Thank you to anyone who has already donated - your generous donations helped make three months of treatment possible.
My brother Nate continues to fight stage IV Hodgkin's lymphoma. He's just 31, with a wife and baby girl. They have no active income (since he's been unable to return to work), no insurance, and cannot afford the treatment he needs. Nate and his family need your help. Please consider a donation, every dollar helps. Thanks.
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 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 |
DIR_UNCACHED* dir; struct dirent_uncached* entry; int fd; - char pathnamecopy[MAX_PATH]; + int pathnamesize = strlen(pathname) + 1; + char pathnamecopy[pathnamesize]; char* name; struct filedesc* file = NULL; int rc; } #endif - strlcpy(pathnamecopy, pathname, sizeof(pathnamecopy)); + strlcpy(pathnamecopy, pathname, pathnamesize); /* locate filename */ name=strrchr(pathnamecopy+1,'/'); #define LE16_CONST(x) (x)&0xff, ((x)>>8)&0xff #define LE32_CONST(x) (x)&0xff, ((x)>>8)&0xff, ((x)>>16)&0xff, ((x)>>24)&0xff +#if LCD_DEPTH <= 4 +#define BMP_BPP 4 +#define BMP_LINESIZE ((LCD_WIDTH/2 + 3) & ~3) +#elif LCD_DEPTH <= 8 +#define BMP_BPP 8 +#define BMP_LINESIZE ((LCD_WIDTH + 3) & ~3) +#elif LCD_DEPTH <= 16 +#define BMP_BPP 16 +#define BMP_LINESIZE ((LCD_WIDTH*2 + 3) & ~3) +#else +#define BMP_BPP 24 +#define BMP_LINESIZE ((LCD_WIDTH*3 + 3) & ~3) +#endif + #ifdef BOOTLOADER #define screen_dump() #endif /* LCD_DEPTH > 8 */ #endif /* LCD_DEPTH != 16 */ -#if LCD_DEPTH <= 4 -#define BMP_BPP 4 -#define BMP_LINESIZE ((LCD_WIDTH/2 + 3) & ~3) -#elif LCD_DEPTH <= 8 -#define BMP_BPP 8 -#define BMP_LINESIZE ((LCD_WIDTH + 3) & ~3) -#elif LCD_DEPTH <= 16 -#define BMP_BPP 16 -#define BMP_LINESIZE ((LCD_WIDTH*2 + 3) & ~3) -#else -#define BMP_BPP 24 -#define BMP_LINESIZE ((LCD_WIDTH*3 + 3) & ~3) -#endif - #define BMP_HEADERSIZE (54 + 4 * BMP_NUMCOLORS) #define BMP_DATASIZE (BMP_LINESIZE * (LCD_HEIGHT+LCD_SPLIT_LINES)) #define BMP_TOTALSIZE (BMP_HEADERSIZE + BMP_DATASIZE) void screen_dump(void) { int fd, y; - char filename[MAX_PATH]; + char filename[32]; fb_data *src; #if LCD_DEPTH == 1 static struct mutex ftl_mtx; +/* Pages per hyperblock (ftl_nand_type->pagesperblock * ftl_banks) */ +static uint32_t ppb; +/* Reserved hyperblocks (ftl_nand_type->blocks + - ftl_nand_type->userblocks - 0x17) */ +static uint32_t syshyperblocks; + + /* Finds a device info page for the specified bank and returns its number. Used to check if one is present, and to read the lowlevel BBT. */ static uint32_t ftl_find_devinfo(uint32_t bank) DEBUGF("FTL: VFL: Reading page %d\n", vpage); #endif - uint32_t ppb = ftl_nand_type->pagesperblock * ftl_banks; - uint32_t syshyperblocks = ftl_nand_type->blocks - - ftl_nand_type->userblocks - 0x17; uint32_t abspage = vpage + ppb * syshyperblocks; if (abspage >= ftl_nand_type->blocks * ppb || abspage < ppb) { #endif uint32_t i, rc = 0; - uint32_t ppb = ftl_nand_type->pagesperblock * ftl_banks; - uint32_t syshyperblocks = ftl_nand_type->blocks - - ftl_nand_type->userblocks - 0x17; uint32_t abspage = vpage + ppb * syshyperblocks; if (abspage + ftl_banks - 1 >= ftl_nand_type->blocks * ppb || abspage < ppb) { DEBUGF("FTL: VFL: Writing page %d\n", vpage); #endif - uint32_t ppb = ftl_nand_type->pagesperblock * ftl_banks; - uint32_t syshyperblocks = ftl_nand_type->blocks - - ftl_nand_type->userblocks - 0x17; uint32_t abspage = vpage + ppb * syshyperblocks; if (abspage + count > ftl_nand_type->blocks * ppb || abspage < ppb) { return 4; } - uint32_t bank[5]; - uint32_t block[5]; - uint32_t physpage[5]; + static uint32_t bank[5]; + static uint32_t block[5]; + static uint32_t physpage[5]; for (i = 0; i < count; i++, abspage++) { uint8_t bbt[0x410]; #endif - uint32_t syshyperblocks = ftl_nand_type->blocks - - ftl_nand_type->userblocks - 0x18; - for (i = 0; i < ftl_banks; i++) #ifndef FTL_READONLY if (ftl_load_bbt(i, ftl_bbt[i]) == 0) { uint32_t i; uint32_t ret; - uint32_t ppb = ftl_nand_type->pagesperblock * ftl_banks; struct ftl_vfl_cxt_type* cxt = ftl_vfl_get_newest_cxt(); uint32_t ftlcxtblock = 0xffffffff; uint32_t ftl_read(uint32_t sector, uint32_t count, void* buffer) { uint32_t i, j; - uint32_t ppb = ftl_nand_type->pagesperblock * ftl_banks; uint32_t error = 0; #ifdef FTL_TRACE static uint32_t ftl_next_ctrl_pool_page(void) { uint32_t i; - uint32_t ppb = ftl_nand_type->pagesperblock * ftl_banks; if (++ftl_cxt.ftlctrlpage % ppb != 0) return 0; for (i = 0; i < 3; i++) if ((ftl_cxt.ftlctrlblocks[i] + 1) * ppb == ftl_cxt.ftlctrlpage) static uint32_t ftl_copy_page(uint32_t source, uint32_t destination, uint32_t lpn, uint32_t type) { - uint32_t ppb = ftl_nand_type->pagesperblock * ftl_banks; uint32_t rc = ftl_vfl_read(source, ftl_copybuffer[0], &ftl_copyspare[0], 1, 1) & 0x11F; memset(&ftl_copyspare[0], 0xFF, 0x40); static uint32_t ftl_copy_block(uint32_t source, uint32_t destination) { uint32_t i, j; - uint32_t ppb = ftl_nand_type->pagesperblock * ftl_banks; uint32_t error = 0; ftl_cxt.nextblockusn++; for (i = 0; i < ppb; i += FTL_COPYBUF_SIZE) static uint32_t ftl_compact_scattered(struct ftl_log_type* entry) { uint32_t i, j; - uint32_t ppb = ftl_nand_type->pagesperblock * ftl_banks; uint32_t error; struct ftl_log_type backup; if (entry->pagescurrent == 0) static uint32_t ftl_commit_sequential(struct ftl_log_type* entry) { uint32_t i; - uint32_t ppb = ftl_nand_type->pagesperblock * ftl_banks; if (entry->issequential != 1 || entry->pagescurrent != entry->pagesused) static uint32_t ftl_remove_scattered_block(struct ftl_log_type* entry) { uint32_t i; - uint32_t ppb = ftl_nand_type->pagesperblock * ftl_banks; uint32_t age = 0xFFFFFFFF, used = 0; if (entry == NULL) { static uint32_t ftl_commit_cxt(void) { uint32_t i; - uint32_t ppb = ftl_nand_type->pagesperblock * ftl_banks; uint32_t mappages = (ftl_nand_type->userblocks + 0x3ff) >> 10; uint32_t ctrpages = (ftl_nand_type->userblocks + 23 + 0x3ff) >> 10; uint32_t endpage = ftl_cxt.ftlctrlpage + mappages + ctrpages + 1; #ifndef FTL_READONLY /* Swaps the most and least worn block on the flash, - to better distribute wear. It will refuse to do anything + to better distribute wear. It will not do anything if the wear spread is lower than 5 erases. */ static uint32_t ftl_swap_blocks(void) { uint32_t ftl_write(uint32_t sector, uint32_t count, const void* buffer) { uint32_t i, j, k; - uint32_t ppb = ftl_nand_type->pagesperblock * ftl_banks; #ifdef FTL_TRACE DEBUGF("FTL: Writing %d sectors starting at %d\n", count, sector); { uint32_t i; uint32_t rc = 0; - uint32_t ppb = ftl_nand_type->pagesperblock * ftl_banks; if (ftl_cxt.clean_flag == 1) return 0; mutex_lock(&ftl_mtx); for (i = 0; i < 4; i++) if (nand_get_device_type(i) != 0) ftl_banks = i + 1; ftl_nand_type = nand_get_device_type(0); + ppb = ftl_nand_type->pagesperblock * ftl_banks; + syshyperblocks = ftl_nand_type->blocks - ftl_nand_type->userblocks - 0x17; foundsignature = 0; blockwiped = 1; for (i = 0; i < ftl_nand_type->pagesperblock; i++) static int usb_mmc_countdown = 0; #endif -/* FIXME: The extra 0x800 is consumed by fat_mount() when the fsinfo - needs updating */ +/* Make sure there's enough stack space for screendump */ #ifdef USB_FULL_INIT -static long usb_stack[(DEFAULT_STACK_SIZE + 0x800)/sizeof(long)]; +static long usb_stack[(DEFAULT_STACK_SIZE + SECTOR_SIZE + BMP_LINESIZE)/sizeof(long)]; static const char usb_thread_name[] = "usb"; static unsigned int usb_thread_entry = 0; #ifndef USB_STATUS_BY_EVENT |