Commit Graph

10712 Commits

Author SHA1 Message Date
Dmitriy Linikov
ef1ca963a5 Merged in hardlulz/modem-3.0-nuttx/fix-stm32_dmacapable-on-f20xx (pull request #522)
Fix stm32 dmacapable on f20xx

* Fixed build for STM32F20XX platforms when CONFIG_STM32_DMACAPABLE is enabled

* Fixed build for STM32F20XX platforms when CONFIG_STM32_DMACAPABLE is enabled

Approved-by: Gregory Nutt <gnutt@nuttx.org>
2017-10-30 19:20:52 +00:00
Dmitriy Linikov
73082f7513 STM32 ADC: Added support for ADC's IO_ENABLE_TEMPER_VOLT_CH ioctl on STM32F10XX and STM32F20XX 2017-10-30 06:21:48 -06:00
Mateusz Szafoni
e3bb78a881 Merged in raiden00/nuttx (pull request #520)
Master

* stm32: add ADC DMA support to STM32F33 configuration

* stm32f33xxx_adc.c: fix compilation if no DMA

* nucleo-f334r8: eliminate warning

* nucleo-f334r8: add highpri example configuration

Approved-by: Gregory Nutt <gnutt@nuttx.org>
2017-10-28 14:29:07 +00:00
Jussi Kivilinna
bcf4a5d056 Merged in jussi_kivilinna/nuttx/stm32l4_i2c_rewrite (pull request #519)
Port STM32F7 I2C driver to STM32L4

* arch/stm32l4: port STM32F7 I2C driver to STM32L4

    STM32L4 I2C driver is in work-in-progress state (plentiful of
    TODOs and #warnings) and lags many features found in more
    up-to-date STM32 I2C drivers. The peripheral on STM32F7 and
    STM32L4 are identical except for L4's 'wakeup from stop mode'
    flag and STM32F7's I2C driver is in more 'ready to use' state.

    Patch ports the STM32F7 I2C driver to STM32L4. The I2C clock
    configuration is kept the same as before (I2CCLK = PCLK1 80 Mhz)
    instead of switching to STM32F7 arch default that is I2CCLK=HSI.
    Further work would be to add configuration option for choosing
    I2C clock source instead of current hard-coded default.

* arch/arm/stm32f7: i2c: restore bus frequency after I2C reset

    Copy frequency restoration fix from STM32L4 I2C driver to STM32F7 I2C driver.

* arch/arm/stm32f7: i2c: remove unused Kconfig option

* configs/nucleo-l496zg/nsh: enable I2C4 bus with i2ctool

Approved-by: Gregory Nutt <gnutt@nuttx.org>
2017-10-26 13:59:20 +00:00
Jussi Kivilinna
45fdad5055 arch/arm/common/up_checkstack: fix assert panic when both TLS and interrupt stack are enable 2017-10-23 12:02:20 -06:00
Mateusz Szafoni
9105ac3e98 Merged in raiden00/nuttx (pull request #516)
Master

* stm32_hrtim: fix warnings related with RCC

* stm32f33xxx_adc: add some publicly visable interfaces and some code to support injected channels

* stm32f33xxx_dma: add public interface to handle with DMA interrupts

* stm32_hrtim: change some names and add some coments

* chip/stm32f33xxx_adc.h: cosmetics

* nucleo-f334r8: add logic for zero latency high priority interrupts example

* stm32: update some ADC-related configuration in Kconfig

Approved-by: Gregory Nutt <gnutt@nuttx.org>
2017-10-22 15:46:13 +00:00
Mateusz Szafoni
704ad2faeb Merged in raiden00/nuttx (pull request #515)
stm32_adc.c: clear pending interrupts

Approved-by: Gregory Nutt <gnutt@nuttx.org>
2017-10-20 17:15:48 +00:00
Juha Niskanen
9653255cff Merged in juniskane/nuttx_stm32l4/stm32l1_stm32l4_rtc_update_pr (pull request #514)
STM32L1, STM32L4 RTC: add periodic interrupts, update L1 RTC implementation

* STM32L4 RTC: add support experimental CONFIG_RTC_PERIODIC

* STM32 RTC: separate STM32L1 RTC into a separate file

    STM32L1 RTC is very close to F4 or L4 versions, with two alarms
    and periodic wakeup support so backported L4 peripheral to L1.

* RTC: add periodic alarms to upper and lower halves

Approved-by: Gregory Nutt <gnutt@nuttx.org>
2017-10-20 17:15:17 +00:00
Jussi Kivilinna
b87739d174 arch/arm/src/stm32f7/i2c: fix I2C_M_NORESTART handling 2017-10-20 08:41:42 -06:00
Mateusz Szafoni
09f3e9ce5c Merged in raiden00/nuttx (pull request #513)
Master

* stm32f33xxx_adc.c: fix some warnings and compilation error when extsel not in use

* nucleo-f334r8/adc: change serial console to USART2 (STLINK COM)

Approved-by: Gregory Nutt <gnutt@nuttx.org>
2017-10-19 20:07:04 +00:00
Gregory Nutt
ffca71b9bf Alexey T, Bitbuck Issue 73:
Lower part of STM32 CAN driver arch/arm/src/stm32/stm32_can.c uses all three hw tx mailboxes and clears TXFP bit in the CAN_MCR register (it means transmission order is defined by identifier and mailbox number).

This creates situation when order frames are put in upper part of CAN driver (via can_write) and order frames are sent on bus can be different (and I experience this in wild).

Since CAN driver API pretends to be "file like" I expect data to be read from fd the same order it is written. So I consider described behaviour to be a bug.

I propose either to set TXFP bit in the CAN_MCR register (FIFO transmit order) or to use only one mailbox.
2017-10-19 06:34:54 -06:00
Gregory Nutt
9b5f56ba5b BCM2708: The PiZero configuration now compiles and links cleanly. Still a few thngs missing internally. 2017-10-18 14:07:52 -06:00
Gregory Nutt
e18e8573d1 BCM2708: Allow pass parameters with AUX interrupts; Add mini-UART break capability. 2017-10-18 13:57:54 -06:00
Gregory Nutt
bcff0543f9 BCM2708: Add a little more Mini-UART logic. Still missing UART configuration logic. 2017-10-18 13:44:32 -06:00
Gregory Nutt
6235e72ce0 BCM2708: Add a little more Mini-UART logic. Still missing UART configuration logic. 2017-10-18 12:50:56 -06:00
Gregory Nutt
25079a9c93 BCM2708: Fleshes out GPIO interrupt logic. 2017-10-18 10:13:10 -06:00
Gregory Nutt
63b93a9fba BCM2708: Add framework for a Mini-UART driver (incomplete) 2017-10-18 09:17:08 -06:00
Gregory Nutt
3316103efd BCM2708: Add hooks to support both Mini- and PL011 UARTs. 2017-10-18 08:09:24 -06:00
Gregory Nutt
477a8d1aa7 BCM2708: Add support for AUX interrupts. 2017-10-17 17:08:54 -06:00
Gregory Nutt
d160ae8a32 BCM2708: Add some build configuration and support logic for low-level serial otput (unfinished) 2017-10-17 16:26:52 -06:00
Gregory Nutt
851fa7ba85 BCM2708: Fixes off system timer logic for the Pi Zero. 2017-10-17 14:53:11 -06:00
Gregory Nutt
ea23268f34 BCM2708: Add system timer register definitions and a partial implementation of the tickless mode timer. 2017-10-17 13:54:54 -06:00
Juha Niskanen
d101fad026 Merged in juniskane/nuttx_stm32l4/stm32_rtc_small_patches_pr (pull request #511)
Stm32 rtc small patches

* RTC: canceling an alarm marks it as inactive

* STM32L4, STM32F4, STM32F7 RTC: fix reading alarm value that is more than 24h in future

* STM32F0 RTC: fix backup register count in stm32_rtcc.h

    All other STM32: SHIFTR_SUBFS_MASK was correct in STM32F0 only

* STM32L1: use correct EXTI line definitions

Approved-by: Gregory Nutt <gnutt@nuttx.org>
2017-10-17 16:45:48 +00:00
Gregory Nutt
3750da237c BCM2708: Flesh out some GPIO logic. 2017-10-17 10:33:48 -06:00
Gregory Nutt
c810a77cca Add skeleton GPIO C files; Add pinmap file. 2017-10-17 08:58:03 -06:00
Gregory Nutt
0fc8978a90 Pi Zero: Add GPIO module header file. 2017-10-17 07:37:44 -06:00
Gregory Nutt
692d4b3dc6 configs/sim: Update touchscreen driver initialization to use only multiple-user NX server logic. 2017-10-15 12:40:01 -06:00
Mateusz Szafoni
61293cfc4c Merged in raiden00/nuttx (pull request #510)
Initial ADC support for the STM32F33XX

* stm32_adc.h: add JEXTSEL definitions and hrtim trigger configuration

* stm32_adc.c: move STM32F33 ADC logic to a separate file

Approved-by: Gregory Nutt <gnutt@nuttx.org>
2017-10-15 16:29:05 +00:00
Jussi Kivilinna
51ed697de1 stm32f7 BBSRAM: stm32_bbsram: avoid assert in stm32_bbsram_savepanic. If panic happens before stm32_bbsram is initialized, stm32_bbsram_savepanic caused additional assert panic. Function has null pointer check, so drop DEBUGASSERT. 2017-10-13 07:37:51 -06:00
Juha Niskanen
7c815e555c Merged in juniskane/nuttx_stm32l4/stm32l4_rtc_fixes_pr (pull request #509)
STM32L4 small fixes to RTC

* STM32L4 RTC: init mode was never exited because nested locking in rtc_synchwait() disabled backup domain access

* STM32L4 RTC: use backup register magic value instead of INITS bit

    The INITS (bit 4) of RTC_ISR register cannot be used to reliably
    detect backup domain reset. This is because we can operate our
    device without ever initializing the year field in the RTC calendar
    if our application does not care about correct date being set.

    Hardware also clears the bit when RTC date is set back to year 2000:

    nsh> date -s "Jan 01 00:00:00 2001"
    rtc_dumptime: Setting time:
    rtc_dumptime:   tm: 2001-01-01 00:00:00
    rtc_dumpregs: New time setting:
    rtc_dumpregs:       TR: 00000000
    rtc_dumpregs:       DR: 00012101
    rtc_dumpregs:       CR: 00000000
    rtc_dumpregs:      ISR: 00000037
    ...
    nsh> date -s "Jan 01 00:00:00 2000"
    rtc_dumptime: Setting time:
    rtc_dumptime:   tm: 2000-01-01 00:00:00
    rtc_dumpregs: New time setting:
    rtc_dumpregs:       TR: 00000000
    rtc_dumpregs:       DR: 0000c101
    rtc_dumpregs:       CR: 00000000
    rtc_dumpregs:      ISR: 00000027      <--- Bit 4 went missing!
    ...

    This patch allows us to do:

      stm32l4_pmstop(true);

      /* Stop mode disables HSE/HSI/PLL and wake happens with default system
       * clock. So reconfigure clocks early on Stop mode return.
       */

      stm32l4_clockconfig();

    without stm32l4_clockconfig() doing spurious and harmful backup domain
    reset in rcc_resetbkp().

* STM32L4 RTC: put back the SSR race condition workaround

    ST has confirmed that the issue has not been fixed, and that it applies
    to STM32L4 too (was not in errata sheets due to documentation bug)
    See discussion:

    https://community.st.com/thread/43710-issue-with-rtc-maximum-time-resolution

* STM32F4, STM32L4, STM32F7 RTC: add more CONFIG_RTC_NALARMS > 1 to reduce code size

* STM32L4: rename stm32l4_rtcc.c to stm32l4_rtc.c to better match STM32F7

    Cosmetic changes to comments

* STM32, STM32L4, STM32F7 RTC: stray comment and typos in chip/stm32_rtcc.h

* STM32L4 RTC: change maximum alarm time from 24h to one month

Approved-by: Gregory Nutt <gnutt@nuttx.org>
2017-10-13 12:32:33 +00:00
Anthony Merlino
c15b01f32a stm32 SPI: Add missing include required when CONFIG_SPI_CALLBACK is enabled 2017-10-12 11:28:51 -06:00
Gregory Nutt
5350b0f2fe Cosmetic changes related to coding standard. 2017-10-12 09:32:16 -06:00
Manish Kumar Sharma
b12f693b8b arch/arm/src/samv7: Correct an error in RX DMA setup. 2017-10-11 10:54:02 -06:00
Gregory Nutt
eb79a575f6 Fix a few places where there was a semicolon following the 'if' condition, makeing the following logic unconditional. 2017-10-10 14:24:13 -06:00
Gregory Nutt
101eb73014 STM32 Serial: Fix a compilation error introduced in some configurations by a recent PR. 2017-10-10 07:23:55 -06:00
Gregory Nutt
270aa2848a Squashed commit of the following:
BCM2708:  Add enough infrastructrue (more stubs) to get a clean compilation of the Pi Zero configuration (with many undefined things at link time).

    BCM2708:  Add basic interrupt handling logic

    BCM2708: Add interrupt register definitions.

    BCM2708:  Add irq.h header file

    BCM2708/Pi zero:  bcm_boot.c and bcm_memorymap.h now compile.  Added pizero linker script.

    BCM2708/Pi Zero:  Add Make.defs needed to build.

    arch/arm/include/bcm2708, arch/arm/src/bcm2708, configs/pizero:  Add some basic build and configuration logic.

    configs/pizero:  Add some basic structure of the Rasperry Pi Zero port.

    Created directory configs/pizero.  Nothing there now but a README.txt file.

    Add initial boot.c and memorymap.c files
    Author: Alan Carvalho de Assis <acassis@gmail.com>

    Add AUX/UART/SPI registers definition
    Author: Alan Carvalho de Assis <acassis@gmail.com>

    Pizero GPIO registers
    * Initial commit to add GPIO definitions
    * Add remaining GPIO registers definition
    Alan Carvalho de Assis <acassis@gmail.com>

    BCM2708 memory map:  Add VBASE defintions; fix VCSDRAM address per Alan; move all virtual address to the bottom of the file to avoid confusion -- top is all physical address; bottom is all veritural address.

    Add initial memory map to BCM2708/BCM2835
    Alan Carvalho de Assis <acassis@gmail.com>
2017-10-09 13:11:17 -06:00
Gregory Nutt
d0eb182c00 Minor changes from review of last PR 2017-10-09 12:15:05 -06:00
Mateusz Szafoni
6c25f3d142 Merged in raiden00/nuttx (pull request #505)
Master

* power: Add powerled to Kconfig

* stm32_powerled.c: cosmetics

* stm32_hrtim.c: cosmetics

* stm32/Kconfig: add HRTIM configuration and add DAC external trigger configuration

* stm32f334-disco: Add powerled example configuration

Approved-by: Gregory Nutt <gnutt@nuttx.org>
2017-10-09 18:07:09 +00:00
Juha Niskanen
798d03cb3d Merged in juniskane/nuttx_stm32l4/stm32_serial_patches_pr (pull request #504)
Stm32, stm32l4 serial patches

* stm32: serial: add interface to get uart_dev_t by USART number, stm32_serial_get_uart

* stm32: serial: do not stop processing input in SW flow-control mode

* stm32l4: serial: do not stop processing input in SW flow-control mode

* stm32l4: serial: suspend serial for Stop mode

Approved-by: Gregory Nutt <gnutt@nuttx.org>
2017-10-09 16:20:24 +00:00
Gregory Nutt
ecf6dda2c5 Correct recurring typo: semaphore not semapore 2017-10-09 09:57:56 -06:00
Gregory Nutt
3e40460ab8 lpc31xx: Cosmetic changes. 2017-10-08 19:33:05 -06:00
Gregory Nutt
700f1a8e8c Eliminate some warnings found in build testing. 2017-10-08 16:27:17 -06:00
Mateusz Szafoni
e612ae0803 Merged in raiden00/nuttx (pull request #503)
Master

* stm32_hrtim.c: fix burst mode prescaler update

* powerled.h: add fault field to state structure

* stm32f334-disco: add flash mode support for powerled driver + cosmetics

Approved-by: Gregory Nutt <gnutt@nuttx.org>
2017-10-08 19:13:12 +00:00
Gregory Nutt
5b04c25dcd drivers/serial/tcdrain: tcdrain() was recently added to the NuttX C library. But there is a problem. The specification of tcdrain() requires that it be a cancellation point. In order to do this, tcdrain was moved from the C library into the OS and the addition cancellation point hooks were added. In non-FLAT builds, access via system calls is also now supported. 2017-10-06 10:55:36 -06:00
Gregory Nutt
936df1bcb5 Adds new OS internal functions nxsig_sleep() and nxsig_usleep. These differ from the standard sleep() and usleep() in that (1) they don't cause cancellation points, and (2) don't set the errno variable (if applicable). All calls to sleep() and usleep() changed to calls to nxsig_sleep() and nxsig_usleep().
Squashed commit of the following:

    Change all calls to usleep() in the OS proper to calls to nxsig_usleep()

    sched/signal:  Add a new OS internal function nxsig_usleep() that is functionally equivalent to usleep() but does not cause a cancellaption point and does not modify the errno variable.

    sched/signal:  Add a new OS internal function nxsig_sleep() that is functionally equivalent to sleep() but does not cause a cancellaption point.
2017-10-06 10:15:01 -06:00
Gregory Nutt
29b5b3667f sched/semaphore: sem_timedwait() is a cancellation point and, hence, cannot be called from within the OS. Created nxsem_timedwait() that is equivalent but does not modify the errno and does not cause cancellation. All calls to sem_timedwait() change to calls to nxsem_timedwait() in the OS. 2017-10-05 07:24:54 -06:00
Gregory Nutt
9568600ab1 Squashed commit of the following:
This commit backs out most of commit b4747286b1.  That change was added because sem_wait() would sometimes cause cancellation points inappropriated.  But with these recent changes, nxsem_wait() is used instead and it is not a cancellation point.

    In the OS, all calls to sem_wait() changed to nxsem_wait().  nxsem_wait() does not return errors via errno so each place where nxsem_wait() is now called must not examine the errno variable.

    In all OS functions (not libraries), change sem_wait() to nxsem_wait().  This will prevent the OS from creating bogus cancellation points and from modifying the per-task errno variable.

    sched/semaphore:  Add the function nxsem_wait().  This is a new internal OS interface.  It is functionally equivalent to sem_wait() except that (1) it is not a cancellation point, and (2) it does not set the per-thread errno value on return.
2017-10-04 15:22:27 -06:00
Gregory Nutt
42a0796615 Squashed commit of the following:
sched/semaphore:  Add nxsem_post() which is identical to sem_post() except that it never modifies the errno variable.  Changed all references to sem_post in the OS to nxsem_post().

    sched/semaphore:  Add nxsem_destroy() which is identical to sem_destroy() except that it never modifies the errno variable.  Changed all references to sem_destroy() in the OS to nxsem_destroy().

    libc/semaphore and sched/semaphore:  Add nxsem_getprotocol() and nxsem_setprotocola which are identical to sem_getprotocol() and set_setprotocol() except that they never modifies the errno variable.  Changed all references to sem_setprotocol in the OS to nxsem_setprotocol().  sem_getprotocol() was not used in the OS
2017-10-03 15:35:24 -06:00
Gregory Nutt
83cdb0c552 Squashed commit of the following:
libc/semaphore:  Add nxsem_getvalue() which is identical to sem_getvalue() except that it never modifies the errno variable.  Changed all references to sem_getvalue in the OS to nxsem_getvalue().

    sched/semaphore:  Rename all internal private functions from sem_xyz to nxsem_xyz.  The sem_ prefix is (will be) reserved only for the application semaphore interfaces.

    libc/semaphore:  Add nxsem_init() which is identical to sem_init() except that it never modifies the errno variable.  Changed all references to sem_init in the OS to nxsem_init().

    sched/semaphore:  Rename sem_tickwait() to nxsem_tickwait() so that it is clear this is an internal OS function.

    sched/semaphoate:  Rename sem_reset() to nxsem_reset() so that it is clear this is an internal OS function.
2017-10-03 12:52:31 -06:00
Juha Niskanen
2997a49e51 Merged in juniskane/nuttx_stm32l4/stm32l4_rtc_pm_fixes_pr (pull request #502)
STM32L4 RTC, PM: small fixes to subseconds handling, ADC power-management hooks

* STM32L4 ADC: add PM hooks from Motorola MDK

* STM32L4 RTC: add up_rtc_getdatetime_with_subseconds

* STM32 RTC: workaround for potential subseconds race condition

    In all recent STM32 chips reading either RTC_SSR or RTC_TR is supposed to lock
    the values in the higher-order calendar shadow registers until RTC_DR is read.
    However many old chips have in their errata this silicon bug (at least F401xB/C,
    F42xx, F43xx, L15xxE, L15xVD and likely others):

    "When reading the calendar registers with BYPSHAD=0, the RTC_TR and RTC_DR
    registers may not be locked after reading the RTC_SSR register. This happens
    if the read operation is initiated one APB clock period before the shadow
    registers are updated. This can result in a non-consistency of the three
    registers. Similarly, RTC_DR register can be updated after reading the RTC_TR
    register instead of being locked."

* STM32L4 RTC: correct RTC_SSR and RTC_TR read ordering

    In all recent STM32 chips reading either RTC_SSR or RTC_TR is supposed to lock
    the values in the higher-order calendar shadow registers until RTC_DR is read.
    Change the register read ordering to match this and don't keep a workaround
    for a hypothetical race condition (not in any L4 errata, lets for once assume
    ST's silicon works as it is documented...)

* STM32L4 PM: remove useless #ifdefs and old non-L4 STM32 code

Approved-by: Gregory Nutt <gnutt@nuttx.org>
2017-10-03 16:39:51 +00:00