OLE Developer Guide  Latest Git
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
usb_transport.h
Go to the documentation of this file.
1 /*
2  * This library is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU Lesser General Public
4  * License as published by the Free Software Foundation; either
5  * version 2.1 of the License, or (at your option) any later version.
6  *
7  * This library is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
10  * Lesser General Public License for more details.
11  *
12  * You should have received a copy of the GNU Lesser General Public
13  * License along with this library; if not, write to the Free Software
14  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
15  *
16  * usb_transport.h
17  * Copyright (C) 2015 Simon Newton
18  */
19 
33 #ifndef FIRMWARE_SRC_USB_TRANSPORT_H_
34 #define FIRMWARE_SRC_USB_TRANSPORT_H_
35 
36 #include <stdbool.h>
37 #include <stdint.h>
38 
39 #include "constants.h"
40 #include "transport.h"
41 #include "system_definitions.h"
42 #include "usb/usb_device.h"
43 
44 #ifdef __cplusplus
45 extern "C" {
46 #endif
47 
57 
63 void USBTransport_Tasks();
64 
78 bool USBTransport_SendResponse(uint8_t token, Command command, uint8_t rc,
79  const IOVec* data, unsigned int iov_count);
80 
85 
90 USB_DEVICE_HANDLE USBTransport_GetHandle();
91 
97 
102 
103 #ifdef __cplusplus
104 }
105 #endif
106 
107 #endif // FIRMWARE_SRC_USB_TRANSPORT_H_
108 
The Host <-> Device communication transport.
bool USBTransport_WritePending()
Check if there is a write in progress.
Various constants.
void USBTransport_SoftReset()
Perform a soft reset. This aborts any outbound (write) transfers.
An IOVector, with a pointer to memory and a length attribute.
Definition: iovec.h:35
void USBTransport_Tasks()
Perform the periodic USB layer tasks.
Command
The Ja Rule message commands.
Definition: constants.h:87
USB_DEVICE_HANDLE USBTransport_GetHandle()
Return the USB Device handle.
bool USBTransport_SendResponse(uint8_t token, Command command, uint8_t rc, const IOVec *data, unsigned int iov_count)
Send a response to the Host.
void USBTransport_Initialize(TransportRxFunction rx_cb)
Initialize the USB Transport.
void(* TransportRxFunction)(const uint8_t *, unsigned int)
A function pointer to call when data is received from the host.
Definition: transport.h:65
bool USBTransport_IsConfigured()
Check if the USB driver is configured.