Go to the documentation of this file.
18#ifndef __VSF_USBD_DRV_IFS_H__
19#define __VSF_USBD_DRV_IFS_H__
28#if defined(VSF_USBD_CFG_DRV_LV0_OO)
30# undef VSF_USBD_DRV_PREPARE
31# define VSF_USBD_DRV_PREPARE(__dev)
33# define vk_usbd_drv_func_name(__header, __func) VSF_MCONNECT3(__header, _, __func)
36# define vk_usbd_drv_init(__cfg) \
37 vk_usbd_drv_func_name(VSF_USBD_CFG_DRV_LV0_OO_PREFIX, init) \
38 (&VSF_USBD_CFG_DRV_LV0_OO_OBJ, (__cfg))
40# define vk_usbd_drv_fini() \
41 vk_usbd_drv_func_name(VSF_USBD_CFG_DRV_LV0_OO_PREFIX, fini) \
42 (&VSF_USBD_CFG_DRV_LV0_OO_OBJ)
44# define vk_usbd_drv_reset(__cfg) \
45 vk_usbd_drv_func_name(VSF_USBD_CFG_DRV_LV0_OO_PREFIX, reset) \
46 (&VSF_USBD_CFG_DRV_LV0_OO_OBJ, (__cfg))
48# define vk_usbd_drv_connect() \
49 vk_usbd_drv_func_name(VSF_USBD_CFG_DRV_LV0_OO_PREFIX, connect) \
50 (&VSF_USBD_CFG_DRV_LV0_OO_OBJ)
52# define vk_usbd_drv_disconnect() \
53 vk_usbd_drv_func_name(VSF_USBD_CFG_DRV_LV0_OO_PREFIX, disconnect) \
54 (&VSF_USBD_CFG_DRV_LV0_OO_OBJ)
56# define vk_usbd_drv_wakeup() \
57 vk_usbd_drv_func_name(VSF_USBD_CFG_DRV_LV0_OO_PREFIX, wakeup) \
58 (&VSF_USBD_CFG_DRV_LV0_OO_OBJ)
60# define vk_usbd_drv_set_address(__addr) \
61 vk_usbd_drv_func_name(VSF_USBD_CFG_DRV_LV0_OO_PREFIX, set_address) \
62 (&VSF_USBD_CFG_DRV_LV0_OO_OBJ, (__addr))
64# define vk_usbd_drv_get_setup(__request) \
65 vk_usbd_drv_func_name(VSF_USBD_CFG_DRV_LV0_OO_PREFIX, get_setup) \
66 (&VSF_USBD_CFG_DRV_LV0_OO_OBJ, (uint8_t *)(__request))
68# define vk_usbd_drv_status_stage(__is_in) \
69 vk_usbd_drv_func_name(VSF_USBD_CFG_DRV_LV0_OO_PREFIX, status_stage) \
70 (&VSF_USBD_CFG_DRV_LV0_OO_OBJ, (__is_in))
72# define vk_usbd_drv_ep_add(__addr, __attr, __size) \
73 vk_usbd_drv_func_name(VSF_USBD_CFG_DRV_LV0_OO_PREFIX, ep_add) \
74 (&VSF_USBD_CFG_DRV_LV0_OO_OBJ, (__addr), (usb_ep_type_t)(__attr), (__size))
76# define vk_usbd_drv_ep_get_feature(__ep, __feature) \
77 vk_usbd_drv_func_name(VSF_USBD_CFG_DRV_LV0_OO_PREFIX, ep_get_feature) \
78 (&VSF_USBD_CFG_DRV_LV0_OO_OBJ, (__ep), (__feature))
80# define vk_usbd_drv_ep_get_size(__ep) \
81 vk_usbd_drv_func_name(VSF_USBD_CFG_DRV_LV0_OO_PREFIX, ep_get_size) \
82 (&VSF_USBD_CFG_DRV_LV0_OO_OBJ, (__ep))
84# define vk_usbd_drv_ep_is_stalled(__ep) \
85 vk_usbd_drv_func_name(VSF_USBD_CFG_DRV_LV0_OO_PREFIX, ep_is_stalled) \
86 (&VSF_USBD_CFG_DRV_LV0_OO_OBJ, (__ep))
88# define vk_usbd_drv_ep_set_stall(__ep) \
89 vk_usbd_drv_func_name(VSF_USBD_CFG_DRV_LV0_OO_PREFIX, ep_set_stall) \
90 (&VSF_USBD_CFG_DRV_LV0_OO_OBJ, (__ep))
92# define vk_usbd_drv_ep_clear_stall(__ep) \
93 vk_usbd_drv_func_name(VSF_USBD_CFG_DRV_LV0_OO_PREFIX, ep_clear_stall) \
94 (&VSF_USBD_CFG_DRV_LV0_OO_OBJ, (__ep))
96# define vk_usbd_drv_ep_get_data_size(__ep) \
97 vk_usbd_drv_func_name(VSF_USBD_CFG_DRV_LV0_OO_PREFIX, ep_get_data_size) \
98 (&VSF_USBD_CFG_DRV_LV0_OO_OBJ, (__ep))
100# define vk_usbd_drv_ep_transaction_read_buffer(__ep, __buf, __size) \
101 vk_usbd_drv_func_name(VSF_USBD_CFG_DRV_LV0_OO_PREFIX, ep_transaction_read_buffer) \
102 (&VSF_USBD_CFG_DRV_LV0_OO_OBJ, (__ep), (__buf), (__size))
104# define vk_usbd_drv_ep_transaction_write_buffer(__ep, __buf, __size) \
105 vk_usbd_drv_func_name(VSF_USBD_CFG_DRV_LV0_OO_PREFIX, ep_transaction_write_buffer)\
106 (&VSF_USBD_CFG_DRV_LV0_OO_OBJ, (__ep), (__buf), (__size))
108# define vk_usbd_drv_ep_transaction_set_data_size(__ep, __size) \
109 vk_usbd_drv_func_name(VSF_USBD_CFG_DRV_LV0_OO_PREFIX, ep_transaction_set_data_size)\
110 (&VSF_USBD_CFG_DRV_LV0_OO_OBJ, (__ep), (__size))
112# define vk_usbd_drv_ep_transaction_enable_out(__ep) \
113 vk_usbd_drv_func_name(VSF_USBD_CFG_DRV_LV0_OO_PREFIX, ep_transaction_enable_out)\
114 (&VSF_USBD_CFG_DRV_LV0_OO_OBJ, (__ep))
116# define vk_usbd_drv_ep_transfer_send(__ep, __buf, __size, __zlp) \
117 vk_usbd_drv_func_name(VSF_USBD_CFG_DRV_LV0_OO_PREFIX, ep_transfer_send) \
118 (&VSF_USBD_CFG_DRV_LV0_OO_OBJ, (__ep), (__buf), (__size), (__zlp))
120# define vk_usbd_drv_ep_transfer_recv(__ep, __buf, __size) \
121 vk_usbd_drv_func_name(VSF_USBD_CFG_DRV_LV0_OO_PREFIX, ep_transfer_recv) \
122 (&VSF_USBD_CFG_DRV_LV0_OO_OBJ, (__ep), (__buf), (__size))
126# undef VSF_USBD_DRV_PREPARE
127# define VSF_USBD_DRV_PREPARE(__dev) const i_usb_dc_t *__drv = (__dev)->drv;
129# define vk_usbd_drv_init(__cfg) __drv->Init((__cfg))
130# define vk_usbd_drv_fini() __drv->Fini()
131# define vk_usbd_drv_reset(__cfg) __drv->Reset((__cfg))
132# define vk_usbd_drv_connect() __drv->Connect()
133# define vk_usbd_drv_disconnect() __drv->Disconnect()
134# define vk_usbd_drv_wakeup() __drv->Wakeup()
135# define vk_usbd_drv_set_address(__addr) __drv->SetAddress((__addr))
136# define vk_usbd_drv_get_setup(__request) __drv->GetSetup((uint8_t *)(__request))
137# define vk_usbd_drv_status_stage(__is_in) __drv->StatusStage((__is_in))
138# define vk_usbd_drv_ep_add(__addr, __attr, __size) __drv->Ep.Add((__addr), (usb_ep_type_t)(__attr), (__size))
140# define vk_usbd_drv_ep_get_feature(__ep, __feature) __drv->Ep.GetFeature((__ep), (__feature))
141# define vk_usbd_drv_ep_get_size(__ep) __drv->Ep.GetSize((__ep))
142# define vk_usbd_drv_ep_is_stalled(__ep) __drv->Ep.IsStalled((__ep))
143# define vk_usbd_drv_ep_set_stall(__ep) __drv->Ep.SetStall((__ep))
144# define vk_usbd_drv_ep_clear_stall(__ep) __drv->Ep.ClearStall((__ep))
145# define vk_usbd_drv_ep_get_data_size(__ep) __drv->Ep.GetDataSize((__ep))
146# define vk_usbd_drv_ep_transaction_read_buffer(__ep, __buf, __size) \
147 __drv->Ep.Transaction.ReadBuffer((__ep), (__buf), (__size))
148# define vk_usbd_drv_ep_transaction_write_buffer(__ep, __buf, __size) \
149 __drv->Ep.Transaction.WriteBuffer((__ep), (__buf), (__size))
150# define vk_usbd_drv_ep_transaction_set_data_size(__ep, __size) \
151 __drv->Ep.Transaction.SetDataSize((__ep), (__size))
152# define vk_usbd_drv_ep_transaction_enable_out(__ep) \
153 __drv->Ep.Transaction.EnableOut((__ep))
154# define vk_usbd_drv_ep_transfer_send(__ep, __buf, __size, __zlp) \
155 __drv->Ep.Transfer.Send((__ep), (__buf), (__size), (__zlp))
156# define vk_usbd_drv_ep_transfer_recv(__ep, __buf, __size) \
157 __drv->Ep.Transfer.Recv((__ep), (__buf), (__size))