C8051F32x firmware infrastructure
Sign in or create your account | Project List | Help
C8051F32x firmware infrastructure Git Source Tree
Root/
1 | /* |
2 | * f32x/flash.h - Flash programming and reading |
3 | * |
4 | * Written 2008 by Werner Almesberger |
5 | * Copyright 2008 Werner Almesberger |
6 | * |
7 | * This program is free software; you can redistribute it and/or modify |
8 | * it under the terms of the GNU General Public License as published by |
9 | * the Free Software Foundation; either version 2 of the License, or |
10 | * (at your option) any later version. |
11 | */ |
12 | |
13 | |
14 | #ifndef FLASH_H |
15 | #define FLASH_H |
16 | |
17 | #include <sys/types.h> |
18 | |
19 | |
20 | #define FPCTL 0x02 |
21 | #define FPDAT 0xb4 |
22 | |
23 | #define FLASH_INIT_MAGIC1 0x02 |
24 | #define FLASH_INIT_MAGIC2 0x01 |
25 | |
26 | #define FLASH_ERASE_MAGIC1 0xde |
27 | #define FLASH_ERASE_MAGIC2 0xad |
28 | #define FLASH_ERASE_MAGIC3 0xa5 |
29 | |
30 | #define FLASH_DEVICE_ERASE 0x03 |
31 | #define FLASH_BLOCK_READ 0x06 |
32 | #define FLASH_BLOCK_WRITE 0x07 |
33 | #define FLASH_PAGE_ERASE 0x08 |
34 | #define REG_READ 0x09 |
35 | #define REG_WRITE 0x0a |
36 | |
37 | #define FLASH_STATUS_OK 0x0d |
38 | |
39 | #define InBusy (1 << 1) |
40 | #define OutReady (1 << 0) |
41 | |
42 | |
43 | void flash_device_erase(void); |
44 | void flash_block_write(uint16_t addr, const void *data, size_t size); |
45 | void flash_block_read(uint16_t addr, void *data, size_t size); |
46 | void flash_init(void); |
47 | |
48 | /* @@@ doesn't really seem to work */ |
49 | |
50 | uint8_t fp_reg_read(uint8_t addr); |
51 | void fp_reg_write(uint8_t addr, uint8_t value); |
52 | |
53 | #endif /* !FLASH_H */ |
54 |
Branches:
master