1 /* ieee802154_rf2xx_iface.h - ATMEL RF2XX transceiver interface */ 2 3 /* 4 * Copyright (c) 2019-2020 Gerson Fernando Budke 5 * 6 * SPDX-License-Identifier: Apache-2.0 7 */ 8 9 #ifndef ZEPHYR_DRIVERS_IEEE802154_IEEE802154_RF2XX_IFACE_H_ 10 #define ZEPHYR_DRIVERS_IEEE802154_IEEE802154_RF2XX_IFACE_H_ 11 12 /** 13 * @brief Resets the TRX radio 14 * 15 * @param[in] dev Transceiver device instance 16 */ 17 void rf2xx_iface_phy_rst(const struct device *dev); 18 19 /** 20 * @brief Start TX transmission 21 * 22 * @param[in] dev Transceiver device instance 23 */ 24 void rf2xx_iface_phy_tx_start(const struct device *dev); 25 26 /** 27 * @brief Reads current value from a transceiver register 28 * 29 * This function reads the current value from a transceiver register. 30 * 31 * @param[in] dev Transceiver device instance 32 * @param[in] addr Specifies the address of the trx register 33 * from which the data shall be read 34 * 35 * @return value of the register read 36 */ 37 uint8_t rf2xx_iface_reg_read(const struct device *dev, 38 uint8_t addr); 39 40 /** 41 * @brief Writes data into a transceiver register 42 * 43 * This function writes a value into transceiver register. 44 * 45 * @param[in] dev Transceiver device instance 46 * @param[in] addr Address of the trx register 47 * @param[in] data Data to be written to trx register 48 * 49 */ 50 void rf2xx_iface_reg_write(const struct device *dev, 51 uint8_t addr, 52 uint8_t data); 53 54 /** 55 * @brief Subregister read 56 * 57 * @param[in] dev Transceiver device instance 58 * @param[in] addr offset of the register 59 * @param[in] mask bit mask of the subregister 60 * @param[in] pos bit position of the subregister 61 * 62 * @return value of the read bit(s) 63 */ 64 uint8_t rf2xx_iface_bit_read(const struct device *dev, 65 uint8_t addr, 66 uint8_t mask, 67 uint8_t pos); 68 69 /** 70 * @brief Subregister write 71 * 72 * @param[in] dev Transceiver device instance 73 * @param[in] reg_addr Offset of the register 74 * @param[in] mask Bit mask of the subregister 75 * @param[in] pos Bit position of the subregister 76 * @param[out] new_value Data, which is muxed into the register 77 */ 78 void rf2xx_iface_bit_write(const struct device *dev, 79 uint8_t reg_addr, 80 uint8_t mask, 81 uint8_t pos, 82 uint8_t new_value); 83 84 /** 85 * @brief Reads frame buffer of the transceiver 86 * 87 * This function reads the frame buffer of the transceiver. 88 * 89 * @param[in] dev Transceiver device instance 90 * @param[out] data Pointer to the location to store frame 91 * @param[in] length Number of bytes to be read from the frame 92 */ 93 void rf2xx_iface_frame_read(const struct device *dev, 94 uint8_t *data, 95 uint8_t length); 96 97 /** 98 * @brief Writes data into frame buffer of the transceiver 99 * 100 * This function writes data into the frame buffer of the transceiver 101 * 102 * @param[in] dev Transceiver device instance 103 * @param[in] data Pointer to data to be written into frame buffer 104 * @param[in] length Number of bytes to be written into frame buffer 105 */ 106 void rf2xx_iface_frame_write(const struct device *dev, 107 uint8_t *data, 108 uint8_t length); 109 110 /** 111 * @brief Reads sram data from the transceiver 112 * 113 * This function reads the sram data of the transceiver. 114 * 115 * @param[in] dev Transceiver device instance 116 * @param[in] address Start address to be read 117 * @param[out] data Pointer to the location to store data 118 * @param[in] length Number of bytes to be read from the sram space 119 */ 120 void rf2xx_iface_sram_read(const struct device *dev, 121 uint8_t address, 122 uint8_t *data, 123 uint8_t length); 124 125 #endif /* ZEPHYR_DRIVERS_IEEE802154_IEEE802154_RF2XX_IFACE_H_ */ 126