Commit Graph

794 Commits

Author SHA1 Message Date
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