Home |
RTTarget-32 Programming Manual Function RTPCSetConfigRegister Function RTPCMapATAContiguous System Management BIOS (SMBIOS) Advanced Programmable Interrupt Controller (APIC) |
Function RTPCMapATAContiguousThis function maps and enables all required resources to use an ATA disk card in contiguous I/O mode as an IDE master device: void RTPCMapATAContiguous(int Socket, WORD IOBase, int IRQ); This function should be called after an application has verified that an ATA disk card has been inserted. ParametersSocketSpecifies the socket of the card to map. IOBaseSpecifies the I/O port base address to use for the card. A block of 16 consecutive addresses is required starting at this address. IRQThe interrupt on which the disk should signal events. The application must ensure that the requested resources are free. For example, a PCMCIA disk can only be configured to be on the primary IDE channel if no IDE host adapter is in the system (e.g., on the motherboard). Important: The IOBase and IRQ value must be published to the RTFiles-32 IDE device driver through the device data structure! In addition, the IDE driver must operate in RTF_CONTIGUOUS_IO mode! The following example shows how to configure a PCMCIA ATA disk as the master on the third IDE channel with a custom IOBase and IRQ value. The PCMCIA ATA disk has drive number 2 and can coexist with up to two IDE disks on the primary IDE channel installed on the target's motherboard. #include <rttarget.h> #include <rtpcmcia.h> #include <rtfiles.h> #define PCMCIA_ATA_IDX 2 // entry #2 in device list #define PCMCIA_ATA_IO 0x1E0 #define PCMCIA_ATA_IRQ 10 static RTFDrvIDEData IDEDrive0Data = {0}; // master disk on primary IDE static RTFDrvIDEData IDEDrive1Data = {0}; // slave disk on primary IDE static RTFDrvIDEData IDEDrive2Data = {0, 0, PCMCIA_ATA_IO, 0, 0, 0, PCMCIA_ATA_IRQ}; RTFDevice RTFDeviceList[] = { { RTF_DEVICE_FDISK, 0, 0, &RTFDrvIDE, &IDEDrive0Data }, { RTF_DEVICE_FDISK, 1, 0, &RTFDrvIDE, &IDEDrive1Data }, { RTF_DEVICE_FDISK, 4, RTF_DEVICE_REMOVABLE | RTF_DEVICE_NO_MEDIA | RTF_DEVICE_NEW_LOCK | RTF_CONTIGUOUS_IO, &RTFDrvIDE, &IDEDrive2Data }, { 0 } }; void ConfigureDisk(int Socket) { if (RTPCIsATA(Socket)) { RTPCMapATAContiguous(Socket, PCMCIA_ATA_IO, PCMCIA_ATA_IRQ); // tell RTFiles-32 that this disk is now available RTFRawSetMedia(PCMCIA_ATA_IDX, 1); } } The source code of function RTPCMapATAContiguous is: void RTTAPI RTPCMapATAContiguous(int Socket, int IOBase, int IRQ) { RTPCSetConfigRegister(Socket, RTPC_CFGREG_SOCKET_COPY, Socket); RTPCSetConfigRegister(Socket, RTPC_CFGREG_OPTION, 0x40 | 1); RTPCUnmapCIS(Socket); RTPCMapIOWindow(Socket, 0, IOBase, IOBase, 16, RTPC_IO_WINDOW_AUTO); RTPCEnableIRQ(Socket, IRQ); }
|