summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--demos/bsp/boards/printf_retarget.c36
-rw-r--r--demos/host/host_os_none/host_os_none.ewp2
-rw-r--r--demos/host/host_os_none/host_os_none.uvopt26
-rw-r--r--tinyusb/tusb.h243
4 files changed, 150 insertions, 157 deletions
diff --git a/demos/bsp/boards/printf_retarget.c b/demos/bsp/boards/printf_retarget.c
index dd33d2dba..ee95f25ef 100644
--- a/demos/bsp/boards/printf_retarget.c
+++ b/demos/bsp/boards/printf_retarget.c
@@ -41,11 +41,11 @@
#if CFG_PRINTF_TARGET != PRINTF_TARGET_SEMIHOST
#if CFG_PRINTF_TARGET == PRINTF_TARGET_UART
- #define retarget_getchar() board_uart_getchar()
+ #define retarget_getchar() board_uart_getchar()
#define retarget_putchar(c) board_uart_putchar(c);
#elif CFG_PRINTF_TARGET == PRINTF_TARGET_SWO
volatile int32_t ITM_RxBuffer; // keil variable to read from SWO
- #define retarget_getchar() ITM_ReceiveChar()
+ #define retarget_getchar() ITM_ReceiveChar()
#define retarget_putchar(c) ITM_SendChar(c)
#else
#error Target is not implemented yet
@@ -68,17 +68,14 @@ int __sys_write (int iFileHandle, char *buf, int length)
{
(void) iFileHandle;
- int ret = length;
for (int i=0; i<length; i++)
{
- if (buf[i] == '\n')
- {
- retarget_putchar('\r');
- ret++;
- }
+ if (buf[i] == '\n') retarget_putchar('\r');
+
retarget_putchar( buf[i] );
}
- return ret;
+
+ return length;
}
// Called by bottom level of scanf routine within RedLib C library to read
@@ -113,14 +110,14 @@ int fgetc(FILE *f)
int fputc(int ch, FILE *f)
{
- _ttywrch(ch)
+ _ttywrch(ch);
return ch;
}
//--------------------------------------------------------------------+
// IAR
//--------------------------------------------------------------------+
-#elif 0 // defined __ICCARM__ TODO could not able to retarget to UART with IAR
+#elif defined __ICCARM__ // TODO could not able to retarget to UART with IAR
#if CFG_PRINTF_TARGET == PRINTF_TARGET_UART
#include <stddef.h>
@@ -133,18 +130,14 @@ size_t __write(int handle, const unsigned char *buf, size_t length)
/* Check for stdout and stderr (only necessary if FILE descriptors are enabled.) */
if (handle != 1 && handle != 2) return -1;
- size_t ret = length;
for (size_t i=0; i<length; i++)
{
- if (buf[i] == '\n')
- {
- board_uart_putchar('\r');
- ret++;
- }
- board_uart_putchar( buf[i] );
+ if (buf[i] == '\n') retarget_putchar('\r');
+
+ retarget_putchar( buf[i] );
}
- return ret;
+ return length;
}
size_t __read(int handle, unsigned char *buf, size_t bufSize)
@@ -152,7 +145,7 @@ size_t __read(int handle, unsigned char *buf, size_t bufSize)
/* Check for stdin (only necessary if FILE descriptors are enabled) */
if (handle != 0) return -1;
- /*size_t i;
+ size_t i;
for (i=0; i<bufSize; i++)
{
uint8_t ch = board_uart_getchar();
@@ -160,8 +153,7 @@ size_t __read(int handle, unsigned char *buf, size_t bufSize)
buf[i] = ch;
}
- return i; */
- return 0;
+ return i;
}
#endif
diff --git a/demos/host/host_os_none/host_os_none.ewp b/demos/host/host_os_none/host_os_none.ewp
index eb221327f..e6a4e41ca 100644
--- a/demos/host/host_os_none/host_os_none.ewp
+++ b/demos/host/host_os_none/host_os_none.ewp
@@ -147,7 +147,7 @@
</option>
<option>
<name>OGUseCmsis</name>
- <state>1</state>
+ <state>0</state>
</option>
<option>
<name>OGUseCmsisDspLib</name>
diff --git a/demos/host/host_os_none/host_os_none.uvopt b/demos/host/host_os_none/host_os_none.uvopt
index 254ccce89..1a696ba95 100644
--- a/demos/host/host_os_none/host_os_none.uvopt
+++ b/demos/host/host_os_none/host_os_none.uvopt
@@ -73,7 +73,7 @@
<OPTFL>
<tvExp>1</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
- <IsCurrentTarget>0</IsCurrentTarget>
+ <IsCurrentTarget>1</IsCurrentTarget>
</OPTFL>
<CpuCode>8</CpuCode>
<Books>
@@ -738,7 +738,7 @@
<OPTFL>
<tvExp>1</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
- <IsCurrentTarget>1</IsCurrentTarget>
+ <IsCurrentTarget>0</IsCurrentTarget>
</OPTFL>
<CpuCode>8</CpuCode>
<Books>
@@ -926,7 +926,7 @@
<Focus>0</Focus>
<ColumnNumber>0</ColumnNumber>
<tvExpOptDlg>0</tvExpOptDlg>
- <TopLine>110</TopLine>
+ <TopLine>111</TopLine>
<CurrentLine>112</CurrentLine>
<bDave2>0</bDave2>
<PathWithFileName>..\src\main.c</PathWithFileName>
@@ -972,10 +972,10 @@
<FileType>1</FileType>
<tvExp>0</tvExp>
<Focus>0</Focus>
- <ColumnNumber>37</ColumnNumber>
+ <ColumnNumber>54</ColumnNumber>
<tvExpOptDlg>0</tvExpOptDlg>
- <TopLine>122</TopLine>
- <CurrentLine>129</CurrentLine>
+ <TopLine>123</TopLine>
+ <CurrentLine>137</CurrentLine>
<bDave2>0</bDave2>
<PathWithFileName>..\src\mouse_app.c</PathWithFileName>
<FilenameWithoutPath>mouse_app.c</FilenameWithoutPath>
@@ -1006,7 +1006,7 @@
<Focus>0</Focus>
<ColumnNumber>38</ColumnNumber>
<tvExpOptDlg>0</tvExpOptDlg>
- <TopLine>144</TopLine>
+ <TopLine>135</TopLine>
<CurrentLine>150</CurrentLine>
<bDave2>0</bDave2>
<PathWithFileName>..\src\msc_app.c</PathWithFileName>
@@ -1484,9 +1484,9 @@
<FileType>1</FileType>
<tvExp>0</tvExp>
<Focus>0</Focus>
- <ColumnNumber>2</ColumnNumber>
+ <ColumnNumber>4</ColumnNumber>
<tvExpOptDlg>0</tvExpOptDlg>
- <TopLine>3184</TopLine>
+ <TopLine>3185</TopLine>
<CurrentLine>3196</CurrentLine>
<bDave2>0</bDave2>
<PathWithFileName>..\..\..\vendor\fatfs\ff.c</PathWithFileName>
@@ -1556,10 +1556,10 @@
<FileType>1</FileType>
<tvExp>0</tvExp>
<Focus>0</Focus>
- <ColumnNumber>3</ColumnNumber>
+ <ColumnNumber>22</ColumnNumber>
<tvExpOptDlg>0</tvExpOptDlg>
- <TopLine>0</TopLine>
- <CurrentLine>0</CurrentLine>
+ <TopLine>79</TopLine>
+ <CurrentLine>88</CurrentLine>
<bDave2>0</bDave2>
<PathWithFileName>..\..\bsp\boards\printf_retarget.c</PathWithFileName>
<FilenameWithoutPath>printf_retarget.c</FilenameWithoutPath>
@@ -1694,7 +1694,7 @@
<Focus>0</Focus>
<ColumnNumber>30</ColumnNumber>
<tvExpOptDlg>0</tvExpOptDlg>
- <TopLine>145</TopLine>
+ <TopLine>146</TopLine>
<CurrentLine>153</CurrentLine>
<bDave2>0</bDave2>
<PathWithFileName>..\..\bsp\lpc43xx\startup_keil\startup_LPC43xx.s</PathWithFileName>
diff --git a/tinyusb/tusb.h b/tinyusb/tusb.h
index d7155b1f4..a9d624e2b 100644
--- a/tinyusb/tusb.h
+++ b/tinyusb/tusb.h
@@ -1,121 +1,122 @@
-/**************************************************************************/
-/*!
- @file tusb.h
- @author hathach (tinyusb.org)
-
- @section LICENSE
-
- Software License Agreement (BSD License)
-
- Copyright (c) 2013, hathach (tinyusb.org)
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- 3. Neither the name of the copyright holders nor the
- names of its contributors may be used to endorse or promote products
- derived from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
- EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY
- DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION HOWEVER CAUSED AND
- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- INCLUDING NEGLIGENCE OR OTHERWISE ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- This file is part of the tinyusb stack.
-*/
-/**************************************************************************/
-
-/** \file
- * \brief Tiny USB header
- *
- * \note Tiny USB header Note
- */
-
-#ifndef _TUSB_H_
-#define _TUSB_H_
-
-#ifdef __cplusplus
- extern "C" {
-#endif
-
-//--------------------------------------------------------------------+
-// INCLUDE
-//--------------------------------------------------------------------+
-#include "common/common.h"
-#include "hal/hal.h"
-#include "osal/osal.h"
-
-//------------- HOST -------------//
-#if MODE_HOST_SUPPORTED
- #include "host/usbh.h"
-
- #if HOST_CLASS_HID
- #include "class/hid_host.h"
- #endif
-
- #if TUSB_CFG_HOST_MSC
- #include "class/msc_host.h"
- #endif
-
- #if TUSB_CFG_HOST_CDC
- #include "class/cdc_host.h"
- #endif
-
- #if TUSB_CFG_HOST_CUSTOM_CLASS
- #include "class/custom_class.h"
- #endif
-
-#endif
-
-//------------- DEVICE -------------//
-#if MODE_DEVICE_SUPPORTED
- #include "device/usbd.h"
-
- #if DEVICE_CLASS_HID
- #include "class/hid_device.h"
- #endif
-
- #if TUSB_CFG_DEVICE_CDC
- #include "class/cdc_device.h"
- #endif
-
- #if TUSB_CFG_DEVICE_MSC
- #include "class/msc_device.h"
- #endif
-#endif
-
-
-//--------------------------------------------------------------------+
-// APPLICATION API
-//--------------------------------------------------------------------+
-tusb_error_t tusb_init(void);
-
-// TODO merge with tick_tock
-#if TUSB_CFG_OS == TUSB_OS_NONE
-void tusb_task_runner(void);
-#endif
-
-#if TUSB_CFG_OS == TUSB_OS_NONE && !defined(_TEST_)
-static inline void tusb_tick_tock(void) ATTR_ALWAYS_INLINE;
-static inline void tusb_tick_tock(void)
-{
- osal_tick_tock();
-}
-#endif
-
-#ifdef __cplusplus
- }
-#endif
-
-#endif /* _TUSB_H_ */
+/**************************************************************************/
+/*!
+ @file tusb.h
+ @author hathach (tinyusb.org)
+
+ @section LICENSE
+
+ Software License Agreement (BSD License)
+
+ Copyright (c) 2013, hathach (tinyusb.org)
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ 3. Neither the name of the copyright holders nor the
+ names of its contributors may be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
+ EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY
+ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION HOWEVER CAUSED AND
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ INCLUDING NEGLIGENCE OR OTHERWISE ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ This file is part of the tinyusb stack.
+*/
+/**************************************************************************/
+
+/** \file
+ * \brief Tiny USB header
+ *
+ * \note Tiny USB header Note
+ */
+
+#ifndef _TUSB_H_
+#define _TUSB_H_
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+//--------------------------------------------------------------------+
+// INCLUDE
+//--------------------------------------------------------------------+
+#include "common/common.h"
+#include "hal/hal.h"
+#include "osal/osal.h"
+
+//------------- HOST -------------//
+#if MODE_HOST_SUPPORTED
+ #include "host/usbh.h"
+
+ #if HOST_CLASS_HID
+ #include "class/hid_host.h"
+ #endif
+
+ #if TUSB_CFG_HOST_MSC
+ #include "class/msc_host.h"
+ #endif
+
+ #if TUSB_CFG_HOST_CDC
+ #include "class/cdc_host.h"
+ #endif
+
+ #if TUSB_CFG_HOST_CUSTOM_CLASS
+ #include "class/custom_class.h"
+ #endif
+
+#endif
+
+//------------- DEVICE -------------//
+#if MODE_DEVICE_SUPPORTED
+ #include "device/usbd.h"
+
+ #if DEVICE_CLASS_HID
+ #include "class/hid_device.h"
+ #endif
+
+ #if TUSB_CFG_DEVICE_CDC
+ #include "class/cdc_device.h"
+ #endif
+
+ #if TUSB_CFG_DEVICE_MSC
+ #include "class/msc_device.h"
+ #endif
+#endif
+
+
+//--------------------------------------------------------------------+
+// APPLICATION API
+//--------------------------------------------------------------------+
+tusb_error_t tusb_init(void);
+
+// TODO merge with tick_tock
+#if TUSB_CFG_OS == TUSB_OS_NONE
+void tusb_task_runner(void);
+#endif
+
+#if TUSB_CFG_OS == TUSB_OS_NONE && !defined(_TEST_)
+static inline void tusb_tick_tock(void) ATTR_ALWAYS_INLINE;
+static inline void tusb_tick_tock(void)
+{
+ osal_tick_tock();
+}
+#endif
+
+#ifdef __cplusplus
+ }
+#endif
+
+#endif /* _TUSB_H_ */
+