Changeset 3a0a4d8 in mainline for uspace/lib/c/include


Ignore:
Timestamp:
2013-09-12T07:54:05Z (12 years ago)
Author:
Maurizio Lombardi <m.lombardi85@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
95027b5
Parents:
47f5a77 (diff), 64f3d3b (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.
Message:

merge mainline changes

Location:
uspace/lib/c/include
Files:
4 added
15 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/include/adt/list.h

    r47f5a77 r3a0a4d8  
    11/*
    22 * Copyright (c) 2001-2004 Jakub Jermar
    3  * Copyright (c) 2011 Jiri Svoboda
     3 * Copyright (c) 2013 Jiri Svoboda
    44 * All rights reserved.
    55 *
     
    6565
    6666#define list_get_instance(link, type, member) \
    67         ((type *) (((void *)(link)) - ((void *) &(((type *) NULL)->member))))
    68 
    69 #define list_foreach(list, iterator) \
    70         for (link_t *iterator = (list).head.next; \
    71             iterator != &(list).head; iterator = iterator->next)
     67        ((type *) (((void *)(link)) - list_link_to_void(&(((type *) NULL)->member))))
     68
     69#define list_foreach(list, member, itype, iterator) \
     70        for (itype *iterator = NULL; iterator == NULL; iterator = (itype *) 1) \
     71            for (link_t *_link = (list).head.next; \
     72            iterator = list_get_instance(_link, itype, member), \
     73            _link != &(list).head; _link = _link->next)
    7274
    7375/** Unlike list_foreach(), allows removing items while traversing a list.
    74  * 
     76 *
    7577 * @code
    7678 * list_t mylist;
     
    238240static inline link_t *list_last(list_t *list)
    239241{
    240         return ((list->head.prev == &list->head) ? NULL : list->head.prev);
     242        return (list->head.prev == &list->head) ? NULL : list->head.prev;
     243}
     244
     245/** Get next item in list.
     246 *
     247 * @param link Current item link
     248 * @param list List containing @a link
     249 *
     250 * @return Next item or NULL if @a link is the last item.
     251 *
     252 */
     253static inline link_t *list_next(link_t *link, const list_t *list)
     254{
     255        return (link->next == &list->head) ? NULL : link->next;
     256}
     257
     258/** Get previous item in list.
     259 *
     260 * @param link Current item link
     261 * @param list List containing @a link
     262 *
     263 * @return Previous item or NULL if @a link is the first item.
     264 *
     265 */
     266static inline link_t *list_prev(link_t *link, const list_t *list)
     267{
     268        return (link->prev == &list->head) ? NULL : link->prev;
    241269}
    242270
     
    308336        unsigned int cnt = 0;
    309337       
    310         list_foreach(*list, link) {
     338        link_t *link = list_first(list);
     339        while (link != NULL) {
    311340                if (cnt == n)
    312341                        return link;
    313342               
    314343                cnt++;
     344                link = list_next(link, list);
    315345        }
    316346       
    317347        return NULL;
     348}
     349
     350/** Verify that argument type is a pointer to link_t (at compile time).
     351 *
     352 * This can be used to check argument type in a macro.
     353 */
     354static inline const void *list_link_to_void(const link_t *link)
     355{
     356        return link;
    318357}
    319358
  • uspace/lib/c/include/async.h

    r47f5a77 r3a0a4d8  
    399399extern int async_data_read_start(async_exch_t *, void *, size_t);
    400400extern bool async_data_read_receive(ipc_callid_t *, size_t *);
     401extern bool async_data_read_receive_call(ipc_callid_t *, ipc_call_t *, size_t *);
    401402extern int async_data_read_finalize(ipc_callid_t, const void *, size_t);
    402403
     
    437438extern int async_data_write_start(async_exch_t *, const void *, size_t);
    438439extern bool async_data_write_receive(ipc_callid_t *, size_t *);
     440extern bool async_data_write_receive_call(ipc_callid_t *, ipc_call_t *, size_t *);
    439441extern int async_data_write_finalize(ipc_callid_t, void *, size_t);
    440442
  • uspace/lib/c/include/cfg.h

    r47f5a77 r3a0a4d8  
    8080
    8181#define cfg_file_foreach(file, cur) \
    82         list_foreach((file)->sections, (cur))
     82        list_foreach((file)->sections, link, const cfg_section_t, (cur))
    8383
    8484#define cfg_section_instance(cur) \
     
    8686
    8787#define cfg_section_foreach(section, cur) \
    88         list_foreach((section)->entries, (cur))
     88        list_foreach((section)->entries, link, const cfg_entry_t, (cur))
    8989
    9090#define cfg_entry_instance(cur) \
  • uspace/lib/c/include/ddi.h

    r47f5a77 r3a0a4d8  
    4242#include <task.h>
    4343
     44#define DMAMEM_16MiB  ((uintptr_t) UINT64_C(0xffffffffff000000))
     45#define DMAMEM_4GiB   ((uintptr_t) UINT64_C(0xffffffff00000000))
     46
    4447extern int device_assign_devno(void);
    4548
    46 extern int physmem_map(void *, size_t, unsigned int, void **);
     49extern int physmem_map(uintptr_t, size_t, unsigned int, void **);
    4750
    48 extern int dmamem_map(void *, size_t, unsigned int, unsigned int, void **);
    49 extern int dmamem_map_anonymous(size_t, unsigned int, unsigned int, void **,
    50     void **);
     51extern int dmamem_map(void *, size_t, unsigned int, unsigned int, uintptr_t *);
     52extern int dmamem_map_anonymous(size_t, uintptr_t, unsigned int, unsigned int,
     53    uintptr_t *, void **);
    5154extern int dmamem_unmap(void *, size_t);
    5255extern int dmamem_unmap_anonymous(void *);
     
    6972extern uint32_t pio_read_32(const ioport32_t *);
    7073
    71 static inline uint8_t pio_change_8(
    72     ioport8_t *reg, uint8_t val, uint8_t mask, useconds_t delay)
     74static inline uint8_t pio_change_8(ioport8_t *reg, uint8_t val, uint8_t mask,
     75    useconds_t delay)
    7376{
    7477        uint8_t v = pio_read_8(reg);
     
    7881}
    7982
    80 static inline uint16_t pio_change_16(
    81     ioport16_t *reg, uint16_t val, uint16_t mask, useconds_t delay)
     83static inline uint16_t pio_change_16(ioport16_t *reg, uint16_t val,
     84    uint16_t mask, useconds_t delay)
    8285{
    8386        uint16_t v = pio_read_16(reg);
     
    8790}
    8891
    89 static inline uint32_t pio_change_32(
    90     ioport32_t *reg, uint32_t val, uint32_t mask, useconds_t delay)
     92static inline uint32_t pio_change_32(ioport32_t *reg, uint32_t val,
     93    uint32_t mask, useconds_t delay)
    9194{
    9295        uint32_t v = pio_read_32(reg);
  • uspace/lib/c/include/device/hw_res.h

    r47f5a77 r3a0a4d8  
    5353        HW_RES_ENABLE_INTERRUPT,
    5454        HW_RES_DMA_CHANNEL_SETUP,
     55        HW_RES_DMA_CHANNEL_REMAIN,
    5556} hw_res_method_t;
    5657
     
    115116
    116117extern int hw_res_dma_channel_setup(async_sess_t *, unsigned int, uint32_t,
    117     uint16_t, uint8_t);
     118    uint32_t, uint8_t);
     119extern int hw_res_dma_channel_remain(async_sess_t *, unsigned);
    118120
    119121#endif
  • uspace/lib/c/include/device/hw_res_parsed.h

    r47f5a77 r3a0a4d8  
    139139}
    140140
    141 extern int hw_res_list_parse(hw_resource_list_t *, hw_res_list_parsed_t *, int);
     141extern int hw_res_list_parse(const hw_resource_list_t *,
     142    hw_res_list_parsed_t *, int);
    142143extern int hw_res_get_list_parsed(async_sess_t *, hw_res_list_parsed_t *, int);
    143144
  • uspace/lib/c/include/devman.h

    r47f5a77 r3a0a4d8  
    6161    unsigned int);
    6262extern int devman_fun_get_child(devman_handle_t, devman_handle_t *);
     63extern int devman_dev_get_parent(devman_handle_t, devman_handle_t *);
    6364extern int devman_dev_get_functions(devman_handle_t, devman_handle_t **,
    6465    size_t *);
     66extern int devman_fun_get_match_id(devman_handle_t, size_t, char *, size_t,
     67    unsigned int *);
    6568extern int devman_fun_get_name(devman_handle_t, char *, size_t);
    6669extern int devman_fun_get_driver_name(devman_handle_t, char *, size_t);
     
    7174extern int devman_add_device_to_category(devman_handle_t, const char *);
    7275extern int devman_fun_sid_to_handle(service_id_t, devman_handle_t *);
     76extern int devman_get_drivers(devman_handle_t **, size_t *);
     77extern int devman_driver_get_devices(devman_handle_t, devman_handle_t **,
     78    size_t *);
     79extern int devman_driver_get_handle(const char *, devman_handle_t *);
     80extern int devman_driver_get_match_id(devman_handle_t, size_t, char *, size_t,
     81    unsigned int *);
     82extern int devman_driver_get_name(devman_handle_t, char *, size_t);
     83extern int devman_driver_get_state(devman_handle_t, driver_state_t *);
     84extern int devman_driver_load(devman_handle_t);
    7385
    7486#endif
  • uspace/lib/c/include/inet/addr.h

    r47f5a77 r3a0a4d8  
    7373extern void addr128(const addr128_t, addr128_t);
    7474
     75extern int addr48_compare(const addr48_t, const addr48_t);
    7576extern int addr128_compare(const addr128_t, const addr128_t);
     77
     78extern void addr48_solicited_node(const addr128_t, addr48_t);
    7679
    7780extern void host2addr128_t_be(const addr128_t, addr128_t);
  • uspace/lib/c/include/inet/dnsr.h

    r47f5a77 r3a0a4d8  
    5151
    5252extern int dnsr_init(void);
    53 extern int dnsr_name2host(const char *, dnsr_hostinfo_t **);
     53extern int dnsr_name2host(const char *, dnsr_hostinfo_t **, uint16_t);
    5454extern void dnsr_hostinfo_destroy(dnsr_hostinfo_t *);
    5555extern int dnsr_get_srvaddr(inet_addr_t *);
  • uspace/lib/c/include/ipc/dev_iface.h

    r47f5a77 r3a0a4d8  
    3636typedef enum {
    3737        HW_RES_DEV_IFACE = 0,
     38        PIO_WINDOW_DEV_IFACE,
     39
    3840        /** Character device interface */
    3941        CHAR_DEV_IFACE,
     
    4143        /** Graphic device interface */
    4244        GRAPH_DEV_IFACE,
     45
     46        /** Audio device mixer interface */
     47        AUDIO_MIXER_IFACE,
     48        /** Audio device pcm buffer interface */
     49        AUDIO_PCM_BUFFER_IFACE,
    4350       
    4451        /** Network interface controller interface */
     
    5461        /** Interface provided by USB HID devices. */
    5562        USBHID_DEV_IFACE,
     63
    5664        /** Interface provided by Real Time Clock devices */
    5765        CLOCK_DEV_IFACE,
     66
    5867        /** Interface provided by battery powered devices */
    5968        BATTERY_DEV_IFACE,
     69
    6070        /** Interface provided by AHCI devices. */
    6171        AHCI_DEV_IFACE,
  • uspace/lib/c/include/ipc/devman.h

    r47f5a77 r3a0a4d8  
    4242
    4343typedef sysarg_t devman_handle_t;
     44
     45typedef enum {
     46        /** Driver has not been started. */
     47        DRIVER_NOT_STARTED = 0,
     48       
     49        /**
     50         * Driver has been started, but has not registered as running and ready
     51         * to receive requests.
     52         */
     53        DRIVER_STARTING,
     54       
     55        /** Driver is running and prepared to serve incomming requests. */
     56        DRIVER_RUNNING
     57} driver_state_t;
    4458
    4559typedef enum {
     
    155169        DEVMAN_DEVICE_GET_HANDLE = IPC_FIRST_USER_METHOD,
    156170        DEVMAN_DEV_GET_FUNCTIONS,
     171        DEVMAN_DEV_GET_PARENT,
    157172        DEVMAN_FUN_GET_CHILD,
     173        DEVMAN_FUN_GET_MATCH_ID,
    158174        DEVMAN_FUN_GET_NAME,
    159175        DEVMAN_FUN_GET_DRIVER_NAME,
     
    161177        DEVMAN_FUN_OFFLINE,
    162178        DEVMAN_FUN_GET_PATH,
    163         DEVMAN_FUN_SID_TO_HANDLE
     179        DEVMAN_FUN_SID_TO_HANDLE,
     180        DEVMAN_GET_DRIVERS,
     181        DEVMAN_DRIVER_GET_DEVICES,
     182        DEVMAN_DRIVER_GET_HANDLE,
     183        DEVMAN_DRIVER_GET_MATCH_ID,
     184        DEVMAN_DRIVER_GET_NAME,
     185        DEVMAN_DRIVER_GET_STATE,
     186        DEVMAN_DRIVER_LOAD
    164187} client_to_devman_t;
    165188
  • uspace/lib/c/include/ipc/services.h

    r47f5a77 r3a0a4d8  
    5353} services_t;
    5454
     55#define SERVICE_NAME_CORECFG    "corecfg"
    5556#define SERVICE_NAME_DNSR       "net/dnsr"
    5657#define SERVICE_NAME_INET       "net/inet"
  • uspace/lib/c/include/ipc/vfs.h

    r47f5a77 r3a0a4d8  
    8282        VFS_IN_WAIT_HANDLE,
    8383        VFS_IN_MTAB_GET,
     84        VFS_IN_STATFS
    8485} vfs_in_request_t;
    8586
     
    9899        VFS_OUT_LOOKUP,
    99100        VFS_OUT_DESTROY,
     101        VFS_OUT_STATFS,
    100102        VFS_OUT_LAST
    101103} vfs_out_request_t;
  • uspace/lib/c/include/macros.h

    r47f5a77 r3a0a4d8  
    4040#define abs(a)     ((a) >= 0 ? (a) : -(a))
    4141
     42#define ARRAY_SIZE(array)   (sizeof(array) / sizeof(array[0]))
    4243
    4344#define KiB2SIZE(kb)  ((kb) << 10)
  • uspace/lib/c/include/vfs/vfs.h

    r47f5a77 r3a0a4d8  
    4444#include "vfs_mtab.h"
    4545
     46
    4647enum vfs_change_state_type {
    4748        VFS_PASS_HANDLE
    4849};
     50
    4951
    5052extern char *absolutize(const char *, size_t *);
     
    6163extern async_exch_t *vfs_exchange_begin(void);
    6264extern void vfs_exchange_end(async_exch_t *);
    63 
    6465#endif
    6566
Note: See TracChangeset for help on using the changeset viewer.