URL
https://opencores.org/ocsvn/or1k/or1k/trunk
Subversion Repositories or1k
Compare Revisions
- This comparison shows the changes necessary to convert path
/
- from Rev 1725 to Rev 1726
- ↔ Reverse comparison
Rev 1725 → Rev 1726
/trunk/or1ksim/peripheral/atadevice.c
449,14 → 449,14
case ATA_SR: |
TRACE( "read status register: %s\n", |
ata_pretty_status(device->regs.status) ); |
if ( (device->regs.device_head & ATA_DHR_DEV) == device->internals.dev) |
return device -> regs.status; |
else |
{ |
TRACE("device0 responds for device1, sr = 0x00\n"); |
return 0; // return 0 when device0 responds for device1 |
if((device->regs.device_head & ATA_DHR_DEV) == device->internals.dev) { |
device->sigs.intrq = 0; |
return device->regs.status; |
} |
|
TRACE("device0 responds for device1, sr = 0x00\n"); |
return 0; // return 0 when device0 responds for device1 |
|
// case ATA_DA : |
// return device -> regs.status; |
} |
/trunk/or1ksim/peripheral/atadevice.h
113,6 → 113,8
|
/******* Housekeeping *****************************************/ |
struct { |
/* Pointer to host that device is attached to */ |
void *host; |
/* device number */ |
int dev; |
|
/trunk/or1ksim/peripheral/atahost.c
33,6 → 33,7
#include "abstract.h" |
#include "sim-config.h" |
#include "sched.h" |
#include "pic.h" |
#include "debug.h" |
|
#include "atahost.h" |
78,6 → 79,18
/* ========================================================================= */ |
|
|
/* Assert interrupt */ |
void ata_int(void *dat) |
{ |
ata_host *ata = dat; |
if(!(ata->regs.stat & ATA_IDEIS)) { |
ata->regs.stat |= ATA_IDEIS; |
report_interrupt(ata->irq); |
} |
} |
/* ========================================================================= */ |
|
|
/* |
Read a register |
*/ |
167,7 → 180,10
break; |
|
case ATA_STAT : |
ata -> regs.stat = (ata -> regs.stat & ~ATA_IDEIS) | (ata -> regs.stat & ATA_IDEIS & value); |
if(!(value & ATA_IDEIS) && (ata->regs.stat & ATA_IDEIS)) { |
clear_interrupt(ata->irq); |
ata->regs.stat &= ~ATA_IDEIS; |
} |
break; |
|
case ATA_PCTR : |
521,6 → 537,8
|
/* Connect ata_devices. */ |
ata_devices_init(&ata->devices); |
ata->devices.device[0].internals.host = ata; |
ata->devices.device[1].internals.host = ata; |
|
memset(&ops, 0, sizeof(struct mem_ops)); |
|
/trunk/or1ksim/peripheral/atahost.h
164,6 → 164,7
/* ---------------------------- */ |
/* ----- Prototypes ----- */ |
/* ---------------------------- */ |
void ata_int(void *dat); |
|
|
/* ---------------------------- */ |
/trunk/or1ksim/peripheral/atadevice_cmdi.c
40,11 → 40,15
#include "atadevice.h" |
#include "atadevice_cmdi.h" |
#include "atacmd.h" |
#include "atahost.h" |
|
#include "debug.h" |
|
DEFAULT_DEBUG_CHANNEL(ata); |
|
/* FIXME: If device0 is not selected and then an interrupt occurs and |
* then it is selected, the interrupt should be delivered, but I just drop it |
* (same goes for device 1). */ |
static void ata_cmd_complete(void *dat) |
{ |
ata_device *dev = dat; |
53,6 → 57,18
dev->internals.dev ? 1 : 0); |
|
dev->regs.status &= ~ATA_SR_BSY; |
|
if(dev->regs.device_control & ATA_DCR_IEN) |
return; |
|
if((dev->regs.device_head & ATA_DHR_DEV) != dev->internals.dev) |
return; |
|
if(dev->sigs.intrq) |
return; |
|
dev->sigs.intrq = 1; |
ata_int(dev->internals.host); |
} |
|
static void ata_set_sect(ata_device *dev, uint32_t sect) |