Mercurial > flash_v2
comparison packages/redboot/current/src/flash.c @ 159:511f4dc167f6
Merge from eCos master repository on 2001-05-18-01:30:05-BST
| author | jlarmour |
|---|---|
| date | Fri, 18 May 2001 06:32:28 +0000 |
| parents | b65ec671dd4c |
| children | 0d0f03f76f6a |
comparison
equal
deleted
inserted
replaced
| 158:f2545e5de153 | 159:511f4dc167f6 |
|---|---|
| 926 struct fis_image_desc *img; | 926 struct fis_image_desc *img; |
| 927 unsigned long mem_addr; | 927 unsigned long mem_addr; |
| 928 bool mem_addr_set = false; | 928 bool mem_addr_set = false; |
| 929 bool show_cksum = false; | 929 bool show_cksum = false; |
| 930 struct option_info opts[3]; | 930 struct option_info opts[3]; |
| 931 #ifdef CYGPKG_REDBOOT_FIS_CRC_CHECK | |
| 931 unsigned long cksum; | 932 unsigned long cksum; |
| 933 #endif | |
| 932 int num_options; | 934 int num_options; |
| 933 bool decompress = false; | 935 bool decompress = false; |
| 934 | 936 |
| 935 init_opts(&opts[0], 'b', true, OPTION_ARG_TYPE_NUM, | 937 init_opts(&opts[0], 'b', true, OPTION_ARG_TYPE_NUM, |
| 936 (void **)&mem_addr, (bool *)&mem_addr_set, "memory [load] base address"); | 938 (void **)&mem_addr, (bool *)&mem_addr_set, "memory [load] base address"); |
| 1067 #define CONFIG_CHANGED 1 | 1069 #define CONFIG_CHANGED 1 |
| 1068 #define CONFIG_OK 2 | 1070 #define CONFIG_OK 2 |
| 1069 #define CONFIG_BACK 3 | 1071 #define CONFIG_BACK 3 |
| 1070 #define CONFIG_BAD 4 | 1072 #define CONFIG_BAD 4 |
| 1071 | 1073 |
| 1072 // Note: the following options are related. If 'bootp' is false, then | 1074 // Note: the following options are related. If 'boot_script' is false, then |
| 1073 // the other values are used in the configuration. Because of the way | 1075 // the other values are used in the configuration. Because of the way |
| 1074 // that configuration tables are generated, they should have names which | 1076 // that configuration tables are generated, they should have names which |
| 1075 // are related. The configuration options will show up lexicographically | 1077 // are related. The configuration options will show up lexicographically |
| 1076 // ordered, thus the peculiar naming. | 1078 // ordered, thus the peculiar naming. |
| 1077 RedBoot_config_option("Run script at boot", | 1079 RedBoot_config_option("Run script at boot", |
| 1088 ); | 1090 ); |
| 1089 // Some preprocessor magic for building the [constant] prompt string | 1091 // Some preprocessor magic for building the [constant] prompt string |
| 1090 #define __cat(s1,c2,s3) s1 #c2 s3 | 1092 #define __cat(s1,c2,s3) s1 #c2 s3 |
| 1091 #define _cat(s1,c2,s3) __cat(s1,c2,s3) | 1093 #define _cat(s1,c2,s3) __cat(s1,c2,s3) |
| 1092 RedBoot_config_option(_cat("Boot script timeout (", | 1094 RedBoot_config_option(_cat("Boot script timeout (", |
| 1093 CYGNUM_REDBOOT_FLASH_SCRIPT_TIMEOUT_RESOLUTION, | 1095 CYGNUM_REDBOOT_BOOT_SCRIPT_TIMEOUT_RESOLUTION, |
| 1094 "ms resolution)"), | 1096 "ms resolution)"), |
| 1095 boot_script_timeout, | 1097 boot_script_timeout, |
| 1096 "boot_script", true, | 1098 "boot_script", true, |
| 1097 CONFIG_INT, | 1099 CONFIG_INT, |
| 1098 0 | 1100 0 |
| 1099 ); | 1101 ); |
| 1100 #undef __cat | 1102 #undef __cat |
| 1101 #undef _cat | 1103 #undef _cat |
| 1104 | |
| 1105 #ifdef CYGSEM_REDBOOT_VARIBLE_BAUD_RATE | |
| 1106 RedBoot_config_option("Console baud rate", | |
| 1107 console_baud_rate, | |
| 1108 ALWAYS_ENABLED, true, | |
| 1109 CONFIG_INT, | |
| 1110 CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_BAUD | |
| 1111 ); | |
| 1112 #endif | |
| 1102 | 1113 |
| 1103 CYG_HAL_TABLE_BEGIN( __CONFIG_options_TAB__, RedBoot_config_options); | 1114 CYG_HAL_TABLE_BEGIN( __CONFIG_options_TAB__, RedBoot_config_options); |
| 1104 CYG_HAL_TABLE_END( __CONFIG_options_TAB_END__, RedBoot_config_options); | 1115 CYG_HAL_TABLE_END( __CONFIG_options_TAB_END__, RedBoot_config_options); |
| 1105 | 1116 |
| 1106 extern struct config_option __CONFIG_options_TAB__[], __CONFIG_options_TAB_END__[]; | 1117 extern struct config_option __CONFIG_options_TAB__[], __CONFIG_options_TAB_END__[]; |
| 1385 title = opt->title; | 1396 title = opt->title; |
| 1386 break; | 1397 break; |
| 1387 } | 1398 } |
| 1388 opt++; | 1399 opt++; |
| 1389 } | 1400 } |
| 1390 if ( onlyone && 0 != strcmp(opt->key, onlyone) ) | 1401 if ( onlyone && 0 != strcmp(CONFIG_OBJECT_KEY(dp), onlyone) ) |
| 1391 ret = CONFIG_OK; // skip this entry | 1402 ret = CONFIG_OK; // skip this entry |
| 1392 else { | 1403 else { |
| 1393 doneone = true; | 1404 doneone = true; |
| 1394 ret = get_config(dp, title, list_opt, onevalue); // do this opt | 1405 ret = get_config(dp, title, list_opt, onevalue); // do this opt |
| 1395 } | 1406 } |
| 1412 printf ("** invalid entry\n"); | 1423 printf ("** invalid entry\n"); |
| 1413 } | 1424 } |
| 1414 } | 1425 } |
| 1415 | 1426 |
| 1416 done: | 1427 done: |
| 1417 if (NULL != onlyone && !doneone) | 1428 if (NULL != onlyone && !doneone) { |
| 1418 printf("** entry '%s' not found\n", onlyone); | 1429 #ifdef CYGSEM_REDBOOT_ALLOW_DYNAMIC_FLASH_CONFIG_DATA |
| 1430 if (verify_action("** entry '%s' not found - add", onlyone)) { | |
| 1431 struct config_option opt; | |
| 1432 printf("Trying to add value\n"); | |
| 1433 } | |
| 1434 #else | |
| 1435 printf("** entry '%s' not found", onlyone); | |
| 1436 #endif | |
| 1437 } | |
| 1419 if (!need_update) | 1438 if (!need_update) |
| 1420 return; | 1439 return; |
| 1421 flash_write_config(); | 1440 flash_write_config(); |
| 1422 } | 1441 } |
| 1423 | 1442 |
| 1625 flash_get_config("boot_script", &use_boot_script, CONFIG_BOOL); | 1644 flash_get_config("boot_script", &use_boot_script, CONFIG_BOOL); |
| 1626 if (use_boot_script) { | 1645 if (use_boot_script) { |
| 1627 flash_get_config("boot_script_data", &script, CONFIG_SCRIPT); | 1646 flash_get_config("boot_script_data", &script, CONFIG_SCRIPT); |
| 1628 flash_get_config("boot_script_timeout", &script_timeout, CONFIG_INT); | 1647 flash_get_config("boot_script_timeout", &script_timeout, CONFIG_INT); |
| 1629 } | 1648 } |
| 1649 #ifdef CYGSEM_REDBOOT_VARIBLE_BAUD_RATE | |
| 1650 if (flash_get_config("console_baud_rate", &console_baud_rate, CONFIG_INT)) { | |
| 1651 extern void set_console_baud_rate(int); | |
| 1652 set_console_baud_rate(console_baud_rate); | |
| 1653 } | |
| 1654 #endif | |
| 1630 } | 1655 } |
| 1631 | 1656 |
| 1632 RedBoot_init(load_flash_config, RedBoot_INIT_FIRST); | 1657 RedBoot_init(load_flash_config, RedBoot_INIT_FIRST); |
| 1633 | 1658 |
| 1634 #endif // CYGSEM_REDBOOT_FLASH_CONFIG | 1659 #endif // CYGSEM_REDBOOT_FLASH_CONFIG |
