Subversion Repositories freemyipod

Rev

Rev 221 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 221 Rev 225
Line 351... Line 351...
351
        if (stall) DOEPCTL(endpoint) |= 0x00200000;
351
        if (stall) DOEPCTL(endpoint) |= 0x00200000;
352
        else DOEPCTL(endpoint) &= ~0x00200000;
352
        else DOEPCTL(endpoint) &= ~0x00200000;
353
    }
353
    }
354
}
354
}
355
 
355
 
356
void usb_drv_power_up(void)
356
void usb_drv_power_up(void)
357
{
357
{
358
    /* Enable USB clock */
358
    /* Enable USB clock */
359
    clockgate_enable(CLOCKGATE_USB_1, true);
359
    clockgate_enable(CLOCKGATE_USB_1, true);
360
    clockgate_enable(CLOCKGATE_USB_2, true);
360
    clockgate_enable(CLOCKGATE_USB_2, true);
361
    PCGCCTL = 0;
361
    PCGCCTL = 0;
362
 
362
 
363
    /* reset the beast */
363
    /* reset the beast */
364
    usb_reset();
364
    usb_reset();
365
}
365
}
366
 
366
 
367
void usb_drv_power_down(void)
367
void usb_drv_power_down(void)
368
{
368
{
369
    DCTL = 0x802;  /* Soft Disconnect */
369
    DCTL = 0x802;  /* Soft Disconnect */
370
 
370
 
371
    ORSTCON = 1;  /* Put the PHY into reset (needed to get current down) */
371
    ORSTCON = 1;  /* Put the PHY into reset (needed to get current down) */
372
    PCGCCTL = 1;  /* Shut down PHY clock */
372
    PCGCCTL = 1;  /* Shut down PHY clock */
373
    OPHYPWR = 0xF;  /* PHY: Power down */
373
    OPHYPWR = 0xF;  /* PHY: Power down */
374
    
374
    
375
    clockgate_enable(CLOCKGATE_USB_1, false);
375
    clockgate_enable(CLOCKGATE_USB_1, false);
376
    clockgate_enable(CLOCKGATE_USB_2, false);
376
    clockgate_enable(CLOCKGATE_USB_2, false);
377
}
377
}
378
 
378
 
379
void usb_check_vbus()
379
void usb_check_vbus()
380
{
380
{
381
    bool oldstate = false;
381
    bool oldstate = false;
382
    while (true)
382
    while (true)
383
    {
383
    {