This module includes api's and defenitions required for Devices with externally plugged transceivers(Non Soc's)
Macros | |
#define | ENTER_TRX_CRITICAL_REGION() |
#define | IRQ_PINGET() ioport_get_pin_level(AT86RFX_IRQ_PIN) |
#define | LEAVE_TRX_CRITICAL_REGION() cpu_irq_restore(flags); } |
#define | READ_ACCESS_COMMAND (0x80) |
Read access command to the tranceiver. More... | |
#define | RST_HIGH() |
Set TRX GPIO pins. More... | |
#define | RST_LOW() |
#define | SLP_TR_HIGH() |
#define | SLP_TR_LOW() |
#define | TRX_CMD_FR (0x20) |
Frame read command of transceiver. More... | |
#define | TRX_CMD_FW (0x60) |
Frame write command of transceiver. More... | |
#define | TRX_CMD_SR (0x00) |
SRAM read command of transceiver. More... | |
#define | TRX_CMD_SW (0x40) |
SRAM write command of transceiver. More... | |
#define | trx_irq_flag_clr() CLEAR_TRX_IRQ() |
Clears the transceiver main interrupt. More... | |
#define | TRX_IRQ_HIGH() IRQ_PINGET() |
Macro to get the transceiver's main IRQ status. More... | |
#define | TRX_RST_HIGH() RST_HIGH() |
Macro to set Reset pin to high. More... | |
#define | TRX_RST_LOW() RST_LOW() |
Macro to set Reset pin to low. More... | |
#define | TRX_SLP_TR_HIGH() SLP_TR_HIGH() |
Macro to set SLP_TR pin to high. More... | |
#define | TRX_SLP_TR_LOW() SLP_TR_LOW() |
Macro to set SLP_TR pin to low. More... | |
#define | TRX_TRIG_DELAY() {nop(); nop(); } |
#define | U16_TO_TARGET(x) (x) |
This macro is used for handling endianness among the different CPUs. More... | |
#define | WRITE_ACCESS_COMMAND (0xC0) |
Write access command of the transceiver. More... | |
Typedefs | |
typedef void(* | irq_handler_t )(void) |
Functions | |
void | PhyReset (void) |
Resets the TRX radio. More... | |
void | trx_aes_wrrd (uint8_t addr, uint8_t *idata, uint8_t length) |
Writes and reads data into/from SRAM of the transceiver. More... | |
uint8_t | trx_bit_read (uint8_t addr, uint8_t mask, uint8_t pos) |
Subregister read. More... | |
void | trx_bit_write (uint8_t reg_addr, uint8_t mask, uint8_t pos, uint8_t new_value) |
Subregister write. More... | |
void | trx_frame_read (uint8_t *data, uint8_t length) |
Reads frame buffer of the transceiver. More... | |
void | trx_frame_write (uint8_t *data, uint8_t length) |
Writes data into frame buffer of the transceiver. More... | |
void | trx_irq_init (FUNC_PTR trx_irq_cb) |
uint8_t | trx_reg_read (uint8_t addr) |
Reads current value from a transceiver register. More... | |
void | trx_reg_write (uint8_t addr, uint8_t data) |
Writes data into a transceiver register. More... | |
void | trx_spi_disable (void) |
Disables the SPI interface for communication with the transceiver. More... | |
void | trx_spi_done_cb_init (void *spi_done_cb) |
SPI done callback initialization. More... | |
void | trx_spi_enable (void) |
enables the SPI interface for communication with the transceiver More... | |
void | trx_spi_init (void) |
Initializes the SPI interface for communication with the transceiver. More... | |
void | trx_sram_read (uint8_t addr, uint8_t *data, uint8_t length) |
Reads data from SRAM of the transceiver. More... | |
void | trx_sram_write (uint8_t addr, uint8_t *data, uint8_t length) |
Writes data into SRAM of the transceiver. More... | |
#define ENTER_TRX_CRITICAL_REGION | ( | ) |
Referenced by read(), trx_frame_read(), trx_frame_write(), trx_reg_read(), trx_reg_write(), trx_sram_read(), and trx_sram_write().
#define IRQ_PINGET | ( | ) | ioport_get_pin_level(AT86RFX_IRQ_PIN) |
#define LEAVE_TRX_CRITICAL_REGION | ( | ) | cpu_irq_restore(flags); } |
Referenced by read(), trx_frame_read(), trx_frame_write(), trx_reg_read(), trx_reg_write(), trx_sram_read(), and trx_sram_write().
#define READ_ACCESS_COMMAND (0x80) |
Read access command to the tranceiver.
Referenced by trx_reg_read().
#define RST_HIGH | ( | ) |
Set TRX GPIO pins.
Referenced by PhyReset().
#define RST_LOW | ( | ) |
Referenced by PhyReset().
#define SLP_TR_HIGH | ( | ) |
#define SLP_TR_LOW | ( | ) |
Referenced by PhyReset().
#define TRX_CMD_FR (0x20) |
Frame read command of transceiver.
Referenced by trx_frame_read().
#define TRX_CMD_FW (0x60) |
Frame write command of transceiver.
Referenced by trx_frame_write().
#define TRX_CMD_SR (0x00) |
SRAM read command of transceiver.
Referenced by trx_sram_read().
#define TRX_CMD_SW (0x40) |
SRAM write command of transceiver.
Referenced by trx_aes_wrrd(), and trx_sram_write().
#define trx_irq_flag_clr | ( | ) | CLEAR_TRX_IRQ() |
Clears the transceiver main interrupt.
Referenced by rf_generate_random_seed().
#define TRX_IRQ_HIGH | ( | ) | IRQ_PINGET() |
Macro to get the transceiver's main IRQ status.
Referenced by switch_pll_on().
#define TRX_RST_HIGH | ( | ) | RST_HIGH() |
Macro to set Reset pin to high.
Referenced by trx_init(), and trx_reset().
#define TRX_RST_LOW | ( | ) | RST_LOW() |
Macro to set Reset pin to low.
Referenced by trx_init(), and trx_reset().
#define TRX_SLP_TR_HIGH | ( | ) | SLP_TR_HIGH() |
Macro to set SLP_TR pin to high.
Referenced by handle_tx_end_irq(), PHY_DataReq(), PHY_Sleep(), send_frame(), set_trx_state(), and tfa_continuous_tx_start().
#define TRX_SLP_TR_LOW | ( | ) | SLP_TR_LOW() |
Macro to set SLP_TR pin to low.
Referenced by handle_tx_end_irq(), PHY_DataReq(), PHY_Wakeup(), send_frame(), set_trx_state(), tfa_continuous_tx_start(), trx_init(), and trx_reset().
Referenced by PHY_DataReq().
#define U16_TO_TARGET | ( | x | ) | (x) |
This macro is used for handling endianness among the different CPUs.
#define WRITE_ACCESS_COMMAND (0xC0) |
Write access command of the transceiver.
Referenced by trx_reg_write().
typedef void(* irq_handler_t)(void) |
void PhyReset | ( | void | ) |
Resets the TRX radio.
References delay_us, RST_HIGH, RST_LOW, and SLP_TR_LOW.
Referenced by PHY_Init().
void trx_aes_wrrd | ( | uint8_t | addr, |
uint8_t * | idata, | ||
uint8_t | length | ||
) |
Writes and reads data into/from SRAM of the transceiver.
This function writes data into the SRAM of the transceiver and simultaneously reads the bytes.
addr | Start address in the SRAM for the write operation |
idata | Pointer to the data written/read into/from SRAM |
length | Number of bytes written/read into/from SRAM |
References delay_us, master, slave, SPI_AT86RFX_DEVICE, spi_is_ready_to_read(), spi_is_ready_to_write(), spi_is_write_complete(), spi_read(), spi_select_slave(), spi_write(), and TRX_CMD_SW.
Referenced by sal_aes_wrrd().
uint8_t trx_bit_read | ( | uint8_t | addr, |
uint8_t | mask, | ||
uint8_t | pos | ||
) |
Subregister read.
addr | offset of the register |
mask | bit mask of the subregister |
pos | bit position of the subregister |
References ret, and trx_reg_read().
Referenced by get_batmon_voltage(), handle_received_frame_irq(), handle_tx_end_irq(), perform_cca_twice(), rf212_transmit(), rf233_transmit(), rf_generate_random_seed(), set_trx_state(), switch_pll_on(), tal_generate_rand_seed(), tal_get_curr_trx_config(), tal_get_trx_status(), tal_set_frequency(), tal_set_frequency_regs(), tfa_cca_perform(), tfa_get_batmon_voltage(), trx_init(), trx_irq_handler_cb(), and trx_reset().
void trx_bit_write | ( | uint8_t | reg_addr, |
uint8_t | mask, | ||
uint8_t | pos, | ||
uint8_t | new_value | ||
) |
Subregister write.
[in] | reg_addr | Offset of the register |
[in] | mask | Bit mask of the subregister |
[in] | pos | Bit position of the subregister |
[out] | new_value | Data, which is muxed into the register |
References trx_reg_read(), and trx_reg_write().
Referenced by apply_channel_page_configuration(), config_frequency(), get_batmon_voltage(), per_mode_receptor_init(), perform_cca_twice(), rf212_init(), rf233_init(), rf_generate_random_seed(), send_frame(), set_trx_state(), tal_generate_rand_seed(), tal_pib_set(), tal_set_frequency(), tal_set_frequency_regs(), tfa_cca_perform(), tfa_continuous_tx_start(), tfa_ed_sample(), tfa_get_batmon_voltage(), tfa_pib_set(), trx_config(), trx_init(), trx_irq_handler_cb(), and write_all_tal_pib_to_trx().
void trx_frame_read | ( | uint8_t * | data, |
uint8_t | length | ||
) |
Reads frame buffer of the transceiver.
This function reads the frame buffer of the transceiver.
[out] | data | Pointer to the location to store frame |
[in] | length | Number of bytes to be read from the frame buffer. |
References ENTER_TRX_CRITICAL_REGION, LEAVE_TRX_CRITICAL_REGION, master, slave, SPI_AT86RFX_DEVICE, spi_is_ready_to_read(), spi_is_ready_to_write(), spi_is_write_complete(), spi_read(), spi_select_slave(), spi_write(), and TRX_CMD_FR.
Referenced by handle_received_frame_irq(), PHY_TaskHandler(), rf212_read(), and rf233_read().
void trx_frame_write | ( | uint8_t * | data, |
uint8_t | length | ||
) |
Writes data into frame buffer of the transceiver.
This function writes data into the frame buffer of the transceiver
[in] | data | Pointer to data to be written into frame buffer |
[in] | length | Number of bytes to be written into frame buffer |
References ENTER_TRX_CRITICAL_REGION, LEAVE_TRX_CRITICAL_REGION, master, slave, SPI_AT86RFX_DEVICE, spi_is_ready_to_read(), spi_is_ready_to_write(), spi_is_write_complete(), spi_read(), spi_select_slave(), spi_write(), and TRX_CMD_FW.
Referenced by flush_buffer(), PHY_DataReq(), rf212_prepare(), rf233_prepare(), send_frame(), and tfa_continuous_tx_start().
void trx_irq_init | ( | FUNC_PTR | trx_irq_cb | ) |
References irq_hdl_trx.
Referenced by rf212_init(), rf233_init(), set_trx_state(), tal_init(), and tal_reset().
uint8_t trx_reg_read | ( | uint8_t | addr | ) |
Reads current value from a transceiver register.
This function reads the current value from a transceiver register.
addr | Specifies the address of the trx register from which the data shall be read |
References ENTER_TRX_CRITICAL_REGION, LEAVE_TRX_CRITICAL_REGION, master, READ_ACCESS_COMMAND, slave, SPI_AT86RFX_DEVICE, spi_is_ready_to_read(), spi_is_ready_to_write(), spi_is_write_complete(), spi_read(), spi_select_slave(), and spi_write().
Referenced by get_batmon_voltage(), handle_received_frame_irq(), perform_cca_twice(), phyReadRegister(), rf212_channel_clear(), rf212_get_txp(), rf212_init(), rf212_interrupt_poll(), rf212_read(), rf212_status(), rf233_channel_clear(), rf233_get_txp(), rf233_init(), rf233_interrupt_poll(), rf233_read(), rf233_status(), rf_generate_random_seed(), rf_get_channel(), rf_set_channel(), set_trx_state(), switch_pll_on(), tal_dump_registers(), tal_generate_rand_seed(), tal_get_curr_trx_config(), tal_rpc_mode_config(), tal_set_frequency(), tal_set_frequency_regs(), tal_trx_reg_read(), tal_trx_reg_write(), tfa_ed_sample(), tfa_get_batmon_voltage(), trx_bit_read(), trx_bit_write(), trx_init(), trx_irq_awake_handler_cb(), and trx_irq_handler_cb().
void trx_reg_write | ( | uint8_t | addr, |
uint8_t | data | ||
) |
Writes data into a transceiver register.
This function writes a value into transceiver register.
addr | Address of the trx register |
data | Data to be written to trx register |
References ENTER_TRX_CRITICAL_REGION, LEAVE_TRX_CRITICAL_REGION, master, slave, SPI_AT86RFX_DEVICE, spi_is_ready_to_read(), spi_is_ready_to_write(), spi_is_write_complete(), spi_read(), spi_select_slave(), spi_write(), and WRITE_ACCESS_COMMAND.
Referenced by PHY_SetIEEEAddr(), phyWriteRegister(), rf212_channel_clear(), rf212_init(), rf212_set_txp(), rf212_transmit(), rf233_channel_clear(), rf233_init(), rf233_set_txp(), rf233_transmit(), rf_generate_random_seed(), rf_set_channel(), set_default_tx_pwr(), set_trx_state(), SetIEEEAddr(), SetPanId(), SetShortAddr(), switch_pll_on(), tal_generate_rand_seed(), tal_pib_set(), tal_rpc_mode_config(), tal_set_frequency(), tal_set_frequency_regs(), tal_trx_reg_write(), tfa_continuous_tx_start(), tfa_ed_sample(), trx_bit_write(), trx_config(), trx_init(), and write_all_tal_pib_to_trx().
void trx_spi_disable | ( | void | ) |
Disables the SPI interface for communication with the transceiver.
References master, and spi_disable().
void trx_spi_done_cb_init | ( | void * | spi_done_cb | ) |
SPI done callback initialization.
spi_done_cb | Pointer to SPI done callback function |
void trx_spi_enable | ( | void | ) |
enables the SPI interface for communication with the transceiver
References master, and spi_enable().
void trx_spi_init | ( | void | ) |
Initializes the SPI interface for communication with the transceiver.
References extint_chan_conf::detection_criteria, EXTINT_CALLBACK_TYPE_DETECT, extint_chan_get_config_defaults(), extint_chan_set_config(), EXTINT_DETECT_RISING, EXTINT_PULL_DOWN, extint_register_callback(), extint_chan_conf::filter_input_signal, extint_chan_conf::gpio_pin, extint_chan_conf::gpio_pin_mux, extint_chan_conf::gpio_pin_pull, master, slave, SPI_AT86RFX_DEVICE, spi_attach_slave(), spi_enable(), spi_get_config_defaults(), spi_init(), spi_slave_inst_get_config_defaults(), and extint_chan_conf::wake_if_sleeping.
Referenced by pal_init(), PHY_Init(), rf212_init(), and rf233_init().
void trx_sram_read | ( | uint8_t | addr, |
uint8_t * | data, | ||
uint8_t | length | ||
) |
Reads data from SRAM of the transceiver.
This function reads from the SRAM of the transceiver
[in] | addr | Start address in SRAM for read operation |
[out] | data | Pointer to the location where data stored |
[in] | length | Number of bytes to be read from SRAM |
References delay_us, ENTER_TRX_CRITICAL_REGION, LEAVE_TRX_CRITICAL_REGION, master, slave, SPI_AT86RFX_DEVICE, spi_is_ready_to_read(), spi_is_ready_to_write(), spi_is_write_complete(), spi_read(), spi_select_slave(), spi_write(), and TRX_CMD_SR.
Referenced by handle_received_frame_irq(), rf212_read(), rf233_read(), sal_aes_read(), and sal_aes_setup().
void trx_sram_write | ( | uint8_t | addr, |
uint8_t * | data, | ||
uint8_t | length | ||
) |
Writes data into SRAM of the transceiver.
This function writes data into the SRAM of the transceiver
addr | Start address in the SRAM for the write operation |
data | Pointer to the data to be written into SRAM |
length | Number of bytes to be written into SRAM |
References ENTER_TRX_CRITICAL_REGION, LEAVE_TRX_CRITICAL_REGION, master, slave, SPI_AT86RFX_DEVICE, spi_is_ready_to_read(), spi_is_ready_to_write(), spi_is_write_complete(), spi_read(), spi_select_slave(), spi_write(), and TRX_CMD_SW.
Referenced by sal_aes_restart(), and sal_aes_setup().