Browse Source

[Style] A small coding style fixing session.

pull/180/head
Piotr Esden-Tempski 12 years ago
parent
commit
2f425af647
  1. 8
      include/libopencm3/cm3/common.h
  2. 3
      include/libopencm3/stm32/tools.h
  3. 3
      lib/lm4f/usb_lm4f.c
  4. 4
      lib/stm32/common/gpio_common_f24.c
  5. 5
      lib/stm32/common/pwr_common_all.c
  6. 2
      lib/stm32/f1/adc.c
  7. 15
      lib/usb/usb_f103.c

8
include/libopencm3/cm3/common.h

@ -53,11 +53,11 @@
#define MMIO64(addr) (*(volatile uint64_t *)(addr))
/* Generic bit-band I/O accessor functions */
#define BBIO_SRAM(addr,bit) \
MMIO8(((addr) & 0x0FFFFF) * 32 | 0x22000000 + (bit) * 4 )
#define BBIO_SRAM(addr, bit) \
MMIO8(((addr) & 0x0FFFFF) * 32 | 0x22000000 + (bit) * 4)
#define BBIO_PERIPH(addr,bit) \
MMIO8(((addr) & 0x0FFFFF) * 32 | 0x42000000 + (bit) * 4 )
#define BBIO_PERIPH(addr, bit) \
MMIO8(((addr) & 0x0FFFFF) * 32 | 0x42000000 + (bit) * 4)
/* Generic bit definition */
#define BIT0 (1<<0)

3
include/libopencm3/stm32/tools.h

@ -55,9 +55,10 @@ do { \
register uint16_t toggle_mask = GET_REG(REG) & (MSK); \
register uint16_t bit_selector; \
for (bit_selector = 1; bit_selector; bit_selector <<= 1) { \
if ((bit_selector & (BIT)) != 0) \
if ((bit_selector & (BIT)) != 0) { \
toggle_mask ^= bit_selector; \
} \
} \
SET_REG(REG, toggle_mask); \
} while (0)

3
lib/lm4f/usb_lm4f.c

@ -321,8 +321,7 @@ static void lm4f_ep_stall_set(usbd_device *usbd_dev, uint8_t addr,
} else {
(USB_TXCSRL(ep)) &= ~USB_TXCSRL_STALL;
}
}
else {
} else {
if (stall) {
(USB_RXCSRL(ep)) |= USB_RXCSRL_STALL;
} else {

4
lib/stm32/common/gpio_common_f24.c

@ -137,9 +137,9 @@ void gpio_set_output_options(uint32_t gpioport, uint8_t otype, uint8_t speed,
if (otype == 0x1) {
GPIO_OTYPER(gpioport) |= gpios;
}
else
} else {
GPIO_OTYPER(gpioport) &= ~gpios;
}
ospeedr = GPIO_OSPEEDR(gpioport);

5
lib/stm32/common/pwr_common_all.c

@ -172,7 +172,7 @@ threshold.
bool pwr_voltage_high(void)
{
return (PWR_CSR & PWR_CSR_PVDO);
return PWR_CSR & PWR_CSR_PVDO;
}
/*---------------------------------------------------------------------------*/
@ -186,7 +186,7 @@ cleared by software (see @ref pwr_clear_standby_flag).
bool pwr_get_standby_flag(void)
{
return (PWR_CSR & PWR_CSR_SBF);
return PWR_CSR & PWR_CSR_SBF;
}
/*---------------------------------------------------------------------------*/
@ -203,4 +203,3 @@ bool pwr_get_wakeup_flag(void)
return PWR_CSR & PWR_CSR_WUF;
}
/**@}*/

2
lib/stm32/f1/adc.c

@ -1066,7 +1066,7 @@ void adc_set_regular_sequence(uint32_t adc, uint8_t length, uint8_t channel[])
reg32_1 |= (channel[i - 1] << ((i - 12 - 1) * 5));
}
}
reg32_1 |= ((length -1) << ADC_SQR1_L_LSB);
reg32_1 |= ((length - 1) << ADC_SQR1_L_LSB);
ADC_SQR1(adc) = reg32_1;
ADC_SQR2(adc) = reg32_2;

15
lib/usb/usb_f103.c

@ -191,13 +191,15 @@ static uint8_t stm32f103_ep_stall_get(usbd_device *dev, uint8_t addr)
(void)dev;
if (addr & 0x80) {
if ((*USB_EP_REG(addr & 0x7F) & USB_EP_TX_STAT) ==
USB_EP_TX_STAT_STALL)
USB_EP_TX_STAT_STALL) {
return 1;
}
} else {
if ((*USB_EP_REG(addr) & USB_EP_RX_STAT) ==
USB_EP_RX_STAT_STALL)
USB_EP_RX_STAT_STALL) {
return 1;
}
}
return 0;
}
@ -213,9 +215,9 @@ static void stm32f103_ep_nak_set(usbd_device *dev, uint8_t addr, uint8_t nak)
if (nak) {
USB_SET_EP_RX_STAT(addr, USB_EP_RX_STAT_NAK);
}
else
} else {
USB_SET_EP_RX_STAT(addr, USB_EP_RX_STAT_VALID);
}
}
/**
@ -308,10 +310,11 @@ static void stm32f103_poll(usbd_device *dev)
uint8_t ep = istr & USB_ISTR_EP_ID;
uint8_t type = (istr & USB_ISTR_DIR) ? 1 : 0;
if (type) /* OUT or SETUP transaction */
if (type) { /* OUT or SETUP transaction */
type += (*USB_EP_REG(ep) & USB_EP_SETUP) ? 1 : 0;
else /* IN transaction */
} else { /* IN transaction */
USB_CLR_EP_TX_CTR(ep);
}
if (dev->user_callback_ctr[ep][type]) {
dev->user_callback_ctr[ep][type] (dev, ep);

Loading…
Cancel
Save