Fixed IDE issues

Can now read a directory.
This commit is contained in:
Peter Weingartner 2021-10-06 11:54:33 -04:00
parent c4d9642b38
commit 863bbd9472
6 changed files with 5243 additions and 5217 deletions

View file

@ -0,0 +1,9 @@
Keyboard Status LED:
Gabe Control Register $00C00006 (16bit write)
Bit[2:0] = Bit 0 - Blue On/Off, Bit 1 - Green On/Off, Bit 2 - Red On/Off - This is the LED Close to DEL key
Bit[5:3] = Bit 3 - Blue On/Off, Bit 4 - Green On/Off, Bit 5 - Red On/Off - This is the LED below 1st one
Bit[8:6] = Bit 6 - Blue On/Off, Bit 7 - Green On/Off, Bit 8 - Red On/Off - This is the LED above Arrow Key
Bit[11:9] = Bit 9 - Blue On/Off, Bit 10 - Green On/Off, Bit 11 - Red On/Off - This is the Caps Lock LED (on Rev C Keyboard)
You can now change the FONT Set
// $00C48000..$00C48FFF - FONT MEMORY Channel A
// $00C88000..$00C88FFF - FONT MEMORY Channel B

View file

@ -81,9 +81,13 @@ short pata_wait_ready_not_busy() {
TRACE("pata_wait_ready_not_busy");
// do {
// status = *PATA_CMD_STAT;
// } while (((status & (PATA_STAT_DRDY | PATA_STAT_BSY)) != PATA_STAT_DRDY) && (count-- > 0));
do {
status = *PATA_CMD_STAT;
} while (((status & (PATA_STAT_DRDY | PATA_STAT_BSY)) != PATA_STAT_DRDY) && (count-- > 0));
while ((*PATA_CMD_STAT & PATA_STAT_DRDY) != PATA_STAT_DRDY);
} while ((*PATA_CMD_STAT & PATA_STAT_BSY) == PATA_STAT_BSY);
if (count == 0) {
return DEV_TIMEOUT;
@ -106,7 +110,7 @@ short pata_wait_data_request() {
do {
status = *PATA_CMD_STAT;
} while (((status & PATA_STAT_DRQ) == 0) && (count-- > 0));
} while (((status & PATA_STAT_DRQ) != PATA_STAT_DRQ) && (count-- > 0));
if (count == 0) {
return DEV_TIMEOUT;
@ -230,6 +234,7 @@ short pata_read(long lba, unsigned char * buffer, short size) {
short i;
unsigned short *wptr;
TRACE("pata_read");
log_num(LOG_VERBOSE, "pata_read lba: ", lba);
if (pata_wait_ready_not_busy()) {
return DEV_TIMEOUT;
@ -243,7 +248,7 @@ short pata_read(long lba, unsigned char * buffer, short size) {
*PATA_SECT_CNT = 1; // Read one sector (make this an option?)
*PATA_SECT_SRT = lba & 0xff; // Set the rest of the LBA
*PATA_CLDR_LO = (lba >> 8) & 0xff;
*PATA_CLDR_LO = (lba >> 16) & 0xff;
*PATA_CLDR_HI = (lba >> 16) & 0xff;
*PATA_CMD_STAT = PATA_CMD_READ_SECTOR; // Issue the READ command
@ -253,6 +258,10 @@ short pata_read(long lba, unsigned char * buffer, short size) {
return DEV_TIMEOUT;
}
if (pata_wait_data_request()) {
return DEV_TIMEOUT;
}
// Copy the data... let the compiler and the FPGA worry about endianess
for (i = 0, wptr = (unsigned short *)buffer; i < size; i += 2) {
*wptr++ = *PATA_DATA_16;

View file

@ -12,6 +12,7 @@
#include "dev/text_screen_iii.h"
#include "ff.h" /* Obtains integer types */
#include "diskio.h" /* Declarations of disk functions */
#include "simpleio.h"
/* Definitions of physical drive number for each drive */
#define DEV_SDC 0 /* Example: Map Ramdisk to physical drive 0 */
@ -75,10 +76,10 @@ DRESULT disk_read (
for (i = 0; i < count; i++) {
result = bdev_read(pdrv, sector, buff, 512);
if (result < 0) {
DEBUG("disk_read error: ");
log_num(LOG_ERROR, "disk_read error: ", result);
return RES_PARERR;
} else {
sector += result;
sector++;
}
}

File diff suppressed because it is too large Load diff

View file

@ -36,7 +36,7 @@
#define PATA_STAT_ERR 0x01 // ERR (Error) indicates that an error occurred during execution of the previous command.
#define PATA_CMD_INIT 0x00
#define PATA_CMD_READ_SECTOR 0x21
#define PATA_CMD_READ_SECTOR 0x20 // 0x21
#define PATA_CMD_WRITE_SECTOR 0x30
#define PATA_CMD_IDENTITY 0xEC

File diff suppressed because it is too large Load diff