This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Difference in Syslink Samples from what is Documented

Other Parts Discussed in Thread: SYSBIOS

In examining the sample code for the Gate implementation in Syslink 2_00_00_68,  I see a difference between what has been coded and the documentation.

The sample hlos code( GateMPApp.c):

if (status >= 0) {

GateMP_Params_init (&gateMPParams);

gateMPParams.remoteProtect = GateMP_RemoteProtect_SYSTEM;

gateMPParams.sharedAddr = NULL;

/* Calculate the size for System Gate and shared buffer*/

sharedMemSize = GateMP_sharedMemReq (&gateMPParams) + BYTES_TO_PROCESS;

/* Allocate memory for GateMP */

gateMPParams.sharedAddr = Memory_alloc (srHeap,

sharedMemSize,

0,

NULL);

if (NULL == gateMPParams.sharedAddr) {

Memory_free (srHeap,

(Ptr) (buffer),

BYTES_TO_PROCESS);

status = -1;

Osal_printf ("Memory_alloc failed."

" when allocating %x bytes!.\n",

sharedMemSize);

}

else {

/* Now create the actual gate */

Osal_printf ("Creating the GateMP\n");

gateMPParams.name = "HOSTGATE";

hostGate = GateMP_create (&gateMPParams);

The example given in the Sys/bios Inter-Processor Communication and I/O User's Guide (SPRUGO6C):

GateMP_params_init(&gparams);

gparams.localProtect = GateMP_LocalProtect_THREAD;

gparams.remoteProtect = GateMP_RemoteProtect_SYSTEM;

gparams.name = "myGate";

gparams.regionId = 1;

gateHandle = GateMP_create(&gparams, NULL);

Notice that in the documented example there is no mention of allocating memory for the gate itself, is this something new, and is it required for Syslink? The included html documentation doesn't mention this either.

 

Lee Holeva

 

  • Lee,
     
    The SysLink samples are "what they are" and I'm not sure of the reasoning behind specific implementation.  They are developed independently from the IPC examples in the SysBios documentation.  SysLink provides an IPC implementation for the HLOS, usually Linux, and SysBios provides an IPC implementation for SysBios.  There is no one "canonical" way of using many of the modules.
     
    A GateMP can be created with either a provided address or a provided "region".  The SysLink sample has decided to allocate its own memory for the GateMP, and serves to show how one would do that since it's more complicated than the way that the IPC example does it.  The IPC example provides the "regionId", which is the SharedRegion id from which the GateMP memory will be allocated (the specified SharedRegion needs to have been configured to contain a heap).  So, you either specify sharedAddr as NULL and provide a regionId, or you specify sharedAddr explicitly in which case the regionId element is DON"T CARE.
     
    The SysLink sample is also different from the IPC example in that it doesn't specify gateMPParams.localProtect.  I'm not sure why it doesn't - perhaps it knows the default value and is happy with that, or it truly doesn't care what kind of local protection is provided.
     
    There is good documentation available within the header files themselves.  The doxygen-created "documentation" is harvested from these header file comments.  For GateMP.h, you can find it in <ipc_install_dir>/packages/ti/ipc/GateMP.h.
     
    Regards,
     
    - Rob