Changeset b910455 in mainline for uspace/app/tester/devs/devman1.c


Ignore:
Timestamp:
2011-04-07T09:46:11Z (13 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
6639ae1
Parents:
f6bffee (diff), 8e80d3f (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge mainline changes.

File:
1 moved

Legend:

Unmodified
Added
Removed
  • uspace/app/tester/devs/devman1.c

    rf6bffee rb910455  
    11/*
    2  * Copyright (c) 2005 Sergey Bondari
     2 * Copyright (c) 2011 Vojtech Horky
    33 * All rights reserved.
    44 *
     
    2727 */
    2828
    29 /** @addtogroup arm32
     29/** @addtogroup tester
     30 * @brief Test devman service.
    3031 * @{
    3132 */
    32 /** @file
    33  *  @brief Memory manipulating functions declarations.
     33/**
     34 * @file
    3435 */
    3536
    36 #ifndef KERN_arm32_MEMSTR_H_
    37 #define KERN_arm32_MEMSTR_H_
     37#include <inttypes.h>
     38#include <errno.h>
     39#include <str_error.h>
     40#include <sys/types.h>
     41#include <async.h>
     42#include <devman.h>
     43#include <str.h>
     44#include <vfs/vfs.h>
     45#include <sys/stat.h>
     46#include <fcntl.h>
     47#include "../tester.h"
    3848
    39 #define memcpy(dst, src, cnt)  __builtin_memcpy((dst), (src), (cnt))
     49#define DEVICE_PATH_NORMAL "/virt/null/a"
     50#define DEVICE_CLASS "virt-null"
     51#define DEVICE_CLASS_NAME "1"
     52#define DEVICE_PATH_CLASSES DEVICE_CLASS "/" DEVICE_CLASS_NAME
    4053
    41 extern void memsetw(void *, size_t, uint16_t);
    42 extern void memsetb(void *, size_t, uint8_t);
     54const char *test_devman1(void)
     55{
     56        devman_handle_t handle_primary;
     57        devman_handle_t handle_class;
     58       
     59        int rc;
     60       
     61        TPRINTF("Asking for handle of `%s'...\n", DEVICE_PATH_NORMAL);
     62        rc = devman_device_get_handle(DEVICE_PATH_NORMAL, &handle_primary, 0);
     63        if (rc != EOK) {
     64                TPRINTF(" ...failed: %s.\n", str_error(rc));
     65                if (rc == ENOENT) {
     66                        TPRINTF("Have you compiled the test drivers?\n");
     67                }
     68                return "Failed getting device handle";
     69        }
    4370
    44 #endif
     71        TPRINTF("Asking for handle of `%s' by class..\n", DEVICE_PATH_CLASSES);
     72        rc = devman_device_get_handle_by_class(DEVICE_CLASS, DEVICE_CLASS_NAME,
     73            &handle_class, 0);
     74        if (rc != EOK) {
     75                TPRINTF(" ...failed: %s.\n", str_error(rc));
     76                return "Failed getting device class handle";
     77        }
     78
     79        TPRINTF("Received handles %" PRIun " and %" PRIun ".\n",
     80            handle_primary, handle_class);
     81        if (handle_primary != handle_class) {
     82                return "Retrieved different handles for the same device";
     83        }
     84
     85        return NULL;
     86}
    4587
    4688/** @}
Note: See TracChangeset for help on using the changeset viewer.