Show
Ignore:
Timestamp:
02/25/09 01:21:12 (3 years ago)
Author:
mwhitworth
Message:

Move ind/inw reading code to AtaDataRead function, let ATA disk code use it, check against drive->totalSectors for out of bound I/O, and misc formatting.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • Whitix/trunk/devices/storage/ata/ata-cd.c

    r1885 r1916  
    101101/*********************************************************************** 
    102102 * 
    103  * FUNCTION:    AtapiRead 
    104  * 
    105  * DESCRIPTION: Read data from the drive controller. 
    106  * 
    107  * PARAMETERS:  controller - controller of the drive. 
    108  *                              buffer - buffer to transfer data into. 
    109  *                              count - number of bytes available. 
    110  * 
    111  * RETURNS:             Nothing. 
    112  * 
    113  ***********************************************************************/ 
    114  
    115 static void AtapiRead(struct AtaDrive* drive, BYTE* buffer, int count) 
    116 { 
    117         if (!count) 
    118         { 
    119                 KePrint("AtapiRead: no bytes to read.\n"); 
    120                 return; 
    121         } 
    122          
    123         if (drive->ioFlags & ATA_IO_DWORD) 
    124                 insd(CTRL_REG(drive->parent, REG_DATA), buffer, count >> 2); 
    125         else 
    126                 insw(CTRL_REG(drive->parent,REG_DATA), buffer, count >> 1); 
    127 } 
    128  
    129 /*********************************************************************** 
    130  * 
    131103 * FUNCTION:    AtapiError 
    132104 * 
     
    205177                count=AtapiTransferCount(drive->parent); 
    206178                 
    207                 AtapiRead(drive, (BYTE*)request->data, count); 
     179                AtaDataRead(drive, (BYTE*)request->data, count); 
    208180                 
    209181                request->data+=ATAPI_SECTOR_SIZE;