User guide
70 MPC184/MPC185 Security Co-Processor Software User’s Guide MOTOROLA
PRELIMINARY—SUBJECT TO CHANGE WITHOUT NOTICE
Porting Porting
6Porting
The following sections describe the main operating system specific concept of semaphores and the interrupt
service routine (ISR), and the required files for the code, configuration, and external variables.
6.1 Include Files
The interface module code uses the file vxWorks.h. This includes standard VxWorks type includes. Using
this code in another system will require redefining those types for that system. For example, the type
UINT32 should be defined as a 32-bit unsigned integer on your target system. In addition, for the semaphore
mechanism the file semLib.h is included, to provide definitions for the semaphore type (SEM_ID) and the
semaphore function calls. This will need to be replaced by the appropriate files depending on the
communication mechanism used for the port.
For Linux, vxWorks.h has been replaced by RTLinux.h. Several drivers also use the ANSI standard string
functions specified in string.h.
The first type of semaphore is the Mutex, which is used to use protect driver structures during critical
updates. There are three calls involved with this semaphore:
• VxWorks
— semMCreate—This call creates the semaphore for later use.
— semTake—This call takes the semaphore, preventing another task from using the resource.
— semGive—This call gives the semaphore, allowing another process to use the resource.
• Linux kernel
— init_MUTEX—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.
The semaphores used in the code are as follows:
• SEM_ID ChannelAssignSemId;
• SEM_ID QueueSemId;
The second types of semaphores are binary semaphores that are used by the test programs to wait for the
ISR. In other multitasking operating systems, these calls should be replaced with the appropriate semaphore
calls for the specific operating system.
There are three calls involved with these semaphores:
• VxWorks
— semBCreate—This call creates the semaphore for later use.
— semTake—This call is used in mainline code to wait on the semaphore. It usually has a timeout
associated with it.
— semGive—This call gives the semaphore allowing the mainline task to continue.










