void cdc_get_line_coding(void) {
    usb_unset_in_handler(0); // Unregister IN handler;
}
Exemplo n.º 2
0
void cdc_set_control_line_state_status(void) {
    usb_unset_in_handler(0);
}
Exemplo n.º 3
0
void usb_init(ROMPTR const unsigned char *device_descriptor,
        ROMPTR const unsigned char *config_descriptor,
        ROMPTR const unsigned char *string_descriptor,
        int num_string_descriptors) {
    int i;


    usb_device_descriptor = device_descriptor;
    usb_config_descriptor = config_descriptor;
    usb_string_descriptor = string_descriptor;
    usb_num_string_descriptors = num_string_descriptors;

    SetUsbAddress(0); // JTR added here. Probably not required though
    ResetPPbuffers();
    DisableUsbInterrupts();
    DisableAllUsbInterrupts();
    ClearAllUsbErrorInterruptFlags();
    ClearAllUsbInterruptFlags();
    ConfigureUsbHardware();

    sof_handler = NULL;
    class_setup_handler = NULL;
    vendor_setup_handler = NULL;

    for (i = 0; i < MAX_CHIP_EP; i++) {
        endpoints[i].out_handler = NULL;
        endpoints[i].in_handler = NULL;
    }
    // Register ep0 - no handlers

    usb_unset_in_handler(0);
    usb_unset_out_handler(0);

    // JTR All UEPx SPRs are hard coded. I cannot see much point of tables or indexing for these.
    // On the PIC16C765 such indexing was required for the STALL bit but now the STALL feature
    // is in the Buffer descriptor table not in the UEPx SPRs.
    // See changes to "USB_REQUEST_GET_STATUS"

    //	USB_UEP[0] = endpoints[0].type;

    USB_UEP0 = USB_EP_CONTROL;
    /* Configure endpoints TODO: Only ep0 ? */
    // JTR Right! code for other end points snipped...At this point we are only setting up EP0

#ifdef USB_SELF_POWERED
    usb_device_status = 0x0001;
#else
    usb_device_status = 0x0000;
#endif
    usb_device_state = 0x00; // JTR added flag byte for enumeration state
    usb_current_cfg = 0; // JTR formally usb_configured
    usb_addr_pending = 0x00;

#if USB_PP_BUF_MODE == 0
    usb_bdt[USB_CALC_BD(0, USB_DIR_OUT, USB_PP_EVEN)].BDCNT = USB_EP0_BUFFER_SIZE; // JTR endpoints[0].buffer_size; same thing done more obviously
    usb_bdt[USB_CALC_BD(0, USB_DIR_OUT, USB_PP_EVEN)].BDADDR = usb_ep0_out_buf; //endpoints[0].out_buffer;
    usb_bdt[USB_CALC_BD(0, USB_DIR_OUT, USB_PP_EVEN)].BDSTAT = UOWN + DTSEN;
    usb_bdt[USB_CALC_BD(0, USB_DIR_IN, USB_PP_EVEN)].BDCNT = 0;
    usb_bdt[USB_CALC_BD(0, USB_DIR_IN, USB_PP_EVEN)].BDADDR = usb_ep0_in_buf; //endpoints[0].in_buffer;
    usb_bdt[USB_CALC_BD(0, USB_DIR_IN, USB_PP_EVEN)].BDSTAT = DTS; // Set DTS => First packet inverts, ie. is Data0
#else
    // TODO: Implement Ping-Pong buffering setup.
#error "PP Mode not implemented yet"
#endif
}
Exemplo n.º 4
0
void cdc_set_line_coding_status(void) {
    usb_unset_in_handler(0);
}