Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/include/async.h

    rb4df8db rae6021d  
    4545#include <atomic.h>
    4646#include <stdbool.h>
    47 #include <task.h>
     47#include <abi/proc/task.h>
     48#include <abi/ddi/irq.h>
     49#include <abi/ipc/event.h>
     50#include <abi/ipc/interfaces.h>
    4851
    4952typedef ipc_callid_t aid_t;
     53typedef sysarg_t port_id_t;
    5054
    5155typedef void *(*async_client_data_ctor_t)(void);
    5256typedef void (*async_client_data_dtor_t)(void *);
    5357
    54 /** Client connection handler
     58/** Port connection handler
    5559 *
    5660 * @param callid ID of incoming call or 0 if connection initiated from
    57  *               inside using async_connect_to_me()
     61 *               inside using async_create_callback_port()
    5862 * @param call   Incoming call or 0 if connection initiated from inside
    59  * @param arg    Local argument passed from async_new_connection() or
    60  *               async_connect_to_me()
    61  */
    62 typedef void (*async_client_conn_t)(ipc_callid_t, ipc_call_t *, void *);
    63 
    64 /** Interrupt handler */
    65 typedef void (*async_interrupt_handler_t)(ipc_callid_t, ipc_call_t *);
     63 *               using async_create_callback_port()
     64 * @param arg    Local argument.
     65 *
     66 */
     67typedef void (*async_port_handler_t)(ipc_callid_t, ipc_call_t *, void *);
     68
     69/** Notification handler */
     70typedef void (*async_notification_handler_t)(ipc_callid_t, ipc_call_t *,
     71    void *);
    6672
    6773/** Exchange management style
     
    7783        EXCHANGE_ATOMIC = 0,
    7884       
     85        /** Exchange management via mutual exclusion
     86         *
     87         * Suitable for any kind of client/server communication,
     88         * but can limit parallelism.
     89         *
     90         */
     91        EXCHANGE_SERIALIZE = 1,
     92       
    7993        /** Exchange management via phone cloning
    8094         *
     
    8498         *
    8599         */
    86         EXCHANGE_PARALLEL,
    87        
    88         /** Exchange management via mutual exclusion
    89          *
    90          * Suitable for any kind of client/server communication,
    91          * but can limit parallelism.
    92          *
    93          */
    94         EXCHANGE_SERIALIZE
     100        EXCHANGE_PARALLEL = 2
    95101} exch_mgmt_t;
    96102
     
    105111
    106112#define async_manager() \
    107         fibril_switch(FIBRIL_TO_MANAGER)
     113        do { \
     114                futex_down(&async_futex); \
     115                fibril_switch(FIBRIL_FROM_DEAD); \
     116        } while (0)
    108117
    109118#define async_get_call(data) \
     
    141150extern void async_forget(aid_t);
    142151
    143 extern fid_t async_new_connection(task_id_t, sysarg_t, ipc_callid_t,
    144     ipc_call_t *, async_client_conn_t, void *);
    145 
    146152extern void async_usleep(suseconds_t);
    147153extern void async_create_manager(void);
     
    154160extern void async_put_client_data_by_id(task_id_t);
    155161
    156 extern void async_set_client_connection(async_client_conn_t);
    157 extern void async_set_interrupt_received(async_interrupt_handler_t);
    158 extern void async_set_interrupt_handler_stack_size(size_t);
     162extern int async_create_port(iface_t, async_port_handler_t, void *,
     163    port_id_t *);
     164extern void async_set_fallback_port_handler(async_port_handler_t, void *);
     165extern int async_create_callback_port(async_exch_t *, iface_t, sysarg_t,
     166    sysarg_t, async_port_handler_t, void *, port_id_t *);
     167
     168extern int async_irq_subscribe(int, int, async_notification_handler_t, void *,
     169    const irq_code_t *);
     170extern int async_irq_unsubscribe(int, int);
     171
     172extern int async_event_subscribe(event_type_t, async_notification_handler_t,
     173    void *);
     174extern int async_event_task_subscribe(event_task_type_t,
     175    async_notification_handler_t, void *);
     176extern int async_event_unsubscribe(event_type_t);
     177extern int async_event_task_unsubscribe(event_task_type_t);
     178extern int async_event_unmask(event_type_t);
     179extern int async_event_task_unmask(event_task_type_t);
    159180
    160181/*
     
    325346extern async_sess_t *async_connect_me_to(exch_mgmt_t, async_exch_t *, sysarg_t,
    326347    sysarg_t, sysarg_t);
     348extern async_sess_t *async_connect_me_to_iface(async_exch_t *, iface_t,
     349    sysarg_t, sysarg_t);
    327350extern async_sess_t *async_connect_me_to_blocking(exch_mgmt_t, async_exch_t *,
    328351    sysarg_t, sysarg_t, sysarg_t);
     352extern async_sess_t *async_connect_me_to_blocking_iface(async_exch_t *, iface_t,
     353    sysarg_t, sysarg_t);
    329354extern async_sess_t *async_connect_kbox(task_id_t);
    330355
    331 extern int async_connect_to_me(async_exch_t *, sysarg_t, sysarg_t, sysarg_t,
    332     async_client_conn_t, void *);
     356extern int async_connect_to_me(async_exch_t *, sysarg_t, sysarg_t, sysarg_t);
    333357
    334358extern int async_hangup(async_sess_t *);
     
    399423extern int async_data_read_start(async_exch_t *, void *, size_t);
    400424extern bool async_data_read_receive(ipc_callid_t *, size_t *);
     425extern bool async_data_read_receive_call(ipc_callid_t *, ipc_call_t *, size_t *);
    401426extern int async_data_read_finalize(ipc_callid_t, const void *, size_t);
    402427
     
    437462extern int async_data_write_start(async_exch_t *, const void *, size_t);
    438463extern bool async_data_write_receive(ipc_callid_t *, size_t *);
     464extern bool async_data_write_receive_call(ipc_callid_t *, ipc_call_t *, size_t *);
    439465extern int async_data_write_finalize(ipc_callid_t, void *, size_t);
    440466
     
    462488extern void async_remote_state_release_exchange(async_exch_t *);
    463489
     490extern void *async_as_area_create(void *, size_t, unsigned int, async_sess_t *,
     491    sysarg_t, sysarg_t, sysarg_t);
     492
    464493#endif
    465494
Note: See TracChangeset for help on using the changeset viewer.