diff options
author | Solomon Peachy <pizza@shaftnet.org> | 2020-07-15 19:40:55 -0400 |
---|---|---|
committer | Solomon Peachy <pizza@shaftnet.org> | 2020-07-24 21:20:13 +0000 |
commit | 092c340a2062fa98b7387fc5fd63578ddae7d0b6 (patch) | |
tree | 98ec96946eeb2ae709cb0528cc6998e21bb9b290 /flash/uart_boot/flash.c | |
parent | 17f7cc92c258bc456a27c3e7c5a19c9409851879 (diff) | |
download | rockbox-092c340a2062fa98b7387fc5fd63578ddae7d0b6.tar.gz rockbox-092c340a2062fa98b7387fc5fd63578ddae7d0b6.zip |
[1/4] Remove SH support and all archos targets
This removes all code specific to SH targets
Change-Id: I7980523785d2596e65c06430f4638eec74a06061
Diffstat (limited to 'flash/uart_boot/flash.c')
-rw-r--r-- | flash/uart_boot/flash.c | 78 |
1 files changed, 0 insertions, 78 deletions
diff --git a/flash/uart_boot/flash.c b/flash/uart_boot/flash.c deleted file mode 100644 index 854de20454..0000000000 --- a/flash/uart_boot/flash.c +++ /dev/null | |||
@@ -1,78 +0,0 @@ | |||
1 | // flash.cpp : higher-level functions for flashing the chip | ||
2 | // | ||
3 | |||
4 | #include "scalar_types.h" // (U)INT8/16/32 | ||
5 | #include "Uart.h" // platform abstraction for UART | ||
6 | #include "client.h" // client functions | ||
7 | |||
8 | |||
9 | // read the manufacturer and device ID | ||
10 | int ReadID(tUartHandle serial_handle, UINT32 base, UINT8* pManufacturerID, UINT8* pDeviceID) | ||
11 | { | ||
12 | base &= 0xFFF80000; // round down to 512k align, to make shure | ||
13 | |||
14 | WriteByte(serial_handle, base + 0x5555, 0xAA); // enter command mode | ||
15 | WriteByte(serial_handle, base + 0x2AAA, 0x55); | ||
16 | WriteByte(serial_handle, base + 0x5555, 0x90); // ID command | ||
17 | SLEEP(20); // Atmel wants 20ms pause here | ||
18 | |||
19 | *pManufacturerID = ReadByte(serial_handle, base + 0); | ||
20 | *pDeviceID = ReadByte(serial_handle, base + 1); | ||
21 | |||
22 | WriteByte(serial_handle, base + 0, 0xF0); // reset flash (back to normal read mode) | ||
23 | SLEEP(20); // Atmel wants 20ms pause here | ||
24 | |||
25 | return 0; | ||
26 | } | ||
27 | |||
28 | |||
29 | // erase the sector which contains the given address | ||
30 | int EraseSector(tUartHandle serial_handle, UINT32 address) | ||
31 | { | ||
32 | UINT32 base = address & 0xFFF80000; // round down to 512k align | ||
33 | |||
34 | WriteByte(serial_handle, base + 0x5555, 0xAA); // enter command mode | ||
35 | WriteByte(serial_handle, base + 0x2AAA, 0x55); | ||
36 | WriteByte(serial_handle, base + 0x5555, 0x80); // eraze command | ||
37 | WriteByte(serial_handle, base + 0x5555, 0xAA); // enter command mode | ||
38 | WriteByte(serial_handle, base + 0x2AAA, 0x55); | ||
39 | WriteByte(serial_handle, address, 0x30); // eraze the sector | ||
40 | SLEEP(25); // sector eraze time: 25ms | ||
41 | |||
42 | return 0; | ||
43 | } | ||
44 | |||
45 | |||
46 | // erase the whole flash | ||
47 | int EraseChip(tUartHandle serial_handle, UINT32 base) | ||
48 | { | ||
49 | base &= 0xFFF80000; // round down to 512k align, to make shure | ||
50 | |||
51 | WriteByte(serial_handle, base + 0x5555, 0xAA); // enter command mode | ||
52 | WriteByte(serial_handle, base + 0x2AAA, 0x55); | ||
53 | WriteByte(serial_handle, base + 0x5555, 0x80); // eraze command | ||
54 | WriteByte(serial_handle, base + 0x5555, 0xAA); // enter command mode | ||
55 | WriteByte(serial_handle, base + 0x2AAA, 0x55); | ||
56 | WriteByte(serial_handle, base + 0x5555, 0x10); // chip eraze command | ||
57 | SLEEP(100); // chip eraze time: 100ms | ||
58 | |||
59 | return 0; | ||
60 | } | ||
61 | |||
62 | |||
63 | // program a bunch of bytes "by hand" | ||
64 | int ProgramBytes(tUartHandle serial_handle, UINT32 address, UINT8* pData, UINT32 size) | ||
65 | { | ||
66 | UINT32 base = address & 0xFFF80000; // round down to 512k align | ||
67 | |||
68 | while (size--) | ||
69 | { | ||
70 | WriteByte(serial_handle, base + 0x5555, 0xAA); // enter command mode | ||
71 | WriteByte(serial_handle, base + 0x2AAA, 0x55); | ||
72 | WriteByte(serial_handle, base + 0x5555, 0xA0); // byte program command | ||
73 | WriteByte(serial_handle, address++, *pData++); | ||
74 | // UART protocol is slow enough such that I don't have to wait 20us here | ||
75 | } | ||
76 | return 0; | ||
77 | } | ||
78 | |||