zglobals.lst
来自「CC2430上开关控制灯和温度传感器采集两个例子」· LST 代码 · 共 1,276 行 · 第 1/5 页
LST
1,276 行
\ 00007C ....8300 DW zgMaxSourceRoute, 131, 2, zgConfigPANID, 98, 16, zgPreConfigKey, 99
\ 0200....
\ 62001000
\ ....6300
\ 00008C 0100.... DW 1, zgPreConfigKeys, 97, 1, zgSecurityLevel, 67, 1
\ 61000100
\ ....4300
\ 0100
\ 00009A ....4400 DW zgApscMaxFrameRetries, 68, 2, zgApscAckWaitDurationPolled, 69, 1
\ 0200....
\ 45000100
\ 0000A6 ....4600 DW zgApsAckWaitMultiplier, 70, 2, zgApsDefaultMaxBindingTime, 4, 1
\ 0200....
\ 04000100
\ 0000B2 ....A100 DW zgStartDelay, 161, 1, zgSapiEndpoint, 0, 0, 0H
\ 0100....
\ 00000000
\ 0000
160 {
161 #if defined ( NV_INIT )
162 {
163 ZCD_NV_LOGICAL_TYPE, sizeof(zgDeviceLogicalType), &zgDeviceLogicalType
164 },
165 {
166 ZCD_NV_POLL_RATE, sizeof(zgPollRate), &zgPollRate
167 },
168 {
169 ZCD_NV_QUEUED_POLL_RATE, sizeof(zgQueuedPollRate), &zgQueuedPollRate
170 },
171 {
172 ZCD_NV_RESPONSE_POLL_RATE, sizeof(zgResponsePollRate), &zgResponsePollRate
173 },
174 {
175 ZCD_NV_REJOIN_POLL_RATE, sizeof(zgRejoinPollRate), &zgRejoinPollRate
176 },
177 {
178 ZCD_NV_DATA_RETRIES, sizeof(zgMaxDataRetries), &zgMaxDataRetries
179 },
180 {
181 ZCD_NV_POLL_FAILURE_RETRIES, sizeof(zgMaxPollFailureRetries), &zgMaxPollFailureRetries
182 },
183 {
184 ZCD_NV_CHANLIST, sizeof(zgDefaultChannelList), &zgDefaultChannelList
185 }
186 ,
187 {
188 ZCD_NV_SCAN_DURATION, sizeof(zgDefaultStartingScanDuration), &zgDefaultStartingScanDuration
189 },
190 {
191 ZCD_NV_STACK_PROFILE, sizeof(zgStackProfile), &zgStackProfile
192 },
193 {
194 ZCD_NV_INDIRECT_MSG_TIMEOUT, sizeof(zgIndirectMsgTimeout), &zgIndirectMsgTimeout
195 },
196 {
197 ZCD_NV_ROUTE_EXPIRY_TIME, sizeof(zgRouteExpiryTime), &zgRouteExpiryTime
198 },
199 {
200 ZCD_NV_EXTENDED_PAN_ID, Z_EXTADDR_LEN, &zgExtendedPANID
201 },
202 {
203 ZCD_NV_BCAST_RETRIES, sizeof(zgMaxBcastRetires), &zgMaxBcastRetires
204 },
205 {
206 ZCD_NV_PASSIVE_ACK_TIMEOUT, sizeof(zgPassiveAckTimeout), &zgPassiveAckTimeout
207 },
208 {
209 ZCD_NV_BCAST_DELIVERY_TIME, sizeof(zgBcastDeliveryTime), &zgBcastDeliveryTime
210 },
211 {
212 ZCD_NV_NWK_MODE, sizeof(zgNwkMode), &zgNwkMode
213 },
214 {
215 ZCD_NV_CONCENTRATOR_ENABLE, sizeof(zgConcentratorEnable), &zgConcentratorEnable
216 },
217 {
218 ZCD_NV_CONCENTRATOR_DISCOVERY, sizeof(zgConcentratorDiscoveryTime), &zgConcentratorDiscoveryTime
219 },
220 {
221 ZCD_NV_CONCENTRATOR_RADIUS, sizeof(zgConcentratorRadius), &zgConcentratorRadius
222 },
223 {
224 ZCD_NV_MAX_SOURCE_ROUTE, sizeof(zgMaxSourceRoute), &zgMaxSourceRoute
225 },
226 #ifndef NONWK
227 {
228 ZCD_NV_PANID, sizeof(zgConfigPANID), &zgConfigPANID
229 },
230 {
231 ZCD_NV_PRECFGKEY, SEC_KEY_LEN, &zgPreConfigKey
232 },
233 {
234 ZCD_NV_PRECFGKEYS_ENABLE, sizeof(zgPreConfigKeys), &zgPreConfigKeys
235 },
236 {
237 ZCD_NV_SECURITY_LEVEL, sizeof(zgSecurityLevel), &zgSecurityLevel
238 },
239 #endif // NONWK
240 {
241 ZCD_NV_APS_FRAME_RETRIES, sizeof(zgApscMaxFrameRetries), &zgApscMaxFrameRetries
242 },
243 {
244 ZCD_NV_APS_ACK_WAIT_DURATION, sizeof(zgApscAckWaitDurationPolled), &zgApscAckWaitDurationPolled
245 },
246 {
247 ZCD_NV_APS_ACK_WAIT_MULTIPLIER, sizeof(zgApsAckWaitMultiplier), &zgApsAckWaitMultiplier
248 },
249 {
250 ZCD_NV_BINDING_TIME, sizeof(zgApsDefaultMaxBindingTime), &zgApsDefaultMaxBindingTime
251 },
252 {
253 ZCD_NV_START_DELAY, sizeof(zgStartDelay), &zgStartDelay
254 },
255 {
256 ZCD_NV_SAPI_ENDPOINT, sizeof(zgSapiEndpoint), &zgSapiEndpoint
257 },
258 #endif // NV_INIT
259 // Last item -- DO NOT MOVE IT!
260 {
261 0x00, 0, NULL
262 }
263 };
264
265 /*********************************************************************
266 * LOCAL FUNCTIONS
267 */
268
269 static uint8 zgItemInit( uint16 id, uint16 len, void *buf, uint8 setDefault );
270
271
272 /*********************************************************************
273 * @fn zgItemInit()
274 *
275 * @brief
276 *
277 * Initialize a global item. If the item doesn't exist in NV memory,
278 * write the system default (value passed in) into NV memory. But if
279 * it exists, set the item to the value stored in NV memory.
280 *
281 * Also, if setDefault is TRUE and the item exists, we will write
282 * the default value to NV space.
283 *
284 * @param id - item id
285 * @param len - item len
286 * @param buf - pointer to the item
287 * @param setDefault - TRUE to set default, not read
288 *
289 * @return ZSUCCESS if successful, NV_ITEM_UNINIT if item did not
290 * exist in NV, NV_OPER_FAILED if failure.
291 */
292 static uint8 zgItemInit( uint16 id, uint16 len, void *buf, uint8 setDefault )
293 {
294
295 uint8 status;
296
297 // If the item doesn't exist in NV memory, create and initialize
298 // it with the value passed in.
299 status = osal_nv_item_init( id, len, buf );
300 if ( status == ZSUCCESS )
301 {
302 if ( setDefault )
303 {
304 // Write the default value back to NV
305 status = osal_nv_write( id, 0, len, buf );
306 }
307 else
308 {
309 // The item exists in NV memory, read it from NV memory
310 status = osal_nv_read( id, 0, len, buf );
311 }
312 }
313
314 return (status);
315 }
316
317 /*********************************************************************
318 * API FUNCTIONS
319 */
320
321
322 /*********************************************************************
323 * @fn zgInit
324 *
325 * @brief
326 *
327 * Initialize the Z-Stack Globals. If an item doesn't exist in
328 * NV memory, write the system default into NV memory. But if
329 * it exists, set the item to the value stored in NV memory.
330 *
331 * NOTE: The Startup Options (ZCD_NV_STARTUP_OPTION) indicate
332 * that the Config state items (zgItemTable) need to be
333 * set to defaults (ZCD_STARTOPT_DEFAULT_CONFIG_STATE). The
334 *
335 *
336 * @param none
337 *
338 * @return ZSUCCESS if successful, NV_ITEM_UNINIT if item did not
339 * exist in NV, NV_OPER_FAILED if failure.
340 */
\ In segment BANKED_CODE, align 1, keep-with-next
341 uint8 zgInit( void )
\ zgInit:
342 {
\ 000000 74F1 MOV A,#-0xf
\ 000002 12.... LCALL ?BANKED_ENTER_XDATA
\ 000005 ; Saved register size: 15
\ 000005 ; Auto size: 0
343 uint8 i = 0;
\ 000005 75..00 MOV ?V0 + 3,#0x0
344 uint8 setDefault = FALSE;
\ 000008 75..00 MOV ?V0 + 2,#0x0
345
346 // Do we want to default the Config state values
347 if ( zgReadStartupOptions() & ZCD_STARTOPT_DEFAULT_CONFIG_STATE )
\ 00000B ; Setup parameters for call to function zgReadStartupOptions
\ 00000B 90.... MOV DPTR,#(zgReadStartupOptions & 0xffff)
\ 00000E 74.. MOV A,#((zgReadStartupOptions >> 16) & 0xff)
\ 000010 12.... LCALL ?BCALL ; Banked call to: DPTR()
\ 000013 E9 MOV A,R1
\ 000014 A2E0 MOV C,0xE0 /* A */.0
\ 000016 5003 JNC ??zgInit_0
348 {
349 setDefault = TRUE;
\ 000018 75..01 MOV ?V0 + 2,#0x1
350 }
351
352 #if 0
353 // Enable this section if you need to track the number of resets
354 // This section is normally disabled to minimize "wear" on NV memory
355 uint16 bootCnt = 0;
356
357 // Update the Boot Counter
358 if ( osal_nv_item_init( ZCD_NV_BOOTCOUNTER, sizeof(bootCnt), &bootCnt ) == ZSUCCESS )
359 {
360 // Get the old value from NV memory
361 osal_nv_read( ZCD_NV_BOOTCOUNTER, 0, sizeof(bootCnt), &bootCnt );
362 }
363
364 // Increment the Boot Counter and store it into NV memory
365 if ( setDefault )
366 bootCnt = 0;
367 else
368 bootCnt++;
369 osal_nv_write( ZCD_NV_BOOTCOUNTER, 0, sizeof(bootCnt), &bootCnt );
370 #endif
371
372 // Initialize the Extended PAN ID as my own extended address
373 ZMacGetReq( ZMacExtAddr, zgExtendedPANID );
\ ??zgInit_0:
\ 00001B ; Setup parameters for call to function ZMacGetReq
\ 00001B 7A.. MOV R2,#(zgExtendedPANID & 0xff)
\ 00001D 7B.. MOV R3,#((zgExtendedPANID >> 8) & 0xff)
\ 00001F 79E2 MOV R1,#-0x1e
\ 000021 12.... LCALL ZMacGetReq & 0xFFFF
374
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?