+static void nulink2_usb_init_buffer(void *handle, uint32_t size)
+{
+ struct nulink_usb_handle_s *h = handle;
+
+ h->cmdidx = 0;
+
+ memset(h->cmdbuf, 0, h->max_packet_size + 1);
+ memset(h->tempbuf, 0, h->max_packet_size);
+ memset(h->databuf, 0, h->max_packet_size);
+
+ h->cmdbuf[0] = 0; /* report number */
+ h->cmdbuf[1] = ++h->usbcmdidx & 0x7F;
+ h_u16_to_le(h->cmdbuf + 2, size);
+ h->cmdidx += 4;
+}
+
+static inline int nulink_usb_xfer(void *handle, uint8_t *buf, int size)
+{
+ struct nulink_usb_handle_s *h = handle;
+
+ assert(handle);
+
+ return h->xfer(handle, buf, size);
+}
+
+static inline void nulink_usb_init_buffer(void *handle, uint32_t size)
+{
+ struct nulink_usb_handle_s *h = handle;
+
+ assert(handle);
+
+ h->init_buffer(handle, size);
+}
+