?? lpradio.h
字號:
//--------------------------------------------------------------------------
//
// Filename: lpradio.h
//
// Description: Include file which defines the Radio C prototypes
//
//--------------------------------------------------------------------------
// WirelessUSB LP Radio Driver Version 1.0
// $Revision: 3 $
//--------------------------------------------------------------------------
//
// Copyright 2003-2006, Cypress Semiconductor Corporation.
//
// This software is owned by Cypress Semiconductor Corporation (Cypress)
// and is protected by and subject to worldwide patent protection (United
// States and foreign), United States copyright laws and international
// treaty provisions. Cypress hereby grants to licensee a personal,
// non-exclusive, non-transferable license to copy, use, modify, create
// derivative works of, and compile the Cypress Source Code and derivative
// works for the sole purpose of creating custom software in support of
// licensee product to be used only in conjunction with a Cypress integrated
// circuit as specified in the applicable agreement. Any reproduction,
// modification, translation, compilation, or representation of this
// software except as specified above is prohibited without the express
// written permission of Cypress.
//
// Disclaimer: CYPRESS MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// WITH REGARD TO THIS MATERIAL, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
// Cypress reserves the right to make changes without further notice to the
// materials described herein. Cypress does not assume any liability arising
// out of the application or use of any product or circuit described herein.
// Cypress does not authorize its products for use as critical components in
// life-support systems where a malfunction or failure may reasonably be
// expected to result in significant injury to the user. The inclusion of
// Cypress' product in a life-support systems application implies that the
// manufacturer assumes all risk of such use and in doing so indemnifies
// Cypress against all charges.
//
// Use may be limited by and subject to the applicable Cypress software
// license agreement.
//
//--------------------------------------------------------------------------
#ifndef inc_lpradio_h
#define inc_lpradio_h
//--------------------------------------
// Included files
//--------------------------------------
#include "m8c.h"
#include "lpregs.h"
typedef unsigned char RADIO_FRAME_CONFIG;
#define RADIO_SOP_EN 0x80
#define RADIO_SOP_LEN 0x40
#define RADIO_LEN_EN 0x20
#define RADIO_SOP_THRESH_MSK 0x1F
typedef unsigned char RADIO_TX_STATUS;
#define RADIO_XS 0x80
#define RADIO_LV 0x40
#define RADIO_TXE 0x01
//----------------------------------------------------------------------------
//
// LP SPI Interface definitions:
//
#define mSPI_ADDRESS 0x3Fh
#define bSPI_WRITE 0x80h
#define bSPI_AUTO_INC 0x40h
//----------------------------------------------------------------------------
//
// RADIO_STATE uses many of the same bits as the RX_IRQ_STATUS_ADR register. We
// add in a couple of our own. If something changes and we have a collision
// between the symbolics and the constants that should generate a compile error.
//
typedef unsigned char RADIO_STATE;
#define RADIO_IDLE 0x00
#define RADIO_RX 0x80
#define RADIO_TX 0x20
#define RADIO_SOP SOFDET_IRQ
#define RADIO_DATA RXB1_IRQ
#define RADIO_COMPLETE RXC_IRQ
#define RADIO_ERROR RXE_IRQ
//----------------------------------------------------------------------------
//
// XACT_CONFIG defines the states the radio hardware can automatically
// got to after performing an operation and whether the radio acks
// automatically.
//
typedef unsigned char XACT_CONFIG;
//----------------------------------------------------------------------------
//
// TX_CONFIG defines the data and SOP length and encoding for transmit data
// and also the TX power.
//
typedef unsigned char TX_CONFIG;
//----------------------------------------------------------------------------
//
// RADIO_RX_STATUS
//
typedef unsigned char RADIO_RX_STATUS;
#define RADIO_RX_ACK 0x80
#define RADIO_RX_MISS 0x40
#define RADIO_RX_OF 0x20
#define RADIO_RX_CRC0 0x10
#define RADIO_BAD_CRC 0x08
#define RADIO_DATCODE_LEN 0x04
#define RADIO_SDR 0x03
#define RADIO_DDR 0x02
#define RADIO_8DR 0x01
#define RADIO_GFSK 0x00
//--------------------------------------
// Type Declarations
//--------------------------------------
typedef unsigned char RADIO_LENGTH;
typedef unsigned char RADIO_REG_ADDR;
typedef void *RADIO_BUFFER_PTR;
typedef const char *RADIO_CONST_PTR;
typedef unsigned char RADIO_RSSI;
//--------------------------------------
// API Function Declarations
//--------------------------------------
//
// All these functions are fastcall16.
//
#pragma fastcall16 RadioReset
#pragma fastcall16 RadioRead
#pragma fastcall16 RadioWrite
#pragma fastcall16 RadioSetPtr
#pragma fastcall16 RadioSetLength
#pragma fastcall16 RadioFileRead
#pragma fastcall16 RadioFileWrite
#pragma fastcall16 RadioBurstRead
#pragma fastcall16 RadioBurstWrite
#pragma fastcall16 RadioStartAtom
#pragma fastcall16 RadioEndAtom
#pragma fastcall16 RadioSetFrequency
#pragma fastcall16 RadioSetChannel
#pragma fastcall16 RadioGetFrequency
#pragma fastcall16 RadioGetChannel
#pragma fastcall16 RadioSetTxConfig
#pragma fastcall16 RadioGetTxConfig
#pragma fastcall16 RadioSetXactConfig
#pragma fastcall16 RadioGetXactConfig
#pragma fastcall16 RadioSetFrameConfig
#pragma fastcall16 RadioGetFrameConfig
#pragma fastcall16 RadioSetThreshold32
#pragma fastcall16 RadioGetThreshold32
#pragma fastcall16 RadioSetThreshold64
#pragma fastcall16 RadioGetThreshold64
#pragma fastcall16 RadioSetPreambleCount
#pragma fastcall16 RadioGetPreambleCount
#pragma fastcall16 RadioSetPreamblePattern
#pragma fastcall16 RadioGetPreamblePattern
#pragma fastcall16 RadioSetSopPnCode
#pragma fastcall16 RadioSetConstDataPnCode
#pragma fastcall16 RadioSetConstSopPnCode
#pragma fastcall16 RadioSetCrcSeed
#pragma fastcall16 RadioGetCrcSeed
#pragma fastcall16 RadioGetRssi
#pragma fastcall16 RadioInit
#pragma fastcall16 RadioBlockingTransmit
#pragma fastcall16 RadioStartTransmit
#pragma fastcall16 RadioStartReceive
#pragma fastcall16 RadioGetTransmitState
#pragma fastcall16 RadioGetReceiveState
#pragma fastcall16 RadioGetReceiveStatus
#pragma fastcall16 RadioEndTransmit
#pragma fastcall16 RadioEndReceive
#pragma fastcall16 RadioAbort
#pragma fastcall16 RadioGetFuses
//
// Low level SPI access routines.
//
extern void RadioReset(void);
extern BYTE RadioRead(RADIO_REG_ADDR regAddr);
extern void RadioWrite(RADIO_REG_ADDR regAddr, BYTE value);
extern void RadioSetPtr(RADIO_BUFFER_PTR ramPtr);
extern void RadioSetLength(unsigned char length);
extern void RadioFileRead(RADIO_REG_ADDR regAddr, RADIO_LENGTH cnt);
extern void RadioFileWrite(RADIO_REG_ADDR regAddr, RADIO_LENGTH cnt);
extern void RadioBurstRead(RADIO_REG_ADDR regAddr, RADIO_LENGTH cnt);
extern void RadioBurstWrite(RADIO_REG_ADDR regAddr, RADIO_LENGTH cnt);
extern void RadioStartAtom(void);
extern void RadioEndAtom(void);
//
// Configuration access routines.
//
extern void RadioSetFrequency(BYTE frequency);
extern void RadioSetChannel(BYTE channel);
extern BYTE RadioGetFrequency(void);
extern BYTE RadioGetChannel(void);
extern void RadioSetTxConfig(TX_CONFIG config);
extern TX_CONFIG RadioGetTxConfig(void);
extern void RadioSetXactConfig(XACT_CONFIG config);
extern XACT_CONFIG RadioGetXactConfig(void);
extern void RadioSetTxConfig(XACT_CONFIG config);
extern void RadioSetFrameConfig(RADIO_FRAME_CONFIG config);
extern RADIO_FRAME_CONFIG RadioGetFrameConfig(void);
extern void RadioSetThreshold32(BYTE threshold);
extern BYTE RadioGetThreshold32(void);
extern void RadioSetThreshold64(BYTE threshold);
extern BYTE RadioGetThreshold64(void);
extern void RadioSetPreambleCount(BYTE count);
extern BYTE RadioGetPreambleCount(void);
extern void RadioSetPreamblePattern(WORD pattern);
extern WORD RadioGetPreamblePattern(void);
extern void RadioSetSopPnCode(BYTE patternNum);
extern void RadioSetConstDataPnCode(const BYTE *patternAddr);
extern void RadioSetConstSopPnCode(const BYTE *patternAddr);
extern void RadioSetCrcSeed(WORD crcSeed);
extern WORD RadioGetCrcSeed(void);
extern void RadioReadFuses(void);
extern RADIO_RSSI RadioGetRssi(void);
extern void RadioGetFuses(void);
//
// Synch and asynch transmit and receive routines.
//
extern void RadioInit(XACT_CONFIG defaultXactState, TX_CONFIG defaultTxState);
extern void RadioStartTransmit(BYTE retryCount, RADIO_LENGTH length);
extern RADIO_STATE RadioBlockingTransmit(BYTE retryCount, RADIO_LENGTH length);
extern void RadioStartRetransmit(void);
extern void RadioStartReceive(void);
extern RADIO_STATE RadioGetTransmitState(void);
extern RADIO_STATE RadioGetReceiveState(void);
extern RADIO_RX_STATUS RadioGetReceiveStatus(void);
extern RADIO_STATE RadioEndTransmit(void);
extern RADIO_LENGTH RadioEndReceive(void);
extern RADIO_LENGTH RadioAbort(void);
//
// Return value for a RadioAbort completed successfully. Otherwise the return value
// is the length of the packet received (without error).
//
#define RADIO_ABORT_SUCCESS 0xFF
extern RADIO_STATE RadioState;
#endif // inc_lpradio_h
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -