Commit Graph

1041 Commits

Author SHA1 Message Date
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
Daniel Thompson 0b63408260 usb: Prevent memcpy() being called with NULL arguments
If there is no additional iface data then iface->extra is NULL and
iface->extralen is zero. Passing NULL to memcpy is undefined behaviour
even if the length of data to copy is zero. In other words a conforming
(debug) memcpy implementation is permitted to assert(dst && src) without
checking the value of n.

Add an extra branch to avoid this.
2014-12-18 22:50:27 +00:00
Kuldeep Singh Dhaka 342ec6e9e3 [STM32F0] Add support functions for USB clock setup in F072 chips.
There is remaining an issue with PREDIV connected just after clock multiplexer (only F072). This should be fixed in another commit.
2014-12-18 23:43:04 +01:00
Kuldeep Singh Dhaka 331acce4fc [STM32F0] add support of autotrimming HSI to USB SOF frames
Signed-off-by: Frantisek Burian <BuFran@seznam.cz>
2014-12-18 23:43:04 +01:00
Karl Palsson 3974e5f48d ethernet: mac stm32fxx7: Fix style and docs
Rushed commits are bad mkay :)
2014-12-18 22:00:03 +00:00
Frantisek Burian cf6d8d7235 [fix] after phyid addition, the init function should init correct phy. 2014-12-18 21:26:59 +01:00
brabo bb8980efc6 [ETH] Make support of ethernet for F1 family 2014-12-17 23:58:55 +01:00
brabo 9cced2c0b4 [ETH] Phy ID configurable as parameter 2014-12-17 23:40:06 +01:00
Chuck McManis 9ddfcb0e53 Rename rcc_ppre1_frequency and rcc_ppre2_frequency
Rename rcc_ppre1_frequency and rcc_ppre2_frequency to rcc_apb1_frequency and rcc_apb2_frequency
Also add rcc_ahb_frequency (although it is not set correctly in all cases) which will be fixed by
the rcc commits later. Also fixup the only use in the library of these variables, the USART code.

And fix the typos that resulted
Make l1 generic too
2014-12-13 19:49:04 -08:00
brabo 2429159203 ethernet: corrected typo in ethernet/phy_ksz8051mll.c to include setting the speed to 100M in case of 100M Half Duplex 2014-12-14 00:11:51 +01:00
Oliver Meier f52a39cc48 [cm3/sync] mutex_lock now calls mutex_trylock repeatedly 2014-12-11 09:59:22 +00:00
Oliver Meier a2fe6c49a8 [cm3/sync] Add mutex_trylock()
Allows non-blocking use in user code.
2014-12-11 09:58:34 +00:00
Daniel Thompson ad937e00fd stm32/desig: include in f4 library
The code is all there and working but simply isn't being built.
2014-12-07 12:47:19 +01:00
Chuck McManis 99f83eedcd stm32/f0: rcc.c Use common version instead of duplicate code.
Pulls out duplicate calls from f0/rcc.c and uses the common version which
also means that f0 can use rcc_peripheral_enable() now which is in common
but not the old rcc versions.
2014-12-03 11:14:26 +00:00
Karl Palsson f51698fff4 stm32:l0: RCC: add osc_on/osc_off helpers
These are the routines that have custom switch cases, and aren't easy targets
for pulling out.
2014-12-03 11:13:39 +00:00
Karl Palsson 160a644bc6 stm32:l0: Add linker script / memory sizes
Easier to pick a corresponding part.
2014-12-03 11:13:39 +00:00
Karl Palsson 378069091a stm32:l0: Add RCC register definitions
Tested with a miniblink example on the l053 discovery board.

Only register definitions at this stage, no helpers.
Register definitions from RM0367r2, hopefully the biggest
superset of L0 parts.

Signed-off-by: Karl Palsson <karlp@tweak.net.au>
2014-12-03 11:13:39 +00:00
Karl Palsson 2c475a38d5 stm32:l0: Correctly compile as m0+, not m0.
Committed to binutils back in 2012, so even though it has no real impact, it at
least does the right thing for future compilers to make better decisions.

Signed-off-by: Karl Palsson <karlp@tweak.net.au>
2014-11-18 21:50:10 +00:00
Silvio Gissi 1420be5577 lpc17xx: power: basic peripheral power functions and defns 2014-10-27 22:05:36 +00:00
Silvio Gissi 9a79e6036e lpc17xx: trivial: fix description in linker script. 2014-10-27 22:04:54 +00:00
Frantisek Burian f9152eb00a [stm32l0] Initial support for STM32L0 architecture, Add GPIO peripheral 2014-10-15 19:31:41 +02:00
Stefan Agner 7cef59a83f vf6xx: add I/O mux controller
Add I/O mux controller which is required to mux pins according to
their used function. For all pads, the alternative function 0 is
GPIO. For different pin mux function refer to the reference manual.
2014-10-15 19:31:09 +02:00
Stefan Agner 2e1cbcae22 vf6xx: initial GPIO support
This adds GPIO module support. GPIO can be controlled using the GPIO
number as stated in the reference manual, similar to Linux. Also
32-bit access to whole ports is possible. Reading a GPIO is possible
without muxing the pad as GPIO, however writing a GPIO needs the pad
to be muxed as GPIO.
2014-10-15 19:31:09 +02:00
Stefan Agner a1d456521d vf6xx: add UART support
This adds UART support for Vybrid VF6xx. Baud rate is calculated
from IPG clock, which need to be initialized by using the
ccm_calculate_clocks functions. Also clock need to be gated using
the ccm_clock_gate_enable function. Tested with an unitialized
UART with a baud rate of 115200.
2014-10-15 19:31:02 +02:00
Stefan Agner c9857ad52a vf6xx: calculate core clocks
Extend the clock controller module with a function to calculate
core clocks from the current registers settings. On Vybrid, we
assume that the core clocks are setup by the main operating system
running on the Cortex-A5. Nevertheless we need to know their actual
values in order to calculate other clocks or baud rates.

Verified on a Colibri VF61, which calculates following values:
ccm_core_clk: 500210526
ccm_platform_bus_clk: 166736842
ccm_ipg_bus_clk: 83368421
2014-10-15 19:31:02 +02:00
Stefan Agner 511f16e8c7 vf6xx: enable floating-point coprocessor 2014-10-15 19:31:02 +02:00
Stefan Agner 3132ae50cb vf6xx: initial memorymap and clock control module
Add initial memorymap for Vybrid VF6xx module. Also add the clock
control module which allows to control system clocks and enable
clocks of individual pheripherials.
2014-10-15 19:31:02 +02:00
Stefan Agner cc2dc243e5 vf6xx: set vector table to memory
Set Vector Table Offset to memory location of our vector table.
Since we put the whole programm including the vector table into
memory, we need to make use of the Cortex-M4 system control block
Vector Table Offset Register (VTOR).
2014-10-15 19:31:02 +02:00
Stefan Agner 07b7d3e805 vf6xx: initial add of Vybrid VF6xx support
Freescale Vybrid is a familiy of ARM SoC, wheras the VF6xx models
have two cores in one SoC, a Cortex-A5 and a Cortex-M4. This adds
initial support for the Cortex-M4 in the libopencm3 library.

By using two different ram areas (pc_ram and ps_ram) the user can
put the code in a RAM area bounded to the code bus. The data can
be stored in the data area. However, currently the initial values
of for the variables in the data section are stored in the code
section and copied to the ram section by the initialization code
(like it's copied from ROM to RAM on microcontrollers).
2014-10-15 19:31:01 +02:00
Freek van Tienen ac8ac8c64d [f4] Added a 25mhz clock 2014-10-15 17:27:18 +02:00
Karl Palsson 67f4f50a94 stm32: common: fix missing SPI_I2S_BASE rename regression
Fix regresion from 5d4437fe43 where
somehow not all occurrences were replaced.  I could swear it all
compiled when I was working on it :(

Reported-by: Trevor Woerner <trevor.woerner@linaro.org>
2014-10-08 14:32:05 +00:00
Michael Spieler 50dd1c5725 stm32: gpio_toggle: ensure correct state of non-toggled pins. 2014-10-07 12:01:04 +00:00
Stefan Agner 0d5dac515a init: call pre_main before C++ constructors
This moves the platform specific initialization function pre_main
in front of C++ constructors. This is especially necessary for
platforms which need to setup the stack pointer (pre_main itself
is inline, hence no stack needed for this function).
2014-10-07 11:31:36 +00:00
Karl Palsson 4c190a3fa3 stm32: i2c: actually keep bit 14 set as per datasheet.
Old code did three writes, new way actually seems to follow datasheet
properly.
2014-10-07 11:25:02 +00:00
Karl Palsson 5d4437fe43 stm32/spi: Replace all SPIx_I2S_BASE with SPIx_BASE
Latest versions of all reference manuals refer to the address as SPIx_BASE, and
simply name some of the individual registers as SPI_I2SXXXX.  Likewise, the
interrupts are simply SPIx, not SPIx/I2Sx.  Rather than hacking more duplicates
into the F0 and L0 parts where this was turning up, remove the pointless _I2S_
from SPI2/SPI3 and make it all consistent

Compile tested only, with the examples collection.

Signed-off-by: Karl Palsson <karlp@tweak.net.au>

Fixes #331
Fixes #347
2014-10-07 11:21:40 +00:00
Paul Fertser 283d8cc7d2 Makefile: fix build for directories with spaces
When full path of a source directory has spaces in it, that makes
shell and Make split the path, so special treatment is
necessary. Additionally, @F doesn't honour the escaping, so has to be
avoided.

Reported-by: Roman Faizullin <roman@faizullin.info>
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
2014-08-12 12:01:16 +00:00
Karl Palsson 8fa7727b09 stm32f3: drop redundant gpio.c
All methods in this file are in either
* common/gpio_common_all.c
* common/gpio_common_f0234.c

Those other files have better doxygen commentary, this file should never
have been added.
2014-08-10 21:06:38 +00:00
Norbert Braun 884924d598 stm32: timers: fix mixup between TIMx_CCMR1 and TIMx_CCMR2 in timer_set_oc_mode() 2014-08-04 15:38:01 +02:00
Karl Palsson af3389652c stm32: timers: Fix edge polarity setup
The CCxP/CCxNP bits are actually separated by a reserved bit, so the
correct mask is 0xa, (0b1010) not 0x6 (0b0110)

Reported by PyroDevil on the mailinglist
2014-07-15 13:28:02 +00:00
Karl Palsson cf5fb002f6 [l1-flash/eeprom] Add lock/unlock/eeprom helper routines 2014-07-14 17:54:20 +00:00
Franck Jullien d6bad27735 Allow more than one usbd_register_set_config_callback
In a composite device if one want to separate code
for each interface, usbd_register_set_config_callback
can now register more than one callback.

Signed-off-by: Franck Jullien <franck.jullien@gmail.com>
2014-07-14 14:04:58 +02:00
Pavol Rusnak 806ebb18fa add MSC (Mass Storage Class) support 2014-07-03 18:46:55 +02:00
Felix Ruess f6b6d62ec5 [stm32] fix dox for rcc_periph_x
closes #329
2014-06-28 02:40:36 +02:00
Felix Ruess f49c1f264a [stm32] fix i2c_reset
rcc_periph_reset_pulse needs RST_I2Cx instead of RCC_I2Cx as argument
see also #329
2014-06-26 00:05:46 +02:00
Felix Ruess c01f9ee323 [stm32] implement i2c_reset using rcc_periph_reset_pulse
this also adds support for I2C3 in i2c_reset
2014-06-11 12:58:05 +00:00
Karl Palsson b37597f1db stm32/dac: Follow ref-man guidelines on GPIO config
GPIO pins should be configured for Analog IN on virtually all families
to reduce parasitic consumption.

Reported-by: Roger Wolff <R.E.Wolff@BitWizard.nl>
2014-05-19 10:29:11 +00:00
Roger Wolff a99e3a2cd3 stm32/flash: Make comments match reality
Copy/paste commentary with wrong sizes.
2014-05-19 10:21:56 +00:00
Karl Palsson 34ed0a740b sync: use matching #ifdefs in source as in header
Fixes github issue #298
2014-04-04 20:19:37 +00:00
Karl Palsson 5b6e97732b cm0 doesn't support sync operations
So remove the warning, the sync code is already left out of the cm0
builds.

Fixes #291
2014-03-12 09:40:03 +00:00
Nikolay Merinov ec29bd7f48 stm32l1: lcd: Basic LCD configure functions. 2014-03-11 21:44:48 +00:00
Nikolay Merinov 553a14f21d stm32l1: lcd: Define all LCD registers
Define minimal susbet of necessary functions for work with LCD screen.
2014-03-11 21:44:48 +00:00
Frantisek Burian 14f1ac4764 stm32: common: SPI: Fix spi_common_all warning
Fixes #226

This function should be deprecated in the future.
2014-03-11 21:13:03 +00:00
Frantisek Burian bf01d890f6 [STM32F0] Add support for timers.
This commit has been based on kuldeepdhaka's pioneer work, but it was reformatted to apply libopencm3 inclusion tree correctly.

timer_common_all.c now supports new rcc_periph_reset_pulse function for all families.
2014-03-11 16:49:01 +00:00
Rick Kimball f780075d4d add dac support to stm32 f0 2014-03-11 16:40:31 +00:00
Ken Sarkies 7816501dbc Changes to the header includes for all STM32 peripherals
to remove variations, redundancies, add missing, fix errors. All c files
refer only to the dispatch style headers in /include/stm32. Those headers
#include memorymap.h and cm3/common.h. All references to
these are removed from the family specific headers. Ethernet untouched as
it appears incomplete.

Added dummy spi.c for F0/F3. Fix some doxygen anomalies.
2014-03-11 16:40:31 +00:00
Felix Held 0f29fc8b1b [sam3a] apply SRCLIBDIR patch 2014-03-01 18:16:33 +01:00
Frantisek Burian 0d08891c8d [stm32f1] Fix bad RCC_ definitions for issue #77 2014-02-24 18:44:12 +00:00
Felix Held 641fbffe9a [sam3a] add irq table and memory map 2014-02-24 02:32:38 +01:00
R.E. Wolff fbf8c19ea4 stm32: dac: buffer enable bits were inverted. 2014-02-17 15:19:22 +00:00
Frantisek Burian 6de1b50c4e [BUILD] Fix the correct make behavior if compiling inside tree
On linux, the output of CP rule was try to write to / which is - of course, forbidden for write.

This solution adds to each part of lib correct pointer to the root of lib where the libs should be written.

Bug found by Kuldeep Singh Dhaka.
2014-02-12 15:27:03 +00:00
Frantisek Burian fc9a7260c2 [F0] Add new peripheral Clock Recovery Subsystem as defined in RM0091 Rev. 5 2014-02-07 07:46:54 +01:00
Frantisek Burian 55750d5dc6 [F0] Updated RCC module to be compatible wih RM0091 Rev. 5 2014-02-07 07:46:53 +01:00
Felix Held b5d937a00c add memory map and irq table for sam3s and sam3u devices 2014-02-06 23:06:55 +01:00
Frantisek Burian 8d5ad52e0f Fix the stm32f0 evident bugs 2014-02-06 11:23:01 +01:00
Stefan Agner 7681597e42 Use type suffix to avoid warnings
When compiling with all warnings enabled, some defines can lead to
warning due to missing unsigned type suffix:

warning: integer overflow in expression [-Woverflow]

This fix should not affected behavior at all, since calculation with
such overflows lead to the same actual address when writing to that
location. However, it makes the warning disappear and also defines
the right data type for a memory location.
2014-02-06 00:59:39 +01:00
Ken Sarkies 0af6d06eda Deduplication of flash code for STM32F0 and F1.
Extension of code for STM32F1 to allow for dual bank series XL.
Small changes to documentation for F2, F4 and L1 to add a parameter reference.

Tested with STM32F103RBT6
(note: tests show that the PG bit must be cleared after programming, otherwise
a subsequent erase attempt fails. This has been added to flash_program_half_word
for F0 and F1 only. A fix for the other families is not included in this PR.)
2014-02-06 00:52:42 +01:00
Frantisek Burian a4d9a41093 [Style] Don't use editor droppings in files, please. 2014-02-06 00:46:05 +01:00
cmcmanis 07d0076934 Updates for STM32F429 chip
After a few rounds of review, changes are added to support
additional peripherals of the STM32F427/429
2014-02-06 00:41:52 +01:00
Karl Palsson 27bc12de61 stm32: unify bulk of adc convenience functions
This unifies stm32f1, l1, and f4 convenience functions for adc.  The code
should be useable for f2 and f37x as well, but that needs hardware for testing,
and there was no existing implementation. This is the reason for the
"adc_common_v1.c" name, as trying to put all the different families into the
common file name has become too cumbersome.

All of the deprecated routines have been dropped, they've been marked
deprecated for a very long time now, and porting them seemed unnecessary.

This has been tested on f1, l1 and f4 discovery boards, and is based on some
existing l1/f1 unification code from
https://github.com/karlp/libopencm3/tree/rme_l1_master
2014-02-05 10:39:00 +00:00
memeruiz cf21290488 [stm32f3] Moving common f0 an f3 functions together. New init_master function. 2014-02-01 21:11:58 +01:00
Felix Ruess 8782a60b48 [stm32][f1|f3] fix adc_set_injected_sequence 2014-02-01 19:22:17 +01:00
Frantisek Burian 5ba8b10428 Add method to clear the systick value, that is undefined at startup. 2014-01-15 22:37:45 +01:00
Ken Sarkies 3c6e9fd56d Fix a number of top level doxygen issues.
So that the navigation pane works correctly in browsers.
Some additional doc fixes put in where found (but many more still to go).
Added some dummy .c and .h files to bring the associated docs into line.
makefile changed to allow 'make html' as well as 'make doc' (the latter only does html anyway).
2014-01-15 22:19:52 +01:00
Ken Sarkies a54a12e1c9 Documentation added to flash modules for all STM32 families. 2014-01-15 22:09:36 +01:00
Piotr Esden-Tempski a909b5ca9e [Style] Global style fix run. 2014-01-03 01:07:30 +01:00
a1ien 67efedec54 [STM32F2-F4:CRYPTO]Fix hash_set_last_word_valid_bits() 2014-01-02 22:17:46 +01:00
Frantisek Burian d541c14110 [CM3] Systick Add helper function to easily set the desired frequency 2014-01-02 22:09:16 +01:00
BuFran 52758bb8fd [Ethernet] Add support for the ethernet module STM32Fxx7 and Micrel PHY 2014-01-02 22:02:54 +01:00
BuFran 723e1a69bd Better method of reset and clock handling with RCC, support L1, F1, F2, F3, F4 2014-01-02 22:00:11 +01:00
BuFran 6a41e5fccb [GENLINK] Moved linker template source to ld directory 2014-01-02 21:50:02 +01:00
molnarkares f7620ae148 * unnecessary PG bit clearing removed from flash word and half-word programming to improve speed
* missing PG bit set is inserted at word programming
2014-01-02 21:41:33 +01:00
Frantisek Burian db3dc42dd6 [CM3:DWT] Add the file to library build process for each target 2014-01-02 21:25:26 +01:00
Frantisek Burian 7ccc0d053e [CM3] Add register definitions for Debug Watch Trace point.
Add provision functions for the use of CPU counter as a high-resolution timer for code benchmarking purposes
2014-01-02 21:25:26 +01:00
Onno Kortmann fe6b542357 STM32F0: Correctly clear pll source bits. 2013-12-16 19:42:21 +00:00
Onno Kortmann f622437cfb STM32F0: Fix PLL multiplication factor for 48MHz setup
It was set to overclocking configuration!
2013-12-16 19:37:07 +00:00
Onno Kortmann 868d65d872 STM32F0: Turn on PLL clock source when asked to
The STM32F05xxx/06xxx manual describes on p.98 (Sec 7.4.1) the RCC_CR
register, on which it says that bit 24 is the PLLON bit which has to be
enabled before using the PLL. This causes the PLL to be enabled with
rcc_osc_on(PLL).
2013-12-16 19:37:06 +00:00
Karl Palsson 0dce37a4d2 [sam] Eliminate warnings
the usart_enable/usart_disable() methods are for api compatibility with other
parts of libopencm3.
2013-12-16 19:31:23 +00:00
BuFran 6570f6eb07 Fix the order of ADC injected channel list
According to RM0090, page 301, paragraph 11.13.12 Note. (For F4, for F1 and F3 is it in the corresponding manuals)

The JSQR are filled always ending at SQR4 ie for those lists we must set this list:

(A)       ->                               JSQ4 = A,
(A,B)     ->                     JSQ3 = A, JSQ4 = B,
(A,B,C)   ->           JSQ2 = A, JSQ3 = B, JSQ4 = C,
(A,B,C,D) -> JSQ1 = A, JSQ2 = B, JSQ3 = C, JSQ4 = D,

The readed values are in correct order, starting from JDR1:

(A)       -> JDR1 = A,
(A,B)     -> JDR1 = A, JDR2 = B,
(A,B,C)   -> JDR1 = A, JDR2 = B, JDR3 = C,
(A,B,C,D) -> JDR1 = A, JDR2 = B, JDR3 = C, JDR4 = D,
2013-12-04 22:03:23 +00:00
podhrmic dfeeda24ba [timers] Fixed typo
- Bit shift should be 2, not 4 (see the datatsheet - TIMx_CMMR2 register)
2013-11-08 16:00:51 -07:00
Karl Palsson 5cbf5619a1 [stm32] Unify f0/f3 SPI and correct all makefiles
The common code wasn't being included in L1 builds, even though the headers now
included the correct definitions.

This combines the two f0 and f3 spi files, which previously differed only in
the number of spi peripherals defined.

Files were renamed to the full "l1f124" style, not because I like it, but
because it's the convention we have, so it's best to apply it rigourously.

Tested on L1 and F100 boards, compile tested only for others, but the examples
repository all compiles too.  (Though the lack of SPI examples for all
platforms was how this broke in the first place)
2013-11-07 21:50:48 +00:00
Karl Palsson a99f4fb620 [stm32] Use correct offsets for UniqueID bits
STM32L1 has a different set of offsets, not just a different base
address, so we can't have common registers definitions.  Also, out of
F0,F1,F2,F3,F4,L1, only the F1 has the odd note about 2x16bit registers
and 2x32bit registers with one 16bit register marked as "This field
value is also reserved for a future feature."  Therefore, replace the
awkward reading out as multiple words and just copy them in.

F0,F2,F3,F4 were missing definitions altogether.

This does _not_ attempt to address the problem of the mismatched base
addresses for Medium+ and High Density L1 parts.
2013-10-15 11:16:14 +00:00
BuFran 8c8592e2b6 [CM3] Fix the set clksource, found and described by ksarkies. 2013-10-06 19:04:41 +00:00
Karl Palsson 822654b16b [stm32f3] Properly turn on the FPU
The vector chipset file was added, but not included in the dispatcher.
Fixes github issue #201
2013-09-23 14:32:35 +00:00
Pavol Rusnak dbb65d9f5b [stm32f2] fix missing USB symbols 2013-09-14 18:28:48 +00:00
Karl Palsson 5dca8c7973 [stm32-l1] Include f103 usb driver in build.
Tested with the h103 cdcacm demo (originally targetting an F103) on a
custom L1 based board and it enumerates successfully.
2013-09-05 17:35:07 +00:00
Karl Palsson a277abe2c1 [usb-f103] Use the "modern" /rcc include instead of f1.
The f103 usb core should be usable on the l1 as well, and the /f1/rcc
isn't explicitly required anymore.  This is an important change to be
able to share the driver.
2013-09-05 17:35:07 +00:00
BuFran f04d6dd82b [DOXYGEN:STM32F3] fix the conflict strings. 2013-08-24 17:01:28 +02:00
BuFran d63bf5ac64 [STM32F3:doc] Add doxygen documentation page to output 2013-08-22 23:08:52 -07:00
BuFran 65eaad938f [Style] checked and corrected 2013-08-22 22:29:40 -07:00
BuFran e19270b3bf [STM32F0:ADC] Add supporting functions to the module 2013-08-22 17:18:42 -07:00
BuFran 81982916e2 [Doxygen] Add complete documentation page to STM32F0 2013-08-22 17:18:42 -07:00
BuFran efc2489d2c [Stylecheck] Code cleaned to current stylecheck script 2013-08-22 17:18:41 -07:00
BuFran 210a17ec97 [STM32F0:SPI] Add initial support 2013-08-22 17:18:41 -07:00
BuFran 1345a3403c [STM32F0:EXTI] Add prelimnary support of exti, common file now in common directory 2013-08-22 17:18:39 -07:00
BuFran 9f8dd28a5c [STM32F0:COMP] Add preliminary support of module 2013-08-22 17:18:38 -07:00
BuFran 4bb18baa59 [STM32F0:RTC] Renamed common files to be consistent to file naming scheme 2013-08-22 17:18:38 -07:00
BuFran cc4c164ebe [STM32F0:DMA] Renamed common file to meet all supported families, added missing files 2013-08-22 17:18:37 -07:00
BuFran 8b0656459b [STM32F0:DMA] Add initial support 2013-08-22 17:18:37 -07:00
BuFran 62a8aca04a [STM32F0:RTC] Add initial support 2013-08-22 17:18:37 -07:00
BuFran c99be0fb96 [STM32F0:IWDG] Add initial support 2013-08-22 17:18:37 -07:00
BuFran 4e566bf8b1 [STM32F0] Add FP_FLAGS to support #159 2013-08-22 17:18:36 -07:00
BuFran eb7d29e115 [STM32F0:GPIO] File renamed to meet the content 2013-08-22 17:18:36 -07:00
BuFran fc02aa6162 [STM32F0:USART] Add support for USART peripheral 2013-08-22 17:18:36 -07:00
BuFran 18c4d299c1 [STM32F0] Add preliminary support for the family 2013-08-22 17:18:35 -07:00
BuFran e1ebcc9da8 [Cortex] Add preliminary support for core-dependent defines ARMv6m / ARMv7m, ARMv7em 2013-08-22 17:18:35 -07:00
Alexandru Gagniuc 52d34c814b Global: Allow overriding float-abi flags
We currently default to "-mfloat-abi=hard -mfpu=fpv4-sp-d16" for M4F cores, and
and variations of "-mfloat-abi=soft" for the others. Keep the M4F default, and
move others to no FP flags for consistency, but allow overriding these flags
via the FP_FLAGS environment variable.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
2013-07-07 18:59:33 -07:00
Ben Gamari 63d150008a lpc43xx/ssp: Mark ssp_wait_until_not_busy as static 2013-07-07 18:50:51 -07:00
Ben Gamari 5d4f759c92 lpc43xx/timer: Add timer utilities 2013-07-07 18:50:44 -07:00
Ben Gamari bbde1012a3 stm32/f4/adc: Fix set_resolution
I can only imagine the resolution argument was 16 bits due to some cut
and paste error
2013-07-07 17:22:13 -07:00
Alexandru Gagniuc 0819a49411 usb_control: Mark the control pipe as IDLE after a STALL
After a STALL handshake is transmitted, a control pipe becomes idle. Not
marking the pipe as idle did not affect the STM32 family. Since it
distinguishes between OUT and SETUP tokens, it calls the setup handler
on a SETUP token, regardless of the state of the pipe.

Other families, such as LM4F do not distinguish in software between IN and
SETUP tokens, and need to decide which handler to call based on the state
of the pipe. On these chips, SETUP transactions will not be handled
properly after a transfer was STALLED, as the state machine of the pipe is
b0rked. Unb0rk it.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
2013-07-07 17:04:38 -07:00
Dirk Braun ad29d0ce31 [lm4f/usb] fixed lm4f_ep_write_packet() when single byte copied to buffer. 2013-07-07 16:42:02 -07:00
Alexandru Gagniuc 5ea4763845 lm4f: Appease checkpath.pl and de-typedef enums
Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
2013-07-07 16:33:18 -07:00
Piotr Esden-Tempski 337733b5e5 [STM32L1] Fixed compilaion of usart convenience functions. 2013-07-07 16:01:53 -07:00
Piotr Esden-Tempski 7042beaa91 [Stylefix] Removed trailing spaces and added missing braces. 2013-07-07 16:01:52 -07:00
BuFran 68ee13be4b Doxygen style blocks corrected 2013-07-07 16:01:52 -07:00
Piotr Esden-Tempski 62e6635992 [Style] Fixed style in the newly added F3 code. 2013-07-07 16:01:52 -07:00
Piotr Esden-Tempski b6231dbb49 [Style] Do not define types if not necessary. 2013-07-07 16:01:52 -07:00
Piotr Esden-Tempski 7085867db6 [STM32F3] Split timer common f24 into f234 and f24. 2013-07-07 16:01:52 -07:00
Piotr Esden-Tempski 201c2706b5 [STM32] Removed exti.c from f1 and made global exti.c usable.
Because most changes are internal to a function in exti.c I am leaving
the macro checks in there, otherwise we would end up with a bunch of
code duplication if we used the dispatch system used otherwise
throughout the stm32 part of the library. I bet it could be split up
into more granular functions resulting in more generic code that we
could run through the dispatch system. But I am leaving that as an
excersize for later.
2013-07-07 16:01:52 -07:00
Piotr Esden-Tempski 590135b65f [STM32F3] Moved all F3 specific functions out of common. 2013-07-07 16:01:51 -07:00
Piotr Esden-Tempski 18da63879c [STM32] Rename the f0124 files to f124.
We don't support f0 yet so let's not fool anyone. We may rename those
files back again if when we cross check that it is actually true this
file supports f0.
2013-07-07 16:01:51 -07:00
Piotr Esden-Tempski ebb058825f [STM32F3] Removed all specific F3 stuff out of common files. 2013-07-07 16:01:51 -07:00
Piotr Esden-Tempski f8734dfcd3 [STM32F3] Move the f3 specific stuff out of common. 2013-07-07 16:01:50 -07:00
Federico Ruiz Ugalde 60bdf4eebd stm32f3: f1 usb header files moved to stm32 root directory.
- Now the f1 usb header files serve both the f1 and f3.
- usb_f103 modified to find the new headers file location.
2013-07-07 16:01:50 -07:00
Federico Ruiz Ugalde 934c8dbf4c stm32f3: Usb support added. usb unit is the same as f103.
- memorymap value for usb base changed to the one expected by the
  f103 usb code.
- f3 Makefile updated to build the f102 usb code.
2013-07-07 16:01:50 -07:00
Federico Ruiz Ugalde 59b2b5da87 stm32f3: Some additions to rcc.
- Additional frequency configuration (48Mhz, for usb use!)
- FLASH latency decreased (too unnecessarily low before)
- Rcc functions to change usb freq prescaler.
2013-07-07 16:01:50 -07:00
Federico Ruiz Ugalde 011124c33f stm32f3: i2c support increased. Now it works.
- Several functions added (that only work on the f3)
- The data register now has a 8bit access counter part
  that is necessary for 8bit transmissions, together with
  the access functions.
- The init master functions doesn't work for the f3.
2013-07-07 16:01:50 -07:00
Federico Ruiz Ugalde 9b2873d874 stm32f3: Adding convinience functions for sending and receiving i2c data. 2013-07-07 16:01:50 -07:00
Federico Ruiz Ugalde 66eab73570 stm32f3: Some additional f3 clock functions for the i2c. 2013-07-07 16:01:49 -07:00
Federico Ruiz Ugalde 4673348ff7 stm32f3: i2c support now in f3 directory.
Very few functions can be shared (~ 3). A possible solutions is to move
i2c_common_all to i2c_common_f124, create i2c_common_all and move f3/i2c to i2c_common_f3. Who agrees?
2013-07-07 16:01:49 -07:00
Federico Ruiz Ugalde 8f3675fbfd stm32f3: i2c support removed from the i2c_common_all files because f3 is too different. 2013-07-07 16:01:49 -07:00
Federico Ruiz Ugalde e9375dbfd2 usart set baudrate clock source incorrect. Now fixed. 2013-07-07 16:01:49 -07:00
Federico Ruiz Ugalde efe08e4898 stm32f3: flash_common_f24 now includes f3 support. Also, renamed to f234.
- Makefiles of other stm32s updated accordingly.
- f3/rcc.c updated to some definition changes.
- f3/flash.c removed in order to use flash_common_f234.c to comply with new organization.
2013-07-07 16:01:49 -07:00
Federico Ruiz Ugalde 74a313625f stm32f3: timer support added. 2013-07-07 16:01:48 -07:00
Federico Ruiz Ugalde 6af6cec101 stm32f3: dma support added. 2013-07-07 16:01:48 -07:00
Federico Ruiz Ugalde 433c1c9db8 stm32f3: spi support added. 2013-07-07 16:01:48 -07:00
Federico Ruiz Ugalde 5c825a78c7 stm32f3: watchdog support added. 2013-07-07 16:01:48 -07:00
Federico Ruiz Ugalde 6b522fc644 stm32f3: Crc support added. 2013-07-07 16:01:48 -07:00
Federico Ruiz Ugalde ef762f0448 Stm32f3: usart support added. 2013-07-07 16:01:48 -07:00
Federico Ruiz Ugalde 49fe59e82d stm32f3: adding external interrupts support. 2013-07-07 16:01:47 -07:00
Federico Ruiz Ugalde a7bcf6446b stm32f3 dac support added. 2013-07-07 16:01:47 -07:00
Federico Ruiz Ugalde 0a39eab19a Missing files for adc stm32f3 support added. 2013-07-07 16:01:47 -07:00
Federico Ruiz Ugalde 6732ae25cb Adc stm32f3 support added. 2013-07-07 16:01:47 -07:00
Federico Ruiz Ugalde be841154a9 i2c support added.
Most of the changes went to i2c_common_all.h file.
F3 is considerably different than all the other in i2c.
2013-07-07 16:01:47 -07:00
Federico Ruiz Ugalde b6bae46b71 Unnecessary include of pwr.h removed from rcc.c. Pwr.h becomes unnecessary to run the f3 2013-07-07 16:01:47 -07:00
Federico Ruiz Ugalde 934821aa42 Partial flash support added. 2013-07-07 16:01:47 -07:00
Federico Ruiz Ugalde 45035f2f3c Fixed compile warning, function declaration in rcc.h wrong 2013-07-07 16:01:46 -07:00
Federico Ruiz Ugalde 0ca18eb09f Added interrupts for f3, Pre_main rutine in vector_chipset, nvic.h modified to include f3. 2013-07-07 16:01:46 -07:00
Federico Ruiz Ugalde b8764d0214 Makefile for f3 lib added. Gpio.c and rcc.c also in. 2013-07-07 16:01:46 -07:00
Federico Ruiz Ugalde 67c979e5fa Fixed compile of f4 and l1 after gpio_common_f234.c renaming. 2013-07-07 16:01:46 -07:00
Federico Ruiz Ugalde a156b9e8fc linker script file for f3 added. 2013-07-07 16:01:45 -07:00
Federico Ruiz Ugalde 3af5833b83 Initial support for stm32f3. Changes in makefiles, gpio.
- Makefiles now include building f3 src directory.
- Gpio support added. gpio_common_f24 changed to support also f3.
- f3 still not compiling, but f2 compile not broken (probably also f4).
2013-07-07 16:01:45 -07:00
Ben Gamari d7fdcefbd7 lpc43xx: Fix rom_to_ram linker script
It was missing some definitions compared to the libopencm3_lpc43xx.ld.
2013-07-07 18:22:56 -04:00
Piotr Esden-Tempski b72a3640b3 [CM0] Disabled sync for LPC43xx/M0.
We are currently using the same code for CM0 CM3 and CM4 cores. This
patch is a bodge that disables sync on the LPC43xx/M0 core, it would be
nicer to probably implement a dispatch system similar to the one used in
stm32 peripheral support so that we can accomodate the different
features of the cortex cores. I (esden) assume we will run into more
incompatibilities in the future between the cortex cores.
2013-07-07 13:58:00 -07:00
Ben Gamari 11ea9b090c sync: Add comment 2013-07-07 13:52:16 -07:00