Changes in / [6843a9c:0bbd13e] in mainline
- Files:
-
- 31 deleted
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
boot/Makefile.common
r6843a9c r0bbd13e 155 155 $(USPACE_PATH)/app/dltest2/dltest2 \ 156 156 $(USPACE_PATH)/app/dload/dload \ 157 $(USPACE_PATH)/app/dplay/dplay \158 157 $(USPACE_PATH)/app/edit/edit \ 159 158 $(USPACE_PATH)/app/ext2info/ext2info \ … … 162 161 $(USPACE_PATH)/app/killall/killall \ 163 162 $(USPACE_PATH)/app/loc/loc \ 164 $(USPACE_PATH)/app/mixerctl/mixerctl \165 163 $(USPACE_PATH)/app/mkfat/mkfat \ 166 164 $(USPACE_PATH)/app/mkexfat/mkexfat \ -
boot/arch/amd64/Makefile.inc
r6843a9c r0bbd13e 35 35 36 36 RD_DRVS += \ 37 audio/sb16 \38 char/ns8250 \39 37 infrastructure/rootpc \ 40 38 bus/pci/pciintel \ -
uspace/Makefile
r6843a9c r0bbd13e 38 38 app/bnchmark \ 39 39 app/devctl \ 40 app/dplay \41 40 app/edit \ 42 41 app/ext2info \ … … 49 48 app/loc \ 50 49 app/lsusb \ 51 app/mixerctl \52 50 app/mkfat \ 53 51 app/mkexfat \ … … 105 103 srv/hid/remcons \ 106 104 srv/hw/char/s3c24xx_uart \ 107 drv/audio/sb16 \108 105 drv/infrastructure/root \ 109 106 drv/infrastructure/rootvirt \ -
uspace/drv/bus/isa/isa.c
r6843a9c r0bbd13e 91 91 fibril_mutex_t mutex; 92 92 ddf_fun_t *fnode; 93 hw_resource_t resources[ISA_MAX_HW_RES];94 93 hw_resource_list_t hw_resources; 95 94 link_t bus_link; … … 208 207 209 208 fibril_mutex_initialize(&fun->mutex); 210 fun->hw_resources.resources = fun->resources;211 212 209 fun->fnode = fnode; 213 210 return fun; … … 521 518 } 522 519 520 static void fun_hw_res_alloc(isa_fun_t *fun) 521 { 522 fun->hw_resources.resources = 523 (hw_resource_t *) malloc(sizeof(hw_resource_t) * ISA_MAX_HW_RES); 524 } 525 526 static void fun_hw_res_free(isa_fun_t *fun) 527 { 528 free(fun->hw_resources.resources); 529 fun->hw_resources.resources = NULL; 530 } 531 523 532 static char *isa_fun_read_info(char *fun_conf, isa_bus_t *isa) 524 533 { … … 549 558 return NULL; 550 559 } 560 561 /* Allocate buffer for the list of hardware resources of the device. */ 562 fun_hw_res_alloc(fun); 551 563 552 564 /* Get properties of the device (match ids, irq and io range). */ … … 665 677 list_remove(&fun->bus_link); 666 678 679 fun_hw_res_free(fun); 667 680 ddf_fun_destroy(fun->fnode); 668 681 } -
uspace/lib/c/generic/device/hw_res.c
r6843a9c r0bbd13e 42 42 { 43 43 sysarg_t count = 0; 44 44 45 45 async_exch_t *exch = async_exchange_begin(sess); 46 if (exch == NULL)47 return ENOMEM;48 46 int rc = async_req_1_1(exch, DEV_IFACE_ID(HW_RES_DEV_IFACE), 49 47 HW_RES_GET_RESOURCE_LIST, &count); 50 48 51 49 if (rc != EOK) { 52 50 async_exchange_end(exch); 53 51 return rc; 54 52 } 55 53 56 54 size_t size = count * sizeof(hw_resource_t); 57 55 hw_resource_t *resources = (hw_resource_t *) malloc(size); … … 61 59 return ENOMEM; 62 60 } 63 61 64 62 rc = async_data_read_start(exch, resources, size); 65 63 async_exchange_end(exch); 66 64 67 65 if (rc != EOK) { 68 66 free(resources); 69 67 return rc; 70 68 } 71 69 72 70 hw_resources->resources = resources; 73 71 hw_resources->count = count; 74 72 75 73 return EOK; 76 74 } … … 79 77 { 80 78 async_exch_t *exch = async_exchange_begin(sess); 81 if (exch == NULL)82 return false;83 79 int rc = async_req_1_0(exch, DEV_IFACE_ID(HW_RES_DEV_IFACE), 84 80 HW_RES_ENABLE_INTERRUPT); 85 81 async_exchange_end(exch); 86 82 87 83 return (rc == EOK); 88 }89 90 /**91 * Setup DMA channel to specified place and mode.92 * @param channel DMA Channel 1,2,3 for 8 bit transfers, 5,6,7 for 16 bit.93 * @param pa Physical address of the buffer. Must be < 16MB for 16 bit and < 1MB94 * for 8 bit transfers.95 * @param size DMA buffer size, limited to 64K.96 * @param mode Mode of the DMA channel:97 * - Read or Write98 * - Allow automatic reset99 * - Use address decrement instead of increment100 * - Use SINGLE/BLOCK/ON DEMAND transfer mode101 * @return Error code.102 */103 int hw_res_dma_channel_setup(async_sess_t *sess,104 unsigned channel, uint32_t pa, uint16_t size, uint8_t mode)105 {106 async_exch_t *exch = async_exchange_begin(sess);107 if (exch == NULL)108 return ENOMEM;109 const uint32_t packed = size | (mode << 16);110 const int ret = async_req_4_0(exch, DEV_IFACE_ID(HW_RES_DEV_IFACE),111 HW_RES_DMA_CHANNEL_SETUP, channel, pa, packed);112 async_exchange_end(exch);113 114 return ret;115 84 } 116 85 -
uspace/lib/c/generic/device/hw_res_parsed.c
r6843a9c r0bbd13e 38 38 #include <errno.h> 39 39 40 static void hw_res_parse_add_dma_channel(hw_res_list_parsed_t *out, 41 const hw_resource_t *res, int flags) 42 { 43 assert(res); 44 assert((res->type == DMA_CHANNEL_8) || (res->type == DMA_CHANNEL_16)); 45 46 const int channel = (res->type == DMA_CHANNEL_8) ? 47 res->res.dma_channel.dma8 : res->res.dma_channel.dma16; 48 const size_t count = out->dma_channels.count; 49 const int keep_duplicit = flags & HW_RES_KEEP_DUPLICIT; 50 51 if (!keep_duplicit) { 52 for (size_t i = 0; i < count; ++i) { 53 if (out->dma_channels.channels[i] == channel) 54 return; 55 } 56 } 57 58 out->dma_channels.channels[count] = channel; 59 ++out->dma_channels.count; 60 } 61 62 static void hw_res_parse_add_irq(hw_res_list_parsed_t *out, 63 const hw_resource_t *res, int flags) 40 static void hw_res_parse_add_irq(hw_res_list_parsed_t *out, hw_resource_t *res, 41 int flags) 64 42 { 65 43 assert(res && (res->type == INTERRUPT)); … … 81 59 82 60 static void hw_res_parse_add_io_range(hw_res_list_parsed_t *out, 83 consthw_resource_t *res, int flags)61 hw_resource_t *res, int flags) 84 62 { 85 63 assert(res && (res->type == IO_RANGE)); … … 112 90 113 91 static void hw_res_parse_add_mem_range(hw_res_list_parsed_t *out, 114 consthw_resource_t *res, int flags)92 hw_resource_t *res, int flags) 115 93 { 116 94 assert(res && (res->type == MEM_RANGE)); … … 154 132 * 155 133 */ 156 int hw_res_list_parse( consthw_resource_list_t *hw_resources,134 int hw_res_list_parse(hw_resource_list_t *hw_resources, 157 135 hw_res_list_parsed_t *out, int flags) 158 136 { … … 163 141 hw_res_list_parsed_clean(out); 164 142 165 out->irqs.irqs = calloc(res_count, sizeof(int)); 166 out->dma_channels.channels = calloc(res_count, sizeof(int)); 167 out->io_ranges.ranges = calloc(res_count, sizeof(io_range_t)); 168 out->mem_ranges.ranges = calloc(res_count, sizeof(mem_range_t)); 169 if (!out->irqs.irqs || !out->dma_channels.channels || 170 !out->io_ranges.ranges || !out->mem_ranges.ranges) { 171 hw_res_list_parsed_clean(out); 172 return ENOMEM; 173 } 143 out->irqs.irqs = malloc(res_count * sizeof(int)); 144 out->io_ranges.ranges = malloc(res_count * sizeof(io_range_t)); 145 out->mem_ranges.ranges = malloc(res_count * sizeof(mem_range_t)); 174 146 175 147 for (size_t i = 0; i < res_count; ++i) { 176 consthw_resource_t *resource = &(hw_resources->resources[i]);177 148 hw_resource_t *resource = &(hw_resources->resources[i]); 149 178 150 switch (resource->type) { 179 151 case INTERRUPT: … … 186 158 hw_res_parse_add_mem_range(out, resource, flags); 187 159 break; 188 case DMA_CHANNEL_8:189 case DMA_CHANNEL_16:190 hw_res_parse_add_dma_channel(out, resource, flags);191 break;192 160 default: 193 hw_res_list_parsed_clean(out);194 161 return EINVAL; 195 162 } 196 163 } 197 164 198 165 return EOK; 199 166 }; -
uspace/lib/c/include/device/hw_res_parsed.h
r6843a9c r0bbd13e 100 100 /** List of IRQs */ 101 101 irq_list_t irqs; 102 103 /** List of DMA channels */104 dma_list_t dma_channels;105 102 106 103 /** List of DMA channels */ … … 142 139 } 143 140 144 extern int hw_res_list_parse( 145 const hw_resource_list_t *, hw_res_list_parsed_t *, int); 141 extern int hw_res_list_parse(hw_resource_list_t *, hw_res_list_parsed_t *, int); 146 142 extern int hw_res_get_list_parsed(async_sess_t *, hw_res_list_parsed_t *, int); 147 143 -
uspace/lib/c/include/ipc/dev_iface.h
r6843a9c r0bbd13e 36 36 typedef enum { 37 37 HW_RES_DEV_IFACE = 0, 38 39 /** Audio device mixer interface */40 AUDIO_MIXER_IFACE,41 /** Audio device pcm buffer interface */42 AUDIO_PCM_BUFFER_IFACE,43 44 38 /** Character device interface */ 45 39 CHAR_DEV_IFACE, -
uspace/lib/drv/Makefile
r6843a9c r0bbd13e 38 38 generic/log.c \ 39 39 generic/logbuf.c \ 40 generic/remote_audio_mixer.c \41 generic/remote_audio_pcm_buffer.c \42 40 generic/remote_hw_res.c \ 43 41 generic/remote_char_dev.c \ -
uspace/lib/drv/generic/dev_iface.c
r6843a9c r0bbd13e 46 46 #include "remote_usbhid.h" 47 47 #include "remote_pci.h" 48 #include "remote_audio_mixer.h"49 #include "remote_audio_pcm_buffer.h"50 48 51 static constiface_dipatch_table_t remote_ifaces = {49 static iface_dipatch_table_t remote_ifaces = { 52 50 .ifaces = { 53 [AUDIO_MIXER_IFACE] = &remote_audio_mixer_iface, 54 [AUDIO_PCM_BUFFER_IFACE] = &remote_audio_pcm_buffer_iface, 55 [HW_RES_DEV_IFACE] = &remote_hw_res_iface, 56 [CHAR_DEV_IFACE] = &remote_char_dev_iface, 57 [NIC_DEV_IFACE] = &remote_nic_iface, 58 [PCI_DEV_IFACE] = &remote_pci_iface, 59 [USB_DEV_IFACE] = &remote_usb_iface, 60 [USBHC_DEV_IFACE] = &remote_usbhc_iface, 61 [USBHID_DEV_IFACE] = &remote_usbhid_iface, 51 &remote_hw_res_iface, 52 &remote_char_dev_iface, 53 &remote_nic_iface, 54 &remote_pci_iface, 55 &remote_usb_iface, 56 &remote_usbhc_iface, 57 &remote_usbhid_iface 62 58 } 63 59 }; -
uspace/lib/drv/generic/remote_hw_res.c
r6843a9c r0bbd13e 1 1 /* 2 2 * Copyright (c) 2010 Lenka Trochtova 3 * Copyright (c) 2011 Jan Vesely4 3 * All rights reserved. 5 4 * … … 44 43 static void remote_hw_res_enable_interrupt(ddf_fun_t *, void *, ipc_callid_t, 45 44 ipc_call_t *); 46 static void remote_hw_res_dma_channel_setup(ddf_fun_t *, void *, ipc_callid_t,47 ipc_call_t *);48 45 49 46 static remote_iface_func_ptr_t remote_hw_res_iface_ops [] = { 50 [HW_RES_GET_RESOURCE_LIST] = &remote_hw_res_get_resource_list, 51 [HW_RES_ENABLE_INTERRUPT] = &remote_hw_res_enable_interrupt, 52 [HW_RES_DMA_CHANNEL_SETUP] = &remote_hw_res_dma_channel_setup, 47 &remote_hw_res_get_resource_list, 48 &remote_hw_res_enable_interrupt 53 49 }; 54 50 … … 98 94 } 99 95 100 static void remote_hw_res_dma_channel_setup(ddf_fun_t *fun, void *ops,101 ipc_callid_t callid, ipc_call_t *call)102 {103 hw_res_ops_t *hw_res_ops = ops;104 105 if (hw_res_ops->dma_channel_setup == NULL) {106 async_answer_0(callid, ENOTSUP);107 return;108 }109 const unsigned channel = DEV_IPC_GET_ARG1(*call);110 const uint32_t address = DEV_IPC_GET_ARG2(*call);111 const uint16_t size = DEV_IPC_GET_ARG3(*call) & 0xffff;112 const uint8_t mode = DEV_IPC_GET_ARG3(*call) >> 16;113 114 const int ret = hw_res_ops->dma_channel_setup(115 fun, channel, address, size, mode);116 async_answer_0(callid, ret);117 }118 119 96 /** 120 97 * @}
Note:
See TracChangeset
for help on using the changeset viewer.