// *************************************************************************** // repeat_mem_test - Repeating Memory Tests // static void repeat_mem_test (MENU_ARG arg) { CYG_ADDRWORD start_addr, mem_size, end_addr; char cache_disable[10]; diag_printf ("Turn off Data Cache? (y/n): "); while (_rb_gets(cache_disable, sizeof(cache_disable), 0) != _GETS_OK) ; diag_printf ("\nBase address of memory to test (in hex): "); start_addr = hexIn(); diag_printf ("\nSize of memory to test (in hex): "); mem_size = hexIn(); end_addr = start_addr + mem_size - 1; diag_printf("\nTesting memory from %p to %p", start_addr, end_addr); while (memTest (start_addr, end_addr)) ; }
// *************************************************************************** // memory_tests - Basic Memory Tests // // Memory tests can be run one of two ways - with the cache turned OFF to test // physical memory, or with cache turned ON to test the caching // static void memory_tests (MENU_ARG arg) { CYG_ADDRWORD start_addr, end_addr; long mem_size; diag_printf("Base address of memory to test (in hex): "); start_addr = hexIn(); diag_printf ("\nSize of memory to test (in hex): "); mem_size = hexIn(); end_addr = start_addr + mem_size - 1; diag_printf("\nTesting memory from %p to %p.\n", start_addr, end_addr); memTest(start_addr, end_addr); diag_printf ("\nMemory test done.\n"); }
// **************************************************************************** // special_mem_test - Repeat-On-Fail Memory Test // // Memory tests can be run one of two ways - with the cache turned OFF to test // physical memory, or with cache turned ON to test the caching // static void special_mem_test (MENU_ARG arg) { long start_addr; long mem_size; long end_addr; diag_printf ("Base address of memory to test (in hex): "); start_addr = hexIn(); diag_printf ("\nSize of memory to test (in hex): "); mem_size = hexIn(); end_addr = start_addr + mem_size - 1; diag_printf("\nTesting memory from %p to %p.\n", start_addr, end_addr); LoopMemTest(start_addr, end_addr); diag_printf ("\n\nMemory test done.\n"); diag_wait(); }
/***************************************************************************** * * flash_test - System Flash ROM diagnostics * * A destructive Flash ROM Read/Write test. Note that the area of Flash * which is tested changes based on whether the diagnostic is being invoked * from the System code or from the Factory code (can't write over MON960). * * This test basically does a Longword Address test to the Flash area. * */ void flash_test(MENU_ARG arg) { ADDR start_addr = (ADDR)FLASH_ADDR; /* Original */ int i; unsigned long *f_ptr = (unsigned long *)FLASH_ADDR; int bytes_written = 0; unsigned long flash_data; char answer[20]; /* 10/31/00 */ int status; init_eeprom(); printf("***********************************\n"); printf("*** WARNING ***\n"); printf("*** This test is destructive to ***\n"); printf("*** all contents of the FLASH! ***\n"); printf("***********************************\n"); printf("\nDo you wish to continue? (y/n)\n"); sgets(answer); printf("\n\n"); if ((answer[0] != 'y') && (answer[0] != 'Y')) return; printf ("FLASH begins at 0x%X\n", FLASH_ADDR); printf ("Total FLASH size = 0x%X\n\n", eeprom_size); printf ("Checking FLASH ...\n"); if (check_eeprom(NO_ADDR, 0) == OK) printf("FLASH is erased\n\n"); else printf("FLASH is programmed between 0x%X and 0x%X\n\n", eeprom_prog_first, eeprom_prog_last); printf ("\nClearing Block Lock Bits... \n"); if(clear_all_lock_bits(NO_ADDR)==OK) printf("Done!\n\n"); else printf("Error!\n\n"); printf ("Erasing FLASH...\n"); if (erase_eeprom(NO_ADDR, 0) != OK) printf("Error on erase_eeprom()\n\n"); else printf("Done Erasing FLASH!\n\n"); (ADDR)start_addr = (ADDR)FLASH_BLK4_BASE_ADDR; printf ("Writing Longword Data to FLASH...\n"); /* write to all of available Flash ROM. Don't do this thousands of times since the Flash has only 100,000 write cycles in its lifespan */ while (bytes_written < (eeprom_size - RESERVED_AREA_SIZE)) { flash_data = (unsigned long)start_addr; for (i=0; i<TEST_BUF_LONGS; i++) { flash_buffer[i] = flash_data; /* put address in buffer */ flash_data += 4; /* increment address */ } if (write_eeprom (start_addr, (void *)flash_buffer, TEST_BUF_CHARS) != OK) { printf("Error on write_eeprom()\n"); goto finish; } start_addr = (unsigned long)start_addr + TEST_BUF_CHARS; bytes_written += TEST_BUF_CHARS; } printf ("Write Complete, Verifying Data...\n"); bytes_written = 0; f_ptr = (unsigned long *)FLASH_BLK4_BASE_ADDR; while (bytes_written < (eeprom_size - RESERVED_AREA_SIZE)) { if (*f_ptr != (unsigned long)f_ptr) { printf ("Data verification error at 0x%X\n", (unsigned long)f_ptr); printf ("Expected 0x%X Got 0x%X\n", (unsigned long)f_ptr, *f_ptr); goto finish; } f_ptr++; bytes_written += 4; } printf ("Done Verifying Longword Data!\n\n"); printf ("Checking FLASH...\n"); if (check_eeprom(NO_ADDR, 0) == OK) printf("FLASH is erased\n\n"); else printf("FLASH is programmed between 0x%X and 0x%X\n\n", eeprom_prog_first, eeprom_prog_last); printf ("Erasing FLASH...\n"); if (erase_eeprom(NO_ADDR, 0) != OK) printf("Error on erase_eeprom()\n\n"); else printf("Done Erasing FLASH!\n\n"); printf ("Checking FLASH...\n"); if (check_eeprom(NO_ADDR, 0) == OK) printf("FLASH is erased\n\n"); else printf("FLASH is programmed between 0x%X and 0x%X\n\n", eeprom_prog_first, eeprom_prog_last); /* reinitialize variables */ bytes_written = 0; start_addr = (ADDR)FLASH_BLK4_BASE_ADDR; f_ptr = (unsigned long *)FLASH_BLK4_BASE_ADDR; printf ("Writing Inverted Longword Data to FLASH...\n"); /* write to all of available Flash ROM. Don't do this thousands of times since the Flash has only 100,000 write cycles in its lifespan */ while (bytes_written < (eeprom_size - RESERVED_AREA_SIZE)) { flash_data = (unsigned long)start_addr; for (i=0; i<TEST_BUF_LONGS; i++) { flash_buffer[i] = ~flash_data; /* put address BAR in buffer */ flash_data += 4; /* increment address */ } if (write_eeprom (start_addr, (void *)flash_buffer, TEST_BUF_CHARS) != OK) { printf("Error on write_eeprom()\n"); goto finish; } start_addr = (unsigned long)start_addr + TEST_BUF_CHARS; bytes_written += TEST_BUF_CHARS; } printf ("Write Complete, Verifying Data...\n"); bytes_written = 0; while (bytes_written < (eeprom_size - RESERVED_AREA_SIZE)) { if (*f_ptr != (~(unsigned long)f_ptr)) { printf ("Data verification error at 0x%X\n", (unsigned long)f_ptr); printf ("Expected 0x%X Got 0x%X\n", (~(unsigned long)f_ptr), *f_ptr); goto finish; } f_ptr++; bytes_written += 4; } printf ("Done Verifying Inverted Longword Data!\n\n"); printf ("Checking FLASH...\n"); if (check_eeprom(NO_ADDR, 0) == OK) printf("FLASH is erased\n\n"); else { printf("FLASH is programmed between 0x%X and 0x%X\n\n", eeprom_prog_first, eeprom_prog_last); } printf ("Erasing FLASH...\n"); if (erase_eeprom(NO_ADDR, 0) != OK) printf("Error on erase_eeprom()\n\n"); else printf("Done Erasing FLASH!\n\n"); printf ("Checking FLASH...\n"); if (check_eeprom(NO_ADDR, 0) == OK) printf("FLASH is erased\n\n"); else printf("FLASH is programmed between 0x%X and 0x%X\n\n", eeprom_prog_first, eeprom_prog_last); /* 11/02/00 */ printf ("Setting Lock Bits for Blocks 0-3... \n"); if( (status = set_all_lock_bits() ) == OK ) printf("Done!\n"); else printf("Error! status =0x%x\n", status); finish: _flushICache(); printf ("\nHit <CR> to Continue...\n"); (void)hexIn(); return; }
void uart_test () { volatile int loop; int looplim; int int_id; unsigned long* reg_ptr; int i, baud; /*11/01/00 */ char info[] = {"Move Console Cable back to Connector J9 and hit <CR> to exit test"}; int index; looplim = 400000; /* perform tests on both UARTs */ for (uart_unit = 0; uart_unit < 2; uart_unit++) { if (uart_unit == 0) int_id = UART1_INT_ID; else int_id = UART2_INT_ID; if (!bus_test ()) printf ("\nERROR: bus_test for UART Unit %d failed\n", uart_unit); else { printf ("\nbus_test for UART Unit %d passed\n", uart_unit); uart_int = 0; isr_connect (int_id, uart_isr, 0); if (enable_external_interrupt(int_id) != OK) printf("ERROR enabling UART UINT %d interrupt!\n", uart_unit); init_uart (); loop = 0; while (!uart_int && (loop < looplim)) loop++; if (!uart_int) printf ("UART Unit %d INTERRUPT test failed %X\n", uart_unit, loop) ; else printf ("UART Unit %d INTERRUPT test passed\n", uart_unit); serial_putc(' '); } /* disable UART interrupt */ if (disable_external_interrupt(int_id)!= OK) printf("ERROR disabling UART UNIT %d interrupt!\n", uart_unit); /* disconnect test handler */ isr_disconnect (int_id); } /* 11/01/00 */ /* #if 0 */ /* writing to port 2 doesnt work yet... */ #if 1 /* writing to port 2 doesnt work yet... */ /* printf ("\nMove the Console Cable to the 2nd Serial Port,\n"); printf ("Connector J10,\n"); printf ("and Hit <CR> when the cable is connected.\n\n"); printf ("After alphabet prints, move Console Cable back to 1st Serial Port,\n"); printf ("Connector J9,\n"); printf ("and hit <CR> to exit test\n"); */ /* 10/30/00 */ uart_unit = DFLTPORT; /* test J10, the PCI-700 GDB port */ printf ("\nMove the Console Cable to the 2nd Serial Port, Connector J10,\n"); printf ("and Hit <CR> when the cable is connected.\n"); printf ("The alphabet should print on the screen.\n\n"); /* 11/01/00 */ /* printf ("After alphabet prints, move Console Cable back to 1st Serial Port,\n"); printf ("Connector J9,\n"); printf ("and hit <CR> to exit test\n"); */ baud = 115200; serial_init(); serial_set(baud?baud:115200L); /* while (serial_getc() == -1); */ while (serial_getc() != 0x0d); /* wait for a carriage return character to start test */ /* while (1) { for ( i = 65; i <= 90; i++ ) serial_putc(i); } */ for ( i = 65; i <= 90; i++ ) /* transmit the alphabet */ serial_putc(i); serial_putc(10); /* transmit a New Line */ serial_putc(13); /* transmit a Carriage Return */ serial_putc(10); /* transmit a New Line */ for (index=0; info[index] != '\0'; index++) /* transmit some instructions to the user */ { serial_putc(info[index]); } /* point at default port before returning */ /* uart_unit = DFLTPORT; */ (void)hexIn(); #endif printf ("\n\nUART tests done.\n"); printf ("Press return to continue.\n"); (void) hexIn(); }