[질문] RedHat 9.0 Kernel 2.4에서 timer를 이용해서 인터럽트를 구현하려고 하는데 방법을 모르겠습니다.

rapperdo의 이미지

리눅스에 처음 이어서 그런지 도무지 감이 잡히질 않습니다.
제가 가지고 있는 책에서는 타이머를 사용하려면

struct timer_list my_timer;
init_timer(&my_timer);
my_timer.expires = jiffies + delay ;
my_timer.data 0 ;
my_timer.function = my_function;
add_timer(&my_timer);

이렇게 하면 쓸수 있다고 설명 되어 있는데 이것을 일반 application에서 쓸수 있는 것인가요?? 다시 말해서 main()에서 위에 부분을 선언을

해주고 그냥 함수 부분만 가저다 쓰면 마이크로 컨트롤러의 타이머 인터럽트 처럼 delay 후 인터럽터 구분으로 뛰는 것인지 알고 싶습니다.

처음 접해봐서 개념이 안잡히니 난감하네요...

이런 개념이 아니라면 어떤 부분 부터 공부를 해야 되는지 대답해 주셨으면 합니다. 매우 난감하네요...ㅎㅎ

제가 쓰려는 의도는 main이 동작하다 일정한 시간이 되면 제가 정해준 인터럽트 함수로 뛰어서 프로그램을 실행하다 다시 main구문으로

돌아오는것입니다. 고수님들의 조언 부탁 드립니다. (- -)(_ _);;

제가 redhat 9.0 kernel 2.4 로 컴파일 했더니

계속 이런 식의 해더 파일에서 에러가 뜨네요....

/usr/include/linux/timer.h:32: field `vec' has incomplete type
/usr/include/linux/timer.h:37: field `vec' has incomplete type
/usr/include/linux/timer.h:45: parse error before "spinlock_t"
/usr/include/linux/timer.h:53: parse error before '}' token
/usr/include/linux/timer.h:63: field `list' has incomplete type
/usr/include/linux/timer.h:67: parse error before "tvec_base_t"
/usr/include/linux/timer.h:101: parse error before "tvec_bases"
/usr/include/linux/timer.h: In function `init_timer':
/usr/include/linux/timer.h:105: dereferencing pointer to incomplete type
/usr/include/linux/timer.h:105: dereferencing pointer to incomplete type
/usr/include/linux/timer.h:105: `NULL' undeclared (first use in this function)
/usr/include/linux/timer.h:105: (Each undeclared identifier is reported only once....

wariua의 이미지

말씀하신 '책'이란 것은 커널 프로그래밍 책을 가리키신 것이겠군요. 커널에서 사용하기 위한 함수(init_timer(), add_timer(), ...)를 사용자 공간의 응용 프로그램에서는 직접 사용할 수 없습니다. 그게 가능하다면 잘못 작성한 응용 프로그램 때문에 시스템이 뻗을 수도 있을 테니까요. 대신 커널은 시스템 호출이라는 형태로 사용자 공간에 여러 '서비스'를 제공합니다. 그리고 glibc 라이브러리가 상당수 시스템 호출에 대한 wrapper 함수를 제공하구요.

말씀하신 기능은 alarm() 함수나 setitimer() 함수를 이용하실 수 있습니다.
----
$PWD `date`

$PWD `date`

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

BBCode

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param>
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

Textile

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • You can use Textile markup to format text.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Markdown

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Plain text

  • HTML 태그를 사용할 수 없습니다.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 줄과 단락은 자동으로 분리됩니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.