Download Manual

Transcript
ERTFS User Guide
Appendix F. PORTIO.C
EBS – ERTFS-PRO (Real Time File Manager) Copyright EBS, Inc. 2003
This is a representative sample of the ERTFS I/O porting layer file */
#include <rtfs.h>
/* All of the I/O in and out functions in this file call one of these four macros to write or read the appropriate I/O location.
If t is convenient to use this scheme and it will work for you then please modify these macros to do the appropriate I/O
operation for the register. If this can’t be accomplished just modify the appropriate routines manually.
*/
#define
#define
#define
#define
#define
RTFS_OUTBYTE(ADDRESS,VALUE)
RTFS_INBYTE(ADDRESS) 0
RTFS_OUTWORD(ADDRESS,VALUE)
RTFS_INWORD(ADDRESS) 0
RTFS_OUTDWORD(ADDRESS,VALUE)
/* The code below must be implemented for all targets */
/*rtfs_port_disable() and rtfs_port_enable()
Used by a few device drivers, floppy, flash chip and pcmctrl, you may ignore it if not being called, but first check to see if
floppy, flash chip and pcmctrl are still the only drivers using the functions */
/*This function must disable interrupts and return. */
void rtfs_port_disable(void)
{
}
/*This function must re-disable interrupts that were disabled via a call to
rtfs_port_disable(). */
void rtfs_port_enable(void)
{
}
#if (INCLUDE_82365_PCMCTRL)
/* These routines are required only if the 82365 pcmcia controller driver
is included (pcmctrl.c)
phys82365_to_virtual(PFBYTE * virt, dword phys)
write_82365_index_register(byte value)
write_82365_data_register(byte value)
read_82365_data_register(void)
*/
/* This routine must take a physical linear 32 bit bus address passed in the “phys” argument and convert it to an address
addressable in the logical space of the CPU, returning that value in “virt”. Two sample methods are provided, a flat version
where the virtual address is simply the “phys” address cast to a pointer and a second segmented version for X86 segmented applications.
*/
void phys82365_to_virtual(PFBYTE * virt, dword phys)
{
*virt = (PFBYTE) phys; /* example for flat unmapped address space */
}
/*
These routines write and read the 82365’s index and data registers which, in a standard PC environment, are located in
I/O space at address 0x3E0 and 0x3E1. Non PC architectures typically map these as memory mapped locations somewhere high in memory such as 0xB10003E0 and 0xB10003E1.
*/
void write_82365_index_register(byte value)
{
Appendix F: PORTIO.C
171