RTEMS-CVS is broken
Chris Johns
chrisj at rtems.org
Fri Jul 14 00:18:29 UTC 2006
Joel Sherrill wrote:
>
> At first thought, this seems reasonable. confdefs.h can stick to the
> basics in CPU Kit.
>
Why do we need to use confdefs.h ?
I have used the following type of BSP specific code in the past without
the need to adjust the static driver table. The code uses
'rtems_io_register_driver'. I am yet to see the need for the change in
confdefs.h.
Regards
Chris
------------------
#include <.....>
/*
* Provide the bsp IDE functions.
*/
boolean
my_bsp_ide_probe (int minor)
{
}
.....
ide_ctrl_fns_t my_bsp_ide_ctrl_fns =
{
my_bsp_ide_probe,
my_bsp_ide_initialise,
my_bsp_ide_control,
my_bsp_ide_read_reg,
my_bsp_ide_write_reg,
my_bsp_ide_read_block,
my_bsp_ide_write_block,
my_bsp_ide_config_io_speed
};
/*
* IDE controllers Table
*/
ide_controller_bsp_table_t IDE_Controller_Table[] =
{
{
"/dev/ide",
IDE_STD, /* standard IDE controller */
&my_bsp_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)
/*
* Called by other code in the BSP during initialisation.
*/
int
my_bsp_ide_init ()
{
rtems_driver_address_table ide_drv = \
IDE_CONTROLLER_DRIVER_TABLE_ENTRY;
rtems_driver_address_table ata_drv = \
ATA_DRIVER_TABLE_ENTRY;
rtems_status_code sc;
/*
* Add specific BSP code to detect the hardware and a drive. This
* includes setting up the hardware specific to the target, eg
* chip selects, buses etc.
*/
.....
if (rtems_rootfs_mkdir ("/bsp", MKDIR_MODE) < 0)
{
printf ("my-bsp-ide: could not create the mount point\n");
return 0;
}
sc = rtems_io_register_driver (7, &ide_drv, &ide_major);
if (sc != RTEMS_SUCCESSFUL)
{
printf ("my-bsp-ide: could not register the IDE driver: %s\n",
rtems_status_text (sc));
return 0;
}
sc = rtems_io_register_driver (8, &ata_drv, &ata_major);
if (sc != RTEMS_SUCCESSFUL)
{
printf ("my-bsp-ide: could not register the ATA driver: %s\n",
rtems_status_text (sc));
return 0;
}
sc = rtems_ide_part_table_initialize ("/dev/hda");
if (sc != RTEMS_SUCCESSFUL)
{
printf ("my-bsp-ide: failed to read the partition table: %s\n",
rtems_status_text (sc));
return 0;
}
if (mount (&mt_entry, &msdos_ops, RTEMS_FILESYSTEM_READ_WRITE,
"/dev/hda1", "/bsp") < 0)
{
printf ("my-bsp-ide: could not mount the drive: %s\n",
strerror (errno));
return 0;
}
return 1;
}
More information about the users
mailing list