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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? mac_csp_tx.c

?? TI的基于ZIGBEE2006的協(xié)議棧
?? C
?? 第 1 頁 / 共 3 頁
字號:
/**************************************************************************************************
    Filename:
    Revised:        $Date: 2007-03-28 18:21:19 -0700 (Wed, 28 Mar 2007) $
    Revision:       $Revision: 13888 $

    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 */
#include "mac_spec.h"
#include "mac_pib.h"

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

/* low-level specific */
#include "mac_csp_tx.h"
#include "mac_tx.h"
#include "mac_rx.h"
#include "mac_rx_onoff.h"

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

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


/* ------------------------------------------------------------------------------------------------
 *                                   CSP Defines / Macros
 * ------------------------------------------------------------------------------------------------
 */
/* immediate strobe commands */
#define ISSTART     0xFE
#define ISSTOP      0xFF

/* strobe processor instructions */
#define SKIP(s,c)   (0x00 | (((s) & 0x07) << 4) | ((c) & 0x0F))   /* skip 's' instructions if 'c' is true  */
#define WHILE(c)    SKIP(0,c)              /* pend while 'c' is true (derived instruction)        */
#define WAITW(w)    (0x80 | ((w) & 0x1F))  /* wait for 'w' number of MAC timer overflows          */
#define WEVENT      (0xB8)                 /* wait for MAC timer compare                          */
#define WAITX       (0xBB)                 /* wait for CPSX number of MAC timer overflows         */
#define LABEL       (0xBA)                 /* set next instruction as start of loop               */
#define RPT(c)      (0xA0 | ((c) & 0x0F))  /* if condition is true jump to last label             */
#define INT         (0xB9)                 /* assert IRQ_CSP_INT interrupt                        */
#define INCY        (0xBD)                 /* increment CSPY                                      */
#define INCMAXY(m)  (0xB0 | ((m) & 0x07))  /* increment CSPY but not above maximum value of 'm'   */
#define DECY        (0xBE)                 /* decrement CSPY                                      */
#define DECZ        (0xBF)                 /* decrement CSPZ                                      */
#define RANDXY      (0xBC)                 /* load the lower CSPY bits of CSPX with random value  */

/* strobe processor command instructions */
#define SSTOP       (0xDF)    /* stop program execution                                      */
#define SNOP        (0xC0)    /* no operation                                                */
#define STXCALN     (0xC1)    /* enable and calibrate frequency synthesizer for TX           */
#define SRXON       (0xC2)    /* turn on receiver                                            */
#define STXON       (0xC3)    /* transmit after calibration                                  */
#define STXONCCA    (0xC4)    /* transmit after calibration if CCA indicates clear channel   */
#define SRFOFF      (0xC5)    /* turn off RX/TX                                              */
#define SFLUSHRX    (0xC6)    /* flush receive FIFO                                          */
#define SFLUSHTX    (0xC7)    /* flush transmit FIFO                                         */
#define SACK        (0xC8)    /* send ACK frame                                              */
#define SACKPEND    (0xC9)    /* send ACK frame with pending bit set                         */

/* conditions for use with instructions SKIP and RPT */
#define C_CCA_IS_VALID        0x00
#define C_SFD_IS_ACTIVE       0x01
#define C_CPU_CTRL_IS_ON      0x02
#define C_END_INSTR_MEM       0x03
#define C_CSPX_IS_ZERO        0x04
#define C_CSPY_IS_ZERO        0x05
#define C_CSPZ_IS_ZERO        0x06

/* negated conditions for use with instructions SKIP and RPT */
#define C_NEGATE(c)   ((c) | 0x08)
#define C_CCA_IS_INVALID      C_NEGATE(C_CCA_IS_VALID)
#define C_SFD_IS_INACTIVE     C_NEGATE(C_SFD_IS_ACTIVE)
#define C_CPU_CTRL_IS_OFF     C_NEGATE(C_CPU_CTRL_IS_ON)
#define C_NOT_END_INSTR_MEM   C_NEGATE(C_END_INSTR_MEM)
#define C_CSPX_IS_NON_ZERO    C_NEGATE(C_CSPX_IS_ZERO)
#define C_CSPY_IS_NON_ZERO    C_NEGATE(C_CSPY_IS_ZERO)
#define C_CSPZ_IS_NON_ZERO    C_NEGATE(C_CSPZ_IS_ZERO)

///////////////////////////////////////////////////////////////////////////////////////
//  REV_B_WORKAROUND : part of a workaround to help ameliorate chip bug #273.
//  This bug could actually be the source of extant every-once-in-a-while problems.
//  When Rev B is obsolete, delete these defines and all references to them.
//  Compile errors should flag all related fixes.
#define __SNOP_SKIP__     1
#define __SNOP__          SNOP
///////////////////////////////////////////////////////////////////////////////////////


/* ------------------------------------------------------------------------------------------------
 *                                         Defines
 * ------------------------------------------------------------------------------------------------
 */

/* CSPY return values from CSP program */
#define CSPY_RXTX_COLLISION         0
#define CSPY_NO_RXTX_COLLISION      1

/* CSPZ return values from CSP program */
#define CSPZ_CODE_TX_DONE           0
#define CSPZ_CODE_CHANNEL_BUSY      1
#define CSPZ_CODE_TX_ACK_TIME_OUT   2


/* ------------------------------------------------------------------------------------------------
 *                                          Macros
 * ------------------------------------------------------------------------------------------------
 */
#define CSP_STOP_AND_CLEAR_PROGRAM()          st( RFST = ISSTOP;  )
#define CSP_START_PROGRAM()                   st( RFST = ISSTART; )
////////////////////////////////////////////////////////////////////////////////////////////////////
//  REV_B_WORKAROUND : workaround for chip bug #574, delete this whole mess when Rev B is obsolete.
//  Compile errors will flag all instances of macro call.  Delete those too.
#ifndef _REMOVE_REV_B_WORKAROUNDS
#define __FIX_T2CMP_BUG__()   st( if (T2CMP == 0) { T2CMP = 1;} )
#else
#define __FIX_T2CMP_BUG__()
#endif
////////////////////////////////////////////////////////////////////////////////////////////////////

/*
 *  These macros improve readability of using T2CMP in conjunction with WEVENT.
 *
 *  The timer2 compare, T2CMP, only compares one byte of the 16-bit timer register.
 *  It is configurable and has been set to compare against the upper byte of the timer value.
 *  The CSP instruction WEVENT waits for the timer value to be greater than or equal
 *  the value of T2CMP.
 *
 *  Reading the timer value is done by reading the low byte first.  This latches the
 *  high byte.  A trick with the ternary operator is used by a macro below to force a
 *  read of the low byte when returning the value of the high byte.
 *
 *  CSP_WEVENT_SET_TRIGGER_NOW()      - sets the WEVENT trigger point at the current timer count
 *  CSP_WEVENT_SET_TRIGGER_SYMBOLS(x) - sets the WEVENT trigger point in symbols
 *  CSP_WEVENT_READ_COUNT_SYMBOLS()   - reads the current timer count in symbols
 */
#define T2THD_TICKS_PER_SYMBOL                (MAC_RADIO_TIMER_TICKS_PER_SYMBOL() >> 8)

#define CSP_WEVENT_SET_TRIGGER_NOW()          st( uint8 temp=T2TLD;  T2CMP = T2THD;  __FIX_T2CMP_BUG__(); )
#define CSP_WEVENT_SET_TRIGGER_SYMBOLS(x)     st( MAC_ASSERT(x <= MAC_A_UNIT_BACKOFF_PERIOD); \
                                                  T2CMP = (x) * T2THD_TICKS_PER_SYMBOL; \
                                                  __FIX_T2CMP_BUG__(); )
#define CSP_WEVENT_READ_COUNT_SYMBOLS()       (((T2TLD) ? T2THD : T2THD) / T2THD_TICKS_PER_SYMBOL)

/*
 *  Number of bits used for aligning a slotted transmit to the backoff count (plus
 *  derived values).  There are restrictions on this value.  Compile time integrity
 *  checks will catch an illegal setting of this value.  A full explanation accompanies
 *  this compile time check (see bottom of this file).
 */
#define SLOTTED_TX_MAX_BACKOFF_COUNTDOWN_NUM_BITS     4
#define SLOTTED_TX_MAX_BACKOFF_COUNTDOWN              (1 << SLOTTED_TX_MAX_BACKOFF_COUNTDOWN_NUM_BITS)
#define SLOTTED_TX_BACKOFF_COUNT_ALIGN_BIT_MASK       (SLOTTED_TX_MAX_BACKOFF_COUNTDOWN - 1)



/* ------------------------------------------------------------------------------------------------
 *                                     Local Programs
 * ------------------------------------------------------------------------------------------------
 */
static void cspPrepForTxProgram(void);


/**************************************************************************************************
 * @fn          macCspTxReset
 *
 * @brief       Reset the CSP.  Immediately halts any running program.
 *
 * @param       none
 *
 * @return      none
 **************************************************************************************************
 */
void macCspTxReset(void)
{
  MAC_MCU_CSP_STOP_DISABLE_INTERRUPT();
  MAC_MCU_CSP_INT_DISABLE_INTERRUPT();
  CSP_STOP_AND_CLEAR_PROGRAM();
}


/*=================================================================================================
 * @fn          cspPrepForTxProgram
 *
 * @brief       Prepare and initialize for transmit CSP program.
 *              Call *before* loading the CSP program!
 *
 * @param       none
 *
 * @return      none
 *=================================================================================================
 */
static void cspPrepForTxProgram(void)
{
  MAC_ASSERT(!(RFIM & IM_CSP_STOP)); /* already an active CSP program */

  /* set up parameters for CSP transmit program */
  CSPY = CSPY_NO_RXTX_COLLISION;
  CSPZ = CSPZ_CODE_CHANNEL_BUSY;

  /* clear the currently loaded CSP, this generates a stop interrupt which must be cleared */
  CSP_STOP_AND_CLEAR_PROGRAM();
  MAC_MCU_CSP_STOP_CLEAR_INTERRUPT();
  MAC_MCU_CSP_INT_CLEAR_INTERRUPT();
}


/**************************************************************************************************
 * @fn          macCspTxPrepCsmaUnslotted
 *
 * @brief       Prepare CSP for "Unslotted CSMA" transmit.  Load CSP program and set CSP parameters.
 *
 * @param       none
 *
 * @return      none
 **************************************************************************************************
 */
void macCspTxPrepCsmaUnslotted(void)
{
  cspPrepForTxProgram();

  /*----------------------------------------------------------------------
   *  Load CSP program :  Unslotted CSMA transmit 
   */

  /*
   *  Wait for X number of backoffs, then wait for intra-backoff count
   *  to reach value set for WEVENT.
   */
  RFST = WAITX;
  RFST = WEVENT;

  /* wait for one backoff to guarantee receiver has been on at least that long */
  RFST = WAITW(1);
  RFST = WEVENT;
  
  /* sample CCA, if it fails exit from here, CSPZ indicates result */
  RFST = SKIP(1+__SNOP_SKIP__, C_CCA_IS_VALID);
  RFST = SSTOP;
  RFST = __SNOP__;
  
  /* CSMA has passed so transmit */
  RFST = STXON;

  /*
   *  If the SFD pin is high at this point, there was an RX-TX collision.
   *  In other words, TXON was strobed while receiving.  The CSP variable
   *  CSPY is decremented to indicate this happened.  The rest of the transmit
   *  continues normally.

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲人午夜精品天堂一二香蕉| 亚洲午夜久久久久| 精品av综合导航| 欧美一区二区在线观看| 欧美精品乱人伦久久久久久| 欧美调教femdomvk| 欧美亚洲日本一区| 欧美精品vⅰdeose4hd| 欧美三级中文字幕| 欧美日韩激情在线| 制服丝袜亚洲网站| 欧美不卡一区二区三区四区| 日韩一区二区三区视频在线 | 国产精品1区2区| 国产在线一区观看| 国产91高潮流白浆在线麻豆| 成人综合在线观看| 99精品久久99久久久久| 在线视频国内一区二区| 欧美日韩国产一级二级| 欧美日韩mp4| 欧美刺激午夜性久久久久久久 | 亚洲一区二区免费视频| 水蜜桃久久夜色精品一区的特点| 日韩 欧美一区二区三区| 久久国产精品一区二区| 国产毛片精品视频| 9色porny自拍视频一区二区| 欧美亚洲动漫制服丝袜| 日韩一区二区在线看片| 国产精品天美传媒| 亚洲综合激情另类小说区| 全国精品久久少妇| 懂色av一区二区三区免费观看| 91片在线免费观看| 欧美一区二区成人6969| 国产亚洲欧美在线| 亚洲一区二区在线免费观看视频| 视频在线观看91| 国产成人在线视频免费播放| 一本大道综合伊人精品热热| 欧美日韩精品一区二区在线播放| 欧美mv日韩mv亚洲| 亚洲欧洲精品一区二区三区 | 99精品国产视频| 在线播放中文一区| 国产日韩欧美精品在线| 亚洲一区二区三区在线播放| 蜜桃久久av一区| 91在线视频观看| 欧美一区二区大片| 亚洲啪啪综合av一区二区三区| 天天综合网 天天综合色| 国产成人高清在线| 在线播放欧美女士性生活| 国产欧美精品一区| 日日夜夜精品视频天天综合网| 国产1区2区3区精品美女| 欧美浪妇xxxx高跟鞋交| 国产精品视频免费看| 日本成人在线电影网| 99精品视频一区| 久久久青草青青国产亚洲免观| 亚洲h在线观看| 成人aaaa免费全部观看| 日韩欧美综合在线| 亚洲综合激情另类小说区| 国产乱一区二区| 日韩一区二区在线观看| 亚洲午夜精品在线| 91在线视频免费91| 欧美激情一区二区三区全黄| 久久99精品久久久久久久久久久久| 色综合久久综合| 中文字幕av在线一区二区三区| 美女任你摸久久 | 日韩美女视频一区| 国产精品原创巨作av| 在线成人av网站| 亚洲国产精品影院| 一本一道综合狠狠老| 国产性色一区二区| 久久99精品国产| 日韩一区二区免费视频| 亚洲成av人片一区二区三区| 色婷婷综合五月| 国产精品美日韩| 国产精品影视在线| 国产偷国产偷亚洲高清人白洁 | 成人精品免费看| 亚洲精品一区在线观看| 免费成人美女在线观看| 51久久夜色精品国产麻豆| 亚洲第一主播视频| 欧美在线观看一区| 亚洲成av人片一区二区梦乃| 欧美中文字幕一区二区三区亚洲| 国产精品成人一区二区艾草| av综合在线播放| 亚洲欧美在线视频| 99re热这里只有精品视频| 国产精品国产三级国产a| 成人免费看黄yyy456| 欧美精彩视频一区二区三区| 国产高清精品在线| 日本一区二区三区视频视频| 国产精品一区二区你懂的| 欧美国产日韩亚洲一区| 99免费精品在线| 亚洲精品第1页| 欧美日韩国产精选| 蜜桃一区二区三区在线观看| 精品国产免费视频| 国产成人精品一区二| 中文字幕第一区综合| 99免费精品视频| 一区二区在线看| 欧美日韩国产三级| 另类小说综合欧美亚洲| 精品国产成人系列| 成人免费毛片aaaaa**| 亚洲日本一区二区三区| 欧美日韩专区在线| 日本美女视频一区二区| 久久人人超碰精品| 91色在线porny| 亚洲国产欧美另类丝袜| 日韩一区二区视频在线观看| 国产suv精品一区二区三区| 亚洲123区在线观看| 一区二区欧美精品| 伊人开心综合网| 亚洲男人的天堂网| 亚洲国产精品人人做人人爽| 精品欧美一区二区三区精品久久| 在线成人高清不卡| 日本最新不卡在线| 久久久久9999亚洲精品| 99精品在线免费| 日韩不卡免费视频| 亚洲国产精品成人久久综合一区| 91美女精品福利| 日本欧美韩国一区三区| 亚洲国产成人一区二区三区| 欧美体内she精视频| 国产在线精品免费av| 一区二区欧美视频| 亚洲精品一区二区精华| 一本久久综合亚洲鲁鲁五月天 | 亚洲色图视频网| 欧美蜜桃一区二区三区| 懂色一区二区三区免费观看| 亚洲国产成人91porn| 国产日韩精品久久久| 91免费看片在线观看| 国产精品美女久久久久久2018| 日韩精品影音先锋| 国产精品三级av| 欧美另类变人与禽xxxxx| 国产成人无遮挡在线视频| 亚洲综合一区二区| 国产天堂亚洲国产碰碰| 欧美日韩不卡一区二区| 成人精品一区二区三区四区 | 香蕉成人啪国产精品视频综合网| 久久久久97国产精华液好用吗| 欧美午夜片在线观看| 成人午夜精品在线| 日产国产欧美视频一区精品| 亚洲天堂中文字幕| 久久只精品国产| 欧美日韩国产免费一区二区 | 国产精品入口麻豆九色| 欧美一区二区在线视频| 日本韩国欧美三级| 国产成人亚洲综合a∨猫咪| 蜜臀精品久久久久久蜜臀| 一区二区三区免费观看| 国产欧美日韩在线看| 欧美tickling挠脚心丨vk| 欧美日韩综合不卡| 91亚洲国产成人精品一区二区三| 国产自产视频一区二区三区| 五月天久久比比资源色| 一区二区三区影院| 国产精品九色蝌蚪自拍| 国产午夜精品在线观看| 精品日韩99亚洲| 欧美一区二区三区视频免费播放| 色94色欧美sute亚洲13| 91污片在线观看| 成人国产精品免费观看| 国产原创一区二区| 久久99精品久久久久久国产越南 | 欧美一区二区精品久久911| 欧美日韩在线播放三区| 色综合天天综合色综合av| 成人免费的视频| 成人av高清在线| jizzjizzjizz欧美|