Changes in / [d6b1359:0c70f7e] in mainline
- Location:
- uspace
- Files:
-
- 8 added
- 8 deleted
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/tester/hw/misc/virtchar1.c
rd6b1359 r0c70f7e 40 40 #include <sys/types.h> 41 41 #include <async.h> 42 #include <device/char _dev.h>42 #include <device/char.h> 43 43 #include <str.h> 44 44 #include <vfs/vfs.h> 45 45 #include <sys/stat.h> 46 46 #include <fcntl.h> 47 #include <device/char.h> 47 48 #include "../../tester.h" 48 49 … … 78 79 size_t i; 79 80 char buffer[BUFFER_SIZE]; 80 char_dev_read(phone, buffer, BUFFER_SIZE);81 read_dev(phone, buffer, BUFFER_SIZE); 81 82 TPRINTF(" ...verifying that we read zeroes only...\n"); 82 83 for (i = 0; i < BUFFER_SIZE; i++) { -
uspace/app/tester/hw/serial/serial1.c
rd6b1359 r0c70f7e 45 45 #include <ipc/devman.h> 46 46 #include <devman.h> 47 #include <device/char _dev.h>47 #include <device/char.h> 48 48 #include <str.h> 49 49 #include <ipc/serial_ctl.h> … … 121 121 size_t total = 0; 122 122 while (total < cnt) { 123 ssize_t read = char_dev_read(phone, buf, cnt - total);123 ssize_t read = read_dev(phone, buf, cnt - total); 124 124 125 125 if (read < 0) { … … 152 152 * direction of data transfer. 153 153 */ 154 ssize_t written = char_dev_write(phone, buf, read);154 ssize_t written = write_dev(phone, buf, read); 155 155 156 156 if (written < 0) { … … 181 181 182 182 size_t eot_size = str_size(EOT); 183 ssize_t written = char_dev_write(phone, (void *) EOT, eot_size);183 ssize_t written = write_dev(phone, (void *) EOT, eot_size); 184 184 185 185 ipc_call_sync_4_0(phone, SERIAL_SET_COM_PROPS, old_baud, -
uspace/drv/isa/isa.c
rd6b1359 r0c70f7e 51 51 52 52 #include <driver.h> 53 #include < ops/hw_res.h>53 #include <resource.h> 54 54 55 55 #include <devman.h> … … 84 84 } 85 85 86 static hw_res_ops_t isa_child_hw_res_ops= {86 static resource_iface_t isa_child_res_iface = { 87 87 &isa_get_child_resources, 88 88 &isa_enable_child_interrupt … … 502 502 static void isa_init() 503 503 { 504 isa_child_dev_ops.interfaces[HW_RES_DEV_IFACE] = &isa_child_ hw_res_ops;504 isa_child_dev_ops.interfaces[HW_RES_DEV_IFACE] = &isa_child_res_iface; 505 505 } 506 506 -
uspace/drv/ns8250/ns8250.c
rd6b1359 r0c70f7e 53 53 54 54 #include <driver.h> 55 #include <ops/char_dev.h> 55 #include <char.h> 56 #include <resource.h> 56 57 57 58 #include <devman.h> … … 226 227 227 228 /** The character interface's callbacks. */ 228 static char_ dev_ops_t ns8250_char_dev_ops= {229 static char_iface_t ns8250_char_iface = { 229 230 .read = &ns8250_read, 230 231 .write = &ns8250_write … … 346 347 347 348 /* Get hw resources. */ 348 ret = hw_res_get_resource_list(dev->parent_phone, &hw_resources);349 ret = get_hw_resources(dev->parent_phone, &hw_resources); 349 350 if (ret != EOK) { 350 351 printf(NAME ": failed to get hw resources for the device " … … 393 394 } 394 395 395 hw_res_clean_resource_list(&hw_resources);396 clean_hw_resource_list(&hw_resources); 396 397 return ret; 397 398 398 399 failed: 399 400 ns8250_dev_cleanup(dev); 400 hw_res_clean_resource_list(&hw_resources);401 clean_hw_resource_list(&hw_resources); 401 402 return ret; 402 403 } … … 923 924 ns8250_dev_ops.close = &ns8250_close; 924 925 925 ns8250_dev_ops.interfaces[CHAR_DEV_IFACE] = &ns8250_char_ dev_ops;926 ns8250_dev_ops.interfaces[CHAR_DEV_IFACE] = &ns8250_char_iface; 926 927 ns8250_dev_ops.default_handler = &ns8250_default_handler; 927 928 } -
uspace/drv/pciintel/pci.c
rd6b1359 r0c70f7e 49 49 #include <ipc/devman.h> 50 50 #include <ipc/dev_iface.h> 51 #include < ops/hw_res.h>51 #include <resource.h> 52 52 #include <device/hw_res.h> 53 53 #include <ddi.h> … … 77 77 } 78 78 79 static hw_res_ops_t pciintel_child_hw_res_ops= {79 static resource_iface_t pciintel_child_res_iface = { 80 80 &pciintel_get_child_resources, 81 81 &pciintel_enable_child_interrupt … … 473 473 hw_resource_list_t hw_resources; 474 474 475 rc = hw_res_get_resource_list(dev->parent_phone, &hw_resources);475 rc = get_hw_resources(dev->parent_phone, &hw_resources); 476 476 if (rc != EOK) { 477 477 printf(NAME ": pci_add_device failed to get hw resources for " … … 497 497 delete_pci_bus_data(bus_data); 498 498 ipc_hangup(dev->parent_phone); 499 hw_res_clean_resource_list(&hw_resources);499 clean_hw_resource_list(&hw_resources); 500 500 return EADDRNOTAVAIL; 501 501 } … … 508 508 pci_bus_scan(dev, 0); 509 509 510 hw_res_clean_resource_list(&hw_resources);510 clean_hw_resource_list(&hw_resources); 511 511 512 512 return EOK; … … 515 515 static void pciintel_init(void) 516 516 { 517 pci_child_ops.interfaces[HW_RES_DEV_IFACE] = &pciintel_child_ hw_res_ops;517 pci_child_ops.interfaces[HW_RES_DEV_IFACE] = &pciintel_child_res_iface; 518 518 } 519 519 … … 537 537 { 538 538 if (dev_data != NULL) { 539 hw_res_clean_resource_list(&dev_data->hw_resources);539 clean_hw_resource_list(&dev_data->hw_resources); 540 540 free(dev_data); 541 541 } -
uspace/drv/rootpc/rootpc.c
rd6b1359 r0c70f7e 50 50 #include <ipc/devman.h> 51 51 #include <ipc/dev_iface.h> 52 #include < ops/hw_res.h>52 #include <resource.h> 53 53 #include <device/hw_res.h> 54 54 … … 107 107 } 108 108 109 static hw_res_ops_t child_hw_res_ops= {109 static resource_iface_t child_res_iface = { 110 110 &rootpc_get_child_resources, 111 111 &rootpc_enable_child_interrupt … … 190 190 static void root_pc_init(void) 191 191 { 192 rootpc_child_ops.interfaces[HW_RES_DEV_IFACE] = &child_ hw_res_ops;192 rootpc_child_ops.interfaces[HW_RES_DEV_IFACE] = &child_res_iface; 193 193 } 194 194 -
uspace/drv/test1/char.c
rd6b1359 r0c70f7e 33 33 #include <errno.h> 34 34 #include <mem.h> 35 #include < ops/char_dev.h>35 #include <char.h> 36 36 37 37 #include "test1.h" … … 46 46 } 47 47 48 static char_ dev_ops_t char_dev_ops= {48 static char_iface_t char_interface = { 49 49 .read = &impl_char_read, 50 50 .write = &imp_char_write … … 52 52 53 53 device_ops_t char_device_ops = { 54 .interfaces[CHAR_DEV_IFACE] = &char_ dev_ops54 .interfaces[CHAR_DEV_IFACE] = &char_interface 55 55 }; 56 56 -
uspace/lib/c/Makefile
rd6b1359 r0c70f7e 59 59 generic/devman.c \ 60 60 generic/device/hw_res.c \ 61 generic/device/char _dev.c \61 generic/device/char.c \ 62 62 generic/event.c \ 63 63 generic/errno.c \ -
uspace/lib/c/generic/device/hw_res.c
rd6b1359 r0c70f7e 26 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 27 */ 28 28 29 29 /** @addtogroup libc 30 30 * @{ … … 32 32 /** @file 33 33 */ 34 34 35 35 #include <device/hw_res.h> 36 36 #include <errno.h> … … 38 38 #include <malloc.h> 39 39 40 int hw_res_get_resource_list(int dev_phone, hw_resource_list_t *hw_resources)40 int get_hw_resources(int dev_phone, hw_resource_list_t *hw_resources) 41 41 { 42 42 sysarg_t count = 0; 43 44 int rc = async_req_1_1(dev_phone, DEV_IFACE_ID(HW_RES_DEV_IFACE), 45 HW_RES_GET_RESOURCE_LIST, &count); 46 43 int rc = async_req_1_1(dev_phone, DEV_IFACE_ID(HW_RES_DEV_IFACE), GET_RESOURCE_LIST, &count); 47 44 hw_resources->count = count; 48 45 if (rc != EOK) … … 60 57 return rc; 61 58 } 62 59 63 60 return EOK; 64 61 } 65 62 66 bool hw_res_enable_interrupt(int dev_phone)63 bool enable_interrupt(int dev_phone) 67 64 { 68 int rc = async_req_1_0(dev_phone, DEV_IFACE_ID(HW_RES_DEV_IFACE), 69 HW_RES_ENABLE_INTERRUPT); 70 65 int rc = async_req_1_0(dev_phone, DEV_IFACE_ID(HW_RES_DEV_IFACE), ENABLE_INTERRUPT); 71 66 return rc == EOK; 72 67 } 73 74 /** @} 68 69 70 71 /** @} 75 72 */ -
uspace/lib/c/include/device/hw_res.h
rd6b1359 r0c70f7e 27 27 */ 28 28 29 /** @addtogroup libc29 /** @addtogroup libc 30 30 * @{ 31 31 */ … … 39 39 #include <bool.h> 40 40 41 /** HW resource provider interface */ 41 // HW resource provider interface 42 42 43 typedef enum { 43 HW_RES_GET_RESOURCE_LIST = 0,44 HW_RES_ENABLE_INTERRUPT45 } hw_res_ method_t;44 GET_RESOURCE_LIST = 0, 45 ENABLE_INTERRUPT 46 } hw_res_funcs_t; 46 47 47 /** HW resource types */48 /** HW resource types. */ 48 49 typedef enum { 49 50 INTERRUPT, … … 57 58 } endianness_t; 58 59 59 /** HW resource (e.g. interrupt, memory register, i/o register etc.) */ 60 typedef struct { 60 61 /** HW resource (e.g. interrupt, memory register, i/o register etc.). */ 62 typedef struct hw_resource { 61 63 hw_res_type_t type; 62 64 union { 63 65 struct { 64 66 uint64_t address; 65 endianness_t endianness; 66 size_t size; 67 endianness_t endianness; 68 size_t size; 67 69 } mem_range; 68 69 70 struct { 70 71 uint64_t address; 71 endianness_t endianness; 72 size_t size; 72 endianness_t endianness; 73 size_t size; 73 74 } io_range; 74 75 75 struct { 76 int irq; 77 } interrupt; 78 } res; 76 int irq; 77 } interrupt; 78 } res; 79 79 } hw_resource_t; 80 80 81 typedef struct {81 typedef struct hw_resource_list { 82 82 size_t count; 83 hw_resource_t *resources; 83 hw_resource_t *resources; 84 84 } hw_resource_list_t; 85 85 86 static inline void hw_res_clean_resource_list(hw_resource_list_t *hw_res)86 static inline void clean_hw_resource_list(hw_resource_list_t *hw_res) 87 87 { 88 if (hw_res->resources != NULL) {88 if(NULL != hw_res->resources) { 89 89 free(hw_res->resources); 90 91 90 hw_res->resources = NULL; 92 91 } 93 94 hw_res->count = 0; 92 hw_res->count = 0; 95 93 } 96 94 97 extern int hw_res_get_resource_list(int, hw_resource_list_t *); 98 extern bool hw_res_enable_interrupt(int); 95 96 97 extern int get_hw_resources(int, hw_resource_list_t *); 98 extern bool enable_interrupt(int); 99 99 100 100 101 #endif -
uspace/lib/c/include/ipc/dev_iface.h
rd6b1359 r0c70f7e 35 35 #include <libarch/types.h> 36 36 37 typedef enum { 38 HW_RES_DEV_IFACE = 0, 37 typedef enum { 38 HW_RES_DEV_IFACE = 0, 39 39 CHAR_DEV_IFACE, 40 // TODO add more interfaces 40 41 DEV_IFACE_MAX 41 42 } dev_inferface_idx_t; -
uspace/lib/drv/Makefile
rd6b1359 r0c70f7e 35 35 generic/driver.c \ 36 36 generic/dev_iface.c \ 37 generic/remote_ hw_res.c \38 generic/remote_char _dev.c37 generic/remote_res.c \ 38 generic/remote_char.c 39 39 40 40 include $(USPACE_PREFIX)/Makefile.common -
uspace/lib/drv/generic/dev_iface.c
rd6b1359 r0c70f7e 37 37 38 38 #include "dev_iface.h" 39 #include "remote_ hw_res.h"40 #include "remote_char _dev.h"39 #include "remote_res.h" 40 #include "remote_char.h" 41 41 42 42 static iface_dipatch_table_t remote_ifaces = { 43 43 .ifaces = { 44 &remote_ hw_res_iface,45 &remote_char_ dev_iface44 &remote_res_iface, 45 &remote_char_iface 46 46 } 47 47 }; 48 48 49 49 remote_iface_t* get_remote_iface(int idx) 50 { 50 { 51 51 assert(is_valid_iface_idx(idx)); 52 52 return remote_ifaces.ifaces[idx]; -
uspace/lib/drv/include/driver.h
rd6b1359 r0c70f7e 41 41 #include <ipc/devman.h> 42 42 #include <ipc/dev_iface.h> 43 #include <device/hw_res.h> 44 #include <device/char.h> 43 45 #include <assert.h> 44 46 #include <ddi.h>
Note:
See TracChangeset
for help on using the changeset viewer.