clean up warnings here and there

This commit is contained in:
hathach 2013-10-02 14:20:05 +07:00
parent 1263dbb122
commit 6f9172c15f
13 changed files with 56 additions and 58 deletions

View File

@ -129,7 +129,7 @@
<option> <option>
<name>GeneralMisraRules04</name> <name>GeneralMisraRules04</name>
<version>0</version> <version>0</version>
<state>111101110010111111111000110111111111111111111111111110010111101111010101111111111111111111111111101111111011111001111011111011111111111111111</state> <state>111101010010111111111000110011111101111111111111110110010111101111010101111111111111111111111111101111111011110001111011111011111111111111111</state>
</option> </option>
<option> <option>
<name>RTConfigPath2</name> <name>RTConfigPath2</name>

View File

@ -460,7 +460,7 @@
<Focus>0</Focus> <Focus>0</Focus>
<ColumnNumber>25</ColumnNumber> <ColumnNumber>25</ColumnNumber>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
<TopLine>155</TopLine> <TopLine>156</TopLine>
<CurrentLine>160</CurrentLine> <CurrentLine>160</CurrentLine>
<bDave2>0</bDave2> <bDave2>0</bDave2>
<PathWithFileName>..\src\main.c</PathWithFileName> <PathWithFileName>..\src\main.c</PathWithFileName>
@ -554,10 +554,10 @@
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<Focus>0</Focus> <Focus>0</Focus>
<ColumnNumber>35</ColumnNumber> <ColumnNumber>18</ColumnNumber>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
<TopLine>399</TopLine> <TopLine>226</TopLine>
<CurrentLine>405</CurrentLine> <CurrentLine>237</CurrentLine>
<bDave2>0</bDave2> <bDave2>0</bDave2>
<PathWithFileName>..\src\cli.c</PathWithFileName> <PathWithFileName>..\src\cli.c</PathWithFileName>
<FilenameWithoutPath>cli.c</FilenameWithoutPath> <FilenameWithoutPath>cli.c</FilenameWithoutPath>
@ -610,10 +610,10 @@
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<Focus>0</Focus> <Focus>0</Focus>
<ColumnNumber>1</ColumnNumber> <ColumnNumber>3</ColumnNumber>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
<TopLine>95</TopLine> <TopLine>95</TopLine>
<CurrentLine>132</CurrentLine> <CurrentLine>138</CurrentLine>
<bDave2>0</bDave2> <bDave2>0</bDave2>
<PathWithFileName>..\..\bsp\boards\printf_retarget.c</PathWithFileName> <PathWithFileName>..\..\bsp\boards\printf_retarget.c</PathWithFileName>
<FilenameWithoutPath>printf_retarget.c</FilenameWithoutPath> <FilenameWithoutPath>printf_retarget.c</FilenameWithoutPath>
@ -812,7 +812,7 @@
<Focus>0</Focus> <Focus>0</Focus>
<ColumnNumber>0</ColumnNumber> <ColumnNumber>0</ColumnNumber>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
<TopLine>356</TopLine> <TopLine>357</TopLine>
<CurrentLine>362</CurrentLine> <CurrentLine>362</CurrentLine>
<bDave2>0</bDave2> <bDave2>0</bDave2>
<PathWithFileName>..\..\..\tinyusb\host\usbh.c</PathWithFileName> <PathWithFileName>..\..\..\tinyusb\host\usbh.c</PathWithFileName>
@ -1060,7 +1060,7 @@
<Focus>0</Focus> <Focus>0</Focus>
<ColumnNumber>3</ColumnNumber> <ColumnNumber>3</ColumnNumber>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
<TopLine>576</TopLine> <TopLine>577</TopLine>
<CurrentLine>580</CurrentLine> <CurrentLine>580</CurrentLine>
<bDave2>0</bDave2> <bDave2>0</bDave2>
<PathWithFileName>..\..\bsp\lpc43xx\CMSIS_LPC43xx_DriverLib\src\lpc43xx_cgu.c</PathWithFileName> <PathWithFileName>..\..\bsp\lpc43xx\CMSIS_LPC43xx_DriverLib\src\lpc43xx_cgu.c</PathWithFileName>
@ -1116,7 +1116,7 @@
<Focus>0</Focus> <Focus>0</Focus>
<ColumnNumber>19</ColumnNumber> <ColumnNumber>19</ColumnNumber>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
<TopLine>146</TopLine> <TopLine>147</TopLine>
<CurrentLine>152</CurrentLine> <CurrentLine>152</CurrentLine>
<bDave2>0</bDave2> <bDave2>0</bDave2>
<PathWithFileName>..\..\bsp\lpc43xx\startup_keil\startup_LPC43xx.s</PathWithFileName> <PathWithFileName>..\..\bsp\lpc43xx\startup_keil\startup_LPC43xx.s</PathWithFileName>
@ -1138,10 +1138,10 @@
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<Focus>0</Focus> <Focus>0</Focus>
<ColumnNumber>23</ColumnNumber> <ColumnNumber>47</ColumnNumber>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
<TopLine>109</TopLine> <TopLine>50</TopLine>
<CurrentLine>113</CurrentLine> <CurrentLine>59</CurrentLine>
<bDave2>0</bDave2> <bDave2>0</bDave2>
<PathWithFileName>..\..\..\vendor\fatfs\diskio.c</PathWithFileName> <PathWithFileName>..\..\..\vendor\fatfs\diskio.c</PathWithFileName>
<FilenameWithoutPath>diskio.c</FilenameWithoutPath> <FilenameWithoutPath>diskio.c</FilenameWithoutPath>

View File

@ -55,8 +55,8 @@
#endif #endif
typedef enum { typedef enum {
CDC_PIPE_ERROR, CDC_PIPE_ERROR = 0,
CDC_PIPE_NOTIFICATION = 1, CDC_PIPE_NOTIFICATION,
CDC_PIPE_DATA_IN, CDC_PIPE_DATA_IN,
CDC_PIPE_DATA_OUT CDC_PIPE_DATA_OUT
}cdc_pipeid_t; }cdc_pipeid_t;

View File

@ -36,7 +36,7 @@
*/ */
/**************************************************************************/ /**************************************************************************/
/** /**
* \addtogroup Group_ClassDriver Class Driver * \addtogroup Group_ClassDriver Class Driver
* @{ * @{
* \defgroup Group_HID Human Interface Device * \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_DATA_3(data) , U32_TO_U8S_LE(data)
#define HID_REPORT_ITEM(data, tag, type, size) \ #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_MAIN 0
#define RI_TYPE_GLOBAL 1 #define RI_TYPE_GLOBAL 1

View File

@ -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); tusbh_msc_mounted_cb(dev_addr);
OSAL_SUBTASK_END OSAL_SUBTASK_END
return TUSB_ERROR_NONE;
} }
void msch_isr(pipe_handle_t pipe_hdl, tusb_event_t event, uint32_t xferred_bytes) void msch_isr(pipe_handle_t pipe_hdl, tusb_event_t event, uint32_t xferred_bytes)

View File

@ -99,17 +99,17 @@
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
// INLINE FUNCTION // 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[]) 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[])
{ {
return p_desc + p_desc[DESCRIPTOR_OFFSET_LENGTH]; 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[]) 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[])
{ {
return p_desc[DESCRIPTOR_OFFSET_TYPE]; 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) ATTR_ALWAYS_INLINE ATTR_CONST;
static inline uint32_t u32_from_u8(uint8_t b1, uint8_t b2, uint8_t b3, uint8_t b4) 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) ATTR_CONST ATTR_ALWAYS_INLINE;
static inline uint8_t u16_high_u8(uint16_t u16) 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; 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) ATTR_CONST ATTR_ALWAYS_INLINE;
static inline uint16_t u16_le2be(uint16_t u16) 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 -------------// //------------- 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) ATTR_ALWAYS_INLINE ATTR_CONST;
static inline uint32_t align_n (uint32_t alignment, uint32_t value) 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; 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); 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) ATTR_ALWAYS_INLINE ATTR_CONST;
static inline uint8_t log2_of(uint32_t value) static inline uint8_t log2_of(uint32_t value)
{ {

View File

@ -40,7 +40,7 @@
#if TUSB_CFG_DEBUG == 3 #if TUSB_CFG_DEBUG == 3
char const* const TUSB_ErrorStr[] = char const* const TUSB_ErrorStr[TUSB_ERROR_COUNT] =
{ {
ERROR_TABLE(ERROR_STRING) ERROR_TABLE(ERROR_STRING)
0 0

View File

@ -104,7 +104,7 @@ typedef enum {
#if TUSB_CFG_DEBUG == 3 #if TUSB_CFG_DEBUG == 3
/// Enum to String for debugging purposes. Only available if \ref TUSB_CFG_DEBUG > 0 /// 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 #endif
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -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) ATTR_CONST ATTR_ALWAYS_INLINE;
static inline uint8_t bm_request_type(uint8_t direction, uint8_t type, uint8_t recipient) 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 #ifdef __cplusplus

View File

@ -42,7 +42,7 @@
* \note TBD * \note TBD
*/ */
/** /**
* \defgroup Group_HAL Hardware Abtract Layer * \defgroup Group_HAL Hardware Abtract Layer
* \brief Hardware dependent layer * \brief Hardware dependent layer
* *
@ -52,11 +52,31 @@
#ifndef _TUSB_HAL_H_ #ifndef _TUSB_HAL_H_
#define _TUSB_HAL_H_ #define _TUSB_HAL_H_
//--------------------------------------------------------------------+
// INCLUDES
//--------------------------------------------------------------------+
#include "tusb_option.h" #include "tusb_option.h"
#include "common/primitive_types.h" #include "common/primitive_types.h"
#include "common/errors.h" #include "common/errors.h"
#include "common/compiler/compiler.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 #if MCU == 0
#error MCU is not defined or supported yet #error MCU is not defined or supported yet
#elif MCU == MCU_LPC11UXX #elif MCU == MCU_LPC11UXX
@ -75,22 +95,12 @@
extern "C" { extern "C" {
#endif #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) ATTR_PURE ATTR_ALWAYS_INLINE;
static inline bool hal_debugger_is_attached(void) static inline bool hal_debugger_is_attached(void)
{ {
#if !defined(_TEST_) && !(MCU==MCU_LPC11UXX) #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 #else
return false; return false;
#endif #endif

View File

@ -46,12 +46,12 @@
#ifndef _TUSB_HAL_LPC175X_6X_H_ #ifndef _TUSB_HAL_LPC175X_6X_H_
#define _TUSB_HAL_LPC175X_6X_H_ #define _TUSB_HAL_LPC175X_6X_H_
#include "LPC17xx.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
#include "LPC17xx.h"
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
// //
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+

View File

@ -833,9 +833,9 @@ STATIC_ INLINE_ ehci_link_t* get_period_frame_list(uint8_t hostid)
case 1: case 1:
return period_frame_list1; return period_frame_list1;
#endif #endif
default: return NULL;
} }
return NULL;
} }
#endif #endif

View File

@ -50,10 +50,6 @@
#ifndef _TUSB_TUSB_OPTION_H_ #ifndef _TUSB_TUSB_OPTION_H_
#define _TUSB_TUSB_OPTION_H_ #define _TUSB_TUSB_OPTION_H_
#ifdef __cplusplus
extern "C" {
#endif
#define TUSB_VERSION_YEAR 00 #define TUSB_VERSION_YEAR 00
#define TUSB_VERSION_MONTH 00 #define TUSB_VERSION_MONTH 00
#define TUSB_VERSION_WEEK 0 #define TUSB_VERSION_WEEK 0
@ -191,12 +187,6 @@
#define CDC_NOTIFICATION_EP_MAXPACKETSIZE 8 #define CDC_NOTIFICATION_EP_MAXPACKETSIZE 8
#define CDC_DATA_EP_MAXPACKET_SIZE 16 #define CDC_DATA_EP_MAXPACKET_SIZE 16
#ifdef __cplusplus
}
#endif
#endif /* _TUSB_TUSB_OPTION_H_ */ #endif /* _TUSB_TUSB_OPTION_H_ */
/** @} */ /** @} */