Rev 2066 Rev 3120
1 /******************** (C) COPYRIGHT 2010 STMicroelectronics ******************** 1 /******************** (C) COPYRIGHT 2010 STMicroelectronics ********************
2 * File Name : STBLLIB.h 2 * File Name : STBLLIB.h
3 * Author : MCD Application Team 3 * Author : MCD Application Team
4 * Version : v2.2.0 4 * Version : v2.2.0
5 * Date : 05/03/2010 5 * Date : 05/03/2010
6 * Description : Defines the system memory boot loader protocol interface 6 * Description : Defines the system memory boot loader protocol interface
7 ******************************************************************************** 7 ********************************************************************************
8 * THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 8 * THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
9 * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. 9 * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
10 * AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, 10 * AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
11 * INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE 11 * INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
12 * CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING 12 * CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
13 * INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 13 * INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
14 *******************************************************************************/ 14 *******************************************************************************/
15   15  
16 #ifndef STDLIB_H 16 #ifndef STDLIB_H
17 #define STDLIB_H 17 #define STDLIB_H
18   18  
19 #include "StdAfx.h" 19 #include "StdAfx.h"
20 #include "../CRs232/rs232.h" 20 #include "../CRs232/rs232.h"
21   21  
22 #ifdef STBLLIB_EXPORTS 22 #ifdef STBLLIB_EXPORTS
23 #define STBLLIB_API __declspec(dllexport) 23 #define STBLLIB_API __declspec(dllexport)
24 #else 24 #else
25 #define STBLLIB_API __declspec(dllimport) 25 #define STBLLIB_API __declspec(dllimport)
26 #endif 26 #endif
27   27  
28 const BYTE INIT_CON = 0x7F; 28 const BYTE INIT_CON = 0x7F;
29   29  
30 const BYTE GET_CMD = 0x00; //Get the version and the allowed commands supported by the current version of the boot loader 30 const BYTE GET_CMD = 0x00; //Get the version and the allowed commands supported by the current version of the boot loader
31 const BYTE GET_VER_ROPS_CMD = 0x01; //Get the BL version and the Read Protection status of the NVM 31 const BYTE GET_VER_ROPS_CMD = 0x01; //Get the BL version and the Read Protection status of the NVM
32 const BYTE GET_ID_CMD = 0x02; //Get the chip ID 32 const BYTE GET_ID_CMD = 0x02; //Get the chip ID
33 const BYTE SET_SPEED_CMD = 0x03; //set the new baudrate 33 const BYTE SET_SPEED_CMD = 0x03; //set the new baudrate
34 const BYTE READ_CMD = 0x11; //Read up to 256 bytes of memory starting from an address specified by the user 34 const BYTE READ_CMD = 0x11; //Read up to 256 bytes of memory starting from an address specified by the user
35 const BYTE GO_CMD = 0x21; //Jump to an address specified by the user to execute (a loaded) code 35 const BYTE GO_CMD = 0x21; //Jump to an address specified by the user to execute (a loaded) code
36 const BYTE WRITE_CMD = 0x31; //Write maximum 256 bytes to the RAM or the NVM starting from an address specified by the user 36 const BYTE WRITE_CMD = 0x31; //Write maximum 256 bytes to the RAM or the NVM starting from an address specified by the user
37 const BYTE ERASE_CMD = 0x43; //Erase from one to all the NVM sectors 37 const BYTE ERASE_CMD = 0x43; //Erase from one to all the NVM sectors
38 const BYTE ERASE_EXT_CMD = 0x44; //Erase from one to all the NVM sectors 38 const BYTE ERASE_EXT_CMD = 0x44; //Erase from one to all the NVM sectors
39 const BYTE WRITE_PROTECT_CMD = 0x63; //Enable the write protection in a permanent way for some sectors 39 const BYTE WRITE_PROTECT_CMD = 0x63; //Enable the write protection in a permanent way for some sectors
40 const BYTE WRITE_TEMP_UNPROTECT_CMD = 0x71; //Disable the write protection in a temporary way for all NVM sectors 40 const BYTE WRITE_TEMP_UNPROTECT_CMD = 0x71; //Disable the write protection in a temporary way for all NVM sectors
41 const BYTE WRITE_PERM_UNPROTECT_CMD = 0x73; //Disable the write protection in a permanent way for all NVM sectors 41 const BYTE WRITE_PERM_UNPROTECT_CMD = 0x73; //Disable the write protection in a permanent way for all NVM sectors
42 const BYTE READOUT_PROTECT_CMD = 0x82; //Enable the readout protection in a permanent way 42 const BYTE READOUT_PROTECT_CMD = 0x82; //Enable the readout protection in a permanent way
43 const BYTE READOUT_TEMP_UNPROTECT_CMD = 0x91; //Disable the readout protection in a temporary way 43 const BYTE READOUT_TEMP_UNPROTECT_CMD = 0x91; //Disable the readout protection in a temporary way
44 const BYTE READOUT_PERM_UNPROTECT_CMD = 0x92; //Disable the readout protection in a permanent way 44 const BYTE READOUT_PERM_UNPROTECT_CMD = 0x92; //Disable the readout protection in a permanent way
45   45  
46   46  
47 const BYTE SUCCESS = 0x00; // No error 47 const BYTE SUCCESS = 0x00; // No error
48 const BYTE ERROR_OFFSET = 0x00; //error offset 48 const BYTE ERROR_OFFSET = 0x00; //error offset
49   49  
50 const BYTE COM_ERROR_OFFSET = ERROR_OFFSET + 0x00; 50 const BYTE COM_ERROR_OFFSET = ERROR_OFFSET + 0x00;
51 const BYTE NO_CON_AVAILABLE = COM_ERROR_OFFSET + 0x01; // No serial port opened 51 const BYTE NO_CON_AVAILABLE = COM_ERROR_OFFSET + 0x01; // No serial port opened
52 const BYTE COM_ALREADY_OPENED = COM_ERROR_OFFSET + 0x02; // Serial port already opened 52 const BYTE COM_ALREADY_OPENED = COM_ERROR_OFFSET + 0x02; // Serial port already opened
53 const BYTE CANT_OPEN_COM = COM_ERROR_OFFSET + 0x03; // Fail to open serial port 53 const BYTE CANT_OPEN_COM = COM_ERROR_OFFSET + 0x03; // Fail to open serial port
54 const BYTE SEND_FAIL = COM_ERROR_OFFSET + 0x04; // send over serial port fail 54 const BYTE SEND_FAIL = COM_ERROR_OFFSET + 0x04; // send over serial port fail
55 const BYTE READ_FAIL = COM_ERROR_OFFSET + 0x05; // Read from serial port fail 55 const BYTE READ_FAIL = COM_ERROR_OFFSET + 0x05; // Read from serial port fail
56   56  
57 const BYTE SYS_MEM_ERROR_OFFSET = ERROR_OFFSET + 0x10; 57 const BYTE SYS_MEM_ERROR_OFFSET = ERROR_OFFSET + 0x10;
58 const BYTE CANT_INIT_BL = SYS_MEM_ERROR_OFFSET + 0x01; // Fail to start system memory BL 58 const BYTE CANT_INIT_BL = SYS_MEM_ERROR_OFFSET + 0x01; // Fail to start system memory BL
59 const BYTE UNREOGNIZED_DEVICE = SYS_MEM_ERROR_OFFSET + 0x02; // Unreconized device 59 const BYTE UNREOGNIZED_DEVICE = SYS_MEM_ERROR_OFFSET + 0x02; // Unreconized device
60 const BYTE CMD_NOT_ALLOWED = SYS_MEM_ERROR_OFFSET + 0x03; // Command not allowed 60 const BYTE CMD_NOT_ALLOWED = SYS_MEM_ERROR_OFFSET + 0x03; // Command not allowed
61 const BYTE CMD_FAIL = SYS_MEM_ERROR_OFFSET + 0x04; // command failed 61 const BYTE CMD_FAIL = SYS_MEM_ERROR_OFFSET + 0x04; // command failed
62   62  
63 const BYTE PROGRAM_ERROR_OFFSET = ERROR_OFFSET + 0x20; 63 const BYTE PROGRAM_ERROR_OFFSET = ERROR_OFFSET + 0x20;
64 const BYTE INPUT_PARAMS_ERROR = PROGRAM_ERROR_OFFSET + 0x01; 64 const BYTE INPUT_PARAMS_ERROR = PROGRAM_ERROR_OFFSET + 0x01;
65 const BYTE INPUT_PARAMS_MEMORY_ALLOCATION_ERROR = PROGRAM_ERROR_OFFSET + 0x02; 65 const BYTE INPUT_PARAMS_MEMORY_ALLOCATION_ERROR = PROGRAM_ERROR_OFFSET + 0x02;
66 const BYTE LIB_LOADING_ERROR = PROGRAM_ERROR_OFFSET + 0x03; 66 const BYTE LIB_LOADING_ERROR = PROGRAM_ERROR_OFFSET + 0x03;
67   67  
68   68  
69   69  
70 enum ACKS {UNDEFINED=0x00, ST75=0x75, ST79=0x79}; 70 enum ACKS {UNDEFINED=0x00, ST75=0x75, ST79=0x79};
71 enum INTERFACE_TYPE {UART, CAN}; 71 enum INTERFACE_TYPE {UART, CAN};
72   72  
73 enum EBaudRate { brCustom,br110, br300, br600, br1200, br2400, br4800, br9600, br14400, br19200, br38400, 73 enum EBaudRate { brCustom,br110, br300, br600, br1200, br2400, br4800, br9600, br14400, br19200, br38400,
74 br56000, br57600, br115200, br128000, br256000 };// Port Numbers ( custom or COM1..COM16 } 74 br56000, br57600, br115200, br128000, br256000 };// Port Numbers ( custom or COM1..COM16 }
75 enum EPortNumber { pnCustom,pnCOM1, pnCOM2, pnCOM3, pnCOM4, pnCOM5, pnCOM6, pnCOM7,pnCOM8, pnCOM9, pnCOM10, 75 enum EPortNumber { pnCustom,pnCOM1, pnCOM2, pnCOM3, pnCOM4, pnCOM5, pnCOM6, pnCOM7,pnCOM8, pnCOM9, pnCOM10,
76 pnCOM11, pnCOM12, pnCOM13,pnCOM14, pnCOM15, pnCOM16 };// Data bits ( 5, 6, 7, 8 } 76 pnCOM11, pnCOM12, pnCOM13,pnCOM14, pnCOM15, pnCOM16 };// Data bits ( 5, 6, 7, 8 }
77 enum EDataBits { db5BITS, db6BITS, db7BITS, db8BITS }; 77 enum EDataBits { db5BITS, db6BITS, db7BITS, db8BITS };
78 // Stop bits ( 1, 1.5, 2 } 78 // Stop bits ( 1, 1.5, 2 }
79 enum EStopBits { sb1BITS, sb1HALFBITS, sb2BITS }; 79 enum EStopBits { sb1BITS, sb1HALFBITS, sb2BITS };
80 // Parity ( None, odd, even, mark, space } 80 // Parity ( None, odd, even, mark, space }
81 enum EParity { ptNONE, ptODD, ptEVEN, ptMARK, ptSPACE }; 81 enum EParity { ptNONE, ptODD, ptEVEN, ptMARK, ptSPACE };
82 // Hardware Flow Control ( None, None + RTS always on, RTS/CTS } 82 // Hardware Flow Control ( None, None + RTS always on, RTS/CTS }
83 enum EHwFlowControl { hfNONE, hfNONERTSON, hfRTSCTS }; 83 enum EHwFlowControl { hfNONE, hfNONERTSON, hfRTSCTS };
84 // Software Flow Control ( None, XON/XOFF } 84 // Software Flow Control ( None, XON/XOFF }
85 enum ESwFlowControl { sfNONE, sfXONXOFF }; 85 enum ESwFlowControl { sfNONE, sfXONXOFF };
86 // What to do with incomplete (incoming} packets ( Discard, Pass } 86 // What to do with incomplete (incoming} packets ( Discard, Pass }
87 enum EPacketMode { pmDiscard, pmPass }; 87 enum EPacketMode { pmDiscard, pmPass };
88   88  
89 enum OPERATION {NONE, ERASE, UPLOAD, DNLOAD, DIS_R_PROT, DIS_W_PROT, ENA_R_PROT, ENA_W_PROT}; 89 enum OPERATION {NONE, ERASE, UPLOAD, DNLOAD, DIS_R_PROT, DIS_W_PROT, ENA_R_PROT, ENA_W_PROT};
90   90  
91 typedef struct RESULT 91 typedef struct RESULT
92 { 92 {
93 OPERATION operation; 93 OPERATION operation;
94 char* filename; 94 char* filename;
95 HANDLE Image; 95 HANDLE Image;
96 }* LPRESULT; 96 }* LPRESULT;
97   97  
98 typedef struct Commands 98 typedef struct Commands
99 { 99 {
100 BOOL GET_CMD ; //Get the version and the allowed commands supported by the current version of the boot loader 100 BOOL GET_CMD ; //Get the version and the allowed commands supported by the current version of the boot loader
101 BOOL GET_VER_ROPS_CMD ; //Get the BL version and the Read Protection status of the NVM 101 BOOL GET_VER_ROPS_CMD ; //Get the BL version and the Read Protection status of the NVM
102 BOOL GET_ID_CMD ; //Get the chip ID 102 BOOL GET_ID_CMD ; //Get the chip ID
103 BOOL SET_SPEED_CMD ; //Change the CAN baudrate 103 BOOL SET_SPEED_CMD ; //Change the CAN baudrate
104 BOOL READ_CMD ; //Read up to 256 bytes of memory starting from an address specified by the user 104 BOOL READ_CMD ; //Read up to 256 bytes of memory starting from an address specified by the user
105 BOOL GO_CMD ; //Jump to an address specified by the user to execute (a loaded) code 105 BOOL GO_CMD ; //Jump to an address specified by the user to execute (a loaded) code
106 BOOL WRITE_CMD ; //Write maximum 256 bytes to the RAM or the NVM starting from an address specified by the user 106 BOOL WRITE_CMD ; //Write maximum 256 bytes to the RAM or the NVM starting from an address specified by the user
107 BOOL ERASE_CMD ; //Erase from one to all the NVM sectors 107 BOOL ERASE_CMD ; //Erase from one to all the NVM sectors
108 BOOL ERASE_EXT_CMD ; //Erase from one to all the NVM sectors 108 BOOL ERASE_EXT_CMD ; //Erase from one to all the NVM sectors
109 BOOL WRITE_PROTECT_CMD ; //Enable the write protection in a permanent way for some sectors 109 BOOL WRITE_PROTECT_CMD ; //Enable the write protection in a permanent way for some sectors
110 BOOL WRITE_TEMP_UNPROTECT_CMD ; //Disable the write protection in a temporary way for all NVM sectors 110 BOOL WRITE_TEMP_UNPROTECT_CMD ; //Disable the write protection in a temporary way for all NVM sectors
111 BOOL WRITE_PERM_UNPROTECT_CMD ; //Disable the write protection in a permanent way for all NVM sectors 111 BOOL WRITE_PERM_UNPROTECT_CMD ; //Disable the write protection in a permanent way for all NVM sectors
112 BOOL READOUT_PROTECT_CMD ; //Enable the readout protection in a permanent way 112 BOOL READOUT_PROTECT_CMD ; //Enable the readout protection in a permanent way
113 BOOL READOUT_TEMP_UNPROTECT_CMD ; //Disable the readout protection in a temporary way 113 BOOL READOUT_TEMP_UNPROTECT_CMD ; //Disable the readout protection in a temporary way
114 BOOL READOUT_PERM_UNPROTECT_CMD ; //Disable the readout protection in a permanent way 114 BOOL READOUT_PERM_UNPROTECT_CMD ; //Disable the readout protection in a permanent way
115 }* LPCommands; 115 }* LPCommands;
116   116  
117 typedef struct TARGET_DESCRIPTOR 117 typedef struct TARGET_DESCRIPTOR
118 { 118 {
119 BYTE Version ; 119 BYTE Version ;
120 BYTE CmdCount ; 120 BYTE CmdCount ;
121 BYTE PIDLen ; 121 BYTE PIDLen ;
122 BYTE* PID ; 122 BYTE* PID ;
123   123  
124 BYTE ROPE ; 124 BYTE ROPE ;
125 BYTE ROPD ; 125 BYTE ROPD ;
126   126  
127 BOOL GET_CMD ; //Get the version and the allowed commands supported by the current version of the boot loader 127 BOOL GET_CMD ; //Get the version and the allowed commands supported by the current version of the boot loader
128 BOOL GET_VER_ROPS_CMD ; //Get the BL version and the Read Protection status of the NVM 128 BOOL GET_VER_ROPS_CMD ; //Get the BL version and the Read Protection status of the NVM
129 BOOL GET_ID_CMD ; //Get the chip ID 129 BOOL GET_ID_CMD ; //Get the chip ID
130 BOOL SET_SPEED_CMD ; 130 BOOL SET_SPEED_CMD ;
131 BOOL READ_CMD ; //Read up to 256 bytes of memory starting from an address specified by the user 131 BOOL READ_CMD ; //Read up to 256 bytes of memory starting from an address specified by the user
132 BOOL GO_CMD ; //Jump to an address specified by the user to execute (a loaded) code 132 BOOL GO_CMD ; //Jump to an address specified by the user to execute (a loaded) code
133 BOOL WRITE_CMD ; //Write maximum 256 bytes to the RAM or the NVM starting from an address specified by the user 133 BOOL WRITE_CMD ; //Write maximum 256 bytes to the RAM or the NVM starting from an address specified by the user
134 BOOL ERASE_CMD ; //Erase from one to all the NVM sectors 134 BOOL ERASE_CMD ; //Erase from one to all the NVM sectors
135 BOOL ERASE_EXT_CMD ; //Erase from one to all the NVM sectors 135 BOOL ERASE_EXT_CMD ; //Erase from one to all the NVM sectors
136 BOOL WRITE_PROTECT_CMD ; //Enable the write protection in a permanent way for some sectors 136 BOOL WRITE_PROTECT_CMD ; //Enable the write protection in a permanent way for some sectors
137 BOOL WRITE_TEMP_UNPROTECT_CMD ; //Disable the write protection in a temporary way for all NVM sectors 137 BOOL WRITE_TEMP_UNPROTECT_CMD ; //Disable the write protection in a temporary way for all NVM sectors
138 BOOL WRITE_PERM_UNPROTECT_CMD ; //Disable the write protection in a permanent way for all NVM sectors 138 BOOL WRITE_PERM_UNPROTECT_CMD ; //Disable the write protection in a permanent way for all NVM sectors
139 BOOL READOUT_PERM_PROTECT_CMD ; //Enable the readout protection in a permanent way 139 BOOL READOUT_PERM_PROTECT_CMD ; //Enable the readout protection in a permanent way
140 BOOL READOUT_TEMP_UNPROTECT_CMD ; //Disable the readout protection in a temporary way 140 BOOL READOUT_TEMP_UNPROTECT_CMD ; //Disable the readout protection in a temporary way
141 BOOL READOUT_PERM_UNPROTECT_CMD ; //Disable the readout protection in a permanent way 141 BOOL READOUT_PERM_UNPROTECT_CMD ; //Disable the readout protection in a permanent way
142 }* LPTARGET_DESCRIPTOR; 142 }* LPTARGET_DESCRIPTOR;
143   143  
144 typedef struct STBL_Request 144 typedef struct STBL_Request
145 { 145 {
146 BYTE _cmd; 146 BYTE _cmd;
147 DWORD _address; 147 DWORD _address;
148 WORD _length; 148 WORD _length;
149 BYTE _nbSectors; 149 BYTE _nbSectors;
150 LPTARGET_DESCRIPTOR _target; 150 LPTARGET_DESCRIPTOR _target;
151 LPBYTE _data; 151 LPBYTE _data;
152 WORD _wbSectors; 152 WORD _wbSectors;
153 }* LPSTBL_Request; 153 }* LPSTBL_Request;
154   154  
155 extern "C" 155 extern "C"
156 { 156 {
157 /************************************************************************************/ 157 /************************************************************************************/
158 /* GET PROGRESS STATE 158 /* GET PROGRESS STATE
159 /* 159 /*
160 /* 160 /*
161 /************************************************************************************/ 161 /************************************************************************************/
162 STBLLIB_API BYTE GetProgress(LPBYTE progress); 162 STBLLIB_API BYTE GetProgress(LPBYTE progress);
163   163  
164 /************************************************************************************/ 164 /************************************************************************************/
165 /* GET ACTIVITY TIME 165 /* GET ACTIVITY TIME
166 /* 166 /*
167 /* 167 /*
168 /************************************************************************************/ 168 /************************************************************************************/
169 STBLLIB_API BYTE GetActivityTime(LPDWORD time); 169 STBLLIB_API BYTE GetActivityTime(LPDWORD time);
170   170  
171 /************************************************************************************/ 171 /************************************************************************************/
172 /* SET ACTIVITY TIME 172 /* SET ACTIVITY TIME
173 /* 173 /*
174 /* 174 /*
175 /************************************************************************************/ 175 /************************************************************************************/
176 STBLLIB_API BYTE SetActivityTime(DWORD time); 176 STBLLIB_API BYTE SetActivityTime(DWORD time);
177   177  
178 /************************************************************************************/ 178 /************************************************************************************/
179 /* SET COMMUNICATION INTERFACE TYPE 179 /* SET COMMUNICATION INTERFACE TYPE
180 /* UART - CAN - ... 180 /* UART - CAN - ...
181 /* 181 /*
182 /************************************************************************************/ 182 /************************************************************************************/
183 STBLLIB_API BYTE TARGET_SetComIntType(BYTE com_int_type); 183 STBLLIB_API BYTE TARGET_SetComIntType(BYTE com_int_type);
184 /************************************************************************************/ 184 /************************************************************************************/
185 /* GetFlashSize 185 /* GetFlashSize
186 /* 186 /*
187 /* 187 /*
188 /************************************************************************************/ 188 /************************************************************************************/
189 STBLLIB_API BYTE TARGET_GetFlashSize(DWORD Addr, LPWORD val); 189 STBLLIB_API BYTE TARGET_GetFlashSize(DWORD Addr, LPWORD val);
190 /************************************************************************************/ 190 /************************************************************************************/
191 /* GetMemoryAddress 191 /* GetMemoryAddress
192 /* 192 /*
193 /* 193 /*
194 /************************************************************************************/ 194 /************************************************************************************/
195 STBLLIB_API BYTE TARGET_GetMemoryAddress(DWORD Addr, LPBYTE val); 195 STBLLIB_API BYTE TARGET_GetMemoryAddress(DWORD Addr, LPBYTE val);
196 /************************************************************************************/ 196 /************************************************************************************/
197 /* GetRDPOptionByte 197 /* GetRDPOptionByte
198 /* 198 /*
199 /* 199 /*
200 /************************************************************************************/ 200 /************************************************************************************/
201 STBLLIB_API BYTE TARGET_GetRDPOptionByte(LPBYTE RDP); 201 STBLLIB_API BYTE TARGET_GetRDPOptionByte(LPBYTE RDP);
202 /************************************************************************************/ 202 /************************************************************************************/
203 /* GetWRPOptionBytes 203 /* GetWRPOptionBytes
204 /* 204 /*
205 /* 205 /*
206 /************************************************************************************/ 206 /************************************************************************************/
207 STBLLIB_API BYTE TARGET_GetWRPOptionBytes(LPBYTE WRP0, LPBYTE WRP1, LPBYTE WRP2, LPBYTE WRP3); 207 STBLLIB_API BYTE TARGET_GetWRPOptionBytes(LPBYTE WRP0, LPBYTE WRP1, LPBYTE WRP2, LPBYTE WRP3);
208 /************************************************************************************/ 208 /************************************************************************************/
209 /* Basic function to send a request 209 /* Basic function to send a request
210 /* 210 /*
211 /* 211 /*
212 /************************************************************************************/ 212 /************************************************************************************/
213 STBLLIB_API BYTE Send_RQ(LPSTBL_Request pRQ); 213 STBLLIB_API BYTE Send_RQ(LPSTBL_Request pRQ);
214   214  
215 /************************************************************************************/ 215 /************************************************************************************/
216 /* 216 /*
217 /* 217 /*
218 /* 218 /*
219 /************************************************************************************/ 219 /************************************************************************************/
220 STBLLIB_API BYTE SetCOMSettings(int numPort, long speedInBaud, int nbBit, 220 STBLLIB_API BYTE SetCOMSettings(int numPort, long speedInBaud, int nbBit,
221 int parity, float nbStopBit); 221 int parity, float nbStopBit);
222 /************************************************************************************/ 222 /************************************************************************************/
223 /* 223 /*
224 /* 224 /*
225 /* 225 /*
226 /************************************************************************************/ 226 /************************************************************************************/
227 /*STBLLIB_API BYTE ESetCOMSettings(EPortNumber numPort, EBaudRate speedInBaud, EDataBits nbBit, 227 /*STBLLIB_API BYTE ESetCOMSettings(EPortNumber numPort, EBaudRate speedInBaud, EDataBits nbBit,
228 EParity parity, EStopBits nbStopBit);*/ 228 EParity parity, EStopBits nbStopBit);*/
229 /************************************************************************************/ 229 /************************************************************************************/
230 /* 230 /*
231 /* 231 /*
232 /* 232 /*
233 /************************************************************************************/ 233 /************************************************************************************/
234 STBLLIB_API BYTE COM_Open(); 234 STBLLIB_API BYTE COM_Open();
235 /************************************************************************************/ 235 /************************************************************************************/
236 /* 236 /*
237 /* 237 /*
238 /* 238 /*
239 /************************************************************************************/ 239 /************************************************************************************/
240 STBLLIB_API BYTE COM_Close(); 240 STBLLIB_API BYTE COM_Close();
241 /************************************************************************************/ 241 /************************************************************************************/
242 /* 242 /*
243 /* 243 /*
244 /* 244 /*
245 /************************************************************************************/ 245 /************************************************************************************/
246 STBLLIB_API BYTE STBL_SetSpeed(DWORD speed); 246 STBLLIB_API BYTE STBL_SetSpeed(DWORD speed);
247 /************************************************************************************/ 247 /************************************************************************************/
248 /* 248 /*
249 /* 249 /*
250 /* 250 /*
251 /************************************************************************************/ 251 /************************************************************************************/
252 STBLLIB_API BYTE STBL_Init_BL(); 252 STBLLIB_API BYTE STBL_Init_BL();
253 /************************************************************************************/ 253 /************************************************************************************/
254 /* 0x00; //Get the version and the allowed commands supported by the current version of the boot loader 254 /* 0x00; //Get the version and the allowed commands supported by the current version of the boot loader
255 /* 255 /*
256 /* 256 /*
257 /************************************************************************************/ 257 /************************************************************************************/
258 STBLLIB_API BYTE STBL_GET(LPBYTE Version, LPCommands pCmds); 258 STBLLIB_API BYTE STBL_GET(LPBYTE Version, LPCommands pCmds);
259 /************************************************************************************/ 259 /************************************************************************************/
260 /* 0x01; //Get the BL version and the Read Protection status of the NVM 260 /* 0x01; //Get the BL version and the Read Protection status of the NVM
261 /* 261 /*
262 /* 262 /*
263 /************************************************************************************/ 263 /************************************************************************************/
264 STBLLIB_API BYTE STBL_GET_VER_ROPS(LPBYTE Version, LPBYTE ROPEnabled, LPBYTE ROPDisabled); 264 STBLLIB_API BYTE STBL_GET_VER_ROPS(LPBYTE Version, LPBYTE ROPEnabled, LPBYTE ROPDisabled);
265 /************************************************************************************/ 265 /************************************************************************************/
266 /* 0x02; //Get the chip ID 266 /* 0x02; //Get the chip ID
267 /* 267 /*
268 /* 268 /*
269 /************************************************************************************/ 269 /************************************************************************************/
270 STBLLIB_API BYTE STBL_GET_ID(LPBYTE size, LPBYTE pID); 270 STBLLIB_API BYTE STBL_GET_ID(LPBYTE size, LPBYTE pID);
271 /************************************************************************************/ 271 /************************************************************************************/
272 /* 0x11; //Read up to 256 bytes of memory starting from an address specified by the user 272 /* 0x11; //Read up to 256 bytes of memory starting from an address specified by the user
273 /* 273 /*
274 /* 274 /*
275 /************************************************************************************/ 275 /************************************************************************************/
276 STBLLIB_API BYTE STBL_READ(DWORD Address, BYTE Size, LPBYTE pData); 276 STBLLIB_API BYTE STBL_READ(DWORD Address, BYTE Size, LPBYTE pData);
277 /************************************************************************************/ 277 /************************************************************************************/
278 /* 0x21; //Jump to an address specified by the user to execute (a loaded) code 278 /* 0x21; //Jump to an address specified by the user to execute (a loaded) code
279 /* 279 /*
280 /* 280 /*
281 /************************************************************************************/ 281 /************************************************************************************/
282 STBLLIB_API BYTE STBL_GO(DWORD Address); 282 STBLLIB_API BYTE STBL_GO(DWORD Address);
283 /************************************************************************************/ 283 /************************************************************************************/
284 /* 0x31; //Write maximum 256 bytes to the RAM or the NVM starting from an address specified by the user 284 /* 0x31; //Write maximum 256 bytes to the RAM or the NVM starting from an address specified by the user
285 /* 285 /*
286 /* 286 /*
287 /************************************************************************************/ 287 /************************************************************************************/
288 STBLLIB_API BYTE STBL_WRITE(DWORD address, BYTE size, LPBYTE pData); 288 STBLLIB_API BYTE STBL_WRITE(DWORD address, BYTE size, LPBYTE pData);
289 /************************************************************************************/ 289 /************************************************************************************/
290 /* 0x43; //Erase from one to all the NVM sectors 290 /* 0x43; //Erase from one to all the NVM sectors
291 /* 291 /*
292 /* 292 /*
293 /************************************************************************************/ 293 /************************************************************************************/
294 STBLLIB_API BYTE STBL_ERASE(WORD NbSectors, LPBYTE pSectors); 294 STBLLIB_API BYTE STBL_ERASE(WORD NbSectors, LPBYTE pSectors);
295 295
296 /************************************************************************************/ 296 /************************************************************************************/
297 /* 0x63; //Enable the write protection in a permanent way for some sectors 297 /* 0x63; //Enable the write protection in a permanent way for some sectors
298 /* 298 /*
299 /* 299 /*
300 /************************************************************************************/ 300 /************************************************************************************/
301 STBLLIB_API BYTE STBL_WRITE_PROTECT(BYTE NbSectors, LPBYTE pSectors); 301 STBLLIB_API BYTE STBL_WRITE_PROTECT(BYTE NbSectors, LPBYTE pSectors);
302 /************************************************************************************/ 302 /************************************************************************************/
303 /* 0x71; //Disable the write protection in a temporary way for all NVM sectors 303 /* 0x71; //Disable the write protection in a temporary way for all NVM sectors
304 /* 304 /*
305 /* 305 /*
306 /************************************************************************************/ 306 /************************************************************************************/
307 STBLLIB_API BYTE STBL_WRITE_TEMP_UNPROTECT(); 307 STBLLIB_API BYTE STBL_WRITE_TEMP_UNPROTECT();
308 /************************************************************************************/ 308 /************************************************************************************/
309 /* 0x73; //Disable the write protection in a permanent way for all NVM sectors 309 /* 0x73; //Disable the write protection in a permanent way for all NVM sectors
310 /* 310 /*
311 /* 311 /*
312 /************************************************************************************/ 312 /************************************************************************************/
313 STBLLIB_API BYTE STBL_WRITE_PERM_UNPROTECT(); 313 STBLLIB_API BYTE STBL_WRITE_PERM_UNPROTECT();
314 /************************************************************************************/ 314 /************************************************************************************/
315 /* 0x82; //Enable the readout protection in a permanent way 315 /* 0x82; //Enable the readout protection in a permanent way
316 /* 316 /*
317 /* 317 /*
318 /************************************************************************************/ 318 /************************************************************************************/
319 STBLLIB_API BYTE STBL_READOUT_PROTECT(); 319 STBLLIB_API BYTE STBL_READOUT_PROTECT();
320 /************************************************************************************/ 320 /************************************************************************************/
321 /* 0x91; //Disable the readout protection in a temporary way 321 /* 0x91; //Disable the readout protection in a temporary way
322 /* 322 /*
323 /* 323 /*
324 /************************************************************************************/ 324 /************************************************************************************/
325 STBLLIB_API BYTE STBL_READOUT_TEMP_UNPROTECT(); 325 STBLLIB_API BYTE STBL_READOUT_TEMP_UNPROTECT();
326 /************************************************************************************/ 326 /************************************************************************************/
327 /* 0x92; //Disable the readout protection in a permanent way 327 /* 0x92; //Disable the readout protection in a permanent way
328 /* 328 /*
329 /* 329 /*
330 /************************************************************************************/ 330 /************************************************************************************/
331 STBLLIB_API BYTE STBL_READOUT_PERM_UNPROTECT(); 331 STBLLIB_API BYTE STBL_READOUT_PERM_UNPROTECT();
332 /************************************************************************************/ 332 /************************************************************************************/
333 /* UPLOAD 333 /* UPLOAD
334 /* 334 /*
335 /* 335 /*
336 /************************************************************************************/ 336 /************************************************************************************/
337 STBLLIB_API BYTE STBL_UPLOAD(DWORD Address, LPBYTE pData, DWORD Length); 337 STBLLIB_API BYTE STBL_UPLOAD(DWORD Address, LPBYTE pData, DWORD Length);
338 /************************************************************************************/ 338 /************************************************************************************/
339 /* VERIFY 339 /* VERIFY
340 /* 340 /*
341 /* 341 /*
342 /************************************************************************************/ 342 /************************************************************************************/
343 STBLLIB_API BYTE STBL_VERIFY(DWORD Address, LPBYTE pData, DWORD Length,BOOL bTruncateLeadFFForDnLoad); 343 STBLLIB_API BYTE STBL_VERIFY(DWORD Address, LPBYTE pData, DWORD Length,BOOL bTruncateLeadFFForDnLoad);
344 /************************************************************************************/ 344 /************************************************************************************/
345 /* DNLOAD 345 /* DNLOAD
346 /* 346 /*
347 /* 347 /*
348 /************************************************************************************/ 348 /************************************************************************************/
349 STBLLIB_API BYTE STBL_DNLOAD(DWORD Address, LPBYTE pData, DWORD Length,BOOL bTruncateLeadFFForDnLoad); 349 STBLLIB_API BYTE STBL_DNLOAD(DWORD Address, LPBYTE pData, DWORD Length,BOOL bTruncateLeadFFForDnLoad);
350   350  
351 /************************************************************************************/ 351 /************************************************************************************/
352 /* SET PACKET SIZE 352 /* SET PACKET SIZE
353 /* 353 /*
354 /* 354 /*
355 /************************************************************************************/ 355 /************************************************************************************/
356 STBLLIB_API BYTE SetPaketSize(BYTE WORD); 356 STBLLIB_API BYTE SetPaketSize(BYTE WORD);
357 357
358 /************************************************************************************/ 358 /************************************************************************************/
359 /* GET PACKET SIZE 359 /* GET PACKET SIZE
360 /* 360 /*
361 /* 361 /*
362 /************************************************************************************/ 362 /************************************************************************************/
363 STBLLIB_API BYTE GetPaketSize(LPBYTE size); 363 STBLLIB_API BYTE GetPaketSize(LPBYTE size);
364   364  
365 /************************************************************************************/ 365 /************************************************************************************/
366 /* GetAckValue 366 /* GetAckValue
367 /* 367 /*
368 /* 368 /*
369 /************************************************************************************/ 369 /************************************************************************************/
370 STBLLIB_API ACKS GetAckValue(); 370 STBLLIB_API ACKS GetAckValue();
371   371  
372 /************************************************************************************/ 372 /************************************************************************************/
373 /* IsConnected 373 /* IsConnected
374 /* 374 /*
375 /* 375 /*
376 /************************************************************************************/ 376 /************************************************************************************/
377 STBLLIB_API BOOL COM_is_Open(); 377 STBLLIB_API BOOL COM_is_Open();
378   378  
379 /************************************************************************************/ 379 /************************************************************************************/
380 /* SetTimeOut 380 /* SetTimeOut
381 /* 381 /*
382 /* 382 /*
383 /************************************************************************************/ 383 /************************************************************************************/
384 STBLLIB_API BYTE SetTimeOut(DWORD vms); 384 STBLLIB_API BYTE SetTimeOut(DWORD vms);
385 /************************************************************************************/ 385 /************************************************************************************/
386 /* GetUserOptionByte 386 /* GetUserOptionByte
387 /* 387 /*
388 /* 388 /*
389 /************************************************************************************/ 389 /************************************************************************************/
390 STBLLIB_API BYTE TARGET_GetUserOptionByte(LPBYTE User); 390 STBLLIB_API BYTE TARGET_GetUserOptionByte(LPBYTE User);
391 /************************************************************************************/ 391 /************************************************************************************/
392 /* GetDataOptionByte 392 /* GetDataOptionByte
393 /* 393 /*
394 /* 394 /*
395 /************************************************************************************/ 395 /************************************************************************************/
396 STBLLIB_API BYTE TARGET_GetDataOptionByte(LPBYTE Data0, LPBYTE Data1); 396 STBLLIB_API BYTE TARGET_GetDataOptionByte(LPBYTE Data0, LPBYTE Data1);
397   397  
398 /************************************************************************************/ 398 /************************************************************************************/
399 /* SetSIFData 399 /* SetSIFData
400 /* 400 /*
401 /* 401 /*
402 /************************************************************************************/ 402 /************************************************************************************/
403 STBLLIB_API BYTE TARGET_SetSIFData(BYTE User, BYTE RDP, BYTE Data0, BYTE Data1, 403 STBLLIB_API BYTE TARGET_SetSIFData(BYTE User, BYTE RDP, BYTE Data0, BYTE Data1,
404 BYTE WRP0, BYTE WRP1, BYTE WRP2, BYTE WRP3); 404 BYTE WRP0, BYTE WRP1, BYTE WRP2, BYTE WRP3);
405   405  
406 /************************************************************************************/ 406 /************************************************************************************/
407 /* GetSIFData 407 /* GetSIFData
408 /* 408 /*
409 /* 409 /*
410 /************************************************************************************/ 410 /************************************************************************************/
411 STBLLIB_API BYTE TARGET_GetSIFData(LPBYTE User, LPBYTE RDP, LPBYTE Data0, LPBYTE Data1, 411 STBLLIB_API BYTE TARGET_GetSIFData(LPBYTE User, LPBYTE RDP, LPBYTE Data0, LPBYTE Data1,
412 LPBYTE WRP0, LPBYTE WRP1, LPBYTE WRP2, LPBYTE WRP3); 412 LPBYTE WRP0, LPBYTE WRP1, LPBYTE WRP2, LPBYTE WRP3);
413   413  
414 /************************************************************************************/ 414 /************************************************************************************/
415 /* Set Rts Line State 415 /* Set Rts Line State
416 /* High = TRUE 416 /* High = TRUE
417 /* Low = FALSE 417 /* Low = FALSE
418 /************************************************************************************/ 418 /************************************************************************************/
419 STBLLIB_API BYTE STBL_SetRts(BOOL Val); 419 STBLLIB_API BYTE STBL_SetRts(BOOL Val);
420   420  
421 /************************************************************************************/ 421 /************************************************************************************/
422 /* Set Dtr Line State 422 /* Set Dtr Line State
423 /* High = TRUE 423 /* High = TRUE
424 /* Low = FALSE 424 /* Low = FALSE
425 /************************************************************************************/ 425 /************************************************************************************/
426 STBLLIB_API BYTE STBL_SetDtr(BOOL Val); 426 STBLLIB_API BYTE STBL_SetDtr(BOOL Val);
427   427  
428 /************************************************************************************/ 428 /************************************************************************************/
429 /* Set the state of TXD. Return: true if success. 429 /* Set the state of TXD. Return: true if success.
430 /* High = TRUE 430 /* High = TRUE
431 /* Low = FALSE 431 /* Low = FALSE
432 /************************************************************************************/ 432 /************************************************************************************/
433 STBLLIB_API BYTE STBL_setTxd(BOOL val); 433 STBLLIB_API BYTE STBL_setTxd(BOOL val);
434 434
435 /************************************************************************************/ 435 /************************************************************************************/
436 /* Return: The state of CTS. 436 /* Return: The state of CTS.
437 /* High = TRUE 437 /* High = TRUE
438 /* Low = FALSE 438 /* Low = FALSE
439 /************************************************************************************/ 439 /************************************************************************************/
440 STBLLIB_API BYTE STBL_getCts(BOOL* pval); 440 STBLLIB_API BYTE STBL_getCts(BOOL* pval);
441 441
442 /************************************************************************************/ 442 /************************************************************************************/
443 /* Return: The state of DTR. 443 /* Return: The state of DTR.
444 /* High = TRUE 444 /* High = TRUE
445 /* Low = FALSE 445 /* Low = FALSE
446 /************************************************************************************/ 446 /************************************************************************************/
447 STBLLIB_API BYTE STBL_getDtr(BOOL* pval); 447 STBLLIB_API BYTE STBL_getDtr(BOOL* pval);
448 448
449 /************************************************************************************/ 449 /************************************************************************************/
450 /* Return: The state of RI. 450 /* Return: The state of RI.
451 /* High = TRUE 451 /* High = TRUE
452 /* Low = FALSE 452 /* Low = FALSE
453 /************************************************************************************/ 453 /************************************************************************************/
454 STBLLIB_API BYTE STBL_getRi(BOOL* pval); 454 STBLLIB_API BYTE STBL_getRi(BOOL* pval);
455 455
456 /************************************************************************************/ 456 /************************************************************************************/
457 /* Return: The state of DTR. 457 /* Return: The state of DTR.
458 /* High = TRUE 458 /* High = TRUE
459 /* Low = FALSE 459 /* Low = FALSE
460 /************************************************************************************/ 460 /************************************************************************************/
461 STBLLIB_API BYTE STBL_getCd(BOOL* pval); 461 STBLLIB_API BYTE STBL_getCd(BOOL* pval);
462 462
463 /************************************************************************************/ 463 /************************************************************************************/
464 /* Set Echo back Mode 464 /* Set Echo back Mode
465 /* 0 = Echo Disabled 465 /* 0 = Echo Disabled
466 /* 1 = Echo Back Enabled 466 /* 1 = Echo Back Enabled
467 /* 2 = Listen Echo Enabled 467 /* 2 = Listen Echo Enabled
468 /************************************************************************************/ 468 /************************************************************************************/
469 STBLLIB_API BYTE STBL_SetEcho(int val); 469 STBLLIB_API BYTE STBL_SetEcho(int val);
470   470  
471   471  
472 /************************************************************************************/ 472 /************************************************************************************/
473 /* SetFlowControl : Enable/Disable Flow Control of DTR and RTS 473 /* SetFlowControl : Enable/Disable Flow Control of DTR and RTS
474 /* FALSE = Disabled 474 /* FALSE = Disabled
475 /* TRUE = Enabled 475 /* TRUE = Enabled
476 /************************************************************************************/ 476 /************************************************************************************/
477 STBLLIB_API BYTE STBL_SetFlowControl(bool val); 477 STBLLIB_API BYTE STBL_SetFlowControl(bool val);
478   478  
479   479  
480 } 480 }
481   481  
482   482  
483   483  
484 #endif 484 #endif
485   485  
486 /******************* (C) COPYRIGHT 2010 STMicroelectronics *****END OF FILE******/ 486 /******************* (C) COPYRIGHT 2010 STMicroelectronics *****END OF FILE******/