Line 17... |
Line 17... |
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
along with this program; if not, write to the Free Software
|
along with this program; if not, write to the Free Software
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
*/
|
*/
|
|
|
|
#include "config.h"
|
|
|
|
#ifdef HAVE_INTTYPES_H
|
|
#include <inttypes.h>
|
|
#endif
|
|
|
|
#include "port.h"
|
|
#include "arch.h"
|
/* get a prototype for 'register_memoryarea()', and 'adjust_rw_delay()' */
|
/* get a prototype for 'register_memoryarea()', and 'adjust_rw_delay()' */
|
#include "abstract.h"
|
#include "abstract.h"
|
#include "sim-config.h"
|
#include "sim-config.h"
|
#include "sched.h"
|
#include "sched.h"
|
|
|
Line 87... |
Line 95... |
/* ========================================================================= */
|
/* ========================================================================= */
|
|
|
|
|
/* Convert a memory address to a device struct and relative address.
|
/* Convert a memory address to a device struct and relative address.
|
* Return nonzero on success */
|
* Return nonzero on success */
|
int ata_find_device( unsigned long addr, ata_host **ata, unsigned long *reladdr )
|
int ata_find_device( oraddr_t addr, ata_host **ata, oraddr_t *reladdr )
|
{
|
{
|
unsigned i;
|
unsigned i;
|
*ata = NULL;
|
*ata = NULL;
|
|
|
for ( i = 0; i < config.natas && *ata == NULL; ++ i ) {
|
for ( i = 0; i < config.natas && *ata == NULL; ++ i ) {
|
Line 114... |
Line 122... |
|
|
|
|
/*
|
/*
|
Read a register
|
Read a register
|
*/
|
*/
|
unsigned long ata_read32( unsigned long addr )
|
uint32_t ata_read32( oraddr_t addr )
|
{
|
{
|
ata_host *ata;
|
ata_host *ata;
|
|
|
if ( !ata_find_device( addr, &ata, &addr ) ) {
|
if ( !ata_find_device( addr, &ata, &addr ) ) {
|
fprintf(stderr, "ata_read32( 0x%08lX ): Not in registered range(s)\n", addr );
|
fprintf(stderr, "ata_read32( 0x%"PRIxADDR" ): Not in registered range(s)\n", addr );
|
return 0;
|
return 0;
|
}
|
}
|
|
|
/* determine if ata_host or ata_device addressed */
|
/* determine if ata_host or ata_device addressed */
|
if (is_ata_hostadr(addr))
|
if (is_ata_hostadr(addr))
|
Line 188... |
Line 196... |
|
|
|
|
/*
|
/*
|
Write a register
|
Write a register
|
*/
|
*/
|
void ata_write32( unsigned long addr, unsigned long value )
|
void ata_write32( oraddr_t addr, uint32_t value )
|
{
|
{
|
ata_host *ata;
|
ata_host *ata;
|
|
|
if ( !ata_find_device( addr, &ata, &addr ) )
|
if ( !ata_find_device( addr, &ata, &addr ) )
|
{
|
{
|
fprintf(stderr, "ata_write32( 0x%08lX ): Not in registered range(s)\n", addr );
|
fprintf(stderr, "ata_write32( 0x%"PRIxADDR" ): Not in registered range(s)\n", addr );
|
return;
|
return;
|
}
|
}
|
|
|
/* determine if ata_host or ata_device addressed */
|
/* determine if ata_host or ata_device addressed */
|
if (is_ata_hostadr(addr))
|
if (is_ata_hostadr(addr))
|
Line 290... |
Line 298... |
ata = &(atas[i]);
|
ata = &(atas[i]);
|
|
|
if ( ata->baseaddr == 0 )
|
if ( ata->baseaddr == 0 )
|
continue;
|
continue;
|
|
|
PRINTF( "\nOCIDEC-%1d %u at: 0x%08lX\n", DEV_ID, i, ata->baseaddr );
|
PRINTF( "\nOCIDEC-%1d %u at: 0x%"PRIxADDR"\n", DEV_ID, i, ata->baseaddr );
|
PRINTF( "ATA CTRL : 0x%08X\n", ata->regs.ctrl );
|
PRINTF( "ATA CTRL : 0x%08X\n", ata->regs.ctrl );
|
PRINTF( "ATA STAT : 0x%08x\n", ata->regs.stat );
|
PRINTF( "ATA STAT : 0x%08x\n", ata->regs.stat );
|
PRINTF( "ATA PCTR : 0x%08x\n", ata->regs.pctr );
|
PRINTF( "ATA PCTR : 0x%08x\n", ata->regs.pctr );
|
|
|
#if (DEV_ID > 1)
|
#if (DEV_ID > 1)
|