Lcd companion boards support (VKLCD50RTA & VKLCD70RT)

What is this ?

This is a demo program using Renesas RGA library & USB Camera to demonstrate VK-RZ/A1H's companion boards workability.


Supported companion Boards:

VKLCD50RTA

/media/uploads/tvendov/front_view_hmi_50.png /media/uploads/tvendov/side_view_hmi_50.png

VKLCD70RT

/media/uploads/tvendov/front_view_hmi_70.png/media/uploads/tvendov/side_view_hmi_70.png /media/uploads/tvendov/front_view_lvds.png/media/uploads/tvendov/back_view_lvds.png


How to Configure ?

You can choose which display is installed by altering the lcd_panel.h file

Leave the active one & comment out the others:

#define     LCD_VDC5_CH0_PANEL                  LCD_CH0_PANEL_VKLCD50RTA
//#define     LCD_VDC5_CH0_PANEL                  LCD_CH0_PANEL_VKLCD70RT

You can alter the whole demo with your pictures if you like:


How to compile ?

  • The Demo can be compiled in 3 modes:
    • I. Execution from the internal 10-MB on-chip SRAM.
      • After import in the online compiler just leave only the VKRZA1H_RAM.sct & delete all others linker files in the TOOLCHAIN_ARM_STD folder.
      • Save the result binary in the SD Card (<SD>:\vkrza1\lcd_sample ), altering vkrza1h.ini by this way
    • II. Execution from the on-board serial FALSH in dual (32-MB) mode.
      • After import in the online compiler just leave only the VKRZA1H_DOUBLE.sct & delete all others linker files in the TOOLCHAIN_ARM_STD folder.
      • Drag & drop the result binary in MBED disk, (previously inited in double flash mode)
    • III. Execution from the on-board serial FALSH in single (16-MB) mode.
      • After import in the online compiler just leave only the VKRZA1H_SINGLE.sct & delete all others linker files in the TOOLCHAIN_ARM_STD folder.
      • Drag & drop the result binary in MBED disk, (previously inited in single flash mode )

Quick presentation:


Other demos ?

More demos you can find on our FTP

Committer:
tvendov
Date:
Thu Feb 16 10:23:48 2017 +0000
Revision:
0:6435b67ad23c
Initial lcd support (VKLCD50RTA & VKLCD70RT companion boards)

Who changed what in which revision?

UserRevisionLine numberNew contents of line
tvendov 0:6435b67ad23c 1 /* mbed USBHost Library
tvendov 0:6435b67ad23c 2 * Copyright (c) 2006-2013 ARM Limited
tvendov 0:6435b67ad23c 3 *
tvendov 0:6435b67ad23c 4 * Licensed under the Apache License, Version 2.0 (the "License");
tvendov 0:6435b67ad23c 5 * you may not use this file except in compliance with the License.
tvendov 0:6435b67ad23c 6 * You may obtain a copy of the License at
tvendov 0:6435b67ad23c 7 *
tvendov 0:6435b67ad23c 8 * http://www.apache.org/licenses/LICENSE-2.0
tvendov 0:6435b67ad23c 9 *
tvendov 0:6435b67ad23c 10 * Unless required by applicable law or agreed to in writing, software
tvendov 0:6435b67ad23c 11 * distributed under the License is distributed on an "AS IS" BASIS,
tvendov 0:6435b67ad23c 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
tvendov 0:6435b67ad23c 13 * See the License for the specific language governing permissions and
tvendov 0:6435b67ad23c 14 * limitations under the License.
tvendov 0:6435b67ad23c 15 */
tvendov 0:6435b67ad23c 16
tvendov 0:6435b67ad23c 17 #ifndef USBHOST_H
tvendov 0:6435b67ad23c 18 #define USBHOST_H
tvendov 0:6435b67ad23c 19
tvendov 0:6435b67ad23c 20 #include "USBHALHost.h"
tvendov 0:6435b67ad23c 21 #include "USBDeviceConnected.h"
tvendov 0:6435b67ad23c 22 #include "IUSBEnumerator.h"
tvendov 0:6435b67ad23c 23 #include "USBHostConf.h"
tvendov 0:6435b67ad23c 24 #include "rtos.h"
tvendov 0:6435b67ad23c 25 #include "dbg.h"
tvendov 0:6435b67ad23c 26 #include "USBHostHub.h"
tvendov 0:6435b67ad23c 27
tvendov 0:6435b67ad23c 28 /**
tvendov 0:6435b67ad23c 29 * USBHost class
tvendov 0:6435b67ad23c 30 * This class is a singleton. All drivers have a reference on the static USBHost instance
tvendov 0:6435b67ad23c 31 */
tvendov 0:6435b67ad23c 32 class USBHost : public USBHALHost {
tvendov 0:6435b67ad23c 33 public:
tvendov 0:6435b67ad23c 34 /**
tvendov 0:6435b67ad23c 35 * Static method to create or retrieve the single USBHost instance
tvendov 0:6435b67ad23c 36 */
tvendov 0:6435b67ad23c 37 static USBHost * getHostInst();
tvendov 0:6435b67ad23c 38
tvendov 0:6435b67ad23c 39 /**
tvendov 0:6435b67ad23c 40 * Control read: setup stage, data stage and status stage
tvendov 0:6435b67ad23c 41 *
tvendov 0:6435b67ad23c 42 * @param dev the control read will be done for this device
tvendov 0:6435b67ad23c 43 * @param requestType request type
tvendov 0:6435b67ad23c 44 * @param request request
tvendov 0:6435b67ad23c 45 * @param value value
tvendov 0:6435b67ad23c 46 * @param index index
tvendov 0:6435b67ad23c 47 * @param buf pointer on a buffer where will be store the data received
tvendov 0:6435b67ad23c 48 * @param len length of the transfer
tvendov 0:6435b67ad23c 49 *
tvendov 0:6435b67ad23c 50 * @returns status of the control read
tvendov 0:6435b67ad23c 51 */
tvendov 0:6435b67ad23c 52 USB_TYPE controlRead(USBDeviceConnected * dev, uint8_t requestType, uint8_t request, uint32_t value, uint32_t index, uint8_t * buf, uint32_t len);
tvendov 0:6435b67ad23c 53
tvendov 0:6435b67ad23c 54 /**
tvendov 0:6435b67ad23c 55 * Control write: setup stage, data stage and status stage
tvendov 0:6435b67ad23c 56 *
tvendov 0:6435b67ad23c 57 * @param dev the control write will be done for this device
tvendov 0:6435b67ad23c 58 * @param requestType request type
tvendov 0:6435b67ad23c 59 * @param request request
tvendov 0:6435b67ad23c 60 * @param value value
tvendov 0:6435b67ad23c 61 * @param index index
tvendov 0:6435b67ad23c 62 * @param buf pointer on a buffer which will be written
tvendov 0:6435b67ad23c 63 * @param len length of the transfer
tvendov 0:6435b67ad23c 64 *
tvendov 0:6435b67ad23c 65 * @returns status of the control write
tvendov 0:6435b67ad23c 66 */
tvendov 0:6435b67ad23c 67 USB_TYPE controlWrite(USBDeviceConnected * dev, uint8_t requestType, uint8_t request, uint32_t value, uint32_t index, uint8_t * buf, uint32_t len);
tvendov 0:6435b67ad23c 68
tvendov 0:6435b67ad23c 69 /**
tvendov 0:6435b67ad23c 70 * Bulk read
tvendov 0:6435b67ad23c 71 *
tvendov 0:6435b67ad23c 72 * @param dev the bulk transfer will be done for this device
tvendov 0:6435b67ad23c 73 * @param ep USBEndpoint which will be used to read a packet
tvendov 0:6435b67ad23c 74 * @param buf pointer on a buffer where will be store the data received
tvendov 0:6435b67ad23c 75 * @param len length of the transfer
tvendov 0:6435b67ad23c 76 * @param blocking if true, the read is blocking (wait for completion)
tvendov 0:6435b67ad23c 77 *
tvendov 0:6435b67ad23c 78 * @returns status of the bulk read
tvendov 0:6435b67ad23c 79 */
tvendov 0:6435b67ad23c 80 USB_TYPE bulkRead(USBDeviceConnected * dev, USBEndpoint * ep, uint8_t * buf, uint32_t len, bool blocking = true);
tvendov 0:6435b67ad23c 81
tvendov 0:6435b67ad23c 82 /**
tvendov 0:6435b67ad23c 83 * Bulk write
tvendov 0:6435b67ad23c 84 *
tvendov 0:6435b67ad23c 85 * @param dev the bulk transfer will be done for this device
tvendov 0:6435b67ad23c 86 * @param ep USBEndpoint which will be used to write a packet
tvendov 0:6435b67ad23c 87 * @param buf pointer on a buffer which will be written
tvendov 0:6435b67ad23c 88 * @param len length of the transfer
tvendov 0:6435b67ad23c 89 * @param blocking if true, the write is blocking (wait for completion)
tvendov 0:6435b67ad23c 90 *
tvendov 0:6435b67ad23c 91 * @returns status of the bulk write
tvendov 0:6435b67ad23c 92 */
tvendov 0:6435b67ad23c 93 USB_TYPE bulkWrite(USBDeviceConnected * dev, USBEndpoint * ep, uint8_t * buf, uint32_t len, bool blocking = true);
tvendov 0:6435b67ad23c 94
tvendov 0:6435b67ad23c 95 /**
tvendov 0:6435b67ad23c 96 * Interrupt read
tvendov 0:6435b67ad23c 97 *
tvendov 0:6435b67ad23c 98 * @param dev the bulk transfer will be done for this device
tvendov 0:6435b67ad23c 99 * @param ep USBEndpoint which will be used to write a packet
tvendov 0:6435b67ad23c 100 * @param buf pointer on a buffer which will be written
tvendov 0:6435b67ad23c 101 * @param len length of the transfer
tvendov 0:6435b67ad23c 102 * @param blocking if true, the read is blocking (wait for completion)
tvendov 0:6435b67ad23c 103 *
tvendov 0:6435b67ad23c 104 * @returns status of the interrupt read
tvendov 0:6435b67ad23c 105 */
tvendov 0:6435b67ad23c 106 USB_TYPE interruptRead(USBDeviceConnected * dev, USBEndpoint * ep, uint8_t * buf, uint32_t len, bool blocking = true);
tvendov 0:6435b67ad23c 107
tvendov 0:6435b67ad23c 108 /**
tvendov 0:6435b67ad23c 109 * Interrupt write
tvendov 0:6435b67ad23c 110 *
tvendov 0:6435b67ad23c 111 * @param dev the bulk transfer will be done for this device
tvendov 0:6435b67ad23c 112 * @param ep USBEndpoint which will be used to write a packet
tvendov 0:6435b67ad23c 113 * @param buf pointer on a buffer which will be written
tvendov 0:6435b67ad23c 114 * @param len length of the transfer
tvendov 0:6435b67ad23c 115 * @param blocking if true, the write is blocking (wait for completion)
tvendov 0:6435b67ad23c 116 *
tvendov 0:6435b67ad23c 117 * @returns status of the interrupt write
tvendov 0:6435b67ad23c 118 */
tvendov 0:6435b67ad23c 119 USB_TYPE interruptWrite(USBDeviceConnected * dev, USBEndpoint * ep, uint8_t * buf, uint32_t len, bool blocking = true);
tvendov 0:6435b67ad23c 120
tvendov 0:6435b67ad23c 121 /**
tvendov 0:6435b67ad23c 122 * Enumerate a device.
tvendov 0:6435b67ad23c 123 *
tvendov 0:6435b67ad23c 124 * @param dev device which will be enumerated
tvendov 0:6435b67ad23c 125 *
tvendov 0:6435b67ad23c 126 * @returns status of the enumeration
tvendov 0:6435b67ad23c 127 */
tvendov 0:6435b67ad23c 128 USB_TYPE enumerate(USBDeviceConnected * dev, IUSBEnumerator* pEnumerator);
tvendov 0:6435b67ad23c 129 #if(1) /* Isochronous */
tvendov 0:6435b67ad23c 130 inline uint8_t * getConfDescrCurPtr() {
tvendov 0:6435b67ad23c 131 return &data[indexCnfdDescr];
tvendov 0:6435b67ad23c 132 };
tvendov 0:6435b67ad23c 133
tvendov 0:6435b67ad23c 134 inline uint16_t getConfDescrRestLen() {
tvendov 0:6435b67ad23c 135 return lenCnfdDescr - indexCnfdDescr;
tvendov 0:6435b67ad23c 136 };
tvendov 0:6435b67ad23c 137 #endif
tvendov 0:6435b67ad23c 138
tvendov 0:6435b67ad23c 139 /**
tvendov 0:6435b67ad23c 140 * reset a specific device
tvendov 0:6435b67ad23c 141 *
tvendov 0:6435b67ad23c 142 * @param dev device which will be resetted
tvendov 0:6435b67ad23c 143 */
tvendov 0:6435b67ad23c 144 USB_TYPE resetDevice(USBDeviceConnected * dev);
tvendov 0:6435b67ad23c 145
tvendov 0:6435b67ad23c 146 /**
tvendov 0:6435b67ad23c 147 * Get a device
tvendov 0:6435b67ad23c 148 *
tvendov 0:6435b67ad23c 149 * @param index index of the device which will be returned
tvendov 0:6435b67ad23c 150 *
tvendov 0:6435b67ad23c 151 * @returns pointer on the "index" device
tvendov 0:6435b67ad23c 152 */
tvendov 0:6435b67ad23c 153 USBDeviceConnected * getDevice(uint8_t index);
tvendov 0:6435b67ad23c 154
tvendov 0:6435b67ad23c 155 /*
tvendov 0:6435b67ad23c 156 * If there is a HID device connected, the host stores the length of the report descriptor.
tvendov 0:6435b67ad23c 157 * This avoid to the driver to re-ask the configuration descriptor to request the report descriptor
tvendov 0:6435b67ad23c 158 *
tvendov 0:6435b67ad23c 159 * @returns length of the report descriptor
tvendov 0:6435b67ad23c 160 */
tvendov 0:6435b67ad23c 161 inline uint16_t getLengthReportDescr() {
tvendov 0:6435b67ad23c 162 return lenReportDescr;
tvendov 0:6435b67ad23c 163 };
tvendov 0:6435b67ad23c 164
tvendov 0:6435b67ad23c 165 /**
tvendov 0:6435b67ad23c 166 * register a driver into the host associated with a callback function called when the device is disconnected
tvendov 0:6435b67ad23c 167 *
tvendov 0:6435b67ad23c 168 * @param dev device
tvendov 0:6435b67ad23c 169 * @param intf interface number
tvendov 0:6435b67ad23c 170 * @param tptr pointer to the object to call the member function on
tvendov 0:6435b67ad23c 171 * @param mptr pointer to the member function to be called
tvendov 0:6435b67ad23c 172 */
tvendov 0:6435b67ad23c 173 template<typename T>
tvendov 0:6435b67ad23c 174 inline void registerDriver(USBDeviceConnected * dev, uint8_t intf, T* tptr, void (T::*mptr)(void)) {
tvendov 0:6435b67ad23c 175 int index = findDevice(dev);
tvendov 0:6435b67ad23c 176 if ((index != -1) && (mptr != NULL) && (tptr != NULL)) {
tvendov 0:6435b67ad23c 177 USB_DBG("register driver for dev: %p on intf: %d", dev, intf);
tvendov 0:6435b67ad23c 178 deviceAttachedDriver[index][intf] = true;
tvendov 0:6435b67ad23c 179 dev->onDisconnect(intf, tptr, mptr);
tvendov 0:6435b67ad23c 180 }
tvendov 0:6435b67ad23c 181 }
tvendov 0:6435b67ad23c 182
tvendov 0:6435b67ad23c 183 /**
tvendov 0:6435b67ad23c 184 * register a driver into the host associated with a callback function called when the device is disconnected
tvendov 0:6435b67ad23c 185 *
tvendov 0:6435b67ad23c 186 * @param dev device
tvendov 0:6435b67ad23c 187 * @param intf interface number
tvendov 0:6435b67ad23c 188 * @param fn callback called when the specified device has been disconnected
tvendov 0:6435b67ad23c 189 */
tvendov 0:6435b67ad23c 190 inline void registerDriver(USBDeviceConnected * dev, uint8_t intf, void (*fn)(void)) {
tvendov 0:6435b67ad23c 191 int index = findDevice(dev);
tvendov 0:6435b67ad23c 192 if ((index != -1) && (fn != NULL)) {
tvendov 0:6435b67ad23c 193 USB_DBG("register driver for dev: %p on intf: %d", dev, intf);
tvendov 0:6435b67ad23c 194 deviceAttachedDriver[index][intf] = true;
tvendov 0:6435b67ad23c 195 dev->onDisconnect(intf, fn);
tvendov 0:6435b67ad23c 196 }
tvendov 0:6435b67ad23c 197 }
tvendov 0:6435b67ad23c 198
tvendov 0:6435b67ad23c 199 /**
tvendov 0:6435b67ad23c 200 * Instantiate to protect USB thread from accessing shared objects (USBConnectedDevices and Interfaces)
tvendov 0:6435b67ad23c 201 */
tvendov 0:6435b67ad23c 202 class Lock
tvendov 0:6435b67ad23c 203 {
tvendov 0:6435b67ad23c 204 public:
tvendov 0:6435b67ad23c 205 Lock(USBHost* pHost);
tvendov 0:6435b67ad23c 206 ~Lock();
tvendov 0:6435b67ad23c 207 private:
tvendov 0:6435b67ad23c 208 USBHost* m_pHost;
tvendov 0:6435b67ad23c 209 };
tvendov 0:6435b67ad23c 210
tvendov 0:6435b67ad23c 211 friend class USBHostHub;
tvendov 0:6435b67ad23c 212 bool plug_status;
tvendov 0:6435b67ad23c 213
tvendov 0:6435b67ad23c 214 protected:
tvendov 0:6435b67ad23c 215
tvendov 0:6435b67ad23c 216 /**
tvendov 0:6435b67ad23c 217 * Virtual method called when a transfer has been completed
tvendov 0:6435b67ad23c 218 *
tvendov 0:6435b67ad23c 219 * @param addr list of the TDs which have been completed
tvendov 0:6435b67ad23c 220 */
tvendov 0:6435b67ad23c 221 virtual void transferCompleted(volatile uint32_t addr);
tvendov 0:6435b67ad23c 222
tvendov 0:6435b67ad23c 223 /**
tvendov 0:6435b67ad23c 224 * Virtual method called when a device has been connected
tvendov 0:6435b67ad23c 225 *
tvendov 0:6435b67ad23c 226 * @param hub hub number of the device
tvendov 0:6435b67ad23c 227 * @param port port number of the device
tvendov 0:6435b67ad23c 228 * @param lowSpeed 1 if low speed, 0 otherwise
tvendov 0:6435b67ad23c 229 * @param hub_parent reference on the parent hub
tvendov 0:6435b67ad23c 230 */
tvendov 0:6435b67ad23c 231 virtual void deviceConnected(int hub, int port, bool lowSpeed, USBHostHub * hub_parent = NULL);
tvendov 0:6435b67ad23c 232
tvendov 0:6435b67ad23c 233 /**
tvendov 0:6435b67ad23c 234 * Virtuel method called when a device has been disconnected
tvendov 0:6435b67ad23c 235 *
tvendov 0:6435b67ad23c 236 * @param hub hub number of the device
tvendov 0:6435b67ad23c 237 * @param port port number of the device
tvendov 0:6435b67ad23c 238 * @param addr list of the TDs which have been completed to dequeue freed TDs
tvendov 0:6435b67ad23c 239 */
tvendov 0:6435b67ad23c 240 virtual void deviceDisconnected(int hub, int port, USBHostHub * hub_parent, volatile uint32_t addr);
tvendov 0:6435b67ad23c 241
tvendov 0:6435b67ad23c 242
tvendov 0:6435b67ad23c 243 private:
tvendov 0:6435b67ad23c 244 // singleton class -> constructor is private
tvendov 0:6435b67ad23c 245 USBHost();
tvendov 0:6435b67ad23c 246 static USBHost * instHost;
tvendov 0:6435b67ad23c 247 uint16_t lenReportDescr;
tvendov 0:6435b67ad23c 248 #if(1) /* Isochronous */
tvendov 0:6435b67ad23c 249 uint16_t lenCnfdDescr;
tvendov 0:6435b67ad23c 250 uint16_t indexCnfdDescr;
tvendov 0:6435b67ad23c 251 #endif
tvendov 0:6435b67ad23c 252
tvendov 0:6435b67ad23c 253 // endpoints
tvendov 0:6435b67ad23c 254 void unqueueEndpoint(USBEndpoint * ep) ;
tvendov 0:6435b67ad23c 255 USBEndpoint endpoints[MAX_ENDPOINT];
tvendov 0:6435b67ad23c 256 USBEndpoint* volatile control;
tvendov 0:6435b67ad23c 257
tvendov 0:6435b67ad23c 258 USBEndpoint* volatile headControlEndpoint;
tvendov 0:6435b67ad23c 259 USBEndpoint* volatile headBulkEndpoint;
tvendov 0:6435b67ad23c 260 USBEndpoint* volatile headInterruptEndpoint;
tvendov 0:6435b67ad23c 261
tvendov 0:6435b67ad23c 262 USBEndpoint* volatile tailControlEndpoint;
tvendov 0:6435b67ad23c 263 USBEndpoint* volatile tailBulkEndpoint;
tvendov 0:6435b67ad23c 264 USBEndpoint* volatile tailInterruptEndpoint;
tvendov 0:6435b67ad23c 265
tvendov 0:6435b67ad23c 266 bool controlEndpointAllocated;
tvendov 0:6435b67ad23c 267
tvendov 0:6435b67ad23c 268 // devices connected
tvendov 0:6435b67ad23c 269 USBDeviceConnected devices[MAX_DEVICE_CONNECTED];
tvendov 0:6435b67ad23c 270 bool deviceInUse[MAX_DEVICE_CONNECTED];
tvendov 0:6435b67ad23c 271 bool deviceAttachedDriver[MAX_DEVICE_CONNECTED][MAX_INTF];
tvendov 0:6435b67ad23c 272 bool deviceReset[MAX_DEVICE_CONNECTED];
tvendov 0:6435b67ad23c 273 bool deviceInited[MAX_DEVICE_CONNECTED];
tvendov 0:6435b67ad23c 274
tvendov 0:6435b67ad23c 275 #if MAX_HUB_NB
tvendov 0:6435b67ad23c 276 USBHostHub hubs[MAX_HUB_NB];
tvendov 0:6435b67ad23c 277 bool hub_in_use[MAX_HUB_NB];
tvendov 0:6435b67ad23c 278 #endif
tvendov 0:6435b67ad23c 279
tvendov 0:6435b67ad23c 280 // to store a setup packet
tvendov 0:6435b67ad23c 281 uint8_t setupPacket[8];
tvendov 0:6435b67ad23c 282
tvendov 0:6435b67ad23c 283 typedef struct {
tvendov 0:6435b67ad23c 284 uint8_t event_id;
tvendov 0:6435b67ad23c 285 void * td_addr;
tvendov 0:6435b67ad23c 286 uint8_t hub;
tvendov 0:6435b67ad23c 287 uint8_t port;
tvendov 0:6435b67ad23c 288 uint8_t lowSpeed;
tvendov 0:6435b67ad23c 289 uint8_t td_state;
tvendov 0:6435b67ad23c 290 void * hub_parent;
tvendov 0:6435b67ad23c 291 } message_t;
tvendov 0:6435b67ad23c 292
tvendov 0:6435b67ad23c 293 Thread usbThread;
tvendov 0:6435b67ad23c 294 void usb_process();
tvendov 0:6435b67ad23c 295 static void usb_process_static(void const * arg);
tvendov 0:6435b67ad23c 296 Mail<message_t, 10> mail_usb_event;
tvendov 0:6435b67ad23c 297 Mutex usb_mutex;
tvendov 0:6435b67ad23c 298 Mutex td_mutex;
tvendov 0:6435b67ad23c 299
tvendov 0:6435b67ad23c 300 // buffer for conf descriptor
tvendov 0:6435b67ad23c 301 #if(1) /* Isochronous */
tvendov 0:6435b67ad23c 302 uint8_t data[1024];
tvendov 0:6435b67ad23c 303 #else
tvendov 0:6435b67ad23c 304 uint8_t data[415];
tvendov 0:6435b67ad23c 305 #endif
tvendov 0:6435b67ad23c 306
tvendov 0:6435b67ad23c 307 /**
tvendov 0:6435b67ad23c 308 * Add a transfer on the TD linked list associated to an ED
tvendov 0:6435b67ad23c 309 *
tvendov 0:6435b67ad23c 310 * @param ed the transfer is associated to this ed
tvendov 0:6435b67ad23c 311 * @param buf pointer on a buffer where will be read/write data to send or receive
tvendov 0:6435b67ad23c 312 * @param len transfer length
tvendov 0:6435b67ad23c 313 *
tvendov 0:6435b67ad23c 314 * @return status of the transfer
tvendov 0:6435b67ad23c 315 */
tvendov 0:6435b67ad23c 316 USB_TYPE addTransfer(USBEndpoint * ed, uint8_t * buf, uint32_t len) ;
tvendov 0:6435b67ad23c 317
tvendov 0:6435b67ad23c 318 /**
tvendov 0:6435b67ad23c 319 * Link the USBEndpoint to the linked list and attach an USBEndpoint this USBEndpoint to a device
tvendov 0:6435b67ad23c 320 *
tvendov 0:6435b67ad23c 321 * @param dev pointer on a USBDeviceConnected object
tvendov 0:6435b67ad23c 322 * @param ep pointer on the USBEndpoint which will be added
tvendov 0:6435b67ad23c 323 *
tvendov 0:6435b67ad23c 324 * return true if successful
tvendov 0:6435b67ad23c 325 */
tvendov 0:6435b67ad23c 326 bool addEndpoint(USBDeviceConnected * dev, uint8_t intf_nb, USBEndpoint * ep) ;
tvendov 0:6435b67ad23c 327
tvendov 0:6435b67ad23c 328 /**
tvendov 0:6435b67ad23c 329 * Create an USBEndpoint descriptor. Warning: the USBEndpoint is not linked.
tvendov 0:6435b67ad23c 330 *
tvendov 0:6435b67ad23c 331 * @param type USBEndpoint type (CONTROL_ENDPOINT, BULK_ENDPOINT, INTERRUPT_ENDPOINT)
tvendov 0:6435b67ad23c 332 * @param dir USBEndpoint direction (no meaning for CONTROL_ENDPOINT)
tvendov 0:6435b67ad23c 333 * @param size USBEndpoint max packet size
tvendov 0:6435b67ad23c 334 * @param addr USBEndpoint address
tvendov 0:6435b67ad23c 335 *
tvendov 0:6435b67ad23c 336 * @returns pointer on the USBEndpoint created
tvendov 0:6435b67ad23c 337 */
tvendov 0:6435b67ad23c 338 USBEndpoint * newEndpoint(ENDPOINT_TYPE type, ENDPOINT_DIRECTION dir, uint32_t size, uint8_t addr) ;
tvendov 0:6435b67ad23c 339
tvendov 0:6435b67ad23c 340 /**
tvendov 0:6435b67ad23c 341 * Request the device descriptor
tvendov 0:6435b67ad23c 342 *
tvendov 0:6435b67ad23c 343 * @param dev request the device descriptor on this device
tvendov 0:6435b67ad23c 344 * @param buf buffer to store the device descriptor
tvendov 0:6435b67ad23c 345 * @param max_len_buf maximum size of buf
tvendov 0:6435b67ad23c 346 * @param len_dev_descr pointer to store the length of the packet transferred
tvendov 0:6435b67ad23c 347 */
tvendov 0:6435b67ad23c 348 USB_TYPE getDeviceDescriptor(USBDeviceConnected * dev, uint8_t * buf, uint16_t max_len_buf, uint16_t * len_dev_descr = NULL);
tvendov 0:6435b67ad23c 349
tvendov 0:6435b67ad23c 350 /**
tvendov 0:6435b67ad23c 351 * Request the configuration descriptor
tvendov 0:6435b67ad23c 352 *
tvendov 0:6435b67ad23c 353 * @param dev request the configuration descriptor on this device
tvendov 0:6435b67ad23c 354 * @param buf buffer to store the configuration descriptor
tvendov 0:6435b67ad23c 355 * @param max_len_buf maximum size of buf
tvendov 0:6435b67ad23c 356 * @param len_conf_descr pointer to store the length of the packet transferred
tvendov 0:6435b67ad23c 357 */
tvendov 0:6435b67ad23c 358 USB_TYPE getConfigurationDescriptor(USBDeviceConnected * dev, uint8_t * buf, uint16_t max_len_buf, uint16_t * len_conf_descr = NULL);
tvendov 0:6435b67ad23c 359
tvendov 0:6435b67ad23c 360 /**
tvendov 0:6435b67ad23c 361 * Set the address of a specific device
tvendov 0:6435b67ad23c 362 *
tvendov 0:6435b67ad23c 363 * @param dev device to set the address
tvendov 0:6435b67ad23c 364 * @param address address
tvendov 0:6435b67ad23c 365 */
tvendov 0:6435b67ad23c 366 USB_TYPE setAddress(USBDeviceConnected * dev, uint8_t address);
tvendov 0:6435b67ad23c 367
tvendov 0:6435b67ad23c 368 /**
tvendov 0:6435b67ad23c 369 * Set the configuration of a device
tvendov 0:6435b67ad23c 370 *
tvendov 0:6435b67ad23c 371 * @param dev device on which the specified configuration will be activated
tvendov 0:6435b67ad23c 372 * @param conf configuration number to activate (usually 1)
tvendov 0:6435b67ad23c 373 */
tvendov 0:6435b67ad23c 374 USB_TYPE setConfiguration(USBDeviceConnected * dev, uint8_t conf);
tvendov 0:6435b67ad23c 375
tvendov 0:6435b67ad23c 376 /**
tvendov 0:6435b67ad23c 377 * Free a specific device
tvendov 0:6435b67ad23c 378 *
tvendov 0:6435b67ad23c 379 * @param dev device to be freed
tvendov 0:6435b67ad23c 380 */
tvendov 0:6435b67ad23c 381 void freeDevice(USBDeviceConnected * dev);
tvendov 0:6435b67ad23c 382
tvendov 0:6435b67ad23c 383 USB_TYPE controlTransfer( USBDeviceConnected * dev,
tvendov 0:6435b67ad23c 384 uint8_t requestType,
tvendov 0:6435b67ad23c 385 uint8_t request,
tvendov 0:6435b67ad23c 386 uint32_t value,
tvendov 0:6435b67ad23c 387 uint32_t index,
tvendov 0:6435b67ad23c 388 uint8_t * buf,
tvendov 0:6435b67ad23c 389 uint32_t len,
tvendov 0:6435b67ad23c 390 bool write);
tvendov 0:6435b67ad23c 391
tvendov 0:6435b67ad23c 392 USB_TYPE generalTransfer( USBDeviceConnected * dev,
tvendov 0:6435b67ad23c 393 USBEndpoint * ep,
tvendov 0:6435b67ad23c 394 uint8_t * buf,
tvendov 0:6435b67ad23c 395 uint32_t len,
tvendov 0:6435b67ad23c 396 bool blocking,
tvendov 0:6435b67ad23c 397 ENDPOINT_TYPE type,
tvendov 0:6435b67ad23c 398 bool write) ;
tvendov 0:6435b67ad23c 399
tvendov 0:6435b67ad23c 400 void fillControlBuf(uint8_t requestType, uint8_t request, uint16_t value, uint16_t index, int len) ;
tvendov 0:6435b67ad23c 401 void parseConfDescr(USBDeviceConnected * dev, uint8_t * conf_descr, uint32_t len, IUSBEnumerator* pEnumerator) ;
tvendov 0:6435b67ad23c 402 int findDevice(USBDeviceConnected * dev) ;
tvendov 0:6435b67ad23c 403 int findDevice(uint8_t hub, uint8_t port, USBHostHub * hub_parent = NULL) ;
tvendov 0:6435b67ad23c 404 uint8_t numberDriverAttached(USBDeviceConnected * dev);
tvendov 0:6435b67ad23c 405
tvendov 0:6435b67ad23c 406 /////////////////////////
tvendov 0:6435b67ad23c 407 /// FOR DEBUG
tvendov 0:6435b67ad23c 408 /////////////////////////
tvendov 0:6435b67ad23c 409 void printList(ENDPOINT_TYPE type);
tvendov 0:6435b67ad23c 410
tvendov 0:6435b67ad23c 411 };
tvendov 0:6435b67ad23c 412
tvendov 0:6435b67ad23c 413 #endif