Freescale Semiconductor SEC2SWUG Network Card User Manual


 
SEC 2.0 Reference Device Driver User’s Guide, Rev. 0
42 PRELIMINARY—SUBJECT TO CHANGE WITHOUT NOTICE Freescale Semiconductor
Porting
Only a few of the files in the driver's source distribution contain specific dependencies on operating system
components; this is intentional. Those specific files are:
Sec2Driver.h
sec2_init.c
sec2_io.c
8.1 Header Files
Sec2Driver.h
This header file is meant to be local (private) to the driver itself, and as such, is responsible for including all needed
operating system header files, and casts a series of macros for specific system calls
Of particular interest, this header casts local equivalents macros for:
8.2 C Source Files
sec2_init.c performs the basic initialization of the device and the driver. It is responsible for finding the base
address of the hardware and saving it in IOBaseAddress for later reference.
For Linux, this file also contains references to register/unregister the driver as a kernel module, and to manage it's
usage/link count.
sec2_io.c contains functions to establish:
Channel interlock semaphores (
IOInitSemaphores)
The ISR message queue (
IOInitQs)
Driver service function registration with the operating system (
IORegisterDriver)
ISR connection/disconnection (
IOConnectInterrupt)
8.3 Interrupt Service Routine
The ISR will queue processing completion result messages onto the IsrMsgQId queue. ProcessingComplete()
pends on this message queue. When a message is received, the completion task will execute the appropriate callback
routine based on the result of the processing. When the end-user application prepares the request to be executed,
callback functions can be defined for nominal processing as well as error case processing. If the callback function
was set to
NULL when the request was prepared then no callback function will be executed. These routines will be
executed as part of the device driver so any constraints placed on the device driver will also be placed on the callback
routines.
malloc Allocate a block of system memory with the operating system's heap allocation mechanism.
free Return a block of memory to the system heap
semGive Release a mutex semaphore
semTake Capture and hold a mutex semaphore
__vpa Translate a logical address to a physical address for hardware DMA (if both are equivalent, does nothing).