Subversion Repositories HomeAutomation

Rev

Rev 102 | Blame | 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/trunk/EmbeddedSoftware/PIC/Include/funcdefs.h $
  7.  * Last changed:    $LastChangedDate: 2006-11-15 17:32:04 +0100 (Wed, 15 Nov 2006) $
  8.  * By:          $LastChangedBy: johboh $
  9.  * Revision:        $Revision: 107 $
  10.  ********************************************************************/
  11.  
  12.  
  13.  
  14. //<FUNCT>
  15. #define FUNCT_BOOTLOADER 0x0
  16.  
  17. //<FUNCC> configuration packet
  18. #define FUNCC_BOOT_INIT   0b0000000001 //Start programmring and/or resseting user program to go into bootloader mode.
  19. #define FUNCC_BOOT_ADDR   0b0000000010  //Change programming address.
  20. #define FUNCC_BOOT_SET_ID 0b0000000110  //Change ID and NID.
  21. #define FUNCC_BOOT_DONE   0b0000000101  //End programming, start user program.
  22.  
  23. #define FUNCC_BOOT_HEARTBEAT 0b0000001000 // Heartbeat
  24.  
  25. //<FUNCC> program packet
  26. #define FUNCC_BOOT_PGM 0b0000000011 //To indicate programming data packet.
  27.  
  28. //<FUNCC> ack packet
  29. #define FUNCC_BOOT_ACK 0b0000000100 //Ack packet
  30.  
  31.  
  32. #define DEFAULT_ID 0x78     // Default ID for bootloader/node when no id is set.
  33. #define DEFAULT_NID 0x00    // Default ID for bootloader/node when no nid is set.
  34.  
  35.  
  36. #define NODE_ID_EE  0x00    // EEPROM first index where to look for ID and NID.
  37.                 // NODE_ID_EE = NODE_HAS_ID if has correct ID, otherwise use DEFAULT_ID and DEFAULT_NID
  38.                 // NODE_ID_EE + 1 = ID[1]
  39.                 // NODE_ID_EE + 2 = ID[0]
  40.                 // NODE_ID_EE + 3 = NID
  41.  
  42. #define NODE_HAS_ID 0x2A    // Value which indicate valid ID and NID.
  43.  
  44.  
  45. // Definitions for BOOT packets. Which index in data where things are.
  46. #define BOOT_DATA_ADDRL_INDEX 0
  47. #define BOOT_DATA_ADDRH_INDEX 1
  48. #define BOOT_DATA_ADDRU_INDEX 2
  49. #define BOOT_DATA_RID_LOW_INDEX 4
  50. #define BOOT_DATA_RID_HIGH_INDEX 5
  51. #define BOOT_DATA_ERR_INDEX 4
  52. #define BOOT_DATA_NEW_ID_LOW 0
  53. #define BOOT_DATA_NEW_ID_HIGH 1
  54. #define BOOT_DATA_NEW_NID 2
  55.  
  56. //<ERR>
  57. // Value in BOOT_DATA_ERR_INDEX
  58. #define ACK_ERR_NO_ERROR 0x00 //= no error
  59. #define ACK_ERR_ERROR 0x01 //= error