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
tvendov 0:6435b67ad23c 18 #include "dbg.h"
tvendov 0:6435b67ad23c 19 #include "USBEndpoint.h"
tvendov 0:6435b67ad23c 20
tvendov 0:6435b67ad23c 21 void USBEndpoint::init(HCED * hced_, ENDPOINT_TYPE type_, ENDPOINT_DIRECTION dir_, uint32_t size, uint8_t ep_number, HCTD* td_list_[2])
tvendov 0:6435b67ad23c 22 {
tvendov 0:6435b67ad23c 23 hced = hced_;
tvendov 0:6435b67ad23c 24 type = type_;
tvendov 0:6435b67ad23c 25 dir = dir_;
tvendov 0:6435b67ad23c 26 setup = (type == CONTROL_ENDPOINT) ? true : false;
tvendov 0:6435b67ad23c 27
tvendov 0:6435b67ad23c 28 //TDs have been allocated by the host
tvendov 0:6435b67ad23c 29 memcpy((HCTD**)td_list, td_list_, sizeof(HCTD*)*2); //TODO: Maybe should add a param for td_list size... at least a define
tvendov 0:6435b67ad23c 30 memset(td_list_[0], 0, sizeof(HCTD));
tvendov 0:6435b67ad23c 31 memset(td_list_[1], 0, sizeof(HCTD));
tvendov 0:6435b67ad23c 32
tvendov 0:6435b67ad23c 33 td_list[0]->ep = this;
tvendov 0:6435b67ad23c 34 td_list[1]->ep = this;
tvendov 0:6435b67ad23c 35
tvendov 0:6435b67ad23c 36 hced->control = 0;
tvendov 0:6435b67ad23c 37 //Empty queue
tvendov 0:6435b67ad23c 38 hced->tailTD = td_list[0];
tvendov 0:6435b67ad23c 39 hced->headTD = td_list[0];
tvendov 0:6435b67ad23c 40 hced->nextED = 0;
tvendov 0:6435b67ad23c 41
tvendov 0:6435b67ad23c 42 address = (ep_number & 0x7F) | ((dir - 1) << 7);
tvendov 0:6435b67ad23c 43
tvendov 0:6435b67ad23c 44 hced->control = ((ep_number & 0x7F) << 7) // Endpoint address
tvendov 0:6435b67ad23c 45 | (type != CONTROL_ENDPOINT ? ( dir << 11) : 0 ) // direction : Out = 1, 2 = In
tvendov 0:6435b67ad23c 46 | ((size & 0x3ff) << 16); // MaxPkt Size
tvendov 0:6435b67ad23c 47
tvendov 0:6435b67ad23c 48 transfer_len = 0;
tvendov 0:6435b67ad23c 49 transferred = 0;
tvendov 0:6435b67ad23c 50 buf_start = 0;
tvendov 0:6435b67ad23c 51 nextEp = NULL;
tvendov 0:6435b67ad23c 52
tvendov 0:6435b67ad23c 53 td_current = td_list[0];
tvendov 0:6435b67ad23c 54 td_next = td_list[1];
tvendov 0:6435b67ad23c 55
tvendov 0:6435b67ad23c 56 intf_nb = 0;
tvendov 0:6435b67ad23c 57
tvendov 0:6435b67ad23c 58 state = USB_TYPE_IDLE;
tvendov 0:6435b67ad23c 59 }
tvendov 0:6435b67ad23c 60
tvendov 0:6435b67ad23c 61 void USBEndpoint::setSize(uint32_t size)
tvendov 0:6435b67ad23c 62 {
tvendov 0:6435b67ad23c 63 hced->control &= ~(0x3ff << 16);
tvendov 0:6435b67ad23c 64 hced->control |= (size << 16);
tvendov 0:6435b67ad23c 65 }
tvendov 0:6435b67ad23c 66
tvendov 0:6435b67ad23c 67
tvendov 0:6435b67ad23c 68 void USBEndpoint::setDeviceAddress(uint8_t addr)
tvendov 0:6435b67ad23c 69 {
tvendov 0:6435b67ad23c 70 hced->control &= ~(0x7f);
tvendov 0:6435b67ad23c 71 hced->control |= (addr & 0x7F);
tvendov 0:6435b67ad23c 72 }
tvendov 0:6435b67ad23c 73
tvendov 0:6435b67ad23c 74 void USBEndpoint::setSpeed(uint8_t speed)
tvendov 0:6435b67ad23c 75 {
tvendov 0:6435b67ad23c 76 hced->control &= ~(1 << 13);
tvendov 0:6435b67ad23c 77 hced->control |= (speed << 13);
tvendov 0:6435b67ad23c 78 }
tvendov 0:6435b67ad23c 79
tvendov 0:6435b67ad23c 80 //Only for control Eps
tvendov 0:6435b67ad23c 81 void USBEndpoint::setNextToken(uint32_t token)
tvendov 0:6435b67ad23c 82 {
tvendov 0:6435b67ad23c 83 switch (token) {
tvendov 0:6435b67ad23c 84 case TD_SETUP:
tvendov 0:6435b67ad23c 85 dir = OUT;
tvendov 0:6435b67ad23c 86 setup = true;
tvendov 0:6435b67ad23c 87 break;
tvendov 0:6435b67ad23c 88 case TD_IN:
tvendov 0:6435b67ad23c 89 dir = IN;
tvendov 0:6435b67ad23c 90 setup = false;
tvendov 0:6435b67ad23c 91 break;
tvendov 0:6435b67ad23c 92 case TD_OUT:
tvendov 0:6435b67ad23c 93 dir = OUT;
tvendov 0:6435b67ad23c 94 setup = false;
tvendov 0:6435b67ad23c 95 break;
tvendov 0:6435b67ad23c 96 }
tvendov 0:6435b67ad23c 97 }
tvendov 0:6435b67ad23c 98
tvendov 0:6435b67ad23c 99 struct {
tvendov 0:6435b67ad23c 100 USB_TYPE type;
tvendov 0:6435b67ad23c 101 const char * str;
tvendov 0:6435b67ad23c 102 } static type_string[] = {
tvendov 0:6435b67ad23c 103 /*0*/ {USB_TYPE_OK, "USB_TYPE_OK"},
tvendov 0:6435b67ad23c 104 {USB_TYPE_CRC_ERROR, "USB_TYPE_CRC_ERROR"},
tvendov 0:6435b67ad23c 105 {USB_TYPE_BIT_STUFFING_ERROR, "USB_TYPE_BIT_STUFFING_ERROR"},
tvendov 0:6435b67ad23c 106 {USB_TYPE_DATA_TOGGLE_MISMATCH_ERROR, "USB_TYPE_DATA_TOGGLE_MISMATCH_ERROR"},
tvendov 0:6435b67ad23c 107 {USB_TYPE_STALL_ERROR, "USB_TYPE_STALL_ERROR"},
tvendov 0:6435b67ad23c 108 /*5*/ {USB_TYPE_DEVICE_NOT_RESPONDING_ERROR, "USB_TYPE_DEVICE_NOT_RESPONDING_ERROR"},
tvendov 0:6435b67ad23c 109 {USB_TYPE_PID_CHECK_FAILURE_ERROR, "USB_TYPE_PID_CHECK_FAILURE_ERROR"},
tvendov 0:6435b67ad23c 110 {USB_TYPE_UNEXPECTED_PID_ERROR, "USB_TYPE_UNEXPECTED_PID_ERROR"},
tvendov 0:6435b67ad23c 111 {USB_TYPE_DATA_OVERRUN_ERROR, "USB_TYPE_DATA_OVERRUN_ERROR"},
tvendov 0:6435b67ad23c 112 {USB_TYPE_DATA_UNDERRUN_ERROR, "USB_TYPE_DATA_UNDERRUN_ERROR"},
tvendov 0:6435b67ad23c 113 /*10*/ {USB_TYPE_ERROR, "USB_TYPE_ERROR"},
tvendov 0:6435b67ad23c 114 {USB_TYPE_ERROR, "USB_TYPE_ERROR"},
tvendov 0:6435b67ad23c 115 {USB_TYPE_BUFFER_OVERRUN_ERROR, "USB_TYPE_BUFFER_OVERRUN_ERROR"},
tvendov 0:6435b67ad23c 116 {USB_TYPE_BUFFER_UNDERRUN_ERROR, "USB_TYPE_BUFFER_UNDERRUN_ERROR"},
tvendov 0:6435b67ad23c 117 {USB_TYPE_DISCONNECTED, "USB_TYPE_DISCONNECTED"},
tvendov 0:6435b67ad23c 118 /*15*/ {USB_TYPE_FREE, "USB_TYPE_FREE"},
tvendov 0:6435b67ad23c 119 {USB_TYPE_IDLE, "USB_TYPE_IDLE"},
tvendov 0:6435b67ad23c 120 {USB_TYPE_PROCESSING, "USB_TYPE_PROCESSING"},
tvendov 0:6435b67ad23c 121 {USB_TYPE_ERROR, "USB_TYPE_ERROR"}
tvendov 0:6435b67ad23c 122 };
tvendov 0:6435b67ad23c 123
tvendov 0:6435b67ad23c 124 void USBEndpoint::setState(uint8_t st) {
tvendov 0:6435b67ad23c 125 if (st > 18)
tvendov 0:6435b67ad23c 126 return;
tvendov 0:6435b67ad23c 127 state = type_string[st].type;
tvendov 0:6435b67ad23c 128 }
tvendov 0:6435b67ad23c 129
tvendov 0:6435b67ad23c 130
tvendov 0:6435b67ad23c 131 const char * USBEndpoint::getStateString() {
tvendov 0:6435b67ad23c 132 return type_string[state].str;
tvendov 0:6435b67ad23c 133 }
tvendov 0:6435b67ad23c 134
tvendov 0:6435b67ad23c 135 void USBEndpoint::queueTransfer()
tvendov 0:6435b67ad23c 136 {
tvendov 0:6435b67ad23c 137 transfer_len = (uint32_t)td_current->bufEnd - (uint32_t)td_current->currBufPtr + 1;
tvendov 0:6435b67ad23c 138 transferred = transfer_len;
tvendov 0:6435b67ad23c 139 buf_start = (uint8_t *)td_current->currBufPtr;
tvendov 0:6435b67ad23c 140
tvendov 0:6435b67ad23c 141 //Now add this free TD at this end of the queue
tvendov 0:6435b67ad23c 142 state = USB_TYPE_PROCESSING;
tvendov 0:6435b67ad23c 143 td_current->nextTD = (hcTd*)td_next;
tvendov 0:6435b67ad23c 144 hced->tailTD = td_next;
tvendov 0:6435b67ad23c 145 }
tvendov 0:6435b67ad23c 146
tvendov 0:6435b67ad23c 147 void USBEndpoint::unqueueTransfer(volatile HCTD * td)
tvendov 0:6435b67ad23c 148 {
tvendov 0:6435b67ad23c 149 td->control=0;
tvendov 0:6435b67ad23c 150 td->currBufPtr=0;
tvendov 0:6435b67ad23c 151 td->bufEnd=0;
tvendov 0:6435b67ad23c 152 td->nextTD=0;
tvendov 0:6435b67ad23c 153 hced->headTD = (HCTD *)((uint32_t)hced->tailTD | ((uint32_t)hced->headTD & 0x2)); //Carry bit
tvendov 0:6435b67ad23c 154 td_current = td_next;
tvendov 0:6435b67ad23c 155 td_next = td;
tvendov 0:6435b67ad23c 156 }
tvendov 0:6435b67ad23c 157
tvendov 0:6435b67ad23c 158 void USBEndpoint::queueEndpoint(USBEndpoint * ed)
tvendov 0:6435b67ad23c 159 {
tvendov 0:6435b67ad23c 160 nextEp = ed;
tvendov 0:6435b67ad23c 161 hced->nextED = (ed == NULL) ? 0 : (hcEd*)(ed->getHCED());
tvendov 0:6435b67ad23c 162 }