Microchip® Advanced Software Framework

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Group_trx_access

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   (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) << 8) & 0xFF00) | (((x) >> 8) & 0x00FF))
 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 ( )
Value:
{uint8_t flags \
static irqflags_t cpu_irq_save(void)
Get and clear the global interrupt flags.
Definition: interrupt_sam_nvic.h:141

Referenced by trx_frame_read(), trx_frame_write(), trx_reg_read(), trx_reg_write(), trx_sram_read(), and trx_sram_write().

#define IRQ_PINGET ( )    port_pin_get_input_level(AT86RFX_IRQ_PIN)
#define LEAVE_TRX_CRITICAL_REGION ( )    cpu_irq_restore(flags); }
#define READ_ACCESS_COMMAND   (0x80)

Read access command to the tranceiver.

Referenced by trx_reg_read().

#define RST_HIGH ( )
Value:
static void port_pin_set_output_level(const uint8_t gpio_pin, const bool level)
Sets the state of a port pin that is configured as an output.
Definition: port.h:497
#define AT86RFX_RST_PIN
Definition: conf_board.h:44

Set TRX GPIO pins.

Referenced by PhyReset().

#define RST_LOW ( )
Value:
static void port_pin_set_output_level(const uint8_t gpio_pin, const bool level)
Sets the state of a port pin that is configured as an output.
Definition: port.h:497
#define AT86RFX_RST_PIN
Definition: conf_board.h:44

Referenced by PhyReset().

#define SLP_TR_HIGH ( )
Value:
#define AT86RFX_SLP_PIN
Definition: conf_board.h:47
static void port_pin_set_output_level(const uint8_t gpio_pin, const bool level)
Sets the state of a port pin that is configured as an output.
Definition: port.h:497
#define SLP_TR_LOW ( )
Value:
#define AT86RFX_SLP_PIN
Definition: conf_board.h:47
static void port_pin_set_output_level(const uint8_t gpio_pin, const bool level)
Sets the state of a port pin that is configured as an output.
Definition: port.h:497

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.

#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.

Referenced by PHY_DataReq(), and PHY_Sleep().

#define TRX_SLP_TR_LOW ( )    SLP_TR_LOW()

Macro to set SLP_TR pin to low.

Referenced by PHY_DataReq(), and PHY_Wakeup().

#define TRX_TRIG_DELAY ( )    {nop(); nop(); }

Referenced by PHY_DataReq().

#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   (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.

Parameters
addrStart address in the SRAM for the write operation
idataPointer to the data written/read into/from SRAM
lengthNumber of bytes written/read into/from SRAM

References AT86RFX_SPI, delay_us, ENTER_TRX_REGION, LEAVE_TRX_REGION, 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.

Parameters
addroffset of the register
maskbit mask of the subregister
posbit position of the subregister
Returns
value of the read bit(s)

References trx_reg_read().

void trx_bit_write ( uint8_t  reg_addr,
uint8_t  mask,
uint8_t  pos,
uint8_t  new_value 
)

Subregister write.

Parameters
[in]reg_addrOffset of the register
[in]maskBit mask of the subregister
[in]posBit position of the subregister
[out]new_valueData, which is muxed into the register

References trx_reg_read(), and trx_reg_write().

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.

Parameters
[out]dataPointer to the location to store frame
[in]lengthNumber of bytes to be read from the frame buffer.

References AT86RFX_SPI, ENTER_TRX_CRITICAL_REGION, LEAVE_TRX_CRITICAL_REGION, 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 PHY_TaskHandler().

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

Parameters
[in]dataPointer to data to be written into frame buffer
[in]lengthNumber of bytes to be written into frame buffer

References AT86RFX_SPI, ENTER_TRX_CRITICAL_REGION, LEAVE_TRX_CRITICAL_REGION, 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 PHY_DataReq().

void trx_irq_init ( FUNC_PTR  trx_irq_cb)

References irq_hdl_trx.

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.

Parameters
addrSpecifies the address of the trx register from which the data shall be read
Returns
value of the register read

References AT86RFX_SPI, ENTER_TRX_CRITICAL_REGION, LEAVE_TRX_CRITICAL_REGION, READ_ACCESS_COMMAND, 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 phyReadRegister(), trx_bit_read(), and trx_bit_write().

void trx_reg_write ( uint8_t  addr,
uint8_t  data 
)

Writes data into a transceiver register.

This function writes a value into transceiver register.

Parameters
addrAddress of the trx register
dataData to be written to trx register

References AT86RFX_SPI, ENTER_TRX_CRITICAL_REGION, LEAVE_TRX_CRITICAL_REGION, 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(), and trx_bit_write().

void trx_spi_disable ( void  )

Disables the SPI interface for communication with the transceiver.

References spi_disable().

void trx_spi_done_cb_init ( void *  spi_done_cb)

SPI done callback initialization.

Parameters
spi_done_cbPointer to SPI done callback function
void trx_spi_enable ( void  )

enables the SPI interface for communication with the transceiver

References spi_enable().

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

Parameters
[in]addrStart address in SRAM for read operation
[out]dataPointer to the location where data stored
[in]lengthNumber of bytes to be read from SRAM

References AT86RFX_SPI, delay_us, ENTER_TRX_CRITICAL_REGION, LEAVE_TRX_CRITICAL_REGION, 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 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

Parameters
addrStart address in the SRAM for the write operation
dataPointer to the data to be written into SRAM
lengthNumber of bytes to be written into SRAM

References AT86RFX_SPI, ENTER_TRX_CRITICAL_REGION, LEAVE_TRX_CRITICAL_REGION, 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().