Changes between Version 2 and Version 3 of TBR/UserManual/Using_the_RTEMS_DOS_File_System


Ignore:
Timestamp:
Sep 12, 2008, 12:17:32 PM (11 years ago)
Author:
ChrisJohns
Comment:

Add ATA configuration.

Legend:

Unmodified
Added
Removed
Modified
  • TBR/UserManual/Using_the_RTEMS_DOS_File_System

    v2 v3  
    4242 #define CONFIGURE_BDBUF_MAX_READ_AHEAD_BLOCKS      64
    4343 #define CONFIGURE_BDBUF_MAX_WRITE_BLOCKS           32
     44= ATA Disk =
     45
     46
     47The ATA driver is in libchip and requires a BSP driver. It is best to take an existing driver and modify it. YOu can locate the various drivers by searching the source tree for {{{IDE_Controller_Table</code>. There are drivers in :
     48
     49  c/src/lib/libbsp/arm/nds/block/block.c
     50  c/src/lib/libbsp/i386/pc386/ide/idecfg.c
     51  c/src/lib/libbsp/powerpc/gen5200/ide/idecfg.c
     52  c/src/lib/libbsp/powerpc/mbx8xx/ide/idecfg.c
     53  c/src/lib/libbsp/powerpc/mbx8xx/ide/pcmcia_ide.c
     54
     55The {{{confdefs.h</code> configuration entry configures the IDE driver and the ATA driver:
     56
     57 #define CONFIGURE_APPLICATION_NEEDS_IDE_DRIVER
     58 #define CONFIGURE_APPLICATION_NEEDS_ATA_DRIVER
     59 #define CONFIGURE_ATA_DRIVER_TASK_PRIORITY         9
     60
     61Note, the examples given the ATA driver is a higher priority than the cache swap out task. This will make the ATA more responsive to the low levels. It does not have to be configured this way.
     62
     63Some where in the initialization phase of your application you need to read the IDE disk partition table. The code is:
     64
     65 extern rtems_status_code rtems_ide_part_table_initialize (const char* );
     66 
     67 rtems_status_code sc;
     68
     69 /*
     70  * Register the IDE Disk driver.
     71  */
     72 printf ("Read IDE Disk Partition Table: ");
     73 sc = rtems_ide_part_table_initialize (path);
     74 if (sc != RTEMS_SUCCESSFUL)
     75 {
     76   printf ("error: ide partition table not found: %s\n",
     77           rtems_status_text (sc));
     78   return 1;
     79 }
     80 
     81 printf ("successful\n");
     82
     83Once the partition table has been read you can mount partitions. The ATA code will create devices in the device tree for each MSDOS partition found. The first primary partition on a primary IDE disk is called {{{/dev/hda1</code>.
     84
     85You can use the shell to mount the partition or you can code the mount call directly. Note, the shell can run scripts so you could embedded a simple initialization script that mounts the partition. The shell code to mount is in the function {{{rtems_shell_libc_mounter</code> and the shell command is:
     86
     87 mkdir c
     88 mount -t msdos /dev/hda1 /c
     89
     90The code to mount the same partition to an existing {{{/c</code> directory is:
     91
     92 #include <rtems/dosfs.h>
     93 #include <rtems/fsmount.h>
     94
     95 rtems_filesystem_mount_table_entry_t* mt_entry;
     96 
     97 if (mount (&mt_entry, &msdos_ops, options, "/dev/hda1", "/c") < 0)
     98 {
     99   fprintf (stderr, "mount: mount failed: %s\n", strerror (errno));
     100   return 1;
     101 }
     102 
     103 return 0;