Changeset 72d120e in mainline for uspace/lib
- Timestamp:
- 2014-06-16T20:17:44Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 5a78e4e
- Parents:
- 9d653e3 (diff), 334bf28 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)links above to see all the changes relative to each parent. - Location:
- uspace/lib
- Files:
-
- 3 added
- 10 edited
- 2 moved
-
c/Makefile (modified) (1 diff)
-
c/arch/ia64/Makefile.common (modified) (1 diff)
-
c/arch/sparc64/_link.ld.in (modified) (2 diffs)
-
c/generic/ddi.c (modified) (4 diffs)
-
c/generic/device/clock_dev.c (modified) (1 diff)
-
c/generic/device/led_dev.c (added)
-
c/generic/time.c (modified) (1 diff)
-
c/include/device/led_dev.h (added)
-
c/include/ipc/dev_iface.h (modified) (1 diff)
-
drv/Makefile (modified) (1 diff)
-
drv/generic/dev_iface.c (modified) (2 diffs)
-
drv/generic/private/remote_led_dev.h (moved) (moved from uspace/app/msim/arch_helenos/helenos.h ) (2 diffs)
-
drv/generic/remote_led_dev.c (moved) (moved from uspace/app/msim/arch_helenos/input.c ) (2 diffs)
-
drv/generic/remote_usbhc.c (modified) (2 diffs)
-
drv/include/ops/led_dev.h (added)
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/Makefile
r9d653e3 r72d120e 65 65 generic/device/pio_window.c \ 66 66 generic/device/clock_dev.c \ 67 generic/device/led_dev.c \ 67 68 generic/dhcp.c \ 68 69 generic/dnsr.c \ -
uspace/lib/c/arch/ia64/Makefile.common
r9d653e3 r72d120e 27 27 # 28 28 29 # 30 # FIXME: 31 # 32 # The -fno-selective-scheduling and -fno-selective-scheduling2 options 33 # should be removed as soon as a bug in GCC concerning unchecked 34 # speculative loads is fixed. 35 # 36 # See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53975 for reference. 37 # 38 39 GCC_CFLAGS += -fno-unwind-tables -fno-selective-scheduling -fno-selective-scheduling2 29 GCC_CFLAGS += -fno-unwind-tables 40 30 41 31 ENDIANESS = LE -
uspace/lib/c/arch/sparc64/_link.ld.in
r9d653e3 r72d120e 10 10 #endif 11 11 data PT_LOAD FLAGS(6); 12 debug PT_NOTE; 12 13 } 13 14 … … 63 64 } :data 64 65 66 #ifdef CONFIG_LINE_DEBUG 67 .comment 0 : { *(.comment); } :debug 68 .debug_abbrev 0 : { *(.debug_abbrev); } :debug 69 .debug_aranges 0 : { *(.debug_aranges); } :debug 70 .debug_info 0 : { *(.debug_info); } :debug 71 .debug_line 0 : { *(.debug_line); } :debug 72 .debug_loc 0 : { *(.debug_loc); } :debug 73 .debug_pubnames 0 : { *(.debug_pubnames); } :debug 74 .debug_pubtypes 0 : { *(.debug_pubtypes); } :debug 75 .debug_ranges 0 : { *(.debug_ranges); } :debug 76 .debug_str 0 : { *(.debug_str); } :debug 77 #endif 78 65 79 /DISCARD/ : { 66 80 *(*); -
uspace/lib/c/generic/ddi.c
r9d653e3 r72d120e 71 71 * @param flags Flags for the new address space area. 72 72 * @param virt Virtual address of the starting page. 73 * 74 * @return EOK on success 75 * @return EPERM if the caller lacks the CAP_MEM_MANAGER capability 76 * @return ENOENT if there is no task with specified ID 73 * If set to AS_AREA_ANY ((void *) -1), a suitable value 74 * is found by the kernel, otherwise the kernel tries to 75 * obey the desired value. 76 * 77 * @return EOK on success. 78 * @return EPERM if the caller lacks the CAP_MEM_MANAGER capability. 77 79 * @return ENOMEM if there was some problem in creating 78 80 * the address space area. … … 85 87 } 86 88 89 /** Lock a piece physical memory for DMA transfers. 90 * 91 * The mapping of the specified virtual memory address 92 * to physical memory address is locked in order to 93 * make it safe for DMA transferts. 94 * 95 * Caller of this function must have the CAP_MEM_MANAGER capability. 96 * 97 * @param virt Virtual address of the memory to be locked. 98 * @param size Number of bytes to lock. 99 * @param map_flags Desired virtual memory area flags. 100 * @param flags Flags for the physical memory address. 101 * @param phys Locked physical memory address. 102 * 103 * @return EOK on success. 104 * @return EPERM if the caller lacks the CAP_MEM_MANAGER capability. 105 * @return ENOMEM if there was some problem in creating 106 * the address space area. 107 * 108 */ 87 109 int dmamem_map(void *virt, size_t size, unsigned int map_flags, 88 110 unsigned int flags, uintptr_t *phys) … … 93 115 } 94 116 117 /** Map a piece of physical memory suitable for DMA transfers. 118 * 119 * Caller of this function must have the CAP_MEM_MANAGER capability. 120 * 121 * @param size Number of bytes to map. 122 * @param constraint Bit mask defining the contraint on the physical 123 * address to be mapped. 124 * @param map_flags Desired virtual memory area flags. 125 * @param flags Flags for the physical memory address. 126 * @param virt Virtual address of the starting page. 127 * If set to AS_AREA_ANY ((void *) -1), a suitable value 128 * is found by the kernel, otherwise the kernel tries to 129 * obey the desired value. 130 * 131 * @return EOK on success. 132 * @return EPERM if the caller lacks the CAP_MEM_MANAGER capability. 133 * @return ENOMEM if there was some problem in creating 134 * the address space area. 135 * 136 */ 95 137 int dmamem_map_anonymous(size_t size, uintptr_t constraint, 96 138 unsigned int map_flags, unsigned int flags, uintptr_t *phys, void **virt) … … 221 263 size_t pages = SIZE2PAGES(offset + size); 222 264 223 void *virt_page ;265 void *virt_page = AS_AREA_ANY; 224 266 int rc = physmem_map(phys_frame, pages, 225 267 AS_AREA_READ | AS_AREA_WRITE, &virt_page); -
uspace/lib/c/generic/device/clock_dev.c
r9d653e3 r72d120e 27 27 */ 28 28 29 /** @addtogroup libc29 /** @addtogroup libc 30 30 * @{ 31 31 */ -
uspace/lib/c/generic/time.c
r9d653e3 r72d120e 555 555 } 556 556 557 void *addr ;557 void *addr = AS_AREA_ANY; 558 558 rc = physmem_map(faddr, 1, AS_AREA_READ | AS_AREA_CACHEABLE, 559 559 &addr); -
uspace/lib/c/include/ipc/dev_iface.h
r9d653e3 r72d120e 65 65 CLOCK_DEV_IFACE, 66 66 67 /** Interface provided by LED devices */ 68 LED_DEV_IFACE, 69 67 70 /** Interface provided by battery powered devices */ 68 71 BATTERY_DEV_IFACE, -
uspace/lib/drv/Makefile
r9d653e3 r72d120e 54 54 generic/remote_usbhid.c \ 55 55 generic/remote_clock_dev.c \ 56 generic/remote_led_dev.c \ 56 57 generic/remote_battery_dev.c \ 57 58 generic/remote_ahci.c -
uspace/lib/drv/generic/dev_iface.c
r9d653e3 r72d120e 43 43 #include "remote_char_dev.h" 44 44 #include "remote_clock_dev.h" 45 #include "remote_led_dev.h" 45 46 #include "remote_battery_dev.h" 46 47 #include "remote_graph_dev.h" … … 68 69 [USBHID_DEV_IFACE] = &remote_usbhid_iface, 69 70 [CLOCK_DEV_IFACE] = &remote_clock_dev_iface, 71 [LED_DEV_IFACE] = &remote_led_dev_iface, 70 72 [BATTERY_DEV_IFACE] = &remote_battery_dev_iface, 71 73 [AHCI_DEV_IFACE] = &remote_ahci_iface, -
uspace/lib/drv/generic/private/remote_led_dev.h
r9d653e3 r72d120e 1 1 /* 2 * Copyright (c) 201 2 Vojtech Horky2 * Copyright (c) 2014 Martin Decky 3 3 * All rights reserved. 4 4 * … … 27 27 */ 28 28 29 /** @addtogroup msim29 /** @addtogroup libdrv 30 30 * @{ 31 31 */ 32 /** @file 33 */ 32 34 33 #ifndef MSIM_HELENOS_H_34 #define MSIM_HELENOS_H_35 #ifndef LIBDRV_REMOTE_LED_DEV_H_ 36 #define LIBDRV_REMOTE_LED_DEV_H_ 35 37 36 char *helenos_input_get_next_command(void); 37 void helenos_dprinter_init(void); 38 extern remote_iface_t remote_led_dev_iface; 38 39 39 40 #endif -
uspace/lib/drv/generic/remote_led_dev.c
r9d653e3 r72d120e 1 1 /* 2 * Copyright (c) 201 2 Vojtech Horky2 * Copyright (c) 2014 Martin Decky 3 3 * All rights reserved. 4 4 * … … 27 27 */ 28 28 29 /** @addtogroup msim29 /** @addtogroup libdrv 30 30 * @{ 31 31 */ 32 /** @file HelenOS specific functions for MSIM simulator.32 /** @file 33 33 */ 34 34 35 /* Because of asprintf. */ 36 #define _GNU_SOURCE 37 #include "../../io/input.h" 38 #include "../../io/output.h" 39 #include "../../fault.h" 40 #include "helenos.h" 41 #include <tinput.h> 35 #include <async.h> 42 36 #include <errno.h> 43 #include <stdlib.h> 37 #include <io/pixel.h> 38 #include <macros.h> 39 #include <device/led_dev.h> 40 #include <ops/led_dev.h> 41 #include <ddf/driver.h> 44 42 45 static tinput_t *input_prompt; 43 static void remote_led_color_set(ddf_fun_t *, void *, ipc_callid_t, 44 ipc_call_t *); 46 45 47 /** Terminal and readline initialization 46 /** Remote LED interface operations */ 47 static const remote_iface_func_ptr_t remote_led_dev_iface_ops[] = { 48 [LED_DEV_COLOR_SET] = remote_led_color_set 49 }; 50 51 /** Remote LED interface structure 52 * 53 * Interface for processing requests from remote clients 54 * addressed by the LED interface. 48 55 * 49 56 */ 50 void input_init(void) 57 const remote_iface_t remote_led_dev_iface = { 58 .method_count = ARRAY_SIZE(remote_led_dev_iface_ops), 59 .methods = remote_led_dev_iface_ops 60 }; 61 62 /** Process the color_set() request from the remote client 63 * 64 * @param fun The function to which the data are written 65 * @param ops The local ops structure 66 * 67 */ 68 static void remote_led_color_set(ddf_fun_t *fun, void *ops, ipc_callid_t callid, 69 ipc_call_t *call) 51 70 { 52 input_prompt = tinput_new(); 53 if (input_prompt == NULL) { 54 die(1, "Failed to intialize input."); 71 led_dev_ops_t *led_dev_ops = (led_dev_ops_t *) ops; 72 pixel_t color = DEV_IPC_GET_ARG1(*call); 73 74 if (!led_dev_ops->color_set) { 75 async_answer_0(callid, ENOTSUP); 76 return; 55 77 } 56 helenos_dprinter_init(); 78 79 int rc = (*led_dev_ops->color_set)(fun, color); 80 async_answer_0(callid, rc); 57 81 } 58 82 59 void input_inter(void) 60 { 61 } 62 63 void input_shadow( void) 64 { 65 } 66 67 void input_back( void) 68 { 69 } 70 71 char *helenos_input_get_next_command(void) 72 { 73 tinput_set_prompt(input_prompt, "[msim] "); 74 75 char *commline = NULL; 76 int rc = tinput_read(input_prompt, &commline); 77 78 if (rc == ENOENT) { 79 rc = asprintf(&commline, "quit"); 80 mprintf("Quit\n"); 81 if (rc != EOK) { 82 exit(1); 83 } 84 } 85 86 /* On error, it remains NULL. */ 87 return commline; 88 } 89 90 91 bool stdin_poll(char *key) 92 { 93 cons_event_t ev; 94 suseconds_t timeout = 0; 95 errno = EOK; 96 console_flush(input_prompt->console); 97 bool has_input = console_get_event_timeout(input_prompt->console, &ev, &timeout); 98 if (!has_input) { 99 return false; 100 } 101 102 if (ev.type != CEV_KEY || ev.ev.key.type != KEY_PRESS) 103 return false; 104 105 *key = ev.ev.key.c; 106 107 return true; 108 } 109 83 /** 84 * @} 85 */ -
uspace/lib/drv/generic/remote_usbhc.c
r9d653e3 r72d120e 363 363 static void async_transaction_destroy(async_transaction_t *trans) 364 364 { 365 if (trans == NULL) {366 return; 367 }368 if (trans->buffer != NULL) {365 if (trans == NULL) 366 return; 367 368 if (trans->buffer != NULL) 369 369 free(trans->buffer); 370 } 371 370 372 371 free(trans); 373 372 } … … 585 584 async_answer_0(callid, ENOMEM); 586 585 async_transaction_destroy(trans); 586 return; 587 587 } 588 588
Note:
See TracChangeset
for help on using the changeset viewer.
