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.

Read From SharedRegion in rtos side 6678

Hi

In my 6678 aplication the linux is run on core0 and there are SYS/Bios on other cores,  i need a share region to be accessible from all cores (linux and sys/bios),

In the syslink samples directory I found a shareRegion example that create 3 sharedRegoin in the hlos side, but in the rtos side there is not any API to read from SharedRegion (created in the hlos side).

my questions are :

  1. how can Include created ShareRigions in rtos side?
  2. what are the APIs to read from share region from rtos side?
  3. how can write data in shredRegion in hlos side? (can I use *(address)=value);

thanks

  • Hi,

    You haven't mentioned what software your code base is on. I am assuming a SysLink product, right.

    You may refer to the API reference for SharedRegion for your RTOS release, and let us know if you still need help.
    Some general answers to your questions would be:

    1. yes, configured SharedRegions would be accessible from all cores, via SharedRegion APIs.
    2. SharedRegion APIs can be used to convert pointers between the local processor's address space and the SharedRegion- pointer (SRPtr) address space. These APIs include SharedRegion_getId, SharedRegion_getSRPtr and SharedRegion_getPtr. An example is shown below where 'addr' has been allocated from a SharedRegion statically or dynamically though a SharedRegion heap:

    Ptr addr;
    UInt16 id;
    // to get the id of the local address if id is not already known.
    id = SharedRegion_getId(addr);
    // to get the shared region pointer for the local address
    srptr = SharedRegion_getSRPtr(addr, id);
    // to get the local address from the shared region pointer
    addr = SharedRegion_getPtr(srptr);

    you can use the 'addr' by reading/writing.

    Also importantly, you need ensurecache-coherency across cores when reads and writes are from different cores. You can use for example the following APIs:
    #include <ti/sysbios/hal/Cache.h>
    Cache_inv(Ptr blockPtr, SizeT byteCnt, Bits16 type, Bool wait);
    Cache_wbinv(Ptr blockPtr, SizeT byteCnt, Bits16 type, Bool wait);

    A reader should Cache_inv() the memory before actually reading it. A writer should Cache_wb() or Cache_wbinv() the memory  following the write operation. This ensures the external memory contents are coherent with respect to local processor cache if cache has been enabled.

    Murat