Changeset 8b1e15ac in mainline for uspace/drv/test1


Ignore:
Timestamp:
2011-02-11T22:26:36Z (15 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
68414f4a
Parents:
1b367b4
Message:

Finish splitting device node: devman client in C library, drv library. Update device drivers accordingly.

Location:
uspace/drv/test1
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/test1/char.c

    r1b367b4 r8b1e15ac  
    3737#include "test1.h"
    3838
    39 static int impl_char_read(device_t *dev, char *buf, size_t count) {
     39static int impl_char_read(function_t *fun, char *buf, size_t count) {
    4040        memset(buf, 0, count);
    4141        return count;
    4242}
    4343
    44 static int imp_char_write(device_t *dev, char *buf, size_t count) {
     44static int imp_char_write(function_t *fun, char *buf, size_t count) {
    4545        return count;
    4646}
  • uspace/drv/test1/test1.c

    r1b367b4 r8b1e15ac  
    6161           name, message);
    6262
    63         int rc = child_device_register_wrapper(parent, name,
     63        int rc = register_function_wrapper(parent, name,
    6464            match_id, match_score);
    6565
    6666        if (rc == EOK) {
    67                 printf(NAME ": registered child device `%s'.\n", name);
     67                printf(NAME ": registered function `%s'.\n", name);
    6868        } else {
    69                 printf(NAME ": failed to register child `%s' (%s).\n",
     69                printf(NAME ": failed to register function `%s' (%s).\n",
    7070                    name, str_error(rc));
    7171        }
     
    9191static int add_device(device_t *dev)
    9292{
     93        function_t *fun_a;
     94
    9395        printf(NAME ": add_device(name=\"%s\", handle=%d)\n",
    9496            dev->name, (int) dev->handle);
    9597
    96         add_device_to_class(dev, "virtual");
     98        fun_a = create_function();
     99        fun_a->ftype = fun_exposed;
     100        fun_a->name = "a";
     101
     102        register_function(fun_a, dev);
     103
     104        add_function_to_class(fun_a, "virtual");
    97105
    98106        if (str_cmp(dev->name, "null") == 0) {
    99                 dev->ops = &char_device_ops;
    100                 add_device_to_class(dev, "virt-null");
    101         } else if (dev->parent == NULL) {
     107                fun_a->ops = &char_device_ops;
     108                add_function_to_class(fun_a, "virt-null");
     109        } else if (str_cmp(dev->name, "test1") == 0) {
    102110                register_child_verbose(dev, "cloning myself ;-)", "clone",
    103111                    "virtual&test1", 10);
Note: See TracChangeset for help on using the changeset viewer.