loader_prompt.c (161370) | loader_prompt.c (163596) |
---|---|
1/****************************************************************************** 2 * 3 * Filename: loader_prompt.c 4 * 5 * Instantiation of the interactive loader functions. 6 * 7 * Revision information: 8 * --- 5 unchanged lines hidden (view full) --- 14 * No warranty, expressed or implied, is included with this software. It is 15 * provided "AS IS" and no warranty of any kind including statutory or aspects 16 * relating to merchantability or fitness for any purpose is provided. All 17 * intellectual property rights of others is maintained with the respective 18 * owners. This software is not copyrighted and is intended for reference 19 * only. 20 * END_BLOCK 21 * | 1/****************************************************************************** 2 * 3 * Filename: loader_prompt.c 4 * 5 * Instantiation of the interactive loader functions. 6 * 7 * Revision information: 8 * --- 5 unchanged lines hidden (view full) --- 14 * No warranty, expressed or implied, is included with this software. It is 15 * provided "AS IS" and no warranty of any kind including statutory or aspects 16 * relating to merchantability or fitness for any purpose is provided. All 17 * intellectual property rights of others is maintained with the respective 18 * owners. This software is not copyrighted and is intended for reference 19 * only. 20 * END_BLOCK 21 * |
22 * $FreeBSD: head/sys/boot/arm/at91/bootiic/loader_prompt.c 161370 2006-08-16 23:39:58Z imp $ | 22 * $FreeBSD: head/sys/boot/arm/at91/bootiic/loader_prompt.c 163596 2006-10-21 22:43:39Z imp $ |
23 *****************************************************************************/ 24 25#include "at91rm9200_lowlevel.h" 26#ifdef SUPPORT_TAG_LIST 27#include "tag_list.h" 28#endif 29#include "emac.h" 30#include "loader_prompt.h" --- 57 unchanged lines hidden (view full) --- 88 * .KB_C_FN_DEFINITION_END 89 */ 90static int 91StringToCommand(char *cPtr) 92{ 93 int i; 94 95 for (i = 0; CommandTable[i].command != COMMAND_FINAL_FLAG; ++i) | 23 *****************************************************************************/ 24 25#include "at91rm9200_lowlevel.h" 26#ifdef SUPPORT_TAG_LIST 27#include "tag_list.h" 28#endif 29#include "emac.h" 30#include "loader_prompt.h" --- 57 unchanged lines hidden (view full) --- 88 * .KB_C_FN_DEFINITION_END 89 */ 90static int 91StringToCommand(char *cPtr) 92{ 93 int i; 94 95 for (i = 0; CommandTable[i].command != COMMAND_FINAL_FLAG; ++i) |
96 if (!p_strcmp(CommandTable[i].c_string, cPtr)) | 96 if (!strcmp(CommandTable[i].c_string, cPtr)) |
97 return (CommandTable[i].command); 98 99 return (COMMAND_INVALID); 100} 101 102 103/* 104 * .KB_C_FN_DEFINITION_START --- 78 unchanged lines hidden (view full) --- 183 // copy memory 184 char *to, *from; 185 unsigned size; 186 187 if (argc > 3) { 188 to = (char *)p_ASCIIToHex(argv[1]); 189 from = (char *)p_ASCIIToHex(argv[2]); 190 size = p_ASCIIToHex(argv[3]); | 97 return (CommandTable[i].command); 98 99 return (COMMAND_INVALID); 100} 101 102 103/* 104 * .KB_C_FN_DEFINITION_START --- 78 unchanged lines hidden (view full) --- 183 // copy memory 184 char *to, *from; 185 unsigned size; 186 187 if (argc > 3) { 188 to = (char *)p_ASCIIToHex(argv[1]); 189 from = (char *)p_ASCIIToHex(argv[2]); 190 size = p_ASCIIToHex(argv[3]); |
191 p_memcpy(to, from, size); | 191 memcpy(to, from, size); |
192 } 193 break; 194 } 195 196 case COMMAND_DUMP: 197 // display boot commands 198 DumpBootCommands(); 199 break; --- 29 unchanged lines hidden (view full) --- 229 // "server_ip <server IP 192 200 1 20>" 230 // set download server address 231 if (argc > 4) 232 SetServerIPAddress(BuildIP()); 233 break; 234 235 case COMMAND_HELP: 236 // dump command info | 192 } 193 break; 194 } 195 196 case COMMAND_DUMP: 197 // display boot commands 198 DumpBootCommands(); 199 break; --- 29 unchanged lines hidden (view full) --- 229 // "server_ip <server IP 192 200 1 20>" 230 // set download server address 231 if (argc > 4) 232 SetServerIPAddress(BuildIP()); 233 break; 234 235 case COMMAND_HELP: 236 // dump command info |
237 printf("Commands:\r\n" 238 "\tc\r\n" 239 "\td\r\n" 240 "\te\r\n" 241 "\tip\r\n" 242 "\tserver_ip\r\n" 243 "\tm\r\n" 244 "\ttftp\r\n" 245 "\ts\r\n" | 237 printf("Commands:\n" 238 "\tc\n" 239 "\td\n" 240 "\te\n" 241 "\tip\n" 242 "\tserver_ip\n" 243 "\tm\n" 244 "\ttftp\n" 245 "\ts\n" |
246#ifdef SUPPORT_TAG_LIST | 246#ifdef SUPPORT_TAG_LIST |
247 "\tt\r\n" | 247 "\tt\n" |
248#endif | 248#endif |
249 "\tw\r\n" 250 "\tx\r\n"); | 249 "\tw\n" 250 "\tx\n"); |
251 break; 252 253 case COMMAND_LOCAL_IP: 254 // "local_ip <local IP 192 200 1 21> 255 // set ip of this module 256 if (argc > 4) 257 SetLocalIPAddress(BuildIP()); 258 break; --- 51 unchanged lines hidden (view full) --- 310 xmodem_rx((char *)p_ASCIIToHex(argv[1])); 311 break; 312 } 313 314 default: 315 break; 316 } 317 | 251 break; 252 253 case COMMAND_LOCAL_IP: 254 // "local_ip <local IP 192 200 1 21> 255 // set ip of this module 256 if (argc > 4) 257 SetLocalIPAddress(BuildIP()); 258 break; --- 51 unchanged lines hidden (view full) --- 310 xmodem_rx((char *)p_ASCIIToHex(argv[1])); 311 break; 312 } 313 314 default: 315 break; 316 } 317 |
318 printf("\r\n"); | 318 printf("\n"); |
319} 320 321 322/* 323 * .KB_C_FN_DEFINITION_START 324 * void ServicePrompt(char) 325 * This private function process each character checking for valid commands. 326 * This function is only executed if the character is considered valid. | 319} 320 321 322/* 323 * .KB_C_FN_DEFINITION_START 324 * void ServicePrompt(char) 325 * This private function process each character checking for valid commands. 326 * This function is only executed if the character is considered valid. |
327 * Each command is terminated with NULL (0) or '\r'. | 327 * Each command is terminated with NULL (0) or ''. |
328 * .KB_C_FN_DEFINITION_END 329 */ 330static void 331ServicePrompt(char p_char) 332{ 333 if (p_char == '\r') 334 p_char = 0; 335 --- 5 unchanged lines hidden (view full) --- 341 } 342 return; 343 } 344 if (buffCount < MAX_INPUT_SIZE - 1) { 345 inputBuffer[buffCount++] = p_char; 346 putchar(p_char); 347 } 348 if (!p_char) { | 328 * .KB_C_FN_DEFINITION_END 329 */ 330static void 331ServicePrompt(char p_char) 332{ 333 if (p_char == '\r') 334 p_char = 0; 335 --- 5 unchanged lines hidden (view full) --- 341 } 342 return; 343 } 344 if (buffCount < MAX_INPUT_SIZE - 1) { 345 inputBuffer[buffCount++] = p_char; 346 putchar(p_char); 347 } 348 if (!p_char) { |
349 printf("\r\n"); | 349 printf("\n"); |
350 ParseCommand(inputBuffer); 351 p_memset(inputBuffer, 0, MAX_INPUT_SIZE); 352 buffCount = 0; | 350 ParseCommand(inputBuffer); 351 p_memset(inputBuffer, 0, MAX_INPUT_SIZE); 352 buffCount = 0; |
353 printf("\r\n>"); | 353 printf("\n>"); |
354 } 355} 356 357 358/* ************************** GLOBAL FUNCTIONS ********************************/ 359 360 361/* --- 12 unchanged lines hidden (view full) --- 374 375 p_memset((void*)inputBuffer, 0, sizeof(inputBuffer)); 376 377 buffCount = 0; 378 if (!inputFunction) { 379 inputFunction = getc; 380 } 381 | 354 } 355} 356 357 358/* ************************** GLOBAL FUNCTIONS ********************************/ 359 360 361/* --- 12 unchanged lines hidden (view full) --- 374 375 p_memset((void*)inputBuffer, 0, sizeof(inputBuffer)); 376 377 buffCount = 0; 378 if (!inputFunction) { 379 inputFunction = getc; 380 } 381 |
382 printf("\r\n>"); | 382 printf("\n>"); |
383 384 while (1) 385 if ((ch = ((*inputFunction)(0))) > 0) 386 ServicePrompt(ch); 387} | 383 384 while (1) 385 if ((ch = ((*inputFunction)(0))) > 0) 386 ServicePrompt(ch); 387} |