Changeset 00ff4cd in rtems
- Timestamp:
- 08/25/00 17:24:49 (24 years ago)
- Branches:
- 4.10, 4.11, 4.8, 4.9, 5, master
- Children:
- f018b1a
- Parents:
- 060d538
- Location:
- c/src/lib/libbsp/powerpc/mbx8xx
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
c/src/lib/libbsp/powerpc/mbx8xx/ChangeLog
r060d538 r00ff4cd 1 2000-08-11 Charles-Antoine Gauthier <charles.gauthier@nrc.ca> 2 3 * README: 4 * console/console.c: 5 * include/bsp.h: 6 * network/network.c: 7 * startup/bspstart.c: 8 Add support for configuration parameters in NVRAM 9 1 10 2000-08-11 Charles-Antoine Gauthier <charles.gauthier@nrc.ca> 2 11 -
c/src/lib/libbsp/powerpc/mbx8xx/README
r060d538 r00ff4cd 1 # 2 # $Id$ 3 # 4 1 5 This is a README file for the MBX860/MBX821 port of RTEMS 4.5.0 2 6 3 7 Please send any comments, improvements, or bug reports to: 4 8 5 Darlene A. Stewart 9 Charles-Antoine Gauthier 10 charles.gauthier@nrc.ca 11 12 or 13 14 Darlene Stewart 15 Darlene.Stewart@nrc.ca 16 6 17 Software Engineering Group 7 18 Institute for Information Technology 8 19 National Research Council of Canada 9 20 Ottawa, ON, K1A 0R6 10 Canada 11 12 Darlene.Stewart@nrc.ca 13 21 Canada 14 22 15 23 … … 125 133 Board description 126 134 ----------------- 127 Clock rate: 128 Bus width: 129 FLASH: 130 RAM: 135 Clock rate: 50MHz Entry level boards, 40 MHz others. 136 Bus width: 8/32 bit Flash, 32 bit DRAM 137 FLASH: 2-4MB, 120ns 138 RAM: 4-16MB EDO, 60ns DRAM DIMM 131 139 132 140 … … 166 174 --------------- 167 175 168 This BSP includes an termios-capable asynchronous serial line driver 169 that supports SMC1, SMC2, SCC2, and SCC3 and SCC4 if present. The RTEMS 170 console is selected in rtems/make/custom/mbx8xx.cfg with the 171 CONSOLE_MINOR variable. We normally run with the RTEMS application 172 console on SMC2. SMC1 is used by the debugger. 176 This BSP includes an termios-capable asynchronous serial line driver that 177 supports SMC1, SMC2, SCC2, and SCC3 and SCC4 if present. The RTEMS console is 178 selected in rtems/make/custom/mbx8xx.cfg with the CONSOLE_MINOR variable, or 179 in NVRAM if that option is enabled in the rtems/make/custom/mbx8xx.cfg file. 180 We normally run with the RTEMS application console on SMC2. SMC1 is used by 181 the debugger. 173 182 174 183 Support is provided for five different modes of operation: … … 181 190 support. 182 191 183 The mode of operation of the serial driver is determined at build time 184 by the value of the UARTS_IO_MODE constant in rtems/make/custom/mbx8xx.cfg. 185 Edit the file to select the type of I/O desired before building RTEMS. 186 The choices are: 192 If NVRAM_CONFIGURE is set to 1 in rtems/make/custom/mbx8xx.cfg, the mode of 193 operation of the driver is determined at boot time from the values stored 194 in the user area in NVRAM. See the Configuration Parameters section below for 195 instructions on setting up NVRAM. Otherwise, the mode of operation of the 196 serial driver is determined at build time in part by the value of the 197 UARTS_IO_MODE constant in rtems/make/custom/mbx8xx.cfg. Edit the file to select 198 the type of I/O desired before building RTEMS. The choices are: 187 199 188 200 0 - polled I/O done by the supplied device driver, … … 190 202 2 - polled I/O done by EPPC-Bug. 191 203 192 Also set the value of UARTS_USE_TERMIOS to select whether termios should 193 be used to perform buffering and input/output processing. Without termios 194 support, input processing is limited to the substitution of LF for a 195 received CR, and output processing is limited to the transmission of a 196 CR following the transmission of a LF. The choices for UARTS_USE_TERMIOS are: 204 Also, if NVRAM_CONFIGURE is not set to 1 in rtems/make/custom/mbx8xx.cfg, set 205 the value of UARTS_USE_TERMIOS to select whether termios should be used to 206 perform buffering and input/output processing. Without termios support, input 207 processing is limited to the substitution of LF for a received CR, and output 208 processing is limited to the transmission of a CR following the transmission of 209 a LF. The choices for UARTS_USE_TERMIOS are: 197 210 198 211 0 - do not use termios … … 227 240 port at build time in rtems/make/custom/mbx8xx.cfg by setting the value 228 241 of PRINTK_MINOR to one of SMC1_MINOR, SMC2_MINOR, SCC2_MINOR, SCC3_MINOR, 229 or SCC4_MINOR. 242 or SCC4_MINOR. Alternatively, if NVRAM_CONFIGURE is set to 1 in 243 rtems/make/custom/mbx8xx.cfg, the printk port is selected based on data that 244 is stored in the user area in NVRAM. See the Configuration Parameters section 245 below for instructions on setting up NVRAM. 230 246 231 247 Select the type of output desired for printk() by setting the value of … … 233 249 234 250 0 - polled I/O done by the supplied device driver, 235 1 - interrupt-drivenI/O done by the supplied device driver,251 1 - polled I/O done by the supplied device driver, 236 252 2 - polled I/O done by EPPC-Bug. 237 253 … … 240 256 If the printk() port is opened by RTEMS, then PRINK_IO_MODE mode must have 241 257 the same value as UARTS_IO_MODE, otherwise the I/O functions will be in 242 conflict. Interrupt-driven printk() output is only possible if the port is 243 opened before hand by an RTEMS application, and is of dubious value... 258 conflict. Interrupt-driven printk() output did not work, although we think 259 that it should have. It would have been of dubious value anyways. If 260 interrupt-driven I/O is selected (value of 1), the driver defaults to using 261 polled I/O through the RTEMS driver. 262 263 IMPORTANT: Polled I/O through the RTEMS driver requires that the driver be 264 initialized. Consequently, to debug startup code using printk prior to the 265 initialization of the serial driver, use mode 2: polled I/O through EPPC-Bug, 266 and read the next section. 244 267 245 268 … … 306 329 307 330 IMPORTANT: When using EPPC-Bug on SMC1, either for debugging or for polled I/O, 308 EPPCBUG_SMC1 must be defined in rtems/make/custom/mbx8xx.cfg. Defining this 309 constant prevents the device driver from re-initializing SMC1. It also causes 310 the network driver, the clock driver, and the asynchronous serial line driver 311 to maintain simask_copy for use by gdb. 331 EPPCBUG_SMC1 must be defined in rtems/make/custom/mbx8xx.cfg, or the eppc_bug 332 field set to non-zero in NVRAM. Defining this constant prevents the device 333 driver from re-initializing SMC1. It also causes the network driver, the clock 334 driver, and the asynchronous serial line driver to maintain simask_copy for use 335 by gdb. 336 337 Polled I/O through EPPC-Bug is pretty funky... If your are old enough, it might 338 bring back fond memories of the days of 300 baud modems. If not, you can 339 experience for yourself what the state of the art used to be. 312 340 313 341 … … 318 346 get compiled with the appropriate -mcpu flag. The nof variants of the gcc 319 347 runtime libraries should be used for linking. 348 349 350 Configuration Parameters 351 ------------------------ 352 353 If NVRAM_CONFIGURE is set in rtems/make/custom/mbx8xx.cfg, certain 354 configuration parameters will be read from the first 31 bytes of the NVRAM 355 User Area, which starts at 0xFA001000. The user is responsible for writing 356 the appropriate values in NVRAM (via EPPC-Bug). The paramaters 357 that are configurable and their default settings are described below. 358 359 Cache Mode (0xFA001000 - 1 byte) 360 Set the following bits in the byte to control the caches: 361 bit 0 362 0 - data cache disable 363 1 - data cache enable 364 bit 1 365 0 - instruction cache disable 366 1 - instruction cache enable 367 If enabled, all of RAM except for the last 512 KB will be cached using 368 copyback mode. The last 512 KB of RAMis for the use of EPPC-Bug. 369 370 Console driver I/O mode (0xFA001001 - 1 byte) 371 Set the following bits in the byte to set the desired I/O mode 372 for the rtems ports: 373 bit 0 374 0 - do not use termios 375 1 - use termios 376 bit 2 & 1 377 00 - polled I/O through RTEMS driver 378 01 - interrupt-driven I/O 379 10 - polled I/O through EPPC-Bug 380 Set the following bits in the byte to set the desired I/O mode 381 for printk: 382 bit 5 & 4 383 00 - polled I/O through RTEMS driver 384 01 - polled I/O through RTEMS driver 385 10 - polled I/O through EPPC-Bug 386 387 Console driver ports (0xFA001002 - 1 byte) 388 Set the following bits in the byte to select the console and printk ports: 389 bit 2, 1 & 0 select the RTEMS console port 390 000 - /dev/tty0, SMC1 391 001 - /dev/tty1, SMC2 392 011 - /dev/tty2, SCC2 393 100 - /dev/tty3, SCC3 394 101 - /dev/tty4, SCC4 395 bit 6, 5 & 4 select the RTEMS printk port 396 000 - /dev/tty0, SMC1 397 001 - /dev/tty1, SMC2 398 011 - /dev/tty2, SCC2 399 100 - /dev/tty3, SCC3 400 101 - /dev/tty4, SCC4 401 If the printk port is the same as some other port that will be opened by an 402 RTEMS application, then the driver must use polled I/O, or the printk port 403 must not be used. 404 405 EPPC-Bug in use on SMC1 (0xFA001003 - 1 byte) 406 Set to non-zero to indicate that EPPC-Bug is using SMC1. This will prevent 407 the SMC1 port from being re-initialized. 408 409 IP Address (0xFA001004 - 4 bytes) 410 Write the hexadecimal representation of the IP address of the board in this 411 location, e.g. 192.168.1.2 = 0xC0A80102 412 413 Netmask (0xFA001008 - 4 bytes) 414 Write the hexadecimal representation of the netmask in this location 415 for example, 255.255.255.0 = 0xFFFFFF00 416 417 Ethernet Address (0xFA00100C - 6 bytes) 418 Write the Ethernet address of the board in this location 419 420 Processor ID (0xFA001012 - 2 bytes) 421 Reserved for future use 422 423 RMA start (0xFA001014 - 4 bytes) 424 Reserved for future use 425 426 VMA start (0xFA001018 - 4 bytes) 427 Reserved for future use 428 429 RamSize (0xFA00101C - 4 bytes) 430 Reserved for future use 320 431 321 432 … … 350 461 objects. 351 462 352 The cpuuse and malloctest tests do not work properly, either with polled I/O 353 or interrupt-driven I/O. They are known not to work with interrupt-driven I/O, 354 but should work with polled I/O? 355 356 Output stops prematurely in the termios test when the console is operating in 357 interrupt-driven mode because the serial port is re-initialized before all 358 characters in the last raw output buffer are sent. Adding calls to tcdrain() 359 in the test task helps, but it does not solve the problem. What happens is 360 that the CD2401 raises a transmit interrupt when the last character in the 361 DMA buffer is written into the transmit FIFO, not when the last character 362 has been transmitted. When tcdrain() returns, there might be up to 16 363 characters in the output FIFO. The call to tcsetattr() causes the serial port 364 to re-initialize, at which point the output FIFO is cleared. We could not find 365 a way to detect whether characters are still in the FIFO and to wait for them 366 to be transmitted. 367 368 The first raw buffer to be transmitted after the console is re-initialized 369 with tcsetattr() is garbled. At this time, it does not seem worth while to 370 track this problem down. 371 372 In the stackchk test, an access fault exception is raised after the stack is 373 blown. This is one case were overwritting the first or last 16 bytes of the 374 stack does cause problems (but hey, an exception occurred, which is better 375 than propagating the error). 376 377 When using interrupt-driven I/O, psx08 produces all the expected output, but 378 it does not return control to 167Bug. Is this test supposed to work with 379 interrupt-driven console I/O? 380 381 382 What's new 463 When using interrupt-driven I/O, psx08 fails with an internal assertion error. 464 465 466 What is new 383 467 ---------- 384 468 385 469 All known problems with use of the caches on the MBX860-002 and MBX821-001 386 470 have been resolved. 471 472 Configuration of the console and network is now possible at boot time through 473 NVRAM parameters. 387 474 388 475 -
c/src/lib/libbsp/powerpc/mbx8xx/console/console.c
r060d538 r00ff4cd 82 82 #include <termios.h> 83 83 84 #if UARTS_IO_MODE == 085 #define BSP_WRITE m8xx_uart_pollWrite86 #define BSP_READ m8xx_uart_pollRead87 #elif UARTS_IO_MODE == 188 #define BSP_WRITE m8xx_uart_write89 #elif UARTS_IO_MODE == 290 #define BSP_WRITE _EPPCBug_pollWrite91 #define BSP_READ _EPPCBug_pollRead92 #endif93 94 84 static int _EPPCBug_pollRead( int minor ); 95 85 static int _EPPCBug_pollWrite( int minor, const char *buf, int len ); 96 86 static void _BSP_output_char( char c ); 87 static rtems_status_code do_poll_read( rtems_device_major_number major, rtems_device_minor_number minor, void * arg); 88 static rtems_status_code do_poll_write( rtems_device_major_number major, rtems_device_minor_number minor, void * arg); 89 97 90 98 91 BSP_output_char_function_type BSP_output_char = _BSP_output_char; … … 113 106 * -1 if no character is present in the input FIFO. 114 107 */ 115 int _EPPCBug_pollRead(108 static int _EPPCBug_pollRead( 116 109 int minor 117 110 ) … … 221 214 * Return value: IGNORED 222 215 */ 223 int _EPPCBug_pollWrite(216 static int _EPPCBug_pollWrite( 224 217 int minor, 225 218 const char *buf, … … 332 325 333 326 /* 327 * do_poll_read 328 * 329 * Input characters through polled I/O. Returns has soon as a character has 330 * been received. Otherwise, if we wait for the number of requested characters, 331 * we could be here forever! 332 * 333 * CR is converted to LF on input. The terminal should not send a CR/LF pair 334 * when the return or enter key is pressed. 335 * 336 * Input parameters: 337 * major - ignored. Should be the major number for this driver. 338 * minor - selected channel. 339 * arg->buffer - where to put the received characters. 340 * arg->count - number of characters to receive before returning--Ignored. 341 * 342 * Output parameters: 343 * arg->bytes_moved - the number of characters read. Always 1. 344 * 345 * Return value: RTEMS_SUCCESSFUL 346 * 347 * CANNOT BE COMBINED WITH INTERRUPT DRIVEN I/O! 348 */ 349 static rtems_status_code do_poll_read( 350 rtems_device_major_number major, 351 rtems_device_minor_number minor, 352 void * arg 353 ) 354 { 355 rtems_libio_rw_args_t *rw_args = arg; 356 int c; 357 358 #if NVRAM_CONFIGURE == 1 359 360 int (*pollRead)( int minor ); 361 362 if ( (nvram->console_mode & 0x06) == 0x04 ) 363 pollRead = _EPPCBug_pollRead; 364 else 365 pollRead = m8xx_uart_pollRead; 366 367 while( (c = (*pollRead)(minor)) == -1 ); 368 rw_args->buffer[0] = (unsigned8)c; 369 if( rw_args->buffer[0] == '\r' ) 370 rw_args->buffer[0] = '\n'; 371 rw_args->bytes_moved = 1; 372 return RTEMS_SUCCESSFUL; 373 374 #else 375 376 #if UARTS_IO_MODE == 2 377 #define BSP_READ _EPPCBug_pollRead 378 #else 379 #define BSP_READ m8xx_uart_pollRead 380 #endif 381 382 while( (c = BSP_READ(minor)) == -1 ); 383 rw_args->buffer[0] = (unsigned8)c; 384 if( rw_args->buffer[0] == '\r' ) 385 rw_args->buffer[0] = '\n'; 386 rw_args->bytes_moved = 1; 387 return RTEMS_SUCCESSFUL; 388 389 #endif 390 } 391 392 393 /* 394 * do_poll_write 395 * 396 * Output characters through polled I/O. Returns only once every character has 397 * been sent. 398 * 399 * CR is transmitted AFTER a LF on output. 400 * 401 * Input parameters: 402 * major - ignored. Should be the major number for this driver. 403 * minor - selected channel 404 * arg->buffer - where to get the characters to transmit. 405 * arg->count - the number of characters to transmit before returning. 406 * 407 * Output parameters: 408 * arg->bytes_moved - the number of characters read 409 * 410 * Return value: RTEMS_SUCCESSFUL 411 * 412 * CANNOT BE COMBINED WITH INTERRUPT DRIVEN I/O! 413 */ 414 static rtems_status_code do_poll_write( 415 rtems_device_major_number major, 416 rtems_device_minor_number minor, 417 void * arg 418 ) 419 { 420 rtems_libio_rw_args_t *rw_args = arg; 421 unsigned32 i; 422 char cr ='\r'; 423 424 #if NVRAM_CONFIGURE == 1 425 426 int (*pollWrite)(int minor, const char *buf, int len); 427 428 if ( (nvram->console_mode & 0x06) == 0x04 ) 429 pollWrite = _EPPCBug_pollWrite; 430 else 431 pollWrite = m8xx_uart_pollWrite; 432 433 for( i = 0; i < rw_args->count; i++ ) { 434 (*pollWrite)(minor, &(rw_args->buffer[i]), 1); 435 if ( rw_args->buffer[i] == '\n' ) 436 (*pollWrite)(minor, &cr, 1); 437 } 438 rw_args->bytes_moved = i; 439 return RTEMS_SUCCESSFUL; 440 441 #else 442 443 #if UARTS_IO_MODE == 2 444 #define BSP_WRITE _EPPCBug_pollWrite 445 #else 446 #define BSP_WRITE m8xx_uart_pollWrite 447 #endif 448 449 for( i = 0; i < rw_args->count; i++ ) { 450 BSP_WRITE(minor, &(rw_args->buffer[i]), 1); 451 if ( rw_args->buffer[i] == '\n' ) 452 BSP_WRITE(minor, &cr, 1); 453 } 454 rw_args->bytes_moved = i; 455 return RTEMS_SUCCESSFUL; 456 457 #endif 458 } 459 460 461 /* 334 462 * Print functions prototyped in bspIo.h 335 463 */ 336 464 337 void _BSP_output_char( char c )465 static void _BSP_output_char( char c ) 338 466 { 339 467 char cr = '\r'; 340 468 341 BSP_WRITE( PRINTK_MINOR, &c, 1 ); 469 /* 470 * Can't rely on console_initialize having been called before this function 471 * is used, so it may fail unless output is done through EPPC-Bug. 472 */ 473 #if NVRAM_CONFIGURE == 1 474 475 rtems_device_minor_number printk_minor; 476 477 /* Use NVRAM info for configuration */ 478 printk_minor = (nvram->console_printk_port & 0x70) >> 4; 479 if( (nvram->console_mode & 0x30) == 0x20 ) { 480 _EPPCBug_pollWrite( printk_minor, &c, 1 ); 481 if( c == '\n' ) 482 _EPPCBug_pollWrite( printk_minor, &cr, 1 ); 483 } 484 else { 485 m8xx_uart_pollWrite( printk_minor, &c, 1 ); 486 if( c == '\n' ) 487 m8xx_uart_pollWrite( PRINTK_MINOR, &cr, 1 ); 488 } 489 490 #else 491 492 #if PRINTK_IO_MODE == 2 493 #define PRINTK_WRITE _EPPCBug_pollWrite 494 #else 495 #define PRINTK_WRITE m8xx_uart_pollWrite 496 #endif 497 498 PRINTK_WRITE( PRINTK_MINOR, &c, 1 ); 342 499 if( c == '\n' ) 343 BSP_WRITE( PRINTK_MINOR, &cr, 1 ); 500 PRINTK_WRITE( PRINTK_MINOR, &cr, 1 ); 501 502 #endif 344 503 } 345 504 … … 363 522 { 364 523 rtems_status_code status; 524 rtems_device_minor_number console_minor; 365 525 366 526 /* 367 * Set up TERMIOS 527 * Set up TERMIOS if needed 368 528 */ 529 #if NVRAM_CONFIGURE == 1 530 /* Use NVRAM info for configuration */ 531 console_minor = nvram->console_printk_port & 0x07; 532 533 if ( nvram->console_mode & 0x01 ) 534 /* termios */ 535 rtems_termios_initialize (); 536 537 /* 538 * Do common initialization. 539 */ 540 m8xx_uart_initialize(); 541 542 /* 543 * Do device-specific initialization 544 */ 545 if ( !nvram->eppcbug_smc1 && 546 ( ((nvram->console_mode & 0x30) != 0x20) || 547 (((nvram->console_printk_port & 0x30) >> 4) != SMC1_MINOR) ) ) 548 m8xx_uart_smc_initialize(SMC1_MINOR); /* /dev/tty0 */ 549 550 if ( ((nvram->console_mode & 0x30) != 0x20) || 551 (((nvram->console_printk_port & 0x30) >> 4) != SMC2_MINOR) ) 552 m8xx_uart_smc_initialize(SMC2_MINOR); /* /dev/tty1 */ 553 554 if ( ((nvram->console_mode & 0x30) != 0x20) || 555 (((nvram->console_printk_port & 0x30) >> 4) != SCC2_MINOR) ) 556 m8xx_uart_scc_initialize(SCC2_MINOR); /* /dev/tty2 */ 557 558 #ifdef mpc860 559 560 if ( ((nvram->console_mode & 0x30) != 0x20) || 561 (((nvram->console_printk_port & 0x30) >> 4) != SCC3_MINOR) ) 562 m8xx_uart_scc_initialize(SCC3_MINOR); /* /dev/tty3 */ 563 564 if ( ((nvram->console_mode & 0x30) != 0x20) || 565 (((nvram->console_printk_port & 0x30) >> 4) != SCC4_MINOR) ) 566 m8xx_uart_scc_initialize(SCC4_MINOR); /* /dev/tty4 */ 567 568 #endif /* mpc860 */ 569 570 #else /* NVRAM_CONFIGURE != 1 */ 571 572 console_minor = CONSOLE_MINOR; 573 369 574 #if UARTS_USE_TERMIOS == 1 370 rtems_termios_initialize(); 371 #endif 575 576 rtems_termios_initialize (); 577 578 #endif /* UARTS_USE_TERMIOS */ 579 372 580 /* 373 581 * Do common initialization. … … 401 609 402 610 #endif /* mpc860 */ 611 612 #endif /* NVRAM_CONFIGURE != 1 */ 613 403 614 404 615 /* … … 431 642 432 643 /* Now register the RTEMS console */ 433 status = rtems_io_register_name ("/dev/console", major, CONSOLE_MINOR);644 status = rtems_io_register_name ("/dev/console", major, console_minor); 434 645 if (status != RTEMS_SUCCESSFUL) 435 646 rtems_fatal_error_occurred (status); … … 449 660 { 450 661 /* Used to track termios private data for callbacks */ 451 #if UARTS_IO_MODE == 1452 662 extern struct rtems_termios_tty *ttyp[]; 663 453 664 rtems_libio_open_close_args_t *args = arg; 454 #endif455 456 665 rtems_status_code sc; 457 458 #if UARTS_USE_TERMIOS == 1 666 459 667 static const rtems_termios_callbacks sccEPPCBugCallbacks = { 460 668 NULL, /* firstOpen */ … … 466 674 0 /* outputUsesInterrupts */ 467 675 }; 676 468 677 static const rtems_termios_callbacks intrCallbacks = { 469 678 NULL, /* firstOpen */ … … 476 685 1 /* outputUsesInterrupts */ 477 686 }; 687 478 688 static const rtems_termios_callbacks pollCallbacks = { 479 689 NULL, /* firstOpen */ … … 486 696 0 /* outputUsesInterrupts */ 487 697 }; 488 #endif489 698 490 699 if ( minor > NUM_PORTS-1 ) 491 700 return RTEMS_INVALID_NUMBER; 492 701 702 #if NVRAM_CONFIGURE == 1 703 704 /* Use NVRAM info for configuration */ 705 if ( nvram->console_mode & 0x01 ) { 706 /* Use termios */ 707 if ( (nvram->console_mode & 0x06) == 0x02 ) { 708 /* interrupt-driven I/O */ 709 sc = rtems_termios_open( major, minor, arg, &intrCallbacks ); 710 ttyp[minor] = args->iop->data1; /* Keep cookie returned by termios_open */ 711 return sc; 712 } 713 else if ( (nvram->console_mode & 0x06) == 0x04 ) 714 /* polled I/O through EPPC-Bug, better be through SMC1 */ 715 return rtems_termios_open( major, minor, arg, &sccEPPCBugCallbacks ); 716 else 717 /* normal polled I/O */ 718 return rtems_termios_open( major, minor, arg, &pollCallbacks ); 719 } 720 else 721 /* no termios -- default to polled I/O */ 722 return RTEMS_SUCCESSFUL; 723 724 #else /* NVRAM_CONFIGURE != 1 */ 725 493 726 #if UARTS_USE_TERMIOS == 1 494 727 495 728 #if UARTS_IO_MODE == 2 /* EPPCBug polled I/O with termios */ 496 497 sc = rtems_termios_open (major, minor, arg, &sccEPPCBugCallbacks); 498 729 sc = rtems_termios_open( major, minor, arg, &sccEPPCBugCallbacks ); 499 730 #elif UARTS_IO_MODE == 1 /* RTEMS interrupt-driven I/O with termios */ 500 501 sc = rtems_termios_open (major, minor, arg, &intrCallbacks); 731 sc = rtems_termios_open( major, minor, arg, &intrCallbacks ); 502 732 ttyp[minor] = args->iop->data1; /* Keep cookie returned by termios_open */ 503 504 733 #else /* RTEMS polled I/O with termios */ 505 506 sc = rtems_termios_open (major, minor, arg, &pollCallbacks); 507 508 #endif 509 510 #else /* Nothing to do if termios is not used */ 511 734 sc = rtems_termios_open( major, minor, arg, &pollCallbacks ); 735 #endif 736 737 #else /* UARTS_USE_TERMIOS != 1 */ 738 /* no termios -- default to polled I/O */ 512 739 sc = RTEMS_SUCCESSFUL; 513 514 #endif 740 #endif /* UARTS_USE_TERMIOS != 1 */ 515 741 516 742 return sc; 743 744 #endif /* NVRAM_CONFIGURE != 1 */ 517 745 } 518 746 … … 530 758 return RTEMS_INVALID_NUMBER; 531 759 760 #if NVRAM_CONFIGURE == 1 761 762 /* Use NVRAM info for configuration */ 763 if ( nvram->console_mode & 0x01 ) 764 /* use termios */ 765 return rtems_termios_close( arg ); 766 else 767 /* no termios */ 768 return RTEMS_SUCCESSFUL; 769 770 #else /* NVRAM_CONFIGURE != 1 */ 771 532 772 #if UARTS_USE_TERMIOS == 1 533 return rtems_termios_close (arg);773 return rtems_termios_close( arg ); 534 774 #else 535 775 return RTEMS_SUCCESSFUL; 536 776 #endif 777 778 #endif /* NVRAM_CONFIGURE != 1 */ 537 779 } 538 780 … … 547 789 ) 548 790 { 549 #if UARTS_USE_TERMIOS != 1550 rtems_libio_rw_args_t *rw_args = arg;551 int c;552 #endif553 554 791 if ( minor > NUM_PORTS-1 ) 555 792 return RTEMS_INVALID_NUMBER; 556 793 794 #if NVRAM_CONFIGURE == 1 795 796 /* Use NVRAM info for configuration */ 797 if ( nvram->console_mode & 0x01 ) 798 /* use termios */ 799 return rtems_termios_read( arg ); 800 else 801 /* no termios -- default to polled */ 802 return do_poll_read( major, minor, arg ); 803 804 #else 805 557 806 #if UARTS_USE_TERMIOS == 1 558 559 return rtems_termios_read(arg); 560 561 #else 562 563 #if UARTS_IO_MODE != 1 /* Polled I/O without termios */ 564 565 while( (c = BSP_READ( minor )) == -1 ); 566 rw_args->buffer[0] = (unsigned8)c; 567 if( rw_args->buffer[0] == '\r' ) 568 rw_args->buffer[0] = '\n'; 569 rw_args->bytes_moved = 1; 570 return RTEMS_SUCCESSFUL; 571 572 #else /* RTEMS interrupt-driven I/O without termios */ 573 574 #error "Interrupt-driven input without termios is not yet supported" 575 807 return rtems_termios_read( arg ); 808 #else 809 return do_poll_read( major, minor, arg ); 576 810 #endif 577 811 … … 589 823 ) 590 824 { 591 #if UARTS_USE_TERMIOS != 1592 rtems_libio_rw_args_t *rw_args = arg;593 unsigned32 i;594 char cr = '\r';595 #endif596 597 825 if ( minor > NUM_PORTS-1 ) 598 826 return RTEMS_INVALID_NUMBER; 599 827 828 #if NVRAM_CONFIGURE == 1 829 830 /* Use NVRAM info for configuration */ 831 if ( nvram->console_mode & 0x01 ) 832 /* use termios */ 833 return rtems_termios_write( arg ); 834 else 835 /* no termios -- default to polled */ 836 return do_poll_write( major, minor, arg ); 837 838 #else 839 600 840 #if UARTS_USE_TERMIOS == 1 601 602 return rtems_termios_write(arg); 603 604 #else 605 606 #if UARTS_IO_MODE != 1 /* Polled I/O without termios*/ 607 608 /* Must add carriage return to line feeds */ 609 for( i = 0; i < rw_args->count; i++ ) { 610 BSP_WRITE( minor, &(rw_args->buffer[i]), 1 ); 611 if( rw_args->buffer[i] == '\n' ) 612 BSP_WRITE( minor, &cr, 1 ); 613 } 614 rw_args->bytes_moved = i; 615 return RTEMS_SUCCESSFUL; 616 617 #else /* RTEMS interrupt-driven I/O without termios */ 618 619 #error "Interrupt-driven output without termios is not yet supported" 620 841 return rtems_termios_write( arg ); 842 #else 843 /* no termios -- default to polled */ 844 return do_poll_write( major, minor, arg ); 621 845 #endif 622 846 … … 637 861 return RTEMS_INVALID_NUMBER; 638 862 863 #if NVRAM_CONFIGURE == 1 864 865 /* Uuse NVRAM info for configuration */ 866 if ( nvram->console_mode & 0x01 ) 867 /* termios */ 868 return rtems_termios_ioctl( arg ); 869 else 870 /* no termios -- default to polled */ 871 return RTEMS_SUCCESSFUL; 872 873 #else 874 639 875 #if UARTS_USE_TERMIOS == 1 640 return rtems_termios_ioctl (arg);876 return rtems_termios_ioctl( arg ); 641 877 #else 642 878 return RTEMS_SUCCESSFUL; 643 879 #endif 644 } 645 880 881 #endif 882 } 883 -
c/src/lib/libbsp/powerpc/mbx8xx/include/bsp.h
r060d538 r00ff4cd 30 30 #include <mpc8xx/mmu.h> 31 31 #include <mpc8xx/console.h> 32 33 34 /* 35 * Representation of initialization data in NVRAM 36 */ 37 typedef volatile struct nvram_config_ { 38 unsigned char cache_mode; /* 0xFA001000 */ 39 unsigned char console_mode; /* 0xFA001001 */ 40 unsigned char console_printk_port; /* 0xFA001002 */ 41 unsigned char eppcbug_smc1; /* 0xFA001003 */ 42 unsigned long ipaddr; /* 0xFA001004 */ 43 unsigned long netmask; /* 0xFA001008 */ 44 unsigned char enaddr[6]; /* 0xFA00100C */ 45 unsigned short processor_id; /* 0xFA001012 */ 46 unsigned long rma_start; /* 0xFA001014 */ 47 unsigned long vma_start; /* 0xFA001018 */ 48 unsigned long ramsize; /* 0xFA00101C */ 49 } nvram_config; 50 51 /* 52 * Pointer to the base of User Area NVRAM 53 */ 54 #define nvram ((nvram_config * const) 0xFA001000) 55 32 56 33 57 /* … … 71 95 #define Lower_tm27_intr() 72 96 73 /* Constants -- THESE SHOULD BE DEFINED IN THE LINKER SCRIPT */74 75 #define RAM_START 076 #define RAM_END 0x10000077 78 97 /* miscellaneous stuff assumed to exist */ 79 98 -
c/src/lib/libbsp/powerpc/mbx8xx/network/network.c
r060d538 r00ff4cd 53 53 #define TX_BD_PER_BUF 4 54 54 55 #define INET_ADDR_MAX_BUF_SIZE (sizeof "255.255.255.255") 56 57 55 58 /* 56 59 * RTEMS event used by interrupt handler to signal daemons. … … 1538 1541 int unitNumber; 1539 1542 char *unitName; 1543 char *pAddr; 1544 unsigned long addr; 1540 1545 1541 1546 /* … … 1562 1567 * Process options 1563 1568 */ 1569 #if NVRAM_CONFIGURE == 1 1570 1571 /* Configure from NVRAM */ 1572 if ( (addr = nvram->ipaddr) ) { 1573 /* We have a non-zero entry, copy the value */ 1574 if ( (pAddr = malloc ( INET_ADDR_MAX_BUF_SIZE, 0, M_NOWAIT )) ) 1575 config->ip_address = (char *)inet_ntop(AF_INET, &addr, pAddr, INET_ADDR_MAX_BUF_SIZE -1 ); 1576 else 1577 rtems_panic("Can't allocate ip_address buffer!\n"); 1578 } 1579 1580 if ( (addr = nvram->netmask) ) { 1581 /* We have a non-zero entry, copy the value */ 1582 if ( (pAddr = malloc ( INET_ADDR_MAX_BUF_SIZE, 0, M_NOWAIT )) ) 1583 config->ip_netmask = (char *)inet_ntop(AF_INET, &addr, pAddr, INET_ADDR_MAX_BUF_SIZE -1 ); 1584 else 1585 rtems_panic("Can't allocate ip_netmask buffer!\n"); 1586 } 1587 1588 /* Ethernet address requires special handling -- it must be copied into 1589 * the arpcom struct. The following if construct serves only to give the 1590 * User Area NVRAM parameter the highest priority. 1591 * 1592 * If the ethernet address is specified in NVRAM, go ahead and copy it. 1593 * (ETHER_ADDR_LEN = 6 bytes). 1594 */ 1595 if ( nvram->enaddr[0] || nvram->enaddr[1] || nvram->enaddr[2] ) { 1596 /* Anything in the first three bytes indicates a non-zero entry, copy value */ 1597 memcpy ((void *)sc->arpcom.ac_enaddr, &nvram->enaddr, ETHER_ADDR_LEN); 1598 } 1599 else if ( config->hardware_address ) { 1600 /* There is no entry in NVRAM, but there is in the ifconfig struct, so use it. */ 1601 memcpy ((void *)sc->arpcom.ac_enaddr, config->hardware_address, ETHER_ADDR_LEN); 1602 } 1603 else { 1604 /* There is no ethernet address provided, so it could be read 1605 * from the Ethernet protocol block of SCC1 in DPRAM. 1606 */ 1607 rtems_panic("No Ethernet address specified!\n"); 1608 } 1609 1610 #else /* NVRAM_CONFIGURE != 1 */ 1611 1564 1612 if (config->hardware_address) { 1565 1613 memcpy (sc->arpcom.ac_enaddr, config->hardware_address, ETHER_ADDR_LEN); 1566 1614 } 1567 1615 else { 1568 /* FIXME to read the enaddr from NVRAM */ 1569 } 1616 /* There is no ethernet address provided, so it could be read 1617 * from the Ethernet protocol block of SCC1 in DPRAM. 1618 */ 1619 rtems_panic("No Ethernet address specified!\n"); 1620 } 1621 1622 #endif /* NVRAM_CONFIGURE != 1 */ 1570 1623 1571 1624 if (config->mtu) -
c/src/lib/libbsp/powerpc/mbx8xx/startup/bspstart.c
r060d538 r00ff4cd 136 136 * Enable instruction and data caches. Do not force writethrough mode. 137 137 */ 138 #ifdef INSTRUCTION_CACHE_ENABLE 139 rtems_cache_enable_instruction(); 140 #endif 141 142 #ifdef DATA_CACHE_ENABLE 143 rtems_cache_enable_data(); 144 #endif 138 #if NVRAM_CONFIGURE == 1 139 if ( nvram->cache_mode & 0x02 ) 140 rtems_cache_enable_instruction(); 141 if ( nvram->cache_mode & 0x01 ) 142 rtems_cache_enable_data(); 143 #else 144 #ifdef INSTRUCTION_CACHE_ENABLE 145 rtems_cache_enable_instruction(); 146 #endif 147 #ifdef DATA_CACHE_ENABLE 148 rtems_cache_enable_data(); 149 #endif 150 #endif 145 151 146 152 /*
Note: See TracChangeset
for help on using the changeset viewer.