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() port_pin_get_input_level(AT86RFX_IRQ_PIN) |
#define | LEAVE_TRX_CRITICAL_REGION() cpu_irq_restore(flags); } |
#define | READ_ACCESS_COMMAND (0x0000) |
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_irq_flag_clr() CLEAR_TRX_IRQ() |
Clears the transceiver main interrupt. More... | |
#define | TRX_IRQ_GET() IRQ_PINGET() |
#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) << 8) & 0xFF00) | (((x) >> 8) & 0x00FF)) |
This macro is used for handling endianness among the different CPUs. More... | |
#define | WRITE_ACCESS_COMMAND (0x8000) |
Write access command of the transceiver. More... | |
Typedefs | |
typedef void(* | irq_handler_t )(void) |
Transceiver ISR handler. More... | |
Functions | |
void | PhyReset (void) |
Resets the TRX radio. More... | |
uint8_t | trx_bit_read (uint16_t addr, uint8_t mask, uint8_t pos) |
Subregister read. More... | |
void | trx_bit_write (uint16_t reg_addr, uint8_t mask, uint8_t pos, uint8_t new_value) |
Subregister write. More... | |
void | trx_irq_init (FUNC_PTR trx_irq_cb) |
void | trx_read (uint16_t addr, uint8_t *data, uint16_t length) |
uint8_t | trx_reg_read (uint16_t addr) |
void | trx_reg_write (uint16_t addr, uint8_t data) |
Writes data into a transceiver register. More... | |
void | trx_spi_done_cb_init (void *spi_done_cb) |
SPI done callback initialization. More... | |
void | trx_spi_init (void) |
Initializes the SPI interface for communication with the transceiver. More... | |
void | trx_write (uint16_t addr, uint8_t *data, uint16_t length) |
#define ENTER_TRX_CRITICAL_REGION | ( | ) |
#define IRQ_PINGET | ( | ) | port_pin_get_input_level(AT86RFX_IRQ_PIN) |
#define LEAVE_TRX_CRITICAL_REGION | ( | ) | cpu_irq_restore(flags); } |
#define READ_ACCESS_COMMAND (0x0000) |
Read access command to the tranceiver.
Referenced by trx_read(), and trx_reg_read().
#define RST_HIGH | ( | ) |
Set TRX GPIO pins.
Referenced by PhyReset(), and trx_reset().
#define RST_LOW | ( | ) |
Referenced by PhyReset(), and trx_reset().
#define SLP_TR_HIGH | ( | ) |
#define SLP_TR_LOW | ( | ) |
Referenced by PhyReset().
#define trx_irq_flag_clr | ( | ) | CLEAR_TRX_IRQ() |
Clears the transceiver main interrupt.
#define TRX_IRQ_GET | ( | ) | IRQ_PINGET() |
Referenced by trx_reset().
#define TRX_IRQ_HIGH | ( | ) | IRQ_PINGET() |
Macro to get the transceiver's main IRQ status.
#define TRX_RST_HIGH | ( | ) | RST_HIGH() |
Macro to set Reset pin to high.
#define TRX_RST_LOW | ( | ) | RST_LOW() |
Macro to set Reset pin to low.
#define TRX_SLP_TR_HIGH | ( | ) | SLP_TR_HIGH() |
Macro to set SLP_TR pin to high.
#define TRX_SLP_TR_LOW | ( | ) | SLP_TR_LOW() |
Macro to set SLP_TR pin to low.
#define U16_TO_TARGET | ( | x | ) | ((((x) << 8) & 0xFF00) | (((x) >> 8) & 0x00FF)) |
This macro is used for handling endianness among the different CPUs.
#define WRITE_ACCESS_COMMAND (0x8000) |
Write access command of the transceiver.
Referenced by trx_reg_write(), and trx_write().
typedef void(* irq_handler_t)(void) |
Transceiver ISR handler.
void PhyReset | ( | void | ) |
Resets the TRX radio.
References delay_us, RST_HIGH, RST_LOW, and SLP_TR_LOW.
uint8_t trx_bit_read | ( | uint16_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 trx_reg_read().
Referenced by cca_start(), crc_check_ok(), handle_incoming_frame(), handle_rx_end_irq(), handle_tx_end_irq(), tal_get_curr_trx_config(), tal_get_trx_status(), tal_rxaack_prom_mode_ctrl(), tal_set_rx_sensitivity_level(), tfa_get_batmon_voltage(), transmit_frame(), and wait_for_freq_settling().
void trx_bit_write | ( | uint16_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 ack_transmission_done(), conf_fsk(), conf_leg_oqpsk(), conf_ofdm(), conf_oqpsk(), config_fsk_rpc(), config_phy(), handle_ed_end_irq(), handle_incoming_frame(), handle_rx_end_irq(), handle_tx_end_irq(), ofdm_rfcfg(), oqpsk_rfcfg(), set_fsk_pibs(), set_tx_pwr(), start_rpc(), stop_ed_scan(), stop_rpc(), tal_ed_start(), tal_generate_rand_seed(), tal_pib_set(), tal_rxaack_prom_mode_ctrl(), tal_set_rx_sensitivity_level(), tfa_batmon_irq_init(), tfa_cca_perform(), tfa_continuous_tx_start(), tfa_continuous_tx_stop(), tfa_get_batmon_voltage(), transmit_frame(), trx_config(), trx_init(), trx_irq_handler_cb(), and write_all_tal_pib_to_trx().
void trx_irq_init | ( | FUNC_PTR | trx_irq_cb | ) |
References irq_hdl_trx.
Referenced by tal_init(), and tal_reset().
void trx_read | ( | uint16_t | addr, |
uint8_t * | data, | ||
uint16_t | length | ||
) |
References AT86RFX_SPI, DISABLE_TRX_INTERRUPT, dummy_read, ENABLE_TRX_INTERRUPT, master, READ_ACCESS_COMMAND, slave, spi_deselect_device(), spi_read(), spi_read_packet(), spi_select_device(), spi_write(), and spi_write_packet().
Referenced by tfa_get_batmon_voltage(), trx_irq_handler_cb(), and upload_frame().
uint8_t trx_reg_read | ( | uint16_t | addr | ) |
References AT86RFX_SPI, dummy_read, ENTER_CRITICAL_REGION, LEAVE_CRITICAL_REGION, master, READ_ACCESS_COMMAND, slave, spi_deselect_device(), spi_read(), spi_read_packet(), spi_select_device(), spi_write(), and spi_write_packet().
Referenced by cancel_any_reception(), complete_rx_transaction(), conf_trx_modulation(), handle_ed_end_irq(), tal_dump_registers(), tal_generate_rand_seed(), tal_init(), tal_trx_reg_read(), tal_trx_reg_write(), tfa_cca_perform(), transmit_frame(), trx_bit_read(), trx_bit_write(), trx_config(), trx_irq_handler_cb(), trx_reset(), and wait_for_txprep().
void trx_reg_write | ( | uint16_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 AT86RFX_SPI, dummy_read, ENTER_CRITICAL_REGION, LEAVE_CRITICAL_REGION, master, slave, spi_deselect_device(), spi_read(), spi_select_device(), spi_write(), spi_write_packet(), and WRITE_ACCESS_COMMAND.
Referenced by ack_timout_cb(), ack_transmission_done(), apply_channel_settings(), conf_trx_modulation(), config_fsk_rpc(), config_phy(), fsk_rfcfg(), handle_ed_end_irq(), handle_incoming_frame(), handle_rx_end_irq(), handle_trxerr(), set_ed_sample_duration(), set_fsk_pibs(), start_ack_wait_timer(), start_rpc(), stop_rpc(), switch_to_rx(), switch_to_txprep(), tal_ed_start(), tal_generate_rand_seed(), tal_pib_set(), tal_rx_enable(), tal_trx_reg_write(), tal_trx_sleep(), tal_trx_wakeup(), tfa_cca_perform(), tfa_continuous_tx_start(), tfa_continuous_tx_stop(), transmit_frame(), trx_bit_write(), trx_config(), trx_reset(), tx_done_handling(), wait_for_freq_settling(), and wait_for_txprep().
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_init | ( | void | ) |
Initializes the SPI interface for communication with the transceiver.
References AT86RFX_INTC_INIT, AT86RFX_IRQ_PIN, AT86RFX_ISR(), AT86RFX_SPI, AT86RFX_SPI_BAUDRATE, AT86RFX_SPI_CS, config, master, slave, slave_dev_config, spi_enable(), spi_master_init(), spi_master_setup_device(), and SPI_MODE_0.
Referenced by pal_init().
void trx_write | ( | uint16_t | addr, |
uint8_t * | data, | ||
uint16_t | length | ||
) |
References AT86RFX_SPI, DISABLE_TRX_INTERRUPT, dummy_read, ENABLE_TRX_INTERRUPT, master, slave, spi_deselect_device(), spi_is_tx_ready(), spi_read(), spi_select_device(), spi_write(), spi_write_packet(), spi_write_single(), and WRITE_ACCESS_COMMAND.
Referenced by apply_channel_settings(), config_fsk_rpc(), config_phy(), set_channel(), set_fsk_pibs(), set_sfd(), switch_to_txprep(), tal_pib_set(), tfa_continuous_tx_start(), tfa_continuous_tx_stop(), transmit_frame(), and write_all_tal_pib_to_trx().