SEC 2.0 Reference Device Driver User’s Guide, Rev. 0
4PRELIMINARY—SUBJECT TO CHANGE WITHOUT NOTICE Freescale Semiconductor
Device Driver Components
2.1.1 Driver Initialization Routine
The driver initialization routine includes both OS-specific and hardware-specific initialization. The steps taken by
the driver initialization routine are as follows:
Finds the security engine core and sets the device memory map starting address in IOBaseAddress.
Initialize the security engine's registers
Controller registers
Channel registers
—EU registers
Initializes driver internal variables
Initializes the channel assignment table
The device driver will maintain this structure with state information for each channel and user request.
A mutual-exclusion semaphore protects this structure so multiple tasks are prevented from interfering
with each other.
Initializes the internal request queue
This queue holds requests to be dispatched when channels become available. The queue can hold up to
24 requests. The driver will reject requests with an error when the queue is full.
ProcessingComplete() is spawned then pends on the IsrMsgQId which serves as the in terf ace be tween
the interrupt s ervice routin e and this defer red task.
2.1.2 Request Dispatch Routine
The request dispatch routine pr ovides the ioctl() interface to the device driver. It uses the callers request co de to
identify which function is to execute and dispatches the appropriate handler to process the request. The driver
performs a number of tasks that include tracking requests, queuing requests when the requested channel is
unavailable, preparing data packet descriptors, and writing said descriptor's address to the appr opriate channel; in
effect giving the security engine the direction to begin processing the request. The ioctl() function returns to the
end-user application without waiting for the security engine to complete, assuming that once a DPD (data packet
descriptor) is initiated for processing by the hardware, interrupt service may invoke a handler to pr ovide completion
notification
2.1.3 Process Request Routine
The process request routine translates the request into a seque nce of o ne or more d ata pac ket desc riptors ( DPD) and
feeds it to the security engine core to initiate processing. If no channels are available to handle the request, the
request is queued.
2.1.4 Interrupt Service Routine
When processing is completed by the security engine, an interrupt is generated. The interrupt service routine handles
the interrupt and queues the result of the operation in the IsrMsgQId queue for deferred processing by the
ProcessingComplete() deferred service routine.