Subversion Repositories HomeAutomation

Rev

Rev 363 | Blame | Compare with Previous | Last modification | View Log | SVN | RSS feed

  1. /*********************************************************************
  2.  *
  3.  *   Defines functs and funccs and other global definitions.
  4.  *
  5.  *********************************************************************
  6.  * FileName:            $HeadURL: https://svn.auml.se/svn/HomeAutomation/branches/modules/EmbeddedSoftware/PIC/Include/funcdefs.h $
  7.  * Last changed:    $LastChangedDate: 2007-03-13 18:29:20 +0100 (Tue, 13 Mar 2007) $
  8.  * By:          $LastChangedBy: johboh $
  9.  * Revision:        $Revision: 363 $
  10.  ********************************************************************/
  11.  
  12. #include <typedefs.h>
  13. #include <pgmtypes.h>
  14.  
  15. #define DEFAULT_ID 0x78     // Default ID for bootloader/node when no id is set.
  16. #define NODE_ID_EE  0x00    // EEPROM first index where to look for ID and NID.
  17.                 // NODE_ID_EE = NODE_HAS_ID if has correct ID, otherwise use DEFAULT_ID and DEFAULT_NID
  18.                 // NODE_ID_EE + 1 = ID
  19. #define NODE_HAS_ID 0x2A    // Value which indicate valid ID and NID.
  20.  
  21.  
  22. typedef struct _CAN_BOOT_PACKET
  23. {
  24.     BOOT_TYPE type; //3
  25.     BYTE    offset; //8
  26.     BYTE       rid; //8
  27. } CAN_BOOT_PACKET;
  28.  
  29.  
  30. typedef struct _CAN_PGM_PACKET
  31. {
  32.     PGM_CLASS class; //4
  33.     WORD         id; //15
  34. } CAN_PGM_PACKET;
  35.  
  36. typedef struct _CAN_PACKET
  37. {
  38.     PACKET_TYPE     type;
  39.     CAN_PGM_PACKET   pgm;
  40.     CAN_BOOT_PACKET boot;
  41.     BYTE             sid; //8
  42.     BYTE          length;
  43.     BYTE         data[8];
  44. } CAN_PACKET;
  45.  
  46.  
  47.  
  48. // When CAN_BOOT_PACKET.type==btADDR
  49. // data[2] = ADDRU
  50. // data[1] = ADDRH
  51. // data[0] = ADDRL
  52.  
  53. // When CAN_BOOT_PACKET.type==btCRC
  54. // data[4] = CRCH
  55. // data[3] = CRCL
  56. // data[2] = ADDRU
  57. // data[1] = ADDRH
  58. // data[0] = ADDRL
  59.  
  60. // When CAN_BOOT_PACKET.type==btCHANGEID
  61. // data[0] = new id
  62.  
  63.