void wifi_init(u32 band){ // init usart2 PA2,PA3 uart2_init(band); printf("Test1\r\n"); esp_write("AT+GMR\r\n"); while(available() != 0){ printf("%c",read()); } printf("\r\n"); esp_write("AT+CWLAP\r\n"); delay_ms(5000); printf("\r\n"); while(available() != 0){ printf("%c",read()); } printf("\r\n"); }
/***************************************************************** Detection */ int oktagon_esp_detect(Scsi_Host_Template *tpnt) { struct NCR_ESP *esp; struct zorro_dev *z = NULL; unsigned long address; struct ESP_regs *eregs; while ((z = zorro_find_device(ZORRO_PROD_BSC_OKTAGON_2008, z))) { unsigned long board = z->resource.start; if (request_mem_region(board+OKTAGON_ESP_ADDR, sizeof(struct ESP_regs), "NCR53C9x")) { /* * It is a SCSI controller. * Hardwire Host adapter to SCSI ID 7 */ address = (unsigned long)ZTWO_VADDR(board); eregs = (struct ESP_regs *)(address + OKTAGON_ESP_ADDR); /* This line was 5 lines lower */ esp = esp_allocate(tpnt, (void *)board+OKTAGON_ESP_ADDR); /* we have to shift the registers only one bit for oktagon */ esp->shift = 1; esp_write(eregs->esp_cfg1, (ESP_CONFIG1_PENABLE | 7)); udelay(5); if (esp_read(eregs->esp_cfg1) != (ESP_CONFIG1_PENABLE | 7)) return 0; /* Bail out if address did not hold data */ /* Do command transfer with programmed I/O */ esp->do_pio_cmds = 1; /* Required functions */ esp->dma_bytes_sent = &dma_bytes_sent; esp->dma_can_transfer = &dma_can_transfer; esp->dma_dump_state = &dma_dump_state; esp->dma_init_read = &dma_init_read; esp->dma_init_write = &dma_init_write; esp->dma_ints_off = &dma_ints_off; esp->dma_ints_on = &dma_ints_on; esp->dma_irq_p = &dma_irq_p; esp->dma_ports_p = &dma_ports_p; esp->dma_setup = &dma_setup; /* Optional functions */ esp->dma_barrier = 0; esp->dma_drain = 0; esp->dma_invalidate = &dma_invalidate; esp->dma_irq_entry = 0; esp->dma_irq_exit = &dma_irq_exit; esp->dma_led_on = &dma_led_on; esp->dma_led_off = &dma_led_off; esp->dma_poll = 0; esp->dma_reset = 0; esp->dma_mmu_get_scsi_one = &dma_mmu_get_scsi_one; esp->dma_mmu_get_scsi_sgl = &dma_mmu_get_scsi_sgl; esp->dma_mmu_release_scsi_one = &dma_mmu_release_scsi_one; esp->dma_mmu_release_scsi_sgl = &dma_mmu_release_scsi_sgl; esp->dma_advance_sg = &dma_advance_sg; /* SCSI chip speed */ /* Looking at the quartz of the SCSI board... */ esp->cfreq = 25000000; /* The DMA registers on the CyberStorm are mapped * relative to the device (i.e. in the same Zorro * I/O block). */ esp->dregs = (void *)(address + OKTAGON_DMA_ADDR); paddress = (long *) esp->dregs; /* ESP register base */ esp->eregs = eregs; /* Set the command buffer */ esp->esp_command = (volatile unsigned char*) cmd_buffer; /* Yes, the virtual address. See below. */ esp->esp_command_dvma = (__u32) cmd_buffer; esp->irq = IRQ_AMIGA_PORTS; request_irq(IRQ_AMIGA_PORTS, esp_intr, SA_SHIRQ, "BSC Oktagon SCSI", esp->ehost); /* Figure out our scsi ID on the bus */ esp->scsi_id = 7; /* We don't have a differential SCSI-bus. */ esp->diff = 0; esp_initialize(esp); printk("ESP_Oktagon Driver 1.1" #ifdef USE_BOTTOM_HALF " [BOTTOM_HALF]" #else " [IRQ]" #endif " registered.\n"); printk("ESP: Total of %d ESP hosts found, %d actually in use.\n", nesps,esps_in_use); esps_running = esps_in_use; current_esp = esp; register_reboot_notifier(&oktagon_notifier); return esps_in_use; } } return 0; }
/***************************************************************** Detection */ int __init blz1230_esp_detect(Scsi_Host_Template *tpnt) { struct NCR_ESP *esp; struct zorro_dev *z = NULL; unsigned long address; struct ESP_regs *eregs; unsigned long board; #if MKIV #define REAL_BLZ1230_ID ZORRO_PROD_PHASE5_BLIZZARD_1230_IV_1260 #define REAL_BLZ1230_ESP_ADDR BLZ1230_ESP_ADDR #define REAL_BLZ1230_DMA_ADDR BLZ1230_DMA_ADDR #else #define REAL_BLZ1230_ID ZORRO_PROD_PHASE5_BLIZZARD_1230_II_FASTLANE_Z3_CYBERSCSI_CYBERSTORM060 #define REAL_BLZ1230_ESP_ADDR BLZ1230II_ESP_ADDR #define REAL_BLZ1230_DMA_ADDR BLZ1230II_DMA_ADDR #endif if ((z = zorro_find_device(REAL_BLZ1230_ID, z))) { board = z->resource.start; if (request_mem_region(board+REAL_BLZ1230_ESP_ADDR, sizeof(struct ESP_regs), "NCR53C9x")) { /* Do some magic to figure out if the blizzard is * equipped with a SCSI controller */ address = ZTWO_VADDR(board); eregs = (struct ESP_regs *)(address + REAL_BLZ1230_ESP_ADDR); esp = esp_allocate(tpnt, (void *)board+REAL_BLZ1230_ESP_ADDR); esp_write(eregs->esp_cfg1, (ESP_CONFIG1_PENABLE | 7)); udelay(5); if(esp_read(eregs->esp_cfg1) != (ESP_CONFIG1_PENABLE | 7)) goto err_out; /* Do command transfer with programmed I/O */ esp->do_pio_cmds = 1; /* Required functions */ esp->dma_bytes_sent = &dma_bytes_sent; esp->dma_can_transfer = &dma_can_transfer; esp->dma_dump_state = &dma_dump_state; esp->dma_init_read = &dma_init_read; esp->dma_init_write = &dma_init_write; esp->dma_ints_off = &dma_ints_off; esp->dma_ints_on = &dma_ints_on; esp->dma_irq_p = &dma_irq_p; esp->dma_ports_p = &dma_ports_p; esp->dma_setup = &dma_setup; /* Optional functions */ esp->dma_barrier = 0; esp->dma_drain = 0; esp->dma_invalidate = 0; esp->dma_irq_entry = 0; esp->dma_irq_exit = 0; esp->dma_led_on = 0; esp->dma_led_off = 0; esp->dma_poll = 0; esp->dma_reset = 0; /* SCSI chip speed */ esp->cfreq = 40000000; /* The DMA registers on the Blizzard are mapped * relative to the device (i.e. in the same Zorro * I/O block). */ esp->dregs = (void *)(address + REAL_BLZ1230_DMA_ADDR); /* ESP register base */ esp->eregs = eregs; /* Set the command buffer */ esp->esp_command = cmd_buffer; esp->esp_command_dvma = virt_to_bus((void *)cmd_buffer); esp->irq = IRQ_AMIGA_PORTS; esp->slot = board+REAL_BLZ1230_ESP_ADDR; if (request_irq(IRQ_AMIGA_PORTS, esp_intr, SA_SHIRQ, "Blizzard 1230 SCSI IV", esp->ehost)) goto err_out; /* Figure out our scsi ID on the bus */ esp->scsi_id = 7; /* We don't have a differential SCSI-bus. */ esp->diff = 0; esp_initialize(esp); printk("ESP: Total of %d ESP hosts found, %d actually in use.\n", nesps, esps_in_use); esps_running = esps_in_use; return esps_in_use; } } return 0; err_out: scsi_unregister(esp->ehost); esp_deallocate(esp); release_mem_region(board+REAL_BLZ1230_ESP_ADDR, sizeof(struct ESP_regs)); return 0; }
/***************************************************************** Detection */ int __init cyberII_esp_detect(Scsi_Host_Template *tpnt) { struct NCR_ESP *esp; struct zorro_dev *z = NULL; unsigned long address; struct ESP_regs *eregs; if ((z = zorro_find_device(ZORRO_PROD_PHASE5_CYBERSTORM_MK_II, z))) { unsigned long board = z->resource.start; if (request_mem_region(board+CYBERII_ESP_ADDR, sizeof(struct ESP_regs), "NCR53C9x")) { /* Do some magic to figure out if the CyberStorm Mk II * is equipped with a SCSI controller */ address = (unsigned long)ZTWO_VADDR(board); eregs = (struct ESP_regs *)(address + CYBERII_ESP_ADDR); esp = esp_allocate(tpnt, (void *)board+CYBERII_ESP_ADDR); esp_write(eregs->esp_cfg1, (ESP_CONFIG1_PENABLE | 7)); udelay(5); if(esp_read(eregs->esp_cfg1) != (ESP_CONFIG1_PENABLE | 7)) { esp_deallocate(esp); scsi_unregister(esp->ehost); release_mem_region(board+CYBERII_ESP_ADDR, sizeof(struct ESP_regs)); return 0; /* Bail out if address did not hold data */ } /* Do command transfer with programmed I/O */ esp->do_pio_cmds = 1; /* Required functions */ esp->dma_bytes_sent = &dma_bytes_sent; esp->dma_can_transfer = &dma_can_transfer; esp->dma_dump_state = &dma_dump_state; esp->dma_init_read = &dma_init_read; esp->dma_init_write = &dma_init_write; esp->dma_ints_off = &dma_ints_off; esp->dma_ints_on = &dma_ints_on; esp->dma_irq_p = &dma_irq_p; esp->dma_ports_p = &dma_ports_p; esp->dma_setup = &dma_setup; /* Optional functions */ esp->dma_barrier = 0; esp->dma_drain = 0; esp->dma_invalidate = 0; esp->dma_irq_entry = 0; esp->dma_irq_exit = 0; esp->dma_led_on = &dma_led_on; esp->dma_led_off = &dma_led_off; esp->dma_poll = 0; esp->dma_reset = 0; /* SCSI chip speed */ esp->cfreq = 40000000; /* The DMA registers on the CyberStorm are mapped * relative to the device (i.e. in the same Zorro * I/O block). */ esp->dregs = (void *)(address + CYBERII_DMA_ADDR); /* ESP register base */ esp->eregs = eregs; /* Set the command buffer */ esp->esp_command = cmd_buffer; esp->esp_command_dvma = virt_to_bus((void *)cmd_buffer); esp->irq = IRQ_AMIGA_PORTS; request_irq(IRQ_AMIGA_PORTS, esp_intr, SA_SHIRQ, "CyberStorm SCSI Mk II", esp_intr); /* Figure out our scsi ID on the bus */ esp->scsi_id = 7; /* We don't have a differential SCSI-bus. */ esp->diff = 0; esp_initialize(esp); printk("ESP: Total of %d ESP hosts found, %d actually in use.\n", nesps, esps_in_use); esps_running = esps_in_use; return esps_in_use; } } return 0; }