-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUPDI_cmd.h
79 lines (57 loc) · 1.89 KB
/
UPDI_cmd.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
/*
UPDI_cmd.h
This is part of c_updi, programmer
Copyright (C) 2020 Peter Popovec, popovec.peter@gmail.com
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/>.
UPDI high level commands
*/
#ifndef __UPDI_cmd__
#define __UPDI_cmd__
#include <stdint.h>
// -1 error
// 0 to 255 normal return value
int UPDI_cmd_LDCS (uint8_t addr);
// -1 error
// 0 OK
//
int UPDI_cmd_STCS (uint8_t addr, uint8_t data);
// store pointer to UPDI (variants for 24/16 bit UPDI)
// 0 OK
int cmd_ST16_to_PTR (uint32_t addr);
int cmd_ST24_to_PTR (uint32_t addr);
// -1 error
// 0 OK
//
int UPDI_cmd_LD_BYTE (uint8_t * buffer, int count);
// -1 error
// 0 OK
//
int UPDI_cmd_ST_BYTE (uint8_t * buffer, int count);
int UPDI_cmd_ST_BYTE_RSD (uint8_t * buffer, int count);
int UPDI_cmd_ST_WORD_RSD (uint8_t * buffer, int count);
// -1 transaction error
// 0 OK
// 1 timeout
int UPDI_do_SYSTEM_RESET ();
// test (mask) in ASI Key Status (UPDI register 7), if key is not accepted
// send key (repeat, then tiemout)
// 0 OK
// -1 fatal error (transaction, key too long etc.)
// 1 timeout
int UPDI_cmd_KEY (uint8_t *key,uint8_t size,uint8_t mask);
int UPDI_cmd_KEY_NVM_PROG ();
int UPDI_cmd_KEY_CHIP_ERASE ();
int UPDI_cmd_KEY_USERROW ();
// read SIB into buffer
int UPDI_cmd_READ_SIB (uint8_t * buffer);
int UPDI_NVM_enable ();
#endif