1 /* 2 * Copyright (c) 2017 Oticon A/S 3 * Copyright (c) 2023 Nordic Semiconductor ASA 4 * 5 * SPDX-License-Identifier: Apache-2.0 6 * 7 * Private types definitions for the RADIO peripheral 8 */ 9 #ifndef _NRF_RADIO_PRIVATE_H 10 #define _NRF_RADIO_PRIVATE_H 11 12 #ifdef __cplusplus 13 extern "C"{ 14 #endif 15 16 typedef enum {TIFS_DISABLE = 0, TIFS_WAITING_FOR_DISABLE, TIFS_TRIGGERING_TRX_EN} TIFS_state_t; 17 typedef enum {No_pending_abort_reeval = 0, Tx_Abort_reeval, Rx_Abort_reeval, CCA_Abort_reeval} abort_state_t; 18 19 typedef enum { //Note: This should match the real RADIO state values in the STATE register 20 RAD_DISABLED = 0, //No operations are going on inside the radio and the power consumption is at a minimum 21 RAD_RXRU, //The radio is ramping up and preparing for reception 22 RAD_RXIDLE, //The radio is ready for reception to start 23 RAD_RX, //Reception has been started and the addresses enabled in the RXADDRESSES register are being monitored 24 RAD_RXDISABLE, //The radio is disabling the receiver 25 26 RAD_TXRU = 9, //The radio is ramping up and preparing for transmission 27 RAD_TXIDLE, //The radio is ready for transmission to start 28 RAD_TX, //The radio is transmitting a packet 29 RAD_TXDISABLE, //The radio is disabling the transmitter 30 31 RAD_CCA_ED, //We are in either a CCA or ED procedure 32 //Not a real HW state. In real HW the RADIO is in RXIDLE or some other RX state. Seems the CCA and ED procedures as separate machines 33 } nrfra_state_t; 34 35 typedef enum {SUB_STATE_INVALID, /*The timer should not trigger in TX or RX state with this substate*/ 36 TX_WAIT_FOR_ADDRESS_END, TX_WAIT_FOR_PAYLOAD_END, TX_WAIT_FOR_CRC_END, 37 RX_WAIT_FOR_ADDRESS_END, RX_WAIT_FOR_PAYLOAD_END, RX_WAIT_FOR_CRC_END 38 } nrfra_sub_state_t; 39 40 typedef struct { 41 bs_time_t ADDRESS_End_Time; 42 bs_time_t PAYLOAD_End_Time; 43 bs_time_t CRC_End_Time; 44 bs_time_t CRC_duration; 45 p2G4_rxv2_t rx_req; 46 p2G4_rxv2_done_t rx_resp; 47 bool CRC_OK; 48 bool packet_rejected; 49 bool S1Offset; 50 } RADIO_Rx_status_t; 51 52 typedef struct { 53 bs_time_t ADDRESS_end_time; 54 bs_time_t PAYLOAD_end_time; 55 bs_time_t CRC_end_time; 56 p2G4_txv2_t tx_req; 57 p2G4_tx_done_t tx_resp; 58 } RADIO_Tx_status_t; 59 60 typedef struct { 61 bs_time_t CCA_end_time; 62 p2G4_cca_t cca_req; 63 p2G4_cca_done_t cca_resp; 64 bool is_busy; 65 bool CCA_notED; //Is it a CCA procedure (1), or ED procedure (0) 66 } RADIO_CCA_status_t; 67 68 69 #define _NRF_MAX_PACKET_SIZE (256+2+4) 70 71 #ifdef __cplusplus 72 } 73 #endif 74 75 #endif 76