Subversion Repositories freemyipod

Rev

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

Rev 966 Rev 968
Line 107... Line 107...
107
void ata_srst_after_error(bool enable)
107
void ata_srst_after_error(bool enable)
108
{
108
{
109
    ata_error_srst = enable;
109
    ata_error_srst = enable;
110
}
110
}
111
 
111
 
-
 
112
int ata_lock_exclusive(int timeout)
-
 
113
{
-
 
114
    return mutex_lock(&ata_mutex, timeout);
-
 
115
}
-
 
116
 
-
 
117
void ata_unlock_exclusive()
-
 
118
{
-
 
119
    mutex_unlock(&ata_mutex);
-
 
120
}
-
 
121
 
112
static uint16_t ata_read_cbr(uint32_t volatile* reg)
122
static uint16_t ata_read_cbr(uint32_t volatile* reg)
113
{
123
{
114
    while (!(ATA_PIO_READY & 2)) yield();
124
    while (!(ATA_PIO_READY & 2)) yield();
115
    uint32_t dummy = *reg;
125
    uint32_t dummy = *reg;
116
    while (!(ATA_PIO_READY & 1)) yield();
126
    while (!(ATA_PIO_READY & 1)) yield();
Line 1321... Line 1331...
1321
}
1331
}
1322
#endif
1332
#endif
1323
 
1333
 
1324
int ata_init(void)
1334
int ata_init(void)
1325
{
1335
{
-
 
1336
    // Remove this, as it isn't strictly required and causes a race condition.
-
 
1337
    // The clickwheel dispatcher can run ata_lock_exclusive before ata_init is run.
-
 
1338
    // BSS is initialized to zeroes, which are interpreted as an unlocked mutex anyway.
1326
    mutex_init(&ata_mutex);
1339
    //mutex_init(&ata_mutex);
1327
    wakeup_init(&ata_wakeup);
1340
    wakeup_init(&ata_wakeup);
1328
    wakeup_init(&mmc_wakeup);
1341
    wakeup_init(&mmc_wakeup);
1329
    wakeup_init(&mmc_comp_wakeup);
1342
    wakeup_init(&mmc_comp_wakeup);
1330
    ceata = PDAT(11) & BIT(1);
1343
    ceata = PDAT(11) & BIT(1);
1331
    ata_powered = false;
1344
    ata_powered = false;