RAMDisk and DOSFS example program wanted
Chris Johns
chrisj at rtems.org
Fri Jun 4 22:46:12 UTC 2004
Joel Sherrill <joel at OARcorp.com> wrote:
>
> I recall someone having posted these before but can't seem to find
> them. I would greatly appreciate it if they could be sent to me again.
>
I assume you are looking for the driver, and file system initialisation.
If you need a test program try bonnie. I uploaded it to the ftp site a
while ago.
The following assumes a custom IDE interface to the device:
ide_ctrl_fns_t my_ide_ctrl_fns =
{
my_ide_probe,
my_ide_initialise,
my_ide_control,
my_ide_read_reg,
my_ide_write_reg,
my_ide_read_block,
my_ide_write_block,
my_ide_config_io_speed
};
/*
* IDE controllers Table
*/
ide_controller_bsp_table_t IDE_Controller_Table[] =
{
{
"/dev/ide",
IDE_STD, /* standard IDE controller */
&my_ide_ctrl_fns,
NULL, /* probe for IDE standard registers */
FALSE, /* not (yet) initialized */
0, /* base I/O address for first IDE controller */
FALSE,0, /* not (yet) interrupt driven */
NULL
}
};
unsigned long IDE_Controller_Count = 1;
static rtems_filesystem_mount_table_entry_t *mt_entry;
extern rtems_filesystem_operations_table msdos_ops;
rtems_bdbuf_config rtems_bdbuf_configuration[] =
{
{ 512, 20, 0 }
};
int rtems_bdbuf_configuration_size = 1;
static rtems_device_major_number ide_major;
static rtems_device_major_number ata_major;
#define MKDIR_MODE (S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)
void Init (void)
{
/*
* Create a node to mount the disk on.
*/
if (rtems_rootfs_mkdir ("/hda", MKDIR_MODE) < 0)
printf ("ide: could not create the mount point\n");
/*
* Initialise the IDE controller.
*/
sc = rtems_io_register_driver (7, &ide_drv, &ide_major);
if (sc != RTEMS_SUCCESSFUL)
{
printf ("ide: could not register the IDE driver: %s\n",
rtems_status_text (sc));
return false;
}
/*
* Initialise the ATA controller.
*/
sc = rtems_io_register_driver (8, &ata_drv, &ata_major);
if (sc != RTEMS_SUCCESSFUL)
{
printf ("ide: could not register the ATA driver: %s\n",
rtems_status_text (sc));
return false;
}
/*
* Initialise the IDE partition table.
*/
sc = rtems_ide_part_table_initialize ("/dev/hda");
if (sc != RTEMS_SUCCESSFUL)
{
printf ("ide: failed to read the partition table: %s\n",
rtems_status_text (sc));
return false;
}
/*
* Mount the partition.
*/
if (mount (&mt_entry, &msdos_ops, RTEMS_FILESYSTEM_READ_WRITE,
"/dev/hda1", "/hda") < 0)
{
printf ("ide: could not mount hda: %s\n",
strerror (errno));
return false;
}
}
}
--
Chris Johns
More information about the users
mailing list