Skip to content

Commit

Permalink
[ext] update libopencm3
Browse files Browse the repository at this point in the history
Reason is just to get the fix for usb control callbacks so luftboot works again.
Since rcc_ppre1_frequency and rcc_ppre2_frequency were also renamed in the meantime, make appropriate changes.
  • Loading branch information
flixr committed Dec 29, 2014
1 parent 9303c23 commit 0173f34
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
18 changes: 10 additions & 8 deletions sw/airborne/arch/stm32/mcu_arch.c
Expand Up @@ -127,7 +127,7 @@ static inline uint32_t rcc_get_ppre2(void)
uint32_t timer_get_frequency(uint32_t timer_peripheral)
{
switch (timer_peripheral) {
// Timers on APB1
// Timers on high speed APB2
case TIM1:
case TIM8:
#ifdef TIM9
Expand All @@ -140,14 +140,15 @@ uint32_t timer_get_frequency(uint32_t timer_peripheral)
case TIM11:
#endif
if (!rcc_get_ppre2())
// no APB2 prescaler
{
return rcc_ppre2_frequency;
/* without APB2 prescaler, runs at APB2 freq */
return rcc_apb2_frequency;
} else {
return rcc_ppre2_frequency * 2;
/* with any ABP2 prescaler, runs at 2 * APB2 freq */
return rcc_apb2_frequency * 2;
}

// timers on APB2
// timers on low speed APB1
case TIM2:
case TIM3:
case TIM4:
Expand All @@ -164,11 +165,12 @@ uint32_t timer_get_frequency(uint32_t timer_peripheral)
case TIM14:
#endif
if (!rcc_get_ppre1())
// no APB2 prescaler
{
return rcc_ppre1_frequency;
/* without APB1 prescaler, runs at APB1 freq */
return rcc_apb1_frequency;
} else {
return rcc_ppre1_frequency * 2;
/* with any ABP1 prescaler, runs at 2 * APB1 freq */
return rcc_apb1_frequency * 2;
}
default:
// other timers currently not supported
Expand Down
4 changes: 2 additions & 2 deletions sw/airborne/arch/stm32/mcu_periph/i2c_arch.c
Expand Up @@ -1172,10 +1172,10 @@ void i2c_setbitrate(struct i2c_periph *periph, int bitrate)
bitrate = 3000;
}

// rcc_ppre1_frequency is normally configured to max: 36MHz on F1 and 42MHz on F4
// rcc_apb1_frequency is normally configured to max: 36MHz on F1 and 42MHz on F4
// in fast mode: 2counts low 1 count high -> / 3:
// in standard mode: 1 count low, 1 count high -> /2:
devider = (rcc_ppre1_frequency / 2000) / (bitrate / 1000);
devider = (rcc_apb1_frequency / 2000) / (bitrate / 1000);

// never allow faster than 600kbps
if (devider < 20) {
Expand Down
2 changes: 1 addition & 1 deletion sw/ext/libopencm3
Submodule libopencm3 updated 41 files
+4 −1 .gitignore
+1 −0 include/libopencm3/cm3/sync.h
+3 −3 include/libopencm3/ethernet/mac_stm32fxx7.h
+7 −5 include/libopencm3/ethernet/phy.h
+7 −12 include/libopencm3/stm32/common/flash_common_f24.h
+2 −0 include/libopencm3/stm32/f0/crs.h
+7 −7 include/libopencm3/stm32/f0/rcc.h
+24 −0 include/libopencm3/stm32/f1/gpio.h
+9 −2 include/libopencm3/stm32/f1/rcc.h
+5 −3 include/libopencm3/stm32/f2/rcc.h
+3 −2 include/libopencm3/stm32/f3/rcc.h
+9 −3 include/libopencm3/stm32/f4/rcc.h
+620 −0 include/libopencm3/stm32/l0/rcc.h
+5 −3 include/libopencm3/stm32/l1/rcc.h
+2 −0 include/libopencm3/stm32/rcc.h
+94 −0 include/libopencm3/usb/audio.h
+190 −0 include/libopencm3/usb/midi.h
+5 −1 include/libopencm3/usb/usbstd.h
+14 −8 lib/cm3/sync.c
+3 −2 lib/ethernet/mac_stm32fxx7.c
+7 −6 lib/ethernet/phy.c
+11 −7 lib/ethernet/phy_ksz8051mll.c
+4 −4 lib/stm32/common/flash_common_f24.c
+3 −3 lib/stm32/common/usart_common_all.c
+1 −1 lib/stm32/f0/Makefile
+15 −0 lib/stm32/f0/crs.c
+60 −43 lib/stm32/f0/rcc.c
+2 −2 lib/stm32/f0/usart.c
+2 −1 lib/stm32/f1/Makefile
+26 −20 lib/stm32/f1/rcc.c
+6 −5 lib/stm32/f2/rcc.c
+6 −5 lib/stm32/f3/rcc.c
+2 −1 lib/stm32/f4/Makefile
+6 −5 lib/stm32/f4/rcc.c
+3 −3 lib/stm32/l0/Makefile
+294 −0 lib/stm32/l0/rcc.c
+32 −0 lib/stm32/l0/stm32l0xx6.ld
+32 −0 lib/stm32/l0/stm32l0xx8.ld
+10 −9 lib/stm32/l1/rcc.c
+5 −0 lib/usb/usb.c
+18 −7 lib/usb/usb_standard.c

0 comments on commit 0173f34

Please sign in to comment.