write(0x00,1); //select
write(0xf1,1); //f1:Ack c in
write(0x01,1); //01:Select End1
write(0xf1,1); //ack c out
USART_Transmit(0xA1);
write(0x80,1);//80:Read Endpoint Status
tmp = read();
USART_Transmit(tmp);
USART_Transmit(0xA2);
write(0x40,1); //read last transaction status
tmp = read();
USART_Transmit(tmp);
write(0x00,1); //select
read();
write(0xf0,1);
read();
tmp = read();
lastsetup[0] = read();//first bit
lastsetup[1] = read();
lastsetup[2] = read();
lastsetup[3] = read();
lastsetup[4] = read();
lastsetup[5] = read();
lastsetup[6] = read();
lastsetup[7] = read();
USART_Transmit(tmp);
for(i=0;i<8;i++)
USART_Transmit(lastsetup[i]);
//if(lastsetup[1]==6)PORTB++;
write(0xf2,1); //F2:Clear buffer
USART_Transmit(0xA3);
write(0x80,1);//80:Read Endpoint Status
tmp = read();
USART_Transmit(tmp);
USART_Transmit(0xA4);
write(0x81,1);//80:Read Endpoint Status
tmp = read();
USART_Transmit(tmp);
write(0x01,1); //select c in
read();
write(0xf0,1); //write buffer
write(0x00,0); //reserved
write(0x10,0); //size
//Data start
for (i=0;i<16;i++)
{
write(descriptor[i],0);
}
write(0xFA,1); //validate buffer
接到Control Out的Setup(Get_Descriptor)后如上处理,但貌似事实上没有ACK,由串口看出这段程序完了之后主机又重发Bus Reset和Setup(Get_Descriptor),怎么回事?