KR20060088929A - Apparatus and method for processing hardware interrupt in linux-based system - Google Patents
Apparatus and method for processing hardware interrupt in linux-based system Download PDFInfo
- Publication number
- KR20060088929A KR20060088929A KR1020050009423A KR20050009423A KR20060088929A KR 20060088929 A KR20060088929 A KR 20060088929A KR 1020050009423 A KR1020050009423 A KR 1020050009423A KR 20050009423 A KR20050009423 A KR 20050009423A KR 20060088929 A KR20060088929 A KR 20060088929A
- Authority
- KR
- South Korea
- Prior art keywords
- interrupt
- application program
- function
- processing module
- hardware
- Prior art date
Links
Images
Classifications
-
- C—CHEMISTRY; METALLURGY
- C01—INORGANIC CHEMISTRY
- C01B—NON-METALLIC ELEMENTS; COMPOUNDS THEREOF; METALLOIDS OR COMPOUNDS THEREOF NOT COVERED BY SUBCLASS C01C
- C01B11/00—Oxides or oxyacids of halogens; Salts thereof
- C01B11/04—Hypochlorous acid
- C01B11/06—Hypochlorites
- C01B11/062—Hypochlorites of alkali metals
-
- B—PERFORMING OPERATIONS; TRANSPORTING
- B01—PHYSICAL OR CHEMICAL PROCESSES OR APPARATUS IN GENERAL
- B01D—SEPARATION
- B01D17/00—Separation of liquids, not provided for elsewhere, e.g. by thermal diffusion
- B01D17/08—Thickening liquid suspensions by filtration
- B01D17/085—Thickening liquid suspensions by filtration with membranes
Landscapes
- Chemical & Material Sciences (AREA)
- Organic Chemistry (AREA)
- Physics & Mathematics (AREA)
- Thermal Sciences (AREA)
- Chemical Kinetics & Catalysis (AREA)
- Life Sciences & Earth Sciences (AREA)
- General Life Sciences & Earth Sciences (AREA)
- Geology (AREA)
- Inorganic Chemistry (AREA)
- Debugging And Monitoring (AREA)
Abstract
본 발명은 리눅스 기반의 시스템에서 하드웨어 인터럽트 처리하기 위한 것으로, 커널 영역에서 동작하는 인터럽트 처리모듈이, 가상의 디바이스를 등록하는 과정과, 응용 프로그램이, 상기 디바이스를 읽기 위한 제1함수를 호출하는 과정과, 상기 인터럽트 처리모듈이, 하드웨어 인터럽트 발생시 유저 영역에 존재하는 가상의 레지스터의 해당 인터럽트 플래그(flag) 비트를 셋(set)하고, 상기 제1함수를 상기 응용 프로그램으로 리턴(return)하는 과정과, 상기 제1함수 리턴시, 상기 응용 프로그램이, 상기 가상의 레지스터의 값을 읽어 하드웨어 인터럽트 종류를 구별하고, 상기 구별된 인터럽트 종류에 따라 해당 프로세스를 웨이크업(wake up)하는 과정을 포함한다. 이와 같은 본 발명은 빠르고 규칙적인 다수의 인터럽트 신호들을 하나의 디바이스와 디바이스 드라이버를 이용하여 응용 프로그램에 전달하기 때문에, 하드웨어 인터럽트를 효율적으로 응용 프로그램에 전달할수 있는 이점이 있다.The present invention is for hardware interrupt processing in a Linux-based system, the interrupt processing module operating in the kernel region, the process of registering a virtual device, the application program, the process of calling the first function for reading the device And setting, by the interrupt processing module, a corresponding interrupt flag bit of a virtual register existing in a user area when a hardware interrupt occurs, and returning the first function to the application program. In response to the first function returning, the application program reads a value of the virtual register to distinguish a hardware interrupt type, and wakes up a corresponding process according to the distinguished interrupt type. As described above, the present invention delivers a plurality of fast and regular interrupt signals to an application program using a single device and a device driver, and thus, hardware interrupts can be efficiently delivered to the application program.
리눅스, 운영 체계, 인터럽트, 커널, 드라이버, 디바이스Linux, Operating System, Interrupt, Kernel, Driver, Device
Description
도 1은 일반적인 내장 시스템(Embedded system)용 운영 체계를 사용하는 시스템에서 인터럽트 처리 구성을 보여주는 도면.1 is a diagram illustrating an interrupt processing configuration in a system using a general operating system for an embedded system.
도 2는 본 발명의 실시예에 따른 리눅스 기반의 시스템에서 하드웨어 인터럽트를 처리하기 위한 구성을 도시하는 도면.2 is a diagram illustrating a configuration for processing hardware interrupts in a Linux based system according to an embodiment of the present invention.
도 3은 도 2에서 설명된 VPIR(202)의 구성을 도시하는 도면.3 is a diagram showing the configuration of the
도 4는 본 발명의 실시예에 따른 리눅스 기반의 시스템에서 응용 프로그램의 하드웨어 인터럽트 처리 절차를 도시하는 도면.4 is a diagram illustrating a hardware interrupt processing procedure of an application in a Linux-based system according to an embodiment of the present invention.
도 5는 본 발명의 실시예에 따른 리눅스 기반의 시스템에서 인터럽트 처리 모듈(디바이스 드라이버)의 인터럽트 처리 절차를 도시하는 도면.5 is a diagram illustrating an interrupt processing procedure of an interrupt processing module (device driver) in a Linux-based system according to an embodiment of the present invention.
도 6은 본 발명의 실시예에 따른 리눅스 기반의 시스템에서 시스템 콜과 디바이스 드라이버 함수의 매핑 관계를 보여주는 도면.6 is a diagram illustrating a mapping relationship between a system call and a device driver function in a Linux based system according to an exemplary embodiment of the present invention.
도 7은 본 발명의 실시예에 따른 리눅스 기반의 시스템에서 응용 프로그램의 리드 블록킹(read blocking)을 설명하는 도면.FIG. 7 illustrates read blocking of an application program in a Linux based system according to an exemplary embodiment of the present invention. FIG.
도 8은 본 발명의 실시예에 따른 리눅스 기반의 시스템에서 응용 프로그램과 인터럽트 처리모듈 사이의 상관 관계를 설명하는 도면.8 is a diagram illustrating a correlation between an application program and an interrupt processing module in a Linux-based system according to an embodiment of the present invention.
도 9는 TDD방식의 통신시스템에서 하드웨어 인터럽트의 활용 예를 보여주는 도면.9 is a diagram illustrating an example of utilizing a hardware interrupt in a TDD communication system.
본 발명은 리눅스 기반의 시스템에서 하드웨어 인터럽트 처리 장치 및 방법에 관한 것으로, 특히 하나의 디바이스 드라이버로 복수의 하드웨어 인터럽트들을 응용 프로그램으로 전달하기 위한 장치 및 방법에 관한 것이다.The present invention relates to an apparatus and method for processing hardware interrupts in a Linux based system, and more particularly, to an apparatus and method for delivering a plurality of hardware interrupts to an application program using one device driver.
리눅스(Linux)는 본래 서버의 운영 체계(O/S : Operating System) 용도로 개발되었기 때문에, 커널 영역(Kernel space)과 유저 영역(User Space)이 서로 독립적으로 존재한다. 따라서, 상기 유저 영역에서 동작하는 응용 프로그램(어플리케이션)은 상기 커널 영역을 침범할 수 없으며, 커널 영역에서만 하드웨어(Hardware)를 직접 억세스할수 있다.Since Linux was originally developed for operating system (O / S) of servers, Kernel space and User space exist independently of each other. Therefore, an application program (application) operating in the user area cannot invade the kernel area, and can directly access hardware only in the kernel area.
리눅스와 달리, 내장 시스템(Embedded system)을 타겟(target)으로 하는 운영 체계인 pSOS, VxWorks, uClinux 등은 도 1에 도시된 바와 같이, 응용 프로그램이 인터럽트 신호를 중간 매개체 없이 보류 인터럽트 레지스터(PIR : Pending Interrupt Register, 도시하지 않음)를 통해 확인하여 바로 인터럽트 서비스 루틴을 수행한다. 그러나, 리눅스의 경우 커널 영역에서 동작하는 프로그램이 인터럽트 를 등록하여 인터럽트 서비스 루틴을 수행해야 한다. 즉, 리눅스는 인터럽트 서비스 루틴이 커널 레벨에서 수행된다. 이때, 서로 다른 종류의 인터럽트 신호들은 회로적으로 분리되어 하드웨어 칩(chip)상에서 커널로 전달되어 각각 처리된다.Unlike Linux, operating systems that target embedded systems (pSOS, VxWorks, uClinux, etc.), as shown in Figure 1, the application interrupts the interrupt signal without intermediary interrupt register (PIR: Check the Pending Interrupt Register (not shown) to immediately execute the interrupt service routine. However, in Linux, a program running in the kernel area must register an interrupt to execute an interrupt service routine. In other words, Linux has an interrupt service routine running at the kernel level. At this time, different types of interrupt signals are separated into circuits and transferred to a kernel on a hardware chip for processing.
이와 같이, 리눅스는 유저 영역과 커널 영역이 명확히 분리되어 있기 때문에, 만일 응용 프로그램에서 하드웨어 인터럽트를 이용해야 하는 경우, 다른 운용체계와 달리 하드웨어 인터럽트를 응용 프로그램으로 전달하기 위한 중간 매개체가 필요하다. 즉, 커널 영역에서 하드웨어 인터럽트를 받아 상위 응용 프로그램으로 전달하기 위한 모듈이 필요하다. As such, Linux has a clear separation between user and kernel space, so if an application needs to use hardware interrupts, unlike other operating systems, it requires an intermediate medium for delivering hardware interrupts to the application. In other words, a module is needed to receive hardware interrupts from the kernel area and deliver them to higher level applications.
응용 프로그램에서 다수의 인터럽트 신호들을 사용해야 하는 경우, 복수의 디바이스들을 등록하고 각각의 디바이스를 별도로 제어하게 되면, 리눅스의 특성상 처리가 번거롭고 응용 프로그램의 동작이 원활하지 못하거나 많은 리소스(resource)가 요구될 수 있다. 따라서, 다수의 하드웨어 인터럽트들을 적은 리소스를 이용해 등록하여 사용하는 방안이 필요하다.If an application needs to use multiple interrupt signals, registering a plurality of devices and controlling each device separately may cause cumbersome processing and inefficient operation of the application or a large amount of resources. Can be. Therefore, there is a need for a method of registering and using a plurality of hardware interrupts using fewer resources.
또한, 응용 프로그램은 커널 레벨에서 전달해주는 인터럽트를 빠르게 받아 처리해야 하는데, 빠른 시간 간격으로 발생하는 인터럽트를 일반적인 응용 프로그램의 시간 배분 스케쥴링에 의존해 처리하게 되면, 인터럽트를 유실하거나 중복된 인터럽트를 모두 처리하지 못하는 문제가 발생한다. 따라서, 다수의 빠르고 연속된 인터럽트들을 유실 없이 처리할수 있는 방안이 필요하다.In addition, an application must receive and process an interrupt that is delivered at the kernel level quickly. If an interrupt that occurs at a high time interval is processed depending on the time-sharing scheduling of a general application, the application will not lose the interrupt or handle any duplicate interrupts. There is a problem. Therefore, there is a need for a method that can handle a large number of fast and continuous interrupts without loss.
따라서 본 발명의 목적은 리눅스 기반의 시스템에서 디바이스 드라이버를 매개체로 하여 하드웨어 인터럽트를 응용 프로그램에 전달하기 위한 장치 및 방법을 제공함에 있다. Accordingly, an object of the present invention is to provide an apparatus and method for delivering hardware interrupts to an application program via a device driver in a Linux based system.
본 발명의 다른 목적은 리눅스 기반의 시스템에서 짧은 시간 간격으로 발생하는 하드웨어 인터럽트를 유실 없이 적은 리소스로 처리하기 위한 장치 및 방법을 제공함에 있다.Another object of the present invention is to provide an apparatus and method for processing hardware interrupts occurring at short time intervals in Linux-based systems with low resources without loss.
본 발명의 또 다른 목적은 리눅스 기반의 시스템에서 하나의 디바이스 드라이버로 복수의 하드웨어 인터럽트들을 응용 프로그램으로 전달하기 위한 및 방법을 제공함에 있다.Another object of the present invention is to provide a method and method for delivering a plurality of hardware interrupts to an application program as a device driver in a Linux-based system.
상기 목적들을 달성하기 위한 본 발명의 제1견지에 따르면, 리눅스 기반의 시스템에서 하드웨어 인터럽트를 처리하기 위한 장치는, 커널 영역에서 동작하며, 하드웨어 인터럽트 발생시 유저(user) 영역에 존재하는 가상의 레지스터의 해당 인터럽트 플래그(flag) 비트를 셋(set)하고, 소정 함수를 응용 프로그램부로 리턴(return)하는 인터럽트 처리모듈과, 상기 소정 함수 리턴시 상기 가상의 레지스터의 값을 읽어 하드웨어 인터럽트 종류를 구별하고, 상기 구별된 인터럽트 종류에 따라 해당 프로세스를 웨이크업(wake up)하는 상기 응용 프로그램부를 포함하는 것을 특징으로 한다.According to the first aspect of the present invention for achieving the above objects, an apparatus for processing a hardware interrupt in a Linux-based system, operating in the kernel region, of the virtual register existing in the user region when a hardware interrupt occurs An interrupt processing module that sets a corresponding interrupt flag bit, returns a predetermined function to an application program unit, and distinguishes a hardware interrupt type by reading a value of the virtual register upon returning the predetermined function; And the application program unit for waking up a corresponding process according to the distinguished interrupt type.
본 발명의 제2견지에 따르면, 리눅스 기반의 시스템에서 하드웨어 인터럽트 처리 방법은, 커널 영역에서 동작하는 인터럽트 처리모듈이, 가상의 디바이스를 등록하는 과정과, 응용 프로그램이, 상기 디바이스를 읽기 위한 제1함수를 호출하는 과정과, 상기 인터럽트 처리모듈이, 하드웨어 인터럽트 발생시 유저 영역에 존재하는 가상의 레지스터의 해당 인터럽트 플래그(flag) 비트를 셋(set)하고, 상기 제1함수를 상기 응용 프로그램으로 리턴(return)하는 과정과, 상기 제1함수 리턴시, 상기 응용 프로그램이, 상기 가상의 레지스터의 값을 읽어 하드웨어 인터럽트 종류를 구별하고, 상기 구별된 인터럽트 종류에 따라 해당 프로세스를 웨이크업하는 과정을 포함하는 것을 특징으로 한다.
According to a second aspect of the present invention, a hardware interrupt processing method in a Linux-based system includes a process in which an interrupt processing module operating in a kernel region registers a virtual device, and an application program reads the device. Calling the function, and the interrupt processing module sets a corresponding interrupt flag bit of a virtual register existing in the user area when a hardware interrupt occurs, and returns the first function to the application program ( returning the first function, and the application program reads the value of the virtual register to distinguish a hardware interrupt type and wakes up a corresponding process according to the distinguished interrupt type. It is characterized by.
이하 본 발명의 바람직한 실시예를 첨부된 도면의 참조와 함께 상세히 설명한다. 본 발명을 설명함에 있어서, 관련된 공지기능 혹은 구성에 대한 구체적인 설명이 본 발명의 요지를 불필요하게 흐릴 수 있다고 판단된 경우 그 상세한 설명은 생략한다.Hereinafter, preferred embodiments of the present invention will be described in detail with reference to the accompanying drawings. In describing the present invention, if it is determined that the detailed description of the related known function or configuration may unnecessarily obscure the subject matter of the present invention, the detailed description thereof will be omitted.
이하 본 발명은 리눅스 기반의 시스템에서 짧은 시간 간격으로 발생하는 하드웨어 인터럽트를 유실 없이 적은 리소스로 처리하기 위한 방안에 대해 살펴보기로 한다. Hereinafter, a method for processing hardware interrupts occurring at short time intervals in Linux-based systems with less resources without losing them will be described.
도 2는 본 발명의 실시예에 따른 리눅스 기반의 시스템에서 하드웨어 인터럽트를 처리하기 위한 구성을 도시하고 있다.2 illustrates a configuration for processing hardware interrupts in a Linux-based system according to an embodiment of the present invention.
도시된 바와 같이, 리눅스 기반의 시스템은 크게 유저 영역(User Space)(200), 커널 영역(210) 및 하드웨어(220)로 구분된다. 본 발명에 따라 상기 커널 영역(Kernel Space)(210)에는 하드웨어 인터럽트를 응용 프로그램 (Application)(201)으로 전달하기 위한 인터럽트 처리모듈(211)이 구성되고, 상기 유저 영역(200)에는 상기 인터럽트 처리모듈(210)로부터 전달되는 인터럽트를 기록하기 위한 가상 보류 인터럽트 레지스터(VPIR : Virtual Pending Interrupt Register)(202)가 구성된다. 여기서, 상기 인터럽트 처리모듈(211)은 인터럽트를 신속히 처리하기 위해서 특성 디바이스 드라이버(character device driver)를 이용해 구현하는 것이 바람직하다. 여기서, 상기 특성 디바이스 드라이버는 파일처럼 접근할수 있는 특성 디바이스(character device)를 지원하기 위한 드라이버이다. 한편, 상기 특성 디바이스는 스트림 추상화로 표현할수 있으며 파일 시스템 노드를 만들어 접근할수 있다. 일반적으로, 리눅스 기반의 시스템에서 디바이스 드라이버는 디바이스를 지원하기 위해 존재하지만, 본 발명에서는 디바이스 드라이버를 사용하기 위해 가상의 디바이스를 등록한다. As shown, a Linux-based system is largely divided into a user space 200, a kernel area 210, and a hardware 220. According to the present invention, an
도 2를 참조하면, 먼저 응용 프로그램(201)은 초기화시 커널 영역(210)에 존재하는 상기 특성 디바이스를 오픈(오픈 시스템 콜)하고, 상기 오픈된 디바이스를 읽는 동작(리드 시스템 콜)을 한후 인터럽트가 들어올 때까지 대기한다. 이후, 상기 리드함수(read ())가 리턴(return)되면, 상기 응용 프로그램(201)은 상기 VPIR(202)의 값을 읽어 인터럽트 종류를 구별하고, 상기 인터럽트 종류에 따라 해당 쓰레드(또는 프로세스)를 웨이크업(wake up)하여 해당 동작(job)을 수행한다. Referring to FIG. 2, an
이때, 상기 응용 프로그램(201)의 메인 프로세스(main process)는 다른 프로세스의 동작에 관계없이 상기 VPIR(202)의 해당 비트를 리셋(reset)하고 다시 리드함수(read())를 호출한후 대기한다. 즉, 상기 메인 프로세스는 지연(delay) 없이 리드함수(read())를 호출할수 있도록 높은 우선순위를 가진다. 가령, 다른 사용자가 로그인(login)하여 셸(shell) 권한을 획득하려 하거나 ftp(file transfer protocol)로 파일 전송 등을 수행할 경우, 일반 프로세스 보다 우선 순위가 높기 때문에 응용 프로그램(201)에서 리드 시스템 콜(read system call) 타이밍이 지연될 수 있는 문제가 발생할수 있다. 따라서, 상기 메인 프로세서는 이러한 프로세스들보다는 높은 우선순위를 갖도록 설정하는 것이 바람직하다. 일 예로, 인터럽트 감지를 위한 메인 프로세스(메인 쓰레드)의 우선순위를 '30'으로 하고 일반 프로세스의 우선순위를 '15'로 하여 테스트하였을 때 위와 같은 문제는 발생하지 않는다.At this time, the main process of the
상기 인터럽트 처리 모듈(211)은 초기화시 특성 디바이스 형태(파일 형태)의 가상 디바이스를 등록한다. 이후, 상기 응용 프로그램(201)에서 상기 가상 디바이스를 오픈(open)할 경우, 상기 인터럽트 처리 모듈(211)은 인터럽트 신호 입력포트의 마스크(mask)를 해제하여 인터럽트를 받을 준비를 하고, 해당 인터럽트를 사용하겠다고 커널(또는 커널의 코어)에 등록한다. 즉, 상기 인터럽트 처리 모듈(211)은 인터럽트 서비스 루틴의 주소와 자신이 사용하고 싶은 인터럽트 번호를 상기 커널에 등록한다. 이후, 상기 어플리케이션(201)에서 리드함수(read())를 호출하면, 상기 인터럽트 처리 모듈(211)은 하드웨어 인터럽트의 발생(또는 커널의 호출에 의한 인터럽트 서비스 루틴의 수행)을 대기한다. 상기 하드웨어 인터럽트가 발생하면, 상기 인터럽트 처리모듈(211)은 상기 유저 영역(200)에 존재하는 상기 VPIR(202)의 해당 비트를 셋(set)하고 상기 리드함수를 리턴(return)하여 잠들어 있는 어플리케이션(201)의 대기 프로세스(또는 쓰레드)를 웨이크업(wake up)한다.The
도 3은 도 2에서 설명된 VPIR(202)의 구성을 도시하고 있다.3 illustrates the configuration of the
도시된 바와 같이, 본 발명에 따른 VPIR(202)는 1 바이트(byte)의 가상의 레지스터로 구현되고, 각각의 비트는 인터럽트의 종류를 나타내는 플래그(flag)로 사용된다. 여기서, 최하위 비트(Bit 0)는 가장 높은 우선순위의 인터럽트가 기록되고, 최상위 비트(Bit 7)는 가장 낮은 우선순위의 인터럽트가 기록되는 것으로 가정한다. 이와 같이, 레지스터의 비트 위치에 따라 인터럽트 우선순위가 정해지기 때문에 복수의 인터럽트들이 동시에 발생할 경우 응용 프로그램(201)은 인터럽트를 우선순위에 따라 차례로 처리할수 있다. 예를들어, 1ms 간격으로 발생되는 인터럽트(1ms 인터럽트)와 5ms 간격으로 발생하는 인터럽트(5ms)의 2종류 인터럽트가 사용된다고 가정할 때, 상기 VPIR(202)의 첫 번째 비트(Bit 0)는 1ms 인터럽트 플래그 비트(interrupt flag bit)로 할당하고, 두 번째 비트(Bit 1)는 5ms 인터럽트 플래그 비트로 할당한다. 이때 보류된(reserved) 플래그 비트들(Bit 2 내지 Bit 7)은 처리해야할 인터럽트가 추가될 때마다 추가로 할당될 수 있다. As shown, the
상기한 바와 같이, 본 발명은 하나의 디바이스 드라이버를 이용해 복수의 인터럽트들을 처리하는 것을 특징으로 한다. 다시 말해, 응용 프로그램(201)에서 오픈(open)하고 리드(read)할 디바이스 역시 하나이며 하나의 디바이스 파일을 이용하여 복수의 인터럽트들을 모두 처리할수 있다.As described above, the present invention is characterized by processing a plurality of interrupts using one device driver. In other words, there is also one device to be opened and read in the
도 4는 본 발명의 실시예에 따른 리눅스 기반의 시스템에서 응용 프로그램의 하드웨어 인터럽트 처리 절차를 도시하고 있다.4 illustrates a hardware interrupt processing procedure of an application program in a Linux based system according to an exemplary embodiment of the present invention.
도 4를 참조하면, 먼저 응용 프로그램(201)은 401단계에서 인터럽트 처리모둘(211)이 관리하는 가상 특성 디바이스를 오픈(open)하기 위한 오픈 시스템 콜(open system call)을 수행한다. 이때, 도 6에 도시된 바와 같이, 상기 오픈 시스템 콜에 의해 상기 인터럽트 처리 모듈(211)의 지정된 함수(mydevice_open)가 수행된다. Referring to FIG. 4, in
상기 특성 디바이스를 오픈한후, 상기 응용 프로그램(201)은 403단계에서 상기 특성 디바이스를 읽기 위한 리드 시스템 콜(read system call)을 수행한다. 이때, 도 6에 도시된 바와 같이, 상기 리드 시스템 콜에 의해 상기 인터럽트 처리 모듈(211)의 지정된 함수(mydevice_read)가 수행된다. After opening the feature device, the
이와 같이, 응용 프로그램(201)에서 디바이스를 오픈(open), 클로즈(close), 리드(read), 라이트(write)하는 시스템 콜(system call)을 수행할 경우, 상기 인터럽트 처리 모듈(211)의 지정된 함수가 수행된다. 즉, 커널의 모듈이 응용 프로그램과 통신하기 위해서는 디바이스가 등록되어야 한다. 이러한 측면에서 본 발명은 디바이스 드라이버(인터럽트 처리 모듈)를 사용하기 위해 가상의 디바이스를 등록하는 것이다.As such, when an
한편, 상기 응용 프로그램(201)은 도 7에 도시된 바와 같이, 상기 리드 시스템 콜을 수행한 후 해당 함수가 리턴될 때까지 블록킹(blocking)된다. 상기 해당 함수가 리턴(return)되어 리드함수의 동작이 종료되면, 상기 응용 프로그램(201)은 405단계로 진행하여 VPIR(202)의 값을 읽어 인터럽트 종류를 구별하고, 상기 인터럽트 종류에 따라 해당 쓰레드(또는 프로세스)를 웨이크업(wake up)하여 해당 동작 (job)을 수행한다.Meanwhile, as shown in FIG. 7, the
도 5는 본 발명의 실시예에 따른 리눅스 기반의 시스템에서 인터럽트 처리 모듈(디바이스 드라이버)의 인터럽트 처리 절차를 도시하고 있다.5 illustrates an interrupt processing procedure of an interrupt processing module (device driver) in a Linux-based system according to an embodiment of the present invention.
도 5를 참조하면, 먼저 초기화시 인터럽트 처리 모듈(211)은 501단계에서 특성 디바이스(character device) 형태의 가상 디바이스를 등록한다. 이후, 상기 인터럽트 처리 모듈(211)은 503단계에서 상기 응용 프로그램(201)의 오픈 시스템 콜(open system call)에 의해 상기 디바이스가 오픈(open)되는지 검사한다. 도 6에 도시된 바와 같이, 상기 인터럽트 처리 모듈(211)은 상기 응용 프로그램(201)의 오픈 시스템 콜에 의해 지정된 함수(mydevice_open)를 수행한다. 상기 지정된 함수에 의해 상기 인터럽트 처리모듈(211)은 인터럽트 신호 입력포트(레지스터)의 마스크(mask)를 해제(unmask)되고, 해당 인터럽트의 사용을 커널(또는 커널의 코어)에 등록한다.Referring to FIG. 5, in initialization, the interrupt
이와 같이 인터럽트를 받을 준비가 되면, 상기 인터럽트 처리 모듈(211)은 505단계에서 하드웨어 인터럽트가 발생하는지 검사한다. 상기 하드웨어 인터럽트는 상기 커널에서 감지되고, 상기 커널은 인터럽트가 감지될시 상기 인터럽트 처리 모듈(211)내 인터럽트 서비스 루틴을 호출(call)하여 인터럽트 서비스 루틴을 실행한다.When the interrupt is ready to be received, the interrupt
상기 하드웨어 인터럽트의 발생에 의해 상기 인터럽트 서비스 루틴이 실행되면, 상기 인터럽트 처리 모듈(211)은 607단계로 진행하여 상기 응용 프로그램(201) 의 시스템 콜에 의해 리드함수가 호출된 상태인지를 검사한다. 즉, 상기 응용 프로그램(210)에서 인터럽트를 받을 준비가 되어있는지를 검사한다.When the interrupt service routine is executed by the occurrence of the hardware interrupt, the interrupt
만일 상기 리드함수가 호출된 상태가 아니면, 상기 인터럽트 처리 모듈(211)은 상기 505단계로 되돌아가 이하 단계를 재수행한다. 만일 상기 리드함수가 호출된 상태이면, 상기 인터럽트 처리 모듈(211)은 509단계로 진행하여 유저 영역(200)에 존재하는 VPIR(202)의 해당 인터럽트 플래그를 셋(set)한다. 그리고 상기 인터럽트 처리 모듈(211)은 511단계에서 해당 쓰레드(또는 프로세스)를 웨이크업하기 위해 상기 리드함수를 상기 응용 프로그램(201)으로 리턴(return)한후 상기 505단계로 되돌아간다.If the read function is not called, the interrupt
도 8은 본 발명의 실시예에 따른 리눅스 기반의 시스템에서 응용 프로그램과 인터럽트 처리모듈 사이의 상관관계를 설명하는 도면이다.8 is a diagram illustrating a correlation between an application program and an interrupt processing module in a Linux-based system according to an embodiment of the present invention.
도 8을 참조하면, 먼저 인터럽트 처리모듈(211)은 초기화시 특성 디바이스 형태의 가상 디바이스를 등록한다. 일반적으로, 리눅스 기반의 시스템에서 디바이스 드라이버는 디바이스를 관리하기 위한 것이지만, 본 발명에서는 디바이스 드라이버(인터럽트 처리모듈)를 사용하기 위해서 가상의 디바이스를 등록한다. 상기 가상의 디바이스를 등록한후, 상기 인터럽트 처리모듈(211)은 응용 프로그램(201)에서 오픈 시스템 콜(open system call)을 할 때까지 대기한다. 즉, 상기 인터럽트 처리모듈(211)은 이벤트 구동(event driven) 방식으로 동작한다.Referring to FIG. 8, first, the interrupt
한편, 상기 응용 프로그램(201)은 803단계에서 상기 가상 디바이스를 오픈하 기 위한 오픈 시스템 콜(open system call)을 수행한다. 상기 오픈 시스템 콜에 의해 상기 인터럽트 처리모듈(211)은 805단계에서 지정된 함수(mydevice_open)를 수행한다. 상기 지정된 함수에 의해 상기 인터럽트 처리모듈(211)은 인터럽트 신호 입력포트의 마스크(mask)를 해제하고(unmask), 해당 인터럽트를 사용할수 있도록 커널로 인터럽트를 요청한다.In
상기 오픈 시스템 콜을 발행한후, 상기 응용 프로그램(201)은 807단계에서 리드 시스템 콜(read system call)을 수행하여 하드웨어 인터럽트를 받을 준비를 한다. 여기서, 상기 응용 프로그램(201)은 상기 리드 시스템 콜을 수행한후 해당 함수가 리턴(return)될 때까지 블록킹(blocking)된다. After issuing the open system call, the
한편, 상기 리드 시스템 콜에 의해 상기 인터럽트 처리모듈(211)은 809단계에서 지정된 함수(mydevice_read)를 수행한다. 상기 지정된 함수를 수행한후, 상기 인터럽트 처리모듈(211)은 811단계에서 하드웨어 인터럽트의 발생을 대기한다. 상기 하드웨어 인터럽트는 커널에서 감지되고, 상기 커널은 상기 인터럽트가 감지될시 상기 인터럽트 처리모듈(211)내 인터럽트 서비스 루틴을 호출(call)하여 인터럽트 서비스 루틴을 실행한다.In response to the read system call, the interrupt
상기 하드웨어 인터럽트에 의해 상기 인터럽트 서비스 루틴이 수행되면, 상기 인터럽트 처리모듈(211)은 813단계로 진행하여 유저 영역(200)에 존재하는 VPIR(202)의 해당 인터럽트 플래그를 셋(set)한다. 그리고 상기 인터럽트 처리 모듈(211)은 815단계에서 상기 리드 함수를 상기 응용 프로그램(201)으로 리턴(return)한후 상기 811단계로 되돌아간다.When the interrupt service routine is performed by the hardware interrupt, the interrupt
한편, 상기 리드 함수가 리턴되면, 상기 응용 프로그램(201)은 817단계에서 상기 VPIR(202)의 값을 읽어 인터럽트의 종류를 구별한다. 그리고 상기 응용 프로그램(201)은 819단계에서 상기 인터럽트 종류에 따라 해당 쓰레드(또는 프로세스)를 웨이크업(wake up)하여 해당 동작(job)을 수행한다. 동시에, 상기 응용 프로그램(201)은 인터럽트를 대기하는 메인 프로세스에 의해 809단계로 되돌아가 이하 단계를 재수행한다. 즉, 상기 응용 프로그램(201)의 메인 프로세스(main process)는 다른 프로세스의 동작에 관계없이 VPIR(202)의 정보만 확인하고, 그 즉시 다시 리드 시스템 콜을 수행하여 다음 인터럽트를 기다린다. 이와 같이, 응용 프로그램중 인터럽트를 대기하는 메인 프로세스(쓰레드)는 높은 우선순위를 갖도록 설정하여 다른 프로세스에 밀려 리드함수를 호출하는 타이밍을 놓치지 않도록 한다.On the other hand, when the read function is returned, the
이하 본 발명의 보다 나은 이해를 돕기 위해 TDD(Time Division Duplex) 방식으로 동작하는 통신시스템을 예를들어 살펴보기로 한다. Hereinafter, a communication system operating in a time division duplex (TDD) scheme will be described as an example for better understanding of the present invention.
상기 TDD방식은 단말기와 기지국 사이의 상향링크 및 하향링크를 시간으로 구별하는 방식이다. 이러한 TDD 방식을 사용하는 통신시스템은 예를들어 프레임(frame) 기준점을 결정하는 5ms 클럭(clock)과 작업 시작 시점을 결정하는 1ms 클럭에 따라 응용 프로그램(application)이 동작한다. 따라서, 응용 프로그램이 제대로 동작하기 위해서는 하드웨어에서 발생되는 클럭(또는 타이머 인터럽트)들이 유실되지 않고 정확히 응용 프로그램에 전달되어야 한다. 이를 위해 본 발명은 커널 영역에 특성 디바이스 드라이버 형태의 인터럽트 처리 모듈을 구현하고, 상기 인터 럽트 처리모듈에서 하드웨어 인터럽트를 받아 응용 프로그램으로 전달한다. 그러면, 이하에서 상기 응용 프로그램에서의 하드웨어 인터럽트 사용예를 구체적으로 살펴보기로 한다.The TDD scheme distinguishes an uplink and a downlink between a terminal and a base station by time. In a communication system using the TDD scheme, for example, an application operates according to a 5 ms clock that determines a frame reference point and a 1 ms clock that determines a start time of a task. Therefore, in order for an application to function properly, clocks (or timer interrupts) generated by hardware must be delivered to the application program correctly without being lost. To this end, the present invention implements an interrupt processing module in the form of a specific device driver in the kernel region, receives a hardware interrupt from the interrupt processing module, and delivers it to an application program. Next, an example of using hardware interrupts in the application program will be described in detail.
도 9는 TDD방식의 통신시스템에서 하드웨어 인터럽트의 사용예를 보여주는 도면이다.9 is a diagram illustrating an example of using a hardware interrupt in a TDD communication system.
도시된 바와 같이, 하드웨어에서는 GPS(Global Positioning System) 클럭에 동기되어 5ms 간격으로 5ms 인터럽트(또는 tick)를 발생하고, 1ms 간격으로 1ms 인터럽트를 발생한다. 이렇게 발생되는 인터럽트들은 본 발명에 따른 인터럽트 처리 모듈(211)에 의해 응용 프로그램(201)으로 전달된다.As shown in the figure, the hardware generates 5 ms interrupts (or ticks) at 5 ms intervals and 1 ms interrupts at 1 ms intervals in synchronization with the GPS (Global Positioning System) clock. The interrupts generated as described above are transmitted to the
참조부호 901은 5ms 인터럽트를 나타내고, 참조부호 903 내지 911은 1ms 인터럽트를 나타낸다. 5ms 프레임 틱을 기준으로 5ms 구간동안 다섯 번의 1ms 쓰레드 컨트롤 틱(thread control tick)이 발생한다. 즉, 5ms 마다 프레임이 시작되고, 1ms 틱을 카운트 업(count up)하여 해당 동작(job)을 수행한다. 1ms 마다 해당 쓰레드를 웨이크업(wake up)하여 해당 작업을 수행하며, 다른 쓰레드(또는 프로세스)가 동작하는 동안에도 인터럽트를 인식하여 다른 작업을 시작할수 있다.
VPIR(202)를 읽어 5ms 인터럽트(901)가 감지되면, 상기 응용 프로그램(201)은 프레임 시작을 인식하고 다음 1ms인터럽트를 대기한다. 이후 첫 번째 1ms 인터럽트(903)가 감지되면, 상기 응용 프로그램(201)은 쓰레드2(Thread2)를 웨이크업하여 하향링크(downlink) 제어 메시지(control massage)를 메모리에 기록함으로서 하향링크 통신을 진행한다. 여기서, 상기 첫 번째 1ms 인터럽트는 도시된 바와 같이 정해진 규격에 따라 상기 5ms 인터럽트(901)가 발생한 시점으로부터 소정시간(??) 경과된 시점에서 발생된다. If a 5ms interrupt 901 is detected by reading the
이후, 두 번째 1ms 인터럽트가 감지되면, 상기 응용 프로그램(201)은 쓰레드3(Thread3)을 웨이크업하여 메모리에서 데이터를 읽는(read) 동작을 수행한다. 이후, 세 번째 1ms 인터럽트가 감지되면, 상기 응용 프로그램(201)은 쓰레드1(Thread1)을 웨이크업하여 해당 작업(Read uplink)을 수행한다. 이때, 상기 쓰레드3은 상기 세 번째 1ms 인터럽트에 의해 쓰기(write) 동작을 수행한다. Then, when the second 1ms interrupt is detected, the
이후, 네 번째 1ms 인터럽트가 감지되면, 상기 응용 프로그램(201)은 상기 쓰레드3(Thread3)을 웨이크업하여 쓰기(write) 동작을 수행함으로서 상향링크 통신을 진행한다. 이후, 다시 5ms 인터럽트가 감지되면, 상기 응용 프로그램(201)은 다음 프레임에 대한 작업을 진행한다.Then, when the fourth 1ms interrupt is detected, the
한편 본 발명의 상세한 설명에서는 구체적인 실시예에 관해 설명하였으나, 본 발명의 범위에서 벗어나지 않는 한도 내에서 여러 가지 변형이 가능함은 물론이다. 그러므로 본 발명의 범위는 설명된 실시예에 국한되어 정해져서는 아니 되며 후술하는 특허청구의 범위뿐만 아니라 이 특허청구의 범위와 균등한 것들에 의해 정해져야 한다.Meanwhile, in the detailed description of the present invention, specific embodiments have been described, but various modifications are possible without departing from the scope of the present invention. Therefore, the scope of the present invention should not be limited to the described embodiments, but should be determined not only by the scope of the following claims, but also by those equivalent to the scope of the claims.
상술한 바와 같이, 본 발명은 리눅스 시스템에서 하드웨어 인터럽트를 효율 적으로 응용 프로그램에 전달할수 있다. 특히, 빠르고 규칙적인 다수의 인터럽트 신호들을 하나의 디바이스와 디바이스 드라이버를 이용하여 응용 프로그램에 전달하기 때문에 적은 리소스로 하드웨어 인터럽트를 처리할수 있는 효과를 가진다. 또한, 인터럽트를 대기하는 쓰레드에 높은 우선순위를 부여함으로써 하드웨어 인터럽트를 유실하지 않고 처리할수 있는 이점이 있다. As described above, the present invention can efficiently deliver hardware interrupts to an application program in a Linux system. In particular, since it transmits a number of fast and regular interrupt signals to an application program using one device and a device driver, hardware interrupts can be processed with less resources. In addition, by giving a high priority to a thread waiting for an interrupt, there is an advantage that can be handled without losing hardware interrupts.
Claims (19)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
KR1020050009423A KR20060088929A (en) | 2005-02-02 | 2005-02-02 | Apparatus and method for processing hardware interrupt in linux-based system |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
KR1020050009423A KR20060088929A (en) | 2005-02-02 | 2005-02-02 | Apparatus and method for processing hardware interrupt in linux-based system |
Publications (1)
Publication Number | Publication Date |
---|---|
KR20060088929A true KR20060088929A (en) | 2006-08-07 |
Family
ID=37177164
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
KR1020050009423A KR20060088929A (en) | 2005-02-02 | 2005-02-02 | Apparatus and method for processing hardware interrupt in linux-based system |
Country Status (1)
Country | Link |
---|---|
KR (1) | KR20060088929A (en) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
KR100915803B1 (en) * | 2006-12-05 | 2009-09-07 | 한국전자통신연구원 | Application Program Launching Method and System for Improving Security of Embedded Linux Kernel |
KR20160071062A (en) * | 2014-12-11 | 2016-06-21 | 주식회사 한국스마트카드 | USB device driver activation method for authorized user at embedded terminal device and an embedded terminal for the same method |
CN112631975A (en) * | 2020-12-09 | 2021-04-09 | 珠海全志科技股份有限公司 | Linux-based SPI transmission method |
-
2005
- 2005-02-02 KR KR1020050009423A patent/KR20060088929A/en not_active Application Discontinuation
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
KR100915803B1 (en) * | 2006-12-05 | 2009-09-07 | 한국전자통신연구원 | Application Program Launching Method and System for Improving Security of Embedded Linux Kernel |
US8677477B2 (en) | 2006-12-05 | 2014-03-18 | Samsung Electronics Co., Ltd. | Application program launching method and system for improving security of embedded Linux kernel |
KR20160071062A (en) * | 2014-12-11 | 2016-06-21 | 주식회사 한국스마트카드 | USB device driver activation method for authorized user at embedded terminal device and an embedded terminal for the same method |
CN112631975A (en) * | 2020-12-09 | 2021-04-09 | 珠海全志科技股份有限公司 | Linux-based SPI transmission method |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
JP2525997B2 (en) | I / O interrupt subclass recognition method | |
US7062615B2 (en) | Multi-channel memory access arbitration method and system | |
KR100267130B1 (en) | Pci bus system | |
EP1645968B1 (en) | Multi-threaded DMA | |
GB2219420A (en) | Interrupt handling apparatus and method | |
JP2008522277A (en) | Efficient switching between prioritized tasks | |
US5859987A (en) | Method and apparatus for providing multiple configuration reset modes for an intelligent bridge | |
US5544333A (en) | System for assigning and identifying devices on bus within predetermined period of time without requiring host to do the assignment | |
CA2145404C (en) | Automatic logical cpu assignment of physical cpus | |
KR20060088929A (en) | Apparatus and method for processing hardware interrupt in linux-based system | |
US4628445A (en) | Apparatus and method for synchronization of peripheral devices via bus cycle alteration in a microprocessor implemented data processing system | |
CN108958903B (en) | Embedded multi-core central processor task scheduling method and device | |
KR102303424B1 (en) | Direct memory access control device for at least one processing unit having a random access memory | |
US20020120800A1 (en) | Launch raw packet on remote interrupt | |
US11360702B2 (en) | Controller event queues | |
US5875289A (en) | Method and system for simulating auto-init mode DMA data transfers | |
US7103528B2 (en) | Emulated atomic instruction sequences in a multiprocessor system | |
US7434223B2 (en) | System and method for allowing a current context to change an event sensitivity of a future context | |
JPWO2006001051A1 (en) | Multiprocessor device and control method thereof | |
JP2003507815A (en) | Interrupt service with save and return flags | |
KR0182709B1 (en) | Communication method between processors in switching system | |
JPS5926158B2 (en) | Overload control method | |
US20090265721A1 (en) | Information processing apparatus, information processing method, and computer program | |
CN108958905B (en) | Lightweight operating system of embedded multi-core central processing unit | |
JPH0656602B2 (en) | Priority control system for processors with cache |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
WITN | Withdrawal due to no request for examination |