3 * \author John Hodge (thePowersGang)
8 #include <udi_internal.h>
9 #include <udi_internal_ma.h>
12 EXPORT(udi_channel_anchor);
13 EXPORT(udi_channel_spawn);
14 EXPORT(udi_channel_set_context);
15 EXPORT(udi_channel_op_abort);
16 EXPORT(udi_channel_close);
17 EXPORT(udi_channel_event_ind);
18 EXPORT(udi_channel_event_complete);
23 void udi_channel_anchor(
24 udi_channel_anchor_call_t *callback, udi_cb_t *gcb,
25 udi_channel_t channel, udi_index_t ops_idx, void *channel_context
33 extern void udi_channel_spawn(
34 udi_channel_spawn_call_t *callback, udi_cb_t *gcb,
35 udi_channel_t channel, udi_index_t spawn_idx,
36 udi_index_t ops_idx, void *channel_context
39 LOG("gcb=%p,channel=%p,spawn_idx=%i,ops_idx=%i,channel_context=%p",
40 gcb, channel, spawn_idx, ops_idx, channel_context);
42 // Search existing channel for a matching spawn_idx
43 udi_channel_t ret = UDI_CreateChannel_Linked(channel, spawn_idx);
45 // Bind local end of channel to ops_idx (with channel_context)
48 udi_index_t region_idx;
49 tUDI_DriverInstance *inst = UDI_int_ChannelGetInstance(gcb, false, ®ion_idx);
50 UDI_BindChannel(ret, false, inst, ops_idx, region_idx, channel_context, false,0);
63 void udi_channel_set_context(
64 udi_channel_t target_channel, void *channel_context
67 LOG("target_channel=%p,channel_context=%p", target_channel, channel_context);
68 UDI_int_ChannelSetContext(target_channel, channel_context);
71 void udi_channel_op_abort(
72 udi_channel_t target_channel, udi_cb_t *orig_cb
75 udi_channel_event_cb_t cb;
76 cb.gcb.channel = target_channel;
77 cb.event = UDI_CHANNEL_CLOSED;
78 cb.params.orig_cb = orig_cb;
79 udi_channel_event_ind(&cb);
82 void udi_channel_close(udi_channel_t channel)
84 Warning("%s Unimplemented", __func__);
87 void udi_channel_event_ind(udi_channel_event_cb_t *cb)
89 LOG("cb=%p{...}", cb);
91 udi_channel_event_ind_op_t *channel_event_ind_op;
92 } *ops = UDI_int_ChannelPrepForCall( UDI_GCB(cb), NULL, 0 );
94 Log_Warning("UDI", "udi_channel_event_ind on wrong channel type");
98 // UDI_int_MakeDeferredCb( UDI_GCB(cb), ops->channel_event_ind_op );
100 UDI_int_ChannelReleaseFromCall( UDI_GCB(cb) );
101 ops->channel_event_ind_op(cb);
104 void udi_channel_event_complete(udi_channel_event_cb_t *cb, udi_status_t status)
106 LOG("cb=%p,status=%i", cb, status);
107 UDI_MA_TransitionState( UDI_GCB(cb)->initiator_context, UDI_MASTATE_PARENTBIND, UDI_MASTATE_ENUMCHILDREN );
108 udi_cb_free( UDI_GCB(cb) );