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
VKLCD70RT
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.
- 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
USB/USBHost/USBEndpoint.h@0:6435b67ad23c, 2017-02-16 (annotated)
- 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?
User | Revision | Line number | New 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 USBENDPOINT_H |
tvendov | 0:6435b67ad23c | 18 | #define USBENDPOINT_H |
tvendov | 0:6435b67ad23c | 19 | |
tvendov | 0:6435b67ad23c | 20 | #include "FunctionPointer.h" |
tvendov | 0:6435b67ad23c | 21 | #include "USBHostTypes.h" |
tvendov | 0:6435b67ad23c | 22 | #include "rtos.h" |
tvendov | 0:6435b67ad23c | 23 | |
tvendov | 0:6435b67ad23c | 24 | class USBDeviceConnected; |
tvendov | 0:6435b67ad23c | 25 | |
tvendov | 0:6435b67ad23c | 26 | /** |
tvendov | 0:6435b67ad23c | 27 | * USBEndpoint class |
tvendov | 0:6435b67ad23c | 28 | */ |
tvendov | 0:6435b67ad23c | 29 | class USBEndpoint |
tvendov | 0:6435b67ad23c | 30 | { |
tvendov | 0:6435b67ad23c | 31 | public: |
tvendov | 0:6435b67ad23c | 32 | /** |
tvendov | 0:6435b67ad23c | 33 | * Constructor |
tvendov | 0:6435b67ad23c | 34 | */ |
tvendov | 0:6435b67ad23c | 35 | USBEndpoint() { |
tvendov | 0:6435b67ad23c | 36 | state = USB_TYPE_FREE; |
tvendov | 0:6435b67ad23c | 37 | nextEp = NULL; |
tvendov | 0:6435b67ad23c | 38 | }; |
tvendov | 0:6435b67ad23c | 39 | |
tvendov | 0:6435b67ad23c | 40 | /** |
tvendov | 0:6435b67ad23c | 41 | * Initialize an endpoint |
tvendov | 0:6435b67ad23c | 42 | * |
tvendov | 0:6435b67ad23c | 43 | * @param hced hced associated to the endpoint |
tvendov | 0:6435b67ad23c | 44 | * @param type endpoint type |
tvendov | 0:6435b67ad23c | 45 | * @param dir endpoint direction |
tvendov | 0:6435b67ad23c | 46 | * @param size endpoint size |
tvendov | 0:6435b67ad23c | 47 | * @param ep_number endpoint number |
tvendov | 0:6435b67ad23c | 48 | * @param td_list array of two allocated transfer descriptors |
tvendov | 0:6435b67ad23c | 49 | */ |
tvendov | 0:6435b67ad23c | 50 | void init(HCED * hced, ENDPOINT_TYPE type, ENDPOINT_DIRECTION dir, uint32_t size, uint8_t ep_number, HCTD* td_list[2]); |
tvendov | 0:6435b67ad23c | 51 | |
tvendov | 0:6435b67ad23c | 52 | /** |
tvendov | 0:6435b67ad23c | 53 | * Set next token. Warning: only useful for the control endpoint |
tvendov | 0:6435b67ad23c | 54 | * |
tvendov | 0:6435b67ad23c | 55 | * @param token IN, OUT or SETUP token |
tvendov | 0:6435b67ad23c | 56 | */ |
tvendov | 0:6435b67ad23c | 57 | void setNextToken(uint32_t token); |
tvendov | 0:6435b67ad23c | 58 | |
tvendov | 0:6435b67ad23c | 59 | /** |
tvendov | 0:6435b67ad23c | 60 | * Queue an endpoint |
tvendov | 0:6435b67ad23c | 61 | * |
tvendov | 0:6435b67ad23c | 62 | * @param endpoint endpoint which will be queued in the linked list |
tvendov | 0:6435b67ad23c | 63 | */ |
tvendov | 0:6435b67ad23c | 64 | void queueEndpoint(USBEndpoint * endpoint); |
tvendov | 0:6435b67ad23c | 65 | |
tvendov | 0:6435b67ad23c | 66 | |
tvendov | 0:6435b67ad23c | 67 | /** |
tvendov | 0:6435b67ad23c | 68 | * Queue a transfer on the endpoint |
tvendov | 0:6435b67ad23c | 69 | */ |
tvendov | 0:6435b67ad23c | 70 | void queueTransfer(); |
tvendov | 0:6435b67ad23c | 71 | |
tvendov | 0:6435b67ad23c | 72 | /** |
tvendov | 0:6435b67ad23c | 73 | * Unqueue a transfer from the endpoint |
tvendov | 0:6435b67ad23c | 74 | * |
tvendov | 0:6435b67ad23c | 75 | * @param td hctd which will be unqueued |
tvendov | 0:6435b67ad23c | 76 | */ |
tvendov | 0:6435b67ad23c | 77 | void unqueueTransfer(volatile HCTD * td); |
tvendov | 0:6435b67ad23c | 78 | |
tvendov | 0:6435b67ad23c | 79 | /** |
tvendov | 0:6435b67ad23c | 80 | * Attach a member function to call when a transfer is finished |
tvendov | 0:6435b67ad23c | 81 | * |
tvendov | 0:6435b67ad23c | 82 | * @param tptr pointer to the object to call the member function on |
tvendov | 0:6435b67ad23c | 83 | * @param mptr pointer to the member function to be called |
tvendov | 0:6435b67ad23c | 84 | */ |
tvendov | 0:6435b67ad23c | 85 | template<typename T> |
tvendov | 0:6435b67ad23c | 86 | inline void attach(T* tptr, void (T::*mptr)(void)) { |
tvendov | 0:6435b67ad23c | 87 | if((mptr != NULL) && (tptr != NULL)) { |
tvendov | 0:6435b67ad23c | 88 | rx.attach(tptr, mptr); |
tvendov | 0:6435b67ad23c | 89 | } |
tvendov | 0:6435b67ad23c | 90 | } |
tvendov | 0:6435b67ad23c | 91 | |
tvendov | 0:6435b67ad23c | 92 | /** |
tvendov | 0:6435b67ad23c | 93 | * Attach a callback called when a transfer is finished |
tvendov | 0:6435b67ad23c | 94 | * |
tvendov | 0:6435b67ad23c | 95 | * @param fptr function pointer |
tvendov | 0:6435b67ad23c | 96 | */ |
tvendov | 0:6435b67ad23c | 97 | inline void attach(void (*fptr)(void)) { |
tvendov | 0:6435b67ad23c | 98 | if(fptr != NULL) { |
tvendov | 0:6435b67ad23c | 99 | rx.attach(fptr); |
tvendov | 0:6435b67ad23c | 100 | } |
tvendov | 0:6435b67ad23c | 101 | } |
tvendov | 0:6435b67ad23c | 102 | |
tvendov | 0:6435b67ad23c | 103 | /** |
tvendov | 0:6435b67ad23c | 104 | * Call the handler associted to the end of a transfer |
tvendov | 0:6435b67ad23c | 105 | */ |
tvendov | 0:6435b67ad23c | 106 | inline void call() { |
tvendov | 0:6435b67ad23c | 107 | rx.call(); |
tvendov | 0:6435b67ad23c | 108 | }; |
tvendov | 0:6435b67ad23c | 109 | |
tvendov | 0:6435b67ad23c | 110 | |
tvendov | 0:6435b67ad23c | 111 | // setters |
tvendov | 0:6435b67ad23c | 112 | inline void setState(USB_TYPE st) { state = st; } |
tvendov | 0:6435b67ad23c | 113 | void setState(uint8_t st); |
tvendov | 0:6435b67ad23c | 114 | void setDeviceAddress(uint8_t addr); |
tvendov | 0:6435b67ad23c | 115 | inline void setLengthTransferred(int len) { transferred = len; }; |
tvendov | 0:6435b67ad23c | 116 | void setSpeed(uint8_t speed); |
tvendov | 0:6435b67ad23c | 117 | void setSize(uint32_t size); |
tvendov | 0:6435b67ad23c | 118 | inline void setDir(ENDPOINT_DIRECTION d) { dir = d; } |
tvendov | 0:6435b67ad23c | 119 | inline void setIntfNb(uint8_t intf_nb_) { intf_nb = intf_nb_; }; |
tvendov | 0:6435b67ad23c | 120 | |
tvendov | 0:6435b67ad23c | 121 | // getters |
tvendov | 0:6435b67ad23c | 122 | const char * getStateString(); |
tvendov | 0:6435b67ad23c | 123 | inline USB_TYPE getState() { return state; } |
tvendov | 0:6435b67ad23c | 124 | inline ENDPOINT_TYPE getType() { return type; }; |
tvendov | 0:6435b67ad23c | 125 | inline uint8_t getDeviceAddress() { return hced->control & 0x7f; }; |
tvendov | 0:6435b67ad23c | 126 | inline int getLengthTransferred() { return transferred; } |
tvendov | 0:6435b67ad23c | 127 | inline uint8_t * getBufStart() { return buf_start; } |
tvendov | 0:6435b67ad23c | 128 | inline uint8_t getAddress(){ return address; }; |
tvendov | 0:6435b67ad23c | 129 | inline uint32_t getSize() { return (hced->control >> 16) & 0x3ff; }; |
tvendov | 0:6435b67ad23c | 130 | inline volatile HCTD * getHeadTD() { return (volatile HCTD*) ((uint32_t)hced->headTD & ~0xF); }; |
tvendov | 0:6435b67ad23c | 131 | inline volatile HCTD** getTDList() { return td_list; }; |
tvendov | 0:6435b67ad23c | 132 | inline volatile HCED * getHCED() { return hced; }; |
tvendov | 0:6435b67ad23c | 133 | inline ENDPOINT_DIRECTION getDir() { return dir; } |
tvendov | 0:6435b67ad23c | 134 | inline volatile HCTD * getProcessedTD() { return td_current; }; |
tvendov | 0:6435b67ad23c | 135 | inline volatile HCTD* getNextTD() { return td_current; }; |
tvendov | 0:6435b67ad23c | 136 | inline bool isSetup() { return setup; } |
tvendov | 0:6435b67ad23c | 137 | inline USBEndpoint * nextEndpoint() { return (USBEndpoint*)nextEp; }; |
tvendov | 0:6435b67ad23c | 138 | inline uint8_t getIntfNb() { return intf_nb; }; |
tvendov | 0:6435b67ad23c | 139 | |
tvendov | 0:6435b67ad23c | 140 | USBDeviceConnected * dev; |
tvendov | 0:6435b67ad23c | 141 | |
tvendov | 0:6435b67ad23c | 142 | Queue<uint8_t, 1> ep_queue; |
tvendov | 0:6435b67ad23c | 143 | |
tvendov | 0:6435b67ad23c | 144 | private: |
tvendov | 0:6435b67ad23c | 145 | ENDPOINT_TYPE type; |
tvendov | 0:6435b67ad23c | 146 | volatile USB_TYPE state; |
tvendov | 0:6435b67ad23c | 147 | ENDPOINT_DIRECTION dir; |
tvendov | 0:6435b67ad23c | 148 | bool setup; |
tvendov | 0:6435b67ad23c | 149 | |
tvendov | 0:6435b67ad23c | 150 | uint8_t address; |
tvendov | 0:6435b67ad23c | 151 | |
tvendov | 0:6435b67ad23c | 152 | int transfer_len; |
tvendov | 0:6435b67ad23c | 153 | int transferred; |
tvendov | 0:6435b67ad23c | 154 | uint8_t * buf_start; |
tvendov | 0:6435b67ad23c | 155 | |
tvendov | 0:6435b67ad23c | 156 | FunctionPointer rx; |
tvendov | 0:6435b67ad23c | 157 | |
tvendov | 0:6435b67ad23c | 158 | USBEndpoint* nextEp; |
tvendov | 0:6435b67ad23c | 159 | |
tvendov | 0:6435b67ad23c | 160 | // USBEndpoint descriptor |
tvendov | 0:6435b67ad23c | 161 | volatile HCED * hced; |
tvendov | 0:6435b67ad23c | 162 | |
tvendov | 0:6435b67ad23c | 163 | volatile HCTD * td_list[2]; |
tvendov | 0:6435b67ad23c | 164 | volatile HCTD * td_current; |
tvendov | 0:6435b67ad23c | 165 | volatile HCTD * td_next; |
tvendov | 0:6435b67ad23c | 166 | |
tvendov | 0:6435b67ad23c | 167 | uint8_t intf_nb; |
tvendov | 0:6435b67ad23c | 168 | |
tvendov | 0:6435b67ad23c | 169 | }; |
tvendov | 0:6435b67ad23c | 170 | |
tvendov | 0:6435b67ad23c | 171 | #endif |