comparison packages/infra/current/tests/fc_test.c @ 1457:9bf998a57d30

Handle changes in FLASH CFG API
author gthomas
date Mon, 05 Jan 2004 21:58:16 +0000
parents c15fe26f81c7
children
comparison
equal deleted inserted replaced
1456:17c50425fc72 1457:9bf998a57d30
6 // 6 //
7 //========================================================================== 7 //==========================================================================
8 //####ECOSGPLCOPYRIGHTBEGIN#### 8 //####ECOSGPLCOPYRIGHTBEGIN####
9 // ------------------------------------------- 9 // -------------------------------------------
10 // This file is part of eCos, the Embedded Configurable Operating System. 10 // This file is part of eCos, the Embedded Configurable Operating System.
11 // Copyright (C) 2003 Gary Thomas 11 // Copyright (C) 2003, 2004 Gary Thomas
12 // 12 //
13 // eCos is free software; you can redistribute it and/or modify it under 13 // eCos is free software; you can redistribute it and/or modify it under
14 // the terms of the GNU General Public License as published by the Free 14 // the terms of the GNU General Public License as published by the Free
15 // Software Foundation; either version 2 or (at your option) any later version. 15 // Software Foundation; either version 2 or (at your option) any later version.
16 // 16 //
70 70
71 diag_printf("fconfig test started\n"); 71 diag_printf("fconfig test started\n");
72 fc.offset = 0; 72 fc.offset = 0;
73 fc.key = key; 73 fc.key = key;
74 fc.keylen = sizeof(key); 74 fc.keylen = sizeof(key);
75 while (CYGACC_CALL_IF_FLASH_CFG_OP(CYGNUM_CALL_IF_FLASH_CFG_NEXT, &fc)) { 75 while (CYGACC_CALL_IF_FLASH_CFG_OP2(CYGNUM_CALL_IF_FLASH_CFG_NEXT, &fc)) {
76 diag_printf(" Offset: %d, key: '%s', type: %d\n", fc.offset, fc.key, fc.type); 76 diag_printf(" Offset: %d, key: '%s', type: %d\n", fc.offset, fc.key, fc.type);
77 fc.keylen = sizeof(key); 77 fc.keylen = sizeof(key);
78 } 78 }
79 // Try and update a data value 79 // Try and update a data value
80 fc.key = "gdb_port"; 80 fc.key = "gdb_port";
81 fc.val = &port; 81 fc.val = &port;
82 fc.type = CYGNUM_FLASH_CFG_TYPE_CONFIG_INT; 82 fc.type = CYGNUM_FLASH_CFG_TYPE_CONFIG_INT;
83 if (CYGACC_CALL_IF_FLASH_CFG_OP(CYGNUM_CALL_IF_FLASH_CFG_GET, &fc)) { 83 if (CYGACC_CALL_IF_FLASH_CFG_OP2(CYGNUM_CALL_IF_FLASH_CFG_GET, &fc)) {
84 diag_printf("gdb_port = %d\n", port); 84 diag_printf("gdb_port = %d\n", port);
85 port++; 85 port++;
86 if (CYGACC_CALL_IF_FLASH_CFG_OP(CYGNUM_CALL_IF_FLASH_CFG_SET, &fc)) { 86 if (CYGACC_CALL_IF_FLASH_CFG_OP2(CYGNUM_CALL_IF_FLASH_CFG_SET, &fc)) {
87 if (CYGACC_CALL_IF_FLASH_CFG_OP(CYGNUM_CALL_IF_FLASH_CFG_GET, &fc)) { 87 if (CYGACC_CALL_IF_FLASH_CFG_OP2(CYGNUM_CALL_IF_FLASH_CFG_GET, &fc)) {
88 diag_printf("now = %d\n", port); 88 diag_printf("now = %d\n", port);
89 } else { 89 } else {
90 diag_printf("Can't re-fetch 'gdb_port'\n"); 90 diag_printf("Can't re-fetch 'gdb_port'\n");
91 exit(1); 91 exit(1);
92 } 92 }
93 port--; 93 port--;
94 if (!CYGACC_CALL_IF_FLASH_CFG_OP(CYGNUM_CALL_IF_FLASH_CFG_SET, &fc)) { 94 if (!CYGACC_CALL_IF_FLASH_CFG_OP2(CYGNUM_CALL_IF_FLASH_CFG_SET, &fc)) {
95 diag_printf("Can't update 'gdb_port'\n"); 95 diag_printf("Can't update 'gdb_port'\n");
96 exit(1); 96 exit(1);
97 } 97 }
98 } else { 98 } else {
99 diag_printf("Can't update 'gdb_port'\n"); 99 diag_printf("Can't update 'gdb_port'\n");