HCS9S08 和 CH375的芯片
发送CMD_DISK_READ后等到了一个中断,读返回值USB_INT_DISK_READ后发CMD_RD_USB_DATA 指令,读取了64个字节后,再发送CMD_DISK_RD_GO指令后,就等不到中断了,搞了两天都没有弄明白,哪位高手能帮我解释一下吗?
int8_t read_disk_sector(uint32_t SectorNo) { uint8_t *p; uint8_t j,respond,length; p = DiskBuffer; if(!Ch375UdiskIn || !Ch375UdiskInit) return errors; USB_PORT_CS = USB_PORT_CS_EN; usb_send_cmd(CMD_DISK_READ); usb_send_data((uint8_t)SectorNo); usb_send_data((uint8_t)(SectorNo>>8)); usb_send_data((uint8_t)(SectorNo>>16)); usb_send_data((uint8_t)(SectorNo>>24)); usb_send_data(1); // 读一个扇区 delay_05us(20); // 11.55μs USB_PORT_CS = USB_PORT_CS_DIS; for(j=0;j<8;j++) { // 等待中断,等待 USB_INT_DISK_READ 中断状态,如果是USB_INT_SUCCESS,USB_INT_DISK_ERR,分别转相应处理 for(;;) { respond = usb_irq_check(0); if(respond == USB_INT_DISK_READ) break; else if(respond == USB_INT_SUCCESS) return rights; else if(respond == USB_INT_DISCONNECT) return errors; } USB_PORT_CS = USB_PORT_CS_EN; // usb_irq_check()程序修改了端口 usb_send_cmd(CMD_RD_USB_DATA); delay_05us(2); // 2μs length = usb_rev_data(); // 得到长度64, USB_PORT_A0 = USB_PORT_A0_DAT; USB_PORT_DATA_DIR = USB_PORT_DATA_DIR_IN; while(length) { USB_PORT_RE = USB_PORT_RE_EN; *p++ = USB_PORT_DATA; USB_PORT_RE = USB_PORT_RE_DIS; length--; } delay_05us(20); // 11.55μs usb_send_cmd(CMD_DISK_RD_GO); USB_PORT_CS = USB_PORT_CS_DIS; } USB_PORT_CS = USB_PORT_CS_DIS; return rights; }[Emot]2[/Emot]