Subversion Repositories freemyipod

Rev

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

Rev 835 Rev 850
Line 75... Line 75...
75
    DOEPCTL0 |= 0x84000000;  /* EP0 OUT ENABLE CLEARNAK */
75
    DOEPCTL0 |= 0x84000000;  /* EP0 OUT ENABLE CLEARNAK */
76
    if (reinit)
76
    if (reinit)
77
    {
77
    {
78
        /* The size is getting set to zero, because we don't know
78
        /* The size is getting set to zero, because we don't know
79
           whether we are Full Speed or High Speed at this stage */
79
           whether we are Full Speed or High Speed at this stage */
80
        /* EP1 IN INACTIVE DATA0 SIZE=0 NEXT=3 */
80
        /* EP1 DISABLED IN ACTIVE DATA0 SIZE=0 NEXT=3 */
81
        DIEPCTL1 = 0x10001800;
81
        DIEPCTL1 = 0x50009800;
82
        /* EP2 OUT INACTIVE DATA0 SIZE=0 */
82
        /* EP2 DISABLED OUT ACTIVE DATA0 SIZE=0 */
83
        DOEPCTL2 = 0x10000000;
83
        DOEPCTL2 = 0x50008000;
84
        /* EP3 IN INACTIVE DATA0 SIZE=0 NEXT=0 */
84
        /* EP3 DISABLED IN ACTIVE DATA0 SIZE=0 NEXT=0 */
85
        DIEPCTL3 = 0x10000000;
85
        DIEPCTL3 = 0x50008000;
86
        /* EP4 OUT INACTIVE DATA0 SIZE=0 */
86
        /* EP4 DISABLED OUT ACTIVE DATA0 SIZE=0 */
87
        DOEPCTL4 = 0x10000000;
87
        DOEPCTL4 = 0x50008000;
88
    }
88
    }
89
    else
89
    else
90
    {
90
    {
91
        /* INACTIVE DATA0 */
91
        /* DISABLED ACTIVE DATA0 */
92
        DIEPCTL1 = (DIEPCTL1 & ~0x00008000) | 0x10000000;
92
        DIEPCTL1 = DIEPCTL1 | 0x50008000;
93
        DOEPCTL2 = (DOEPCTL2 & ~0x00008000) | 0x10000000;
93
        DOEPCTL2 = DOEPCTL2 | 0x50008000;
94
        DIEPCTL3 = (DIEPCTL3 & ~0x00008000) | 0x10000000;
94
        DIEPCTL3 = DIEPCTL3 | 0x50008000;
95
        DOEPCTL4 = (DOEPCTL4 & ~0x00008000) | 0x10000000;
95
        DOEPCTL4 = DOEPCTL4 | 0x50008000;
96
    }
96
    }
97
    DAINTMSK = 0xFFFFFFFF;  /* Enable interrupts on all EPs */
97
    DAINTMSK = 0xFFFFFFFF;  /* Enable interrupts on all EPs */
98
}
98
}
99
 
99
 
100
int usb_drv_request_endpoint(int type, int dir)
100
int usb_drv_request_endpoint(int type, int dir)
Line 286... Line 286...
286
static void ep_recv(int ep, void *ptr, int length)
286
static void ep_recv(int ep, void *ptr, int length)
287
{
287
{
288
    endpoints[ep].busy = true;
288
    endpoints[ep].busy = true;
289
    endpoints[ep].size = length;
289
    endpoints[ep].size = length;
290
    DOEPCTL(ep) &= ~0x20000;  /* EPx UNSTALL */
290
    DOEPCTL(ep) &= ~0x20000;  /* EPx UNSTALL */
291
    DOEPCTL(ep) |= 0x8000;  /* EPx OUT ACTIVE */
-
 
292
    int blocksize = usb_drv_port_speed() ? 512 : 64;
291
    int blocksize = usb_drv_port_speed() ? 512 : 64;
293
    int packets = (length + blocksize - 1) / blocksize;
292
    int packets = (length + blocksize - 1) / blocksize;
294
    if (!length)
293
    if (!length)
295
    {
294
    {
296
        DOEPTSIZ(ep) = 1 << 19;  /* one empty packet */
295
        DOEPTSIZ(ep) = 1 << 19;  /* one empty packet */