📄 sysata.c
字号:
/* sysAta.c - ATA-2 initialization for sysLib.c */
/* Copyright 1984-1999 Wind River Systems, Inc. */
#include "copyright_wrs.h"
/*
modification history
--------------------
01b,27aug01,dgp change manual pages to reference entries per SPR 23698
01a,01apr99,jkf written
*/
/*
Description
This file contains the sysAtaInit() necessary for
initializing the ATA/EIDE subsystem on the via chip.
This file will enable the controller and also set the
PIO mode as detected by ataDrv().
*/
/* includes */
#include "vxWorks.h"
#include "config.h"
#ifdef INCLUDE_ATA_686
#include "ataDrv.h"
/* defines */
#define WB_CTRL_STAT_INDX 0x40 /* IDE ctrl stat reg */
/* IDE Drive x CTRLx reg's */
#define WB_DRIVE0_CTRL0_INDX 0x44 /* master / primary */
#define WB_DRIVE1_CTRL0_INDX 0x48 /* slave / primary */
#define WB_DRIVE0_CTRL1_INDX 0x4c /* master / secondary */
#define WB_DRIVE1_CTRL1_INDX 0x50 /* slave / secondary */
/* IDE Chip Enable Value */
#define WB_CFG_CHIP_ENABLE 0x33 /* Turn on both ports */
/* via PIO mode settings */
#define WB_PIO_MODE_0 ((0x5 << 8) | 0xd) /* W83C553 setting PIO0 */
#define WB_PIO_MODE_1 ((0x4 << 8) | 0x7) /* W83C553 setting PIO1 */
#define WB_PIO_MODE_2 ((0x3 << 8) | 0x4) /* W83C553 setting PIO2 */
#define WB_PIO_MODE_3 ((0x2 << 8) | 0x2) /* W83C553 setting PIO3 */
#define WB_PIO_MODE_4 ((0x2 << 8) | 0x1) /* W83C553 setting PIO4 */
#define WB_PIO_MODE_5 ((0x1 << 8) | 0x1) /* W83C553 setting PIO5 */
#define DEFAULT_PIOMODE WB_PIO_MODE_4 /* reset as desired */
/* drive ctrl value, note PIO mode is setup in the routine */
#define WB_DRIVE_CTRL_VAL ((WB_PCI_CTRL_REG << 4) | pioMode)
/* external declarations */
/* global declarations */
/* locals */
LOCAL BOOL sysAtaInstalled = FALSE;
/* function declarations */
/******************************************************************************
*
* sysAtaInit - initialize the EIDE/ATA interface
*
* Perform the necessary initialization required before starting up the
* ATA/EIDE driver on the vt82c686. The first time it is called with
* ctrl and drive = 0. The next time it is called is from ataDrv with
* the appropriate controller and drive to determine PIO mode to use
* on the drive. See the ataDrv reference entry.
*/
void sysAtaInit
(
BOOL ctrl
)
{
UINT16 tmpInt16;
int tmpInt;
int pioMode;
ATA_CTRL * pCtrl;
ATA_DRIVE * pDrive;
ataResources[0].resource.ioStart[0] = PCI_MSTR_ISA_IO_LOCAL+0x1f0/*0xfe0001f0*/;
ataResources[0].resource.ioStart[1] = PCI_MSTR_ISA_IO_LOCAL+0x3f6/*0xfe0003f6*/;
ataResources[1].resource.ioStart[0] = PCI_MSTR_ISA_IO_LOCAL+0x170/*0xfe000170*/;
ataResources[1].resource.ioStart[1] = PCI_MSTR_ISA_IO_LOCAL+0x376/*0xfe000376*/;
ataResources[0].ctrlType = IDE_LOCAL;
ataResources[0].drives = ATA_CTRL0_DRIVES;
ataResources[0].intVector = (int)IDE_CNTRLR0_INT_LVL;
ataResources[0].intLevel = (int)IDE_CNTRLR0_INT_LVL;
ataResources[0].configType = (ATA_PIO_AUTO | ATA_GEO_PHYSICAL|ATA_BITS_16|ATA_PIO_MULTI);
ataResources[0].semTimeout = 5;
ataResources[0].wdgTimeout = 5;
/* Second, initialize the Controller 1 data structure */
ataResources[1].ctrlType = IDE_LOCAL;
ataResources[1].drives = ATA_CTRL1_DRIVES;
ataResources[1].intVector = (int)IDE_CNTRLR1_INT_LVL;
ataResources[1].intLevel = (int)IDE_CNTRLR1_INT_LVL;
ataResources[1].configType = (ATA_PIO_AUTO | ATA_GEO_PHYSICAL|ATA_BITS_16|ATA_PIO_MULTI);
ataResources[1].semTimeout = 5;
ataResources[1].wdgTimeout = 5;
_func_sysAtaInit = (VOIDFUNCPTR) sysAtaInit;
}
#endif /* INCLUDE_ATA_686 */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -