NeXTSTEPDRIVERKIT:Chapter5 Functions: Difference between revisions

From 흡혈양파의 번역工房
Jump to navigation Jump to search
(NeXTSTEP DRIVER KIT 함수 초반 내용 추가)
(No difference)

Revision as of 06:19, 24 October 2017

Functions

함수

This section describes three types of functions and macros:
이 절에서는 세 가지 유형의 함수 및 매크로에 대해 설명합니다.

  • General-purpose functions--to perform basic tasks
    범용 함수--기본 작업 수행
  • Driver Debugging Module (DDM) functions--to help all drivers keep debugging information
    드라이버 디버깅 모듈 (DDM) 함수--모든 드라이버가 디버깅 정보를 유지할 수 있도록 지원
  • Miscellaneous functions--such as DMA alignment macros, functions that work only in the kernel, and functions specific to a particular machine architecture.
    기타 함수--DMA 정렬 매크로, 커널에서만 작동하는 기능 및 특정 시스템 아키텍처와 관련된 함수 등이 있습니다.


Unless noted otherwise, all of the functions described in this section work in both user-level and kernel-level drivers.
별도로 언급하지 않는한, 이 절에서 설명하는 모든 함수는 사용자 수준 및 커널 수준의 드라이버에서 모두 작동합니다.


드라이버가 사용할 수 있는 기타 함수

Almost all Mach functions are available to kernel-level device drivers. If you don't find the appropriate functionality in a method or function, you can use a Mach function. For example, port_allocate() and msg_send() are used by many drivers.
거의 모든 Mach 함수는 커널 수준 장치 드라이버에서 사용할 수 있습니다. 메서드 또는 함수에서 적절한 기능을 찾지 못한다면, Mach 함수를 사용할 수 있습니다. 예를 들어, port_allocate() 및 msg_send() 는 많은 드라이버에서 사용됩니다.


Note: Instead of including the header file mach/mach.h, you must include mach/mach_user_internal.h and mach/mach_interface.h.
Note: mach/mach.h 헤더 파일을 포함(include)하는 대신에 'mach/mach_user_internal.hmach/mach_interface.h 를 포함(include)해야합니다.


The host_priv_self() Mach function does not work in the kernel. You should use IOHostPrivSelf() instead.
host_priv_self() 라는 Mach 함수는 커널에서 작동하지 않습니다. 그 대신에 IOHostPrivSelf() 를 사용해야합니다.


범용 함수(General-Purpose Functions)

The general-purpose functions, defined in the header file driverkit/generalFuncs.h, provide a consistent interface for device drivers that may have to run in kernel space at one time (or in one configuration) and in user space at another time. Using these functions minimizes the work or porting between the two environments. All the Driver Kit classes, as well all NeXT kernel-level drivers that use the Driver Kit, were written using these functions so that they have one set of source files with minimal kernel and user mode differences.
헤더 파일 driverkit/generalFuncs.h 에 정의된 범용 함수는, 한 번(또는 하나의 설정(configuration))에 커널 공간에서 실행해야하는 장치 드라이버와 다른 시점에 사용자 공간에서 실행해야하는 경에 대한 일관된 인터페이스를 제공합니다. 이러한 기능을 사용하면 두 환경 간의 작업 또는 포팅이 최소화됩니다. Driver Kit 클래스 및 Driver Kit 을 사용하는 모든 NeXT 커널 수준 드라이버는, 이러한 기능을 사용해서 커널 및 사용자 모드의 차이가 최소한인 소스 파일 세트를 가지고 있도록 작성되었습니다.


Warning: Before using any of the general-purpose functions, each user-level driver must call IOInitGeneralFuncs(). (Kernel-level drivers don't need to call it.)
Warning: 각각의 사용자 수준 드라이버는 범용 함수를 사용하기 전에 IOInitGeneralFuncs() 를 호출해야합니다. (커널 수준 드라이버는 호출할 필요가 없습니다.)


스레드 함수(Thread Functions)

These functions provide the functionality of the C-thread functions in a uniform way in both user and kernel space.
이 함수는 사용자 및 커널 공간에서 일관된 방식으로 C 스레드 함수의 기능을 제공합니다.

IOForkThread()
IOSuspendThread()
IOResumeThread()
IOExitThread()



타이머 함수(Timer Functions)

IOSleep()
IODelay()
IOScheduleFunc()
IOUnscheduleFunc()
IOGetTimestamp()



메모리 할당 및 복사 함수(Memory Allocation and Copying Functions)

IOCopyMemory()
IOMalloc()
IOFree()


기타 범용 함수(Miscellaneous General-Purpose Functions)

IOInitGeneralFuncs()
IOFindNameForValue()
IOFindValueForName()
IOLog()
IOPanic()


드라이버 디버깅 모듈(DDM) 함수(Driver Debugging Module (DDM) Functions)

See the "Adding Debugging Code" section in Chapter 2 for information on using the DDM.
DDM 사용에 대한 정보는 2 장의 "Adding Debugging Code" 절을 참조하십시오.

IOAddDDMEntry()
IOClearDDM()
IOCopyString()
IODEBUG()
IOGetDDMEntry()
IOGetDDMMask()
IOInitDDM()
IONsTimeFromDDMMsg()
IOSetDDMMask()


기타 함수(Miscellaneous Functions)

커널 전용 함수(Kernel-Only Functions)

The function IOConvertPort() is necessary for some kernel-level drivers--and not for user-level drivers--because kernel-level drivers can execute in more than one task. The first thread of a kernel-level driver executes in the loadable kernel server's task, any threads that the driver creates execute in the kernel I/O task, and network drivers and drivers with UNIX entry points (at some stage) can execute in the context of an unknown task.
커널 수준 드라이버는 둘 이상의 작업을 실행할 수 있기 때문에, IOConvertPort() 함수는 일부 커널 수준 드라이버에는 필요하지만, 사용자 수준 드라이버에는 필요하지 않습니다. 커널 수준 드라이버의 첫 번째 스레드는 로드 가능한 커널 서버의 작업에서 실행되며, 드라이버가 만드는 모든 스레드는 커널 I/O 작업에서 실행되고, 네트워크 드라이버 및 UNIX 진입점(어떤 단계에서)이 있는 드라이버는 알 수 없는 작업(unknown task)의 컨텍스트에서 실행할 수 있습니다.


IOGetObjectForDeviceName() provides to kernel-level drivers some of the functionality provided to user-level programs by IODeviceMaster. Similarly, IOHostPrivSelf() is used by some kernel-level drivers that need the information normally returned by host_priv_self() (which is one of the few Mach functions that doesn't work in the kernel).
IOGetObjectForDeviceName() 은 IODeviceMaster 에 의해 사용자 수준 프로그램에 제공되는 일부 기능을 커널 수준 드라이버에 제공합니다. 마찬가지로, IOHostPrivSelf()host_priv_self()(커널에서 작동하지 않는 소수의 Mach 함수 중 하나) 가 정상적으로 반환한 정보를 필요로하는 일부 커널 수준 드라이버에 의해 사용됩니다.


The function IOVmTaskSelf() supplies a vm_task_t for Mach function calls that expect one for the kernel; this is necessary because vm_task_t and task_t aren't the same in the kernel (as they are at user level). IOVmTaskCurrent() supplies a vm_task_t that's needed by some UNIX-style drivers. Finally, IOVmTaskForBuf() supplies a vm_task_t for the unknown task that is requesting UNIX-style I/O.
IOVmTaskSelf() 함수는 Mach 함수 호출을 위한 vm_task_t 를 제공하는데, 이는 커널 함수를 대기하게 됩니다; 이 상황은 vm_task_ttask_t 가 커널에서 동일하지 않기 때문에(사용자 수준에 있기 때문에) 필요합니다. IOVmTaskCurrent() 는 일부 UNIX 스타일 드라이버에 필요한 vm_task_t 를 제공합니다. 마지막으로 IOVmTaskForBuf() 는 UNIX 스타일의 I/O 를 요청하는 알 수 없는 작업(unknown task)에 대해 vm_task_t 를 제공합니다.

IOConvertPort()
IOGetObjectForDeviceName()
IOHostPrivSelf()
IOPhysicalFromVirtual()
IOSetUNIXError()
IOVmTaskCurrent()
IOVmTaskForBuf()
IOVmTaskSelf()


DMA 정렬 매크로(DMA Alignment Macros)

IOAlign()
IOIsAligned()


아키텍처 관련 함수(Architecture-Specific Functions)

The following functions are used by some Intel drivers to read and write I/O ports:
일부 인텔 드라이버는 다음 기능을 사용해서 I/O 포트를 읽고 씁니다(read/write):

inb()
inw()
inl()
outb()
outw()
outl()


Some Intel drivers use the following function to help handle interrupts:
일부 인텔 드라이버는 다음 함수를 사용해서 인터럽트를 처리합니다:

IODisableInterrupt()
IOEnableInterrupt()
IOSendInterrupt()


Some Intel devices require memory in the low 16 MB:
일부 인텔 장치는 16MB 이하의 메모리가 필요합니다:

IOMallocLow()


Intel display drivers often use the following functions to read and write VGA registers:
인텔 디스플레이 드라이버는 종종 다음 기능을 사용해서 VGA 레지스터를 읽고 씁니다(read/write):

IOReadRegister()
IOReadModifyWriteRegister()
IOWriteRegister()


Notes