void pci_list_devices( void ) { uint32_t d; unsigned char bus,dev,fun,hd; printk( "BUS:SLOT:FUN VENDOR-DEV_ID: COMMAND STATUS BASE_ADDR0 " "BASE_ADDR1 IRQ_PIN -> IRQ_LINE\n" ); for (bus=0 ; bus<pci_bus_count(); bus++) { for (dev=0 ; dev<PCI_MAX_DEVICES; dev++) { for (fun=0 ; fun<PCI_MAX_FUNCTIONS; fun++) { /* * The last devfn id/slot is special; must skip it */ if (PCI_MAX_DEVICES-1==dev && PCI_MAX_FUNCTIONS-1 == fun) break; (void) pci_read_config_dword(bus,dev,0,PCI_VENDOR_ID,&d); if (PCI_INVALID_VENDORDEVICEID == d) continue; if ( 0 == fun ) { pci_read_config_byte(bus,dev,0, PCI_HEADER_TYPE, &hd); hd = (hd & PCI_HEADER_TYPE_MULTI_FUNCTION ? PCI_MAX_FUNCTIONS : 1); } (void)pci_read_config_dword(bus,dev,fun,PCI_VENDOR_ID,&d); if (PCI_INVALID_VENDORDEVICEID == d) continue; print_device_config( bus, dev, fun ); } } } }
static void complete_device(struct netdev *dev) { postprocess_device(dev); configure_device(dev); dump_device_config(dev); print_device_config(dev); ++configured; dev->next = ifaces; ifaces = dev; }
void device_boot() { /* POWER STARTUP SEQUENCE */ delay_ms(POWERUP_DELAY); fprintf(RS232,"Booting into main application built on "); fprintf(RS232,__DATE__); fprintf(RS232," "); fprintf(RS232,__TIME__); fprintf(RS232,"\r"); fprintf(RS232,"Device firmware is v%u.%u%s\r",MAJOR_REVISION,MINOR_REVISION,REVISION_TEXT); delay_ms(10); if(DEBUG) { fprintf(RS232,"[DEBUG] Reading DSP addresses from flash into memory... "); } FLASH_ADDR_READ(); if(DEBUG) { fprintf(RS232,"Done!\r\n"); } if(DEBUG) { fprintf(RS232,"[DEBUG] Checking if EEPROM is configured... "); } int eeprom_preset_number = read_eeprom(IEEPROM_PRESET_LOC); //TODO - Re-implement if(eeprom_preset_number == 0xFF) { if(DEBUG) { fprintf(RS232,"NO PRESET IN EEPROM, GOING TO DEFAULT\r\n"); } //switch_flash_program(DEFAULT_PRESET); CURRENT_FLASH_PROGRAM = DEFAULT_PRESET; write_eeprom(IEEPROM_PRESET_LOC,CURRENT_FLASH_PROGRAM); } else { if(DEBUG) { fprintf(RS232,"BOOTING FROM STORED PRESET - %U\r\n",eeprom_preset_number); } //switch_flash_program(eeprom_preset_number); CURRENT_FLASH_PROGRAM = eeprom_preset_number; } delay_ms(10); int programmed_flag = read_eeprom(IEEPROM_FLAG_LOC); INTEEPROM_GET(&DEVICE_CONFIG,sizeof(device_configuration),IEEPROM_DEVICE_CONFIG_LOC); delay_ms(10); if(DEBUG) { print_device_config(); } if(programmed_flag == 0xFF) { if(DEBUG) { fprintf(RS232,"[DEBUG] Starting first boot routine\r\n"); } if(DEBUG) { fprintf(RS232,"[DEBUG] Saving default device properties..."); } default_device_config(); if(DEBUG) { fprintf(RS232,"Done!\r\n"); } if(DEBUG) { fprintf(RS232,"[DEBUG] New device config below...\r\n"); print_device_config(); } write_eeprom(IEEPROM_FLAG_LOC,0x01); delay_ms(10); } /* INIT RS232 volumes and mutes */ rs232_premix_vol[0] = 1; rs232_premix_vol[1] = 1; rs232_premix_vol[2] = 1; rs232_premix_vol[3] = 1; rs232_premix_mute[0] = 0; rs232_premix_mute[1] = 0; rs232_premix_mute[2] = 0; rs232_premix_mute[3] = 0; rs232_output_vol[0] = 1; rs232_output_vol[1] = 1; rs232_output_vol[2] = 1; rs232_output_vol[3] = 1; rs232_output_mute[0] = 0; rs232_output_mute[1] = 0; rs232_output_mute[2] = 0; rs232_output_mute[3] = 0; }