aboutsummaryrefslogtreecommitdiff
path: root/AT91SAM7S256/Source/c_loader.iom
blob: dde8b6a50909e58c60bd3f19292063245108a434 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
//
// Date init       14.12.2004
//
// Revision date   $Date:: 24-06-09 8:53                                     $
//
// Filename        $Workfile:: c_loader.iom                                  $
//
// Version         $Revision:: 15                                            $
//
// Archive         $Archive:: /LMS2006/Sys01/Main_V02/Firmware/Source/c_load $
//
// Platform        C
//

#ifndef   CLOADER_IOM
#define   CLOADER_IOM

#define   pMapLoader ((IOMAPLOADER*)(pHeaders[ENTRY_LOADER]->pIOMap))

//Version numbers are two bytes, MAJOR.MINOR (big-endian)
//For example, version 1.5 would be 0x0105
//If these switch to little-endian, be sure to update
//definition and usages of VM_OLDEST_COMPATIBLE_VERSION, too!
#define   FIRMWAREVERSION               0x011D //1.28
#define   PROTOCOLVERSION               0x017C //1.124

enum
{
  OPENREAD        = 0x80,
  OPENWRITE       = 0x81,
  READ            = 0x82,
  WRITE           = 0x83,
  CLOSE           = 0x84,
  DELETE          = 0x85,
  FINDFIRST       = 0x86,
  FINDNEXT        = 0x87,
  VERSIONS        = 0x88,
  OPENWRITELINEAR = 0x89,
  OPENREADLINEAR  = 0x8A,
  OPENWRITEDATA   = 0x8B,
  OPENAPPENDDATA  = 0x8C,
  CROPDATAFILE    = 0x8D,    /* New cmd for datalogging */
  FINDFIRSTMODULE = 0x90,
  FINDNEXTMODULE  = 0x91,
  CLOSEMODHANDLE  = 0x92,
  IOMAPREAD       = 0x94,
  IOMAPWRITE      = 0x95,
  BOOTCMD         = 0x97,     /* external command only */
  SETBRICKNAME    = 0x98,
  BTGETADR        = 0x9A,
  DEVICEINFO      = 0x9B,
  DELETEUSERFLASH = 0xA0,
  POLLCMDLEN      = 0xA1,
  POLLCMD         = 0xA2,
  RENAMEFILE      = 0xA3,
  BTFACTORYRESET  = 0xA4

};

typedef UWORD LOADER_STATUS;

//Mask out handle byte of Loader status word for error code checks
#define LOADER_ERR(StatusWord) ((StatusWord & 0xFF00))

//Byte value of error half of Loader status word
#define LOADER_ERR_BYTE(StatusWord) ((UBYTE)((StatusWord & 0xFF00) >> 8))

//Value of handle inside Loader status word
#define LOADER_HANDLE(StatusWord) ((UBYTE)(StatusWord))

//Pointer to lower byte of Loader status word
#define LOADER_HANDLE_P(StatusWord) ((UBYTE*)(&StatusWord))

typedef   struct
{
  UWORD   (*pFunc)(UBYTE, UBYTE *, UBYTE *, ULONG *);
  ULONG   FreeUserFlash;
}IOMAPLOADER;


#endif