Changeset 6f34f13 in rtems for testsuites


Ignore:
Timestamp:
Aug 3, 2018, 8:16:32 PM (16 months ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
5e4bab7
Parents:
5005bfc
git-author:
Sebastian Huber <sebastian.huber@…> (08/03/18 20:16:32)
git-committer:
Sebastian Huber <sebastian.huber@…> (08/07/18 05:17:17)
Message:

libtests/block10: Use rtems_blkdev_create()

Update #3358.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • testsuites/libtests/block10/init.c

    r5005bfc r6f34f13  
    88
    99/*
    10  * Copyright (c) 2010
    11  * embedded brains GmbH
    12  * Obere Lagerstr. 30
    13  * D-82178 Puchheim
    14  * Germany
    15  * <rtems@embedded-brains.de>
     10 * Copyright (c) 2010, 2018 embedded brains GmbH.
     11 *
     12 *   embedded brains GmbH
     13 *   Dornierstr. 4
     14 *   D-82178 Puchheim
     15 *   Germany
     16 *   <rtems@embedded-brains.de>
    1617 *
    1718 * The license and distribution terms for this file may be
     
    2627#include "tmacros.h"
    2728
     29#include <sys/stat.h>
    2830#include <assert.h>
    2931#include <errno.h>
     32#include <fcntl.h>
    3033#include <stdlib.h>
     34#include <unistd.h>
    3135
    3236#include <rtems.h>
    3337#include <rtems/bdbuf.h>
    34 #include <rtems/diskdevs.h>
    3538#include <rtems/test.h>
    3639
    37 #include <bsp.h>
    38 
    3940const char rtems_test_name[] = "BLOCK 10";
    4041
    41 /* forward declarations to avoid warnings */
    42 static rtems_task Init(rtems_task_argument argument);
    43 
    4442#define ASSERT_SC(sc) assert((sc) == RTEMS_SUCCESSFUL)
    4543
     
    6058#define BLOCK_COUNT 1
    6159
     60#define DISK_PATH "/disk"
     61
    6262typedef rtems_bdbuf_buffer *(*access_func)(char task);
    6363
     
    7171
    7272static rtems_id task_id_waiter;
    73 
    74 static const rtems_driver_address_table disk_ops = {
    75   .initialization_entry = NULL,
    76   RTEMS_GENERIC_BLOCK_DEVICE_DRIVER_ENTRIES
    77 };
    7873
    7974static void set_task_prio(rtems_id task, rtems_task_priority prio)
     
    122117}
    123118
    124 static rtems_status_code disk_register(
     119static void disk_register(
    125120  uint32_t block_size,
    126121  rtems_blkdev_bnum block_count,
    127   dev_t *dev_ptr
     122  rtems_disk_device **dd
    128123)
    129124{
    130125  rtems_status_code sc = RTEMS_SUCCESSFUL;
    131   rtems_device_major_number major = 0;
    132   dev_t dev = 0;
    133 
    134   sc = rtems_io_register_driver(0, &disk_ops, &major);
    135   ASSERT_SC(sc);
    136 
    137   dev = rtems_filesystem_make_dev_t(major, 0);
    138 
    139   sc = rtems_disk_create_phys(
    140     dev,
     126  int fd;
     127  int rv;
     128
     129  sc = rtems_blkdev_create(
     130    DISK_PATH,
    141131    block_size,
    142132    block_count,
    143133    disk_ioctl,
    144     NULL,
    145134    NULL
    146135  );
    147136  ASSERT_SC(sc);
    148137
    149   *dev_ptr = dev;
    150 
    151   return RTEMS_SUCCESSFUL;
     138  fd = open(DISK_PATH, O_RDWR);
     139  rtems_test_assert(fd >= 0);
     140
     141  rv = rtems_disk_fd_get_disk_device(fd, dd);
     142  rtems_test_assert(rv == 0);
     143
     144  rv = close(fd);
     145  rtems_test_assert(rv == 0);
    152146}
    153147
     
    399393{
    400394  rtems_status_code sc = RTEMS_SUCCESSFUL;
    401   dev_t dev = 0;
    402395  size_t i_w = 0;
    403396  size_t i_ac = 0;
     
    409402  task_id_init = rtems_task_self();
    410403
    411   sc = rtems_disk_io_initialize();
    412   ASSERT_SC(sc);
    413 
    414   sc = disk_register(BLOCK_SIZE, BLOCK_COUNT, &dev);
    415   ASSERT_SC(sc);
    416 
    417   dd = rtems_disk_obtain(dev);
    418   assert(dd != NULL);
     404  disk_register(BLOCK_SIZE, BLOCK_COUNT, &dd);
    419405
    420406  sc = rtems_task_create(
     
    480466#define CONFIGURE_APPLICATION_NEEDS_LIBBLOCK
    481467
     468#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 4
     469
    482470#define CONFIGURE_MAXIMUM_TASKS 3
    483 #define CONFIGURE_MAXIMUM_DRIVERS 4
    484471
    485472#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
Note: See TracChangeset for help on using the changeset viewer.