unhandled interrupt 0x2E




unhandled interrupt 0x2E

Postby O++ » 27. Nov 2020, 19:15

In getting a wired unhandled interrupt 0x2E

Here is my code

Code: Select all

void AdvancedTechnologyAttachment::Identify()
{
    devicePort.Write(master ? 0xA0 : 0xB0);
    controlPort.Write(0);

    devicePort.Write(0xA0);
    uint8_t status = commandPort.Read();
    if (status == 0xFF)
        return;

    devicePort.Write(master ? 0xA0 : 0xB0);
    sectorCountPort.Write(0);
    lbaLowPort.Write(0);
    lbaMidPort.Write(0);
    lbaHiPort.Write(0);
    commandPort.Write(0xEC);

    status = commandPort.Read();
    if (status == 0x00)
        return;

    while (((status & 0x80) == 0x80) && ((status & 0x01) != 0x01))
        status = commandPort.Read();

    if (status & 0x01)
    {
        printf("ERROR");
        return;
    }

    for (int i = 0; i < 256; i++)
    {
        uint16_t data = dataPort.Read();
        char *text = "  \0";
        text[0] = (data >> 8) & 0xFF;
        text[1] = data & 0xFF;
        printf(text);
    }
    printf("\n");
}

void AdvancedTechnologyAttachment::Read28(common::uint32_t sector, common::uint8_t *data, int count)
{
    if (sector & 0x0FFFFFFF)
        return;

    if (count > bytesPerSector)
        return;

    devicePort.Write((master ? 0xE0 : 0xF0) | ((sector & 0x0F000000) >> 24));
    errorPort.Write(0);
    sectorCountPort.Write(1);
    lbaLowPort.Write(sector & 0x000000FF);
    lbaMidPort.Write((sector & 0x0000FF00) >> 8);
    lbaHiPort.Write((sector & 0x00FF0000) >> 16);
    commandPort.Write(0x20);

    uint8_t status = commandPort.Read();
    while (((status & 0x80) == 0x80) && ((status & 0x01) != 0x01))
        status = commandPort.Read();

    if (status & 0x01)
    {
        printf("ERROR Reading");
        return;
    }

    printf("\nReading from ATA: ");

    for (uint16_t i = 0; i < count; i += 2)
    {
        uint16_t wdata = dataPort.Read();

        char *text = "  \0";
        text[0] = wdata & 0x00FF;

        if (i + 1 < count)
            text[1] = (wdata >> 8) & 0x00FF;
        else
            text[1] = '\0';

        // printf(text);

        data[i] = wdata & 0x00FF;
        if (i + 1 < count)
            data[i + 1] = (wdata >> 8) & 0x00FF;
    }

    for (uint16_t i = count + (count % 2); i < bytesPerSector; i += 2)
        dataPort.Read();
}
O++
 
Posts: 2
Joined: 31. Oct 2020, 12:09

by Advertising » 27. Nov 2020, 19:15

Advertising
 

Return to General Discussion

Who is online

No registered users

cron