diff options
author | Aidan MacDonald <amachronic@protonmail.com> | 2022-12-19 21:46:52 +0000 |
---|---|---|
committer | Aidan MacDonald <amachronic@protonmail.com> | 2022-12-23 19:54:18 +0000 |
commit | ba010851fafea3da0d0655b103158f0a9efe6406 (patch) | |
tree | bb26879ee1ac5e2d578948701b20c1bb33db14a9 /lib/x1000-installer/test_lib/nand-x1000.h | |
parent | 6e794c9a2d9e91a926f70d0fcc66e255b0bdc221 (diff) | |
download | rockbox-ba010851fafea3da0d0655b103158f0a9efe6406.tar.gz rockbox-ba010851fafea3da0d0655b103158f0a9efe6406.zip |
Remove lib/x1000-installer
Carrying this library is somewhat of a maintenance burden because
some Rockbox APIs are mocked or duplicated in the test suite and
thus need to be fixed up when refactoring.
It's also unused & incomplete, so there's no good reason to keep
it in tree any more.
Change-Id: If39c62744b4edc0d81b1b6608ee5df69430e6581
Diffstat (limited to 'lib/x1000-installer/test_lib/nand-x1000.h')
-rw-r--r-- | lib/x1000-installer/test_lib/nand-x1000.h | 112 |
1 files changed, 0 insertions, 112 deletions
diff --git a/lib/x1000-installer/test_lib/nand-x1000.h b/lib/x1000-installer/test_lib/nand-x1000.h deleted file mode 100644 index f34f2ce026..0000000000 --- a/lib/x1000-installer/test_lib/nand-x1000.h +++ /dev/null | |||
@@ -1,112 +0,0 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2021 Aidan MacDonald | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU General Public License | ||
14 | * as published by the Free Software Foundation; either version 2 | ||
15 | * of the License, or (at your option) any later version. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | |||
22 | /* Stripped down fake version of X1000 NAND API for testing purposes, | ||
23 | * uses a normal file to store the data */ | ||
24 | |||
25 | #ifndef __NAND_X1000_H__ | ||
26 | #define __NAND_X1000_H__ | ||
27 | |||
28 | #include <stdint.h> | ||
29 | #include <stddef.h> | ||
30 | #include <stdbool.h> | ||
31 | |||
32 | #define NAND_SUCCESS 0 | ||
33 | #define NAND_ERR_UNKNOWN_CHIP (-1) | ||
34 | #define NAND_ERR_PROGRAM_FAIL (-2) | ||
35 | #define NAND_ERR_ERASE_FAIL (-3) | ||
36 | #define NAND_ERR_UNALIGNED (-4) | ||
37 | #define NAND_ERR_OTHER (-5) | ||
38 | #define NAND_ERR_INJECTED (-6) | ||
39 | |||
40 | /* keep max page size in sync with the NAND chip table in the .c file */ | ||
41 | #define NAND_DRV_SCRATCHSIZE 32 | ||
42 | #define NAND_DRV_MAXPAGESIZE 2112 | ||
43 | |||
44 | typedef uint32_t nand_block_t; | ||
45 | typedef uint32_t nand_page_t; | ||
46 | |||
47 | enum nand_trace_type { | ||
48 | NTT_READ, | ||
49 | NTT_PROGRAM, | ||
50 | NTT_ERASE, | ||
51 | }; | ||
52 | |||
53 | enum nand_trace_exception { | ||
54 | NTE_NONE, | ||
55 | NTE_DOUBLE_PROGRAMMED, | ||
56 | NTE_CLEARED, | ||
57 | }; | ||
58 | |||
59 | struct nand_trace { | ||
60 | enum nand_trace_type type; | ||
61 | enum nand_trace_exception exception; | ||
62 | nand_page_t addr; | ||
63 | }; | ||
64 | |||
65 | typedef struct nand_chip { | ||
66 | /* Base2 logarithm of the number of pages per block */ | ||
67 | unsigned log2_ppb; | ||
68 | |||
69 | /* Size of a page's main / oob areas, in bytes. */ | ||
70 | unsigned page_size; | ||
71 | unsigned oob_size; | ||
72 | |||
73 | /* Total number of blocks in the chip */ | ||
74 | unsigned nr_blocks; | ||
75 | } nand_chip; | ||
76 | |||
77 | typedef struct nand_drv { | ||
78 | /* Backing file */ | ||
79 | int fd; | ||
80 | int metafd; | ||
81 | int lock_count; | ||
82 | |||
83 | unsigned refcount; | ||
84 | uint8_t* scratch_buf; | ||
85 | uint8_t* page_buf; | ||
86 | const nand_chip* chip; | ||
87 | unsigned ppb; | ||
88 | unsigned fpage_size; | ||
89 | } nand_drv; | ||
90 | |||
91 | extern const char* nand_backing_file; | ||
92 | extern const char* nand_meta_file; | ||
93 | |||
94 | extern struct nand_trace* nand_trace; | ||
95 | extern size_t nand_trace_capacity; | ||
96 | extern size_t nand_trace_length; | ||
97 | |||
98 | extern void nand_trace_reset(size_t size); | ||
99 | extern void nand_inject_error(int rc); | ||
100 | |||
101 | extern nand_drv* nand_init(void); | ||
102 | |||
103 | extern void nand_lock(nand_drv* drv); | ||
104 | extern void nand_unlock(nand_drv* drv); | ||
105 | |||
106 | extern int nand_open(nand_drv* drv); | ||
107 | extern void nand_close(nand_drv* drv); | ||
108 | extern int nand_block_erase(nand_drv* drv, nand_block_t block); | ||
109 | extern int nand_page_program(nand_drv* drv, nand_page_t page, const void* buffer); | ||
110 | extern int nand_page_read(nand_drv* drv, nand_page_t page, void* buffer); | ||
111 | |||
112 | #endif /* __NAND_X1000_H__ */ | ||