ZuluSCSI_platform.cpp 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546
  1. #include "ZuluSCSI_platform.h"
  2. #include "gd32f20x_sdio.h"
  3. #include "gd32f20x_fmc.h"
  4. #include "ZuluSCSI_log.h"
  5. #include "ZuluSCSI_config.h"
  6. #include "greenpak.h"
  7. #include <SdFat.h>
  8. #include <scsi.h>
  9. #include <assert.h>
  10. extern "C" {
  11. const char *g_azplatform_name = PLATFORM_NAME;
  12. static bool g_enable_apple_quirks = false;
  13. /*************************/
  14. /* Timing functions */
  15. /*************************/
  16. static volatile uint32_t g_millisecond_counter;
  17. static volatile uint32_t g_watchdog_timeout;
  18. static uint32_t g_ns_to_cycles; // Q0.32 fixed point format
  19. static void watchdog_handler(uint32_t *sp);
  20. unsigned long millis()
  21. {
  22. return g_millisecond_counter;
  23. }
  24. void delay(unsigned long ms)
  25. {
  26. uint32_t start = g_millisecond_counter;
  27. while ((uint32_t)(g_millisecond_counter - start) < ms);
  28. }
  29. void delay_ns(unsigned long ns)
  30. {
  31. uint32_t CNT_start = DWT->CYCCNT;
  32. if (ns <= 100) return; // Approximate call overhead
  33. ns -= 100;
  34. uint32_t cycles = ((uint64_t)ns * g_ns_to_cycles) >> 32;
  35. while ((uint32_t)(DWT->CYCCNT - CNT_start) < cycles);
  36. }
  37. void SysTick_Handler_inner(uint32_t *sp)
  38. {
  39. g_millisecond_counter++;
  40. if (g_watchdog_timeout > 0)
  41. {
  42. g_watchdog_timeout--;
  43. const uint32_t busreset_time = WATCHDOG_CRASH_TIMEOUT - WATCHDOG_BUS_RESET_TIMEOUT;
  44. if (g_watchdog_timeout <= busreset_time)
  45. {
  46. if (!scsiDev.resetFlag)
  47. {
  48. azlog("WATCHDOG TIMEOUT at PC ", sp[6], " LR ", sp[5], " attempting bus reset");
  49. scsiDev.resetFlag = 1;
  50. }
  51. if (g_watchdog_timeout == 0)
  52. {
  53. watchdog_handler(sp);
  54. }
  55. }
  56. }
  57. }
  58. __attribute__((interrupt, naked))
  59. void SysTick_Handler(void)
  60. {
  61. // Take note of stack pointer so that we can print debug
  62. // info in watchdog handler.
  63. asm("mrs r0, msp\n"
  64. "b SysTick_Handler_inner": : : "r0");
  65. }
  66. /***************/
  67. /* GPIO init */
  68. /***************/
  69. // Initialize SPI and GPIO configuration
  70. // Clock has already been initialized by system_gd32f20x.c
  71. void azplatform_init()
  72. {
  73. SystemCoreClockUpdate();
  74. // Enable SysTick to drive millis()
  75. g_millisecond_counter = 0;
  76. SysTick_Config(SystemCoreClock / 1000U);
  77. NVIC_SetPriority(SysTick_IRQn, 0x00U);
  78. // Enable DWT counter to drive delay_ns()
  79. g_ns_to_cycles = ((uint64_t)SystemCoreClock << 32) / 1000000000;
  80. CoreDebug->DEMCR |= CoreDebug_DEMCR_TRCENA_Msk;
  81. DWT->CTRL |= DWT_CTRL_CYCCNTENA_Msk;
  82. // Enable debug output on SWO pin
  83. DBG_CTL |= DBG_CTL_TRACE_IOEN;
  84. if (TPI->ACPR == 0)
  85. {
  86. CoreDebug->DEMCR |= CoreDebug_DEMCR_TRCENA_Msk;
  87. TPI->ACPR = SystemCoreClock / 2000000 - 1; // 2 Mbps baudrate for SWO
  88. // TPI->ACPR = SystemCoreClock / 30000000 - 1; // 30 Mbps baudrate for SWO
  89. TPI->SPPR = 2;
  90. TPI->FFCR = 0x100; // TPIU packet framing disabled
  91. // DWT->CTRL |= (1 << DWT_CTRL_EXCTRCENA_Pos);
  92. // DWT->CTRL |= (1 << DWT_CTRL_CYCTAP_Pos)
  93. // | (15 << DWT_CTRL_POSTPRESET_Pos)
  94. // | (1 << DWT_CTRL_PCSAMPLENA_Pos)
  95. // | (3 << DWT_CTRL_SYNCTAP_Pos)
  96. // | (1 << DWT_CTRL_CYCCNTENA_Pos);
  97. ITM->LAR = 0xC5ACCE55;
  98. ITM->TCR = (1 << ITM_TCR_DWTENA_Pos)
  99. | (1 << ITM_TCR_SYNCENA_Pos)
  100. | (1 << ITM_TCR_ITMENA_Pos);
  101. ITM->TER = 0xFFFFFFFF; // Enable all stimulus ports
  102. }
  103. // Enable needed clocks for GPIO
  104. rcu_periph_clock_enable(RCU_AF);
  105. rcu_periph_clock_enable(RCU_GPIOA);
  106. rcu_periph_clock_enable(RCU_GPIOB);
  107. rcu_periph_clock_enable(RCU_GPIOC);
  108. rcu_periph_clock_enable(RCU_GPIOD);
  109. rcu_periph_clock_enable(RCU_GPIOE);
  110. // Switch to SWD debug port (disable JTAG) to release PB4 as GPIO
  111. gpio_pin_remap_config(GPIO_SWJ_SWDPENABLE_REMAP, ENABLE);
  112. // SCSI pins.
  113. // Initialize open drain outputs to high.
  114. SCSI_RELEASE_OUTPUTS();
  115. gpio_init(SCSI_OUT_PORT, GPIO_MODE_OUT_PP, GPIO_OSPEED_50MHZ, SCSI_OUT_DATA_MASK | SCSI_OUT_REQ);
  116. gpio_init(SCSI_OUT_IO_PORT, GPIO_MODE_OUT_PP, GPIO_OSPEED_50MHZ, SCSI_OUT_IO_PIN);
  117. gpio_init(SCSI_OUT_CD_PORT, GPIO_MODE_OUT_PP, GPIO_OSPEED_50MHZ, SCSI_OUT_CD_PIN);
  118. gpio_init(SCSI_OUT_SEL_PORT, GPIO_MODE_OUT_PP, GPIO_OSPEED_50MHZ, SCSI_OUT_SEL_PIN);
  119. gpio_init(SCSI_OUT_MSG_PORT, GPIO_MODE_OUT_PP, GPIO_OSPEED_50MHZ, SCSI_OUT_MSG_PIN);
  120. gpio_init(SCSI_OUT_RST_PORT, GPIO_MODE_OUT_PP, GPIO_OSPEED_50MHZ, SCSI_OUT_RST_PIN);
  121. gpio_init(SCSI_OUT_BSY_PORT, GPIO_MODE_OUT_PP, GPIO_OSPEED_50MHZ, SCSI_OUT_BSY_PIN);
  122. gpio_init(SCSI_IN_PORT, GPIO_MODE_IN_FLOATING, 0, SCSI_IN_MASK);
  123. gpio_init(SCSI_ATN_PORT, GPIO_MODE_IN_FLOATING, 0, SCSI_ATN_PIN);
  124. gpio_init(SCSI_BSY_PORT, GPIO_MODE_IN_FLOATING, 0, SCSI_BSY_PIN);
  125. gpio_init(SCSI_SEL_PORT, GPIO_MODE_IN_FLOATING, 0, SCSI_SEL_PIN);
  126. gpio_init(SCSI_ACK_PORT, GPIO_MODE_IN_FLOATING, 0, SCSI_ACK_PIN);
  127. gpio_init(SCSI_RST_PORT, GPIO_MODE_IN_FLOATING, 0, SCSI_RST_PIN);
  128. // Terminator enable
  129. gpio_bit_set(SCSI_TERM_EN_PORT, SCSI_TERM_EN_PIN);
  130. gpio_init(SCSI_TERM_EN_PORT, GPIO_MODE_OUT_PP, GPIO_OSPEED_2MHZ, SCSI_TERM_EN_PIN);
  131. #ifndef SD_USE_SDIO
  132. // SD card pins using SPI
  133. gpio_init(SD_PORT, GPIO_MODE_OUT_PP, GPIO_OSPEED_50MHZ, SD_CS_PIN);
  134. gpio_init(SD_PORT, GPIO_MODE_AF_PP, GPIO_OSPEED_50MHZ, SD_CLK_PIN);
  135. gpio_init(SD_PORT, GPIO_MODE_IPU, 0, SD_MISO_PIN);
  136. gpio_init(SD_PORT, GPIO_MODE_AF_PP, GPIO_OSPEED_50MHZ, SD_MOSI_PIN);
  137. #else
  138. // SD card pins using SDIO
  139. gpio_init(SD_SDIO_DATA_PORT, GPIO_MODE_AF_PP, GPIO_OSPEED_50MHZ, SD_SDIO_D0 | SD_SDIO_D1 | SD_SDIO_D2 | SD_SDIO_D3);
  140. gpio_init(SD_SDIO_CLK_PORT, GPIO_MODE_AF_PP, GPIO_OSPEED_50MHZ, SD_SDIO_CLK);
  141. gpio_init(SD_SDIO_CMD_PORT, GPIO_MODE_AF_PP, GPIO_OSPEED_50MHZ, SD_SDIO_CMD);
  142. #endif
  143. // DIP switches
  144. gpio_init(DIP_PORT, GPIO_MODE_IPD, 0, DIPSW1_PIN | DIPSW2_PIN | DIPSW3_PIN);
  145. // LED pins
  146. gpio_bit_set(LED_PORT, LED_PINS);
  147. gpio_init(LED_PORT, GPIO_MODE_OUT_PP, GPIO_OSPEED_2MHZ, LED_PINS);
  148. // SWO trace pin on PB3
  149. gpio_init(GPIOB, GPIO_MODE_AF_PP, GPIO_OSPEED_50MHZ, GPIO_PIN_3);
  150. }
  151. void azplatform_late_init()
  152. {
  153. if (gpio_input_bit_get(DIP_PORT, DIPSW3_PIN))
  154. {
  155. azlog("DIPSW3 is ON: Enabling SCSI termination");
  156. gpio_bit_reset(SCSI_TERM_EN_PORT, SCSI_TERM_EN_PIN);
  157. }
  158. else
  159. {
  160. azlog("DIPSW3 is OFF: SCSI termination disabled");
  161. }
  162. if (gpio_input_bit_get(DIP_PORT, DIPSW2_PIN))
  163. {
  164. azlog("DIPSW2 is ON: enabling debug messages");
  165. g_azlog_debug = true;
  166. }
  167. else
  168. {
  169. g_azlog_debug = false;
  170. }
  171. if (gpio_input_bit_get(DIP_PORT, DIPSW1_PIN))
  172. {
  173. azlog("DIPSW1 is ON: enabling Apple quirks by default");
  174. g_enable_apple_quirks = true;
  175. }
  176. greenpak_load_firmware();
  177. }
  178. /*****************************************/
  179. /* Crash handlers */
  180. /*****************************************/
  181. extern SdFs SD;
  182. // Writes log data to the PB3 SWO pin
  183. void azplatform_log(const char *s)
  184. {
  185. while (*s)
  186. {
  187. // Write to SWO pin
  188. while (ITM->PORT[0].u32 == 0);
  189. ITM->PORT[0].u8 = *s++;
  190. }
  191. }
  192. void azplatform_emergency_log_save()
  193. {
  194. azplatform_set_sd_callback(NULL, NULL);
  195. SD.begin(SD_CONFIG_CRASH);
  196. FsFile crashfile = SD.open(CRASHFILE, O_WRONLY | O_CREAT | O_TRUNC);
  197. if (!crashfile.isOpen())
  198. {
  199. // Try to reinitialize
  200. int max_retry = 10;
  201. while (max_retry-- > 0 && !SD.begin(SD_CONFIG_CRASH));
  202. crashfile = SD.open(CRASHFILE, O_WRONLY | O_CREAT | O_TRUNC);
  203. }
  204. uint32_t startpos = 0;
  205. crashfile.write(azlog_get_buffer(&startpos));
  206. crashfile.write(azlog_get_buffer(&startpos));
  207. crashfile.flush();
  208. crashfile.close();
  209. }
  210. extern uint32_t _estack;
  211. __attribute__((noinline))
  212. void show_hardfault(uint32_t *sp)
  213. {
  214. uint32_t pc = sp[6];
  215. uint32_t lr = sp[5];
  216. uint32_t cfsr = SCB->CFSR;
  217. azlog("--------------");
  218. azlog("CRASH!");
  219. azlog("Platform: ", g_azplatform_name);
  220. azlog("FW Version: ", g_azlog_firmwareversion);
  221. azlog("CFSR: ", cfsr);
  222. azlog("SP: ", (uint32_t)sp);
  223. azlog("PC: ", pc);
  224. azlog("LR: ", lr);
  225. azlog("R0: ", sp[0]);
  226. azlog("R1: ", sp[1]);
  227. azlog("R2: ", sp[2]);
  228. azlog("R3: ", sp[3]);
  229. uint32_t *p = (uint32_t*)((uint32_t)sp & ~3);
  230. for (int i = 0; i < 8; i++)
  231. {
  232. if (p == &_estack) break; // End of stack
  233. azlog("STACK ", (uint32_t)p, ": ", p[0], " ", p[1], " ", p[2], " ", p[3]);
  234. p += 4;
  235. }
  236. azplatform_emergency_log_save();
  237. while (1)
  238. {
  239. // Flash the crash address on the LED
  240. // Short pulse means 0, long pulse means 1
  241. int base_delay = 1000;
  242. for (int i = 31; i >= 0; i--)
  243. {
  244. LED_OFF();
  245. for (int j = 0; j < base_delay; j++) delay_ns(100000);
  246. int delay = (pc & (1 << i)) ? (3 * base_delay) : base_delay;
  247. LED_ON();
  248. for (int j = 0; j < delay; j++) delay_ns(100000);
  249. LED_OFF();
  250. }
  251. for (int j = 0; j < base_delay * 10; j++) delay_ns(100000);
  252. }
  253. }
  254. __attribute__((naked, interrupt))
  255. void HardFault_Handler(void)
  256. {
  257. // Copies stack pointer into first argument
  258. asm("mrs r0, msp\n"
  259. "b show_hardfault": : : "r0");
  260. }
  261. __attribute__((naked, interrupt))
  262. void MemManage_Handler(void)
  263. {
  264. asm("mrs r0, msp\n"
  265. "b show_hardfault": : : "r0");
  266. }
  267. __attribute__((naked, interrupt))
  268. void BusFault_Handler(void)
  269. {
  270. asm("mrs r0, msp\n"
  271. "b show_hardfault": : : "r0");
  272. }
  273. __attribute__((naked, interrupt))
  274. void UsageFault_Handler(void)
  275. {
  276. asm("mrs r0, msp\n"
  277. "b show_hardfault": : : "r0");
  278. }
  279. void __assert_func(const char *file, int line, const char *func, const char *expr)
  280. {
  281. uint32_t dummy = 0;
  282. azlog("--------------");
  283. azlog("ASSERT FAILED!");
  284. azlog("Platform: ", g_azplatform_name);
  285. azlog("FW Version: ", g_azlog_firmwareversion);
  286. azlog("Assert failed: ", file , ":", line, " in ", func, ":", expr);
  287. uint32_t *p = (uint32_t*)((uint32_t)&dummy & ~3);
  288. for (int i = 0; i < 8; i++)
  289. {
  290. if (p == &_estack) break; // End of stack
  291. azlog("STACK ", (uint32_t)p, ": ", p[0], " ", p[1], " ", p[2], " ", p[3]);
  292. p += 4;
  293. }
  294. azplatform_emergency_log_save();
  295. while(1)
  296. {
  297. LED_OFF();
  298. for (int j = 0; j < 1000; j++) delay_ns(100000);
  299. LED_ON();
  300. for (int j = 0; j < 1000; j++) delay_ns(100000);
  301. }
  302. }
  303. } /* extern "C" */
  304. static void watchdog_handler(uint32_t *sp)
  305. {
  306. azlog("-------------- WATCHDOG TIMEOUT");
  307. show_hardfault(sp);
  308. }
  309. void azplatform_reset_watchdog()
  310. {
  311. // This uses a software watchdog based on systick timer interrupt.
  312. // It gives us opportunity to collect better debug info than the
  313. // full hardware reset that would be caused by hardware watchdog.
  314. g_watchdog_timeout = WATCHDOG_CRASH_TIMEOUT;
  315. }
  316. /***********************/
  317. /* Flash reprogramming */
  318. /***********************/
  319. bool azplatform_rewrite_flash_page(uint32_t offset, uint8_t buffer[AZPLATFORM_FLASH_PAGE_SIZE])
  320. {
  321. if (offset == 0)
  322. {
  323. if (buffer[3] != 0x20 || buffer[7] != 0x08)
  324. {
  325. azlog("Invalid firmware file, starts with: ", bytearray(buffer, 16));
  326. return false;
  327. }
  328. }
  329. azdbg("Writing flash at offset ", offset, " data ", bytearray(buffer, 4));
  330. assert(offset % AZPLATFORM_FLASH_PAGE_SIZE == 0);
  331. assert(offset >= AZPLATFORM_BOOTLOADER_SIZE);
  332. fmc_unlock();
  333. fmc_bank0_unlock();
  334. fmc_state_enum status;
  335. status = fmc_page_erase(FLASH_BASE + offset);
  336. if (status != FMC_READY)
  337. {
  338. azlog("Erase failed: ", (int)status);
  339. return false;
  340. }
  341. uint32_t *buf32 = (uint32_t*)buffer;
  342. uint32_t num_words = AZPLATFORM_FLASH_PAGE_SIZE / 4;
  343. for (int i = 0; i < num_words; i++)
  344. {
  345. status = fmc_word_program(FLASH_BASE + offset + i * 4, buf32[i]);
  346. if (status != FMC_READY)
  347. {
  348. azlog("Flash write failed: ", (int)status);
  349. return false;
  350. }
  351. }
  352. fmc_lock();
  353. for (int i = 0; i < num_words; i++)
  354. {
  355. uint32_t expected = buf32[i];
  356. uint32_t actual = *(volatile uint32_t*)(FLASH_BASE + offset + i * 4);
  357. if (actual != expected)
  358. {
  359. azlog("Flash verify failed at offset ", offset + i * 4, " got ", actual, " expected ", expected);
  360. return false;
  361. }
  362. }
  363. return true;
  364. }
  365. void azplatform_boot_to_main_firmware()
  366. {
  367. uint32_t *mainprogram_start = (uint32_t*)(0x08000000 + AZPLATFORM_BOOTLOADER_SIZE);
  368. SCB->VTOR = (uint32_t)mainprogram_start;
  369. __asm__(
  370. "msr msp, %0\n\t"
  371. "bx %1" : : "r" (mainprogram_start[0]),
  372. "r" (mainprogram_start[1]) : "memory");
  373. }
  374. /**************************************/
  375. /* SCSI configuration based on DIPSW1 */
  376. /**************************************/
  377. void azplatform_config_hook(S2S_TargetCfg *config)
  378. {
  379. if (g_enable_apple_quirks)
  380. {
  381. if (config->quirks == S2S_CFG_QUIRKS_NONE)
  382. {
  383. config->quirks = S2S_CFG_QUIRKS_APPLE;
  384. }
  385. if (config->quirks == S2S_CFG_QUIRKS_APPLE)
  386. {
  387. static const char *driveinfo_fixed[4] = APPLE_DRIVEINFO_FIXED;
  388. static const char *driveinfo_removable[4] = APPLE_DRIVEINFO_REMOVABLE;
  389. static const char *driveinfo_optical[4] = APPLE_DRIVEINFO_OPTICAL;
  390. static const char *driveinfo_floppy[4] = APPLE_DRIVEINFO_FLOPPY;
  391. static const char *driveinfo_magopt[4] = APPLE_DRIVEINFO_MAGOPT;
  392. static const char *driveinfo_tape[4] = APPLE_DRIVEINFO_TAPE;
  393. const char **driveinfo = NULL;
  394. switch (config->deviceType)
  395. {
  396. case S2S_CFG_FIXED: driveinfo = driveinfo_fixed; break;
  397. case S2S_CFG_REMOVEABLE: driveinfo = driveinfo_removable; break;
  398. case S2S_CFG_OPTICAL: driveinfo = driveinfo_optical; break;
  399. case S2S_CFG_FLOPPY_14MB: driveinfo = driveinfo_floppy; break;
  400. case S2S_CFG_MO: driveinfo = driveinfo_magopt; break;
  401. case S2S_CFG_SEQUENTIAL: driveinfo = driveinfo_tape; break;
  402. default: driveinfo = driveinfo_fixed; break;
  403. }
  404. if (config->vendor[0] == '\0')
  405. {
  406. memset(config->vendor, 0, sizeof(config->vendor));
  407. strncpy(config->vendor, driveinfo[0], sizeof(config->vendor));
  408. }
  409. if (config->prodId[0] == '\0')
  410. {
  411. memset(config->prodId, 0, sizeof(config->prodId));
  412. strncpy(config->prodId, driveinfo[1], sizeof(config->prodId));
  413. }
  414. if (config->revision[0] == '\0')
  415. {
  416. memset(config->revision, 0, sizeof(config->revision));
  417. strncpy(config->revision, driveinfo[2], sizeof(config->revision));
  418. }
  419. if (config->serial[0] == '\0')
  420. {
  421. memset(config->serial, 0, sizeof(config->serial));
  422. strncpy(config->serial, driveinfo[3], sizeof(config->serial));
  423. }
  424. }
  425. }
  426. }
  427. /**********************************************/
  428. /* Mapping from data bytes to GPIO BOP values */
  429. /**********************************************/
  430. #define PARITY(n) ((1 ^ (n) ^ ((n)>>1) ^ ((n)>>2) ^ ((n)>>3) ^ ((n)>>4) ^ ((n)>>5) ^ ((n)>>6) ^ ((n)>>7)) & 1)
  431. #define X(n) (\
  432. ((n & 0x01) ? (SCSI_OUT_DB0 << 16) : SCSI_OUT_DB0) | \
  433. ((n & 0x02) ? (SCSI_OUT_DB1 << 16) : SCSI_OUT_DB1) | \
  434. ((n & 0x04) ? (SCSI_OUT_DB2 << 16) : SCSI_OUT_DB2) | \
  435. ((n & 0x08) ? (SCSI_OUT_DB3 << 16) : SCSI_OUT_DB3) | \
  436. ((n & 0x10) ? (SCSI_OUT_DB4 << 16) : SCSI_OUT_DB4) | \
  437. ((n & 0x20) ? (SCSI_OUT_DB5 << 16) : SCSI_OUT_DB5) | \
  438. ((n & 0x40) ? (SCSI_OUT_DB6 << 16) : SCSI_OUT_DB6) | \
  439. ((n & 0x80) ? (SCSI_OUT_DB7 << 16) : SCSI_OUT_DB7) | \
  440. (PARITY(n) ? (SCSI_OUT_DBP << 16) : SCSI_OUT_DBP) | \
  441. (SCSI_OUT_REQ) \
  442. )
  443. const uint32_t g_scsi_out_byte_to_bop[256] =
  444. {
  445. X(0x00), X(0x01), X(0x02), X(0x03), X(0x04), X(0x05), X(0x06), X(0x07), X(0x08), X(0x09), X(0x0a), X(0x0b), X(0x0c), X(0x0d), X(0x0e), X(0x0f),
  446. X(0x10), X(0x11), X(0x12), X(0x13), X(0x14), X(0x15), X(0x16), X(0x17), X(0x18), X(0x19), X(0x1a), X(0x1b), X(0x1c), X(0x1d), X(0x1e), X(0x1f),
  447. X(0x20), X(0x21), X(0x22), X(0x23), X(0x24), X(0x25), X(0x26), X(0x27), X(0x28), X(0x29), X(0x2a), X(0x2b), X(0x2c), X(0x2d), X(0x2e), X(0x2f),
  448. X(0x30), X(0x31), X(0x32), X(0x33), X(0x34), X(0x35), X(0x36), X(0x37), X(0x38), X(0x39), X(0x3a), X(0x3b), X(0x3c), X(0x3d), X(0x3e), X(0x3f),
  449. X(0x40), X(0x41), X(0x42), X(0x43), X(0x44), X(0x45), X(0x46), X(0x47), X(0x48), X(0x49), X(0x4a), X(0x4b), X(0x4c), X(0x4d), X(0x4e), X(0x4f),
  450. X(0x50), X(0x51), X(0x52), X(0x53), X(0x54), X(0x55), X(0x56), X(0x57), X(0x58), X(0x59), X(0x5a), X(0x5b), X(0x5c), X(0x5d), X(0x5e), X(0x5f),
  451. X(0x60), X(0x61), X(0x62), X(0x63), X(0x64), X(0x65), X(0x66), X(0x67), X(0x68), X(0x69), X(0x6a), X(0x6b), X(0x6c), X(0x6d), X(0x6e), X(0x6f),
  452. X(0x70), X(0x71), X(0x72), X(0x73), X(0x74), X(0x75), X(0x76), X(0x77), X(0x78), X(0x79), X(0x7a), X(0x7b), X(0x7c), X(0x7d), X(0x7e), X(0x7f),
  453. X(0x80), X(0x81), X(0x82), X(0x83), X(0x84), X(0x85), X(0x86), X(0x87), X(0x88), X(0x89), X(0x8a), X(0x8b), X(0x8c), X(0x8d), X(0x8e), X(0x8f),
  454. X(0x90), X(0x91), X(0x92), X(0x93), X(0x94), X(0x95), X(0x96), X(0x97), X(0x98), X(0x99), X(0x9a), X(0x9b), X(0x9c), X(0x9d), X(0x9e), X(0x9f),
  455. X(0xa0), X(0xa1), X(0xa2), X(0xa3), X(0xa4), X(0xa5), X(0xa6), X(0xa7), X(0xa8), X(0xa9), X(0xaa), X(0xab), X(0xac), X(0xad), X(0xae), X(0xaf),
  456. X(0xb0), X(0xb1), X(0xb2), X(0xb3), X(0xb4), X(0xb5), X(0xb6), X(0xb7), X(0xb8), X(0xb9), X(0xba), X(0xbb), X(0xbc), X(0xbd), X(0xbe), X(0xbf),
  457. X(0xc0), X(0xc1), X(0xc2), X(0xc3), X(0xc4), X(0xc5), X(0xc6), X(0xc7), X(0xc8), X(0xc9), X(0xca), X(0xcb), X(0xcc), X(0xcd), X(0xce), X(0xcf),
  458. X(0xd0), X(0xd1), X(0xd2), X(0xd3), X(0xd4), X(0xd5), X(0xd6), X(0xd7), X(0xd8), X(0xd9), X(0xda), X(0xdb), X(0xdc), X(0xdd), X(0xde), X(0xdf),
  459. X(0xe0), X(0xe1), X(0xe2), X(0xe3), X(0xe4), X(0xe5), X(0xe6), X(0xe7), X(0xe8), X(0xe9), X(0xea), X(0xeb), X(0xec), X(0xed), X(0xee), X(0xef),
  460. X(0xf0), X(0xf1), X(0xf2), X(0xf3), X(0xf4), X(0xf5), X(0xf6), X(0xf7), X(0xf8), X(0xf9), X(0xfa), X(0xfb), X(0xfc), X(0xfd), X(0xfe), X(0xff)
  461. };
  462. #undef X