コード例 #1
0
ファイル: interrupts.c プロジェクト: 0xCA5A/dd-wrt
void config_ints(void)
{
int xint, x;
	
	unsigned int* pirsr_ptr = (unsigned int*)PIRSR_ADDR;
	*pirsr_ptr = 0xf; /* this is an errata in the original Yavapai manual.
					     The interrupt steering bits are reversed, so a '1'
						 routes XINT interrupts to FIQ
						*/

	/* install diag IRQ handlers */
	((volatile unsigned *)0x20)[6] = (unsigned)__diag_IRQ;
	((volatile unsigned *)0x20)[7] = (unsigned)__diag_FIQ;
	_flushICache();	

	/* make sure interrupts are enabled in CSPR */

	_cspr_enable_irq_int(); 

	_cspr_enable_fiq_int(); 

	/* initialize the PCI interrupt table */
	for (xint = 0; xint < NUM_PCI_XINTS; xint++)
	{
		for (x = 0; x < MAX_PCI_HANDLERS; x++) 
		{
			pci_int_handlers[xint][x].handler	= NULL;
			pci_int_handlers[xint][x].arg		= (int)NULL;
			pci_int_handlers[xint][x].bus		= (int)NULL;
			pci_int_handlers[xint][x].device	= (int)NULL;
		}
	}


}
コード例 #2
0
void delay_and_flush (void)
{

	do_nothing(); 

	_flushICache();

}
コード例 #3
0
ファイル: flash.c プロジェクト: 0xCA5A/dd-wrt
/*****************************************************************************
*
* 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;
}