Changeset 5481d1bb in mainline


Ignore:
Timestamp:
2009-06-13T09:45:33Z (15 years ago)
Author:
Jiri Svoboda <jirik.svoboda@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
d9f4c76
Parents:
4f5caea
Message:

Use named constants.

Location:
uspace/srv/bd/ata_bd
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/bd/ata_bd/ata_bd.c

    r4f5caea r5481d1bb  
    6969static atomic_t dev_futex = FUTEX_INITIALIZER;
    7070
    71 static disk_t disk[2];
     71static disk_t disk[MAX_DISKS];
    7272
    7373static int ata_bd_init(void);
     
    9797        printf("Reset drives...\n");
    9898        pio_write_8(&ctl->device_control, DCR_SRST);
    99 /*      printf("wait for busy\n");
    100         do {
    101                 status = pio_read_8(&cmd->status);
    102         } while ((status & SR_BSY) == 0);
    103 */
     99        /* FIXME: Find out how to do this properly. */
    104100        async_usleep(100);
    105101        pio_write_8(&ctl->device_control, 0);
     
    154150        pio_write_8(&cmd->drive_head, ((disk_id != 0) ? DHR_DRV : 0));
    155151        async_usleep(100);
    156         pio_write_8(&cmd->command, 0xEC);
     152        pio_write_8(&cmd->command, CMD_IDENTIFY_DRIVE);
    157153
    158154        status = pio_read_8(&cmd->status);
     
    170166        }
    171167
    172         for (i = 0; i < 256; i++) {
     168        for (i = 0; i < block_size / 2; i++) {
    173169                do {
    174170                        status = pio_read_8(&cmd->status);
     
    367363        pio_write_8(&cmd->cylinder_low, c & 0xff);
    368364        pio_write_8(&cmd->cylinder_high, c >> 16);
    369         pio_write_8(&cmd->command, 0x20);
     365        pio_write_8(&cmd->command, CMD_READ_SECTORS);
    370366
    371367        /* Read data from the disk buffer. */
    372368
    373         for (i = 0; i < 256; i++) {
     369        for (i = 0; i < block_size / 2; i++) {
    374370                do {
    375371                        status = pio_read_8(&cmd->status);
  • uspace/srv/bd/ata_bd/ata_bd.h

    r4f5caea r5481d1bb  
    118118};
    119119
     120enum ata_command {
     121        CMD_IDENTIFY_DRIVE      = 0xEC,
     122        CMD_READ_SECTORS        = 0x20,
     123        CMD_WRITE_SECTORS       = 0x30
     124};
     125
    120126typedef struct {
    121127        bool present;
Note: See TracChangeset for help on using the changeset viewer.