Subversion Repositories freemyipod

Rev

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

Rev 58 Rev 66
Line 49... Line 49...
49
int usb_drv_port_speed(void)
49
int usb_drv_port_speed(void)
50
{
50
{
51
    return (DSTS & 2) == 0 ? 1 : 0;
51
    return (DSTS & 2) == 0 ? 1 : 0;
52
}
52
}
53
 
53
 
54
void reset_endpoints(int reinit)
54
static void reset_endpoints(int reinit)
55
{
55
{
56
    unsigned int i;
56
    unsigned int i;
57
    for (i = 0; i < sizeof(endpoints)/sizeof(struct ep_type); i++)
57
    for (i = 0; i < sizeof(endpoints)/sizeof(struct ep_type); i++)
58
    {
58
    {
59
        if (reinit) endpoints[i].active = false;
59
        if (reinit) endpoints[i].active = false;
Line 255... Line 255...
255
void usb_drv_set_address(int address)
255
void usb_drv_set_address(int address)
256
{
256
{
257
    DCFG = (DCFG & ~0x7F0) | (address << 4);
257
    DCFG = (DCFG & ~0x7F0) | (address << 4);
258
}
258
}
259
 
259
 
260
void ep_send(int ep, const void *ptr, int length)
260
static void ep_send(int ep, const void *ptr, int length)
261
{
261
{
262
    endpoints[ep].busy = true;
262
    endpoints[ep].busy = true;
263
    endpoints[ep].size = length;
263
    endpoints[ep].size = length;
264
    DIEPCTL(ep) |= 0x8000;  /* EPx OUT ACTIVE */
264
    DIEPCTL(ep) |= 0x8000;  /* EPx OUT ACTIVE */
265
    int blocksize = usb_drv_port_speed() ? 512 : 64;
265
    int blocksize = usb_drv_port_speed() ? 512 : 64;
Line 271... Line 271...
271
    }
271
    }
272
    else
272
    else
273
    {
273
    {
274
        DIEPTSIZ(ep) = length | (packets << 19);
274
        DIEPTSIZ(ep) = length | (packets << 19);
275
        DIEPDMA(ep) = (uint32_t)ptr;
275
        DIEPDMA(ep) = (uint32_t)ptr;
276
//        if (length > 64) panicf(PANIC_FATAL, "%08X %08X %08X\n%08X %08X %08X", ptr, length | (packets << 19), DIEPCTL(ep), DIEPDMA(ep), DIEPTSIZ(ep), DIEPINT(ep));
-
 
277
    }
276
    }
278
    clean_dcache();
277
    clean_dcache();
279
    DIEPCTL(ep) |= 0x84000000;  /* EPx OUT ENABLE CLEARNAK */
278
    DIEPCTL(ep) |= 0x84000000;  /* EPx OUT ENABLE CLEARNAK */
280
}
279
}
281
 
280
 
282
void ep_recv(int ep, void *ptr, int length)
281
static void ep_recv(int ep, void *ptr, int length)
283
{
282
{
284
    endpoints[ep].busy = true;
283
    endpoints[ep].busy = true;
285
    endpoints[ep].size = length;
284
    endpoints[ep].size = length;
286
    DOEPCTL(ep) &= ~0x20000;  /* EPx UNSTALL */
285
    DOEPCTL(ep) &= ~0x20000;  /* EPx UNSTALL */
287
    DOEPCTL(ep) |= 0x8000;  /* EPx OUT ACTIVE */
286
    DOEPCTL(ep) |= 0x8000;  /* EPx OUT ACTIVE */