summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhathach <[email protected]>2013-10-02 14:20:05 +0700
committerhathach <[email protected]>2013-10-02 14:20:05 +0700
commit6f9172c15f1c2447549f3004f849261aa580d4f9 (patch)
tree1565fa8c0f570ec02e541805aa5e0cf0fa8eaf7e
parent1263dbb1221fc550737e560c415857829e8ecfd1 (diff)
clean up warnings here and there
-rw-r--r--demos/host/host_os_none/host_os_none.ewp2
-rw-r--r--demos/host/host_os_none/host_os_none.uvopt24
-rw-r--r--tinyusb/class/cdc_host.h4
-rw-r--r--tinyusb/class/hid.h4
-rw-r--r--tinyusb/class/msc_host.c2
-rw-r--r--tinyusb/common/common.h20
-rw-r--r--tinyusb/common/errors.c2
-rw-r--r--tinyusb/common/errors.h2
-rw-r--r--tinyusb/core/std_request.h2
-rw-r--r--tinyusb/hal/hal.h34
-rw-r--r--tinyusb/hal/hal_lpc175x_6x.h4
-rw-r--r--tinyusb/host/ehci/ehci.c4
-rw-r--r--tinyusb/tusb_option.h10
13 files changed, 56 insertions, 58 deletions
diff --git a/demos/host/host_os_none/host_os_none.ewp b/demos/host/host_os_none/host_os_none.ewp
index f47f439c6..bf2616f34 100644
--- a/demos/host/host_os_none/host_os_none.ewp
+++ b/demos/host/host_os_none/host_os_none.ewp
@@ -129,7 +129,7 @@
<option>
<name>GeneralMisraRules04</name>
<version>0</version>
- <state>111101110010111111111000110111111111111111111111111110010111101111010101111111111111111111111111101111111011111001111011111011111111111111111</state>
+ <state>111101010010111111111000110011111101111111111111110110010111101111010101111111111111111111111111101111111011110001111011111011111111111111111</state>
</option>
<option>
<name>RTConfigPath2</name>
diff --git a/demos/host/host_os_none/host_os_none.uvopt b/demos/host/host_os_none/host_os_none.uvopt
index 8b223e2aa..3e5f5192f 100644
--- a/demos/host/host_os_none/host_os_none.uvopt
+++ b/demos/host/host_os_none/host_os_none.uvopt
@@ -460,7 +460,7 @@
<Focus>0</Focus>
<ColumnNumber>25</ColumnNumber>
<tvExpOptDlg>0</tvExpOptDlg>
- <TopLine>155</TopLine>
+ <TopLine>156</TopLine>
<CurrentLine>160</CurrentLine>
<bDave2>0</bDave2>
<PathWithFileName>..\src\main.c</PathWithFileName>
@@ -554,10 +554,10 @@
<FileType>1</FileType>
<tvExp>0</tvExp>
<Focus>0</Focus>
- <ColumnNumber>35</ColumnNumber>
+ <ColumnNumber>18</ColumnNumber>
<tvExpOptDlg>0</tvExpOptDlg>
- <TopLine>399</TopLine>
- <CurrentLine>405</CurrentLine>
+ <TopLine>226</TopLine>
+ <CurrentLine>237</CurrentLine>
<bDave2>0</bDave2>
<PathWithFileName>..\src\cli.c</PathWithFileName>
<FilenameWithoutPath>cli.c</FilenameWithoutPath>
@@ -610,10 +610,10 @@
<FileType>1</FileType>
<tvExp>0</tvExp>
<Focus>0</Focus>
- <ColumnNumber>1</ColumnNumber>
+ <ColumnNumber>3</ColumnNumber>
<tvExpOptDlg>0</tvExpOptDlg>
<TopLine>95</TopLine>
- <CurrentLine>132</CurrentLine>
+ <CurrentLine>138</CurrentLine>
<bDave2>0</bDave2>
<PathWithFileName>..\..\bsp\boards\printf_retarget.c</PathWithFileName>
<FilenameWithoutPath>printf_retarget.c</FilenameWithoutPath>
@@ -812,7 +812,7 @@
<Focus>0</Focus>
<ColumnNumber>0</ColumnNumber>
<tvExpOptDlg>0</tvExpOptDlg>
- <TopLine>356</TopLine>
+ <TopLine>357</TopLine>
<CurrentLine>362</CurrentLine>
<bDave2>0</bDave2>
<PathWithFileName>..\..\..\tinyusb\host\usbh.c</PathWithFileName>
@@ -1060,7 +1060,7 @@
<Focus>0</Focus>
<ColumnNumber>3</ColumnNumber>
<tvExpOptDlg>0</tvExpOptDlg>
- <TopLine>576</TopLine>
+ <TopLine>577</TopLine>
<CurrentLine>580</CurrentLine>
<bDave2>0</bDave2>
<PathWithFileName>..\..\bsp\lpc43xx\CMSIS_LPC43xx_DriverLib\src\lpc43xx_cgu.c</PathWithFileName>
@@ -1116,7 +1116,7 @@
<Focus>0</Focus>
<ColumnNumber>19</ColumnNumber>
<tvExpOptDlg>0</tvExpOptDlg>
- <TopLine>146</TopLine>
+ <TopLine>147</TopLine>
<CurrentLine>152</CurrentLine>
<bDave2>0</bDave2>
<PathWithFileName>..\..\bsp\lpc43xx\startup_keil\startup_LPC43xx.s</PathWithFileName>
@@ -1138,10 +1138,10 @@
<FileType>1</FileType>
<tvExp>0</tvExp>
<Focus>0</Focus>
- <ColumnNumber>23</ColumnNumber>
+ <ColumnNumber>47</ColumnNumber>
<tvExpOptDlg>0</tvExpOptDlg>
- <TopLine>109</TopLine>
- <CurrentLine>113</CurrentLine>
+ <TopLine>50</TopLine>
+ <CurrentLine>59</CurrentLine>
<bDave2>0</bDave2>
<PathWithFileName>..\..\..\vendor\fatfs\diskio.c</PathWithFileName>
<FilenameWithoutPath>diskio.c</FilenameWithoutPath>
diff --git a/tinyusb/class/cdc_host.h b/tinyusb/class/cdc_host.h
index f5add34d6..b723d5fbe 100644
--- a/tinyusb/class/cdc_host.h
+++ b/tinyusb/class/cdc_host.h
@@ -55,8 +55,8 @@
#endif
typedef enum {
- CDC_PIPE_ERROR,
- CDC_PIPE_NOTIFICATION = 1,
+ CDC_PIPE_ERROR = 0,
+ CDC_PIPE_NOTIFICATION,
CDC_PIPE_DATA_IN,
CDC_PIPE_DATA_OUT
}cdc_pipeid_t;
diff --git a/tinyusb/class/hid.h b/tinyusb/class/hid.h
index 7d8d1b047..6a983648b 100644
--- a/tinyusb/class/hid.h
+++ b/tinyusb/class/hid.h
@@ -36,7 +36,7 @@
*/
/**************************************************************************/
-/**
+/**
* \addtogroup Group_ClassDriver Class Driver
* @{
* \defgroup Group_HID Human Interface Device
@@ -293,7 +293,7 @@ enum USB_HID_LOCAL_CODE
#define HID_REPORT_DATA_3(data) , U32_TO_U8S_LE(data)
#define HID_REPORT_ITEM(data, tag, type, size) \
- ((tag << 4) | (type << 2) | size) HID_REPORT_DATA_##size(data)
+ (((tag) << 4) | ((type) << 2) | (size)) HID_REPORT_DATA_##size(data)
#define RI_TYPE_MAIN 0
#define RI_TYPE_GLOBAL 1
diff --git a/tinyusb/class/msc_host.c b/tinyusb/class/msc_host.c
index 1b3e62dd4..a8ed60d02 100644
--- a/tinyusb/class/msc_host.c
+++ b/tinyusb/class/msc_host.c
@@ -401,8 +401,6 @@ tusb_error_t msch_open_subtask(uint8_t dev_addr, tusb_descriptor_interface_t con
tusbh_msc_mounted_cb(dev_addr);
OSAL_SUBTASK_END
-
- return TUSB_ERROR_NONE;
}
void msch_isr(pipe_handle_t pipe_hdl, tusb_event_t event, uint32_t xferred_bytes)
diff --git a/tinyusb/common/common.h b/tinyusb/common/common.h
index 73de8bce6..e5c72ba7c 100644
--- a/tinyusb/common/common.h
+++ b/tinyusb/common/common.h
@@ -99,17 +99,17 @@
//--------------------------------------------------------------------+
// INLINE FUNCTION
//--------------------------------------------------------------------+
-#define memclr_(buffer, size) memset(buffer, 0, size)
+#define memclr_(buffer, size) memset((buffer), 0, (size))
-static inline uint8_t const * descriptor_next(uint8_t const * p_desc) ATTR_ALWAYS_INLINE ATTR_PURE;
-static inline uint8_t const * descriptor_next(uint8_t const * p_desc)
+static inline uint8_t const * descriptor_next(uint8_t const p_desc[]) ATTR_ALWAYS_INLINE ATTR_PURE;
+static inline uint8_t const * descriptor_next(uint8_t const p_desc[])
{
return p_desc + p_desc[DESCRIPTOR_OFFSET_LENGTH];
}
-static inline uint8_t descriptor_typeof(uint8_t const * p_desc) ATTR_ALWAYS_INLINE ATTR_PURE;
-static inline uint8_t descriptor_typeof(uint8_t const * p_desc)
+static inline uint8_t descriptor_typeof(uint8_t const p_desc[]) ATTR_ALWAYS_INLINE ATTR_PURE;
+static inline uint8_t descriptor_typeof(uint8_t const p_desc[])
{
return p_desc[DESCRIPTOR_OFFSET_TYPE];
}
@@ -119,13 +119,13 @@ static inline uint8_t descriptor_typeof(uint8_t const * p_desc)
static inline uint32_t u32_from_u8(uint8_t b1, uint8_t b2, uint8_t b3, uint8_t b4) ATTR_ALWAYS_INLINE ATTR_CONST;
static inline uint32_t u32_from_u8(uint8_t b1, uint8_t b2, uint8_t b3, uint8_t b4)
{
- return (b1 << 24) + (b2 << 16) + (b3 << 8) + b4;
+ return ( ((uint32_t) b1) << 24) + ( ((uint32_t) b2) << 16) + ( ((uint32_t) b3) << 8) + b4;
}
static inline uint8_t u16_high_u8(uint16_t u16) ATTR_CONST ATTR_ALWAYS_INLINE;
static inline uint8_t u16_high_u8(uint16_t u16)
{
- return (uint8_t) ((u16 >> 8) & 0x00ff);
+ return (uint8_t) ( ((uint16_t) (u16 >> 8)) & 0x00ff);
}
static inline uint8_t u16_low_u8(uint16_t u16) ATTR_CONST ATTR_ALWAYS_INLINE;
@@ -137,7 +137,7 @@ static inline uint8_t u16_low_u8(uint16_t u16)
static inline uint16_t u16_le2be(uint16_t u16) ATTR_CONST ATTR_ALWAYS_INLINE;
static inline uint16_t u16_le2be(uint16_t u16)
{
- return (u16_low_u8(u16) << 8) | u16_high_u8(u16);
+ return ((uint16_t)(u16_low_u8(u16) << 8)) | u16_high_u8(u16);
}
//------------- Min -------------//
@@ -182,7 +182,7 @@ static inline uint32_t align16 (uint32_t value)
static inline uint32_t align_n (uint32_t alignment, uint32_t value) ATTR_ALWAYS_INLINE ATTR_CONST;
static inline uint32_t align_n (uint32_t alignment, uint32_t value)
{
- return value & (~(alignment-1));
+ return value & ((uint32_t) ~(alignment-1));
}
static inline uint32_t align4k (uint32_t value) ATTR_ALWAYS_INLINE ATTR_CONST;
@@ -212,7 +212,7 @@ static inline bool is_in_range_exclusive(uint32_t lower, uint32_t value, uint32_
return (lower < value) && (value < upper);
}
-
+// TODO use clz
static inline uint8_t log2_of(uint32_t value) ATTR_ALWAYS_INLINE ATTR_CONST;
static inline uint8_t log2_of(uint32_t value)
{
diff --git a/tinyusb/common/errors.c b/tinyusb/common/errors.c
index b575f0ffa..782d7be94 100644
--- a/tinyusb/common/errors.c
+++ b/tinyusb/common/errors.c
@@ -40,7 +40,7 @@
#if TUSB_CFG_DEBUG == 3
-char const* const TUSB_ErrorStr[] =
+char const* const TUSB_ErrorStr[TUSB_ERROR_COUNT] =
{
ERROR_TABLE(ERROR_STRING)
0
diff --git a/tinyusb/common/errors.h b/tinyusb/common/errors.h
index 8762bf06d..027f9bb2d 100644
--- a/tinyusb/common/errors.h
+++ b/tinyusb/common/errors.h
@@ -104,7 +104,7 @@ typedef enum {
#if TUSB_CFG_DEBUG == 3
/// Enum to String for debugging purposes. Only available if \ref TUSB_CFG_DEBUG > 0
-extern char const* const TUSB_ErrorStr[];
+extern char const* const TUSB_ErrorStr[TUSB_ERROR_COUNT];
#endif
#ifdef __cplusplus
diff --git a/tinyusb/core/std_request.h b/tinyusb/core/std_request.h
index 1b2175501..2b618ce7b 100644
--- a/tinyusb/core/std_request.h
+++ b/tinyusb/core/std_request.h
@@ -78,7 +78,7 @@ typedef ATTR_PACKED_STRUCT(struct){
static inline uint8_t bm_request_type(uint8_t direction, uint8_t type, uint8_t recipient) ATTR_CONST ATTR_ALWAYS_INLINE;
static inline uint8_t bm_request_type(uint8_t direction, uint8_t type, uint8_t recipient)
{
- return (direction << 7) | (type << 5) | recipient;
+ return ((uint8_t) (direction << 7)) | ((uint8_t) (type << 5)) | (recipient);
}
#ifdef __cplusplus
diff --git a/tinyusb/hal/hal.h b/tinyusb/hal/hal.h
index 6817baf3a..b0de23422 100644
--- a/tinyusb/hal/hal.h
+++ b/tinyusb/hal/hal.h
@@ -42,7 +42,7 @@
* \note TBD
*/
-/**
+/**
* \defgroup Group_HAL Hardware Abtract Layer
* \brief Hardware dependent layer
*
@@ -52,11 +52,31 @@
#ifndef _TUSB_HAL_H_
#define _TUSB_HAL_H_
+//--------------------------------------------------------------------+
+// INCLUDES
+//--------------------------------------------------------------------+
#include "tusb_option.h"
#include "common/primitive_types.h"
#include "common/errors.h"
#include "common/compiler/compiler.h"
+//--------------------------------------------------------------------+
+// HAL API
+//--------------------------------------------------------------------+
+// callback from tusb.h
+extern void tusb_isr(uint8_t controller_id);
+
+/// USB hardware init
+tusb_error_t hal_init(void);
+
+/// Enable USB Interrupt
+static inline void hal_interrupt_enable(uint8_t controller_id) ATTR_ALWAYS_INLINE;
+/// Disable USB Interrupt
+static inline void hal_interrupt_disable(uint8_t controller_id) ATTR_ALWAYS_INLINE;
+
+//--------------------------------------------------------------------+
+// INCLUDE DRIVEN
+//--------------------------------------------------------------------+
#if MCU == 0
#error MCU is not defined or supported yet
#elif MCU == MCU_LPC11UXX
@@ -75,22 +95,12 @@
extern "C" {
#endif
-// callback from tusb.h
-extern void tusb_isr(uint8_t controller_id);
-
-/// USB hardware init
-tusb_error_t hal_init(void);
-
-/// Enable USB Interrupt
-static inline void hal_interrupt_enable(uint8_t controller_id) ATTR_ALWAYS_INLINE;
-/// Disable USB Interrupt
-static inline void hal_interrupt_disable(uint8_t controller_id) ATTR_ALWAYS_INLINE;
static inline bool hal_debugger_is_attached(void) ATTR_PURE ATTR_ALWAYS_INLINE;
static inline bool hal_debugger_is_attached(void)
{
#if !defined(_TEST_) && !(MCU==MCU_LPC11UXX)
- return (CoreDebug->DHCSR & CoreDebug_DHCSR_C_DEBUGEN_Msk) == CoreDebug_DHCSR_C_DEBUGEN_Msk;
+ return ( (CoreDebug->DHCSR & CoreDebug_DHCSR_C_DEBUGEN_Msk) == CoreDebug_DHCSR_C_DEBUGEN_Msk );
#else
return false;
#endif
diff --git a/tinyusb/hal/hal_lpc175x_6x.h b/tinyusb/hal/hal_lpc175x_6x.h
index 3b94b23c3..4f3224cee 100644
--- a/tinyusb/hal/hal_lpc175x_6x.h
+++ b/tinyusb/hal/hal_lpc175x_6x.h
@@ -46,12 +46,12 @@
#ifndef _TUSB_HAL_LPC175X_6X_H_
#define _TUSB_HAL_LPC175X_6X_H_
+#include "LPC17xx.h"
+
#ifdef __cplusplus
extern "C" {
#endif
-#include "LPC17xx.h"
-
//--------------------------------------------------------------------+
//
//--------------------------------------------------------------------+
diff --git a/tinyusb/host/ehci/ehci.c b/tinyusb/host/ehci/ehci.c
index 756c7dcb9..815c865d0 100644
--- a/tinyusb/host/ehci/ehci.c
+++ b/tinyusb/host/ehci/ehci.c
@@ -833,9 +833,9 @@ STATIC_ INLINE_ ehci_link_t* get_period_frame_list(uint8_t hostid)
case 1:
return period_frame_list1;
#endif
+
+ default: return NULL;
}
-
- return NULL;
}
#endif
diff --git a/tinyusb/tusb_option.h b/tinyusb/tusb_option.h
index 16e474959..f479d0a79 100644
--- a/tinyusb/tusb_option.h
+++ b/tinyusb/tusb_option.h
@@ -50,10 +50,6 @@
#ifndef _TUSB_TUSB_OPTION_H_
#define _TUSB_TUSB_OPTION_H_
-#ifdef __cplusplus
- extern "C" {
-#endif
-
#define TUSB_VERSION_YEAR 00
#define TUSB_VERSION_MONTH 00
#define TUSB_VERSION_WEEK 0
@@ -191,12 +187,6 @@
#define CDC_NOTIFICATION_EP_MAXPACKETSIZE 8
#define CDC_DATA_EP_MAXPACKET_SIZE 16
-
-
-#ifdef __cplusplus
- }
-#endif
-
#endif /* _TUSB_TUSB_OPTION_H_ */
/** @} */