File: isp_commands.h

package info (click to toggle)
lpctools 1.07-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 240 kB
  • sloc: ansic: 2,075; makefile: 41
file content (124 lines) | stat: -rw-r--r-- 3,523 bytes parent folder | download | duplicates (2)
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
/*********************************************************************
 *
 *   LPC ISP Commands
 *
 *
 *  Copyright (C) 2012 Nathael Pajani <nathael.pajani@nathael.net>
 *
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 *********************************************************************/

#ifndef ISP_COMMANDS_H
#define ISP_COMMANDS_H


extern char* error_codes[];

#define CMD_SUCCESS 0
#define INVALID_COMMAND 1
#define SRC_ADDR_ERROR 2
#define DST_ADDR_ERROR 3
#define SRC_ADDR_NOT_MAPPED 4
#define DST_ADDR_NOT_MAPPED 5
#define COUNT_ERROR 6
#define INVALID_SECTOR 7
#define SECTOR_NOT_BLANK 8
#define SECTOR_NOT_PREPARED_FOR_WRITE_OPERATION 9
#define COMPARE_ERROR 10
#define BUSY 11
#define PARAM_ERROR 12
#define ADDR_ERROR 13
#define ADDR_NOT_MAPPED 14
#define CMD_LOCKED 15
#define INVALID_CODE 16
#define INVALID_BAUD_RATE 17
#define INVALID_STOP_BIT 18
#define CODE_READ_PROTECTION_ENABLED 19


/* Connect or reconnect to the target.
 * Return positive or NULL value when connection is OK, or negative value otherwise.
 */
int isp_connect(unsigned int crystal_freq, int quiet);


/*
 * Helper functions
 */
int isp_send_cmd_no_args(char* cmd_name, char* cmd, int quiet);
int isp_send_cmd_two_args(char* cmd_name, char cmd, unsigned int arg1, unsigned int arg2);
int isp_send_cmd_address(char cmd, uint32_t addr1, uint32_t addr2, uint32_t length, char* name);
int isp_send_cmd_sectors(char* name, char cmd, int first_sector, int last_sector, int quiet);


int isp_cmd_unlock(int quiet);

int isp_cmd_read_uid(void);

int isp_cmd_part_id(int quiet);

int isp_cmd_boot_version(void);

/*
 * read-memory
 * aruments : address count file
 * read 'count' bytes from 'address', store then in 'file'
 */
int isp_cmd_read_memory(int arg_count, char** args);
/*
 * perform read-memory operation
 * read 'count' bytes from 'addr' to 'data' buffer
 */
int isp_read_memory(char* data, uint32_t addr, unsigned int count, unsigned int uuencoded);

/*
 * write-to-ram
 * aruments : address file
 * send 'file' to 'address' in ram
 */
int isp_cmd_write_to_ram(int arg_count, char** args);
/*
 * perform write-to-ram operation
 * send 'count' bytes from 'data' to 'addr' in RAM
 */
int isp_send_buf_to_ram(char* data, unsigned long int addr, unsigned int count, unsigned int perform_uuencode);


int isp_cmd_compare(int arg_count, char** args);

int isp_cmd_copy_ram_to_flash(int arg_count, char** args);

/*
 * go
 * aruments : address mode
 * execute program at 'address' (> 0x200) in 'mode' ('arm' or 'thumb')
 */
int isp_cmd_go(int arg_count, char** args);
/*
 * perform go operation
 * start user program at 'addr' in 'mode'
 * mode is 'T' for thumb or 'A' for arm.
 */
int isp_send_cmd_go(uint32_t addr, char mode);

int isp_cmd_blank_check(int arg_count, char** args);

int isp_cmd_prepare_for_write(int arg_count, char** args);

int isp_cmd_erase(int arg_count, char** args);


#endif /* ISP_COMMANDS_H */