|
|
1.1 root 1: /*
2: * OpenBIOS - free your system!
3: * ( firmware/flash device driver for Linux )
4: *
5: * programming.h - prototypes for flash device programming
6: *
7: * This program is part of a free implementation of the IEEE 1275-1994
8: * Standard for Boot (Initialization Configuration) Firmware.
9: *
10: * Copyright (C) 1998-2004 Stefan Reinauer, <[email protected]>
11: *
12: * This program is free software; you can redistribute it and/or modify
13: * it under the terms of the GNU General Public License as published by
14: * the Free Software Foundation; version 2 of the License.
15: *
16: * This program is distributed in the hope that it will be useful,
17: * but WITHOUT ANY WARRANTY; without even the implied warranty of
18: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19: * GNU General Public License for more details.
20: *
21: * You should have received a copy of the GNU General Public License
22: * along with this program; if not, write to the Free Software
23: * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA, 02110-1301 USA
24: *
25: */
26:
27: /* Addresses */
28: #define ADDR_MANUFACTURER 0x0000
29: #define ADDR_DEVICE_ID 0x0001
30: #define ADDR_SECTOR_LOCK 0x0002
31: #define ADDR_HANDSHAKE 0x0003
32:
33: #define ADDR_UNLOCK_1 0x5555
34: #define ADDR_UNLOCK_2 0x2AAA
35: #define ADDR_COMMAND 0x5555
36:
37: /* Commands */
38: #define CMD_UNLOCK_DATA_1 0xAA
39: #define CMD_UNLOCK_DATA_2 0x55
40: #define CMD_MANUFACTURER_UNLOCK_DATA 0x90
41: #define CMD_UNLOCK_BYPASS_MODE 0x20
42: #define CMD_PROGRAM_UNLOCK_DATA 0xA0
43: #define CMD_RESET_DATA 0xF0
44: #define CMD_SECTOR_ERASE_UNLOCK_DATA 0x80
45: #define CMD_SECTOR_ERASE_UNLOCK_DATA_2 0x30
46: #define CMD_ERASE_DATA 0x10
47: #define CMD_UNLOCK_SECTOR 0x60
48:
49: extern int flashcount;
50:
51: void flash_command(unsigned char *addr, unsigned char command);
52:
53: void flash_program (unsigned char *addr);
54: void flash_program_atmel (unsigned char *addr);
55:
56: int flash_ready_toggle (unsigned char *addr, unsigned int offset);
57: int flash_ready_poll (unsigned char *addr, unsigned int offset, unsigned char data);
58:
59: int flash_erase (unsigned char *addr, unsigned int flashnum);
60: int flash_erase_sectors (unsigned char *addr, unsigned int flashnum,
61: unsigned int startsec, unsigned int endsec);
62:
63: void iflash_program_byte (unsigned char *addr, unsigned int offset, unsigned char data);
64: int iflash_erase_sectors (unsigned char *addr, unsigned int flashnum, unsigned int startsec, unsigned int endsec);
65:
66: unsigned char flash_readb(unsigned char *addr, unsigned int offset);
67: void flash_writeb(unsigned char *addr, unsigned int offset, unsigned char data);
68:
69:
70: int flash_probe_address(void *address);
71: void flash_probe_area(unsigned long romaddr, unsigned long romsize,
72: int map_always);
73:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.