⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mc1319xdrv.h

📁 freescale的基于802.15.4的无线通讯例程
💻 H
📖 第 1 页 / 共 2 页
字号:
/************************************************************************************
* This file contains the driver primitives for SPI and GPIO interfacing from the
* MAC/PHY to the MC1319x. The primitives may be implemented as macros or functions
* depending on the speed of the MCU and effectiveness of the compiler. There is a
* potential trade-off between code space and execution speed through this choice.
*
*
* (c) Copyright 2005, Freescale Semiconductor, Inc. All rights reserved.
*
* Freescale Confidential Proprietary
*
* No part of this document must be reproduced in any form - including copied,
* transcribed, printed or by any electronic means - without specific written
* permission from Freescale.
************************************************************************************/

#ifndef _MC1319XDRV_H_
#define _MC1319XDRV_H_

#include "EmbeddedTypes.h"
#include "PortConfig.h"

/************************************************************************************
* Local macros for controlling MC1319x GPIO pins
************************************************************************************/
#define MC1319xDrv_AttEnable()      { gMC1319xAttnPort  |=  gMC1319xAttnMask_c;  }
#define MC1319xDrv_AttDisable()     { gMC1319xAttnPort  &= ~gMC1319xAttnMask_c;  }
#define MC1319xDrv_AssertReset()    { gMC1319xResetPort &= ~gMC1319xResetMask_c; }
#define MC1319xDrv_DeassertReset()  { gMC1319xResetPort |=  gMC1319xResetMask_c; }


/************************************************************************************
* Global Driver variables for getting MC1319x GPIO pin values 
************************************************************************************/
extern uint8_t* pMC1319xDrvPortGpio1; 
extern uint8_t* pMC1319xDrvPortGpio2; 
extern uint8_t  mMC1319xDrvMaskGpio1; 
extern uint8_t  mMC1319xDrvMaskGpio2; 


/************************************************************************************
*************************************************************************************
* Interface functions/macros
*************************************************************************************
************************************************************************************/

/************************************************************************************
* Check if MC1319x Transceiver is active through GPIO1.
*
* Used at the end of packet reception when polling the transceiver state. 
* Read the state of the GPIO1 on the transceiver. 
* GPIO1 high signifies transceiver active; low signifies transceiver inactive.
*   
* Interface assumptions:
*   None
*   
* Return value:
*   None
* 
* Revision history:
*   date      Author    Comments
*   ------    ------    --------
*   100505    JT        Created
* 
************************************************************************************/
#define MC1319xDrv_IsActive()               (*pMC1319xDrvPortGpio1 & mMC1319xDrvMaskGpio1)      // Read of MC1319x GPIO1 pin 

/************************************************************************************
* Check if CRC valid or Channel busy on MC1319x Transceiver GPIO2.
* 
* Essentially identical functions. Used at the end of packet reception 
* and end of a Cca, respectively to check the state of GPIO2. 
* Depending on the transceiver state this GPIO indicates either 
* the result of the CRC performed on a received frame or 
* the result of the Cca algorithm. 
* GPIO2 high signifies 'CRC valid' or 'Channel busy'; 
* GPIO2 low signifies 'CRC invalid' or 'Channel clear'
*
* Interface assumptions:
*   None
*   
* Return value:
*   None
* 
* Revision history:
*   date      Author    Comments
*   ------    ------    --------
*   100505    JT        Created
* 
************************************************************************************/
#define MC1319xDrv_IsCrcOk()                (*pMC1319xDrvPortGpio2 & mMC1319xDrvMaskGpio2)      // Read of MC1319x GPIO2 pin 
#define MC1319xDrv_IsCcaBusy()              (*pMC1319xDrvPortGpio2 & mMC1319xDrvMaskGpio2)      // Read of MC1319x GPIO2 pin 


/************************************************************************************
* Driver prototype functions for setting MC1319x GPIO pins
************************************************************************************/

/************************************************************************************
* Set MC1319x RxTxEnable pin on MC1319x Transceiver.
*
* Ensures that actions written to the MC1319x command register do not take effect 
* until after the release (clr) of the pin.   
*
* Interface assumptions:
*   None
*   
* Return value:
*   None
* 
* Revision history:
*   date      Author    Comments
*   ------    ------    --------
*   100505    JT        Created
* 
************************************************************************************/
void MC1319xDrv_RxTxEnable(void);                         

/************************************************************************************
* Clr MC1319x RxTxEnable pin on MC1319x Transceiver.
*
* Ensures that actions written to the MC1319x command register do not take effect 
* until after the release (clr) of the pin.   
*   
* Interface assumptions:
*   None
*   
* Return value:
*   None
* 
* Revision history:
*   date      Author    Comments
*   ------    ------    --------
*   100505    JT        Created
* 
************************************************************************************/
void MC1319xDrv_RxTxDisable(void);                       

/************************************************************************************
* Set MC1319x antenna switch to Rx on MC1319x Transceiver - if switch available.
*
* It is intended that activation of an optional LNA for Rx is performed in connection 
* with these calls. Execution time must however be kept low very low (2-3us max). 
* Leave empty if no support for antenna switch is desired.
*   
* Interface assumptions:
*   None
*   
* Return value:
*   None
* 
* Revision history:
*   date      Author    Comments
*   ------    ------    --------
*   100505    JT        Created
* 
************************************************************************************/
void MC1319xDrv_RxAntennaSwitchEnable(void);   

/************************************************************************************
* Set MC1319x antenna switch to Tx on MC1319x Transceiver - if switch available.
*   
* It is intended that activation of an optional PA for Tx is performed in connection 
* with these calls. Execution time must however be kept low very low (2-3us max). 
* Leave empty if no support for antenna switch is desired.
*
 Interface assumptions:
*   None
*   
* Return value:
*   None
* 
* Revision history:
*   date      Author    Comments
*   ------    ------    --------
*   100505    JT        Created
* 
************************************************************************************/
void MC1319xDrv_TxAntennaSwitchEnable(void); 

/************************************************************************************
* Turn off LNA if present on MC1319x RF frontend.
*
* This primitive is invoked on receiver shut down. 
* It is assumed that the enabling of this device is performed using the 
* associated Rx Antenna Switch primitive. 
*
*   
* Interface assumptions:
*   None
*   
* Return value:
*   None
* 
* Revision history:
*   date      Author    Comments
*   ------    ------    --------
*   130505    JT        Created
* 
************************************************************************************/
void MC1319xDrv_RxLnaDisable(void);

/************************************************************************************
* Turn off PA if present on MC1319x RF frontend.
*   
* This primitive is invoked on transmitter shut down. 
* It is assumed that the enabling of this device is performed using the 
* associated Tx Antenna Switch primitive. 
*
*   None

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -