forked from gv1/cybootload_linux
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcybtldr_utils.h
133 lines (123 loc) · 5.5 KB
/
cybtldr_utils.h
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
/*******************************************************************************
* Copyright 2011-2012, Cypress Semiconductor Corporation. All rights reserved.
* You may use this file only in accordance with the license, terms, conditions,
* disclaimers, and limitations in the end user license agreement accompanying
* the software package with which this file was provided.
********************************************************************************/
#ifndef __CYBTLDR_UTILS_H__
#define __CYBTLDR_UTILS_H__
#include <stdio.h>
// NB: These items are toolchain specific that will need to be updated
// depending on the environment being used.
#ifdef WIN32
#define EXTERN extern __declspec(dllexport)
#else
#define EXTERN extern
#endif
/******************************************************************************
* HOST ERROR CODES
******************************************************************************
*
* Different return codes from the bootloader host. Functions are not
* limited to these values, but are encuraged to use them when returning
* standard error values.
*
* 0 is successful, all other values indicate a failure.
*****************************************************************************/
/* Completed successfully */
#ifndef CYRET_SUCCESS
#define CYRET_SUCCESS 0x00
#endif
/* File is not accessable */
#define CYRET_ERR_FILE 0x01
/* Reached the end of the file */
#define CYRET_ERR_EOF 0x02
/* The amount of data available is outside the expected range */
#define CYRET_ERR_LENGTH 0x03
/* The data is not of the proper form */
#define CYRET_ERR_DATA 0x04
/* The command is not recognized */
#define CYRET_ERR_CMD 0x05
/* The expected device does not match the detected device */
#define CYRET_ERR_DEVICE 0x06
/* The bootloader version detected is not supported */
#define CYRET_ERR_VERSION 0x07
/* The checksum does not match the expected value */
#define CYRET_ERR_CHECKSUM 0x08
/* The flash array is not valid */
#define CYRET_ERR_ARRAY 0x09
/* The flash row is not valid */
#define CYRET_ERR_ROW 0x0A
/* The bootloader is not ready to process data */
#define CYRET_ERR_BTLDR 0x0B
/* The application is currently marked as active */
#define CYRET_ERR_ACTIVE 0x0C
/* An unknown error occured */
#define CYRET_ERR_UNK 0x0F
/* The operation was aborted */
#define CYRET_ABORT 0xFF
/* The communications object reported an error */
#define CYRET_ERR_COMM_MASK 0x2000
/* The bootloader reported an error */
#define CYRET_ERR_BTLDR_MASK 0x4000
/******************************************************************************
* BOOTLOADER STATUS CODES
******************************************************************************
*
* Different return status codes from the bootloader.
*
* 0 is successful, all other values indicate a failure.
*****************************************************************************/
/* Completed successfully */
#define CYBTLDR_STAT_SUCCESS 0x00
/* The provided key does not match the expected value */
#define CYBTLDR_STAT_ERR_KEY 0x01
/* The verification of flash failed */
#define CYBTLDR_STAT_ERR_VERIFY 0x02
/* The amount of data available is outside the expected range */
#define CYBTLDR_STAT_ERR_LENGTH 0x03
/* The data is not of the proper form */
#define CYBTLDR_STAT_ERR_DATA 0x04
/* The command is not recognized */
#define CYBTLDR_STAT_ERR_CMD 0x05
/* The expected device does not match the detected device */
#define CYBTLDR_STAT_ERR_DEVICE 0x06
/* The bootloader version detected is not supported */
#define CYBTLDR_STAT_ERR_VERSION 0x07
/* The checksum does not match the expected value */
#define CYBTLDR_STAT_ERR_CHECKSUM 0x08
/* The flash array is not valid */
#define CYBTLDR_STAT_ERR_ARRAY 0x09
/* The flash row is not valid */
#define CYBTLDR_STAT_ERR_ROW 0x0A
/* The flash row is protected and can not be programmed */
#define CYBTLDR_STAT_ERR_PROTECT 0x0B
/* The application is not valid and cannot be set as active */
#define CYBTLDR_STAT_ERR_APP 0x0C
/* The application is currently marked as active */
#define CYBTLDR_STAT_ERR_ACTIVE 0x0D
/* An unknown error occured */
#define CYBTLDR_STAT_ERR_UNK 0x0F
/******************************************************************************
* VERSION INFORMATION
******************************************************************************
*
* Major – Used to indicate binary compatibility. If a change is incompatible
* in any way with the prior release, the major version number will be
* updated.
* Minor – Used to indicate feature set. If a new feature or functionality is
* added beyond what was available in a prior release, the this number
* will be updated.
* Patch – Used to indicate very minor fixes. If the code was modified to fix
* a defect or to improve the quality in any way that does not add new
* functionality or change APIs this version number will be updated.
*
* 1.0 - Original (PSoC Creator 1.0 Beta 5)
* 1.1 - Add checksum option (PSoC Creator 1.0 Production)
* 1.2 - Add support for Multi Application Bootloaders
*
*****************************************************************************/
#define VERSION_MAJOR 0x01
#define VERSION_MINOR 0x02
#define VERSION_PATCH 0x00
#endif