1 // *********************************************************************
    2 //   General public DPA header file                                    *
    3 // *********************************************************************
    4 // Copyright (c) IQRF Tech s.r.o.
    5 //
    6 // File:    $RCSfile: DPA.h,v $
    7 // Version: $Revision: 1.210 $
    8 // Date:    $Date: 2017/09/01 13:07:05 $
    9 //
   10 // Revision history:
   11 //   201?/??/??  Release for DPA 3.02
   12 //   2017/08/14  Release for DPA 3.01
   13 //   2017/03/13  Release for DPA 3.00
   14 //   2016/09/12  Release for DPA 2.28
   15 //   2016/04/14  Release for DPA 2.27
   16 //   2016/03/03  Release for DPA 2.26
   17 //   2016/01/21  Release for DPA 2.25
   18 //   2015/12/01  Release for DPA 2.24
   19 //   2015/10/23  Release for DPA 2.23
   20 //   2015/09/25  Release for DPA 2.22
   21 //   2015/09/03  Release for DPA 2.21
   22 //   2015/08/05  Release for DPA 2.20
   23 //   2014/10/31  Release for DPA 2.10
   24 //   2014/04/30  Release for DPA 2.00
   25 //   2013/10/03  Release for DPA 1.00
   26 //
   27 // *********************************************************************
   28 
   29 // Online DPA documentation http://www.iqrf.org/DpaTechGuide/
   30 
   31 #ifndef _DPA_HEADER_
   32 #define _DPA_HEADER_
   33 
   34 //############################################################################################
   35 
   36 // DPA version
   37 #define DPA_VERSION_MASTER          0x0302
   38 
   39 #ifdef __CC5X__
   40 // Compiled only at CC5X
   41 #if __CC5X__ < 3507
   42 #error Insufficient CC5X compiler version, V3.5G is minimum
   43 #endif
   44 
   45 #if IQRFOS < 400
   46 #error IQRF OS 4.00+ is required
   47 #endif
   48 
   49 // Bank for custom variables
   50 #pragma rambank = UserBank_01
   51 
   52 // Main DPA API entry address (also start of the licensed FLASH) 
   53 #define DPA_API_ADDRESS             __LICENSED_FLASH
   54 
   55 // Main DPA entry address
   56 #define MAIN_DPA_ADDRESS            ( DPA_API_ADDRESS + 4 )
   57 
   58 // Main DPA API entry address stub
   59 #define DPA_API_ADDRESS_ENTRY       0x3A08
   60 
   61 // Address of the DPA Custom Handler
   62 #define CUSTOM_HANDLER_ADDRESS      0x3A20
   63 
   64 // Address of the DPA Custom Handler end + 1
   65 #define CUSTOM_HANDLER_ADDRESS_END  0x3D80
   66 
   67 // DPA API entry function
   68 uns8  DpaApiEntry( uns8 par1, uns8 par2, uns8 apiIndex );
   69 
   70 // DPA API codes
   71 #define DPA_API_RFTX_DPAPACKET              0
   72 #define DPA_API_READ_CONFIG_BYTE            1
   73 #define DPA_API_SEND_TO_IFACEMASTER         2
   74 #define DPA_API_COORDINATOR_RFTX_DPAPACKET  3
   75 #define DPA_API_LOCAL_REQUEST               4
   76 #define DPA_API_SET_PERIPHERAL_ERROR        5
   77 #define DPA_API_SET_RF_DEFAULTS             6
   78 
   79 // Used buffer size symbols
   80 #define sizeofBufferAUX                     sizeof( bufferAUX )
   81 #define sizeofBufferCOM                     sizeof( bufferCOM )
   82 
   83 #define STRUCTATTR
   84 
   85 #else //__CC5X__
   86 // Not compiled at CC5X
   87 
   88 // Define CC5X types
   89 typedef uint8_t   uns8;
   90 typedef uint16_t  uns16;
   91 
   92 // Fake buffer sizes
   93 #define sizeofBufferAUX 64
   94 #define sizeofBufferCOM 64
   95 
   96 // Disables alignment of members of structures
   97 #define STRUCTATTR  __attribute__((packed))
   98 
   99 #endif  // __CC5X__
  100 
  101 // Indexes of configuration bytes used by DpaApiReadConfigByte( index )
  102 // Checksum
  103 #define CFGIND_CHECKSUM         0x00
  104 // Embedded peripherals
  105 #define CFGIND_DPA_PERIPHERALS  0x01
  106 // DPA configuration flags
  107 #define CFGIND_DPA_FLAGS        0x05
  108 // Main RF channel, used by the subordinate network
  109 #define CFGIND_CHANNEL_2ND_A    0x06
  110 // Second RF channel, used by the subordinate network
  111 #define CFGIND_CHANNEL_2ND_B    0x07
  112 // TX power
  113 #define CFGIND_TXPOWER          0x08
  114 // RX filter used by checkRF()
  115 #define CFGIND_RXFILTER         0x09
  116 // toutRF for LP mode
  117 #define CFGIND_DPA_LP_TOUTRF    0x0A
  118 // UART interface baud rate
  119 #define CFGIND_DPA_UART_IFACE_SPEED 0x0B
  120 // Alternate DSM channel
  121 #define CFGIND_ALTERNATE_DSM_CHANNEL 0x0C
  122 // Main RF channel
  123 #define CFGIND_CHANNEL_A        0x11
  124 // Second RF channel
  125 #define CFGIND_CHANNEL_B        0x12
  126 
  127 // 0: checks only mandatory precondition in order to prevent critical side-effects
  128 // 1: as above plus checks meaningful parameter conditions
  129 // 2: full implemented parameter checking (default)
  130 #ifndef PARAM_CHECK_LEVEL
  131 #define PARAM_CHECK_LEVEL 2
  132 #endif
  133 
  134 // "foursome" at IFace structure
  135 typedef struct
  136 {
  137   // Node address low byte
  138   uns8  NADRlow;
  139   // Node address high byte
  140   uns8  NADRhigh;
  141   // Peripheral number
  142   uns8  PNUM;
  143   // Peripheral command
  144   uns8  PCMD;
  145   // HWPID
  146   uns16 HWPID;
  147 } STRUCTATTR TDpaIFaceHeader;
  148 
  149 // Maximum command PCMD value (except reserved 0x3F = CMD_GET_PER_INFO)
  150 #define PCMD_MAX                    0x7f
  151 // Bit mask at PCMD that indicates DPA Response message
  152 #define RESPONSE_FLAG               0x80
  153 
  154 // IQMESH coordinator address
  155 #define COORDINATOR_ADDRESS         0x00
  156 // IQMESH broadcast address
  157 #define BROADCAST_ADDRESS           0xff
  158 // IQMESH temporary address, assigned by remote bonding before authorization is done
  159 #define TEMPORARY_ADDRESS           0xfe
  160 // Address of the local device addressed by IFace
  161 #define LOCAL_ADDRESS               0xfc
  162 // Maximum IQMESH network device address
  163 #define MAX_ADDRESS                 ( 240 - 1 )
  164 
  165 // Time slots lengths in 10 ms
  166 #define MIN_STD_TIMESLOT    4   
  167 #define MAX_STD_TIMESLOT    6
  168 
  169 #define MIN_LP_TIMESLOT     8
  170 #define MAX_LP_TIMESLOT     11
  171 
  172 #ifdef DPA_LP
  173 #define MIN_TIMESLOT        MIN_LP_TIMESLOT 
  174 #define MAX_TIMESLOT        MAX_LP_TIMESLOT 
  175 #else
  176 #define MIN_TIMESLOT        MIN_STD_TIMESLOT    
  177 #define MAX_TIMESLOT        MAX_STD_TIMESLOT
  178 #endif
  179 
  180 // Long diagnostics slot time
  181 #define LONG_DIAG_TIMESLOT  20 
  182 
  183 // Maximum number of DPA PData bytes ( minus 8 = 6B foursome + 8b error code + 8b DpaValue )
  184 #define DPA_MAX_DATA_LENGTH         ( sizeofBufferCOM - sizeof( TDpaIFaceHeader ) - 2 * sizeof( uns8 ) )
  185 
  186 // Maximum number of peripherals info that can fit in the message
  187 #define MAX_PERIPHERALS_PER_BLOCK_INFO  ( DPA_MAX_DATA_LENGTH / sizeof( TPeripheralInfoAnswer ) )
  188 
  189 // Embedded peripheral numbers
  190 #define PNUM_COORDINATOR    0x00
  191 #define PNUM_NODE           0x01
  192 #define PNUM_OS             0x02
  193 #define PNUM_EEPROM         0x03
  194 #define PNUM_EEEPROM        0x04
  195 #define PNUM_RAM            0x05
  196 #define PNUM_LEDR           0x06
  197 #define PNUM_LEDG           0x07
  198 #define PNUM_SPI            0x08
  199 #define PNUM_IO             0x09
  200 #define PNUM_THERMOMETER    0x0A
  201 #define PNUM_PWM            0x0B
  202 #define PNUM_UART           0x0C
  203 #define PNUM_FRC            0x0D
  204 
  205 // Number of the 1st user peripheral
  206 #define PNUM_USER           0x20
  207 // Number of the last user peripheral
  208 #define PNUM_USER_MAX       0x3E
  209 // Maximum peripheral number
  210 #define PNUM_MAX            0x7F
  211 
  212 // Fake peripheral number used to flag DPA response with error sent by RF
  213 #define PNUM_ERROR_FLAG     0xFE
  214 // Special peripheral used for enumeration
  215 #define PNUM_ENUMERATION    0xFF
  216 
  217 // DPA Commands for embedded peripherals
  218 #define CMD_COORDINATOR_ADDR_INFO  0
  219 #define CMD_COORDINATOR_DISCOVERED_DEVICES 1
  220 #define CMD_COORDINATOR_BONDED_DEVICES 2
  221 #define CMD_COORDINATOR_CLEAR_ALL_BONDS 3
  222 #define CMD_COORDINATOR_BOND_NODE 4
  223 #define CMD_COORDINATOR_REMOVE_BOND 5
  224 #define CMD_COORDINATOR_REBOND_NODE 6
  225 #define CMD_COORDINATOR_DISCOVERY 7
  226 #define CMD_COORDINATOR_SET_DPAPARAMS 8
  227 #define CMD_COORDINATOR_SET_HOPS 9
  228 #define CMD_COORDINATOR_DISCOVERY_DATA 10
  229 #define CMD_COORDINATOR_BACKUP 11
  230 #define CMD_COORDINATOR_RESTORE 12
  231 #define CMD_COORDINATOR_AUTHORIZE_BOND 13
  232 #define CMD_COORDINATOR_BRIDGE 14
  233 #define CMD_COORDINATOR_READ_REMOTELY_BONDED_MID 15
  234 #define CMD_COORDINATOR_CLEAR_REMOTELY_BONDED_MID 16
  235 #define CMD_COORDINATOR_ENABLE_REMOTE_BONDING 17
  236 
  237 #define CMD_NODE_READ 0
  238 #define CMD_NODE_REMOVE_BOND 1
  239 #define CMD_NODE_READ_REMOTELY_BONDED_MID 2
  240 #define CMD_NODE_CLEAR_REMOTELY_BONDED_MID 3
  241 #define CMD_NODE_ENABLE_REMOTE_BONDING 4
  242 #define CMD_NODE_REMOVE_BOND_ADDRESS 5
  243 #define CMD_NODE_BACKUP 6
  244 #define CMD_NODE_RESTORE 7
  245 
  246 #define CMD_OS_READ 0
  247 #define CMD_OS_RESET 1
  248 #define CMD_OS_READ_CFG 2
  249 #define CMD_OS_RFPGM 3
  250 #define CMD_OS_SLEEP 4
  251 #define CMD_OS_BATCH 5
  252 #define CMD_OS_SET_SECURITY 6
  253 #define CMD_OS_RESTART 8
  254 #define CMD_OS_WRITE_CFG_BYTE 9
  255 #define CMD_OS_LOAD_CODE 10
  256 #define CMD_OS_SELECTIVE_BATCH 11
  257 #define CMD_OS_WRITE_CFG 15
  258 
  259 #define CMD_RAM_READ 0
  260 #define CMD_RAM_WRITE 1
  261 
  262 #define CMD_EEPROM_READ CMD_RAM_READ
  263 #define CMD_EEPROM_WRITE CMD_RAM_WRITE
  264 
  265 #define CMD_EEEPROM_XREAD ( CMD_RAM_READ + 2 )
  266 #define CMD_EEEPROM_XWRITE ( CMD_RAM_WRITE + 2 )
  267 
  268 #define CMD_LED_SET_OFF 0
  269 #define CMD_LED_SET_ON 1
  270 #define CMD_LED_GET 2
  271 #define CMD_LED_PULSE 3
  272 
  273 #define CMD_SPI_WRITE_READ 0
  274 
  275 #define CMD_IO_DIRECTION  0
  276 #define CMD_IO_SET  1
  277 #define CMD_IO_GET  2
  278 
  279 #define CMD_THERMOMETER_READ 0
  280 
  281 #define CMD_PWM_SET 0
  282 
  283 #define CMD_UART_OPEN 0
  284 #define CMD_UART_CLOSE 1
  285 #define CMD_UART_WRITE_READ 2
  286 #define CMD_UART_CLEAR_WRITE_READ 3
  287 
  288 #define CMD_FRC_SEND 0
  289 #define CMD_FRC_EXTRARESULT 1
  290 #define CMD_FRC_SEND_SELECTIVE 2
  291 #define CMD_FRC_SET_PARAMS 3
  292 
  293 #define CMD_GET_PER_INFO  0x3f
  294 
  295 // DPA peripheral type
  296 typedef enum
  297 {
  298   PERIPHERAL_TYPE_DUMMY = 0x00,
  299   PERIPHERAL_TYPE_COORDINATOR = 0x01,
  300   PERIPHERAL_TYPE_NODE = 0x02,
  301   PERIPHERAL_TYPE_OS = 0x03,
  302   PERIPHERAL_TYPE_EEPROM = 0x04,
  303   PERIPHERAL_TYPE_BLOCK_EEPROM = 0x05,
  304   PERIPHERAL_TYPE_RAM = 0x06,
  305   PERIPHERAL_TYPE_LED = 0x07,
  306   PERIPHERAL_TYPE_SPI = 0x08,
  307   PERIPHERAL_TYPE_IO = 0x09,
  308   PERIPHERAL_TYPE_UART = 0x0a,
  309   PERIPHERAL_TYPE_THERMOMETER = 0x0b,
  310   PERIPHERAL_TYPE_ADC = 0x0c,
  311   PERIPHERAL_TYPE_PWM = 0x0d,
  312   PERIPHERAL_TYPE_FRC = 0x0e,
  313   // Starts peripheral type number interval for user peripherals
  314   PERIPHERAL_TYPE_USER_AREA = 0x80
  315 } TDpaPeripheralType;
  316 
  317 // Peripheral extended information
  318 typedef enum
  319 {
  320   PERIPHERAL_TYPE_EXTENDED_DEFAULT = 0b00,
  321   PERIPHERAL_TYPE_EXTENDED_READ = 0b01,
  322   PERIPHERAL_TYPE_EXTENDED_WRITE = 0b10,
  323   PERIPHERAL_TYPE_EXTENDED_READ_WRITE = PERIPHERAL_TYPE_EXTENDED_READ | PERIPHERAL_TYPE_EXTENDED_WRITE
  324 } TDpaPeripheralTypeExtended;
  325 
  326 // Response packet error codes
  327 typedef enum
  328 {
  329   // No error
  330   STATUS_NO_ERROR = 0,
  331 
  332   // General fail
  333   ERROR_FAIL = 1,
  334   // Incorrect PCMD
  335   ERROR_PCMD = 2,
  336   // Incorrect PNUM or PCMD
  337   ERROR_PNUM = 3,
  338   // Incorrect Address value when addressing memory type peripherals
  339   ERROR_ADDR = 4,
  340   // Incorrect Data length
  341   ERROR_DATA_LEN = 5,
  342   // Incorrect Data
  343   ERROR_DATA = 6,
  344   // Incorrect HWPID used
  345   ERROR_HWPID = 7,
  346   // Incorrect NADR
  347   ERROR_NADR = 8,
  348   // IFACE data consumed by Custom DPA Handler
  349   ERROR_IFACE_CUSTOM_HANDLER = 9,
  350   // Custom DPA Handler is missing
  351   ERROR_MISSING_CUSTOM_DPA_HANDLER = 10,
  352 
  353   // Beginning of the user code error interval
  354   ERROR_USER_FROM = 0x20,
  355   // End of the user code error interval
  356   ERROR_USER_TO = 0x3f,
  357 
  358   // Bit/flag reserved for a future use
  359   STATUS_RESERVED_FLAG = 0x40,
  360   // Bit to flag asynchronous response from [N]
  361   STATUS_ASYNC_RESPONSE = 0x80,
  362   // Error code used to mark confirmation
  363   STATUS_CONFIRMATION = 0xff
  364 } TErrorCodes;
  365 
  366 // Embedded FRC commands
  367 typedef enum
  368 {
  369   FRC_Prebonding = 0x00,
  370   FRC_UART_SPI_data = 0x01,
  371   FRC_AcknowledgedBroadcastBits = 0x02,
  372 
  373   FRC_Temperature = 0x80,
  374   FRC_AcknowledgedBroadcastBytes = 0x81,
  375   FRC_MemoryRead = 0x82,
  376   FRC_MemoryReadPlus1 = 0x83,
  377   FRC_FrcResponseTime = 0x84,
  378 } TFRCommands;
  379 
  380 // Intervals of user FRC codes
  381 #define FRC_USER_BIT_FROM     0x40
  382 #define FRC_USER_BIT_TO       0x7F
  383 #define FRC_USER_BYTE_FROM    0xC0
  384 #define FRC_USER_BYTE_TO      0xDF
  385 #define FRC_USER_2BYTE_FROM   0xF0
  386 #define FRC_USER_2BYTE_TO     0xFF
  387 
  388 typedef enum
  389 {
  390   // No HWPID specified
  391   HWPID_Default = 0,
  392   // Use this type to override HWPID check
  393   HWPID_DoNotCheck = 0xFfFf
  394 } THWPIDs;
  395 
  396 // RAM peripheral block definitions
  397 #define PERIPHERAL_RAM_LENGTH       48
  398 
  399 // Start address of EEPROM peripheral in the real EEPROM
  400 #ifndef COORDINATOR_CUSTOM_HANDLER // Node
  401 #define PERIPHERAL_EEPROM_START     ( (uns8)0x00 )
  402 #else // Coordinator
  403 #define PERIPHERAL_EEPROM_START     ( (uns8)0x80 )
  404 #endif
  405 
  406 // Length of the real serial EEEPROM from the EEEPROM DPA peripheral write point of view
  407 #define EEEPROM_REAL_LENGTH                 0x4000
  408 
  409 // Starting address of the Autoexec DPA storage at external EEPROM
  410 #define AUTOEXEC_EEEPROM_ADDR               0x0000
  411 // Length of the autoexec memory block
  412 #define AUTOEXEC_LENGTH                     sizeofBufferAUX
  413 
  414 // Starting address of the IO Setup DPA storage at external EEPROM
  415 #define IOSETUP_EEEPROM_ADDR                ( AUTOEXEC_EEEPROM_ADDR + AUTOEXEC_LENGTH )
  416 // Length of the IO setup memory block
  417 #define IOSETUP_LENGTH                      sizeofBufferAUX
  418 
  419 // ---------------------------------------------------------
  420 
  421 // Enumerate peripherals structure
  422 typedef struct
  423 {
  424   uns16 DpaVersion;
  425   uns8  UserPerNr;
  426   uns8  EmbeddedPers[PNUM_USER / 8];
  427   uns16 HWPID;
  428   uns16 HWPIDver;
  429   uns8  Flags;
  430   uns8  UserPer[( PNUM_MAX - PNUM_USER + 1 + 7 ) / 8];
  431 } STRUCTATTR TEnumPeripheralsAnswer;
  432 
  433 #define FlagUserPer(UserPersArray,UserPerNumber)    UserPersArray[((UserPerNumber)-PNUM_USER) / 8] |= (uns8)0x01 << (((UserPerNumber)-PNUM_USER) % 8);
  434 
  435 // Get peripheral info structure (CMD_GET_PER_INFO)
  436 typedef struct
  437 {
  438   uns8  PerTE;
  439   uns8  PerT;
  440   uns8  Par1;
  441   uns8  Par2;
  442 } STRUCTATTR TPeripheralInfoAnswer;
  443 
  444 // Error DPA response (PNUM_ERROR_FLAG)
  445 typedef struct
  446 {
  447   uns8  ErrN;
  448   uns8  PNUMoriginal;
  449 } STRUCTATTR TErrorAnswer;
  450 
  451 // Structure returned by CMD_COORDINATOR_ADDR_INFO
  452 typedef struct
  453 {
  454   uns8  DevNr;
  455   uns8  DID;
  456 } STRUCTATTR TPerCoordinatorAddrInfo_Response;
  457 
  458 // Structure for CMD_COORDINATOR_BOND_NODE
  459 typedef struct
  460 {
  461   uns8  ReqAddr;
  462   uns8  BondingMask;
  463 } STRUCTATTR TPerCoordinatorBondNode_Request;
  464 
  465 // Structure returned by CMD_COORDINATOR_BOND_NODE
  466 typedef struct
  467 {
  468   uns8  BondAddr;
  469   uns8  DevNr;
  470 } STRUCTATTR TPerCoordinatorBondNode_Response;
  471 
  472 // Structure for CMD_COORDINATOR_REMOVE_BOND or CMD_COORDINATOR_REBOND_NODE
  473 typedef struct
  474 {
  475   uns8  BondAddr;
  476 } STRUCTATTR TPerCoordinatorRemoveRebondBond_Request;
  477 
  478 // Structure returned by CMD_COORDINATOR_REMOVE_BOND or CMD_COORDINATOR_REBOND_NODE
  479 typedef struct
  480 {
  481   uns8  DevNr;
  482 } STRUCTATTR TPerCoordinatorRemoveRebondBond_Response;
  483 
  484 // Structure for CMD_COORDINATOR_DISCOVERY
  485 typedef struct
  486 {
  487   uns8  TxPower;
  488   uns8  MaxAddr;
  489 } STRUCTATTR TPerCoordinatorDiscovery_Request;
  490 
  491 // Structure returned by CMD_COORDINATOR_DISCOVERY
  492 typedef struct
  493 {
  494   uns8  DiscNr;
  495 } STRUCTATTR TPerCoordinatorDiscovery_Response;
  496 
  497 // Structure for and also returned by CMD_COORDINATOR_SET_DPAPARAMS
  498 typedef struct
  499 {
  500   uns8  DpaParam;
  501 } STRUCTATTR TPerCoordinatorSetDpaParams_Request_Response;
  502 
  503 // Structure for and also returned by CMD_COORDINATOR_SET_HOPS
  504 typedef struct
  505 {
  506   uns8  RequestHops;
  507   uns8  ResponseHops;
  508 } STRUCTATTR TPerCoordinatorSetHops_Request_Response;
  509 
  510 // Structure for CMD_COORDINATOR_DISCOVERY_DATA
  511 typedef struct
  512 {
  513   uns16 Address;
  514 } STRUCTATTR TPerCoordinatorDiscoveryData_Request;
  515 
  516 // Structure returned by CMD_COORDINATOR_DISCOVERY_DATA
  517 typedef struct
  518 {
  519   uns8  DiscoveryData[48];
  520 } STRUCTATTR TPerCoordinatorDiscoveryData_Response;
  521 
  522 // Structure for CMD_COORDINATOR_BACKUP and CMD_NODE_BACKUP
  523 typedef struct
  524 {
  525   uns8  Index;
  526 } STRUCTATTR TPerCoordinatorNodeBackup_Request;
  527 
  528 // Structure returned by CMD_COORDINATOR_BACKUP and CMD_NODE_BACKUP
  529 typedef struct
  530 {
  531   uns8  NetworkData[49];
  532 } STRUCTATTR TPerCoordinatorNodeBackup_Response;
  533 
  534 // Structure for CMD_COORDINATOR_RESTORE and CMD_NODE_RESTORE
  535 typedef struct
  536 {
  537   uns8  NetworkData[49];
  538 } STRUCTATTR TPerCoordinatorNodeRestore_Request;
  539 
  540 // Structure for CMD_COORDINATOR_AUTHORIZE_BOND
  541 typedef struct
  542 {
  543   uns8  ReqAddr;
  544   uns8  MID[4];
  545 } STRUCTATTR TPerCoordinatorAuthorizeBond_Request;
  546 
  547 // Structure returned by CMD_COORDINATOR_AUTHORIZE_BOND
  548 typedef struct
  549 {
  550   uns8  BondAddr;
  551   uns8  DevNr;
  552 } STRUCTATTR TPerCoordinatorAuthorizeBond_Response;
  553 
  554 // Structure for CMD_COORDINATOR_BRIDGE
  555 typedef struct
  556 {
  557   TDpaIFaceHeader subHeader;
  558   uns8  subPData[DPA_MAX_DATA_LENGTH - sizeof( TDpaIFaceHeader )];
  559 } STRUCTATTR TPerCoordinatorBridge_Request;
  560 
  561 // Structure returned by CMD_COORDINATOR_BRIDGE
  562 typedef struct
  563 {
  564   TDpaIFaceHeader subHeader;
  565   uns8  subRespCode;
  566   uns8  subDpaValue;
  567   uns8  subPData[DPA_MAX_DATA_LENGTH - sizeof( TDpaIFaceHeader ) - 2 * sizeof( uns8 )];
  568 } STRUCTATTR TPerCoordinatorBridge_Response;
  569 
  570 // Structure for CMD_COORDINATOR_ENABLE_REMOTE_BONDING and CMD_NODE_ENABLE_REMOTE_BONDING
  571 typedef struct
  572 {
  573   uns8  BondingMask;
  574   uns8  Control;
  575   uns8  UserData[4];
  576 } STRUCTATTR TPerCoordinatorNodeEnableRemoteBonding_Request;
  577 
  578 // Structure for TPerCoordinatorNodeReadRemotelyBondedMID_Response
  579 typedef struct
  580 {
  581   uns8  MID[4];
  582   uns8  UserData[4];
  583 } STRUCTATTR TPrebondedNode;
  584 
  585 // Structure returned by CMD_COORDINATOR_READ_REMOTELY_BONDED_MID and CMD_NODE_READ_REMOTELY_BONDED_MID
  586 typedef struct
  587 {
  588   TPrebondedNode  PrebondedNodes[DPA_MAX_DATA_LENGTH / sizeof( TPrebondedNode )];
  589 } STRUCTATTR TPerCoordinatorNodeReadRemotelyBondedMID_Response;
  590 
  591 // Structure returned by CMD_NODE_READ
  592 typedef struct
  593 {
  594   uns8  ntwADDR;
  595   uns8  ntwVRN;
  596   uns8  ntwZIN;
  597   uns8  ntwDID;
  598   uns8  ntwPVRN;
  599   uns16 ntwUSERADDRESS;
  600   uns16 ntwID;
  601   uns8  ntwVRNFNZ;
  602   uns8  ntwCFG;
  603   uns8  Flags;
  604 } STRUCTATTR TPerNodeRead_Response;
  605 
  606 // Structure returned by CMD_OS_READ
  607 typedef struct
  608 {
  609   uns8  ModuleId[4];
  610   uns8  OsVersion;
  611   uns8  McuType;
  612   uns16 OsBuild;
  613   uns8  Rssi;
  614   uns8  SupplyVoltage;
  615   uns8  Flags;
  616   uns8  SlotLimits;
  617 } STRUCTATTR TPerOSRead_Response;
  618 
  619 // Structure returned by CMD_OS_READ_CFG
  620 typedef struct
  621 {
  622   uns8  Checksum;
  623   uns8  Configuration[31];
  624   uns8  RFPGM;
  625   uns8  Undocumented[1];
  626 } STRUCTATTR TPerOSReadCfg_Response;
  627 
  628 // Structure for CMD_OS_WRITE_CFG
  629 typedef struct
  630 {
  631   uns8  Checksum;
  632   uns8  Configuration[31];
  633   uns8  RFPGM;
  634 } STRUCTATTR TPerOSWriteCfg_Request;
  635 
  636 // Structures for CMD_OS_WRITE_CFG_BYTE
  637 typedef struct
  638 {
  639   uns8  Address;
  640   uns8  Value;
  641   uns8  Mask;
  642 } STRUCTATTR TPerOSWriteCfgByteTriplet;
  643 
  644 // Structure for CMD_OS_WRITE_CFG_BYTE
  645 typedef struct
  646 {
  647   TPerOSWriteCfgByteTriplet Triplets[DPA_MAX_DATA_LENGTH / sizeof( TPerOSWriteCfgByteTriplet )];
  648 } STRUCTATTR TPerOSWriteCfgByte_Request;
  649 
  650 // Structure for CMD_OS_SET_SECURITY
  651 typedef struct
  652 {
  653   uns8  Type;
  654   uns8  Data[16];
  655 } STRUCTATTR TPerOSSetSecurity_Request;
  656 
  657 // Structure for CMD_OS_LOAD_CODE
  658 typedef struct
  659 {
  660   uns8  Flags;
  661   uns16 Address;
  662   uns16 Length;
  663   uns16 CheckSum;
  664 } STRUCTATTR TPerOSLoadCode_Request;
  665 
  666 // Structure for CMD_OS_SLEEP
  667 typedef struct
  668 {
  669   uns16 Time;
  670   uns8  Control;
  671 } STRUCTATTR TPerOSSleep_Request;
  672 
  673 // Structure for CMD_OS_SELECTIVE_BATCH
  674 typedef struct
  675 {
  676   uns8  SelectedNodes[30];
  677   uns8  Requests[DPA_MAX_DATA_LENGTH - 30];
  678 } STRUCTATTR TPerOSSelectiveBatch_Request;
  679 
  680 // Structure for general memory request
  681 typedef struct
  682 {
  683   // Address of data to write or read
  684   uns8  Address;
  685 
  686   union
  687   {
  688     // Memory read request
  689     struct
  690     {
  691       // Length of data to read
  692       uns8  Length;
  693     } Read;
  694 
  695     // Size of Address field
  696 #define MEMORY_WRITE_REQUEST_OVERHEAD   ( sizeof( uns8 ) )
  697 
  698     // Memory write request
  699     struct
  700     {
  701       uns8  PData[DPA_MAX_DATA_LENGTH - MEMORY_WRITE_REQUEST_OVERHEAD];
  702     } Write;
  703 
  704   } ReadWrite;
  705 } STRUCTATTR TPerMemoryRequest;
  706 
  707 // Structure for general extended memory request
  708 typedef struct
  709 {
  710   // Address of data to write or read
  711   uns16 Address;
  712 
  713   union
  714   {
  715     // Memory read request
  716     struct
  717     {
  718       // Length of data to read
  719       uns8  Length;
  720     } Read;
  721 
  722     // Size of Address field
  723 #define XMEMORY_WRITE_REQUEST_OVERHEAD  ( sizeof( uns16 ) )
  724 
  725     // Memory write request
  726     struct
  727     {
  728       uns8  PData[DPA_MAX_DATA_LENGTH - XMEMORY_WRITE_REQUEST_OVERHEAD];
  729     } Write;
  730 
  731   } ReadWrite;
  732 } STRUCTATTR TPerXMemoryRequest;
  733 
  734 // Structure for CMD_IO requests
  735 typedef struct
  736 {
  737   uns8  Port;
  738   uns8  Mask;
  739   uns8  Value;
  740 } STRUCTATTR TPerIOTriplet;
  741 
  742 typedef struct
  743 {
  744   uns8  Header; // == PNUM_IO_DELAY
  745   uns16 Delay;
  746 } STRUCTATTR TPerIODelay;
  747 
  748 // Union for CMD_IO_SET and CMD_IO_DIRECTION requests
  749 typedef union
  750 {
  751   TPerIOTriplet Triplets[DPA_MAX_DATA_LENGTH / sizeof( TPerIOTriplet )];
  752   TPerIODelay   Delays[DPA_MAX_DATA_LENGTH / sizeof( TPerIODelay )];
  753 } STRUCTATTR TPerIoDirectionAndSet_Request;
  754 
  755 // Structure returned by CMD_THERMOMETER_READ
  756 typedef struct
  757 {
  758   int8  IntegerValue;
  759   int16 SixteenthValue;
  760 } STRUCTATTR TPerThermometerRead_Response;
  761 
  762 // Structure for CMD_PWM_SET
  763 typedef struct
  764 {
  765   uns8  Prescaler;
  766   uns8  Period;
  767   uns8  Duty;
  768 } STRUCTATTR TPerPwmSet_Request;
  769 
  770 // Structure for CMD_UART_OPEN
  771 typedef struct
  772 {
  773   uns8  BaudRate;
  774 } STRUCTATTR TPerUartOpen_Request;
  775 
  776 // Structure for CMD_UART_[CLEAR_]WRITE_READ and CMD_SPI_WRITE_READ
  777 typedef struct
  778 {
  779   uns8  ReadTimeout;
  780   uns8  WrittenData[DPA_MAX_DATA_LENGTH - sizeof( uns8 )];
  781 } STRUCTATTR TPerUartSpiWriteRead_Request;
  782 
  783 // Structure for CMD_FRC_SEND
  784 typedef struct
  785 {
  786   uns8  FrcCommand;
  787   uns8  UserData[30];
  788 } STRUCTATTR TPerFrcSend_Request;
  789 
  790 // Structure for CMD_FRC_SEND_SELECTIVE
  791 typedef struct
  792 {
  793   uns8  FrcCommand;
  794   uns8  SelectedNodes[30];
  795   uns8  UserData[25];
  796 } STRUCTATTR TPerFrcSendSelective_Request;
  797 
  798 // Structure returned by CMD_FRC_SEND and CMD_FRC_SEND_SELECTIVE
  799 typedef struct
  800 {
  801   uns8  Status;
  802   uns8  FrcData[DPA_MAX_DATA_LENGTH - sizeof( uns8 )];
  803 } STRUCTATTR TPerFrcSend_Response;
  804 
  805 // Structure for request and response of CMD_FRC_SET_PARAMS
  806 typedef struct
  807 {
  808   uns8  FRCresponseTime;
  809 } STRUCTATTR TPerFrcSetParams_RequestResponse;
  810 
  811 // Interface and CMD_COORDINATOR_BRIDGE confirmation structure
  812 typedef struct
  813 {
  814   // Number of hops
  815   uns8  Hops;
  816   // Time slot length in 10ms
  817   uns8  TimeSlotLength;
  818   // Number of hops for response
  819   uns8  HopsResponse;
  820 } STRUCTATTR TIFaceConfirmation;
  821 
  822 // ---------------------------------------------------------
  823 
  824 // DPA Message data structure (packet w/o NADR, PNUM, PCMD, HWPID)
  825 typedef union
  826 {
  827   // General DPA request
  828   struct
  829   {
  830     uns8    PData[DPA_MAX_DATA_LENGTH];
  831   } Request;
  832 
  833   // General DPA response
  834   struct
  835   {
  836     uns8    PData[DPA_MAX_DATA_LENGTH];
  837   } Response;
  838 
  839   // Enumerate peripherals structure
  840   TEnumPeripheralsAnswer EnumPeripheralsAnswer;
  841 
  842   // Get peripheral info structure (CMD_GET_PER_INFO)
  843   TPeripheralInfoAnswer PeripheralInfoAnswer;
  844 
  845   // Get peripheral info structure (CMD_GET_PER_INFO) for more peripherals
  846   TPeripheralInfoAnswer PeripheralInfoAnswers[MAX_PERIPHERALS_PER_BLOCK_INFO];
  847 
  848   // Error DPA response (PNUM_ERROR_FLAG)
  849   TErrorAnswer ErrorAnswer;
  850 
  851   // Structure returned by CMD_COORDINATOR_ADDR_INFO
  852   TPerCoordinatorAddrInfo_Response PerCoordinatorAddrInfo_Response;
  853 
  854   // Structure for CMD_COORDINATOR_BOND_NODE
  855   TPerCoordinatorBondNode_Request PerCoordinatorBondNode_Request;
  856 
  857   // Structure returned by CMD_COORDINATOR_BOND_NODE
  858   TPerCoordinatorBondNode_Response PerCoordinatorBondNode_Response;
  859 
  860   // Structure for CMD_COORDINATOR_REMOVE_BOND or CMD_COORDINATOR_REBOND_NODE
  861   TPerCoordinatorRemoveRebondBond_Request PerCoordinatorRemoveRebondBond_Request;
  862 
  863   // Structure returned by CMD_COORDINATOR_REMOVE_BOND or CMD_COORDINATOR_REBOND_NODE
  864   TPerCoordinatorRemoveRebondBond_Response PerCoordinatorRemoveRebondBond_Response;
  865 
  866   // Structure for CMD_COORDINATOR_DISCOVERY
  867   TPerCoordinatorDiscovery_Request PerCoordinatorDiscovery_Request;
  868 
  869   // Structure returned by CMD_COORDINATOR_DISCOVERY
  870   TPerCoordinatorDiscovery_Response PerCoordinatorDiscovery_Response;
  871 
  872   // Structure for and also returned by CMD_COORDINATOR_SET_DPAPARAMS
  873   TPerCoordinatorSetDpaParams_Request_Response PerCoordinatorSetDpaParams_Request_Response;
  874 
  875   // Structure for and also returned by CMD_COORDINATOR_SET_HOPS
  876   TPerCoordinatorSetHops_Request_Response PerCoordinatorSetHops_Request_Response;
  877 
  878   // Structure for CMD_COORDINATOR_DISCOVERY_DATA
  879   TPerCoordinatorDiscoveryData_Request PerCoordinatorDiscoveryData_Request;
  880 
  881   // Structure returned by CMD_COORDINATOR_DISCOVERY_DATA
  882   TPerCoordinatorDiscoveryData_Response PerCoordinatorDiscoveryData_Response;
  883 
  884   // Structure for CMD_COORDINATOR_BACKUP and CMD_NODE_BACKUP
  885   TPerCoordinatorNodeBackup_Request PerCoordinatorNodeBackup_Request;
  886 
  887   // Structure returned by CMD_COORDINATOR_BACKUP and CMD_NODE_BACKUP
  888   TPerCoordinatorNodeBackup_Response PerCoordinatorNodeBackup_Response;
  889 
  890   // Structure for CMD_COORDINATOR_RESTORE and CMD_NODE_RESTORE
  891   TPerCoordinatorNodeRestore_Request PerCoordinatorNodeRestore_Request;
  892 
  893   // Structure for CMD_COORDINATOR_AUTHORIZE_BOND
  894   TPerCoordinatorAuthorizeBond_Request PerCoordinatorAuthorizeBond_Request;
  895 
  896   // Structure returned by CMD_COORDINATOR_AUTHORIZE_BOND
  897   TPerCoordinatorAuthorizeBond_Response PerCoordinatorAuthorizeBond_Response;
  898 
  899   // Structure for CMD_COORDINATOR_BRIDGE
  900   TPerCoordinatorBridge_Request PerCoordinatorBridge_Request;
  901 
  902   // Structure returned by CMD_COORDINATOR_BRIDGE
  903   TPerCoordinatorBridge_Response PerCoordinatorBridge_Response;
  904 
  905   // Structure for CMD_COORDINATOR_ENABLE_REMOTE_BONDING and CMD_NODE_ENABLE_REMOTE_BONDING
  906   TPerCoordinatorNodeEnableRemoteBonding_Request PerCoordinatorNodeEnableRemoteBonding_Request;
  907 
  908   // Structure returned by CMD_COORDINATOR_READ_REMOTELY_BONDED_MID and CMD_NODE_READ_REMOTELY_BONDED_MID
  909   TPerCoordinatorNodeReadRemotelyBondedMID_Response PerCoordinatorNodeReadRemotelyBondedMID_Response;
  910 
  911   // Structure returned by CMD_NODE_READ
  912   TPerNodeRead_Response PerNodeRead_Response;
  913 
  914   // Structure returned by CMD_OS_READ
  915   TPerOSRead_Response PerOSRead_Response;
  916 
  917   // Structure returned by CMD_OS_READ_CFG
  918   TPerOSReadCfg_Response PerOSReadCfg_Response;
  919 
  920   // Structure for CMD_OS_WRITE_CFG
  921   TPerOSWriteCfg_Request PerOSWriteCfg_Request;
  922 
  923   // Structure for CMD_OS_WRITE_CFG_BYTE
  924   TPerOSWriteCfgByte_Request PerOSWriteCfgByte_Request;
  925 
  926   // Structure for CMD_OS_SET_SECURITY
  927   TPerOSSetSecurity_Request PerOSSetSecurity_Request;
  928 
  929   // Structure for CMD_OS_LOAD_CODE
  930   TPerOSLoadCode_Request PerOSLoadCode_Request;
  931 
  932   // Structure for CMD_OS_SLEEP
  933   TPerOSSleep_Request PerOSSleep_Request;
  934 
  935   // Structure for CMD_OS_SELECTIVE_BATCH
  936   TPerOSSelectiveBatch_Request PerOSSelectiveBatch_Request;
  937 
  938   // Structure for general memory request
  939   TPerMemoryRequest MemoryRequest;
  940 
  941   // Structure for general extended memory request
  942   TPerXMemoryRequest XMemoryRequest;
  943 
  944   // Structure for CMD_IO requests
  945   TPerIoDirectionAndSet_Request PerIoDirectionAndSet_Request;
  946 
  947   // Structure returned by CMD_THERMOMETER_READ
  948   TPerThermometerRead_Response PerThermometerRead_Response;
  949 
  950   // Structure for CMD_PWM_SET
  951   TPerPwmSet_Request PerPwmSet_Request;
  952 
  953   // Structure for CMD_UART_OPEN
  954   TPerUartOpen_Request PerUartOpen_Request;
  955 
  956   // Structure for CMD_UART_[CLEAR_]WRITE_READ and CMD_SPI_WRITE_READ
  957   TPerUartSpiWriteRead_Request PerUartSpiWriteRead_Request;
  958 
  959   // Structure for CMD_FRC_SEND
  960   TPerFrcSend_Request PerFrcSend_Request;
  961 
  962   // Structure returned by CMD_FRC_SEND and CMD_FRC_SEND_SELECTIVE
  963   TPerFrcSend_Response PerFrcSend_Response;
  964 
  965   // Structure for CMD_FRC_SEND_SELECTIVE
  966   TPerFrcSendSelective_Request PerFrcSendSelective_Request;
  967 
  968   // Structure for request and response of CMD_FRC_SET_PARAMS
  969   TPerFrcSetParams_RequestResponse PerFrcSetParams_RequestResponse;
  970 
  971   // Interface and CMD_COORDINATOR_BRIDGE confirmation structure
  972   TIFaceConfirmation IFaceConfirmation;
  973 } TDpaMessage;
  974 
  975 // Custom DPA Handler events
  976 #define DpaEvent_DpaRequest               0
  977 #define DpaEvent_Interrupt                1
  978 #define DpaEvent_Idle                     2
  979 #define DpaEvent_Init                     3
  980 #define DpaEvent_Notification             4
  981 #define DpaEvent_AfterRouting             5
  982 #define DpaEvent_BeforeSleep              6
  983 #define DpaEvent_AfterSleep               7
  984 #define DpaEvent_Reset                    8
  985 #define DpaEvent_DisableInterrupts        9
  986 #define DpaEvent_FrcValue                 10
  987 #define DpaEvent_ReceiveDpaResponse       11
  988 #define DpaEvent_IFaceReceive             12
  989 #define DpaEvent_ReceiveDpaRequest        13
  990 #define DpaEvent_BeforeSendingDpaResponse 14
  991 #define DpaEvent_PeerToPeer               15
  992 #define DpaEvent_AuthorizePreBonding      16
  993 #define DpaEvent_UserDpaValue             17
  994 #define DpaEvent_FrcResponseTime          18
  995 #define DpaEvent_BondingButton            19
  996 
  997 #define DpaEvent_LAST                     DpaEvent_BondingButton
  998 
  999 // Types of the diagnostic DPA Value that is returned inside DPA response 
 1000 typedef enum
 1001 {
 1002   DpaValueType_RSSI = 0,
 1003   DpaValueType_SupplyVoltage = 1,
 1004   DpaValueType_System = 2,
 1005   DpaValueType_User = 3
 1006 } TDpaValueType;
 1007 
 1008 // Type (color) of LED peripheral
 1009 typedef enum
 1010 {
 1011   LED_COLOR_RED = 0,
 1012   LED_COLOR_GREEN = 1,
 1013   LED_COLOR_BLUE = 2,
 1014   LED_COLOR_YELLOW = 3,
 1015   LED_COLOR_WHITE = 4,
 1016   LED_COLOR_UNKNOWN = 0xff
 1017 } TLedColor;
 1018 
 1019 // Baud rates
 1020 typedef enum
 1021 {
 1022   DpaBaud_1200 = 0x00,
 1023   DpaBaud_2400 = 0x01,
 1024   DpaBaud_4800 = 0x02,
 1025   DpaBaud_9600 = 0x03,
 1026   DpaBaud_19200 = 0x04,
 1027   DpaBaud_38400 = 0x05,
 1028   DpaBaud_57600 = 0x06,
 1029   DpaBaud_115200 = 0x07,
 1030   DpaBaud_230400 = 0x08
 1031 } TBaudRates;
 1032 
 1033 // Useful PNUM_IO definitions
 1034 typedef enum
 1035 {
 1036   PNUM_IO_PORTA = 0x00,
 1037   PNUM_IO_TRISA = 0x00,
 1038   PNUM_IO_PORTB = 0x01,
 1039   PNUM_IO_TRISB = 0x01,
 1040   PNUM_IO_PORTC = 0x02,
 1041   PNUM_IO_TRISC = 0x02,
 1042   PNUM_IO_PORTE = 0x04,
 1043   PNUM_IO_TRISE = 0x04,
 1044   PNUM_IO_WPUB = 0x11,
 1045   PNUM_IO_WPUE = 0x14,
 1046   PNUM_IO_DELAY = 0xff
 1047 } PNUM_IO_Definitions;
 1048 
 1049 #ifdef __CC5X__
 1050 
 1051 // DPA message at bufferRF
 1052 TDpaMessage DpaRfMessage @bufferRF;
 1053 
 1054 // Actual allocation of the RAM Peripheral memory block @ UserBank_02
 1055 bank12 uns8  PeripheralRam[PERIPHERAL_RAM_LENGTH];
 1056 
 1057 // Actual DPA message parameters at memory
 1058 #define _NADR           RX
 1059 #define _NADRhigh       RTAUX
 1060 #define _PNUM           PNUM
 1061 #define _PCMD           PCMD
 1062 #define _DpaDataLength  DLEN
 1063 #define _DpaMessage     DpaRfMessage
 1064 
 1065 // Return actual DPA user routine event
 1066 #define GetDpaEvent()   userReg0
 1067 
 1068 // To test for enumeration peripherals request
 1069 #define IsDpaEnumPeripheralsRequestNoSize() ( _PNUM == PNUM_ENUMERATION && _PCMD == CMD_GET_PER_INFO )
 1070 
 1071 #if PARAM_CHECK_LEVEL >= 2
 1072 #define IsDpaEnumPeripheralsRequest() ( IsDpaEnumPeripheralsRequestNoSize() && _DpaDataLength == 0 )
 1073 #else
 1074 #define IsDpaEnumPeripheralsRequest() IsDpaEnumPeripheralsRequestNoSize()
 1075 #endif
 1076 
 1077 // To test for peripherals information request
 1078 #define IsDpaPeripheralInfoRequestNoSize()  ( _PNUM != PNUM_ENUMERATION && _PCMD == CMD_GET_PER_INFO )
 1079 
 1080 #if PARAM_CHECK_LEVEL >= 2
 1081 #define IsDpaPeripheralInfoRequest()  ( IsDpaPeripheralInfoRequestNoSize() && _DpaDataLength == 0 )
 1082 #else
 1083 #define IsDpaPeripheralInfoRequest()  IsDpaPeripheralInfoRequestNoSize()
 1084 #endif
 1085 
 1086 // Optimized macro for both testing enumeration peripherals ELSE peripherals information. See examples
 1087 #define IfDpaEnumPeripherals_Else_PeripheralInfo_Else_PeripheralRequestNoSize() if ( _PCMD == CMD_GET_PER_INFO ) if ( _PNUM == PNUM_ENUMERATION )
 1088 
 1089 #if PARAM_CHECK_LEVEL >= 2
 1090 #define IfDpaEnumPeripherals_Else_PeripheralInfo_Else_PeripheralRequest() if ( _DpaDataLength == 0 && _PCMD == CMD_GET_PER_INFO ) if ( _PNUM == PNUM_ENUMERATION )
 1091 #else
 1092 #define IfDpaEnumPeripherals_Else_PeripheralInfo_Else_PeripheralRequest() IfDpaEnumPeripherals_Else_PeripheralInfo_Else_PeripheralRequestNoSize()
 1093 #endif
 1094 
 1095 // Stores DPA Params inside DPA request/response
 1096 #define _DpaParams                    PPAR
 1097 // Get DPA Value type out of the DPA Params
 1098 #define DpaValueType()                ( _DpaParams & 0b11 )
 1099 
 1100 // Traffic indication active: from the store in case of DPA request
 1101 bit IsDpaTrafficIndication            @_DpaParams.2;
 1102 // Long diagnostic time slot request: from the store in case of DPA request
 1103 bit IsDpaLongTimeslot                 @_DpaParams.3;
 1104 
 1105 // Include assembler definitions
 1106 #include "HexCodes.h"
 1107 
 1108 // Next code must start at the IQRF APPLICATION routine entry point
 1109 #pragma origin __APPLICATION_ADDRESS
 1110 
 1111 #endif  // __CC5X__
 1112 #endif  // _DPA_HEADER_
 1113 //############################################################################################