1 driver initialization routine, 2 request dispatch routine, 3 process request routine – Freescale Semiconductor SEC2SWUG User Manual

Page 4: 4 interrupt service routine

Advertising
background image

SEC 2.0 Reference Device Driver User’s Guide, Rev. 0

4

PRELIMINARY—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 interface between

the interrupt service routine and this deferred task.

2.1.2 Request Dispatch Routine

The request dispatch routine provides the

ioctl()

interface to the device driver. It uses the callers request code 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 appropriate 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 provide completion
notification

2.1.3 Process Request Routine

The process request routine translates the request into a sequence of one or more data packet descriptors (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.

Advertising