Example #1
0
File: ehci.c Project: MWDD/osdev
// ------------------------------------------------------------------------------------------------
static void ehci_probe(EHCI_Controller* hc)
{
    // Port setup
    uint port_count = hc->cap_regs->hcs_params & HCSPARAMS_N_PORTS_MASK;
    for (uint port = 0; port < port_count; ++port)
    {
        // Reset port
        uint status = ehci_reset_port(hc, port);

        if (status & PORT_ENABLE)
        {
            uint speed = USB_HIGH_SPEED;

            USB_Device* dev = usb_dev_create();
            if (dev)
            {
                dev->parent = 0;
                dev->hc = hc;
                dev->port = port;
                dev->speed = speed;
                dev->max_packet_size = 8;

                dev->hc_control = ehci_dev_control;
                dev->hc_intr = ehci_dev_intr;

                if (!usb_dev_init(dev))
                {
                    // TODO - cleanup
                }
            }
        }
    }
}
int usb_cpu_init(void)
{

#if defined(CONFIG_440EP) || defined(CONFIG_440EPX)
	usb_dev_init();
#endif

	return 0;
}
Example #3
0
int usb_cpu_init(void)
{
#ifdef CONFIG_4xx_DCACHE
	/* disable cache */
	change_tlb(gd->bd->bi_memstart, gd->bd->bi_memsize, TLB_WORD2_I_ENABLE);
#endif

#if defined(CONFIG_440EP) || defined(CONFIG_440EPX)
	usb_dev_init();
#endif
	return 0;
}
Example #4
0
usb_cdc_class_t * usb_cdc_init(const usb_dev_t * usb,
                               const uint8_t * const str[],
                               unsigned int strcnt)
{
    struct usb_cdc_acm_dev * dev = &usb_cdc_rt;
    usb_class_t * cl =  (usb_class_t *)dev;

    /* initialize USB device */
    dev->usb = (usb_dev_t *)usb;

#ifndef CDC_RX_SEM_NO
    dev->rx_sem = thinkos_sem_alloc(0);
#endif
#ifndef CDC_TX_DONE_NO
    dev->tx_done = thinkos_flag_alloc();
#endif
#ifndef CDC_TX_LOCK_NO
    dev->tx_lock = thinkos_flag_alloc();
#endif
#ifndef CDC_CTL_FLAG_NO
    dev->ctl_flag = thinkos_flag_alloc();
#endif

    dev->rx_cnt = 0;
    dev->rx_pos = 0;
    dev->str = str;
    dev->strcnt = strcnt;

    DCC_LOG4(LOG_INFO, "tx_done=%d tx_lock=%d rx_sem=%d ctl_flag=%d",
             TX_DONE, TX_LOCK, RX_SEM, CTL_FLAG);

    thinkos_flag_clr(TX_DONE);
    thinkos_flag_clr(TX_LOCK);
    thinkos_flag_clr(CTL_FLAG);

    usb_dev_init(dev->usb, cl, &usb_cdc_ev);

    return (usb_cdc_class_t *)dev;
}