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.

coreKey and Osal_qmssCsEnter ();

Other Parts Discussed in Thread: SYSBIOS

Hi Ti Folks,

                   i have a code doing this operation. This part is in nimu_eth.c [this is in PDK installation folder]

/* Disable the interrupt */
coreKey [CSL_chipReadReg (CSL_CHIP_DNUM)] = Hwi_disableInterrupt(PLATFORM_ETH_INTERRUPT); //Hwi_disable();

/* Begin Critical Section before accessing shared resources. */
key = Osal_qmssCsEnter ();

<<many functions are called here>>

/* End Critical Section */
Osal_qmssCsExit (key);
Hwi_restoreInterrupt(PLATFORM_ETH_INTERRUPT, coreKey [CSL_chipReadReg (CSL_CHIP_DNUM)]);

already many functions are called in here. In addition, i have inserted a function to do a functionality like

1.pop desc from a Free desc queue,

2. fill some contents onto desc

3. push the desc onto a queue.

all in all its around 8 lines of code which is being done here.

what i am seeing is a crash in the code [i understand my code is causing timing issues, but at the same time my code is just 7 lines and i dont think it is occupying too much of time].

what i want to know is, is it ok to put code like qmss_pop and qmss_push..[i assume this is correct since key=Osal_qmssCsEnter() is created for qmss operations to enable sychronization acorss multiple cores] in between hw_disable,getting key .....and......hw_enable,releasing key.

what considerations should be followed for the code to be placed between critical section start and critical section end. In short, what operations are allowed between critical sections and what are not.Any guidelines on the same? please point me to any document on the same.

Thanks

RC Reddy

  • Hi,

    There is no need to put the QMSS LLD push and pop functions inside critical sections, because a) the LLD already takes care of that for you, and b) it is usually not necessary.  At a register level, pops (reading QM Reg D) are atomic, and pushes (writing to QM Reg D) are also atomic - a push is only not atomic when you are also writing to QM Reg C prior to Reg D, and not writing to the Queue Proxy region.

    I am not aware of any documents that describe critical section usage (the SysBIOS User Guide mentions them wrt HWI disable/enable). Generally though, they should be kept as small as possible (which you are already aware), should save/restore any state they modify, and only used to protect shared resources from being modified while the current task owns the resource.

      -dave