nckernel  0.1
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions

인터럽트 관련 아키텍쳐 독립적 인터페이스 정의 More...

Collaboration diagram for 인터럽트:

Macros

#define HIGH_PRIORITY   0x80000000
 IRQ 등록시 가장 높은 우선 순위로, 가장 먼저 실행 된다. More...
 
#define LOW_PRIORITY   0x7FFFFFFF
 IRQ 등록시 가장 낮은 우선 순위로, 가장 나중에 실행 된다. More...
 
#define NORMAL_PRIORITY   0
 IRQ 등록시 일반 적인 우선 순위를 정의한다. More...
 

Functions

void disable_interrupt (void)
 인터럽트를 비활성화 시킨다. More...
 
void enable_interrupt (void)
 인터럽트를 활성화 시킨다. More...
 
void irq_local_restore (unsigned long value)
 주어진 인자의 값으로 인터럽트 상태를 복원한다. More...
 
void irq_local_save (unsigned long *value)
 주어진 인자에 현재 인터럽트 상태를 저장하고 인터럽트를 비활성화 시킨다. More...
 
int register_irq (int idx, int priority, int(*handler)(int, void *, void *), void *data)
 인터럽트 핸들러를 등록한다. More...
 
int unregister_irq (int idx, int(*handler)(int, void *, void *), void *data)
 등록된 인터럽트 핸들러를 제거한다. More...
 

Detailed Description

인터럽트 관련 아키텍쳐 독립적 인터페이스 정의

Author
Sung-jae Park nices.nosp@m.j@ni.nosp@m.cesj..nosp@m.com
Date
2011-7-22
  1. Interrupt 란 무엇인가 CPU 는 Bus 또는 In/Out port 를 통해 다양한 외부 장치와 연결이 되어 있다.

데이터를 주고 받는 방법과 유사하게 어떤 변화나 이벤트에 대해서도 CPU 는 알아야 한다.

CPU 가 외부로 부터의 변화를 감지할 수 있는 방법은 외부 장치를 꾸준히 감시하는 방법과 외부 장치가 변화가 생겼을 때 CPU 에게 알려주는 방법이 있다.

전자처럼 꾸준히 감시하는 방법을 Polling 이라고 하며, 후자처럼 외부 장치가 변화를 CPU 에게 알려주는 방법을 인터럽트라 한다.

CPU 는 인터럽트가 발생하면 현재 하던일을 잠시 중단하고, Interrupt 발생 원인을 파악한 후 등록된 인터럽트 서비스 루틴을 실행시켜준다.

Macro Definition Documentation

#define HIGH_PRIORITY   0x80000000

IRQ 등록시 가장 높은 우선 순위로, 가장 먼저 실행 된다.

Definition at line 30 of file interrupt.h.

#define LOW_PRIORITY   0x7FFFFFFF

IRQ 등록시 가장 낮은 우선 순위로, 가장 나중에 실행 된다.

Definition at line 27 of file interrupt.h.

Referenced by arch_init().

#define NORMAL_PRIORITY   0

IRQ 등록시 일반 적인 우선 순위를 정의한다.

Definition at line 33 of file interrupt.h.

Referenced by arch_init(), keyboard_init(), main(), and serial_open().

Function Documentation

void disable_interrupt ( void  )

인터럽트를 비활성화 시킨다.

Definition at line 15 of file interrupt.c.

void enable_interrupt ( void  )

인터럽트를 활성화 시킨다.

Definition at line 10 of file interrupt.c.

void irq_local_restore ( unsigned long  value)

주어진 인자의 값으로 인터럽트 상태를 복원한다.

Parameters
[in]value저장된 인터럽트 상태값.
Returns
void 없음
See Also
irq_local_save()

Definition at line 26 of file interrupt.c.

Referenced by brk(), dma_init(), free(), malloc(), posix_memalign(), pthread_cancel(), pthread_mutex_lock(), pthread_mutex_trylock(), pthread_mutex_unlock(), register_irq(), sbrk(), sem_post(), sem_trywait(), sem_wait(), and unregister_irq().

Here is the caller graph for this function:

void irq_local_save ( unsigned long *  value)

주어진 인자에 현재 인터럽트 상태를 저장하고 인터럽트를 비활성화 시킨다.

Parameters
[in]value저장할 변수
Returns
void 없음
See Also
irq_local_restore()

Definition at line 20 of file interrupt.c.

Referenced by brk(), dma_init(), free(), malloc(), posix_memalign(), pthread_cancel(), pthread_mutex_lock(), pthread_mutex_trylock(), pthread_mutex_unlock(), register_irq(), sbrk(), sem_post(), sem_trywait(), sem_wait(), and unregister_irq().

Here is the caller graph for this function:

int register_irq ( int  idx,
int  priority,
int(*)(int, void *, void *)  handler,
void *  data 
)

인터럽트 핸들러를 등록한다.

Parameters
[in]idx인터럽트 번호
[in]priority인터럽트 처리 우선 순위
[in]handler핸들러 포인터
[in]data인터럽트 핸들러에 전달할 인자
Returns
int 성공시 0, 실패시 에러코드

Insertion sorting

Definition at line 43 of file isr.c.

References list::cnt, irq_handler::data, ENOMEM, free(), irq_handler::handler, list::head, irq_handler::head, list::idx, irq_local_restore(), irq_local_save(), list::list, list_entry, list_for_each, malloc(), list::max_priority, NULL, and irq_handler::priority.

Referenced by arch_init(), keyboard_init(), main(), and serial_open().

Here is the call graph for this function:

Here is the caller graph for this function:

int unregister_irq ( int  idx,
int(*)(int, void *, void *)  handler,
void *  data 
)

등록된 인터럽트 핸들러를 제거한다.

Parameters
[in]idx인터럽트 번호
[in]handler핸들러 포인터
[in]data인터럽트 핸들러에 전달되던 인자
Returns
int 성공시 0, 실패시 에러코드

Definition at line 106 of file isr.c.

References list::cnt, irq_handler::data, ENOENT, free(), irq_handler::handler, list::head, irq_handler::head, list::idx, irq_local_restore(), irq_local_save(), list::list, list_entry, list_for_each_safe, and NULL.

Referenced by arch_init(), keyboard_init(), and serial_close().

Here is the call graph for this function:

Here is the caller graph for this function: