void SlavFifo_SendData(unsigned char *SendData_Pointer,unsigned short int Data_Lenth)
{
unsigned short int i;
while (EP6_FullFlag_Pin)
{ /*满标志为真,就直接退出出*/
FifoSednEP_Full_FlagOn = 1;
INT_Event_Flag_On = 1;
return;
}
Exiti_Irq_Disable(); /*禁止中断,防止接受数据改变指针*/
SlaveFifo_ADR0_OP = 0; /*Adr1:Adr0:
00 :EP2
01 :EP4
10 :EP6
11 :EP8
*/
SlaveFifo_ADR1_OP = 1; /*选择端点:6 */
GPIO_PinD_CfigeH = 0x33333333; /*选择端口D为50MHZ,推挽输出*/
GPIO_PinD_CfigeL = 0x33333333;
SlaveFifo_SLOE_OP = 1; /*选择从FIFO读出数据处理*/
SlaveFifo_SLWR_OP = 1; /*FIFO读选线拉高*/
SlaveFifo_PKTEND_OP = 1;
for (i = 0; i < Data_Lenth; i++)
{
if (EP6_FullFlag_Pin)
{ /*缓冲区满,退出循环*/
FifoSednEP_Full_FlagOn = 1;
INT_Event_Flag_On = 1; /*在发送数据的过程中检测到发送端点缓冲区已经满了,也退出*/
break;
}
else
{
Fifo_Data_Out = *(SendData_Pointer + i) & 0xff; /*发送数据*/
*(SendData_Pointer + i) = 0;
SlaveFifo_SLWR_OP = 0;
SlaveFifo_SLWR_OP = 1;
}
}
SlaveFifo_PKTEND_OP = 0;
GPIO_PinD_CfigeH = 0x88888888; /*选择端口D为,上拉输入*/
GPIO_PinD_CfigeL = 0x88888888;
SlaveFifo_PKTEND_OP = 1;
if (FifoReceive_BUF_Fill_FlagOn == 0)
{ /*如果接收缓冲区满的标志为真*/
Exiti_Irq_Enable();
}
FifoTransmit_TBuf_Conter++;
}