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.

CC1310: Callbacks, semaphores, and handles, where can I get more information?

Part Number: CC1310

In the "rfWsnNode_CC1310_LAUNCHXL_tirtos_ccs" project there are a number of uses of callbacks and semaphores using handles for ADC, LED, timers and so forth. This is my first RTOS and multicore project, and I'd like to understand how the callbacks should be used. I do plan on keeping the TI-RTOS for my project, but for doing my own custom code, I need to know what to watch for, and how NOT to step on the other tasks, and to wake up the CM3 only when necessary.

extern PIN_Handle ledPinHandle;

/***** Prototypes *****/
static void nodeRadioTaskFunction(UArg arg0, UArg arg1);
static void returnRadioOperationStatus(enum NodeRadioOperationStatus status);
static void sendDmPacket(struct DualModeSensorPacket sensorPacket, uint8_t maxNumberOfRetries, uint32_t ackTimeoutMs);
static void resendPacket(void);
static void rxDoneCallback(EasyLink_RxPacket * rxPacket, EasyLink_Status status);

#ifdef FEATURE_BLE_ADV
static void bleAdv_eventProxyCB(void);
static void bleAdv_updateTlmCB(uint16_t *pVbatt, uint16_t *pTemp, uint32_t *pTime100MiliSec);
static void bleAdv_updateMsButtonCB(uint8_t *pButton);
#endif

/***** Function definitions *****/
#ifndef USE_DMM
void NodeRadioTask_init(void) {
#else
Task_Handle* NodeRadioTask_init(void) {
#endif /* !USE_DMM */

    /* Create semaphore used for exclusive radio access */
    Semaphore_Params semParam;
    Semaphore_Params_init(&semParam);
    Semaphore_construct(&radioAccessSem, 1, &semParam);
    radioAccessSemHandle = Semaphore_handle(&radioAccessSem);

    /* Create semaphore used for callers to wait for result */
    Semaphore_construct(&radioResultSem, 0, &semParam);
    radioResultSemHandle = Semaphore_handle(&radioResultSem);

Thank you so much...

  • Hi Tim,

    You can find the documentation for each call-back in the driver API documentation:

  • Hi Marie H, thank you very much for the reference.

    I'm looking for a broader definition on how TI uses callbacks, semaphores and handles in their pre-built sample applications. For example the link you provided talks about only handles, doesn't explain callbacks and semaphores. And it says handles need to be created...but not why.

    If you search "callback" for the entire current Simplelink SDK version, you only get a few hits, and that is where a callback is used, not why it is used. If callbacks, semaphores and handles are so prevalent in TI code, and they seem to me at least to provide yet another abstraction of the language, would not there be a place where TI would explain the importance of using them, the danger of not using them, and any other gotchas that some of us have just found out by muddling around?

    There is a training video, that costs some hundreds of dollars here...https://training.ti.com/getting-started-ti-rtos-chapter-9-using-semaphores-hwi

    I also found some help at ..software-dl.ti.com/.../rtos-overview.html

    Also I did find some information about what to do inside a callback (or not to do) here... software-dl.ti.com/.../Application Overview.html

    But maybe I'm missing some TI reference material that is available to engineers, with an explanation in one place about best practices in using semaphores, callbacks and handles, with pointers to their example code?

    Thanks!