Contiki 3.x
smartrf-settings.c
1 /*
2  * Copyright (c) 2015, Texas Instruments Incorporated - http://www.ti.com/
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  * notice, this list of conditions and the following disclaimer in the
12  * documentation and/or other materials provided with the distribution.
13  * 3. Neither the name of the copyright holder nor the names of its
14  * contributors may be used to endorse or promote products derived
15  * from this software without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
20  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
21  * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
22  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
26  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
28  * OF THE POSSIBILITY OF SUCH DAMAGE.
29  */
30 /*---------------------------------------------------------------------------*/
31 #include "rf-core/api/mailbox.h"
32 #include "rf-core/api/common_cmd.h"
33 #include "rf-core/api/prop_cmd.h"
34 /*---------------------------------------------------------------------------*/
35 /* Overrides for CMD_PROP_RADIO_DIV_SETUP */
36 uint32_t overrides[] =
37 {
38  /* override_synth.xml */
39  HW32_ARRAY_OVERRIDE(0x6088, 1),
40  (uint32_t)0x0000001A,
41  ADI_HALFREG_OVERRIDE(0, 61, 0xF, 0xD),
42  HW32_ARRAY_OVERRIDE(0x4038, 1),
43  (uint32_t)0x0000003A,
44  HW_REG_OVERRIDE(0x4020, 0x7F00),
45  HW_REG_OVERRIDE(0x4064, 0x0040),
46  (uint32_t)0x684A3,
47  (uint32_t)0xC0040141,
48  (uint32_t)0x0533B107,
49  (uint32_t)0xA480583,
50  (uint32_t)0x7AB80603,
51  ADI_REG_OVERRIDE(1, 4, 0x1F),
52  ADI_HALFREG_OVERRIDE(1, 7, 0x4, 0x4),
53  HW_REG_OVERRIDE(0x6084, 0x35F1),
54  (uint32_t)0x00038883,
55  (uint32_t)0x00FB88A3,
56  /* TX power override */
57  ADI_REG_OVERRIDE(0, 12, 0xF9),
58 
59  /* Overrides for CRC16 functionality */
60  (uint32_t)0x943,
61  (uint32_t)0x963,
62 
63  (uint32_t)0xFFFFFFFF,
64 };
65 /*---------------------------------------------------------------------------*/
66 /* CMD_PROP_RADIO_DIV_SETUP */
67 rfc_CMD_PROP_RADIO_DIV_SETUP_t smartrf_settings_cmd_prop_radio_div_setup =
68 {
69  .commandNo = 0x3807,
70  .status = 0x0000,
71  .pNextOp = 0,
72  .startTime = 0x00000000,
73  .startTrigger.triggerType = 0x0,
74  .startTrigger.bEnaCmd = 0x0,
75  .startTrigger.triggerNo = 0x0,
76  .startTrigger.pastTrig = 0x0,
77  .condition.rule = 0x1,
78  .condition.nSkip = 0x0,
79  .modulation.modType = 0x1,
80  .modulation.deviation = 0x64,
81  .symbolRate.preScale = 0xf,
82  .symbolRate.rateWord = 0x8000,
83  .rxBw = 0x24,
84  .preamConf.nPreamBytes = 0x3,
85  .preamConf.preamMode = 0x0,
86  .formatConf.nSwBits = 0x18,
87  .formatConf.bBitReversal = 0x0,
88  .formatConf.bMsbFirst = 0x1,
89  .formatConf.fecMode = 0x0,
90 
91  /* 7: .4g mode with dynamic whitening and CRC choice */
92  .formatConf.whitenMode = 0x7,
93  .config.frontEndMode = 0x0, /* Differential mode */
94  .config.biasMode = 0x1, /* External bias*/
95  .config.bNoFsPowerUp = 0x0,
96  .txPower = 0x00, /* Driver sets correct value */
97  .pRegOverride = overrides,
98  .intFreq = 0x8000,
99  .centerFreq = 868,
100  .loDivider = 0x05,
101 };
102 /*---------------------------------------------------------------------------*/
103 /* CMD_FS */
104 rfc_CMD_FS_t smartrf_settings_cmd_fs =
105 {
106  .commandNo = 0x0803,
107  .status = 0x0000,
108  .pNextOp = 0,
109  .startTime = 0x00000000,
110  .startTrigger.triggerType = 0x0,
111  .startTrigger.bEnaCmd = 0x0,
112  .startTrigger.triggerNo = 0x0,
113  .startTrigger.pastTrig = 0x0,
114  .condition.rule = 0x1,
115  .condition.nSkip = 0x0,
116  .frequency = 868,
117  .fractFreq = 0x0000,
118  .synthConf.bTxMode = 0x0,
119  .synthConf.refFreq = 0x0,
120  .__dummy0 = 0x00,
121  .midPrecal = 0x00,
122  .ktPrecal = 0x00,
123  .tdcPrecal = 0x0000,
124 };
125 /*---------------------------------------------------------------------------*/
126 /* CMD_PROP_TX_ADV */
127 rfc_CMD_PROP_TX_ADV_t smartrf_settings_cmd_prop_tx_adv =
128 {
129  .commandNo = 0x3803,
130  .status = 0x0000,
131  .pNextOp = 0,
132  .startTime = 0x00000000,
133  .startTrigger.triggerType = 0x0,
134  .startTrigger.bEnaCmd = 0x0,
135  .startTrigger.triggerNo = 0x0,
136  .startTrigger.pastTrig = 0x0,
137  .condition.rule = 0x1,
138  .condition.nSkip = 0x0,
139  .pktConf.bFsOff = 0x0,
140  .pktConf.bUseCrc = 0x1,
141  .pktConf.bCrcIncSw = 0x0, /* .4g mode */
142  .pktConf.bCrcIncHdr = 0x0, /* .4g mode */
143  .numHdrBits = 0x10 /* 16: .4g mode */,
144  .pktLen = 0x0000,
145  .startConf.bExtTxTrig = 0x0,
146  .startConf.inputMode = 0x0,
147  .startConf.source = 0x0,
148  .preTrigger.triggerType = TRIG_REL_START,
149  .preTrigger.bEnaCmd = 0x0,
150  .preTrigger.triggerNo = 0x0,
151  .preTrigger.pastTrig = 0x1,
152  .preTime = 0x00000000,
153  .syncWord = 0x0055904e,
154  .pPkt = 0,
155 };
156 /*---------------------------------------------------------------------------*/
157 /* CMD_PROP_RX_ADV */
158 rfc_CMD_PROP_RX_ADV_t smartrf_settings_cmd_prop_rx_adv =
159 {
160  .commandNo = 0x3804,
161  .status = 0x0000,
162  .pNextOp = 0,
163  .startTime = 0x00000000,
164  .startTrigger.triggerType = 0x0,
165  .startTrigger.bEnaCmd = 0x0,
166  .startTrigger.triggerNo = 0x0,
167  .startTrigger.pastTrig = 0x0,
168  .condition.rule = 0x1,
169  .condition.nSkip = 0x0,
170  .pktConf.bFsOff = 0x0,
171  .pktConf.bRepeatOk = 0x1,
172  .pktConf.bRepeatNok = 0x1,
173  .pktConf.bUseCrc = 0x1,
174  .pktConf.bCrcIncSw = 0x0, /* .4g mode */
175  .pktConf.bCrcIncHdr = 0x0, /* .4g mode */
176  .pktConf.endType = 0x0,
177  .pktConf.filterOp = 0x1,
178  .rxConf.bAutoFlushIgnored = 0x1,
179  .rxConf.bAutoFlushCrcErr = 0x1,
180  .rxConf.bIncludeHdr = 0x0,
181  .rxConf.bIncludeCrc = 0x0,
182  .rxConf.bAppendRssi = 0x1,
183  .rxConf.bAppendTimestamp = 0x0,
184  .rxConf.bAppendStatus = 0x1,
185  .syncWord0 = 0x0055904e,
186  .syncWord1 = 0x00000000,
187  .maxPktLen = 0x0000, /* To be populated by the driver. */
188  .hdrConf.numHdrBits = 0x10, /* 16: .4g mode */
189  .hdrConf.lenPos = 0x0, /* .4g mode */
190  .hdrConf.numLenBits = 0x0B, /* 11 = 0x0B .4g mode */
191  .addrConf.addrType = 0x0,
192  .addrConf.addrSize = 0x0,
193  .addrConf.addrPos = 0x0,
194  .addrConf.numAddr = 0x0,
195  .lenOffset = -4, /* .4g mode */
196  .endTrigger.triggerType = TRIG_NEVER,
197  .endTrigger.bEnaCmd = 0x0,
198  .endTrigger.triggerNo = 0x0,
199  .endTrigger.pastTrig = 0x0,
200  .endTime = 0x00000000,
201  .pAddr = 0,
202  .pQueue = 0,
203  .pOutput = 0,
204 };
205 /*---------------------------------------------------------------------------*/