1 /******************************************************************************
2 *  Filename:       rf_ieee_coex.h
3 *
4 *  Description:    CC13x2/CC26x2 API for Co-Existance (CoEx) support in IEEE
5 *
6 *  Copyright (c) 2015 - 2020, Texas Instruments Incorporated
7 *  All rights reserved.
8 *
9 *  Redistribution and use in source and binary forms, with or without
10 *  modification, are permitted provided that the following conditions are met:
11 *
12 *  1) Redistributions of source code must retain the above copyright notice,
13 *     this list of conditions and the following disclaimer.
14 *
15 *  2) Redistributions in binary form must reproduce the above copyright notice,
16 *     this list of conditions and the following disclaimer in the documentation
17 *     and/or other materials provided with the distribution.
18 *
19 *  3) Neither the name of the ORGANIZATION nor the names of its contributors may
20 *     be used to endorse or promote products derived from this software without
21 *     specific prior written permission.
22 *
23 *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
24 *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25 *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
27 *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28 *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
29 *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
30 *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
31 *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32 *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33 *  POSSIBILITY OF SUCH DAMAGE.
34 *
35 ******************************************************************************/
36 
37 #ifndef __RF_IEEE_COEX_H
38 #define __RF_IEEE_COEX_H
39 
40 #ifndef __RFC_STRUCT
41 #define __RFC_STRUCT
42 #endif
43 
44 #ifndef __RFC_STRUCT_ATTR
45 #if defined(__GNUC__)
46 #define __RFC_STRUCT_ATTR __attribute__ ((aligned (4)))
47 #elif defined(__TI_ARM__)
48 #define __RFC_STRUCT_ATTR __attribute__ ((__packed__,aligned (4)))
49 #else
50 #define __RFC_STRUCT_ATTR
51 #endif
52 #endif
53 
54 //! \addtogroup rfc
55 //! @{
56 
57 //! \addtogroup rf_ieee_coex
58 //! @{
59 
60 #include <stdint.h>
61 #include "rf_mailbox.h"
62 
63 // Error code for GRANT signal not given
64 #define IEEE_ERROR_NO_GRANT	0x2806
65 
66 typedef struct __RFC_STRUCT rfc_ieeeCoexGlobalEnable_s rfc_ieeeCoexGlobalEnable_t;
67 typedef struct __RFC_STRUCT rfc_ieeeCoExConfig_s rfc_ieeeCoExConfig_t;
68 
69 //! \addtogroup ieeeCoexGlobalEnable
70 //! @{
71 struct __RFC_STRUCT rfc_ieeeCoexGlobalEnable_s {
72    uint32_t __dummy0;
73    uint32_t __dummy1;
74    uint32_t __dummy2;
75    uint32_t __dummy3;
76    uint32_t __dummy4;
77    uint32_t __dummy5;
78    uint32_t __dummy6;
79    uint32_t __dummy7;
80    uint32_t __dummy8;
81    uint32_t __dummy9;
82    uint32_t __dummy10;
83    uint32_t __dummy11;
84    uint32_t __dummy12;
85    uint32_t __dummy13;
86    uint32_t __dummy14;
87    uint32_t __dummy15;
88    uint32_t __dummy16;
89    uint32_t __dummy17;
90    uint32_t __dummy18;
91    uint32_t __dummy19;
92    uint32_t __dummy20;
93    uint32_t __dummy21;
94    uint32_t __dummy22;
95    uint32_t __dummy23;
96    uint32_t __dummy24;
97    uint32_t __dummy25;
98    uint32_t __dummy26;
99    uint32_t __dummy27;
100    uint32_t __dummy28;
101    uint32_t __dummy29;
102    uint32_t __dummy30;
103    uint32_t __dummy31;
104    uint32_t __dummy32;
105    uint32_t __dummy33;
106    uint32_t __dummy34;
107    uint16_t __dummy35;
108    uint8_t __dummy36;
109    uint8_t coExGlobalEnable;            //!<        0 = CoEx features disabled. All other values = CoEx enabled.
110 } __RFC_STRUCT_ATTR;
111 
112 //! @}
113 
114 //! \addtogroup ieeeCoExConfig
115 //! @{
116 struct __RFC_STRUCT rfc_ieeeCoExConfig_s {
117    struct {
118       uint8_t bCoExEnable:1;            //!< \brief 0: CoEx disabled
119                                         //!<        1: CoEx enabled
120       uint8_t bUseREQUEST:1;            //!< \brief 0: REQUEST signal inactive
121                                         //!<        1: REQUEST signal active
122       uint8_t bUseGRANT:1;              //!< \brief 0: GRANT signal inactive
123                                         //!<        1: GRANT signal active
124       uint8_t bUsePRIORITY:1;           //!< \brief 0: PRIORITY signal inactive
125                                         //!<        1: PRIORITY signal active
126       uint8_t bRequestForChain:1;       //!< \brief 0: Deassert REQUEST after each RF command
127                                         //!<        1: Keep REQUEST asserted for entire command chain
128    } coExEnable;
129    uint8_t coExTxRxIndication;          //!< \brief 0 = RX indication is 0, TX indication is 0
130                                         //!<        1 = RX indication is 0, TX indication is 1
131                                         //!<        2 = RX indication is 1, TX indication is 0
132                                         //!<        3 = RX indication is 1, RX indication is 1
133    uint16_t priorityIndicationTime;     //!<        Time (in us) that the PRIORITY signal will indicate the priority.
134    struct {
135       uint8_t bRequestAsserted:1;       //!< \brief READ ONLY. 0 = REQUEST not asserted, 1 = REQUEST is asserted.
136                                         //!<        Will indicate if REQUEST would have been asserted, except if signal is not used.
137       uint8_t bIgnoreGrantInRxAsserted:1;//!< \brief READ ONLY. 0 = GRANT is checked in RX, 1 = GRANT is not checked in RX
138                                         //!<        Will indicate if the current running command is ignoring GRANT in RX
139    } rfCoreCoExStatus;
140    struct {
141       uint8_t bUseOverridePriority:1;   //!< \brief Bit to override default priority
142                                         //!<        0: Use default priority
143                                         //!<        1: use overridePriority priority for entire chain
144       uint8_t overridePriority:1;       //!< \brief Priority to use if priority is overridden
145                                         //!<        0: Low priority if bUseOverridePriority = 1
146                                         //!<        1: High priority if bUseOverridePriority = 1
147       uint8_t bUseOverrideRequestForRx:1;//!< \brief Bit to override default request for RX
148                                         //!<        0: Use default request for RX
149                                         //!<        1: use overrideRequestForRx for entire chain
150       uint8_t overrideRequestForRx:1;   //!< \brief REQUEST signal override if bUseOverrideRequestForRx = 1, used for entire chain
151                                         //!<        0: Don't request for RX if bUseOverrideRequestForRx = 1
152                                         //!<        1: Request for RX if bUseOverrideRequestForRx = 1
153    } overrideConfig;
154    struct {
155       uint8_t defaultPriority:1;        //!< \brief 0: Default low priority
156                                         //!<        1: Default high priority
157       uint8_t bAssertRequestForRx:1;    //!< \brief Default "request for RX" behaviour
158                                         //!<        0: Assert REQUEST for TX operations only
159                                         //!<        1: Assert REQUEST for both RX and TX operations
160       uint8_t bIgnoreGrantInRx:1;       //!< \brief 0: Check GRANT in RX and TX
161                                         //!<        1: Ignore GRANT in RX, check GRANT in TX. Independent of asserting REQUEST for RX.
162       uint8_t bKeepRequestIfNoGrant:1;  //!< \brief 0: Deassert REQUEST if GRANT was not given
163                                         //!<        1: Keep REQUEST asserted if no GRANT was given
164    } cmdIeeeRxConfig;
165    struct {
166       uint8_t defaultPriority:1;        //!< \brief 0: Default low priority
167                                         //!<        1: Default high priority
168       uint8_t bAssertRequestForRx:1;    //!< \brief Default "request for RX" behaviour
169                                         //!<        0: Assert REQUEST for TX operations only
170                                         //!<        1: Assert REQUEST for both RX and TX operations
171       uint8_t bIgnoreGrantInRx:1;       //!< \brief 0: Check GRANT in RX and TX
172                                         //!<        1: Ignore GRANT in RX, check GRANT in TX. Independent of asserting REQUEST for RX.
173       uint8_t bKeepRequestIfNoGrant:1;  //!< \brief 0: Deassert REQUEST if GRANT was not given
174                                         //!<        1: Keep REQUEST asserted if no GRANT was given
175    } cmdIeeeRxAckConfig;
176    struct {
177       uint8_t defaultPriority:1;        //!< \brief 0: Default low priority
178                                         //!<        1: Default high priority
179       uint8_t bAssertRequestForRx:1;    //!< \brief Default "request for RX" behaviour
180                                         //!<        0: Assert REQUEST for TX operations only
181                                         //!<        1: Assert REQUEST for both RX and TX operations
182       uint8_t bIgnoreGrantInRx:1;       //!< \brief 0: Check GRANT in RX and TX
183                                         //!<        1: Ignore GRANT in RX, check GRANT in TX. Independent of asserting REQUEST for RX.
184       uint8_t bKeepRequestIfNoGrant:1;  //!< \brief 0: Deassert REQUEST if GRANT was not given
185                                         //!<        1: Keep REQUEST asserted if no GRANT was given
186    } cmdIeeeCcaConfig;
187    struct {
188       uint8_t defaultPriority:1;        //!< \brief 0: Default low priority
189                                         //!<        1: Default high priority
190       uint8_t bAssertRequestForRx:1;    //!< \brief Default "request for RX" behaviour
191                                         //!<        0: Assert REQUEST for TX operations only
192                                         //!<        1: Assert REQUEST for both RX and TX operations
193       uint8_t bIgnoreGrantInRx:1;       //!< \brief 0: Check GRANT in RX and TX
194                                         //!<        1: Ignore GRANT in RX, check GRANT in TX. Independent of asserting REQUEST for RX.
195       uint8_t bKeepRequestIfNoGrant:1;  //!< \brief 0: Deassert REQUEST if GRANT was not given
196                                         //!<        1: Keep REQUEST asserted if no GRANT was given
197    } cmdIeeeTxConfig;
198    uint8_t grantLatencyTime;            //!< \brief Grant Response Time to Request Signal.
199                                         //!<        Request signal will be asserted Radio activity start time - grantLatencyTime
200                                         //!<        20 us <= grantLatencyTime <= 80 us
201 } __RFC_STRUCT_ATTR;
202 
203 //! @}
204 
205 //! @}
206 //! @}
207 #endif
208