Advertisement
Guest User

Untitled

a guest
Mar 26th, 2010
203
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1.  
  2. static void AT91F_USB_SendData(AT91PS_UDP pUdp, const char *pData, uint length)
  3. {
  4. uint cpt = 0;
  5. AT91_REG csr;
  6.  
  7. //serial_printf("EP0 SendData()\n");
  8.  
  9. do {
  10. cpt = MIN(length, 8);
  11. length -= cpt;
  12.  
  13. while (cpt--)
  14. pUdp->UDP_FDR[0] = *pData++;
  15.  
  16. if (pUdp->UDP_CSR[0] & AT91C_UDP_TXCOMP) {
  17. Udp_ep_clr_flag(pUdp, 0, AT91C_UDP_TXCOMP);
  18. }
  19.  
  20. Udp_ep_set_flag(pUdp, 0, AT91C_UDP_TXPKTRDY);
  21. do {
  22. csr = pUdp->UDP_CSR[0];
  23.  
  24. // Data IN stage has been stopped by a status OUT
  25. if (csr & AT91C_UDP_RX_DATA_BK0) {
  26. //serial_printf("EP0 SendData stopped by status OUT\n");
  27. Udp_ep_clr_flag(pUdp, 0, AT91C_UDP_RX_DATA_BK0);
  28. return;
  29. }
  30. } while ( !(csr & AT91C_UDP_TXCOMP) );
  31.  
  32. } while (length);
  33.  
  34. if (pUdp->UDP_CSR[0] & AT91C_UDP_TXCOMP) {
  35. Udp_ep_clr_flag(pUdp, 0, AT91C_UDP_TXCOMP);
  36. }
  37.  
  38. //serial_printf("EP0 SendData complete\n");
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement