From 949cc878979384c21f49017cf4affdcaa28e689b Mon Sep 17 00:00:00 2001 From: Perry Hung Date: Thu, 12 May 2011 04:48:10 -0400 Subject: libmaple: Fix warnings in libmaple source files -Add -Wall, -Werror to libmaple/* -Fix warnings --- libmaple/dma.c | 2 +- libmaple/i2c.c | 12 +++++------- libmaple/nvic.h | 2 +- libmaple/rcc.c | 2 +- libmaple/rules.mk | 2 +- libmaple/usb/usb.c | 4 +--- libmaple/usb/usb_callbacks.c | 4 ++-- libmaple/usb/usb_lib/usb_regs.h | 6 +++--- 8 files changed, 15 insertions(+), 19 deletions(-) (limited to 'libmaple') diff --git a/libmaple/dma.c b/libmaple/dma.c index 04cdcea..57baa13 100644 --- a/libmaple/dma.c +++ b/libmaple/dma.c @@ -244,9 +244,9 @@ dma_irq_cause dma_get_irq_cause(dma_dev *dev, dma_channel channel) { * order to fail fast, mimic the DMA controller's behavior * when an error occurs. */ dma_disable(dev, channel); - return DMA_TRANSFER_ERROR; } #endif + return DMA_TRANSFER_ERROR; } /** diff --git a/libmaple/i2c.c b/libmaple/i2c.c index 5c8ee02..0ef8e70 100644 --- a/libmaple/i2c.c +++ b/libmaple/i2c.c @@ -32,7 +32,6 @@ #include "libmaple.h" #include "rcc.h" -#include "nvic.h" #include "gpio.h" #include "nvic.h" #include "i2c.h" @@ -302,18 +301,18 @@ void __irq_i2c2_ev(void) { * @sideeffect Aborts any pending i2c transactions */ static void i2c_irq_error_handler(i2c_dev *dev) { - uint32 sr1 = dev->regs->SR1; - uint32 sr2 = dev->regs->SR2; - I2C_CRUMB(ERROR_ENTRY, sr1, sr2); + I2C_CRUMB(ERROR_ENTRY, dev->regs->SR1, dev->regs->SR2); + dev->error_flags = dev->regs->SR2 & (I2C_SR1_BERR | + I2C_SR1_ARLO | + I2C_SR1_AF | + I2C_SR1_OVR); /* Clear flags */ dev->regs->SR1 = 0; dev->regs->SR2 = 0; i2c_stop_condition(dev); i2c_disable_irq(dev, I2C_IRQ_BUFFER | I2C_IRQ_EVENT | I2C_IRQ_ERROR); - dev->error_flags = sr2 & (I2C_SR1_BERR | I2C_SR1_ARLO | I2C_SR1_AF | - I2C_SR1_OVR); dev->state = I2C_STATE_ERROR; } @@ -534,7 +533,6 @@ out: static inline int32 wait_for_state_change(i2c_dev *dev, i2c_state state, uint32 timeout) { - int32 rc; i2c_state tmp; while (1) { diff --git a/libmaple/nvic.h b/libmaple/nvic.h index 496c41b..540a41e 100644 --- a/libmaple/nvic.h +++ b/libmaple/nvic.h @@ -139,7 +139,7 @@ typedef enum nvic_irq_num { void nvic_init(uint32 vector_table_address, uint32 offset); void nvic_set_vector_table(uint32 address, uint32 offset); -void nvic_set_priority(nvic_irq_num irqn, uint8 priority); +void nvic_irq_set_priority(nvic_irq_num irqn, uint8 priority); /** * Enables interrupts and configurable fault handlers (clear PRIMASK). diff --git a/libmaple/rcc.c b/libmaple/rcc.c index 37c1ec4..a1d92b7 100644 --- a/libmaple/rcc.c +++ b/libmaple/rcc.c @@ -105,7 +105,7 @@ static const struct rcc_dev_info rcc_dev_table[] = { void rcc_clk_init(rcc_sysclk_src sysclk_src, rcc_pllsrc pll_src, rcc_pll_multiplier pll_mul) { - uint32 cfgr; + uint32 cfgr = 0; uint32 cr; /* Assume that we're going to clock the chip off the PLL, fed by diff --git a/libmaple/rules.mk b/libmaple/rules.mk index 2eaea55..5e704a7 100644 --- a/libmaple/rules.mk +++ b/libmaple/rules.mk @@ -9,7 +9,7 @@ BUILDDIRS += $(BUILD_PATH)/$(d)/usb/usb_lib LIBMAPLE_INCLUDES := -I$(LIBMAPLE_PATH) -I$(LIBMAPLE_PATH)/usb -I$(LIBMAPLE_PATH)/usb/usb_lib # Local flags -CFLAGS_$(d) = -I$(d) $(LIBMAPLE_INCLUDES) +CFLAGS_$(d) = -I$(d) $(LIBMAPLE_INCLUDES) -Wall -Werror # Local rules and targets cSRCS_$(d) := adc.c \ diff --git a/libmaple/usb/usb.c b/libmaple/usb/usb.c index b34c4b6..617c1ee 100644 --- a/libmaple/usb/usb.c +++ b/libmaple/usb/usb.c @@ -337,7 +337,7 @@ void usbWaitReset(void) { */ void usbBlockingSendByte(char ch) { while (countTx); - UserToPMABufferCopy(&ch,VCOM_TX_ADDR,1); + UserToPMABufferCopy((uint8*)&ch,VCOM_TX_ADDR,1); _SetEPTxCount(VCOM_TX_ENDP,1); _SetEPTxValid(VCOM_TX_ENDP); countTx = 1; @@ -397,8 +397,6 @@ uint32 usbReceiveBytes(uint8* recvBuf, uint32 len) { } void usbSendHello(void) { - char* myStr = "hello!"; - uint8 bufin = 48 + recvBufIn;; uint8 bufout = 48 + recvBufOut; uint8 avail = 48 + usbBytesAvailable(); diff --git a/libmaple/usb/usb_callbacks.c b/libmaple/usb/usb_callbacks.c index 8184537..9694942 100644 --- a/libmaple/usb/usb_callbacks.c +++ b/libmaple/usb/usb_callbacks.c @@ -69,8 +69,8 @@ void vcomDataRxCb(void) { in some cases */ /* magic number, {0x31, 0x45, 0x41, 0x46} is "1EAF" */ - char chkBuf[4]; - char cmpBuf[4] = {0x31, 0x45, 0x41, 0x46}; + uint8 chkBuf[4]; + uint8 cmpBuf[4] = {0x31, 0x45, 0x41, 0x46}; if (reset_state == DTR_NEGEDGE) { reset_state = DTR_LOW; diff --git a/libmaple/usb/usb_lib/usb_regs.h b/libmaple/usb/usb_lib/usb_regs.h index a888f72..b63cc5f 100644 --- a/libmaple/usb/usb_lib/usb_regs.h +++ b/libmaple/usb/usb_lib/usb_regs.h @@ -357,9 +357,9 @@ enum EP_BUF_NUM * Return : None. *******************************************************************************/ #define _ToggleDTOG_RX(bEpNum) (_SetENDPOINT(bEpNum, \ - EP_DTOG_RX | _GetENDPOINT(bEpNum) & EPREG_MASK)) + EP_DTOG_RX | (_GetENDPOINT(bEpNum) & EPREG_MASK))) #define _ToggleDTOG_TX(bEpNum) (_SetENDPOINT(bEpNum, \ - EP_DTOG_TX | _GetENDPOINT(bEpNum) & EPREG_MASK)) + EP_DTOG_TX | (_GetENDPOINT(bEpNum) & EPREG_MASK))) /******************************************************************************* * Macro Name : ClearDTOG_RX / ClearDTOG_TX. @@ -381,7 +381,7 @@ enum EP_BUF_NUM * Return : None. *******************************************************************************/ #define _SetEPAddress(bEpNum,bAddr) _SetENDPOINT(bEpNum,\ - _GetENDPOINT(bEpNum) & EPREG_MASK | bAddr) + (_GetENDPOINT(bEpNum) & EPREG_MASK) | bAddr) /******************************************************************************* * Macro Name : GetEPAddress. -- cgit v1.2.3