Changeset 1dec54f9 in rtems


Ignore:
Timestamp:
Jul 31, 2018, 2:05:49 PM (17 months ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
d279e74
Parents:
0fe7133
git-author:
Sebastian Huber <sebastian.huber@…> (07/31/18 14:05:49)
git-committer:
Sebastian Huber <sebastian.huber@…> (08/07/18 05:17:17)
Message:

bsps/lm32: Use rtems_blkdev_create()

Update #3358.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • bsps/lm32/shared/milkymist_memcard/memcard.c

    r0fe7133 r1dec54f9  
    1414#include <rtems.h>
    1515#include <rtems/libio.h>
    16 #include <rtems/diskdevs.h>
    1716#include <rtems/blkdev.h>
    1817#include <rtems/status-checks.h>
     
    327326}
    328327
    329 static rtems_status_code memcard_disk_init(
    330   rtems_device_major_number major, rtems_device_minor_number minor,
    331   void *arg)
     328rtems_status_code memcard_register(void)
    332329{
    333330  rtems_status_code sc;
    334   dev_t dev;
    335 
    336   sc = rtems_disk_io_initialize();
    337   RTEMS_CHECK_SC(sc, "Initialize RTEMS disk IO");
    338 
    339   dev = rtems_filesystem_make_dev_t(major, 0);
    340331
    341332  sc = memcard_init();
    342333  RTEMS_CHECK_SC(sc, "Initialize memory card");
    343334
    344   sc = rtems_disk_create_phys(dev, BLOCK_SIZE, block_count, memcard_disk_ioctl,
    345     NULL, "/dev/memcard");
     335  sc = rtems_blkdev_create("/dev/memcard", BLOCK_SIZE, block_count,
     336    memcard_disk_ioctl, NULL);
    346337  RTEMS_CHECK_SC(sc, "Create disk device");
    347338
    348339  return RTEMS_SUCCESSFUL;
    349340}
    350 
    351 
    352 static const rtems_driver_address_table memcard_disk_ops = {
    353   .initialization_entry = memcard_disk_init,
    354   .open_entry = rtems_blkdev_generic_open,
    355   .close_entry = rtems_blkdev_generic_close,
    356   .read_entry = rtems_blkdev_generic_read,
    357   .write_entry = rtems_blkdev_generic_write,
    358   .control_entry = rtems_blkdev_generic_ioctl
    359 };
    360 
    361 rtems_status_code memcard_register(void)
    362 {
    363   rtems_status_code sc = RTEMS_SUCCESSFUL;
    364   rtems_device_major_number major = 0;
    365 
    366   sc = rtems_io_register_driver(0, &memcard_disk_ops, &major);
    367   RTEMS_CHECK_SC(sc, "Register disk memory card driver");
    368 
    369   return RTEMS_SUCCESSFUL;
    370 }
Note: See TracChangeset for help on using the changeset viewer.