コード例 #1
0
ファイル: cdc.c プロジェクト: BrzTit/Bus_Pirate
BYTE putPARTARRAYUSBUSART(BYTE *data, BYTE length) // JTR2 added reduced overhead
{
    while ((Inbdp->BDSTAT & UOWN)) {
        if (!TestUsbInterruptEnabled()) {

            if (0 != FAST_usb_handler()) { // JTR2 Pop non-EP0 (USB IN) tranfers from the FIFO and also give SETUP PACKETs a chance.
                return 0xff;
            }
        }
    }
    Inbdp->BDADDR = data;
    Inbdp->BDCNT = length;
    Inbdp->BDSTAT = ((Inbdp->BDSTAT ^ DTS) & DTS) | UOWN | DTSEN;
    FAST_usb_handler();
    return length;
}//end putUSBUSARTFAST
コード例 #2
0
BYTE getsUSBUSART(BYTE *buffer, BYTE len) {
    cdc_Out_len = 0;
    if (0 == (Outbdp->BDSTAT & UOWN)) // Do we have a packet from host?
    {

        // Adjust the expected number of BYTEs to equal
        // the actual number of BYTEs received.

        if (len > Outbdp->BDCNT)
            len = Outbdp->BDCNT;

        // Copy data from dual-ram buffer to user's buffer

        for (cdc_Out_len = 0; cdc_Out_len < len; cdc_Out_len++)
            buffer[cdc_Out_len] = cdc_Out_buffer[cdc_Out_len];

        // Prepare dual-ram buffer for next OUT transaction

        if (!TestUsbInterruptEnabled()) {
            FAST_usb_handler(); // JTR2 Pop non-EP0 (USB IN) tranfers from the FIFO and also give SETUP PACKETs a chance.
        }
        Outbdp->BDCNT = CDC_BUFFER_SIZE;
        Outbdp->BDSTAT = ((Outbdp->BDSTAT ^ DTS) & DTS) | UOWN | DTSEN;
    }//end if

    return cdc_Out_len;

}//end getsUSBUSART
コード例 #3
0
ファイル: cdc.c プロジェクト: BrzTit/Bus_Pirate
BYTE WaitInReady() // JTR2 added reduced overhead
{
    while ((Inbdp->BDSTAT & UOWN)) {
        if (!TestUsbInterruptEnabled()) {
            if (0 != FAST_usb_handler()) // JTR2 Pop non-EP0 (USB IN) tranfers from the FIFO and also give SETUP PACKETs a chance.
                return 0;
        }
    }
    return 1;
}//end WaitInReady