Ignore:
Timestamp:
Jul 21, 2009, 8:38:04 AM (10 years ago)
Author:
Thomas Doerfler <Thomas.Doerfler@…>
Branches:
4.10, 4.11, master
Children:
68799a2a
Parents:
115971c
Message:

Update for MPC55XX changes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libbsp/powerpc/mpc55xxevb/startup/sd-card-init.c

    r115971c rd374492  
    1919 */
    2020
    21 #include  <stdio.h>
     21#include <stdio.h>
    2222
    2323#include <mpc55xx/mpc55xx.h>
     
    2525#include <mpc55xx/dspi.h>
    2626
    27 #include <libchip/spi-sd-card.h>
    28 
    29 #define DEBUG
     27#include <bsp.h>
    3028
    3129#include <rtems/status-checks.h>
    32 
    33 #include <bsp.h>
    3430
    3531static rtems_status_code mpc55xx_dspi_init(void)
     
    8985}
    9086
    91 #include <sys/types.h>
    92 #include <sys/stat.h>
    93 #include <unistd.h>
    94 #include <fcntl.h>
    95 #include <dirent.h>
    9687#include <stdio.h>
    9788#include <rtems/fsmount.h>
    9889#include <rtems/dosfs.h>
    99 #include <rtems/ide_part_table.h>
     90#include <rtems/bdpart.h>
    10091#include <rtems/console.h>
     92
     93#include <libchip/spi-sd-card.h>
    10194
    10295#define MPC55XX_DEVICE "sd-card-a"
     
    118111};
    119112
    120 #define SD_CARD_NUMBER 1
    121 
    122 sd_card_driver_entry sd_card_driver_table [SD_CARD_NUMBER] = { {
    123 #if 0
    124                 .driver = {
    125                         .ops = &sd_card_driver_ops,
    126                         .size = sizeof( sd_card_driver_entry)
    127                 },
    128                 .table_index = 0,
    129                 .minor = 0,
    130 #endif
    131                 .device_name = "sd-card-a",
    132 #if 0
    133                 .disk_device_name = "/dev/sd-card-a",
    134 #endif
     113sd_card_driver_entry sd_card_driver_table [] = {
     114        {
     115                .device_name = "/dev/sd-card-a",
     116                .bus = 0,
    135117                .transfer_mode = SD_CARD_TRANSFER_MODE_DEFAULT,
    136118                .command = SD_CARD_COMMAND_DEFAULT,
     
    141123                .block_size = 0,
    142124                .block_size_shift = 0,
    143                 .busy = 1,
    144                 .verbose = 1,
    145                 .schedule_if_busy = 0,
     125                .busy = true,
     126                .verbose = true,
     127                .schedule_if_busy = false
    146128        }
    147129};
    148130
    149 rtems_status_code mpc55xx_sd_card_init(void)
     131size_t sd_card_driver_table_size = sizeof( sd_card_driver_table) / sizeof( sd_card_driver_table [0]);
     132
     133rtems_status_code mpc55xx_sd_card_init( bool mount)
    150134{
    151135        rtems_status_code sc = RTEMS_SUCCESSFUL;
     
    158142        RTEMS_CHECK_SC( rv, "Intitalize DSPI bus");
    159143
    160         rv = rtems_libi2c_register_drv( e->device_name, (rtems_libi2c_drv_t *) e, mpc55xx_dspi_bus_table [0].bus_number, 0);
    161         RTEMS_CHECK_RV_SC( rv, "Register SD Card driver");
     144        e->bus = mpc55xx_dspi_bus_table [0].bus_number;
    162145
    163         sc = rtems_ide_part_table_initialize( MPC55XX_DEVICE_FILE);
    164         RTEMS_CHECK_SC( sc, "Initialize IDE partition table");
     146        sc = sd_card_register();
     147        RTEMS_CHECK_SC( sc, "Register SD Card");
    165148
    166         rv = mkdir( MPC55XX_MOUNT_POINT, S_IRWXU);
    167         RTEMS_CHECK_RV_SC( rv, "Create mount point");
     149        if (mount) {
     150                sc = rtems_bdpart_register_from_disk( MPC55XX_DEVICE_FILE);
     151                RTEMS_CHECK_SC( sc, "Initialize IDE partition table");
    168152
    169         rv = rtems_fsmount( mpc55xx_fs_table, sizeof( mpc55xx_fs_table) / sizeof( mpc55xx_fs_table [0]), NULL);
    170         RTEMS_CHECK_RV_SC( rv, "Mount file systems");
     153                rv = rtems_fsmount( mpc55xx_fs_table, sizeof( mpc55xx_fs_table) / sizeof( mpc55xx_fs_table [0]), NULL);
     154                RTEMS_CHECK_RV_SC( rv, "Mount file systems");
     155        }
    171156
    172157        return RTEMS_SUCCESSFUL;
Note: See TracChangeset for help on using the changeset viewer.