Subversion Repositories freemyipod

Rev

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

Rev 432 Rev 601
Line 23... Line 23...
23
 
23
 
24
#include "global.h"
24
#include "global.h"
25
#include "usb/usbtarget.h"
25
#include "usb/usbtarget.h"
26
#include "usb/usbdrv.h"
26
#include "usb/usbdrv.h"
27
#include "storage_ata-target.h"
27
#include "storage_ata-target.h"
-
 
28
#include "thread.h"
28
 
29
 
29
 
30
 
30
int usb_target_handle_request(uint32_t* buffer, int bufsize)
31
int usb_target_handle_request(uint32_t* buffer, int bufsize)
31
{
32
{
32
    int size = 0;
33
    int size = 0;
Line 52... Line 53...
52
            size = 32;
53
            size = 32;
53
            break;
54
            break;
54
        }
55
        }
55
        case 0xffff0002:  // LOWLEVEL DISK ACCESS
56
        case 0xffff0002:  // LOWLEVEL DISK ACCESS
56
        {
57
        {
-
 
58
            mutex_lock(&ata_mutex, TIMEOUT_BLOCK);
57
#ifdef ATA_HAVE_BBT
59
#ifdef ATA_HAVE_BBT
58
            int rc = ata_rw_sectors_internal((((uint64_t)(buffer[3])) << 32) | buffer[2],
60
            int rc = ata_rw_sectors_internal((((uint64_t)(buffer[3])) << 32) | buffer[2],
59
                                             buffer[4], (void*)(buffer[5]), (bool)(buffer[1]));
61
                                             buffer[4], (void*)(buffer[5]), (bool)(buffer[1]));
60
#else
62
#else
61
            int rc = ata_rw_sectors((((uint64_t)(buffer[3])) << 32) | buffer[2],
63
            int rc = ata_rw_sectors((((uint64_t)(buffer[3])) << 32) | buffer[2],
62
                                    buffer[4], (void*)(buffer[5]), (bool)(buffer[1]));
64
                                    buffer[4], (void*)(buffer[5]), (bool)(buffer[1]));
63
#endif
65
#endif
-
 
66
            mutex_unlock(&ata_mutex);
64
            buffer[0] = 1;
67
            buffer[0] = 1;
65
            buffer[1] = (uint32_t)rc;
68
            buffer[1] = (uint32_t)rc;
66
            size = 16;
69
            size = 16;
67
            break;
70
            break;
68
        }
71
        }