Subversion Repositories freemyipod

Rev

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

Rev 427 Rev 560
Line 24... Line 24...
24
#include "global.h"
24
#include "global.h"
25
#include "spi.h"
25
#include "spi.h"
26
#include "s5l8702.h"
26
#include "s5l8702.h"
27
#include "thread.h"
27
#include "thread.h"
28
#include "clockgates.h"
28
#include "clockgates.h"
-
 
29
#include "clockgates-target.h"
29
 
30
 
30
 
31
 
31
static struct mutex spimutex[3];
32
static struct mutex spimutex[3];
32
static struct wakeup spiwakeup[3];
33
static struct wakeup spiwakeup[3];
33
 
34
 
Line 77... Line 78...
77
    }
78
    }
78
    SPISETUP(port) |= 0x41;
79
    SPISETUP(port) |= 0x41;
79
    void* addr = (void*)((uint32_t)buf + size);
80
    void* addr = (void*)((uint32_t)buf + size);
80
    struct dma_lli* lli = (struct dma_lli*)(((uint32_t)addr - 0x10) & ~0xf);
81
    struct dma_lli* lli = (struct dma_lli*)(((uint32_t)addr - 0x10) & ~0xf);
81
    struct dma_lli* nextlli = NULL;
82
    struct dma_lli* nextlli = NULL;
-
 
83
    clockgate_dma(0, port + 5, true);
82
    while (addr > buf)
84
    while (addr > buf)
83
    {
85
    {
84
        size = (uint32_t)addr - (uint32_t)buf;
86
        size = (uint32_t)addr - (uint32_t)buf;
85
        if (size > 0xfff) size = 0xfff;
87
        if (size > 0xfff) size = 0xfff;
86
        else lli = (struct dma_lli*)((int)&DMAC0CLLI(port + 5));
88
        else lli = (struct dma_lli*)((int)&DMAC0CLLI(port + 5));
Line 93... Line 95...
93
        lli = &lli[-1];
95
        lli = &lli[-1];
94
    }
96
    }
95
    clean_dcache();
97
    clean_dcache();
96
    DMAC0CCONFIG(port + 5) = 0x9001 | (SPIDMA(port) << 1);
98
    DMAC0CCONFIG(port + 5) = 0x9001 | (SPIDMA(port) << 1);
97
    wakeup_wait(&spiwakeup[port], TIMEOUT_BLOCK);
99
    wakeup_wait(&spiwakeup[port], TIMEOUT_BLOCK);
-
 
100
    clockgate_dma(0, port + 5, false);
98
    invalidate_dcache();
101
    invalidate_dcache();
99
    SPISETUP(port) &= ~0x41;
102
    SPISETUP(port) &= ~0x41;
100
}
103
}
101
 
104
 
102
void INT_DMAC0C5()
105
void INT_DMAC0C5()