How to access ports on cards plugged into the AT-Bus slot on the SBC5206 evaluation board ?

Well here is the answer. The port addresses You provide as parameter to the following routines are the genuine numbers You know from the PC. For example the base address of the AT-Bus EIDE Harddisk controller is 0x01F0 ( hexdecimal ).

Word access works only on cards that provide 16bit ports !!!

Update: New version of EGCS based Gnu Tools use the keyword volatile for memory mapped i/o regions. I will soon post an update

for these routines here !

 

#define    SBC5206_ISA_BASE 0x40000000

unsigned char ReadISAByte( unsigned long port )
{
    unsigned long address;
    address = ( port ^ 1 ) + SBC5206_ISA_BASE;
    return( *(unsigned char *)address );
}

unsigned short ReadISAWord( unsigned long port )
{
    unsigned long address;
    address = ( port ) + SBC5206_ISA_BASE;
    return( *(unsigned short *)address );
}

int WriteISAByte( unsigned long port, unsigned char byte )
{
    unsigned long address;
    address = ( port ^ 1 ) + SBC5206_ISA_BASE;
    *(unsigned char *)address = byte;
    return(0);
}

int WriteISAWord( unsigned long port, unsigned short word )
{
    unsigned long address;
    address = ( port ) + SBC5206_ISA_BASE;
    *(unsigned short *)address = word;
    return(0);
}