Changeset 8b1e15ac in mainline for uspace/drv/test1
- Timestamp:
- 2011-02-11T22:26:36Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 68414f4a
- Parents:
- 1b367b4
- Location:
- uspace/drv/test1
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/test1/char.c
r1b367b4 r8b1e15ac 37 37 #include "test1.h" 38 38 39 static int impl_char_read( device_t *dev, char *buf, size_t count) {39 static int impl_char_read(function_t *fun, char *buf, size_t count) { 40 40 memset(buf, 0, count); 41 41 return count; 42 42 } 43 43 44 static int imp_char_write( device_t *dev, char *buf, size_t count) {44 static int imp_char_write(function_t *fun, char *buf, size_t count) { 45 45 return count; 46 46 } -
uspace/drv/test1/test1.c
r1b367b4 r8b1e15ac 61 61 name, message); 62 62 63 int rc = child_device_register_wrapper(parent, name,63 int rc = register_function_wrapper(parent, name, 64 64 match_id, match_score); 65 65 66 66 if (rc == EOK) { 67 printf(NAME ": registered child device`%s'.\n", name);67 printf(NAME ": registered function `%s'.\n", name); 68 68 } else { 69 printf(NAME ": failed to register child`%s' (%s).\n",69 printf(NAME ": failed to register function `%s' (%s).\n", 70 70 name, str_error(rc)); 71 71 } … … 91 91 static int add_device(device_t *dev) 92 92 { 93 function_t *fun_a; 94 93 95 printf(NAME ": add_device(name=\"%s\", handle=%d)\n", 94 96 dev->name, (int) dev->handle); 95 97 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"); 97 105 98 106 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) { 102 110 register_child_verbose(dev, "cloning myself ;-)", "clone", 103 111 "virtual&test1", 10);
Note:
See TracChangeset
for help on using the changeset viewer.
