Commit Graph

1105 Commits

Author SHA1 Message Date
Sergey Matyukevich ef91856ac1 stm32: unify i2c implementations
The f1, f2, f4, l1 chip families have a similar "v1" i2c peripheral on board.
More recent f0, f3, l0, l3 chip families share another "v2" version  of i2c.

This patch unifies headers and implementation for two types of i2c peripherals:

- rename: i2c_common_all.[ch] to i2c_common_v1.[ch]
- remove i2c_common_f24.h: extra I2C blocks are defined in specific headers
- use f3 i2c code as a basis for common "v2" i2c implementation
- add f0 i2c support: use "v2" i2c implementation

Tests:
- tested on a custom f0 board
- compile-tested both libopencm3 and libopencm3-examples for all stm32

Signed-off-by: Sergey Matyukevich <geomatsi@gmail.com>
2017-03-30 21:48:07 +00:00
Sergey Matyukevich 43736cf03f stm32/f0: RTC clock helpers
Add three more RTC clock helper functions:

- rcc_set_rtc_clock_source
  RTC on stm32/f0 can be clocked from the following three
  sources: LSI, LSE (32.768Hz), HSE/32.

- rcc_enable_rtc_clock
- rcc_disable_rtc_clock
  enable/disable clocking RTC module using selected clock source

Signed-off-by: Sergey Matyukevich <geomatsi@gmail.com>
2017-03-30 21:48:07 +00:00
Karl Palsson d2540e5fc6 stm32f7: rcc: replace magics with existing defines
The defines already existed, use them, rather than the copied constants
from F4 code.
2017-03-30 21:48:07 +00:00
Sync c285bcb493 stm32f7: rcc: initial clock config for disco board
Add clock config for the 25MHz crystal found on the discovery board.
Verified to work on the STM32F7-Disco.

Reviewed-by: Karl Palsson <karlp@tweak.net.au>
Modified namespaces and types->structs to avoid namespace pollution as
was fixed for other families in:

3a7cbec7: stm32l/stm32f: name space standardization [BREAKING]
2017-03-30 21:48:07 +00:00
Sync 3fc0c9d001 stm32f7: rcc: intial stubs support
Reviewed-by: Karl Palsson <karlp@tweak.net.au>
(Added defines and used them)
2017-03-30 21:48:07 +00:00
Karl Palsson 7ee1d948e9 stm32f0:usart: Correctly allow >8bit words.
Make them 16bit regs, like on other periphs.  This allows proper access
to the "8th" bit.  (0..8 is 9 bits, not 8)

Found and reported in https://github.com/libopencm3/libopencm3/pull/651
2017-03-30 21:48:07 +00:00
Karl Palsson 6dd7b3ecc5 stm32f0:usart: drop redundant type info from doxygen
These are redundant, and provided by compilers and doxygen
interpretation anyway.  Frees up plenty of space on each line for useful
documentation.
2017-03-30 21:48:07 +00:00
Ken Sarkies 808cd44a41 STM32F1: RTC: rtc_awake_from_off() clears CR register incorrectly.
It sets bit 5 (manual says "read only") and clears bit 4 which takes the RTC
out of config mode. The RTC registers are not cleared as a result.
2017-03-30 21:48:07 +00:00
Jonathan Challinger 7f8b32efed stm32f3: include CAN 2017-03-30 21:48:07 +00:00
Karl Palsson d964dcfca4 stm32:usart: drop usart_get_interrupt_source()
It was never complete, even for F1 family code, and went on to be even
less complete for f0 and f3.  The usefulness of a library function to
check for both the irq being enabled _and_ the status flag is highly
questionable, and caused known user confusion.

The existing, much simpler, and fully functional usart_get_flag() is
a good replacement in almost all sane use cases.

Fixes https://github.com/libopencm3/libopencm3/issues/734
2017-03-30 21:48:07 +00:00
Karl Palsson f07b58c6d8 stm32:rng: add helper to actually get random numbers
Simplified blocking API, with an async routine if you really need it.
Follows as best as I can understand the reference manual, but testing
those conditions will be difficult.
2017-03-30 21:48:07 +00:00
Karl Palsson 05829037de stm32:rng: add common v1 to l0,l4,f7
This is a common peripheral based on reference manual inspection.
2017-03-30 21:48:07 +00:00
Karl Palsson 2476099f29 stm32:rng: f4 rng peripheral is common with at least f2
Pull it up as common code immediately. Rename to v1, extract to common
with a doxygen marker stubs, add to F2 makefiles.
2017-03-30 21:48:07 +00:00
Sulter ac45247f60 stm32f4:rng: basic functions with documentation.
Reviewed-by: Karl Palsson <karlp@tweak.net.au>
Removed higher level helpers from this commit, they are not a very
friendly API to use.
2017-03-30 21:48:07 +00:00
Karl Palsson c9c5cb7c9c style: fix some of the easier style bugs
No real changes.
2017-03-30 21:48:07 +00:00
Seven Watt 8a62618a63 stm32l0: add exti to makefile
Tested with a Lora radio application that used three GPIO lines to send
different interrupts from the radio module to the L052. Tested with a
Jeenode Zero Rev1
2017-02-17 09:43:01 +00:00
Dave Hylands 755ce402e2 stm32:desig: Add DFU compatible serial generation
Reviewed-by: Karl Palsson <karlp@tweak.net.au>
Modified to provide better doxygen and consistent api names.
2017-01-10 23:07:00 +00:00
David Sidrane cf80e2bd5e stm32f4: USB support for newer OTG cores
Support for the  conflicting bit definitions for vbus sensing on core id
version 0x2000+

Reviewed-by: Karl Palsson <karlp@tweak.net.au>
2017-01-10 22:32:20 +00:00
Karl Palsson cd9ae5e6d7 eeprom: drop support from linker scripts.
While the NOLOAD variant sometimes worked with some toolchains, the
version in the generator scripts could never work, as neither the
startup code, nor gdb know how to load those sections properly.

Originally added in: eb18cc19cb

The original scripts allowed you to place variables in eeprom space for
reading only.  However, the last toolchain that generated working code
with this linker script was the gcc-arm-none-eabi-4_9-2014q4 release.
Subsequent releases treat the directives differently, and can lose track
of where variables are.  One known symptom is constants getting bad
addresses, so for instance, "printf("asdfad")" will end up passing the
wrong address of the string constant into the eventual _write() call.

This commit removes the problematic directives until a more fully
correct system can be found that more properly follows the linker
script rules.
2016-12-19 11:40:39 +00:00
Karl Palsson 950e064885 stm32l1: flash: avoid duplicate calls to unlock_pecr
Attempts to helpfully unlock PECR when required in unlock_progmem and
unlock_option_bytes actually cause a bus error due to repeated unlocks,
as per ref manual and tedious experience.  The better tested eeprom helper
routines unlock/lock in chunks, but that's not applicable for flash
writing.

Fixes: cf5fb002f6
2016-12-19 11:36:20 +00:00
Karl Palsson 825b51a6a8 usb: dwc_otg: fix missing includes
Went awol merging something :(
(Yes, dwc_otg is theoretically shared with efm and co, but at present
it's still pretty much the stm32 version)

Fixes: 422d708384
2016-11-21 17:27:43 +00:00
Karl Palsson 422d708384 usb: dwc_otg: enable clocks automatically.
ST usbfs-v1, v2, EFM32 USB, lm4f usb all automatically enable the clock
in their _init routine.  Do the same for the dwc_otg drivers to be
consistent.
2016-11-21 17:17:32 +00:00
fenugrec 8c74128ff6 usb: st_usbfs_v2: allow unaligned buffers for st_usbfs_copy_from_pm()
The previous implementation of copy_from_pm assumed the destination buffer
was aligned on a 16-bit boundary. On M0/M0+ cores (stm32F0*, stm32L0*)
this causes a hard fault.
This implementation is from Kuldeep Dhaka's tree; it does a 16-bit copy
only if the destination buffer is aligned, otherwise a bytewise copy.

Fixes GH issues #401, #461
2016-10-01 15:46:38 +00:00
Karl Palsson 9a856960cf usb: st_usbfs_v2: fix documentation on copy_from_pm 2016-10-01 15:15:05 +00:00
Karl Palsson 599dd43190 stm32: adc-v2: fix typo in doxygen link
Missed in rename post review.
2016-09-13 16:34:00 +00:00
Karl Palsson 3add0d2054 stm32f1: drop leftover ethernet files
The f107 ethernet peripheral is the same as in f4, and was pulled out
into lib/ethernet/mac_stm32fxx7.c in 52758bb8fd

This drops the duplicate code.
Fixes Github issue #694
2016-09-12 23:30:53 +00:00
Karl Palsson 9a0b07d4de stm32f1: adc: standardize temperature sensor API
The TSVREFE bit is defined to only be present on ADC1, so drop the
pointless adc argument.  This has the added benefit of making the
API consistent with all other STM32 adc parts.
2016-09-12 23:29:32 +00:00
Karl Palsson cda59c3855 stm32f1: adc: remove confusing "adc_on" function
This is _similar_ to adc_power_on, the common name, but has been marked
deprecated since 2012.
2016-09-12 23:29:28 +00:00
Karl Palsson d035a9cd39 stm32f1: adc: use common api for calibration routines
Use same names as adv-v2 peripheral uses. F1 is the only v1 peripheral
adc that has calibration modes at all.

Old:
	adc_calibration(ADC1);  // blocking call

New (blocking):
	adc_calibrate(ADC1);

New (asynch):
	adc_calibrate_async(ADC1);
	// do stuff
	adc_is_calibrating(ADC1);  // false when calibration finished

Old routines are preserved but marked deprecated for now.
2016-09-12 23:29:21 +00:00
Karl Palsson 23cf491501 stm32: adc-v2: extract common calibration code
Extract the calibration code from the f0, and share it with the other
adc-v2 peripheral users (f0,l0,f3,l4)

Uses the same naming set of is/async naming conventions requested by the
RTOS guys instead of having blocking only calls.

Old code:
	adc_calibrate_start(ADC);
	adc_calibrate_wait_finish(ADC);

New code (blocking):
	adc_calibrate(ADC);

New code (asynch):
	adc_calibrate_async(ADC);
	// do stuff
	adc_is_calibrating(ADC);  // will be false when it's finished.

Old code for f0 is still available, but marked deprecated.
2016-09-12 23:29:12 +00:00
Karl Palsson c2e0afdb05 stm32: adc-v2: don't try and disable adc powered off
As per ref manual, you're not allowed to attempt to disable the ADC if
it's not presently enabled.

Fixes github issue #654
2016-09-09 21:35:18 +00:00
Marcus Hultmark Varejao 6e87892a7e stm32f4: rcc: fix setup of main system clock with pllp
Fixes: 57c2b00a69

There was an issue with the pllp value calculation where the masking was done
in the wrong place. The pllp value was always equivalent to 2 (the bits were
always set to 0b00) which could result in an undesired system clock frequency.
2016-09-02 10:33:27 +02:00
Karl Palsson 6c034c8981 stm32f4: rcc: fix compilation error missed in testing
Fixes: 57c2b00a69

Running make for final sanity failed to catch this due to jobserver
issues.  *fumes*
2016-08-23 22:13:33 +00:00
Chuck McManis 57c2b00a69 stm32f4: rcc: support new plls for new f4 parts
Revise the PLL inits to support new and old PLL configurations,
particularly to support F4x9 devices.

Signed-off-by: Karl Palsson <karlp@tweak.net.au>
2016-08-23 22:02:12 +00:00
Karl Palsson 095ed8511a stm32l1: rcc: reliably clock up/down
When changing the system clock, you must take care to not exceed the
legal ranges based on voltage and flash wait states.

Existing code made it possible to provide a valid clock structure, that
would run out of bounds temporarily.  Some boards would crash with
various Usage faults / Bus errors due to this.
2016-08-19 11:34:46 +00:00
Karl Palsson 0869e15718 stm32f3: adc: drop unimplemented dead code.
These functions have existed since the initial commit, fallout from
copying an existing file and then trying to implement functions as
needed.  F3 ADC doesn't have corresponding functions for some of these,
and this dead code should never have landed.  Dropping it for clarity,
and also to stop confusing doxygen.
2016-08-18 23:55:11 +00:00
Karl Palsson 74b228f3a8 doc: stm32f3: drop duplicate group opening
Just a bad syntax error that slid in somewhere.
2016-08-18 23:54:48 +00:00
Karl Palsson 75011168f7 doc: stm32: fix doxygen syntax
Missing endgroups, some accidental syntax errors/unknown commands.
2016-08-18 23:51:49 +00:00
Karl Palsson 34c3a64177 doc: stm32l power: properly include and document
Was missing group markers.
2016-08-18 23:51:48 +00:00
Karl Palsson 08aac020ad stm32: rcc: provide async routines for osc checks
Start providing async routines for all blocking routines, to make it
easier to use libopencm3 in some RTOS environments.  This is not in
anyway intended to be complete, this just covers a single blocking
routine, rcc_wait_for_osc_ready.  Documentation added to the top level,
and provided for all stm32 families.
2016-08-18 23:41:04 +00:00
Karl Palsson 29277adbe3 [BREAKING] stm32f2: rcc: use correct namespace prefixes for osc
Most other families were fully converted earlier, f2 missed a few.

Fixes: 3a7cbec7
2016-08-18 23:40:52 +00:00
Karl Palsson 90debb9fd7 stm32l1: rcc: Extract msi range function
Include doxygen documentation for arguments.
2016-08-18 23:38:40 +00:00
Karl Palsson 53de290fda atmel samd: Basic framework.
Thoughts: should this be a "sam0" family rather than samd?  (Much like Atmel's
own software package lumps all the cortex-m0+ devices in one family)

This was enough to get a basic blinky working at least.
2016-08-18 22:08:58 +00:00
Daniele Lacamera b9f3f9da49 lm3s: Added linker script for LM3S6965
This is not strictly required, as this part is supported by the
devices.data linker script generator tool.  However, as we're still in
migration for that tool, and this is the first time we're getting proper
lm3s(qemu) support, keep it for now.
2016-08-18 22:08:58 +00:00
Daniele Lacamera 09a66cd6d9 lm3s: Support basic UART + RCC 2016-08-18 22:07:36 +00:00
Eric Kerman 9b642dea2a stm32l0: Add timer support
Signed-off-by: Karl Palsson <karlp@tweak.net.au>
2016-08-15 21:10:07 +00:00
Karl Palsson 614c700edb stm32f0: timers: input capture support rising/falling edges
This is common code for f0234, keep renaming files as has become standard, even
if it's a suboptimal solution.  This doesn't rename the header which was not
renamed for f3.

Reported-by: https://github.com/gtoonstra
2016-08-15 21:10:03 +00:00
Alexandru Gagniuc 6f30e76c61 lm4f: Enable FPU using the vector_chipset hook
Newlib and arm-non-eabi-gcc likes to use the FPU by default on
Cortex-M4F chips. AS a result, do the right thing and enable the FPU
by default.

This fixes issues where code is generated which uses the FPU and
causes the CPU to hard-fault. This change removes the responsibility
of FPU initialization from the application code.

This makes the lm4f consistent with other M4+ devices that enable the
FPU in core library startup code.

Signed-off-by: Karl Palsson <karlp@tweak.net.au>
2016-08-15 20:58:34 +00:00
Chuck McManis b802bd07b2 stm32f4: rcc: support PLL_SAI and PLL_I2S
Adds the missing enums for the extra clocks on stm32f4x9 parts.

Signed-off-by: Karl Palsson <karlp@tweak.net.au>
2016-08-15 20:58:33 +00:00
Karl Palsson 543ac0f23c stm32l1: rcc: drop magic numbers in favour of defines
Use the same mask/shift defines as other families.
2016-08-15 16:13:43 +00:00
Karl Palsson cf7d0a08ca stm32: rcc_wait_for_sysclk_status should actually wait
Original implementation only checked whether the user had _selected_ the
clock, not whether it had actually switched to the clock or not.  For
almost all cases, this made this function either a no-op, if you _had_
selected the clock, or a blocking loop if you hadn't selected it ahead
of time.

Fixes github issue #687
2016-08-15 16:09:58 +00:00
Karl Palsson 781e4d94ba efm32lg: mark internal function as static
Squelches gcc warnings

Fixes github #686
2016-08-15 15:54:55 +00:00
Karl Palsson ff7a6fbfd6 stm32l1: rcc: drop deprecated form of clock enables
Trivial, but removes more users of the old style.
2016-08-15 14:38:10 +00:00
Karl Palsson acda7be167 doc: stm32l1: correct typo in family header 2016-08-15 14:24:16 +00:00
Lukas 18e15c133d gpio: stm32f: Fix function name in example 2016-07-08 22:20:48 +00:00
Urja Rannikko d3fff11c1f stm32/desig: fix/cleanup desig_get_unique_id and to string functionality
This was inspired by an Arch Linux provided ARM GCC 5.3.0 bug:
It gave an
"internal compiler error: in expand_expr_addr_expr_1, at expr.c:7736"
with the array version of the desig_get_unique_id.

While I was at it, fixed:
- a potential alignment issue with casting uint8_t* buf to uint32_t*
- a funny static in the string definition that does nothing (given const)
2016-04-11 22:57:55 +00:00
Josef Gajdusek 28592a7ca3 stm32/f3: Build with desig.c 2016-04-09 17:41:36 +02:00
Tido Klaassen 189396c959 stm32f7: fix build failure when CFLAGS is set
Use TGT_CFLAGS instead of CFLAGS in Makefile. Otherwise build will
abort when CFLAGS is passed to the build process by make option or
environment.
2016-04-08 05:38:12 +02:00
Cem Basoglu 6b5150a4dc stm32: usart-v2: Extended USART functions (data/pin inversion, half duplex)
Includes receive timeout, all inversions and duplex and convenience functions.

Applies for F0 and F3 so far.
2016-04-01 22:49:18 +00:00
Karl Palsson 2c1757d269 Revert "NOUP: stm32f3: rcc: provide async osc checks"
This reverts commit aa5e108553.

This commit was not meant to land yet, it should have gone for review, and
doesn't yet include all the parts it should touch.
2016-03-30 17:38:13 +00:00
Karl Palsson aa5e108553 NOUP: stm32f3: rcc: provide async osc checks
replace bulky hardcoded wait for set and wait for clear with a single asynch
routine.  Leave the blocking routines in for compatibility at this point.

NOUP: should be added to other rcc.c files too.
2016-03-30 16:59:57 +00:00
Karl Palsson 0b84540ecb stm32l4: add common timer code. 2016-03-30 16:59:57 +00:00
benjaminlevine 69a3ba6e2a stm32l4: flash: support basic core operations
Heavily reformatted by: Karl Palsson <karlp@tweak.net.au>
Signed-off-by: Karl Palsson <karlp@tweak.net.au>
2016-03-30 16:59:57 +00:00
Karl Palsson c5b00c3dda stm32l4: rcc: MSI range handling 2016-03-30 16:59:57 +00:00
Karl Palsson 97d644c4d3 stm32l4: rcc: Add core functions
Based on STM32L1, and rather a lot of duplication unfortunately.
2016-03-30 16:59:57 +00:00
benjaminlevine d60fd7ca94 stm32l4: pwr: basic core functionality
Only support for voltage range setting.

Signed-off-by: Karl Palsson <karlp@tweak.net.au>
2016-03-30 16:59:57 +00:00
Karl Palsson f6c7d92c4f stm32l4: enable FPU in chipset specific startup.
Helpful if you don't like seeing:
(gdb) vecstate
HardFault: forced due to escalated or disabled configurable fault (see below)
UsageFault due to access to disabled/absent coprocessor
2016-03-30 16:59:57 +00:00
Karl Palsson 1755098617 stm32: adc-v2: pull up voltage regulator control.
L4 and F3 actually have the same bits to write in the same order, but F3 hides
the name of the deep power down bit.  Keep the like that for now, but there's a
standard API for enabling and disabling the regulator.
2016-03-30 16:59:56 +00:00
Karl Palsson f40e34680b stm32: adc-v2: pull up regular sequence setting.
Uses more standardized naming, fills in some missing defintions, removes some
redundant definitions.
2016-03-30 16:59:56 +00:00
Karl Palsson f9b2ffe8cf stm32l4: adc-v2: enable sampling time setting
Link in the "multi" extensions to the adc-v2 periperhal code.
2016-03-30 16:59:56 +00:00
Karl Palsson 7210522d5c stm32f3: adc-v2: extract sample time settings
adc-v2 "multi" needs per channel sampling time settings.  adc-v2 "single" only
sets the sampling time for all channels.
2016-03-30 16:59:56 +00:00
Karl Palsson 697c975dde stm32l4: adc: Initial support for the adc-v2 periph
Now that there's an adc-v2 peripheral layer, we can just use it straight away
for L4.
2016-03-30 16:59:56 +00:00
Karl Palsson 81319a96fb stm32: adc-v2: pull up start_regular
Little steps are easy to review, and easy to test.
2016-03-30 16:59:56 +00:00
Karl Palsson 5063ea0db7 stm32: adc-v2: pull up overrun and EOC flag methods
EOS vs EOSEQ is really a single/multi variant difference, so leave it out.
2016-03-30 16:59:56 +00:00
Karl Palsson b2af9e632c stm32: adc-v2: Pull up more common basic functionality
Pull up eoc/eos/read_regular functions.  More simple, basic core functionality.
2016-03-30 16:59:56 +00:00
Karl Palsson f1d50d24be stm32: adc-v2: pull up more common functionality
More easy bit on/off settings.  Every piece that gets pulled up here becomes
automatically available for l0/l4 when they land
2016-03-30 16:59:56 +00:00
Karl Palsson 77c0a2058c stm32l0: land adc-v2 peripheral support
Now that the big pieces of the adc-v2 common files are in place, start
including l0 in the builds.  This includes only the very very basic core v2
peripheral functions, and the very basic definitions.
2016-03-30 16:59:56 +00:00
Karl Palsson f67e217ffb stm32: adc-v2: Pull up the two forms of the adc-v2
The adc v2 periph has the same register map, but comes in two flavours, one
supporting injected channels, more watchdogs, per channel sampling times and
so on, and one "simple" version.

Pull up the f3 and f0 portions into the appropriate files, after comparing with
L0 and L4 reference manuals, even if those are not fully landed yet.
2016-03-30 16:59:56 +00:00
Karl Palsson 4c550648c3 stm32: adc-v2: pull up common register definitions 2016-03-30 16:59:56 +00:00
Karl Palsson 1d090c840f stm32: adc-v2: pull up temp/vref switches
Common for f0,f3,l0,l4
2016-03-30 16:59:55 +00:00
Karl Palsson 7231b9a691 stm32: adc-v2: pull up single/continuous modes 2016-03-30 16:59:55 +00:00
Karl Palsson a89cd86454 stm32f0/f3: adc: extract beginnings of common v2 periph
The f0, f30x and l0 have a very similar "v2" adc peripheral.
Start extracting out some of the common code, and fix the glaring bug in
adc_power_down that was affecting them both.

This is not intended to be a fully comprehensive extraction, just the first
easy steps.
2016-03-30 16:59:55 +00:00
Karl Palsson 0758deb04d stm32f3: adc: migrate CFGR -> CFGR1
The adc peripheral on F30x is the same as F0, L0 and L4.  In the reference
manuals, the following names are used.

F3:	 	CFGR  (no CFGR2)
F0 and L0:	CFGR1 and CFGR2
L4:		CFGR and CFGR2

Moving to a single consistent name, that's more likely to be inline with future
part numbers makes it much easier to extract common driver code for the
peripheral.

While all bit defines are moved to the CFGR1 style, core register definitions:
ADC_CFGR(adc) and ADCx_CFGR are kept to match the original register name in the
reference manual.

Fixes Github issue #548
2016-03-30 16:59:55 +00:00
Karl Palsson ca50f069b6 stm32f3: adc: common registers are per master/slave
They're not a single set just based on ADC1.
2016-03-30 16:59:55 +00:00
Karl Palsson 7373d3ad58 stm32f3: adc: support voltage regulator on/off
The "Intermediate" value isn't a value you can do anything with, you need to
clear those bits when making changes.
2016-03-30 16:59:55 +00:00
Karl Palsson 50c056f965 stm32: adc: standardize adc_power_off naming. [BREAKING]
Instead of a mismatch of adc_power_on/adc_off, we now have a matched pair of
adc_power_{on,off}

For some people, this is a breaking change in the API!
2016-03-30 16:59:55 +00:00
Karl Palsson 492a943b7e stm32f0: rcc: No APB1, and no restrictions on APB speed
Improperly copied from F1 code.

Fixes github issue #636
2016-03-15 23:23:56 +00:00
Anatol Pomozov ae41782e1a Fix misspellings using codespell tool 2016-03-08 08:52:54 -08:00
Karl Palsson ba9cb7dc5d minor stylecheck cleanups 2016-02-29 21:30:31 +00:00
fenugrec 410f2dd5a1 STM32 timers: avoid RMW when clearing interrupt flags
All defined bits are rc_w0.

The paranoid version of this would write 0 to the reserved bits (0 is the
"reset value"), but this would require knowing which flags are valid on the
actual platform, and adding the corresponding macros.
2016-02-29 20:45:18 +00:00
Karl Palsson eebef01718 stm32f1: remove artificial limit on gpio remap mask
Connectivity line devices have more remaps available, and the existing code was
artificially and needlessly preventing those remaps from being set, even if
defined.

While implementing this, the existing code to handle SWJ remap was found to be
inconsistent with the reference manual and has been fixed.

Fixes github issue #369
2016-02-28 17:53:58 +00:00
Yiyu Zhu 770878e7b4 stm32f3: provide correct ahb frequency 2016-02-17 09:34:35 +00:00
Yiyu Zhu 86d20ef00c stm32l1: provide correct ahb frequency 2016-02-17 09:34:35 +00:00
Yiyu Zhu 05ff0df322 stm32f4: provide correct AHB frequency 2016-02-17 09:34:35 +00:00
Karl Palsson 3777b96cd5 stm32f1: remove duplicate incorrect flash size register
DESIG_FLASH_SIZE is provided for all stm32 parts in desig.h, correctly defined
as 16bits.  Remove the incorrect duplicate definition within the f1 flash
handling code.

Fixes github issues #621
2016-02-16 21:34:17 +00:00
Karl Palsson 6853b7ac5a cortex-m7: fix badly committed incomplete test
Bad merge, bad tests, bad author.

Fixes: 7545a321b0
2016-02-16 10:12:56 +00:00
Karl Palsson 7545a321b0 cortex-m7: improve compiler detection
Recent debian testing and ubuntu 15.10 releases contain a
gcc-arm-none-eabi toolchain that returns 0 for the test with -mcpu and
-fsyntax-only, despite not actually supporting cortex-m7.  They then
failed hard on actual compilation steps.

Use the --help=target output instead. tested with old g-a-e 4.7 and
newer releases.
2016-02-16 09:47:17 +00:00
svo d7f09d1178 usb: Return configuration = 0 in Addressed state.
This is as per USB 2.0 chapter 9 specifications, and
enables passing of USB-IF Chapter 9 tests.
2016-01-27 00:13:05 +00:00
Jean-Philippe Ouellet 1cca117e58 Fix a few comments with logical/bitwise OR reversed. 2016-01-09 20:37:20 +00:00
Ondřej Hruška fb410a403d cm3/sync: Fix broken mutex_trylock()
Fails when the mutex was already locked.

Implemented zyp's fix for broken mutex. If it's 1 (= failure) by default, the function works fine.

irc log for reference
```
<zyp> strex returns 1 if it fails, 0 if it's successful
<zyp> but if the mutex is already locked, line 57 skips the status update and status gets remains at the initial value which means successful, which is wrong
<zyp> changing line 54 to status = 1 should do the trick
```
2016-01-06 14:36:30 +00:00
Piotr Esden-Tempski 5828a77749 [Style] More whitespace fixes. 2015-12-14 23:42:27 +01:00
Karl Palsson 3a7cbec776 stm32l/stm32f: name space standardization [BREAKING]
As done by esden for the F4, remove typedefs and add prefixes to clock enums
This extends this to all stm32 families.

    Let's not hide the fact that these variables are structs/enums.

    We are filling up the namespace badly enough, we should be prefixing as
    much as we can with the module names at least. As users we already run
    often enough in namespace colisions we don't have to make it worse.

    * CLOCK_3V3_xxx enums renamed to RCC_CLOCK_3V3_xxx
    * clock enums (PLL, HSI, HSE ...) prefixed with RCC_
    * scale enum of pwr module prefixed with PWR_
2015-12-14 23:26:42 +01:00
Piotr Esden-Tempski d680be81b5 [stm32f4] Remove rcc typedefs added prefixes to clock related enums.
Let's not hide the fact that these variables are structs/enums.

We are filling up the namespace badly enough, we should be prefixing as
much as we can with the module names at least. As users we already run
often enough in namespace colisions we don't have to make it worse.

* CLOCK_3V3_xxx enums renamed to RCC_CLOCK_3V3_xxx
* clock enums (PLL, HSI, HSE ...) prefixed with RCC_
* scale enum of pwr module prefixed with PWR_
2015-12-14 23:26:32 +01:00
Piotr Esden-Tempski b1049f9a6f [Style] Stylefix sweep over the whole codebase. 2015-12-14 22:57:15 +01:00
Piotr Esden-Tempski 1f6fd11dd9 [Style] Fixed all style errors in the efm32. 2015-12-14 19:30:04 +01:00
Kuldeep Singh Dhaka 77354cb371 Inital support for EFM32LG 2015-12-13 19:56:19 +01:00
Jim Paris 01f08c4638 Remove WEAK from handler prototypes
These prototypes affect functions defined by application code.  Only
the implementations in libopencm3 are supposed to be weak; the
functions in application code should definitely not be.  Otherwise,
you'll end up with two weak symbols being linked together, and
it's luck as to which one the linker picks.
2015-11-24 09:55:27 +00:00
Karl Palsson f14c678ccb stm32l4: add gpio support
Just the basic core common functionality gained for free by being a common
peripheral.  Enough for a miniblink.

Fixes some errors in the GPIO memory map.  ST's naming of AHB2 vs AHB3 is
confusing.
2015-11-13 02:13:31 +00:00
Karl Palsson 8afc983f3e stm32l4: Add RCC definitions
Bring in the core common code, and now that it's used, pull in the common
memorymap
2015-11-13 01:15:17 +00:00
Karl Palsson 507c184456 stm32l4: initial memorymap and vector support
Values from RM0351rev1, with the correction of the duplicate TIM1_CC entry.

Only stub support so far, but this opens up the beginning of build testing.
2015-11-10 23:47:57 +00:00
Nicolas Schodet 9b8d44e8a3 stm32f4: add GPIOJ & GPIOK
They are available on STM32F429 and STM32F439.
2015-11-10 14:27:57 +01:00
Karl Palsson fd100ea6c2 stm32f0: rcc: doxygen update prediv
After adding support to the f3, add missing doxygen support to the f0
equivalent.  This improves things and keeps them consistent until/if they are
pulled out as common code.
2015-11-08 15:36:32 +00:00
Karl Palsson a444aa4476 stm32f3: rcc: Add pll source prediv support
Based on the f0 support, which has identical functionality, but with doxygen
added.  Bits renamed as they are only HSE prediv on some targets, and makes
things more consistent with the f0.

Fixes part of github issue #560
2015-11-08 15:36:32 +00:00
Karl Palsson 489dc5125e stm32f3: rcc: support setting ADC prescalers
If you are in async mode (ADC_CCR.CKMODE == 0) (the reset default) you still
need to set the prescalers before the ADC will actually enable.
2015-11-08 15:36:32 +00:00
Karl Palsson 4d7694b454 stm32f3: rcc: consistent masks for pll multiplier
All other masks consistently used a separate mask/shift define, bring the pll
multiplier function in line, and use the same form as other functions.
2015-11-08 15:36:32 +00:00
Karl Palsson 129a874cf8 stm32f3: rcc: Correct name of pll multiplier helper.
This function was badly copied and pasted from the f4 library, where there are
two functions, rcc_set_main_pll_hsi and rcc_set_main_pll_hse which combine
source, multipliers, dividers and other pll factors.

On F3, (not all of them, but the ones we support now), the function as
implemented has nothing to do with hsi / hse, and instead is simply selecting
the PLL multiplier.
2015-11-08 15:36:32 +00:00
Karl Palsson 10ef294e5d stm32f3: rcc: Set prescalers properly.
Copypasta from f4 rcc code was only modified to shift the result, but not clear
the existing settings properly. Add mask/shift definitions and use them
properly.
2015-11-08 15:36:32 +00:00
Karl Palsson ce9dab2a92 stm32f3: rcc: drop unused "power_save" parameter
Badly copied from F4 rcc code, there's no power save support in the f3 rcc
tree.
2015-11-08 15:36:32 +00:00
Karl Palsson 388138b953 stm32f3: Include at least a single linker script for f3 standard
This is the f3 on the common f3 discovery board.
2015-11-08 15:36:32 +00:00
Karl Palsson 5f2f296047 stm32l1: add l100xc linker script
Less eeprom and ram than l15x series.
2015-11-06 00:05:22 +00:00
Joost Rijneveld 74cd99343b stm32f4: linker scripts: add CCM to F405
The filename has always been wrong, "6" is a temperature grade, but f405 and
f407 are in the same datasheet, and all have the 64k CCM.  Add it to the linker
script.
2015-11-06 00:03:36 +00:00
Karl Palsson ff6cc954b7 stm32: adc: drop non-existant adc_set_single_channel
Was only in the (obviously out of date) documented example and as a
declaration.  No implementations.  Dropping immediately, but documentation
still needs further work.
2015-10-17 01:23:56 +00:00
Karl Palsson caeeed2b0f stm32f7: FPU only single precision on f7 :(
Boo ST.
2015-10-15 12:28:54 +00:00
Frantisek Burian 3ef2c38120 [stm32f7] Add initial support of the family, GPIO support.
Most changes are noise from doxygen.
Readme udpated to explain newer FP_FLAGS for m7
stm32f7 library is skipped if the toolchain doesn't support it yet.
2015-10-15 10:34:28 +00:00
Karl Palsson 2e25d678ba Surround all macro parameters with ()
Followup from c72f3d588a
2015-10-15 01:03:18 +00:00
Karl Palsson 8f06818f03 doc: flash: syntax check parameters
Mostly just cleans up warnings in doxygen, for most purposes the output is
similar enough to have not been noticed.
2015-10-15 00:54:04 +00:00
Karl Palsson 8eb4ae09ea docs: adcv1: update example code 2015-10-15 00:13:45 +00:00
Karl Palsson 3c9e80c6f1 doc: stm32l1: include rcc.c docs 2015-10-15 00:13:25 +00:00
fenugrec c899273c62 usb: Improved comments of USB API
usbd.h: more comments for bmRequestType and bmAttributes bitfield macros
usbd.h: migrated and added API doxyblocks from implementations (*.c)
2015-10-14 20:48:26 +00:00
Antal Szabó f5c9dbdb8d stm32f1: rcc: Fix comments on clock speed. 2015-10-13 15:26:53 +00:00
Tido Klaassen aad8d06c3f make: rename CFLAGS in target Makefiles to TGT_CFLAGS
Renamed every instance of variable CFLAGS in target specific Makefiles
to TGT_CFLAGS to free up CFLAGS for user defined compiler flags.

Added information in README.md about existence and usage of CFLAGS
environment variable in build process.
2015-10-11 19:14:25 +00:00
Karl Palsson 3ed12b6fd9 usb: short control IN might need a ZLP
Control transfers can transfer less than was requested by the host in the
wLength field.  if this short transfer is a multiple of the endpoint's packet
size, a zero length packet must be sent.

Adds tests for a range of control transfer IN requests, and properly supports
this in the core.  Based heavily on work by Kuldeep Dhaka.

See https://github.com/libopencm3/libopencm3/pull/505
and https://github.com/libopencm3/libopencm3/pull/194 for original discussion.

Tested with stm32f4, stm32f103 and stm32l053.
2015-10-11 18:43:11 +00:00
Devan Lai 96fb10b7a8 stm32f0: include desig.o in build. 2015-10-07 10:02:50 +00:00
Karl Palsson 17bc66c46b stm32f4: fmc: Use standard form shift definitions.
It's confusing and unhelpful to use a different style of shift definitions for
bitfields.

Originally reported by "mox-mox" in
https://github.com/libopencm3/libopencm3/pull/467
2015-10-06 01:26:56 +00:00
Karl Palsson f1d8a7ef04 stm32l0: Add USB support via st_usbfs driver. 2015-10-06 00:54:17 +00:00
Robin Kreis add087aafc stm32l0: include desig.c (device electronic signature)
Simple functional peripheral, just needs to be included in the build.
2015-10-06 00:53:51 +00:00
Robin Kreis 112cf5d085 stm32l0: commonize PWR definitions and add to l0 2015-10-06 00:53:51 +00:00
Karl Palsson 29ede503f3 stm32l0: rcc: add more helper routines. 2015-10-06 00:53:51 +00:00
Karl Palsson 63cfc6932a stm32l0: Add Clock Recovery System to build 2015-10-06 00:53:02 +00:00
Karl Palsson d67aec1cc8 stm32: Clock Recovery System is a common peripheral.
Pull it out of the F0 directory ready to be used by other devices with this
peripheral.
2015-10-06 00:52:39 +00:00
Karl Palsson f5eb96caf3 usb: Add st_usbfs_v2 for f0/l0 devices
Based on previous work, add a new driver for the v2 usb peripheral found on
stm32f0 and l0 devices.

Correspondingly, add a usb gadget zero test suite for the f0.  L0 device level
code isn't yet ready, but will add the test case when it moves in.

Work by Frantisek Burian, Kuldeep
Singh Dhaka, Robin Kreis, fenugrec and zyp on irc, and all those forgotten.
2015-10-03 02:03:58 +00:00
Karl Palsson cffaf1ee60 stm32:f0: Add a common range of ld scripts
a couple from the f03, f04, f05 and f07 ranges, which, while having ST wide
consistent flash size codes, differ in ram amounts.
2015-10-03 01:57:01 +00:00
Karl Palsson b9c3c14d7a usb: core code cannot use bitbanding.
Bitbanding is not available on CortexM0/M0+, so don't use any bitbanding
accesses in core code.
2015-10-03 01:32:46 +00:00
Karl Palsson e121243ce2 usb: extract ST USB FS peripheral core. [BREAKING CHANGE]
The breaking changes here changes in header location, and changes in driver
name passed down to the usb stack.

Changes affect: stm32f102/f103, stm32l1, and some f3 parts

* instead of the confusingly generic "usb" use the name "st_usbfs" for the USB
  Full speed peripheral ST provides in a variety of their stm32 products.
  Include directives should change as:
      #include <libopencm3/stm32/usb.h> => <libopencm3/stm32/st_usbfs.h>

* instead of the confusingly specific "f103" name for the driver, use
  "st_usbfs_v1"  [BREAKING_CHANGE]

  Instead of:
    usbd_init(&stm32f103_usb_driver, .....) ==>
    usbd_init(&st_usbfs_v1_usb_driver, .....) ==>

The purpose of these changes is to reduce some confusion around naming, but
primarily to prepare for the "v2" peripheral available on stm32f0/l0 and some
f3 devices.

Work by Frantisek Burian, Kuldeep Singh Dhaka, Robin Kreis, fenugrec and zyp
on irc, and all those forgotten.
2015-10-03 01:32:34 +00:00
Karl Palsson f49cbee683 usb: otg-dev: disable and flush endpoints on reset
Only resetting the fifo memory pointers can result in corrupt data.

Tested on f4 disco board with the gadget0 test suite.
2015-09-22 22:28:02 +00:00
Karl Palsson 53c1d2c8d9 usb: get_configuration should return bConfigurationValue
Rather than the index of the config. This happens to be the same
thing if you have zero based sequential configurations.
2015-09-22 22:28:02 +00:00
Kuldeep Singh Dhaka 7cd7212577 usb: Validate and accept set_configuration properly
Setting the same configuration again should act as a lightweight reset, not be
ignored.  This resulted in data toggle bits not being reset and alternet
settings not being reset.

Further, completely invalid configurations were accepted, when they should have
result in a stall. (Section 9.4.7 of USB 2.0 spec)

fixes Github issue #302

Tested-by: Karl Palsson <karlp@tweak.net.au>
2015-09-22 22:28:02 +00:00
Karl Palsson eb18cc19cb stm32l1: Add eeprom to memory maps
By adding an "eep" memory section, and a NOLOAD step into the linker
scripts, you can now let gcc allocate variables in eeprom for you.
However, as fitting for eeprom, they cannot be initialized, and will not
be loaded at any time.  This simply lets you get place variables in the
eeprom space.

Example:

struct whatever __attribute__((section(".eeprom"))) blah;
struct another __attribute__((section(".eeprom"))) wop;
printf("%#x", &blah); // ==> 0x08080000
printf("%#x", &wop); // ==> 0x08080000 +  sizeof(blah)

You can read directly out of these variables, but need to use the
eeprom_ routines for writing to them.
2015-09-22 22:26:48 +00:00
Karl Palsson 7063e5cdc9 stm32f0: rcc: properly set USB clock source
Missing breaks in switch statement.

Fixes Github issue #524
2015-09-05 16:12:39 +00:00
Karl Palsson 4053bd6e14 stm32f1: add standard ldscripts for medium/high density
We haven't yet moved everything over to any autogenerated linker scripts, so
include more common templates instead of proliferating mountains of them in
every example.
2015-08-31 22:35:23 +00:00
Kuldeep Singh Dhaka e7eb61fe33 usb: Move ti usb_lm4f.c from lm4f/ to usb/
Management of usb code is easier if everything is at one place
2015-08-17 19:07:30 +00:00
Amir Hammad 6357630a90 stm32/usb: otg_fs and otg_hs register definitions
* USB host register definitions added.
* Extracted common register and bitfield definitions
	from 'otg_fs.h' and 'otg_hs.h'
	into new file 'otg_common.h'.
	Modified usb low-level drivers to adopt to new style of bitfields.
* Fixed typo OTG_GOTGIN -> OTG_GOTGINT (according to the datasheet)

Signed-off-by: Amir Hammad <amir.hammad@hotmail.com>
2015-08-16 22:13:53 +00:00
Forrest Voight 4a21730bb6 startup: Explicitly enable STKALIGN for all parts.
SCB.CCR.STKALIGN enables the automatic aligning of the stack pointer to 8 bytes
on interrupt entry.  Per ARM recommendations, and for AAPCS compliance, this
bit should be enabled at all times.  ARMv6M has this hardcoded to 1. Cortex M3
has this broken in rev 0, optional (default off) in rev 1, and optional
(default on) in rev 2 and later. M4(f) has optional (default on) for all
revisions, M7 has hardcoded to 1.

See Section 2.3.3 in ARM document IHI0046B:
http://infocenter.arm.com/help/topic/com.arm.doc.ihi0046b/IHI0046B_ABI_Advisory_1.pdf

To ensure that all parts behave correctly, we make sure that we hardcode the
feature on, for all parts.  While not _required_ for anything other than rev1
cm3, inserting it into the common reset handler ensures no-one gets any
surprises.

Fixes Github issue #516
2015-08-14 01:14:01 +00:00
FrancoisFinfe 7b29caed1a stm32l1:rcc: allow pll source to be HSE.
The existing rcc_clock_setup_pll only allowed HSI as the clock source, even
though the existing clock structure contains pll source variables.

Check this value, and switch to the corresponding clock source, rather than
blindly assuming that we are tryign to operate from HSI.
2015-07-31 05:21:52 +00:00
Karl Palsson a2af34d0e1 stm32f1:rtc: whitespace/style cleanup.
Improperly checked pulls before commiting.  Trivial whitespace only change.
2015-07-31 05:21:46 +00:00
Ken Sarkies 86f3e4a648 stm32:f1:RTC rtc_awake_from_off function originally reset the backup domain.
(probably because the Ref Manual erroneously required it).
This has a naughty side-effect in that unrelated user data in the BD would be wiped.
Replaced this call by clearing the RTC registers to their default values.

Tested with ET-STAMP-STM32 to verify RTC starts from power-on and reset with expected behaviour.
2015-07-31 04:51:07 +00:00
Ken Sarkies d316bbca39 stm32:f1:RTC: Replace direct register access with API calls
Some additional functions added to rcc to support the rtc.
2015-07-31 04:49:56 +00:00
Ken Sarkies 957c5233f4 stm32:f1:RTC: add documentation 2015-07-31 04:48:57 +00:00
Karl Palsson 40cde559a7 stm32: f24: doxygen updates for flash program width.
More doxygen, more better.
2015-07-31 03:51:32 +00:00
Karl Palsson ec15c1ca64 stm32: f24: flash: Make code match documentation
This removes the shift from the defines, and includes them in the helper
function, making the code match the documentation, and following how the
rest of the library commonly operates.

Code using the existing defines will continue to work.
2015-07-31 03:51:25 +00:00
Jorik Jonker 07ee71cf23 stm32f4: rcc: Add 84Mhz, max speed for f401
Basic helpers to at least support common configurations for the f401.

Original submission specified 5 wait states, but the reference manual and other
reviewers all believe that 2ws is sufficient for these modes.

Signed-off-by: Karl Palsson <karlp@tweak.net.au>
2015-07-31 02:25:23 +00:00
Kuldeep Singh Dhaka afefa6888c stm32: usb: Rename USB_DADDR_ENABLE flag per ref manual
Use the standard REG_BIT name from the reference manuals, as specified
in HACKING  All the other bits have the correct naming.
2015-07-29 21:22:32 +00:00
Kuldeep Singh Dhaka 4b892724cf usb: provide typedefs for all the function callbacks.
This makes it easier to read for most people, and makes it substantially
easier to review changes in the function signatures themselves at a
later date.
2015-07-29 13:52:00 +00:00
Karl Palsson b1e495f51a stm32f3: adc: Add support for sequence completion flags
The f3 adc has separate bits for end of conversion and end of sequence.
Support those fully, with the regular enable/disable irq methods, and
the flag checking methods.

Discovered in github bug: #493
2015-07-29 13:28:18 +00:00
Karl Palsson e65140d0d3 stm32f3: adc: remove invalid eoc group methods.
This code was copied from the f4, and blindly modified to make it seem
to work.  The f3 has separate flags for EOC and EOS, it doesn't use a
second bit to configure what the EOC bit does.

Consequently, update the documentation to correctly indicate that the
EOC bits are only set per conversion.

Discovered in github bug: #493
2015-07-29 13:22:17 +00:00
Karl Palsson 42983e2790 stm32f3: adc: Overrun flag is cleared by writing 1
Unlike the ADC peripheral on most other stm32 parts, the bits in the
ADC_ISR register are r_w1, not rc_w0.

Fixes github bug: #493
2015-07-29 13:18:26 +00:00
Karl Palsson 9f8e0ac1ba stm32f3: adc: consistently return flags
No reason to explicitly check against 0.  We just return the flag
directly as a bool in many other places.
2015-07-29 12:57:55 +00:00
Karl Palsson e11b7d5d6d usb: fx07: correctly REBASE for both usb cores.
Regression from 0cc0134f21

When operating on registers in code that is common for both usb cores,
make sure to use the REBASE macros to operate on the correct peripheral.

Reported by: kuldeep
Fixes github issue: #495
2015-07-29 12:46:12 +00:00
Karl Palsson bc212bba45 usb: correctly document return type.
The three existing usb drivers have no possible path that doesn't return
the object here, so I've left that comment, but it is plausible that
future drivers might have some reason that allows failing to init.  We
should strive to avoid that though.

Fixes github issue: #494
2015-07-29 12:37:40 +00:00
Karl Palsson e6e4f1388d usb_f103: fix typo in bad merge for SOF callback.
too many pulls :|
2015-07-15 12:07:45 +00:00
Frantisek Burian 0cc0134f21 usb: Only enable the SOF interrupt if user_callback_sof is given.
Otherwise we get 1 kHz of SOF interrupts even if we don't need them.

Originally reported by Uwe in https://github.com/libopencm3/libopencm3/pull/274
but BuFran provided a reworked implementation.
2015-07-15 00:22:18 +00:00
Frantisek Burian 13004f81ee usb_f103: Clear ISR bit as soon as possible, as for the other IRQs.
Reported by Uwe in https://github.com/libopencm3/libopencm3/pull/274 but
expanded and provided by BuFran finally.
2015-07-15 00:18:57 +00:00
Karl Palsson 3a106dbd10 stm32: spi: add more cross linking documentation 2015-05-25 13:03:23 +00:00
Kuldeep Singh Dhaka c28d7bc187 stm32: spi: Standard mode selection
Allow setting cpol/cpha via standard mode numbers, instead of separate calls
for each bit.
2015-05-25 13:03:20 +00:00
Chuck McManis fb1a365423 stm32: Disable SSOE if slave management is enabled
As called out by flixr, if you want slave select management then
you don't want SSOE active. This turns it off when enable_slave_management
is called.
2015-05-25 01:35:21 +00:00
Chuck McManis f80bff2133 stm32: Fix common case SPI handling
The common case for SPI ports in master mode is that they are not
also running as Slaves some times. For these chips the SSOE bit must
be set (or NSS tied high). Since it is common for people to use a separate
GPIO to select remote slaves and they expect the master to always be the master
this sets that up by default.
2015-05-25 01:34:57 +00:00
Karl Palsson 6d658c20b8 make: use shared DEBUG_FLAGS (-gdb3) by default
-ggdb3 make slightly bigger .elf files, but allows gdb to understand
macros, which libopenocm3 uses somewhat extensively.  Make this the
default, and pull it up to the common base makefile, so it can be easily
substituted.
2015-05-04 13:45:07 +00:00
Karl Palsson a21da3aebf lpc17xx: Optimize for size by default.
This single family had optimization disabled completely, unlike all
other families.  No reason for this.
2015-04-30 16:05:12 +00:00
Karl Palsson 5746fd4d25 stm32: common: Extract MCO source setting
This adds MCO source selection to some targets, and removes and standardizes
the mask/shift usage for all targets.  For devices that support MCO2, this
supports only MCO1.  No attempt has been made to extract MCO prescaler, which
is not available on all F1 and F3.
2015-04-29 01:22:27 +00:00
Felix Held 235734ea42 [sam3] add support for the PIO peripheral of all devices
Add register definitions and access functions.
2015-04-29 01:19:23 +00:00
Felix Held 8a24685d0c [sam3] add basic pmc support
some peripheral ID definitions already added in periph.h were removed
2015-04-29 01:14:17 +00:00
Karl Palsson f473d40038 stm32f0: check correct registers for ready flags
F0 should check the oscillator ready bits in the regular registers, just
like the docs claim, and just like every other stm32, rather than trying
to check for the interrupt flags.

Reported-by: n1b on irc
Signed-off-by: Karl Palsson <karlp@tweak.net.au>
2015-04-21 17:24:23 +00:00
Kuldeep Singh Dhaka 7dbb93c784 usb: fetch endpoint 0 max size from descriptor
Instead of hardcoding.

Fixes #303

Signed-off-by: Karl Palsson <karlp@tweak.net.au>
2015-03-30 18:41:27 +00:00
Andrey Smirnov db58d5ae82 Add provisions to support multiple altsettings
This commit implements the support for one interface to have multiple
altsettings. It also adds hook that user can use to perform actions
when the alsetting switch is performed by host.

Changes:
* For backward compatibility, placed a pointer instead of allocating memory for whole interface struct.
* Always execute callback (even if the current interface alternate-settings matches).
* Multiple configuration support.

Signed-off-by: Kuldeep Singh Dhaka <kuldeepdhaka9@gmail.com>
2015-03-30 00:07:32 +00:00
Piotr Esden-Tempski 5658a4ebcf [stm32f4-ltdc] Style cleanup.
Mainly replaced function like defines with static inline functions.
2015-02-12 19:02:51 -08:00
Piotr Esden-Tempski 8591a5aa20 [stm32-common-i2c] Style fix. 2015-02-05 20:14:29 -08:00
Angus Peart b58ac190bb Fixed unwanted deletions... 2015-02-05 20:11:06 -08:00
Angus Peart 60739968bd STM32F1: Support for I2C_OAR2 (Dual addressing) 2015-02-05 20:11:06 -08:00
Piotr Esden-Tempski 98855af279 Indentation and style fix. 2015-02-05 19:13:49 -08:00
Chuck McManis d7c83348c0 Doxygen fix
Timer docs were a bit out of date just brought them up to date
and added the Quadrature example.
2015-02-05 19:08:25 -08:00
Oliver Meier 276600b511 [stm32f4-ltdc] commented out assertions. will remove them later 2015-02-05 16:44:38 -08:00
Oliver Meier d5112bc9e7 [stm32f4-ltdc] The Makefile change got lost somehow 2015-02-05 16:44:38 -08:00
Oliver Meier eaae7731e9 [stm32f4-ltdc] initial commit 2015-02-05 16:44:38 -08:00
Pavol Rusnak 4b8f6e01ab stm32: f2: Add missing desig.o to Makefile
Basically the same as ad937e00fd but for stm32/f2
2015-01-31 11:24:50 +01:00
Felix Ruess f206fcb57e [stm32] desig: high nibble to hex char first
When converting the uniqute id to a hex string, it seems more sensible to put the higher nibble in the string before the lower nibble.
2015-01-16 19:12:21 +01:00
Daniel Serpell ca41131f97 stm32: f0: Fixes setting of PLL multiplication factor
Really use RCC_CFGR_PLLMUL negated as a mask.

Signed-off-by: Daniel Serpell <daniel.serpell@gmail.com>
2015-01-12 22:44:03 -03:00
Felix Ruess 40d9ffcb6b stm32: f1: fix missing ahb_freq 2014-12-29 19:52:23 +01:00
Felix Ruess 922d8f7079 [usb] fix user_callback_set_config
USB using control callbacks was broken since d6bad27735
Properly check if user usb control callback are registered,
while here make sure user_callback_set_config callback pointers are initialized to NULL.
2014-12-29 17:10:04 +01:00
Karl Palsson 8a15cec6bf stm32: f4: flash: support extended sector ranges
F42xx and F43xx have extended sector ranges.

Reported-by: H2OBrain@irc
2014-12-18 23:29:10 +00:00
Daniel Thompson d3aa579e0a usb: Support for class specific endpoint descriptors.
Extends struct usb_endpoint_descriptor to make it possible to provide
the USB host with class-specific extensions to endpoint descriptors.

The approach taken, based on extra and extralen and removing the sizeof()
from USB_DT_ENDPOINT_SIZE, is identical to the approach used to add
class-specific extensions to interface descriptors. All libopencm3-examples
use the USB_DT_ENDPOINT_SIZE (rather than directly using sizeof) so there
should be no compatibility problems resulting from this change.
2014-12-18 22:50:27 +00:00