#include <string.h>
#include <stdbool.h>
#include <trx_access.h>
#include "miwi_config.h"
#include "miwi_config_p2p.h"
#include "delay.h"
#include "sal.h"
#include "phy.h"
#include "phy_at86rf212b.h"
#include "mimem.h"
#include "miqueue.h"
Macros | |
#define | PHY_CRC_SIZE 2 |
Enumerations | |
enum | PhyState_t { PHY_STATE_INITIAL, PHY_STATE_IDLE, PHY_STATE_SLEEP, PHY_STATE_TX_WAIT_END, PHY_STATE_INITIAL, PHY_STATE_IDLE, PHY_STATE_SLEEP, PHY_STATE_TX_WAIT_END } |
Functions | |
void | PHY_DataReq (PHY_DataReq_t *phyDataReq) |
void | PHY_DecryptReq (uint8_t *text, uint8_t *key) |
uint8_t | PHY_EdReq (void) |
void | PHY_EncryptReq (uint8_t *text, uint8_t *key) |
void | PHY_EncryptReqCBC (uint8_t *text, uint8_t *key) |
void | PHY_Init (void) |
uint16_t | PHY_RandomReq (void) |
void | PHY_SetBand (uint8_t band) |
void | PHY_SetChannel (uint8_t channel) |
void | PHY_SetIEEEAddr (uint8_t *ieee_addr) |
void | PHY_SetModulation (uint8_t modulation) |
void | PHY_SetPanId (uint16_t panId) |
void | PHY_SetRxState (bool rx) |
void | PHY_SetShortAddr (uint16_t addr) |
void | PHY_SetTxPower (uint8_t txPower) |
void | PHY_Sleep (void) |
void | PHY_TaskHandler (void) |
void | PHY_TxHandler (void) |
void | PHY_Wakeup (void) |
static uint8_t | phyReadRegister (uint8_t reg) |
static int8_t | phyRssiBaseVal (void) |
static void | phySetChannel (void) |
static void | phySetRxState (void) |
static void | phyTrxSetState (uint8_t state) |
static void | phyWaitState (uint8_t state) |
static void | phyWriteRegister (uint8_t reg, uint8_t value) |
Variables | |
PHY_DataReq_t | gPhyDataReq |
static uint8_t | phyBand |
static uint8_t | phyChannel |
static uint8_t | phyModulation |
static uint8_t | phyRxBuffer [128] |
static bool | phyRxState |
static PhyState_t | phyState = PHY_STATE_INITIAL |
MiQueue_t | phyTxQueue |
RxBuffer_t | RxBuffer [BANK_SIZE] |
#define PHY_CRC_SIZE 2 |
enum PhyState_t |
void PHY_DataReq | ( | PHY_DataReq_t * | phyDataReq | ) |
References PHY_DataReq_t::confirmCallback, MiMem_Alloc(), miQueueAppend(), NULL, PHY_STATUS_ERROR, and _PhyTxFrame_t::phyDataReq.
Referenced by MiMAC_SendPacket().
void PHY_DecryptReq | ( | uint8_t * | text, |
uint8_t * | key | ||
) |
References AES_DIR_DECRYPT, AES_MODE_ECB, NULL, PHY_STATE_SLEEP, PHY_Wakeup(), phyState, sal_aes_read(), sal_aes_setup(), and sal_aes_wrrd().
uint8_t PHY_EdReq | ( | void | ) |
References CCA_ED_DONE, IRQ_STATUS_REG, PHY_ED_LEVEL_REG, phyReadRegister(), phyRssiBaseVal(), phySetRxState(), phyTrxSetState(), phyWriteRegister(), RX_SYN_REG, TRX_CMD_PLL_ON, and TRX_CMD_RX_ON.
Referenced by MiMAC_ChannelAssessment().
void PHY_EncryptReq | ( | uint8_t * | text, |
uint8_t * | key | ||
) |
References AES_DIR_ENCRYPT, AES_MODE_ECB, NULL, PHY_STATE_SLEEP, PHY_Wakeup(), phyState, sal_aes_exec(), sal_aes_read(), sal_aes_setup(), and sal_aes_wrrd().
void PHY_EncryptReqCBC | ( | uint8_t * | text, |
uint8_t * | key | ||
) |
References AES_DIR_ENCRYPT, AES_MODE_CBC, NULL, PHY_STATE_SLEEP, PHY_Wakeup(), phyState, sal_aes_exec(), sal_aes_read(), sal_aes_setup(), and sal_aes_wrrd().
void PHY_Init | ( | void | ) |
References ALT_SPECTRUM, ANT_DIV_EN, ANT_DIV_REG, ANT_EXT_SW_EN, BPSK_OQPSK, FUNC_PTR, IRQ_MASK_MODE, IRQ_MASK_REG, PHY_STATE_IDLE, PHY_TX_PWR_REG, phyBand, phyModulation, phyReadRegister(), phyRxState, phyState, phyWriteRegister(), PWR_BPSK_OFFSET, RF_CTRL_0_REG, RX_SAFE_MODE, SPI_CMD_MODE, SUB_MODE, TRX_CMD_TRX_OFF, TRX_CTRL_1_REG, TRX_CTRL_2_REG, TRX_END, TRX_STATE_REG, TRX_STATUS_MASK, TRX_STATUS_REG, TRX_STATUS_TRX_OFF, TX_AUTO_CRC_ON, and TX_PWR.
Referenced by MiMAC_Init().
uint16_t PHY_RandomReq | ( | void | ) |
References delay_us, i, PHY_RSSI_REG, phyReadRegister(), phySetRxState(), phyTrxSetState(), phyWriteRegister(), RANDOM_NUMBER_UPDATE_INTERVAL, RND_VALUE, RX_SYN_REG, and TRX_CMD_RX_ON.
Referenced by longAddressValidationAndUpdation(), MiApp_StartConnection(), and MiMAC_Init().
void PHY_SetBand | ( | uint8_t | band | ) |
References phyBand, and phySetChannel().
void PHY_SetChannel | ( | uint8_t | channel | ) |
References PHY_STATE_SLEEP, PHY_Wakeup(), phyChannel, phySetChannel(), and phyState.
Referenced by MiMAC_Set().
void PHY_SetIEEEAddr | ( | uint8_t * | ieee_addr | ) |
References i, and IEEE_ADDR_0_REG.
Referenced by longAddressValidationAndUpdation(), MiMAC_Init(), and wsndemo_init().
void PHY_SetModulation | ( | uint8_t | modulation | ) |
References phyModulation, and phySetChannel().
void PHY_SetPanId | ( | uint16_t | panId | ) |
References PAN_ID_0_REG, PAN_ID_1_REG, and phyWriteRegister().
Referenced by MiMAC_SetAltAddress().
void PHY_SetRxState | ( | bool | rx | ) |
References phyRxState, and phySetRxState().
Referenced by MiMAC_Init().
void PHY_SetShortAddr | ( | uint16_t | addr | ) |
References CSMA_SEED_0_REG, phyWriteRegister(), SHORT_ADDR_0_REG, and SHORT_ADDR_1_REG.
Referenced by MiMAC_SetAltAddress().
void PHY_SetTxPower | ( | uint8_t | txPower | ) |
References PHY_TX_PWR_REG, phyReadRegister(), and phyWriteRegister().
void PHY_Sleep | ( | void | ) |
References ANT_DIV_REG, ANT_EXT_SW_EN, PHY_STATE_SLEEP, phyReadRegister(), phyState, phyTrxSetState(), phyWriteRegister(), and TRX_CMD_TRX_OFF.
Referenced by MiMAC_PowerState().
void PHY_TaskHandler | ( | void | ) |
References BANK_SIZE, PHY_DataReq_t::confirmCallback, i, IRQ_STATUS_REG, MAX_PSDU, NULL, RxBuffer_t::Payload, RxBuffer_t::PayloadLen, PHY_ED_LEVEL_REG, PHY_STATE_IDLE, PHY_STATE_SLEEP, PHY_STATE_TX_WAIT_END, PHY_STATUS_CHANNEL_ACCESS_FAILURE, PHY_STATUS_ERROR, PHY_STATUS_NO_ACK, PHY_STATUS_SUCCESS, PHY_TxHandler(), phyReadRegister(), phyRssiBaseVal(), phyRxBuffer, phySetRxState(), phyState, phyTrxSetState(), phyWaitState(), RX_PACKET_SIZE, TRAC_STATUS, TRAC_STATUS_CHANNEL_ACCESS_FAILURE, TRAC_STATUS_NO_ACK, TRAC_STATUS_SUCCESS, TRX_CMD_TRX_OFF, TRX_END, TRX_STATE_REG, and TRX_STATUS_RX_AACK_ON.
Referenced by MiMAC_Task().
void PHY_TxHandler | ( | void | ) |
References PHY_DataReq_t::confirmCallback, PHY_DataReq_t::data, IRQ_STATUS_REG, MAX_PSDU, MiMem_Free(), miQueueRemove(), NULL, PHY_STATE_IDLE, PHY_STATE_SLEEP, PHY_STATE_TX_WAIT_END, PHY_STATUS_CHANNEL_ACCESS_FAILURE, PHY_STATUS_ERROR, PHY_STATUS_NO_ACK, PHY_STATUS_SUCCESS, _PhyTxFrame_t::phyDataReq, phyReadRegister(), phySetRxState(), phyState, phyTrxSetState(), PHY_DataReq_t::polledConfirmation, MiQueue::size, TRAC_STATUS, TRAC_STATUS_CHANNEL_ACCESS_FAILURE, TRAC_STATUS_NO_ACK, TRAC_STATUS_SUCCESS, TRX_CMD_TX_ARET_ON, TRX_END, and TRX_STATE_REG.
Referenced by PHY_TaskHandler().
void PHY_Wakeup | ( | void | ) |
References ANT_DIV_REG, ANT_EXT_SW_EN, PHY_STATE_IDLE, PHY_STATE_SLEEP, phyReadRegister(), phySetRxState(), phyState, and phyWriteRegister().
Referenced by MiMAC_PowerState(), PHY_DecryptReq(), PHY_EncryptReq(), PHY_EncryptReqCBC(), PHY_SetChannel(), and stb_ccm_secure().
|
static |
|
static |
References BPSK_OQPSK, PHY_RSSI_BASE_VAL_BPSK_20, PHY_RSSI_BASE_VAL_BPSK_40, PHY_RSSI_BASE_VAL_OQPSK_RC_250, PHY_RSSI_BASE_VAL_OQPSK_SIN_250, PHY_RSSI_BASE_VAL_OQPSK_SIN_RC_100, phyModulation, and SUB_MODE.
Referenced by PHY_EdReq(), and PHY_TaskHandler().
|
static |
References CC_CTRL_0_REG, CC_CTRL_1_REG, PHY_CC_CCA_REG, PHY_MOD_BPSK20_CHAN_0, PHY_MOD_BPSK40_CHAN_N, phyBand, phyChannel, phyModulation, phyReadRegister(), and phyWriteRegister().
Referenced by PHY_SetBand(), PHY_SetChannel(), and PHY_SetModulation().
|
static |
References IRQ_STATUS_REG, PHY_STATE_IDLE, phyReadRegister(), phyRxState, phyState, phyTrxSetState(), TRX_CMD_RX_AACK_ON, and TRX_CMD_TRX_OFF.
Referenced by PHY_EdReq(), PHY_RandomReq(), PHY_SetRxState(), PHY_TaskHandler(), PHY_TxHandler(), and PHY_Wakeup().
|
static |
References PHY_STATE_SLEEP, phyReadRegister(), phyState, phyWriteRegister(), TRX_CMD_FORCE_TRX_OFF, TRX_STATE_REG, TRX_STATUS_MASK, TRX_STATUS_REG, and TRX_STATUS_TRX_OFF.
Referenced by PHY_EdReq(), PHY_RandomReq(), PHY_Sleep(), PHY_TaskHandler(), PHY_TxHandler(), and phySetRxState().
|
static |
References phyReadRegister(), TRX_STATUS_MASK, and TRX_STATUS_REG.
Referenced by PHY_TaskHandler().
|
static |
Referenced by PHY_EdReq(), PHY_Init(), PHY_RandomReq(), PHY_SetPanId(), PHY_SetShortAddr(), PHY_SetTxPower(), PHY_Sleep(), PHY_Wakeup(), phySetChannel(), and phyTrxSetState().
PHY_DataReq_t gPhyDataReq |
|
static |
Referenced by PHY_Init(), PHY_SetBand(), and phySetChannel().
|
static |
Referenced by PHY_SetChannel(), and phySetChannel().
|
static |
Referenced by PHY_Init(), PHY_SetModulation(), phyRssiBaseVal(), and phySetChannel().
|
static |
Referenced by PHY_TaskHandler().
|
static |
Referenced by PHY_Init(), PHY_SetRxState(), and phySetRxState().
|
static |
MiQueue_t phyTxQueue |
RxBuffer_t RxBuffer[BANK_SIZE] |
Referenced by MiMAC_DiscardPacket(), MiMAC_Init(), and MiMAC_ReceivedPacket().