1 /****************************************************************************** 2 * Filename: rf_data_entry.h 3 * Revised: 2015-08-04 11:44:20 +0200 (Tue, 04 Aug 2015) 4 * Revision: 44329 5 * 6 * Description: Definition of API for data exchange 7 * 8 * Copyright (c) 2015, Texas Instruments Incorporated 9 * All rights reserved. 10 * 11 * Redistribution and use in source and binary forms, with or without 12 * modification, are permitted provided that the following conditions are met: 13 * 14 * 1) Redistributions of source code must retain the above copyright notice, 15 * this list of conditions and the following disclaimer. 16 * 17 * 2) Redistributions in binary form must reproduce the above copyright notice, 18 * this list of conditions and the following disclaimer in the documentation 19 * and/or other materials provided with the distribution. 20 * 21 * 3) Neither the name of the ORGANIZATION nor the names of its contributors may 22 * be used to endorse or promote products derived from this software without 23 * specific prior written permission. 24 * 25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 26 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 27 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 28 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 29 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 30 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 31 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 32 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 33 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 34 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 35 * POSSIBILITY OF SUCH DAMAGE. 36 * 37 ******************************************************************************/ 38 39 #ifndef __DATA_ENTRY_H 40 #define __DATA_ENTRY_H 41 42 #ifndef __RFC_STRUCT 43 #ifdef __GNUC__ 44 #define __RFC_STRUCT __attribute__ ((aligned (4))) 45 #else 46 #define __RFC_STRUCT 47 #endif 48 #endif 49 50 //! \addtogroup rfc 51 //! @{ 52 53 //! \addtogroup data_entry 54 //! @{ 55 56 #include <stdint.h> 57 #include <driverlib/rf_mailbox.h> 58 59 typedef struct __RFC_STRUCT rfc_dataEntry_s rfc_dataEntry_t; 60 typedef struct __RFC_STRUCT rfc_dataEntryGeneral_s rfc_dataEntryGeneral_t; 61 typedef struct __RFC_STRUCT rfc_dataEntryMulti_s rfc_dataEntryMulti_t; 62 typedef struct __RFC_STRUCT rfc_dataEntryPointer_s rfc_dataEntryPointer_t; 63 typedef struct __RFC_STRUCT rfc_dataEntryPartial_s rfc_dataEntryPartial_t; 64 65 //! \addtogroup dataEntry 66 //! @{ 67 struct __RFC_STRUCT rfc_dataEntry_s { 68 uint8_t* pNextEntry; //!< Pointer to next entry in the queue, NULL if this is the last entry 69 uint8_t status; //!< Indicates status of entry, including whether it is free for the system CPU to write to 70 struct { 71 uint8_t type:2; //!< \brief Type of data entry structure<br> 72 //!< 0: General data entry <br> 73 //!< 1: Multi-element Rx entry<br> 74 //!< 2: Pointer entry<br> 75 //!< 3: Partial read Rx entry 76 uint8_t lenSz:2; //!< \brief Size of length word in start of each Rx entry element<br> 77 //!< 0: No length indicator<br> 78 //!< 1: One byte length indicator<br> 79 //!< 2: Two bytes length indicator<br> 80 //!< 3: <i>Reserved</i> 81 uint8_t irqIntv:4; //!< \brief For partial read Rx entry only: The number of bytes between interrupt generated 82 //!< by the radio CPU (0: 16 bytes) 83 } config; 84 uint16_t length; //!< \brief For pointer entries: Number of bytes in the data buffer pointed to<br> 85 //!< For other entries: Number of bytes following this length field 86 }; 87 88 //! @} 89 90 //! \addtogroup dataEntryGeneral 91 //! @{ 92 //! General data entry structure (type = 0) 93 94 struct __RFC_STRUCT rfc_dataEntryGeneral_s { 95 uint8_t* pNextEntry; //!< Pointer to next entry in the queue, NULL if this is the last entry 96 uint8_t status; //!< Indicates status of entry, including whether it is free for the system CPU to write to 97 struct { 98 uint8_t type:2; //!< \brief Type of data entry structure<br> 99 //!< 0: General data entry <br> 100 //!< 1: Multi-element Rx entry<br> 101 //!< 2: Pointer entry<br> 102 //!< 3: Partial read Rx entry 103 uint8_t lenSz:2; //!< \brief Size of length word in start of each Rx entry element<br> 104 //!< 0: No length indicator<br> 105 //!< 1: One byte length indicator<br> 106 //!< 2: Two bytes length indicator<br> 107 //!< 3: <i>Reserved</i> 108 uint8_t irqIntv:4; //!< \brief For partial read Rx entry only: The number of bytes between interrupt generated 109 //!< by the radio CPU (0: 16 bytes) 110 } config; 111 uint16_t length; //!< \brief For pointer entries: Number of bytes in the data buffer pointed to<br> 112 //!< For other entries: Number of bytes following this length field 113 uint8_t data; //!< First byte of the data array to be received or transmitted 114 }; 115 116 //! @} 117 118 //! \addtogroup dataEntryMulti 119 //! @{ 120 //! Multi-element data entry structure (type = 1) 121 122 struct __RFC_STRUCT rfc_dataEntryMulti_s { 123 uint8_t* pNextEntry; //!< Pointer to next entry in the queue, NULL if this is the last entry 124 uint8_t status; //!< Indicates status of entry, including whether it is free for the system CPU to write to 125 struct { 126 uint8_t type:2; //!< \brief Type of data entry structure<br> 127 //!< 0: General data entry <br> 128 //!< 1: Multi-element Rx entry<br> 129 //!< 2: Pointer entry<br> 130 //!< 3: Partial read Rx entry 131 uint8_t lenSz:2; //!< \brief Size of length word in start of each Rx entry element<br> 132 //!< 0: No length indicator<br> 133 //!< 1: One byte length indicator<br> 134 //!< 2: Two bytes length indicator<br> 135 //!< 3: <i>Reserved</i> 136 uint8_t irqIntv:4; //!< \brief For partial read Rx entry only: The number of bytes between interrupt generated 137 //!< by the radio CPU (0: 16 bytes) 138 } config; 139 uint16_t length; //!< \brief For pointer entries: Number of bytes in the data buffer pointed to<br> 140 //!< For other entries: Number of bytes following this length field 141 uint16_t numElements; //!< Number of entry elements committed in the entry 142 uint16_t nextIndex; //!< Index to the byte after the last byte of the last entry element committed by the radio CPU 143 uint8_t rxData; //!< First byte of the data array of received data entry elements 144 }; 145 146 //! @} 147 148 //! \addtogroup dataEntryPointer 149 //! @{ 150 //! Pointer data entry structure (type = 2) 151 152 struct __RFC_STRUCT rfc_dataEntryPointer_s { 153 uint8_t* pNextEntry; //!< Pointer to next entry in the queue, NULL if this is the last entry 154 uint8_t status; //!< Indicates status of entry, including whether it is free for the system CPU to write to 155 struct { 156 uint8_t type:2; //!< \brief Type of data entry structure<br> 157 //!< 0: General data entry <br> 158 //!< 1: Multi-element Rx entry<br> 159 //!< 2: Pointer entry<br> 160 //!< 3: Partial read Rx entry 161 uint8_t lenSz:2; //!< \brief Size of length word in start of each Rx entry element<br> 162 //!< 0: No length indicator<br> 163 //!< 1: One byte length indicator<br> 164 //!< 2: Two bytes length indicator<br> 165 //!< 3: <i>Reserved</i> 166 uint8_t irqIntv:4; //!< \brief For partial read Rx entry only: The number of bytes between interrupt generated 167 //!< by the radio CPU (0: 16 bytes) 168 } config; 169 uint16_t length; //!< \brief For pointer entries: Number of bytes in the data buffer pointed to<br> 170 //!< For other entries: Number of bytes following this length field 171 uint8_t* pData; //!< Pointer to data buffer of data to be received ro transmitted 172 }; 173 174 //! @} 175 176 //! \addtogroup dataEntryPartial 177 //! @{ 178 //! Partial read data entry structure (type = 3) 179 180 struct __RFC_STRUCT rfc_dataEntryPartial_s { 181 uint8_t* pNextEntry; //!< Pointer to next entry in the queue, NULL if this is the last entry 182 uint8_t status; //!< Indicates status of entry, including whether it is free for the system CPU to write to 183 struct { 184 uint8_t type:2; //!< \brief Type of data entry structure<br> 185 //!< 0: General data entry <br> 186 //!< 1: Multi-element Rx entry<br> 187 //!< 2: Pointer entry<br> 188 //!< 3: Partial read Rx entry 189 uint8_t lenSz:2; //!< \brief Size of length word in start of each Rx entry element<br> 190 //!< 0: No length indicator<br> 191 //!< 1: One byte length indicator<br> 192 //!< 2: Two bytes length indicator<br> 193 //!< 3: <i>Reserved</i> 194 uint8_t irqIntv:4; //!< \brief For partial read Rx entry only: The number of bytes between interrupt generated 195 //!< by the radio CPU (0: 16 bytes) 196 } config; 197 uint16_t length; //!< \brief For pointer entries: Number of bytes in the data buffer pointed to<br> 198 //!< For other entries: Number of bytes following this length field 199 struct { 200 uint16_t numElements:13; //!< Number of entry elements committed in the entry 201 uint16_t bEntryOpen:1; //!< 1 if the entry contains an element that is still open for appending data 202 uint16_t bFirstCont:1; //!< 1 if the first element is a continuation of the last packet from the previous entry 203 uint16_t bLastCont:1; //!< 1 if the packet in the last element continues in the next entry 204 } pktStatus; 205 uint16_t nextIndex; //!< Index to the byte after the last byte of the last entry element committed by the radio CPU 206 uint8_t rxData; //!< First byte of the data array of received data entry elements 207 }; 208 209 //! @} 210 211 //! @} 212 //! @} 213 #endif 214