📄 drivers.h
字号:
/**
* Copyright (c) 2004, Freescale Semiconductor
* Freescale Confidential Proprietary
*
* File name : drivers.h
* Project name: SMAC (Simple Media Access Controller)
*
* Department : Freescale Radio Products Division
*
* Description : This is the SMAC C source driver header file for the HCS08 MCU
* and MC13192 transceiver. The header defines all externals, prototypes and
* MC13192 status mask bits used by the actual C driver.
*
* $Author: flr005 $
* $Date: 2006/02/23 16:24:37 $
* $Name: $
*/
#ifndef _DRIVERS_H
#define _DRIVERS_H
#ifdef DRIVERS_GLOBALS
#define DRIVERS_EXT
#else
#define DRIVERS_EXT extern
#endif
//#include "MC9S08GB60.h"
#include "pub_def.h"
/********************************************
Typedefs
********************************************/
/* Defines */
/* MC13192 status register interrupt masks. */
#define CLEAR_IRQ_FLAG IRQSC_IRQACK = 1 /*
* Dependent upon interrupt source
* chosen.
*/
#define TX_IRQ_MASK 0x0040
#define RAMERR_IRQ_MASK 0x4000
#define RX_IRQ_MASK 0x0080
#define ATTN_IRQ_MASK 0x0400
#define CRC_VALID_MASK 0x0001
#define TIMER1_IRQ_MASK 0x0100
#define TIMER4_IRQ_MASK 0x0010
#define XCVR_SEQ_MASK 0xFFF8
#define LO_LOCK_IRQ_MASK 0x8000
#define CCA_IRQ_MASK 0x0020
#define DOZE_IRQ_MASK 0x0200
#define RESET_BIT_MASK 0x0080
/* Prototypes */
/************************************************************
Function: void RTXENDeAssert(void)
Parameter:
Return:
Description: Deassert the MC13192 RTXEN pin (forces IC to idle)
************************************************************/
void RTXENDeAssert(void);
/************************************************************
Function: void RTXENAssert(void)
Parameter:
Return:
Description: Assert the MC13192 RTXEN pin (initiates programmed cycle)
************************************************************/
void RTXENAssert(void);
/************************************************************
Function: void SPIDrvWrite(UINT8 u8Addr, UINT16 u16Content)
Parameter: u8Addr address of register
u16Content the value that want to write to the register
Return:
Description: Write 1 word to SPI
************************************************************/
void SPIDrvWrite(UINT8 u8Addr, UINT16 u16Content);
/************************************************************
Function: UINT16 SPIDrvRead(UINT8 u8Addr)
Parameter: u8Addr address of register
Return: u16Data u16Data[0] is the MSB, u16Data[1] is the LSB
Description: Read 1 word from SPI
************************************************************/
UINT16 SPIDrvRead(UINT8 u8Addr);
/************************************************************
Function: void RAMDrvWriteTxFifo(UINT8 *psdu, UINT8 psduLength)
Parameter: psdu pointer to the packet
Return: psduLength length of the packet
Description: write the packet to the Tx fifo to transmit
************************************************************/
void RAMDrvWriteTxFifo(UINT8 *psdu, UINT8 psduLength);
/************************************************************
Function: void RAMDrvWriteTxFifo(UINT8 *psdu, UINT8 psduLength)
Parameter: psdu pointer to the packet
Return: psduLength length of the packet
Description: write the packet to the Tx fifo to transmit
************************************************************/
UINT8 RAMDrvReadRxFifo(UINT8 *psdu, UINT16 BufferSize);
/************************************************************
Function: CLRWDT()
Parameter:
Return:
Description: feed the dog
************************************************************/
#define CLRWDT() SRS = 0x00
/************************************************************
Function: SaveStatusReg()
Parameter:
Return:
Description: save current status then disable interrupts,this
function must use together with RestoreStatusReg()
************************************************************/
#define SaveStatusReg() { UINT8 CCR_reg ;asm PSHA; asm TPA; asm STA CCR_reg; asm SEI ; asm PULA;
/************************************************************
Function: RestoreStatusReg()
Parameter:
Return:
Description: Restore the status register ,the function must use after SaveStatusReg()
************************************************************/
/*Restore the status register */
#define RestoreStatusReg() asm PSHA; asm LDA CCR_reg; asm TAP; asm PULA; }
#endif /* _DRIVERS_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -