但是依靠下面的解决方法却无法解决,不知道那位大侠能够提供帮助,非常感谢!
目标机平台:vxworks5.4, x86 pentium, floppy disk, hard disk @ ide 0,0.
目标机上硬盘在第一个ide通道的primary接口上,已经存在了dos文件系统(FAT)。在dos中运行的vxload bootrom.sys引导的vxworks。
目的:希望能够访问目标机硬盘上的文件。
目前的状态:能够通过ataShow得到硬盘的相关信息:(通过shell得到)
-> ataShow(0,0)
ATA-LOCAL
intCount =7 intStatus =0x58
ataTypes
cylinders =208 heads =16
sectorsTrack =63 bytesSector =512
precomp =0xff
ataParams
cylinders =209 heads =16
sectorsTrack =63 bytesSector =0
config =0x427a removcyl =0x0
bytesTrack =0x0 bytesGap =0x0
bytesSync =0x0 vendstat =0x0
serial =00000000000000000001
type =0x0 size =0x40
bytesEcc =0x0
rev =00000001
model =VMware Virtual IDE Hard Drive
multiSecs =0x8040 capabilty =0x2f00
pioMode =0x200 dmaMode =0x0
valid =0x7 curr-cyl =209
curr-head =16 curr-sector =63
capacity0 =0x36f0 capacity1 =0x3
multiSet =0x110 sectors0 =0x36f0
sectors1 =0x3 singleDma =0x0
multiDma =0x7 advancedPio =0x3
cycleDma =120 cycleMulti =120
cyclePio-wo =160 cyclePio-w =120
Capability
MULTI: TRUE, IORDY: TRUE, DMA: TRUE, LBA: TRUE
multiSectors =0x40 pioMode =0x4
singleDma =0x0 multiDma =0x2
Configuration
rwMode =PIO_4 rwBits =16BITS
rwPio =MULTI rwDma =MULTI
value = 0 = 0x0
编写的代码:
int MountAtaDisk(void)
{
int maxfd = 20;
int ctrl = 0;
int drive = 0;
int blocks = 0;
int offset = 0;
char pDevName[] = "/ata0/";
/*
int vector = 14;
int level = 0;
*/
DOS_VOL_CONFIG VolConf;
BLK_DEV * pBlkDev;
DOS_VOL_DESC * pVolDesc;
/* Initialize dosFs Library */
if (dosFsInit(maxfd) == ERROR)
{
printf("Error! error code is %d.\n", errno);
printf("Cann't initialize dosFs library.\n");
return -1;
}
/* Initialize ata driver */
/*
if (ataDrv(ctrl, 1, vector, level, 0, 0, 0) == ERROR)
{
printf("Error! error code is %d.\n", errno);
printf("Cann't load ata driver.\n");
return -1;
}*/
/* Create ata device */
pBlkDev = ataDevCreate(ctrl, drive, blocks, offset);
if (pBlkDev == NULL)
{
printf("Error! error code is %d.\n", errno);
printf("Cann't create ata device.\n");
return -1;
}
/* Initialize ata/ide device */
pVolDesc = dosFsDevInit(pDevName, pBlkDev, NULL);
if (pVolDesc == NULL)
{
printf("Error! error code is %d.\n", errno);
printf("Cann't initialize dosFs Device.\n");
return -1;
}
return 0;
}
出现的问题:
当运行MountAtaDisk时,在调用函数dosFsDevInit()处出现错误,返回:
-> MountAtaDisk
Error! error code is 3670017.
Cann't initialize dosFs Device.
value = -1 = 0xffffffff
运行printErrno(3670017)得到错误提示:
-> printErrno(3670017)
0x380001 = S_dosFsLib_VOLUME_NOT_AVAILABLE
value = 0 = 0x0
这应该如何解决呢。在vxworks映像中已经define了ATA的支持。