SZS ez430-RF2480 1.0

ZigBee Sensor Network with synchronized time and time-stamped measurements.
cc2480ai.h
Go to the documentation of this file.
1 /*
2  * cc2480ai.h
3  *
4  * Date: 19/06/2014
5  * Author: Fernando Biazi Nascimento
6  * Copyright © 2014 Fernando Biazi Nascimento. All rights reserved.
7  *
8  * License of use and copy on file license.txt
9  *
10  */
11 
22 #ifndef CC2480AI_H_
23 #define CC2480AI_H_
24 
25 /*
26  * ======== Includes ========
27  */
28 
29 #include <xdc/std.h>
30 
31 /*
32  * ======== Doxygen ========
33  */
45 /*
46  * ======== Constants ========
47  */
48 
49 /*
50  * ======== Macros ========
51  */
52 
67 #define CCAI_ZP_NV_APP_ITEM_1 0x0300
68 
71 #define CCAI_ZP_NV_APP_ITEM_2 0x0301
72 
75 #define CCAI_ZP_NV_APP_ITEM_3 0x0302
76 
79 #define CCAI_ZP_NV_APP_ITEM_4 0x0303
80 
83 #define CCAI_ZP_NV_APP_ITEM_5 0x0304
84 
87 #define CCAI_ZP_NV_APP_ITEM_6 0x0305
88 
101 #define CCAI_ADC_AIN0 0x06
102 
105 #define CCAI_ADC_AIN1 0x07
106 
109 #define CCAI_ADC_AIN0_1_DIFERENTIAL 0x0B
110 
113 #define CCAI_ADC_TEMPERATURE_SENSOR 0x0E
114 
117 #define CCAI_ADC_VOLTAGE_READING 0x0F
118 
131 #define CCAI_ADC_7_BIT 0x00
132 
135 #define CCAI_ADC_9_BIT 0x01
136 
139 #define CCAI_ADC_10_BIT 0x02
140 
143 #define CCAI_ADC_12_BIT 0x03
144 
157 #define CCAI_GPIO_SETDIRECTION 0x00
158 
162 #define CCAI_GPIO_SETINPUTMODE 0x01
163 
166 #define CCAI_GPIO_SET 0x02
167 
170 #define CCAI_GPIO_CLEAR 0x03
171 
174 #define CCAI_GPIO_TOGGLE 0x04
175 
178 #define CCAI_GPIO_READ 0x05
179 
193 #define CCAI_GPIO_BIT0 0x01
194 
197 #define CCAI_GPIO_BIT1 0x02
198 
201 #define CCAI_GPIO_BIT2 0x10
202 
205 #define CCAI_GPIO_BIT3 0x20
206 
219 #define CCAI_TESTRF_MODE_UNMODULATED 0X00
220 
223 #define CCAI_TESTRF_MODE_RANDOMDATA 0X00
224 
227 #define CCAI_TESTRF_MODE_RECEIVEMODE 0X00
228 
241 #define CCAI_TESTRF_PWR_P006 0xFF
242 
245 #define CCAI_TESTRF_PWR_P005 0xDF
246 
249 #define CCAI_TESTRF_PWR_P003 0xBF
250 
253 #define CCAI_TESTRF_PWR_P002 0x9F
254 
257 #define CCAI_TESTRF_PWR_N001 0x7F
258 
261 #define CCAI_TESTRF_PWR_N004 0x5F
262 
265 #define CCAI_TESTRF_PWR_N009 0x3F
266 
269 #define CCAI_TESTRF_PWR_N015 0x1F
270 
273 #define CCAI_TESTRF_PWR_N027 0x1B
274 
277 #define CCAI_TESTRF_PWR_N040 0x17
278 
281 #define CCAI_TESTRF_PWR_N057 0x13
282 
285 #define CCAI_TESTRF_PWR_N079 0x0F
286 
289 #define CCAI_TESTRF_PWR_N108 0x0B
290 
293 #define CCAI_TESTRF_PWR_N154 0x07
294 
297 #define CCAI_TESTRF_PWR_N186 0x06
298 
301 #define CCAI_TESTRF_PWR_N252 0x03
302 
321 #define CCAI_CFGD_ZCD_NV_STARTUP_OPTION 0x03
322 
332 #define CCAI_CFGD_BIT_STARTOPT_CLEAR_CONFIG 1
333 
336 #define CCAI_CFGD_BIT_STARTOPT_CLEAR_STATE 2
337 
342 #define CCAI_CFGD_BIT_STARTOPT_AUTO_START 4
343 
350 #define CCAI_CFGD_ZCD_NV_LOGICAL_TYPE 0x87
351 
361 #define CCAI_CFGD_LOGICAL_TYPE_COORDINATOR 0
362 
365 #define CCAI_CFGD_LOGICAL_TYPE_ROUTER 1
366 
369 #define CCAI_CFGD_LOGICAL_TYPE_ENDDEVICE 2
370 
377 #define CCAI_CFGD_ZCD_NV_POLL_RATE 0x24
378 
382 #define CCAI_CFGD_ZCD_NV_QUEUED_POLL_RATE 0x25
383 
386 #define CCAI_CFGD_ZCD_NV_RESPONSE_POLL_RATE 0x26
387 
390 #define CCAI_CFGD_ZCD_NV_POLL_FAILURE_RETRIES 0x29
391 
394 #define CCAI_CFGD_ZCD_NV_INDIRECT_MSG_TIMEOUT 0x2B
395 
398 #define CCAI_CFGD_ZCD_NV_APS_FRAME_RETRIES 0x43
399 
402 #define CCAI_CFGD_ZCD_NV_APS_ACK_WAIT_DURATION 0x44
403 
406 #define CCAI_CFGD_ZCD_NV_BINDING_TIME 0x46
407 
410 #define CCAI_CFGD_ZCD_NV_USERDESC 0x81
411 
424 #define CCAI_CFGN_ZCD_NV_PANID 0x83
425 
428 #define CCAI_CFGN_ZCD_NV_CHANLIST 0x84
429 
432 #define CCAI_CFGN_ZCD_NV_PRECFGKEY 0x62
433 
436 #define CCAI_CFGN_ZCD_NV_PRECFGKEYS_ENABLE 0x63
437 
440 #define CCAI_CFGN_ZCD_NV_SECURITY_MODE 0x64
441 
444 #define CCAI_CFGN_ZCD_NV_BCAST_RETRIES 0x2E
445 
448 #define CCAI_CFGN_ZCD_NV_PASSIVE_ACK_TIMEOUT 0x2F
449 
452 #define CCAI_CFGN_ZCD_NV_BCAST_DELIVERY_TIME 0x30
453 
456 #define CCAI_CFGN_ZCD_NV_ROUTE_EXPIRY_TIME 0x2C
457 
472 #define CCAI_INFO_STATE 0
473 
476 #define CCAI_INFO_IEEEADDRESS 1
477 
480 #define CCAI_INFO_SHORTADDRESS 2
481 
484 #define CCAI_INFO_PARENTSHORTADDRESS 3
485 
488 #define CCAI_INFO_PARENTIEEEADDRESS 4
489 
492 #define CCAI_INFO_ZBCHANNEL 5
493 
496 #define CCAI_INFO_ZBPANID 6
497 
500 #define CCAI_INFO_ZBEXTENDEDPANID 7
501 
514 #define CCAI_STA_ZSUCCESS 0x00
515 
518 #define CCAI_STA_ZFAILURE 0x01
519 
522 #define CCAI_STA_ZINVALIDPARAMETER 0x02
523 
526 #define CCAI_STA_ZMEMERROR 0x10
527 
530 #define CCAI_STA_ZBUFFERFULL 0x11
531 
534 #define CCAI_STA_ZUNSUPPORTEDMODE 0x12
535 
538 #define CCAI_STA_ZUNSUPPORTEDMODE 0x12
539 
542 #define CCAI_STA_ZMACMEMERROR 0x13
543 
546 #define CCAI_STA_ZSECNOKEY 0xA1
547 
550 #define CCAI_STA_ZSECMAXFRMCOUNT 0xA3
551 
554 #define CCAI_STA_ZDOINVALIDREQUESTTYPE 0x80
555 
558 #define CCAI_STA_ZDOINVALIDENDPOINT 0x82
559 
562 #define CCAI_STA_ZDOUNSUPPORTED 0x84
563 
566 #define CCAI_STA_ZDOTIMEOUT 0x85
567 
570 #define CCAI_STA_ZDONOMATCH 0x86
571 
574 #define CCAI_STA_ZDOTABLEFULL 0x87
575 
578 #define CCAI_STA_ZDONOBINDENTRY 0x88
579 
582 #define CCAI_STA_ZAPSFAIL 0xB1
583 
586 #define CCAI_STA_ZAPSTABLEFULL 0xB2
587 
590 #define CCAI_STA_ZAPSILLEGALREQUEST 0xB3
591 
594 #define CCAI_STA_ZAPSINVALIDBINDING 0xB4
595 
598 #define CCAI_STA_ZAPSUNSUPPORTEDATTRIB 0xB5
599 
602 #define CCAI_STA_ZAPSNOTSUPPORTED 0xB6
603 
606 #define CCAI_STA_ZAPSNOACK 0xB7
607 
610 #define CCAI_STA_ZAPSDUPLICATEENTRY 0xB8
611 
614 #define CCAI_STA_ZAPSNOBOUNDDEVICE 0xB9
615 
618 #define CCAI_STA_ZNWKINVALIDPARAM 0xC1
619 
622 #define CCAI_STA_ZNWKINVALIDREQUEST 0xC2
623 
626 #define CCAI_STA_ZNWKNOTPERMITTED 0xC3
627 
630 #define CCAI_STA_ZNWKSTARTUPFAILURE 0xC4
631 
634 #define CCAI_STA_ZNWKTABLEFULL 0xC7
635 
638 #define CCAI_STA_ZNWKUNKNOWNDEVICE 0xC8
639 
642 #define CCAI_STA_ZNWKUNSUPPORTEDATTRIBUTE 0xC9
643 
646 #define CCAI_STA_ZNWKNONETWORKS 0xCA
647 
650 #define CCAI_STA_ZNWKLEAVEUNCONFIRMED 0xCB
651 
654 #define CCAI_STA_ZNWKNOACK 0xCC
655 
658 #define CCAI_STA_ZNWKNOROUTE 0xCD
659 
665 /*
666  * ======== Types ========
667  */
668 
672 typedef enum ccai_devStates_t {
685 
686 /*
687  * ======== Global Variables ========
688  */
689 
690 /*
691  * ======== Global Functions ========
692  */
693 
694 void ccai_init();
695 UInt16 ccai_proccess();
696 
697 void ccai_process_message();
698 
699 void ccai_resetFull();
700 void ccai_resetLight();
701 
706 UInt8 ccai_a_sys_reset_req();
707 UInt8 ccai_s_sys_version();
708 UInt8 ccai_s_sys_osal_nv_read(UInt16 id, UInt8 offset);
709 UInt8 ccai_s_sys_osal_nv_write(UInt16 id, UInt8 offset, UInt8 len, char *pBuf);
710 UInt8 ccai_s_sys_osal_start_timer(UInt8 id, UInt16 timeout);
711 UInt8 ccai_s_sys_osal_stop_timer(UInt8 id);
712 UInt8 ccai_s_sys_random();
713 UInt8 ccai_s_sys_adc_read(UInt8 channel, UInt8 resolution);
714 UInt8 ccai_s_sys_gpio(UInt8 operation, UInt8 value);
715 UInt8 ccai_a_sys_test_rf(UInt8 testMode, UInt16 frequency, UInt8 txPower);
716 UInt8 ccai_s_sys_test_loopback(UInt8 len, char *pBuf);
723 UInt8 ccai_s_zb_read_configuration(UInt8 configId);
724 UInt8 ccai_s_zb_write_configuration(UInt8 configId, UInt8 len, void *pBuf);
731 UInt8 ccai_s_zb_app_register_request(UInt8 appEndPoint, UInt16 appProfileId,
732  UInt16 DeviCeId, UInt8 DeviceVersion, UInt8 inputCommandsNum,
733  char *InputCommandsList, UInt8 OutputCommandsNum,
734  char *OutputCommandsList);
736 UInt8 ccai_s_zb_permit_joining_request(UInt16 destination, UInt8 timeOut);
737 UInt8 ccai_s_zb_bind_device(UInt8 create, UInt16 commandId,
738  uint64_t destination);
739 UInt8 ccai_s_zb_allow_bind(UInt8 timeout);
740 UInt8 ccai_s_zb_send_data_request(UInt16 destination, UInt16 commandId,
741  UInt8 handle, UInt8 ack, UInt8 radius, UInt8 len, void *data);
742 UInt8 ccai_s_zb_send_data_request_begin(UInt16 destination, UInt16 commandId,
743  UInt8 handle, UInt8 ack, UInt8 radius, UInt8 len);
744 UInt8 ccai_s_zb_send_data_request_payload(UInt8 len, void *pBuf);
745 void ccai_s_zb_send_data_request_end(UInt8 forwardToSerial);
746 UInt8 ccai_s_zb_get_device_info(UInt8 param);
747 UInt8 ccai_s_zb_find_device_request(uint64_t searchKey);
754 UInt8 ccai_s_af_register();
755 UInt8 ccai_s_af_data_request();
771 UInt8 ccai_s_zdo_end_device_bind_req(); // unclear sender from this line
772 UInt8 ccai_s_zdo_bind_req();
773 UInt8 ccai_s_zdo_unbind_req();
782 #endif /* CC2480AI_H_ */
UInt8 ccai_s_zdo_nwk_addr_req()
Not implemented.
Definition: cc2480ai.c:1794
UInt8 ccai_s_zb_start_request()
Start request.
Definition: cc2480ai.c:1342
UInt8 ccai_s_sys_version()
Version request.
Definition: cc2480ai.c:892
UInt8 ccai_s_zdo_user_desc_set()
Not implemented.
Definition: cc2480ai.c:2050
UInt8 ccai_s_zdo_user_desc_req()
Not implemented.
Definition: cc2480ai.c:2015
Initialized - not connected to anything.
Definition: cc2480ai.h:674
UInt8 ccai_s_zb_find_device_request(uint64_t searchKey)
Find device request.
Definition: cc2480ai.c:1684
Discovering PAN's to join.
Definition: cc2480ai.h:675
UInt8 ccai_s_sys_random()
Random request.
Definition: cc2480ai.c:1068
UInt8 ccai_s_sys_osal_start_timer(UInt8 id, UInt16 timeout)
Timer start request.
Definition: cc2480ai.c:996
UInt8 ccai_s_zb_bind_device(UInt8 create, UInt16 commandId, uint64_t destination)
Bind device request.
Definition: cc2480ai.c:1421
UInt8 ccai_s_zb_send_data_request_payload(UInt8 len, void *pBuf)
Append data to the payload of send data request.
Definition: cc2480ai.c:1588
UInt8 ccai_s_zdo_active_ep_req()
Not implemented.
Definition: cc2480ai.c:1934
UInt8 ccai_s_sys_osal_stop_timer(UInt8 id)
Stop timer request.
Definition: cc2480ai.c:1028
UInt8 ccai_s_zb_allow_bind(UInt8 timeout)
Allow bind request.
Definition: cc2480ai.c:1466
UInt8 ccai_s_zdo_end_device_bind_req()
Not implemented.
Definition: cc2480ai.c:2120
void ccai_resetFull()
Full reset.
Definition: cc2480ai.c:616
UInt8 ccai_s_zb_get_device_info(UInt8 param)
Get device information request.
Definition: cc2480ai.c:1653
ccai_devStates_t
From ZASA, file cc2480.h. This is not documented on swra175a.pdf.
Definition: cc2480ai.h:672
UInt8 ccai_s_zdo_mgmt_leave_req()
Not implemented.
Definition: cc2480ai.c:2260
UInt8 ccai_s_zb_send_data_request_begin(UInt16 destination, UInt16 commandId, UInt8 handle, UInt8 ack, UInt8 radius, UInt8 len)
Begin request to send data.
Definition: cc2480ai.c:1557
Joining a PAN.
Definition: cc2480ai.h:676
Started as device after authentication.
Definition: cc2480ai.h:679
UInt8 ccai_s_af_register()
Not implemented.
Definition: cc2480ai.c:1724
void ccai_resetLight()
Reset.
Definition: cc2480ai.c:627
UInt8 ccai_s_zdo_node_desc_req()
Not implemented.
Definition: cc2480ai.c:1864
UInt8 ccai_s_sys_adc_read(UInt8 channel, UInt8 resolution)
Read ADC request.
Definition: cc2480ai.c:1099
UInt8 ccai_s_sys_test_loopback(UInt8 len, char *pBuf)
Loopback test request.
Definition: cc2480ai.c:1189
UInt8 ccai_s_zdo_end_device_annce()
Not implemented.
Definition: cc2480ai.c:2085
Device has lost information about its parent..
Definition: cc2480ai.h:683
UInt8 ccai_s_zdo_simple_desc_req()
Not implemented.
Definition: cc2480ai.c:1899
UInt8 ccai_a_sys_reset_req()
Reset Request.
Definition: cc2480ai.c:852
UInt8 ccai_s_sys_osal_nv_write(UInt16 id, UInt8 offset, UInt8 len, char *pBuf)
Write memory request.
Definition: cc2480ai.c:958
UInt8 ccai_s_zdo_bind_req()
Not implemented.
Definition: cc2480ai.c:2155
UInt8 ccai_s_sys_osal_nv_read(UInt16 id, UInt8 offset)
Read memory request.
Definition: cc2480ai.c:923
void ccai_process_message()
Proccess a received message.
Definition: cc2480ai.c:639
Started as ZigBee Coordinator.
Definition: cc2480ai.h:682
UInt8 ccai_s_zb_app_register_request(UInt8 appEndPoint, UInt16 appProfileId, UInt16 DeviCeId, UInt8 DeviceVersion, UInt8 inputCommandsNum, char *InputCommandsList, UInt8 OutputCommandsNum, char *OutputCommandsList)
Application register request.
Definition: cc2480ai.c:1301
UInt8 ccai_s_sys_gpio(UInt8 operation, UInt8 value)
GPIO access request.
Definition: cc2480ai.c:1132
UInt8 ccai_s_zb_read_configuration(UInt8 configId)
Read configuration request.
Definition: cc2480ai.c:1223
void ccai_init()
This function initializes the CC2480 Application Interface variables.
Definition: cc2480ai.c:557
Device joined, authenticated and is a router.
Definition: cc2480ai.h:680
UInt8 ccai_s_zdo_unbind_req()
Not implemented.
Definition: cc2480ai.c:2190
UInt8 ccai_s_zdo_mgmt_lqi_req()
Not implemented.
Definition: cc2480ai.c:2225
Started as ZigBee Coordinator.
Definition: cc2480ai.h:681
UInt8 ccai_s_zdo_mgmt_permit_join_req()
Not implemented.
Definition: cc2480ai.c:2297
UInt16 ccai_proccess()
This function processes the tasks of the CC2480 Application Interface.
Definition: cc2480ai.c:573
ReJoining a PAN, only for end devices.
Definition: cc2480ai.h:677
UInt8 ccai_s_zb_write_configuration(UInt8 configId, UInt8 len, void *pBuf)
Write configuration request.
Definition: cc2480ai.c:1256
UInt8 ccai_s_zdo_match_desc_req()
Not implemented.
Definition: cc2480ai.c:1969
Joined but not yet authenticated by trust center.
Definition: cc2480ai.h:678
UInt8 ccai_s_zdo_ieee_addr_req()
Not implemented.
Definition: cc2480ai.c:1829
UInt8 ccai_a_sys_test_rf(UInt8 testMode, UInt16 frequency, UInt8 txPower)
RF test configuration.
Definition: cc2480ai.c:1166
UInt8 ccai_s_af_data_request()
Not implemented.
Definition: cc2480ai.c:1748
UInt8 ccai_s_zb_permit_joining_request(UInt16 destination, UInt8 timeOut)
Permit join change request.
Definition: cc2480ai.c:1386
Initialized - not started automatically.
Definition: cc2480ai.h:673
UInt8 ccai_s_zb_send_data_request(UInt16 destination, UInt16 commandId, UInt8 handle, UInt8 ack, UInt8 radius, UInt8 len, void *data)
Send data request.
Definition: cc2480ai.c:1517
void ccai_s_zb_send_data_request_end(UInt8 forwardToSerial)
Terminate the request to send data and send it to CC2480.
Definition: cc2480ai.c:1604