PMC-Sierra PM5358 S/UNI 4x622 Power Screwdriver User Manual


 
PM5358 S/UNI-4x622 Driver Manual
Software Architecture
Proprietary and Confidential to PMC-Sierra, Inc. 24
Document ID: PMC-2010419, Issue 1
Calling suni4x622DPR
The sysSuni4x622DPRTask function is a system specific function that runs as a separate task
within the RTOS. You should set the DPR task’s priority higher than the application task(s)
interacting with the S/UNI-4x622 driver. In the message-queue implementation model, this task
has an associated message queue. The task waits for messages from the ISR on this message
queue. When a message arrives,
sysSuni4x622DPRTask calls the DPR (suni4x622DPR) with
the received ISV.
Then
suni4x622DPR processes the status information and takes appropriate action based on the
specific interrupt condition detected. The nature of this processing can differ from system to
system. Therefore,
suni4x622DPR calls different indication callbacks for different interrupt
conditions.
Typically, you should implement these callback functions as simple message posting functions
that post messages to an application task. However, you can implement the indication callback to
perform processing within the DPR task context and return without sending any messages. In this
case, ensure that this callback function does not call any API functions that would change the
driver’s state, such as
suni4x622Delete. Also, ensure that the callback function is
non-blocking because the DPR task executes while S/UNI-4x622 interrupts are disabled. You can
customize these callbacks to suit your system. See page 103 for example implementations of the
callback functions.
Note: Since the
suni4x622ISR and suni4x622DPR routines themselves do not specify a
communication mechanism, you have full flexibility in choosing a communication mechanism
between the two. A convenient way to implement this communication mechanism is to use a
message queue, which is a service that most RTOSs provide.
You must implement the two system specific functions,
sysSuni4x622ISRHandler and
sysSuni4x622DPRTask. When the driver calls sysSuni4x622ISRHandlerInstall, the
application installs
sysSuni4x622ISRHandler in the interrupt vector table of the processor,
and the
sysSuni4x622DPRTask function is spawned as a task by the application. The
sysSuni4x622ISRHandlerInstall function also creates the communication channel between
sysSuni4x622ISRHandler and sysSuni4x622DPRTask. This communication channel is
most commonly a message queue associated with the
sysSuni4x622DPRTask.
Similarly, during removal of interrupts, the driver removes
sysSuni4x622ISRHandler from
the microprocessor’s interrupt vector table and deletes the task associated with
sysSuni4x622DPRTask.
As a reference, this manual provides example implementations of the interrupt installation and
removal functions on pages 109 and 111. You can customize these prototypes to suit your specific
needs.
Calling suni4x622Poll
Instead of using an interrupt service model, you can use a polling service model in the S/UNI-
4x622 driver to process the device’s event-indication registers.
Figure 7 illustrates the polling service model used in the S/UNI-4x622 driver design.