User guide

MOTOROLA MPC184/MPC185 Security Co-Processor Software User’s Guide 71
PRELIMINARY—SUBJECT TO CHANGE WITHOUT NOTICE
Porting
Linux kernel
init_MUTEX_LOCKED—This call creates the semaphore for later use.
up—This call takes the semaphore, preventing another task from using the resource.
down_timeout—This call gives the semaphore, allowing another process to use the resource.
Linux user
sem_init—This call creates the semaphore for later use.
sem_post—This call takes the semaphore, preventing another task from using the resource.
sem_wait—This call gives the semaphore, allowing another process to use the resource.
6.2 Interrupt Service Routine
As shown in Figure 1, the ISR will queue processing result messages onto the IsrMsgQId queue. The
ProcessingComplete task pends on this message queue. When a message is received this 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. So for example, in Linux,
copy_to and copy_from user space functions will need to be called.
6.3 Conditional Compilation
The majority of an application will be the same regardless of which operating systems is being used. Some
things like semaphores and cache coherency will differ. For these specific differences, conditional
compilations are ideal. Code isolation is also a good method of handling porting issues when used in
conjunction with conditional compilation. The sample code presented in this document used the following
#defines to distinguish between VxWorks, Linux kernel, and Linux user applications. In addition, if
VXWORKS is not defined, then this code assumes that Linux is being used.
#define VXWORKS for VxWorks applications
#define __KERNEL__ for Linux kernel applications (that is, drivers)
#define _LINUX_USER for Linux user applications
In addition, one of the three listed defines must be specified to identify which co-processor is to be used.
MPC185 security processor 60x bus—use
#define MPC185SP
MPC184 security processor PCI bus—use #define MPC184SP_pci
MPC184 security processor 8xx bus—use #define MPC184SP_8xx
NOTE
If more than one of these are defined at the same time, the drivers will not
perform the required functions.