Esempio n. 1
0
void ep_clear_stall(U8 ep_num)
{
    usb_pcb_t *pcb = usb_pcb_get();

    pcb->ep_stall &= ~(1 << ep_num);
    if( ep_num == 0 )
        SI32_USB_A_clear_stall_sent_ep0( SI32_USB_0 );
    else
    {
        if( ep_dir_get( ep_num ) == DIR_IN )
        {

            SI32_USBEP_A_reset_in_data_toggle( usb_ep[ ep_num - 1 ] );
            SI32_USBEP_A_stop_in_stall( usb_ep[ ep_num - 1 ] );
        }
        else
        {
            SI32_USBEP_A_reset_out_data_toggle( usb_ep[ ep_num - 1 ] );
            SI32_USBEP_A_stop_out_stall( usb_ep[ ep_num - 1 ] );
        }
    }
}
Esempio n. 2
0
void ep_reset_toggle(U8 ep_num)
{
    if( ep_num > 0 )
        SI32_USBEP_A_reset_out_data_toggle( usb_ep[ ep_num - 1 ] );
}
Esempio n. 3
0
void ep_config(U8 ep_num, U8 type, U8 dir, U8 size)
{
    // init the direction the fifo
    usb_buf_init(ep_num,  dir);

    // select the endpoint and reset it
    // FIXME

    if( ep_num > 0 )
    {
        if( dir == DIR_OUT )
        {
            switch( type )
            {
            case XFER_ISOCHRONOUS:
                SI32_USBEP_A_enable_out_isochronous_mode( usb_ep[ ep_num - 1 ] );
                break;
            case XFER_BULK:
            case XFER_INTP:
                SI32_USBEP_A_enable_out_bulk_interrupt_mode( usb_ep[ ep_num - 1 ] );
                break;
            case XFER_CONTROL:
                // only for EP0
                break;
            default:
                break;
            }
            SI32_USBEP_A_set_endpoint_direction_out( usb_ep[ ep_num - 1 ] );
            SI32_USBEP_A_clear_out_data_overrun( usb_ep[ ep_num - 1 ] );
            SI32_USBEP_A_stop_out_stall( usb_ep[ ep_num - 1 ] );
            SI32_USBEP_A_reset_out_data_toggle( usb_ep[ ep_num - 1 ] );
            SI32_USBEP_A_set_out_max_packet_size(usb_ep[ ep_num - 1 ], (1 << size) );
        }
        else
        {
            SI32_USBEP_A_set_endpoint_direction_in( usb_ep[ ep_num - 1 ] );
            SI32_USBEP_A_clear_in_data_underrun( usb_ep[ ep_num - 1 ] );
            switch( type )
            {
            case XFER_ISOCHRONOUS:
                SI32_USBEP_A_select_in_isochronous_mode( usb_ep[ ep_num - 1 ] );
                break;
            case XFER_BULK:
            case XFER_INTP:
                SI32_USBEP_A_select_in_bulk_interrupt_mode( usb_ep[ ep_num - 1 ] );
                SI32_USBEP_A_stop_in_stall( usb_ep[ ep_num - 1 ] );
                SI32_USBEP_A_reset_in_data_toggle( usb_ep[ ep_num - 1 ] );
                break;
            case XFER_CONTROL:
                // only for EP0
                break;
            default:
                break;
            }
            SI32_USBEP_A_set_in_max_packet_size(usb_ep[ ep_num - 1 ], (1 << size) );
        }
    }

    // Enable endpoints
    switch ( ep_num )
    {
    case 1:
        SI32_USB_A_enable_ep1( SI32_USB_0 );
        break;
    case 2:
        SI32_USB_A_enable_ep2( SI32_USB_0 );
        break;
    case 3:
        SI32_USB_A_enable_ep3( SI32_USB_0 );
        break;
    case 4:
        SI32_USB_A_enable_ep4( SI32_USB_0 );
    }


    //SI32_USB_A_reset_module (SI32_USB_0);




    /* if (ep_num == EP_CTRL)
    {
        RX_SETUP_INT_ENB();
        RX_OUT_INT_ENB();
    }
    else if (dir == DIR_OUT)
    {
        RX_OUT_INT_ENB();
    }*/
}
Esempio n. 4
0
void ep_reset_toggle(U8 ep_num)
{
    if( ( ep_num > 0 ) && ep_num <= sizeof( usb_ep ) / sizeof( usb_ep[ 0 ] ) )
        SI32_USBEP_A_reset_out_data_toggle( usb_ep[ ep_num - 1 ] );
}