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

📄 iai_ezmac_lite_int.h

📁 Integration的EZMac Lite
💻 H
📖 第 1 页 / 共 2 页
字号:
   byte     PLENB;
   byte     DBuff[PLEN_MAX];

} T_EZRegfield;



typedef struct { // registers by byte

/// CONTROL REGISTERS

   byte     MCRB;
   byte     TCRB;
   byte     RCRB;
   byte     PFCRB;
   byte     FR[NMBR_OF_CHANNELS];
   byte     FMASKB;
   byte     CIDB;
   byte     SFLTB;
   byte     SMSKB;
   byte     SFIDB;
   byte     RPLB;

/// DATA & STATUS REGISTERS

   byte     MSRB;
   byte     RSRB;
   byte     RX_CIDB;
   byte     SIDB;
   byte     DIDB;
   byte     PLENB;
   byte     DBuff[PLEN_MAX];

} T_EZRegbytes;


_NEAR__ union {
   T_EZRegfield   bits;
   T_EZRegbytes   bytes;
   byte           arr[REGBANK_SIZE + DATABANK_SIZE];
// Changed by Laszlo Kadar on 29.11.05
#ifdef HITECH_COMPILER
 } BANK_1 EZ_reg;
#endif
#ifdef CCS_C_COMPILER
 } EZ_reg;
#endif

#ifdef FIX_MEM_ADDRESS
#pragma locate EZ_reg = 0x2B
#endif

// shortcut for state register:
#define EZ_state EZ_reg.bytes.MSRB
#define EZ_dbuff EZ_reg.bytes.DBuff

typedef enum
{
    Config_command,
    Power_command,
    Freq_command,
    Data_Rate_command,
    RX_Ctrl_command,
    Data_Filter_command,
    Fifo_command,
    AFC_command,
    TX_Ctrl_command,
    Wake_command,
    Low_Duty_command,
    LBD_command
}Command_words;

typedef struct { // EZradio registers

   int16 ConfigW;
   int16 PowerW;
   int16 FreqW;
   int16 DataW;
   int16 RX_CtrlW;
   int16 Data_FltW;
   int16 FifoW;
   int16 AFCW;
   int16 TX_CtrlW;
   int16 WakeW;
   int16 Low_DutyW;
   int16 LBDW;
} stru_EZRadioregs;

#define NR_OF_CMDS   12

_NEAR__ union {
   stru_EZRadioregs    words;
   int16               arr[NR_OF_CMDS];
// Changed by Laszlo Kadar on 29.11.05
#ifdef HITECH_COMPILER
 } BANK_1 EZ_commands;
#endif
#ifdef CCS_C_COMPILER
 } EZ_commands;
#endif

/*#ifdef FIX_MEM_ADDRESS
#locate EZ_commands = 0x6C
#endif*/

                /* ======================================= *
                 *            V A R I A B L E S            *
                 * ======================================= */


// Changed by Laszlo Kadar on 29.11.05
#ifdef HITECH_COMPILER
 volatile static _NEAR__ int8 BANK_2 Frequency,EZ_crccnt;              //the current frequency channel
 volatile static _NEAR__ reg16_union BANK_2 EZ_crc;                    //the current CRC value
 volatile static _NEAR__ state BANK_2 EZInternalState;                 //internal states
 volatile static _NEAR__ int8 BANK_2 DataByteCounter;                  //temp variable for the State_Machine
 volatile static _NEAR__ int8 BANK_2 Data, Data1;                      //temp registers for State_Machine
 volatile static _NEAR__ BOOL BANK_2 SetSpiEn;                         //In Rx states it shouldn't set the SPI select pin to 1 in the Interrupt routine, because the
                                                       //state machine will read the data byte from the FIFO after the status read command
                                                       //if SetSpiEn = 1 - the interrupt routine will set the SPI select pin
 volatile static _NEAR__ int8 BANK_2 ARSSI_value;                      //this variable contains the last ARSSI value                                 
#endif
#ifdef CCS_C_COMPILER
 volatile static int8 Frequency,EZ_crccnt;              //the current frequency channel
 volatile static reg16_union EZ_crc;                    //the current CRC value
 volatile static state EZInternalState;                 //internal states
 volatile static int8 DataByteCounter;                  //temp variable for the State_Machine
 volatile static int8 Data, Data1;                      //temp registers for State_Machine
 volatile static BOOL SetSpiEn;                         //In Rx states it shouldn't set the SPI select pin to 1 in the Interrupt routine, because the
                                                       //state machine will read the data byte from the FIFO after the status read command
                                                       //if SetSpiEn = 1 - the interrupt routine will set the SPI select pin
 volatile static int8 ARSSI_value;                      //this variable contains the last ARSSI value                                 
#endif

/*
int16 Config_command;
int16 Power_command;
int16 Freq_command;
int16 Data_Rate_command;
int16 RX_Ctrl_command;
int16 Data_Filter_command;
int16 Fifo_command;
int16 AFC_command;
int16 TX_Ctrl_command;
int16 Wake_command;
int16 Low_Duty_command;
int16 LBD_command;
*/
#ifdef FIX_MEM_ADDRESS
#pragma locate EZ_crc = 0x5D
#pragma byte Frequency = 0x5F
#pragma byte EZ_crccnt = 0x60
#pragma byte EZInternalState = 0x61
#pragma byte DataByteCounter = 0x66
#pragma byte Data = 0x6A
#pragma byte Data1 = 0x6B
#pragma bit  SetSpiEn = 0x64.4
/*
#locate Config_command = 0x6C
#locate Power_command = 0x6E
#locate Freq_command = 0x70
#locate Fifo_command = 0x72
//#locate Data_Rate_command = 0x74
#locate RX_Ctrl_command = 0x74
/*#locate Data_Filter_command = 0x
#locate AFC_command = 0x
#locate TX_Ctrl_command = 0x
#locate Wake_command = 0x
#locate Low_Duty_command = 0x
#locate LBD_command = 0x  */
#endif



                /* ======================================= *
                 *        M I S C E L L A N E O U S        *
                 * ======================================= */
/* void */


                /* ======================================= *
                 *  F U N C T I O N   P R O T O T Y P E S  *
                 * ======================================= */


/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  +
  + FUNCTION NAME:  Ch_Check_Start
  +
  + DESCRIPTION:    Set the frequency of the channel (input parameter), set the Timer
  +                 and start checking of the channel.
  +
  + RETURN:         none.
  +
  + NOTES:
  +
  +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
#pragma separate
void Ch_Check_Start (bool ChangeFreq);


/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  +
  + FUNCTION NAME:  DQD_Check
  +
  + DESCRIPTION:    Read the DQD and return the value.
  +
  + RETURN:         TRUE:  DQD = 1 (the channel is occupied)
  +                 FALSE: DQD = 0 (the channel is free)
  +
  + NOTES:
  +
  +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
#pragma separate
bool DQD_Check (void);


/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  +
  + FUNCTION NAME:  State_Machine
  +
  + DESCRIPTION:    EZmac's state machine implementation.
  +
  + RETURN:         none.
  +
  + NOTES:          The function is called from the Timer or External ISR.
  +                 It_Source parameter shows from witch ISR was called the function.
  +
  +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
#pragma separate
void State_Machine (char It_Source);


/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  +
  + FUNCTION NAME:  Crc_On_Fly
  +
  + DESCRIPTION:    Calculate the CRC value from byte to byte during the receiving.
  +
  + RETURN:         Crc: the current value of the CRC
  +
  + NOTES:          Data is the current input byte.
  +                 Crc is an input and output parameter too. The state machine should store
  +                 the previously Crc value and this is the input parameter for the next crc calculation.
  +                 If the state machine want to reset the crc calculations, then it should call the
  +                 function with Crc = 0 value.
  +
  +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
#pragma separate
// Changed by Laszlo Kadar on 26.11.05
void Crc_On_Fly(int8 Data);

/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  +
  + FUNCTION NAME:  Crc_Init
  +
  + DESCRIPTION:    Initialise the CRC routine
  +
  + RETURN:         none.
  +
  + NOTES:          This function should call before the first calling of the Crc_On_Fly routine.
  +
  +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
void Crc_Init(void);

/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  +
  + FUNCTION NAME:  void _Set_Timer1(char Limit)
  +
  + DESCRIPTION:    Set and start the Timer1. Input parameter is the TIMER_LIMIT defines
  +
  + RETURN:         none.
  +
  + NOTES:
  +
  +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
#pragma separate
void _Set_Timer1(int16 Limit);
#ifdef CCS_C_COMPILER
 #pragma inline
 void _Turn_Off_Timer1(void);
#endif
#ifdef HITECH_COMPILER
 void _Turn_Off_Timer1(void);
// #pragma inline(_Turn_Off_Timer1);
#endif

/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  +
  + FUNCTION NAME:  void EZ_Reg_Default(void)
  +
  + DESCRIPTION:    Set the default values to the EZ_reg
  +
  + RETURN:         none.
  +
  + NOTES:
  +
  +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
#pragma separate
void EZ_Reg_Default(void);

/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  +
  + FUNCTION NAME:  void EZ_Radio_Config(void)
  +
  + DESCRIPTION:    Configures the EZradio with default values
  +
  + RETURN:         none.
  +
  + NOTES:
  +
  +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
#pragma separate
void EZ_Radio_Config(void);

#pragma separate
char EZRadio_CMD_Write (int8 CMD_index);

#endif
#pragma list

⌨️ 快捷键说明

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