#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 "mimem.h"
#include "miqueue.h"
Macros | |
#define | PHY_CRC_SIZE 2 |
#define | PHY_RSSI_BASE_VAL (-94) |
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_SetChannel (uint8_t channel) |
void | PHY_SetIEEEAddr (uint8_t *ieee_addr) |
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 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 | 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 |
#define PHY_RSSI_BASE_VAL (-94) |
Referenced by PHY_TaskHandler().
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.
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 | ) |
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 ANT_DIV_EN, ANT_DIV_REG, ANT_EXT_SW_EN, FUNC_PTR, IRQ_MASK_MODE, IRQ_MASK_REG, OQPSK_SCRAM_EN, PHY_STATE_IDLE, phyReadRegister(), phyRxState, phyState, phyWriteRegister(), RX_SAFE_MODE, SPI_CMD_MODE, TRX_CMD_TRX_OFF, TRX_CTRL_1_REG, TRX_CTRL_2_REG, TRX_END, TRX_RPC_REG, TRX_STATE_REG, TRX_STATUS_MASK, TRX_STATUS_REG, TRX_STATUS_TRX_OFF, and TX_AUTO_CRC_ON.
uint16_t PHY_RandomReq | ( | void | ) |
References delay_cycles_us(), i, PHY_RSSI_REG, phyReadRegister(), phySetRxState(), phyTrxSetState(), RND_VALUE, and TRX_CMD_RX_ON.
void PHY_SetChannel | ( | uint8_t | channel | ) |
References PHY_CC_CCA_REG, PHY_STATE_SLEEP, PHY_Wakeup(), phyReadRegister(), phyState, and phyWriteRegister().
void PHY_SetIEEEAddr | ( | uint8_t * | ieee_addr | ) |
References i, and IEEE_ADDR_0_REG.
void PHY_SetPanId | ( | uint16_t | panId | ) |
References PAN_ID_0_REG, PAN_ID_1_REG, and phyWriteRegister().
void PHY_SetRxState | ( | bool | rx | ) |
References phyRxState, and phySetRxState().
void PHY_SetShortAddr | ( | uint16_t | addr | ) |
References CSMA_SEED_0_REG, phyWriteRegister(), SHORT_ADDR_0_REG, and SHORT_ADDR_1_REG.
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.
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_RSSI_BASE_VAL, 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(), 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.
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.
void PHY_Wakeup | ( | void | ) |
References ANT_DIV_REG, ANT_EXT_SW_EN, PHY_STATE_IDLE, PHY_STATE_SLEEP, phyReadRegister(), phySetRxState(), phyState, and phyWriteRegister().
|
static |
|
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_SetChannel(), PHY_SetPanId(), PHY_SetShortAddr(), PHY_SetTxPower(), PHY_Sleep(), PHY_Wakeup(), and phyTrxSetState().
PHY_DataReq_t gPhyDataReq |
|
static |
Referenced by PHY_TaskHandler().
|
static |
Referenced by PHY_Init(), PHY_SetRxState(), and phySetRxState().
|
static |
MiQueue_t phyTxQueue |
RxBuffer_t RxBuffer[BANK_SIZE] |