Changeset 83a2f43 in mainline for uspace/drv
- Timestamp:
- 2011-02-15T19:43:50Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- af6b5157
- Parents:
- 34588a80
- Location:
- uspace/drv
- Files:
-
- 11 edited
-
isa/isa.c (modified) (11 diffs)
-
ns8250/ns8250.c (modified) (14 diffs)
-
pciintel/pci.c (modified) (6 diffs)
-
pciintel/pci.h (modified) (2 diffs)
-
root/root.c (modified) (6 diffs)
-
rootpc/rootpc.c (modified) (7 diffs)
-
rootvirt/rootvirt.c (modified) (4 diffs)
-
test1/char.c (modified) (2 diffs)
-
test1/test1.c (modified) (5 diffs)
-
test1/test1.h (modified) (1 diff)
-
test2/test2.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/isa/isa.c
r34588a80 r83a2f43 68 68 69 69 typedef struct isa_fun { 70 function_t *fnode;70 ddf_fun_t *fnode; 71 71 hw_resource_list_t hw_resources; 72 72 } isa_fun_t; 73 73 74 static hw_resource_list_t *isa_get_fun_resources( function_t *fnode)74 static hw_resource_list_t *isa_get_fun_resources(ddf_fun_t *fnode) 75 75 { 76 76 isa_fun_t *fun = ISA_FUN(fnode); … … 80 80 } 81 81 82 static bool isa_enable_fun_interrupt( function_t *fnode)82 static bool isa_enable_fun_interrupt(ddf_fun_t *fnode) 83 83 { 84 84 // TODO … … 92 92 }; 93 93 94 static d evice_ops_t isa_fun_ops;95 96 static int isa_add_device(d evice_t *dev);94 static ddf_dev_ops_t isa_fun_ops; 95 96 static int isa_add_device(ddf_dev_t *dev); 97 97 98 98 /** The isa device driver's standard operations */ … … 107 107 }; 108 108 109 static isa_fun_t *isa_fun_create(d evice_t *dev, const char *name)109 static isa_fun_t *isa_fun_create(ddf_dev_t *dev, const char *name) 110 110 { 111 111 isa_fun_t *fun = calloc(1, sizeof(isa_fun_t)); … … 113 113 return NULL; 114 114 115 function_t *fnode = ddf_fun_create(dev, fun_inner, name);115 ddf_fun_t *fnode = ddf_fun_create(dev, fun_inner, name); 116 116 if (fnode == NULL) { 117 117 free(fun); … … 388 388 } 389 389 390 static char *isa_fun_read_info(char *fun_conf, d evice_t *dev)390 static char *isa_fun_read_info(char *fun_conf, ddf_dev_t *dev) 391 391 { 392 392 char *line; … … 447 447 } 448 448 449 static void fun_conf_parse(char *conf, d evice_t *dev)449 static void fun_conf_parse(char *conf, ddf_dev_t *dev) 450 450 { 451 451 while (conf != NULL && *conf != '\0') { … … 454 454 } 455 455 456 static void isa_functions_add(d evice_t *dev)456 static void isa_functions_add(ddf_dev_t *dev) 457 457 { 458 458 char *fun_conf; … … 465 465 } 466 466 467 static int isa_add_device(d evice_t *dev)467 static int isa_add_device(ddf_dev_t *dev) 468 468 { 469 469 printf(NAME ": isa_add_device, device handle = %d\n", … … 473 473 printf(NAME ": adding a 'ctl' function\n"); 474 474 475 function_t *ctl = ddf_fun_create(dev, fun_exposed, "ctl");475 ddf_fun_t *ctl = ddf_fun_create(dev, fun_exposed, "ctl"); 476 476 if (ctl == NULL) { 477 477 printf(NAME ": Error creating control function.\n"); … … 500 500 printf(NAME ": HelenOS ISA bus driver\n"); 501 501 isa_init(); 502 return d river_main(&isa_driver);502 return ddf_driver_main(&isa_driver); 503 503 } 504 504 -
uspace/drv/ns8250/ns8250.c
r34588a80 r83a2f43 94 94 typedef struct ns8250 { 95 95 /** DDF device node */ 96 d evice_t *dev;96 ddf_dev_t *dev; 97 97 /** DDF function node */ 98 function_t *fun;98 ddf_fun_t *fun; 99 99 /** Is there any client conntected to the device? */ 100 100 bool client_connected; … … 189 189 * error number otherwise. 190 190 */ 191 static int ns8250_read( function_t *fun, char *buf, size_t count)191 static int ns8250_read(ddf_fun_t *fun, char *buf, size_t count) 192 192 { 193 193 ns8250_t *ns = NS8250(fun); … … 223 223 * @return Zero on success 224 224 */ 225 static int ns8250_write( function_t *fun, char *buf, size_t count)225 static int ns8250_write(ddf_fun_t *fun, char *buf, size_t count) 226 226 { 227 227 ns8250_t *ns = NS8250(fun); … … 234 234 } 235 235 236 static d evice_ops_t ns8250_dev_ops;236 static ddf_dev_ops_t ns8250_dev_ops; 237 237 238 238 /** The character interface's callbacks. */ … … 242 242 }; 243 243 244 static int ns8250_add_device(d evice_t *dev);244 static int ns8250_add_device(ddf_dev_t *dev); 245 245 246 246 /** The serial port device driver's standard operations. */ … … 675 675 * @param dev The serial port device. 676 676 */ 677 static inline void ns8250_interrupt_handler(d evice_t *dev, ipc_callid_t iid,677 static inline void ns8250_interrupt_handler(ddf_dev_t *dev, ipc_callid_t iid, 678 678 ipc_call_t *icall) 679 679 { … … 706 706 * @param dev The serial port device. 707 707 */ 708 static int ns8250_add_device(d evice_t *dev)708 static int ns8250_add_device(ddf_dev_t *dev) 709 709 { 710 710 ns8250_t *ns = NULL; 711 function_t *fun = NULL;711 ddf_fun_t *fun = NULL; 712 712 bool need_cleanup = false; 713 713 int rc; … … 777 777 ns->fun = fun; 778 778 779 add_function_to_class(fun, "serial");779 ddf_fun_add_to_class(fun, "serial"); 780 780 781 781 printf(NAME ": the %s device has been successfully initialized.\n", … … 800 800 * @param dev The device. 801 801 */ 802 static int ns8250_open( function_t *fun)802 static int ns8250_open(ddf_fun_t *fun) 803 803 { 804 804 ns8250_t *data = (ns8250_t *) fun->dev->driver_data; … … 824 824 * @param dev The device. 825 825 */ 826 static void ns8250_close( function_t *fun)826 static void ns8250_close(ddf_fun_t *fun) 827 827 { 828 828 ns8250_t *data = (ns8250_t *) fun->dev->driver_data; … … 848 848 */ 849 849 static void 850 ns8250_get_props(d evice_t *dev, unsigned int *baud_rate, unsigned int *parity,850 ns8250_get_props(ddf_dev_t *dev, unsigned int *baud_rate, unsigned int *parity, 851 851 unsigned int *word_length, unsigned int* stop_bits) 852 852 { … … 875 875 * @param stop_bits The number of stop bits to be used. 876 876 */ 877 static int ns8250_set_props(d evice_t *dev, unsigned int baud_rate,877 static int ns8250_set_props(ddf_dev_t *dev, unsigned int baud_rate, 878 878 unsigned int parity, unsigned int word_length, unsigned int stop_bits) 879 879 { … … 902 902 * Configure the parameters of the serial communication. 903 903 */ 904 static void ns8250_default_handler( function_t *fun, ipc_callid_t callid,904 static void ns8250_default_handler(ddf_fun_t *fun, ipc_callid_t callid, 905 905 ipc_call_t *call) 906 906 { … … 950 950 printf(NAME ": HelenOS serial port driver\n"); 951 951 ns8250_init(); 952 return d river_main(&ns8250_driver);952 return ddf_driver_main(&ns8250_driver); 953 953 } 954 954 -
uspace/drv/pciintel/pci.c
r34588a80 r83a2f43 72 72 #define PCI_BUS_FROM_FUN(fun) ((fun)->busptr) 73 73 74 static hw_resource_list_t *pciintel_get_resources( function_t *fnode)74 static hw_resource_list_t *pciintel_get_resources(ddf_fun_t *fnode) 75 75 { 76 76 pci_fun_t *fun = PCI_FUN(fnode); … … 81 81 } 82 82 83 static bool pciintel_enable_interrupt( function_t *fnode)83 static bool pciintel_enable_interrupt(ddf_fun_t *fnode) 84 84 { 85 85 /* TODO */ … … 93 93 }; 94 94 95 static d evice_ops_t pci_fun_ops;96 97 static int pci_add_device(d evice_t *);95 static ddf_dev_ops_t pci_fun_ops; 96 97 static int pci_add_device(ddf_dev_t *); 98 98 99 99 /** PCI bus driver standard operations */ … … 367 367 void pci_bus_scan(pci_bus_t *bus, int bus_num) 368 368 { 369 function_t *fnode;369 ddf_fun_t *fnode; 370 370 pci_fun_t *fun; 371 371 … … 459 459 } 460 460 461 static int pci_add_device(d evice_t *dnode)461 static int pci_add_device(ddf_dev_t *dnode) 462 462 { 463 463 pci_bus_t *bus = NULL; 464 function_t *ctl = NULL;464 ddf_fun_t *ctl = NULL; 465 465 bool got_res = false; 466 466 int rc; … … 633 633 printf(NAME ": HelenOS pci bus driver (intel method 1).\n"); 634 634 pciintel_init(); 635 return d river_main(&pci_driver);635 return ddf_driver_main(&pci_driver); 636 636 } 637 637 -
uspace/drv/pciintel/pci.h
r34588a80 r83a2f43 47 47 typedef struct pciintel_bus { 48 48 /** DDF device node */ 49 d evice_t *dnode;49 ddf_dev_t *dnode; 50 50 uint32_t conf_io_addr; 51 51 void *conf_data_port; … … 56 56 typedef struct pci_fun_data { 57 57 pci_bus_t *busptr; 58 function_t *fnode;58 ddf_fun_t *fnode; 59 59 60 60 int bus; -
uspace/drv/root/root.c
r34588a80 r83a2f43 65 65 #define VIRTUAL_FUN_MATCH_SCORE 100 66 66 67 static int root_add_device(d evice_t *dev);67 static int root_add_device(ddf_dev_t *dev); 68 68 69 69 /** The root device driver's standard operations. */ … … 83 83 * @return EOK on success or negative error code 84 84 */ 85 static int add_virtual_root_fun(d evice_t *dev)85 static int add_virtual_root_fun(ddf_dev_t *dev) 86 86 { 87 87 const char *name = VIRTUAL_FUN_NAME; 88 function_t *fun;88 ddf_fun_t *fun; 89 89 int rc; 90 90 … … 123 123 * @return EOK on success or negative error code 124 124 */ 125 static int add_platform_fun(d evice_t *dev)125 static int add_platform_fun(ddf_dev_t *dev) 126 126 { 127 127 char *match_id; … … 130 130 131 131 const char *name = PLATFORM_FUN_NAME; 132 function_t *fun;132 ddf_fun_t *fun; 133 133 int rc; 134 134 … … 189 189 * of HW and pseudo devices). 190 190 */ 191 static int root_add_device(d evice_t *dev)191 static int root_add_device(ddf_dev_t *dev) 192 192 { 193 193 printf(NAME ": root_add_device, device handle=%" PRIun "\n", … … 212 212 { 213 213 printf(NAME ": HelenOS root device driver\n"); 214 return d river_main(&root_driver);214 return ddf_driver_main(&root_driver); 215 215 } 216 216 -
uspace/drv/rootpc/rootpc.c
r34588a80 r83a2f43 62 62 } rootpc_fun_t; 63 63 64 static int rootpc_add_device(d evice_t *dev);64 static int rootpc_add_device(ddf_dev_t *dev); 65 65 static void root_pc_init(void); 66 66 … … 92 92 }; 93 93 94 static hw_resource_list_t *rootpc_get_resources( function_t *fnode)94 static hw_resource_list_t *rootpc_get_resources(ddf_fun_t *fnode) 95 95 { 96 96 rootpc_fun_t *fun = ROOTPC_FUN(fnode); … … 100 100 } 101 101 102 static bool rootpc_enable_interrupt( function_t *fun)102 static bool rootpc_enable_interrupt(ddf_fun_t *fun) 103 103 { 104 104 /* TODO */ … … 113 113 114 114 /* Initialized in root_pc_init() function. */ 115 static d evice_ops_t rootpc_fun_ops;115 static ddf_dev_ops_t rootpc_fun_ops; 116 116 117 117 static bool 118 rootpc_add_fun(d evice_t *dev, const char *name, const char *str_match_id,118 rootpc_add_fun(ddf_dev_t *dev, const char *name, const char *str_match_id, 119 119 rootpc_fun_t *fun) 120 120 { 121 121 printf(NAME ": adding new function '%s'.\n", name); 122 122 123 function_t *fnode = NULL;123 ddf_fun_t *fnode = NULL; 124 124 match_id_t *match_id = NULL; 125 125 … … 164 164 } 165 165 166 static bool rootpc_add_functions(d evice_t *dev)166 static bool rootpc_add_functions(ddf_dev_t *dev) 167 167 { 168 168 return rootpc_add_fun(dev, "pci0", "intel_pci", &pci_data); … … 175 175 * @return Zero on success, negative error number otherwise. 176 176 */ 177 static int rootpc_add_device(d evice_t *dev)177 static int rootpc_add_device(ddf_dev_t *dev) 178 178 { 179 179 printf(NAME ": rootpc_add_device, device handle = %d\n", … … 197 197 printf(NAME ": HelenOS PC platform driver\n"); 198 198 root_pc_init(); 199 return d river_main(&rootpc_driver);199 return ddf_driver_main(&rootpc_driver); 200 200 } 201 201 -
uspace/drv/rootvirt/rootvirt.c
r34588a80 r83a2f43 61 61 }; 62 62 63 static int rootvirt_add_device(d evice_t *dev);63 static int rootvirt_add_device(ddf_dev_t *dev); 64 64 65 65 static driver_ops_t rootvirt_ops = { … … 78 78 * @return EOK on success or negative error code. 79 79 */ 80 static int rootvirt_add_fun(d evice_t *vdev, virtual_function_t *vfun)80 static int rootvirt_add_fun(ddf_dev_t *vdev, virtual_function_t *vfun) 81 81 { 82 function_t *fun;82 ddf_fun_t *fun; 83 83 int rc; 84 84 … … 112 112 } 113 113 114 static int rootvirt_add_device(d evice_t *dev)114 static int rootvirt_add_device(ddf_dev_t *dev) 115 115 { 116 116 static int instances = 0; … … 142 142 { 143 143 printf(NAME ": HelenOS virtual devices root driver\n"); 144 return d river_main(&rootvirt_driver);144 return ddf_driver_main(&rootvirt_driver); 145 145 } 146 146 -
uspace/drv/test1/char.c
r34588a80 r83a2f43 37 37 #include "test1.h" 38 38 39 static int impl_char_read( function_t *fun, char *buf, size_t count) {39 static int impl_char_read(ddf_fun_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( function_t *fun, char *buf, size_t count) {44 static int imp_char_write(ddf_fun_t *fun, char *buf, size_t count) { 45 45 return count; 46 46 } … … 51 51 }; 52 52 53 d evice_ops_t char_device_ops = {53 ddf_dev_ops_t char_device_ops = { 54 54 .interfaces[CHAR_DEV_IFACE] = &char_dev_ops 55 55 }; -
uspace/drv/test1/test1.c
r34588a80 r83a2f43 36 36 #include "test1.h" 37 37 38 static int test1_add_device(d evice_t *dev);38 static int test1_add_device(ddf_dev_t *dev); 39 39 40 40 static driver_ops_t driver_ops = { … … 55 55 * @param score Device match score. 56 56 */ 57 static int register_fun_verbose(d evice_t *parent, const char *message,57 static int register_fun_verbose(ddf_dev_t *parent, const char *message, 58 58 const char *name, const char *match_id, int match_score) 59 59 { 60 function_t *fun;60 ddf_fun_t *fun; 61 61 int rc; 62 62 … … 105 105 * @return Error code reporting success of the operation. 106 106 */ 107 static int test1_add_device(d evice_t *dev)107 static int test1_add_device(ddf_dev_t *dev) 108 108 { 109 function_t *fun_a;109 ddf_fun_t *fun_a; 110 110 int rc; 111 111 … … 125 125 } 126 126 127 add_function_to_class(fun_a, "virtual");127 ddf_fun_add_to_class(fun_a, "virtual"); 128 128 129 129 if (str_cmp(dev->name, "null") == 0) { 130 130 fun_a->ops = &char_device_ops; 131 add_function_to_class(fun_a, "virt-null");131 ddf_fun_add_to_class(fun_a, "virt-null"); 132 132 } else if (str_cmp(dev->name, "test1") == 0) { 133 133 (void) register_fun_verbose(dev, "cloning myself ;-)", "clone", … … 146 146 { 147 147 printf(NAME ": HelenOS test1 virtual device driver\n"); 148 return d river_main(&test1_driver);148 return ddf_driver_main(&test1_driver); 149 149 } 150 150 -
uspace/drv/test1/test1.h
r34588a80 r83a2f43 36 36 #define NAME "test1" 37 37 38 extern d evice_ops_t char_device_ops;38 extern ddf_dev_ops_t char_device_ops; 39 39 40 40 #endif -
uspace/drv/test2/test2.c
r34588a80 r83a2f43 38 38 #define NAME "test2" 39 39 40 static int test2_add_device(d evice_t *dev);40 static int test2_add_device(ddf_dev_t *dev); 41 41 42 42 static driver_ops_t driver_ops = { … … 57 57 * @param score Device match score. 58 58 */ 59 static int register_fun_verbose(d evice_t *parent, const char *message,59 static int register_fun_verbose(ddf_dev_t *parent, const char *message, 60 60 const char *name, const char *match_id, int match_score) 61 61 { 62 function_t *fun;62 ddf_fun_t *fun; 63 63 int rc; 64 64 … … 92 92 /** Add child devices after some sleep. 93 93 * 94 * @param arg Parent device structure (d evice_t *).94 * @param arg Parent device structure (ddf_dev_t *). 95 95 * @return Always EOK. 96 96 */ 97 97 static int postponed_birth(void *arg) 98 98 { 99 d evice_t *dev = (device_t *) arg;100 function_t *fun_a;99 ddf_dev_t *dev = (ddf_dev_t *) arg; 100 ddf_fun_t *fun_a; 101 101 int rc; 102 102 … … 120 120 } 121 121 122 add_function_to_class(fun_a, "virtual");122 ddf_fun_add_to_class(fun_a, "virtual"); 123 123 124 124 return EOK; 125 125 } 126 126 127 static int test2_add_device(d evice_t *dev)127 static int test2_add_device(ddf_dev_t *dev) 128 128 { 129 129 printf(NAME ": test2_add_device(name=\"%s\", handle=%d)\n", … … 148 148 { 149 149 printf(NAME ": HelenOS test2 virtual device driver\n"); 150 return d river_main(&test2_driver);150 return ddf_driver_main(&test2_driver); 151 151 } 152 152
Note:
See TracChangeset
for help on using the changeset viewer.
