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

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

?? mac_csp_tx.c

?? 用IAR開發的ZIGBEE網絡路由例子
?? 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.

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
heyzo一本久久综合| 久久综合色婷婷| 日韩一级片网站| 精品久久久久久久久久久院品网 | 天堂成人国产精品一区| 麻豆精品在线播放| 国产精品综合二区| www.成人在线| 欧美久久一二三四区| 日韩免费观看高清完整版在线观看| 久久久综合九色合综国产精品| 欧美激情在线一区二区| 亚洲午夜一区二区| 久久爱www久久做| 97久久精品人人做人人爽50路| 欧洲色大大久久| 欧美日韩亚洲综合| 久久精品一二三| 亚洲在线中文字幕| 狠狠久久亚洲欧美| 色国产综合视频| 日韩欧美久久久| 亚洲欧美另类小说视频| 三级亚洲高清视频| 国产精品123| 日本高清视频一区二区| 日韩欧美黄色影院| 亚洲男人的天堂av| 美女看a上一区| jiyouzz国产精品久久| 欧美一区二区三区白人| 欧美精品一区二区三区蜜桃 | 精品99久久久久久| 一区二区三区蜜桃| 久久国产夜色精品鲁鲁99| 成人免费va视频| 91精品国产入口在线| 国产精品国产精品国产专区不片 | 日韩欧美一二三| 一区二区三区四区在线免费观看 | 日韩理论片网站| 国产一区二区成人久久免费影院| 欧美肥妇毛茸茸| 亚洲天堂成人网| 成人亚洲一区二区一| 久久亚洲影视婷婷| 久久97超碰色| 日韩一级欧美一级| 日韩电影在线看| 欧美天堂一区二区三区| 亚洲欧美日韩国产成人精品影院| 成人av动漫网站| 日本一区二区三区在线不卡| 国产真实乱对白精彩久久| 91精品国产美女浴室洗澡无遮挡| 亚洲一区二区在线观看视频| 一本色道久久综合亚洲91| 国产精品美女www爽爽爽| 国产福利精品一区二区| 久久久精品欧美丰满| 国产在线视频精品一区| 久久综合国产精品| 国产精品综合网| 久久麻豆一区二区| 国产又粗又猛又爽又黄91精品| 精品国产乱码久久久久久老虎| 久草中文综合在线| 久久这里只有精品6| 国产精品白丝jk白祙喷水网站| 久久久久久久综合日本| 国产盗摄精品一区二区三区在线 | 成人黄色网址在线观看| 中文av字幕一区| 懂色av一区二区夜夜嗨| 欧美国产乱子伦| 成人av影视在线观看| 国产精品热久久久久夜色精品三区| 成人精品视频一区| 日韩美女视频19| 在线日韩av片| 天天色天天操综合| 日韩美女一区二区三区四区| 蜜臀av亚洲一区中文字幕| 精品国产123| 成人app软件下载大全免费| 亚洲色图欧美偷拍| 欧美日韩精品系列| 久久国产精品区| 久久精品一区四区| 91麻豆精品秘密| 夜夜嗨av一区二区三区四季av | 麻豆精品新av中文字幕| 久久久夜色精品亚洲| 99久久免费精品高清特色大片| 亚洲精品国产无套在线观| 欧美高清一级片在线| 国产一区在线不卡| 17c精品麻豆一区二区免费| 欧美三级欧美一级| 精品在线免费观看| 国产精品你懂的在线欣赏| 91国产福利在线| 久久成人免费电影| 国产精品毛片久久久久久久| 欧美性受极品xxxx喷水| 色综合网站在线| 免费精品视频最新在线| 久久久www免费人成精品| 97久久超碰国产精品电影| 日韩—二三区免费观看av| 久久精品视频在线免费观看| 色哟哟国产精品免费观看| 日韩不卡一二三区| 国产精品国产精品国产专区不片| 欧美日韩国产影片| 国产乱码精品一区二区三区五月婷| 日韩美女啊v在线免费观看| 日韩一级黄色大片| 91视频免费播放| 久久国产精品区| 亚洲最新视频在线观看| 久久综合中文字幕| 欧美在线|欧美| 国产成人啪午夜精品网站男同| 亚洲成人一区在线| 国产精品欧美一区喷水| 91精品国产91久久久久久最新毛片| 国产成人鲁色资源国产91色综| 亚洲综合图片区| 国产欧美一区二区三区鸳鸯浴 | 日韩高清电影一区| 最新国产の精品合集bt伙计| 日韩久久久精品| 欧美在线三级电影| 国产成人高清在线| 日本成人在线一区| 亚洲影院在线观看| 中文字幕av资源一区| 8x8x8国产精品| 色成年激情久久综合| 欧美国产日本韩| 欧美mv日韩mv| 91精品欧美一区二区三区综合在| 色综合天天性综合| 国产精品亚洲第一| 久久精品国内一区二区三区| 夜夜亚洲天天久久| 国产精品成人一区二区艾草| xfplay精品久久| 日韩欧美国产午夜精品| 欧美视频在线观看一区二区| 波多野洁衣一区| 风间由美中文字幕在线看视频国产欧美| 免费人成在线不卡| 午夜精品福利一区二区三区av | 91精品国产色综合久久久蜜香臀| 高清在线不卡av| 美国精品在线观看| 天堂蜜桃91精品| 亚洲一线二线三线视频| 六月丁香婷婷久久| 亚洲福利视频三区| 9i在线看片成人免费| 国产精品一区三区| 国产剧情av麻豆香蕉精品| 理论片日本一区| 秋霞影院一区二区| 奇米影视7777精品一区二区| 亚洲与欧洲av电影| 亚洲午夜久久久久久久久久久| 亚洲日本青草视频在线怡红院| 欧美—级在线免费片| 久久久不卡网国产精品一区| 26uuu欧美日本| 久久久另类综合| 国产欧美日韩激情| 国产精品视频在线看| 久久精品日韩一区二区三区| 久久综合999| 国产亚洲欧美色| 亚洲国产激情av| 国产精品美女久久久久aⅴ| 中文子幕无线码一区tr| 中文字幕av一区二区三区免费看| 国产三级久久久| 中文字幕中文字幕一区| 成人欧美一区二区三区视频网页 | 99久久伊人精品| 91污在线观看| 欧美性受极品xxxx喷水| 欧美日韩亚洲综合| 欧美疯狂做受xxxx富婆| 日韩一二在线观看| 精品免费国产二区三区 | 不卡一区二区中文字幕| 91香蕉国产在线观看软件| 欧美在线制服丝袜| 91精品国产高清一区二区三区蜜臀 | 国产丝袜在线精品| 国产精品国产三级国产三级人妇|