当前位置: 首页>>代码示例>>C++>>正文


C++ HAL_EXIT_CRITICAL_SECTION函数代码示例

本文整理汇总了C++中HAL_EXIT_CRITICAL_SECTION函数的典型用法代码示例。如果您正苦于以下问题:C++ HAL_EXIT_CRITICAL_SECTION函数的具体用法?C++ HAL_EXIT_CRITICAL_SECTION怎么用?C++ HAL_EXIT_CRITICAL_SECTION使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了HAL_EXIT_CRITICAL_SECTION函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: macRxOff

/**************************************************************************************************
 * @fn          macRxOff
 *
 * @brief       Turn off the receiver if it's not already off.
 *
 * @param       none
 *
 * @return      none
 **************************************************************************************************
 */
MAC_INTERNAL_API void macRxOff(void)
{
  halIntState_t  s;

  HAL_ENTER_CRITICAL_SECTION(s);
  if (macRxOnFlag)
  {
    macRxOnFlag = 0;
    MAC_RADIO_RXTX_OFF();
    MAC_DEBUG_TURN_OFF_RX_LED();
    
    /* just in case a receive was about to start, flush the receive FIFO */
    MAC_RADIO_FLUSH_RX_FIFO();

    /* clear any receive interrupt that happened to squeak through */
    MAC_RADIO_CLEAR_RX_THRESHOLD_INTERRUPT_FLAG();

  }
  HAL_EXIT_CRITICAL_SECTION(s);
}
开发者ID:KimiRaikking,项目名称:z-stack,代码行数:30,代码来源:mac_rx_onoff.c

示例2: macBackoffTimerCapture

/**************************************************************************************************
 * @fn          macBackoffTimerCapture
 *
 * @brief       Returns the most recently captured backoff count
 *
 * @param       none
 *
 * @return      last backoff count that was captured
 **************************************************************************************************
 */
uint32 macBackoffTimerCapture(void)
{
  halIntState_t  s;
  uint32 backoffCapture;

  HAL_ENTER_CRITICAL_SECTION(s);
  backoffCapture = MAC_RADIO_BACKOFF_CAPTURE();
  HAL_EXIT_CRITICAL_SECTION(s);

#ifdef MAC_RADIO_FEATURE_HARDWARE_OVERFLOW_NO_ROLLOVER
  /*
   *  See other instance of this #ifdef for detailed comments.
   *  Those comments apply to the backoff capture value too.
   */
  if (backoffCapture >= backoffTimerRollover)
  {
    return(0);
  }
#endif
  
  return(backoffCapture);
}
开发者ID:gxp,项目名称:node,代码行数:32,代码来源:mac_backoff_timer.c

示例3: osal_pwrmgr_powerconserve

/*********************************************************************
 * @fn      osal_pwrmgr_powerconserve
 *
 * @brief   This function is called from the main OSAL loop when there are
 *          no events scheduled and shouldn't be called from anywhere else.
 *
 * @param   none.
 *
 * @return  none.
 */
void osal_pwrmgr_powerconserve( void ){
 	uint32        next;
 	halIntState_t intState;

 	// Should we even look into power conservation
 	if ( pwrmgr_attribute.pwrmgr_device != PWRMGR_ALWAYS_ON ) {
    	// Are all tasks in agreement to conserve
    	if ( pwrmgr_attribute.pwrmgr_task_state == 0 ) {
      		// Hold off interrupts.
      		HAL_ENTER_CRITICAL_SECTION( intState );

      		// Get next time-out
      		next = osal_next_timeout();

      		// Re-enable interrupts.
      		HAL_EXIT_CRITICAL_SECTION( intState );

      		// Put the processor into sleep mode
      		OSAL_SET_CPU_INTO_SLEEP( next );
    	}
  	}
}
开发者ID:paoloach,项目名称:zpowermeter,代码行数:32,代码来源:OSAL_PwrMgr.c

示例4: macMcuOverflowSetCount

/**************************************************************************************************
 * @fn          macMcuOverflowSetCount
 *
 * @brief       Sets the value of the hardware overflow counter.
 *
 * @param       count - new overflow count value
 *
 * @return      none
 **************************************************************************************************
 */
MAC_INTERNAL_API void macMcuOverflowSetCount(uint32 count)
{
  halIntState_t  s;

  MAC_ASSERT(! (count >> 24) );   /* illegal count value */

  /* save the current overflow count */
  accumulatedOverflowCount += macMcuOverflowCount();

  /* deduct the initial count */
  accumulatedOverflowCount -= count;

  HAL_ENTER_CRITICAL_SECTION(s);
  MAC_MCU_T2_ACCESS_OVF_COUNT_VALUE();

  /* for efficiency, the 32-bit value is decoded using endian abstracted indexing */
  /* T2OF2 must be written last */
  T2MOVF0 = (uint32)((uint8 *)&count)[UINT32_NDX0];
  T2MOVF1 = (uint32)((uint8 *)&count)[UINT32_NDX1];
  T2MOVF2 = (uint32)((uint8 *)&count)[UINT32_NDX2];
  HAL_EXIT_CRITICAL_SECTION(s);
}
开发者ID:chessami92,项目名称:ceen4360-cc2538-code,代码行数:32,代码来源:mac_mcu.c

示例5: macMcuOverflowCount

/**************************************************************************************************
 * @fn          macMcuOverflowCount
 *
 * @brief       Returns the value of the overflow counter which is a special hardware feature.
 *              The overflow count actually is 24 bits of information.
 *
 * @param       none
 *
 * @return      value of overflow counter
 **************************************************************************************************
 */
MAC_INTERNAL_API uint32 macMcuOverflowCount(void)
{
  uint32         overflowCount;
  halIntState_t  s;

  /* for efficiency, the 32-bit value is encoded using endian abstracted indexing */

  HAL_ENTER_CRITICAL_SECTION(s);

  /* This T2 access macro allows accessing both T2MOVFx and T2Mx */
  MAC_MCU_T2_ACCESS_OVF_COUNT_VALUE();

  /* Latch the entire T2MOVFx first by reading T2M0. */
  T2M0;
  ((uint8 *)&overflowCount)[UINT32_NDX0] = T2MOVF0;
  ((uint8 *)&overflowCount)[UINT32_NDX1] = T2MOVF1;
  ((uint8 *)&overflowCount)[UINT32_NDX2] = T2MOVF2;
  ((uint8 *)&overflowCount)[UINT32_NDX3] = 0;
  HAL_EXIT_CRITICAL_SECTION(s);

  return (overflowCount);
}
开发者ID:chessami92,项目名称:ceen4360-cc2538-code,代码行数:33,代码来源:mac_mcu.c

示例6: osal_timer_num_active

/*********************************************************************
 * @fn      osal_timer_num_active
 *
 * @brief
 *
 *   This function counts the number of active timers.
 *
 * @return  u8 - number of timers
 */
u8 osal_timer_num_active( void )
{
  halIntState_t intState;
  u8 num_timers = 0;
  osalTimerRec_t *srchTimer;

  HAL_ENTER_CRITICAL_SECTION( intState );  // Hold off interrupts.

  // Head of the timer list
  srchTimer = timerHead;

  // Count timers in the list
  while ( srchTimer != NULL )
  {
    num_timers++;
    srchTimer = srchTimer->next;
  }

  HAL_EXIT_CRITICAL_SECTION( intState );   // Re-enable interrupts.

  return num_timers;
}
开发者ID:Aline1029,项目名称:NPLink-Mote-STM32-SDK,代码行数:31,代码来源:osal_time.c

示例7: RFHAL_NextDataEntryDone

/*******************************************************************************
 * @fn          RFHAL_NextDataEntryDone API
 *
 * @brief       This function is used to mark the next System data entry on a
 *              data entry queue as Pending so that the radio can once again
 *              use it. It should be called after the user has processed the
 *              data entry.
 *
 * input parameters
 *
 * @param       dataEntryQueue_t - Pointer to data entry queue.
 *
 * output parameters
 *
 * @param       None.
 *
 * @return      None.
 */
void RFHAL_NextDataEntryDone( dataEntryQ_t *pDataEntryQ )
{
  halIntState_t  cs;
  dataQ_t       *pDataQueue;

#ifdef DEBUG
  RFHAL_ASSERT( pDataEntryQ != NULL );
#endif // DEBUG

  // point to data queue
  pDataQueue = (dataQ_t *)pDataEntryQ;

  if ( pDataQueue->pNextDataEntry != NULL )
  {
    HAL_ENTER_CRITICAL_SECTION(cs);

    // mark the next System data entry as Pending
    pDataQueue->pNextDataEntry->status = DATASTAT_PENDING;

    // advance to the next data entry in the data entry queue
    pDataQueue->pNextDataEntry = pDataQueue->pNextDataEntry->pNextEntry;

    HAL_EXIT_CRITICAL_SECTION(cs);

    // return pointer to next entry, or NULL if there isn't one
    // Note: For a ring buffer, there is always another.
    return; //( pDataQueue->pNextDataEntry );
  }
  else // we are at the end of a linked list
  {
    // ALT: Could set pNextDataEntry to first entry, but could be problematic
    //       if the radio data queue commands are being used to add/remove
    //       data entries.
  }

  // return next data entry to may be processed by System software
  return;
}
开发者ID:PolymorphicLabs,项目名称:PML-Firmware,代码行数:56,代码来源:rfHal.c

示例8: macRadioSetChannel

/**************************************************************************************************
 * @fn          macRadioSetChannel
 *
 * @brief       Set radio channel.
 *
 * @param       channel - channel number, valid range is 11 through 26. Allow
 *              channels 27 and 28 for some Japanese customers.
 *
 * @return      none
 **************************************************************************************************
 */
MAC_INTERNAL_API void macRadioSetChannel(uint8 channel)
{
  halIntState_t  s;

  MAC_ASSERT((channel >= 11) && (channel <= 28));  /* illegal channel */

  /* critical section to make sure transmit does not start while updating channel */
  HAL_ENTER_CRITICAL_SECTION(s);

  /* set requested channel */
  reqChannel = channel;

  /*
   *  If transmit is not active, update the radio hardware immediately.  If transmit is active,
   *  the channel will be updated at the end of the current transmit.
   */
  if (!macTxActive)
  {
    macRadioUpdateChannel();
  }

  HAL_EXIT_CRITICAL_SECTION(s);
}
开发者ID:Daan1992,项目名称:WSN-Lab,代码行数:34,代码来源:mac_radio.c

示例9: macMcuOverflowSetPeriod

/**************************************************************************************************
 * @fn          macMcuOverflowSetPeriod
 *
 * @brief       Set overflow count period value.  An interrupt is triggered when the overflow
 *              count equals this period value.
 *
 * @param       count - overflow count compare value
 *
 * @return      none
 **************************************************************************************************
 */
MAC_INTERNAL_API void macMcuOverflowSetPeriod(uint32 count)
{
  halIntState_t  s;
  uint8 enableCompareInt = 0;

  MAC_ASSERT( !(count >> 24) );   /* illegal count value */

  HAL_ENTER_CRITICAL_SECTION(s);

  /*  Disable overflow compare interrupts. */
  if (T2IRQM & TIMER2_OVF_PERM)
  {
    enableCompareInt = 1;
    T2IRQM &= ~TIMER2_OVF_PERM;
  }

  MAC_MCU_T2_ACCESS_OVF_PERIOD_VALUE();

  /* for efficiency, the 32-bit value is decoded using endian abstracted indexing */
  T2MOVF0 = ((uint8 *)&count)[UINT32_NDX0];
  T2MOVF1 = ((uint8 *)&count)[UINT32_NDX1];
  T2MOVF2 = ((uint8 *)&count)[UINT32_NDX2];

  /*
   *  Now that new compare value is stored, clear the interrupt flag.  This is important just
   *  in case a false match was generated as the multi-byte compare value was written.
   */
  T2IRQF &= ~TIMER2_OVF_PERF;

  /* re-enable overflow compare interrupts if they were previously enabled */
  if (enableCompareInt)
  {
    T2IRQM |= TIMER2_OVF_PERM;
  }

  HAL_EXIT_CRITICAL_SECTION(s);
}
开发者ID:chessami92,项目名称:ceen4360-cc2538-code,代码行数:48,代码来源:mac_mcu.c

示例10: macBackoffTimerICallPwrNotify

/**************************************************************************************************
 * @fn          macBackoffTimerICallPwrNotify
 *
 * @brief       power state transition notify callback function
 *
 * @param       pwrTrans  power transition
 * @param       data      custom data - not used
 *
 * @return      none
 **************************************************************************************************
 */
static void macBackoffTimerICallPwrNotify(ICall_PwrTransition pwrTrans,
                                          ICall_PwrNotifyData *data)
{
  if (pwrTrans == ICALL_PWR_AWAKE_FROM_STANDBY)
  {
    /* Wakeup must be handled from the thread context.
     * Signal the event to the OSAL thread. */
    halIntState_t is;

    HAL_ENTER_CRITICAL_SECTION(is);
    macBackoffTimerEvents |= MAC_BACKOFF_TIMER_EVENT_POWER_WAKEUP;
    HAL_EXIT_CRITICAL_SECTION(is);
    ICall_signal(osal_semaphore);
  }
  else if (pwrTrans == ICALL_PWR_ENTER_STANDBY)
  {
    /* Stop RAT timer */
    macRATValue = macStopRAT();

    /* Park CM0 */
    MAC_RADIO_POWER_DOWN();

    /* The following calls are necessary to prevent a race condition in 
     * pg2_leakage_workaround that causes CM3 to constantly firing up CPE1
     * interrupts during power up until CM3 crashes.
     */
    ICall_disableInt( INT_RF_CPE0 );
    ICall_disableInt( INT_RF_CPE1 );
    ICall_disableInt( INT_RF_HW );
    ICall_disableInt( INT_RF_CMD_ACK );
  }
  else if (pwrTrans == ICALL_PWR_ENTER_SHUTDOWN)
  {
    /* Park CM0 */
    MAC_RADIO_POWER_DOWN();
  }
}
开发者ID:peifengzhou,项目名称:CC2630_HA_Demo,代码行数:48,代码来源:mac_backoff_timer.c

示例11: HalKeyPoll

/**************************************************************************************************
 * @fn          HalKeyPoll
 *
 * @brief       This function is called by Hal_ProcessEvent() on a HAL_KEY_EVENT.
 *
 * input parameters
 *
 * None.
 *
 * output parameters
 *
 * None.
 *
 * @return      None.
 **************************************************************************************************
 */
void HalKeyPoll(void)
{
  uint8 newKeys;

  if (Hal_KeyIntEnable)
  {
    halIntState_t intState;
    HAL_ENTER_CRITICAL_SECTION(intState);
    newKeys = isrKeys;
    isrKeys = 0;
    HAL_EXIT_CRITICAL_SECTION(intState);
  }
  else
  {
    uint8 keys = HalKeyRead();
    newKeys = (halKeys ^ keys) & keys;
    halKeys = keys;
  }

  if (newKeys && pHalKeyProcessFunction)
  {
    (pHalKeyProcessFunction)(newKeys, HAL_KEY_STATE_NORMAL);
  }
}
开发者ID:JensenSung,项目名称:shred444,代码行数:40,代码来源:hal_key.c

示例12: HalSPIRead

/******************************************************************************
 * @fn      HalSPIRead
 *
 * @brief   Read from the external NV storage via SPI.
 *
 * @param   addr - Offset into the external NV.
 * @param   pBuf - Pointer to buffer to copy the bytes read from external NV.
 * @param   len - Number of bytes to read from external NV.
 *
 * @return  None.
 *****************************************************************************/
static void HalSPIRead(uint32 addr, uint8 *pBuf, uint16 len)
{
#if !HAL_OTA_BOOT_CODE
  uint8 shdw = P1DIR;
  halIntState_t his;
  HAL_ENTER_CRITICAL_SECTION(his);
  P1DIR |= BV(3);
#endif

  XNV_SPI_BEGIN();
  do
  {
    xnvSPIWrite(XNV_STAT_CMD);
  } while (XNV_SPI_RX() & XNV_STAT_WIP);
  XNV_SPI_END();
  asm("NOP"); asm("NOP");

  XNV_SPI_BEGIN();
  xnvSPIWrite(XNV_READ_CMD);
  xnvSPIWrite(addr >> 16);
  xnvSPIWrite(addr >> 8);
  xnvSPIWrite(addr);
  xnvSPIWrite(0);

  while (len--)
  {
    xnvSPIWrite(0);
    *pBuf++ = XNV_SPI_RX();
  }
  XNV_SPI_END();

#if !HAL_OTA_BOOT_CODE
  P1DIR = shdw;
  HAL_EXIT_CRITICAL_SECTION(his);
#endif
}
开发者ID:binwulang,项目名称:zstack-agriculture,代码行数:47,代码来源:hal_ota.c

示例13: stack_main

/**
 * Main entry function for the stack image
 */
int stack_main( void *arg )
{
  /* User reconfiguration of BLE Controller and Host variables */
  setBleUserConfig( (bleUserCfg_t *)arg );
  
  /* Establish OSAL for a stack service that requires accompanying
   * messaging service */
  if (ICall_enrollService(ICALL_SERVICE_CLASS_BLE_MSG,
                          (ICall_ServiceFunc) osal_service_entry,
                          &osal_entity, &osal_semaphore) !=
      ICALL_ERRNO_SUCCESS)
  {
    /* abort */
    ICall_abort();
  }

  halIntState_t state;
  HAL_ENTER_CRITICAL_SECTION(state);
  
  // Turn off interrupts
  //osal_int_disable( INTS_ALL );

  // Initialize NV System
  osal_snv_init( );

  // Initialize the operating system
  osal_init_system();

  // Allow interrupts
  //osal_int_enable( INTS_ALL );
  HAL_EXIT_CRITICAL_SECTION(state);

  osal_start_system(); // No Return from here

  return 0;  // Shouldn't get here.
}
开发者ID:ClarePhang,项目名称:ALL_SmartBatterySwitch_CC2640,代码行数:39,代码来源:OSAL_ICallBle.c

示例14: halUartPollRx

/***********************************************************************************
* @fn           halUartPollRx
*
* @brief        Poll for data from USB.
*
* @param        none
*
* @return       none
*/
static void halUartPollRx(void)
{
  uint8 cnt;
  uint8 ep = USBFW_GET_SELECTED_ENDPOINT();
  USBFW_SELECT_ENDPOINT(4);

  // If the OUT endpoint has received a complete packet.
  if (USBFW_OUT_ENDPOINT_DISARMED())
  {
    halIntState_t intState;

    HAL_ENTER_CRITICAL_SECTION(intState);
    // Get length of USB packet, this operation must not be interrupted.
    cnt = USBFW_GET_OUT_ENDPOINT_COUNT_LOW();
    cnt += USBFW_GET_OUT_ENDPOINT_COUNT_HIGH() >> 8;
    HAL_EXIT_CRITICAL_SECTION(intState);

    while (cnt--)
    {
      halUartRxQ[halUartRxT++] = USBF4;
    }
    USBFW_ARM_OUT_ENDPOINT();

#if !defined HAL_SB_BOOT_CODE
    // If the USB has transferred in more Rx bytes, reset the Rx idle timer.

    // Re-sync the shadow on any 1st byte(s) received.
    if (rxTick == 0)
    {
      rxShdw = ST0;
    }
    rxTick = HAL_UART_USB_IDLE;
#endif
  }
#if !defined HAL_SB_BOOT_CODE
  else if (rxTick)
开发者ID:paoloach,项目名称:zpowermeter,代码行数:45,代码来源:_hal_uart_usb.c

示例15: macRadioSetTxPower

void macRadioSetTxPower(uint8 txPower)
{
  halIntState_t  s;

  /* if the selected dBm is out of range, use the closest available */
  if (txPower > MAC_RADIO_TX_POWER_MAX_MINUS_DBM)
  {
    txPower = MAC_RADIO_TX_POWER_MAX_MINUS_DBM;
  }

  /*
   *  Set the global variable reqTxPower.  This variable is referenced
   *  by the function macRadioUpdateTxPower() to write the radio register.
   *
   *  A lookup table is used to translate the power level to the register
   *  value.
   */
  HAL_ENTER_CRITICAL_SECTION(s);
  reqTxPower = macRadioDefsTxPowerTable[txPower];
  HAL_EXIT_CRITICAL_SECTION(s);

  /* update the radio power setting */
  macRadioUpdateTxPower();
}
开发者ID:kricnam,项目名称:blackboxreader,代码行数:24,代码来源:mac_radio.c


注:本文中的HAL_EXIT_CRITICAL_SECTION函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。