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

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

?? packettransceiver.c

?? 基于cc1010的設計實例
?? C
字號:
/*****************************************************************************
 *                                                                           *
 *        **********                                                         *
 *       ************                                                        *
 *      ***        ***                                                       *
 *      ***   +++   ***                                                      *
 *      ***   + +   ***                                                      *
 *      ***   +                CHIPCON CC1010 Wireless headset project       *
 *      ***   + +   ***                                                      *
 *      ***   +++   ***        PacketTransceiver for the master unit         *
 *      ***       ***                                                        *
 *       ***********                                                         *
 *        *********                                                          *
 *                                                                           *
 *****************************************************************************
 * This source file is part of a software project for Full Duplex,           *
 * single-chip, wireless intercom, written for the CC1010 chip               *
 * (RF-transceiver chip with integrated 8051 micro-controller).              *
 *****************************************************************************
 * Author:              OAE                                                  *
 *****************************************************************************
 * Revision history:                                                         *
 *                                                                           *
 * $Log: PacketTransceiver.c,v $
 * Revision 1.2  2003/08/18 12:19:33  tos
 * Synchronisation with library update (reentry issue).
 *
 * Revision 1.1  2003/08/04 12:34:27  tos
 * Initial version in CVS.
 *
 *                                                                           *
 ****************************************************************************/

#include <chipcon/reg1010.h>
#include <chipcon/cc1010eb.h>
#include <chipcon/hal.h>

// Define ocnstants
#define WAIT 1
#define DO_NOT_WAIT 0

// External variables
extern RF_RXTXPAIR_CALDATA xdata RF_CALDATA;
extern byte xdata DES_KEY[7];

// Prototypes
void InitializeDisassembler();
byte* DES(byte options, byte xdata* buffer, byte xdata* key,
    word length, bit wait);
void ResetReceiveBuffers();
ulong ConfigureTimer23(byte options, ulong period, word clkFreq);

/**************************************************************************
* PacketSend() - Routine for RF-transmission of a single packet           *
***************************************************************************
* Description:                                                            *
*   Used to send a packet using the chosen RF configuration. The RF       *
*   calibration data must be available.                                   *
***************************************************************************
* Input arguments:                                                        *
*   byte numpreambles: The number of preamble bytes (alternating ones and *
*       zeros) to be sent prior to the synchronization byte.              *
*   byte xdata *bufferaddress: A pointer to the location (in XRAM) where  *
*       the first byte of the packet, which is to be sent, is stored.     *
*   word packetsize: Defines the number of bytes to be sent.              *
*   RF_RXTXPAIR_SETTINGS* RF_SETTINGS: A pointer to the structure holding *
*       the chosen RF RX/TX parameters.                                   *
* Return value;                                                           *
*   None.                                                                 *
**************************************************************************/
void PacketSend(byte numpreambles, byte xdata *bufferaddress,
    word packetsize, RF_RXTXPAIR_SETTINGS* RF_SETTINGS)
{
    // Encrypt the buffered packet before transmission
    DES(DES_SINGLE_DES | DES_ENCRYPT | DES_CFB_MODE,
        bufferaddress, &DES_KEY, packetsize, DO_NOT_WAIT);

    // Prepare for transmission
    halRFSetRxTxOff(RF_TX, RF_SETTINGS, &RF_CALDATA);

    // Load buffer (RBUF) with the preamble byte
    RF_SEND_BYTE(RF_PREAMBLE_BYTE);

    // Activate the digital modem and PA
    RF_START_TX();

    // Send remaining preambles
    while(--numpreambles)
        RF_WAIT_AND_SEND_BYTE(RF_PREAMBLE_BYTE);

    // Send synchronising byte
    RF_WAIT_AND_SEND_BYTE(RF_SUITABLE_SYNC_BYTE);

    // Send buffered data
    while(packetsize--)
        RF_WAIT_AND_SEND_BYTE(*bufferaddress++);

    // Send two extra bytes to empty buffer (RFBUF)
    RF_WAIT_AND_SEND_BYTE(0);
    RF_WAIT_AND_SEND_BYTE(0);

    // End transmission
    halRFSetRxTxOff(RF_OFF, NULL, NULL);

}// End function


/**************************************************************************
* PacketReceive() - Routine for RF-reception of a single packet           *
***************************************************************************
* Description:                                                            *
*   Used to receive a packet using the chosen RF configuration. The RF    *
*   calibration data must be available.                                   *
***************************************************************************
* Input arguments:                                                        *
*   byte numpreamblebitsense: The number of preamble bits (alternating    *
*       ones and zeros) that must be received before a synchronization    *
*       byte is accepted.                                                 *
*   byte xdata *bufferaddress: A pointer to the location (in XRAM) where  *
*       the first byte of the packet, which is to be received, is stored. *
*   word packetsize: Defines the number of bytes to be received.          *
*   RF_RXTXPAIR_SETTINGS* RF_SETTINGS: A pointer to the structure holding *
*       the chosen RF RX/TX parameters.                                   *
* Return value;                                                           *
*   None.                                                                 *
**************************************************************************/
void PacketReceive(byte numpreamblebitsense, byte xdata * bufferaddress,
    word packetsize, RF_RXTXPAIR_SETTINGS* RF_SETTINGS)
{
    // Define flag for reception timeout indication
    bit timeoutflag = 0;

    // Copy the packetsize
    word packetsizecopy = packetsize;

    // Save copy of buffer address
    byte xdata *bufferaddresscopy = bufferaddress;

    // Prepare for reception
    halRFSetRxTxOff(RF_RX, RF_SETTINGS, &RF_CALDATA);

    // Configure Timer 2 for timeout detection
    halConfigTimer23(TIMER2|TIMER23_NO_INT_TIMER, 6000, CC1010EB_CLKFREQ);
    INT_SETFLAG(INUM_TIMER2, INT_CLR);
    TIMER2_RUN(TRUE);

    // Set the number of preamble bits
    RF_SET_PREAMBLE_COUNT(numpreamblebitsense);

    // Start reception
    RF_START_RX();

    // Wait for synch or timeout
    while (TRUE)
    {
        // Check if timeout has occurred
        if(INT_GETFLAG(INUM_TIMER2))
        {
            // Toggle yellow led to indicate no valid reception
            YLED = !YLED;

            // Set timeout flag
            timeoutflag = 1;

            break;

        }// End if

        // Check if sync byte is received
        if(RF_BYTE_RECEIVED())
        {
            // Clear interrupt flag
            INT_SETFLAG(INUM_RF, INT_CLR);

            break;

        }// End if

    }// End while

    // Receive data when no timeout occured
    if (!timeoutflag)
    {
        // Receive and buffer the packet
        while(packetsize--)
            RF_WAIT_AND_RECEIVE_BYTE(*bufferaddress++);

        // Perform DES-decryption on the received packet
        DES(DES_SINGLE_DES | DES_DECRYPT | DES_CFB_MODE,
            bufferaddresscopy, &DES_KEY, packetsizecopy, WAIT);

        // Reset the PacketDisassembler (ensures correct timing)
        InitializeDisassembler();

    }// End if
    
    // Fill buffer with NULL-samples when timeout occured
    else
    {
        ResetReceiveBuffers();

    }// End else

    // Stop timer used for timeout detection
    TIMER2_RUN(FALSE);

    // Disable the preamble detector
    RF_SET_PREAMBLE_COUNT(RF_PREDET_OFF);

    // End reception
    halRFSetRxTxOff(RF_OFF, NULL, NULL);

}// End function


/**************************************************************************
* AverageFilterUpdate() - Routine for average filter update               *
***************************************************************************
* Description:                                                            *
*   Used to receive a number of preambles (alternating ones and zeros) in *
*   order to update the average filter of the RF-receiver. The average    *
*   filter is free running during update, and locked after completion.    *
*   The RF calibration data must be available.                            *
***************************************************************************
* Input arguments:                                                        *
*   byte numpreamblebitsense: The number of preamble bits (alternating    *
*       ones and zeros) that must be received before a synchronization    *
*       byte is accepted.                                                 *
*   RF_RXTXPAIR_SETTINGS* RF_SETTINGS: A pointer to the structure holding *
*       the chosen RF RX/TX parameters.                                   *
* Return value;                                                           *
*   bit: High after timeout.                                              *
**************************************************************************/
bit AverageFilterUpdate(byte numpreamblebitsense,
    RF_RXTXPAIR_SETTINGS* RF_SETTINGS)
{
    // Define flag for reception timeout indication
    bit timeoutflag = 0;

    // Prepare for reception
    halRFSetRxTxOff(RF_RX, RF_SETTINGS, &RF_CALDATA);

    // Set the number of preamble bits
    RF_SET_PREAMBLE_COUNT(numpreamblebitsense);

    // Configure Timer 2 for timeout detection
    halConfigTimer23(TIMER2|TIMER23_NO_INT_TIMER, 10000, CC1010EB_CLKFREQ);
    INT_SETFLAG(INUM_TIMER2, INT_CLR);
    TIMER2_RUN(TRUE);

    // Start reception
    RF_START_RX();

    // Wait for sync or timeout
    while (TRUE)
    {
        // Check if timeout has occurred
        if(INT_GETFLAG(INUM_TIMER2))
        {
            // Set timeout flag
            timeoutflag = 1;

            break;

        }// End if

        // Check if synch byte received
        if(RF_BYTE_RECEIVED())
        {
            // Clear interrupt flag
            INT_SETFLAG(INUM_RF, INT_CLR);
            
            break;

        }// End if

    }// End while

    // Lock average filter
    RF_LOCK_AVERAGE_FILTER(TRUE);

    // Stop timer used for timeout detection
    TIMER2_RUN(FALSE);

    // Disable the preamble detector
    RF_SET_PREAMBLE_COUNT(RF_PREDET_OFF);

    // End reception
    halRFSetRxTxOff(RF_OFF, NULL, NULL);

    // Return timeout status
    return timeoutflag;

}// End function

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日本在线不卡视频一二三区| 中文字幕av一区二区三区| 制服丝袜亚洲精品中文字幕| 亚洲精品在线免费观看视频| 亚洲精品高清在线观看| 国模一区二区三区白浆| 国产盗摄一区二区| av一区二区三区在线| 7777精品伊人久久久大香线蕉超级流畅| ww亚洲ww在线观看国产| 亚洲成人激情自拍| 色猫猫国产区一区二在线视频| 精品免费国产一区二区三区四区| 亚洲午夜视频在线| hitomi一区二区三区精品| 久久麻豆一区二区| 麻豆国产91在线播放| 3atv在线一区二区三区| 一区二区三区视频在线看| 成人精品高清在线| 国产欧美日韩卡一| 国产福利91精品一区二区三区| 91精品婷婷国产综合久久性色| 亚洲国产成人av网| 色激情天天射综合网| 国产精品国产三级国产a| 国产激情精品久久久第一区二区| 精品国产一二三| 久久精品国产澳门| 2023国产精品自拍| 国产乱子轮精品视频| 久久综合成人精品亚洲另类欧美 | 免费国产亚洲视频| 91精品国产一区二区三区蜜臀| 久久综合色一综合色88| 久久激情综合网| 精品入口麻豆88视频| 久久国产精品99久久人人澡| 欧美成人精品高清在线播放 | 2019国产精品| 玖玖九九国产精品| 久久一日本道色综合| 国产乱子轮精品视频| 日本一区二区三区dvd视频在线| 国产高清不卡一区| 中文字幕中文字幕一区二区| 国产乱人伦精品一区二区在线观看 | 国产亚洲精品中文字幕| 成人蜜臀av电影| 亚洲欧美另类图片小说| 欧美日韩一区二区三区高清| 日韩精品免费专区| 久久九九国产精品| 91麻豆福利精品推荐| 日韩电影一区二区三区四区| 精品久久久久久亚洲综合网| 懂色中文一区二区在线播放| 亚洲黄色录像片| 日韩欧美黄色影院| www.欧美精品一二区| 亚洲成年人网站在线观看| 久久蜜桃一区二区| 在线观看日韩高清av| 久久aⅴ国产欧美74aaa| 自拍偷拍国产亚洲| 日韩一区二区不卡| 99久久综合精品| 蜜臀av一区二区在线免费观看 | 日韩成人一级大片| 国产精品午夜在线观看| 91精品国产综合久久久久| 国产一区二区不卡在线| 亚洲综合色丁香婷婷六月图片| 日韩欧美综合一区| 99r国产精品| 国产一区二区女| 亚洲国产成人精品视频| 国产精品妹子av| 日韩欧美在线观看一区二区三区| 99久久国产免费看| 久久精品二区亚洲w码| 亚洲激情一二三区| 中文字幕欧美三区| 欧美成人三级电影在线| 欧美日韩精品福利| 91丨porny丨中文| 国产成人在线视频网站| 免费高清不卡av| 亚洲成在人线在线播放| 亚洲特黄一级片| 国产日韩欧美精品一区| 精品国产一区二区三区忘忧草| 在线影视一区二区三区| 成人av在线电影| 国产精品中文字幕日韩精品| 日韩成人精品在线| 一区二区三区美女| 亚洲视频一区二区在线| 亚洲国产精品精华液2区45| 欧美变态tickling挠脚心| 337p亚洲精品色噜噜噜| 欧美日韩国产在线播放网站| 在线视频亚洲一区| 在线中文字幕不卡| 色婷婷狠狠综合| 色噜噜夜夜夜综合网| 色综合久久综合网欧美综合网| www.性欧美| 粉嫩aⅴ一区二区三区四区五区| 国产精品1024| 国产伦精品一区二区三区在线观看| 另类调教123区| 久久精品国产99久久6| 黑人巨大精品欧美一区| 国产一区欧美一区| 成人激情动漫在线观看| 成人一区二区在线观看| av资源网一区| 91麻豆123| 欧美另类高清zo欧美| 欧美一区二区三区成人| 精品日本一线二线三线不卡| 精品日韩在线观看| 日本一区二区三级电影在线观看| 国产精品久久久久久久岛一牛影视| 亚洲国产精品ⅴa在线观看| 亚洲欧美一区二区在线观看| 一区二区三区在线视频免费| 午夜精品福利一区二区三区av| 欧美aⅴ一区二区三区视频| 狠狠色丁香久久婷婷综| 成人免费黄色大片| 欧美日韩在线不卡| 精品成人佐山爱一区二区| 亚洲国产精品av| 亚洲一级二级在线| 精品在线免费视频| av在线一区二区| 制服丝袜一区二区三区| 国产日韩欧美综合一区| 亚洲精品国产精品乱码不99| 日韩一区欧美二区| 高清视频一区二区| 欧美日韩激情一区二区三区| 久久综合久久99| 亚洲精品高清在线| 久久99精品国产.久久久久久| 成人做爰69片免费看网站| 欧美日韩高清不卡| 久久久久久久久久久黄色| 亚洲综合清纯丝袜自拍| 精品亚洲aⅴ乱码一区二区三区| 不卡视频免费播放| 91精品婷婷国产综合久久竹菊| 国产三级一区二区三区| 亚洲成人激情综合网| 成人精品gif动图一区| 99免费精品在线| 亚洲美女免费在线| 青青国产91久久久久久 | 一区二区三区在线视频观看| 另类成人小视频在线| 色婷婷综合五月| 久久综合久久综合九色| 午夜欧美大尺度福利影院在线看 | 麻豆中文一区二区| 一本一道波多野结衣一区二区 | 国内精品国产成人国产三级粉色| 色综合久久精品| 国产亚洲婷婷免费| 日韩电影在线一区| 日本乱人伦aⅴ精品| 亚洲国产精品高清| 国产一区二区美女诱惑| 欧美午夜电影一区| 亚洲欧美电影院| 成人在线综合网| 久久久.com| 国内成+人亚洲+欧美+综合在线| 在线观看区一区二| 亚洲欧美偷拍另类a∨色屁股| 国产精品一区二区果冻传媒| 日韩一区二区三区av| 日本视频一区二区| 欧美写真视频网站| 亚洲一区二区三区美女| 99视频精品全部免费在线| 亚洲国产成人私人影院tom| 国产精品资源站在线| 久久久国产一区二区三区四区小说| 蜜桃一区二区三区在线| 欧美一卡2卡三卡4卡5免费| 亚洲综合激情另类小说区| 一本大道久久a久久综合| 亚洲3atv精品一区二区三区| 成人免费毛片高清视频| 国产欧美日韩三区| 国产精品亚洲午夜一区二区三区| 久久毛片高清国产| 国产九色sp调教91|