Uploaded image for project: 'Embedded Software & Tools'
  1. Embedded Software & Tools
  2. EXT_EP-11609

Critical Section order not optimal in ICall_leaveCSImpl & ICall_enterCSImpl functions

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: High High
    • SimpleLink Lowpower SDK F3 BLE5 Stack
    • BLE_LOKI-1034
    • BLE Stack BLE5-3.2.2
    • Hide
      BLE Stack BLE5-3.3.1 RC1
      BLE Stack BLE5-3.3.1
      Show
      BLE Stack BLE5-3.3.1 RC1 BLE Stack BLE5-3.3.1
    • CC23xx

      In the ICall_leaveCSImpl(ICall_CSState key) and ICall_CSState ICall_enterCSImpl(void)

      When we enter CS, we disable Swi first, but the hwi can still occur before we disable hwi. Most of the times, there is no issue.

      However, in some use cases, it is possible that sometimes the radio runs right after Swi is disabled, which then can eventually causing the wrong keys being used when we exist CS causing Swi being disable forever.

      The proposed fix is that to disable hwi first when entering CS to make sure nothing can run.
      And to enable hwi last when exiting CS.

      ICall_CSState ICall_enterCSImpl(void)
      {
      
        ICall_CSStateUnion cu;
        cu.each.hwikey = (uint_least16_t) Hwi_disable();
        cu.each.swikey = (uint_least16_t) Swi_disable();
        return cu.state;
      }
      
      /* leave critical section implementation. See header file for comment */
      void ICall_leaveCSImpl(ICall_CSState key)
      {
        ICall_CSStateUnion *cu = (ICall_CSStateUnion *) &key;
        Swi_restore((uint32_t) cu->each.swikey);
        Hwi_restore((uint32_t) cu->each.hwikey);
      }
      

            syncuser TI User
            syncuser TI User
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: