亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? mac_backoff_timer.c

?? Zigbee2006入門(源代碼+文檔講解+系統推薦)
?? C
?? 第 1 頁 / 共 2 頁
字號:
/**************************************************************************************************
    Filename:
    Revised:        $Date: 2007-03-26 16:18:09 -0700 (Mon, 26 Mar 2007) $
    Revision:       $Revision: 13860 $

    Description:

    Describe the purpose and contents of the file.

    Copyright (c) 2006 by Texas Instruments, Inc.
    All Rights Reserved.  Permission to use, reproduce, copy, prepare
    derivative works, modify, distribute, perform, display or sell this
    software and/or its documentation for any purpose is prohibited
    without the express written consent of Texas Instruments, Inc.
**************************************************************************************************/



/* ------------------------------------------------------------------------------------------------
 *                                           Includes
 * ------------------------------------------------------------------------------------------------
 */

/* hal */
#include "hal_types.h"
#include "hal_mcu.h"

/* high-level specific */
#include "mac_spec.h"

/* exported low-level */
#include "mac_low_level.h"

/* low-level specific */
#include "mac_backoff_timer.h"
#include "mac_tx.h"

/* target specific */
#include "mac_radio_defs.h"

/* debug */
#include "mac_assert.h"


/* ------------------------------------------------------------------------------------------------
 *                                            Defines
 * ------------------------------------------------------------------------------------------------
 */
#define COMPARE_STATE_ROLLOVER_BV                 BV(0)
#define COMPARE_STATE_TRIGGER_BV                  BV(1)
#define COMPARE_STATE_ARM_BV                      BV(2)

#define COMPARE_STATE_TRIGGER                     COMPARE_STATE_TRIGGER_BV
#define COMPARE_STATE_ROLLOVER                    COMPARE_STATE_ROLLOVER_BV
#define COMPARE_STATE_ROLLOVER_AND_TRIGGER        (COMPARE_STATE_ROLLOVER_BV | COMPARE_STATE_TRIGGER_BV)
#define COMPARE_STATE_ROLLOVER_AND_ARM_TRIGGER    (COMPARE_STATE_ROLLOVER_BV | COMPARE_STATE_ARM_BV)


/*
 *  The datasheet mentions a small delay on both receive and transmit side of approximately
 *  two microseconds.  The precise characterization is given below.
 *  (This data is not given in rev 1.03 datasheet)
 */
#define RX_TX_PROP_DELAY_AVG_USEC         ((MAC_RADIO_RX_TX_PROP_DELAY_MIN_USEC + MAC_RADIO_RX_TX_PROP_DELAY_MAX_USEC) / 2)
#define RX_TX_PROP_DELAY_AVG_TIMER_TICKS  ((uint16)(MAC_RADIO_TIMER_TICKS_PER_USEC() * RX_TX_PROP_DELAY_AVG_USEC + 0.5))

/*
 *  For slotted receives, the SFD signal is expected to occur on a specifc symbol boundary.
 *  This does *not* correspond to the backoff boundary.  The SFD signal occurs at an
 *  offset from the backoff boundary.  This is done for efficiency of related algorithms.
 *
 *  Once transmit is strobed there is a fixed delay until the SFD signal occurs.  The frame
 *  does not start over-the-air transmit until after an internal radio delay of 12 symbols.
 *  Once transmitting over-the-air, the preamble is sent (8 symbols) followed by the
 *  SFD field (2 symbols). After the SFD field completes, the SFD signal occurs.  This
 *  adds up to a total of 22 symbols from strobe to SFD signal.
 *
 *  Since 22 symbols spans more than a backoff (20 symbols) the modulus operation is used
 *  to find the symbol offset which is 2 symbols.
 *
 *  This math is derived formally via the pre-processor.
 */
#define SYMBOLS_FROM_STROBE_TO_PREAMBLE   12 /* from datasheet */
#define SYMBOLS_FROM_PREAMBLE_TO_SFD      (MAC_SPEC_PREAMBLE_FIELD_LENGTH + MAC_SPEC_SFD_FIELD_LENGTH)
#define SYMBOLS_FROM_STROBE_TO_SFD        (SYMBOLS_FROM_STROBE_TO_PREAMBLE + SYMBOLS_FROM_PREAMBLE_TO_SFD)
#define SYMBOLS_EXPECTED_AT_SFD           (SYMBOLS_FROM_STROBE_TO_SFD % MAC_A_UNIT_BACKOFF_PERIOD)

/* after all that formal math, make sure the result is as expected */
#if (SYMBOLS_EXPECTED_AT_SFD != 2)
#error "ERROR! Internal problem with pre-processor math of slotted alignment."
#endif


/*
 *  The expected SFD signal occurs at the symbol offset *plus* a small internal propagation delay
 *  internal to the radio.  This delay is given as the sum of a receive side delay and a transmit
 *  side delay.  When this delay is subtracted from the internal timer, the internal time base
 *  actually becomes the actual receive time *minus* the transmit delay.  This works out though.
 *  The transmit logic does *not* take into account this delay.  Since the timer is skewed by the
 *  transmit delay already, the transmits go out precisely on time.
 */
#define TIMER_TICKS_EXPECTED_AT_SFD   ((SYMBOLS_EXPECTED_AT_SFD * MAC_RADIO_TIMER_TICKS_PER_SYMBOL()) \
                                          + RX_TX_PROP_DELAY_AVG_TIMER_TICKS)


/* ------------------------------------------------------------------------------------------------
 *                                         Local Variables
 * ------------------------------------------------------------------------------------------------
 */
static uint32 backoffTimerRollover;
static uint32 backoffTimerTrigger;
static uint8 compareState;


/**************************************************************************************************
 * @fn          macBackoffTimerInit
 *
 * @brief       Intializes backoff timer.
 *
 * @param       none
 *
 * @return      none
 **************************************************************************************************
 */
void macBackoffTimerInit(void)
{
  compareState = COMPARE_STATE_ROLLOVER;
  MAC_RADIO_BACKOFF_SET_COUNT(0);
  macBackoffTimerSetRollover(MAC_BACKOFF_TIMER_DEFAULT_ROLLOVER);
  MAC_RADIO_BACKOFF_COMPARE_CLEAR_INTERRUPT();
  MAC_RADIO_BACKOFF_COMPARE_ENABLE_INTERRUPT();
}


/**************************************************************************************************
 * @fn          macBackoffTimerReset
 *
 * @brief       Resets backoff timer.
 *
 * @param       none
 *
 * @return      none
 **************************************************************************************************
 */
void macBackoffTimerReset(void)
{
  MAC_RADIO_BACKOFF_COMPARE_DISABLE_INTERRUPT();
  macBackoffTimerInit();
}


/**************************************************************************************************
 * @fn          macBackoffTimerSetRollover
 *
 * @brief       Set rollover count of backoff timer.
 *
 * @param       rolloverBackoff - backoff count where count is reset to zero
 *
 * @return      none
 **************************************************************************************************
 */
void macBackoffTimerSetRollover(uint32 rolloverBackoff)
{
  halIntState_t  s;

  MAC_ASSERT(rolloverBackoff > MAC_RADIO_BACKOFF_COUNT());  /* rollover value must be greater than count */

  HAL_ENTER_CRITICAL_SECTION(s);
  backoffTimerRollover = rolloverBackoff;
  MAC_RADIO_BACKOFF_SET_COMPARE(rolloverBackoff);
  HAL_EXIT_CRITICAL_SECTION(s);
}


/**************************************************************************************************
 * @fn          macBackoffTimerSetCount
 *
 * @brief       Sets the count of the backoff timer.
 *
 * @param       backoff - new count
 *
 * @return      none
 **************************************************************************************************
 */
void macBackoffTimerSetCount(uint32 backoff)
{
  halIntState_t  s;

  MAC_ASSERT(compareState == COMPARE_STATE_ROLLOVER);   /* trigger cannot be active if changing count */
  MAC_ASSERT(backoff < backoffTimerRollover);  /* count must be less than rollover value */

  HAL_ENTER_CRITICAL_SECTION(s);
  MAC_RADIO_BACKOFF_SET_COUNT(backoff);
  HAL_EXIT_CRITICAL_SECTION(s);
}


/**************************************************************************************************
 * @fn          macBackoffTimerCount
 *
 * @brief       Returns the current backoff count.
 *
 * @param       none
 *
 * @return      current backoff count
 **************************************************************************************************
 */
uint32 macBackoffTimerCount(void)
{
  halIntState_t  s;
  uint32 backoffCount;

  HAL_ENTER_CRITICAL_SECTION(s);
  backoffCount = MAC_RADIO_BACKOFF_COUNT();
  HAL_EXIT_CRITICAL_SECTION(s);
  
#ifdef MAC_RADIO_FEATURE_HARDWARE_OVERFLOW_NO_ROLLOVER
  /*
   *  Extra processing is required if the radio has a special hardware overflow
   *  count feature.  Unfortunately this feature does not provide for setting a
   *  rollover value.  This must be done manually.
   *
   *  This means there is a small window in time when reading the hardware count
   *  will be inaccurate.  It's possible it could be one more than the allowable
   *  count.  This happens if the count has just incremented beyond the maximum
   *  and is queried before the ISR has a chance to run and reset the backoff
   *  count back to zero.  (Pure software implementation of backoff count does
   *  not have this problem.)
   *
   *  To solve this, before returning a value for the backoff count, the value
   *  must be tested to see if it is beyond the maximum value.  If so, a rollover
   *  interrupt that will set backoff count to zero is imminent.  In that case,
   *  the correct backoff count of zero is returned.
   */
  if (backoffCount >= backoffTimerRollover)
  {
    return(0);
  }
#endif
  
  return(backoffCount);
}


/**************************************************************************************************
 * @fn          macBackoffTimerCapture
 *
 * @brief       Returns the most recently captured backoff count
 *

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产成人综合在线| 国产精品69毛片高清亚洲| 亚洲少妇中出一区| 视频一区欧美精品| 看片的网站亚洲| 国产宾馆实践打屁股91| av在线一区二区三区| 91精品国产色综合久久不卡蜜臀| 久久免费视频色| 亚洲情趣在线观看| 国产一区二区三区在线观看免费视频 | 亚洲丝袜美腿综合| 日本午夜一区二区| av激情综合网| 日韩精品中文字幕一区二区三区 | 另类专区欧美蜜桃臀第一页| 成人黄色免费短视频| 91精品国产综合久久久久| 国产精品女主播av| 麻豆国产91在线播放| 欧美在线综合视频| 亚洲精品美国一| 成人av片在线观看| 亚洲国产精品国自产拍av| 久久er精品视频| 精品剧情在线观看| 九九精品视频在线看| 欧美日本韩国一区二区三区视频| 国产精品乱人伦一区二区| 国产另类ts人妖一区二区| 欧美一区二区成人6969| 蜜桃av一区二区在线观看| 日韩欧美另类在线| 九色porny丨国产精品| 国产亚洲欧洲一区高清在线观看| 国产麻豆视频一区二区| 亚洲精品一区二区三区福利| 国产高清在线精品| 国产精品欧美综合在线| 欧美体内she精高潮| 日韩黄色片在线观看| 欧美乱妇20p| 国产一区二三区| 国产精品网站一区| 一本色道**综合亚洲精品蜜桃冫| 亚洲成人免费视频| 国产亚洲美州欧州综合国| 国产91丝袜在线播放0| 一区二区三区在线播放| 欧美日韩极品在线观看一区| 成人成人成人在线视频| 日韩电影在线观看电影| 国产日韩精品一区| 欧美日韩一区不卡| 国产suv一区二区三区88区| 五月激情综合网| 国产精品毛片无遮挡高清| 91精品国产综合久久精品| 成人免费毛片片v| 久久精品国产一区二区| 樱花影视一区二区| 国产精品久久影院| 精品久久国产字幕高潮| 欧美日韩午夜在线视频| 91网站黄www| 成人app网站| 国产suv精品一区二区三区| 日韩中文字幕1| 午夜伊人狠狠久久| 樱桃国产成人精品视频| 亚洲精品欧美专区| 亚洲欧美福利一区二区| 成人欧美一区二区三区1314| 国产精品女同一区二区三区| 国产精品网曝门| 亚洲欧美中日韩| 国产精品理伦片| 国产亚洲美州欧州综合国| 欧美激情综合网| 日韩毛片精品高清免费| 一区二区欧美视频| 亚洲va韩国va欧美va精品| 日本亚洲免费观看| 国产成人午夜高潮毛片| 成人性色生活片免费看爆迷你毛片| 国产凹凸在线观看一区二区| 99国产欧美另类久久久精品| 色婷婷综合激情| 欧美男人的天堂一二区| 精品国产91亚洲一区二区三区婷婷| 欧美大黄免费观看| 国产精品久久久久久久久免费樱桃| 国产精品你懂的| 日本强好片久久久久久aaa| 国产美女av一区二区三区| 91国在线观看| 久久综合视频网| 亚洲男女一区二区三区| 免费视频最近日韩| 欧美亚洲国产一卡| 久久久五月婷婷| 日韩在线卡一卡二| av一二三不卡影片| 亚洲精品在线观| 亚洲成av人在线观看| 成人免费视频播放| 久久九九国产精品| 免费视频最近日韩| 欧美中文字幕亚洲一区二区va在线| 欧美精品一区二区三区一线天视频| 亚洲国产日日夜夜| 色94色欧美sute亚洲13| 国产精品系列在线| a4yy欧美一区二区三区| 国产人成亚洲第一网站在线播放| 日韩电影免费一区| 欧美日韩色综合| 亚洲午夜激情av| 在线看国产一区二区| 曰韩精品一区二区| 91在线你懂得| 亚洲柠檬福利资源导航| 91一区二区三区在线观看| 中文成人av在线| 91丝袜美腿高跟国产极品老师| 国产精品不卡在线观看| 色成人在线视频| 午夜久久久影院| 欧美肥妇毛茸茸| 国产精品一区二区不卡| 欧美激情一区在线观看| 一本久道中文字幕精品亚洲嫩| 亚洲国产精品麻豆| 91精品一区二区三区久久久久久| 热久久国产精品| 亚洲国产精品成人综合色在线婷婷| 成人18精品视频| 亚洲自拍偷拍综合| 日韩精品一区二区三区在线| 处破女av一区二区| 亚洲成人av福利| 国产性做久久久久久| 在线观看日韩av先锋影音电影院| 蜜臀精品久久久久久蜜臀| 欧美韩国日本一区| 欧美日本不卡视频| bt欧美亚洲午夜电影天堂| 免费观看成人鲁鲁鲁鲁鲁视频| 亚洲丝袜美腿综合| 久久久精品天堂| 欧美一区二区久久| 色就色 综合激情| 成人美女在线视频| 在线观看亚洲精品| 国产成人自拍在线| 久久99精品国产麻豆婷婷| 日本一区二区高清| 2024国产精品| 26uuu亚洲综合色欧美| 欧美日韩免费不卡视频一区二区三区| 国产黄色精品网站| 国产九九视频一区二区三区| 免费久久99精品国产| 五月综合激情日本mⅴ| 亚洲午夜精品久久久久久久久| 亚洲男人的天堂网| 亚洲欧美视频在线观看| 中文字幕日韩精品一区| 国产欧美一区二区精品性| 欧美xingq一区二区| 欧美一区二区女人| 精品国产免费久久| 欧美韩日一区二区三区| 国产精品国产三级国产aⅴ入口 | 亚洲欧洲国产日韩| 国产亚洲一区二区三区在线观看| 2023国产精品| 国产日韩欧美一区二区三区乱码| 久久久久99精品国产片| 中文字幕视频一区| 无吗不卡中文字幕| 国产一区美女在线| 成人短视频下载| 欧美三级日韩三级国产三级| 欧美另类变人与禽xxxxx| 久久综合五月天婷婷伊人| 亚洲日本欧美天堂| 亚洲电影在线免费观看| 精品一区二区三区影院在线午夜| 国产乱对白刺激视频不卡| 色综合夜色一区| 国产性色一区二区| 亚洲一区二区中文在线| 国产精品正在播放| 色婷婷综合在线| 久久精品视频在线免费观看| 亚洲免费观看高清完整版在线观看熊 | 亚洲va国产va欧美va观看| 国产麻豆日韩欧美久久| 欧美人牲a欧美精品|