diff --git a/drivers/BusIn.h b/drivers/BusIn.h index 80b20d72a1..da3f44545f 100644 --- a/drivers/BusIn.h +++ b/drivers/BusIn.h @@ -106,6 +106,7 @@ public: */ DigitalIn &operator[](int index); +#if !defined(DOXYGEN_ONLY) protected: DigitalIn *_pin[16]; @@ -120,6 +121,7 @@ protected: private: virtual void lock(); virtual void unlock(); +#endif }; } // namespace mbed diff --git a/drivers/BusInOut.h b/drivers/BusInOut.h index 9bb4e995ae..02f62fbf3f 100644 --- a/drivers/BusInOut.h +++ b/drivers/BusInOut.h @@ -83,15 +83,15 @@ public: */ int read(); - /** Set as an output + /** Set all the pins in bus as output */ void output(); - /** Set as an input + /** Set all the pins in bus as an input */ void input(); - /** Set the input pin mode + /** Set the input pin mode for all the pins in bus * * @param pull PullUp, PullDown, PullNone */ @@ -124,7 +124,7 @@ public: * \sa BusInOut::read() */ operator int(); - +#if !defined(DOXYGEN_ONLY) protected: virtual void lock(); virtual void unlock(); @@ -137,6 +137,7 @@ protected: int _nc_mask; PlatformMutex _mutex; +#endif }; } // namespace mbed diff --git a/drivers/BusOut.h b/drivers/BusOut.h index 2f908b65d8..46e21240a7 100644 --- a/drivers/BusOut.h +++ b/drivers/BusOut.h @@ -108,7 +108,7 @@ public: * \sa BusOut::read() */ operator int(); - +#if !defined(DOXYGEN_ONLY) protected: virtual void lock(); virtual void unlock(); @@ -121,6 +121,7 @@ protected: int _nc_mask; PlatformMutex _mutex; +#endif }; } // namespace mbed diff --git a/drivers/FlashIAP.h b/drivers/FlashIAP.h index a33436c0f0..befb45ac23 100644 --- a/drivers/FlashIAP.h +++ b/drivers/FlashIAP.h @@ -138,6 +138,7 @@ public: */ uint8_t get_erase_value() const; +#if !defined(DOXYGEN_ONLY) private: /* Check if address and size are aligned to a sector @@ -151,6 +152,7 @@ private: flash_t _flash; uint8_t *_page_buf; static SingletonPtr _mutex; +#endif }; } /* namespace mbed */ diff --git a/drivers/I2C.h b/drivers/I2C.h index b72c54c13e..daca532ef5 100644 --- a/drivers/I2C.h +++ b/drivers/I2C.h @@ -108,7 +108,7 @@ public: * @param data Pointer to the byte-array to read data in to * @param length Number of bytes to read * @param repeated Repeated start, true - don't send stop at end - * default value is false. + * default value is false. * * @returns * 0 on success (ack), @@ -134,7 +134,7 @@ public: * @param data Pointer to the byte-array data to send * @param length Number of bytes to send * @param repeated Repeated start, true - do not send stop at end - * default value is false. + * default value is false. * * @returns * 0 on success (ack), @@ -188,8 +188,8 @@ public: * @param event The logical OR of events to modify * @param callback The event callback function * @param repeated Repeated start, true - do not send stop at end - * default value is false. - * + * default value is false. + * * @returns Zero if the transfer has started, or -1 if I2C peripheral is busy */ int transfer(int address, const char *tx_buffer, int tx_length, char *rx_buffer, int rx_length, const event_callback_t &callback, int event = I2C_EVENT_TRANSFER_COMPLETE, bool repeated = false); @@ -198,6 +198,7 @@ public: */ void abort_transfer(); +#if !defined(DOXYGEN_ONLY) protected: /** Lock deep sleep only if it is not yet locked */ void lock_deep_sleep(); @@ -211,6 +212,7 @@ protected: DMAUsage _usage; bool _deep_sleep_locked; #endif +#endif #if !defined(DOXYGEN_ONLY) protected: @@ -222,7 +224,6 @@ protected: static SingletonPtr _mutex; PinName _sda; PinName _scl; -#endif private: /** Recover I2C bus, when stuck with SDA low @@ -237,6 +238,7 @@ private: * */ int recover(PinName sda, PinName scl); +#endif }; } // namespace mbed diff --git a/drivers/InterruptManager.h b/drivers/InterruptManager.h index c65fb683e8..6b3c1d086c 100644 --- a/drivers/InterruptManager.h +++ b/drivers/InterruptManager.h @@ -166,6 +166,7 @@ public: "public API of mbed-os and is being removed in the future.") bool remove_handler(pFunctionPointer_t handler, IRQn_Type irq); +#if !defined(DOXYGEN_ONLY) private: InterruptManager(); ~InterruptManager(); @@ -198,6 +199,7 @@ private: CallChain *_chains[NVIC_NUM_VECTORS]; static InterruptManager *_instance; PlatformMutex _mutex; +#endif }; } // namespace mbed diff --git a/drivers/LowPowerTimeout.h b/drivers/LowPowerTimeout.h index 7c9d00e384..561c4a2201 100644 --- a/drivers/LowPowerTimeout.h +++ b/drivers/LowPowerTimeout.h @@ -33,12 +33,13 @@ namespace mbed { * @ingroup drivers */ class LowPowerTimeout : public LowPowerTicker, private NonCopyable { - +#if !defined(DOXYGEN_ONLY) private: virtual void handler(void) { _function.call(); } +#endif }; } diff --git a/drivers/MbedCRC.h b/drivers/MbedCRC.h index f95a645cc3..9c7328bd00 100644 --- a/drivers/MbedCRC.h +++ b/drivers/MbedCRC.h @@ -302,6 +302,7 @@ public: return width; } +#if !defined(DOXYGEN_ONLY) private: uint32_t _initial_value; uint32_t _final_xor; @@ -546,6 +547,7 @@ private: } _mode = (_crc_table != NULL) ? TABLE : BITWISE; } +#endif }; #if defined ( __CC_ARM ) diff --git a/drivers/SPI.h b/drivers/SPI.h index 2fc5388757..10efc7d0aa 100644 --- a/drivers/SPI.h +++ b/drivers/SPI.h @@ -208,6 +208,7 @@ public: */ int set_dma_usage(DMAUsage usage); +#if !defined(DOXYGEN_ONLY) protected: /** SPI interrupt handler. */ @@ -263,8 +264,6 @@ protected: */ void start_transfer(const void *tx_buffer, int tx_length, void *rx_buffer, int rx_length, unsigned char bit_width, const event_callback_t &callback, int event); -#if !defined(DOXYGEN_ONLY) - private: /** Lock deep sleep only if it is not yet locked */ void lock_deep_sleep(); @@ -294,7 +293,6 @@ private: #endif //DEVICE_SPI_ASYNCH #if !defined(DOXYGEN_ONLY) - protected: /* Internal SPI object identifying the resources */ spi_t _spi; diff --git a/drivers/SerialBase.h b/drivers/SerialBase.h index d682db4349..6eca8807ce 100644 --- a/drivers/SerialBase.h +++ b/drivers/SerialBase.h @@ -141,6 +141,7 @@ public: */ void send_break(); +#if !defined(DOXYGEN_ONLY) protected: /** Acquire exclusive access to this serial port @@ -150,7 +151,7 @@ protected: /** Release exclusive access to this serial port */ virtual void unlock(void); - +#endif public: #if DEVICE_SERIAL_FC @@ -235,12 +236,15 @@ public: */ int set_dma_usage_rx(DMAUsage usage); +#if !defined(DOXYGEN_ONLY) protected: void start_read(void *buffer, int buffer_size, char buffer_width, const event_callback_t &callback, int event, unsigned char char_match); void start_write(const void *buffer, int buffer_size, char buffer_width, const event_callback_t &callback, int event); void interrupt_handler_asynch(void); #endif +#endif +#if !defined(DOXYGEN_ONLY) protected: SerialBase(PinName tx, PinName rx, int baud); virtual ~SerialBase(); @@ -259,7 +263,7 @@ protected: serial_t _serial; Callback _irq[IrqCnt]; int _baud; - +#endif }; } // namespace mbed diff --git a/drivers/Timeout.h b/drivers/Timeout.h index 4bb5c66814..f39dcc03d1 100644 --- a/drivers/Timeout.h +++ b/drivers/Timeout.h @@ -56,8 +56,10 @@ namespace mbed { */ class Timeout : public Ticker, private NonCopyable { +#if !defined(DOXYGEN_ONLY) protected: virtual void handler(); +#endif }; } // namespace mbed diff --git a/drivers/TimerEvent.h b/drivers/TimerEvent.h index 3dda439e59..87e2481cf2 100644 --- a/drivers/TimerEvent.h +++ b/drivers/TimerEvent.h @@ -43,6 +43,7 @@ public: */ virtual ~TimerEvent(); +#if !defined(DOXYGEN_ONLY) protected: // The handler called to service the timer event of the derived class virtual void handler() = 0; @@ -77,6 +78,7 @@ protected: ticker_event_t event; const ticker_data_t *_ticker_data; +#endif }; } // namespace mbed diff --git a/targets/TARGET_STM/TARGET_STM32F2/pin_device.h b/targets/TARGET_STM/TARGET_STM32F2/pin_device.h index 6b75ff657a..e263ea750f 100644 --- a/targets/TARGET_STM/TARGET_STM32F2/pin_device.h +++ b/targets/TARGET_STM/TARGET_STM32F2/pin_device.h @@ -32,76 +32,7 @@ #include "cmsis.h" -// when LL is available, below include can be used -// #include "stm32f2xx_ll_gpio.h" -// until then let's define locally the required functions -#define LL_GPIO_PIN_0 GPIO_BSRR_BS0 /*!< Select pin 0 */ -#define LL_GPIO_PIN_1 GPIO_BSRR_BS1 /*!< Select pin 1 */ -#define LL_GPIO_PIN_2 GPIO_BSRR_BS2 /*!< Select pin 2 */ -#define LL_GPIO_PIN_3 GPIO_BSRR_BS3 /*!< Select pin 3 */ -#define LL_GPIO_PIN_4 GPIO_BSRR_BS4 /*!< Select pin 4 */ -#define LL_GPIO_PIN_5 GPIO_BSRR_BS5 /*!< Select pin 5 */ -#define LL_GPIO_PIN_6 GPIO_BSRR_BS6 /*!< Select pin 6 */ -#define LL_GPIO_PIN_7 GPIO_BSRR_BS7 /*!< Select pin 7 */ -#define LL_GPIO_PIN_8 GPIO_BSRR_BS8 /*!< Select pin 8 */ -#define LL_GPIO_PIN_9 GPIO_BSRR_BS9 /*!< Select pin 9 */ -#define LL_GPIO_PIN_10 GPIO_BSRR_BS10 /*!< Select pin 10 */ -#define LL_GPIO_PIN_11 GPIO_BSRR_BS11 /*!< Select pin 11 */ -#define LL_GPIO_PIN_12 GPIO_BSRR_BS12 /*!< Select pin 12 */ -#define LL_GPIO_PIN_13 GPIO_BSRR_BS13 /*!< Select pin 13 */ -#define LL_GPIO_PIN_14 GPIO_BSRR_BS14 /*!< Select pin 14 */ -#define LL_GPIO_PIN_15 GPIO_BSRR_BS15 /*!< Select pin 15 */ - -#define LL_GPIO_MODE_INPUT ((uint32_t)0x00000000U) /*!< Select input mode */ -#define LL_GPIO_MODE_OUTPUT GPIO_MODER_MODE0_0 /*!< Select output mode */ -#define LL_GPIO_MODE_ALTERNATE GPIO_MODER_MODE0_1 /*!< Select alternate function mode */ -#define LL_GPIO_MODE_ANALOG GPIO_MODER_MODE0 /*!< Select analog mode */ - -#define LL_GPIO_OUTPUT_PUSHPULL ((uint32_t)0x00000000U) /*!< Select push-pull as output type */ -#define LL_GPIO_OUTPUT_OPENDRAIN GPIO_OTYPER_OT0 /*!< Select open-drain as output type */ - -#define LL_GPIO_PULL_NO ((uint32_t)0x00000000U) /*!< Select I/O no pull */ -#define LL_GPIO_PULL_UP GPIO_PUPDR_PUPD0_0 /*!< Select I/O pull up */ -#define LL_GPIO_PULL_DOWN GPIO_PUPDR_PUPD0_1 /*!< Select I/O pull down */ - -#define LL_GPIO_SPEED_FREQ_LOW ((uint32_t)0x00000000U) /*!< Select I/O low output speed */ -#define LL_GPIO_SPEED_FREQ_MEDIUM GPIO_OSPEEDER_OSPEEDR0_0 /*!< Select I/O medium output speed */ -#define LL_GPIO_SPEED_FREQ_HIGH GPIO_OSPEEDER_OSPEEDR0_1 /*!< Select I/O fast output speed */ -#define LL_GPIO_SPEED_FREQ_VERY_HIGH GPIO_OSPEEDER_OSPEEDR0 /*!< Select I/O high output speed */ - -__STATIC_INLINE void LL_GPIO_SetAFPin_0_7(GPIO_TypeDef *GPIOx, uint32_t Pin, uint32_t Alternate) -{ - MODIFY_REG(GPIOx->AFR[0], (GPIO_AFRL_AFSEL0 << (POSITION_VAL(Pin) * 4U)), - (Alternate << (POSITION_VAL(Pin) * 4U))); -} - -__STATIC_INLINE void LL_GPIO_SetAFPin_8_15(GPIO_TypeDef *GPIOx, uint32_t Pin, uint32_t Alternate) -{ - MODIFY_REG(GPIOx->AFR[1], (GPIO_AFRH_AFSEL8 << (POSITION_VAL(Pin >> 8U) * 4U)), - (Alternate << (POSITION_VAL(Pin >> 8U) * 4U))); -} -__STATIC_INLINE void LL_GPIO_SetPinMode(GPIO_TypeDef *GPIOx, uint32_t Pin, uint32_t Mode) -{ - MODIFY_REG(GPIOx->MODER, (GPIO_MODER_MODE0 << (POSITION_VAL(Pin) * 2U)), (Mode << (POSITION_VAL(Pin) * 2U))); -} -__STATIC_INLINE uint32_t LL_GPIO_GetPinMode(GPIO_TypeDef *GPIOx, uint32_t Pin) -{ - return (uint32_t)(READ_BIT(GPIOx->MODER, ((Pin * Pin) * GPIO_MODER_MODER0)) / (Pin * Pin)); -} -__STATIC_INLINE void LL_GPIO_SetPinPull(GPIO_TypeDef *GPIOx, uint32_t Pin, uint32_t Pull) -{ - MODIFY_REG(GPIOx->PUPDR, (GPIO_PUPDR_PUPD0 << (POSITION_VAL(Pin) * 2U)), (Pull << (POSITION_VAL(Pin) * 2U))); -} -__STATIC_INLINE void LL_GPIO_SetPinOutputType(GPIO_TypeDef *GPIOx, uint32_t PinMask, uint32_t OutputType) -{ - MODIFY_REG(GPIOx->OTYPER, PinMask, (PinMask * OutputType)); -} -__STATIC_INLINE void LL_GPIO_SetPinSpeed(GPIO_TypeDef *GPIOx, uint32_t Pin, uint32_t Speed) -{ - MODIFY_REG(GPIOx->OSPEEDR, (GPIO_OSPEEDER_OSPEEDR0 << (POSITION_VAL(Pin) * 2U)), - (Speed << (POSITION_VAL(Pin) * 2U))); -} -// Above lines shall be defined in LL when available +#include "stm32f2xx_ll_gpio.h" extern const uint32_t ll_pin_defines[16]; diff --git a/targets/TARGET_STM/TARGET_STM32F4/TARGET_STM32F407xG/device/flash_data.h b/targets/TARGET_STM/TARGET_STM32F4/TARGET_STM32F407xG/device/flash_data.h new file mode 100644 index 0000000000..7b2126163d --- /dev/null +++ b/targets/TARGET_STM/TARGET_STM32F4/TARGET_STM32F407xG/device/flash_data.h @@ -0,0 +1,59 @@ +/* mbed Microcontroller Library + ******************************************************************************* + * Copyright (c) 2016, STMicroelectronics + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of STMicroelectronics nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + ******************************************************************************* + */ +#ifndef MBED_FLASH_DATA_H +#define MBED_FLASH_DATA_H + +#include "device.h" +#include + +#if DEVICE_FLASH + +/* Exported types ------------------------------------------------------------*/ +/* Exported constants --------------------------------------------------------*/ +/* Exported macro ------------------------------------------------------------*/ +/* FLASH SIZE */ +#define FLASH_SIZE (uint32_t) 0x100000 + +/* Base address of the Flash sectors Bank 1 */ +#define ADDR_FLASH_SECTOR_0 ((uint32_t)0x08000000) /* Base @ of Sector 0, 16 Kbytes */ +#define ADDR_FLASH_SECTOR_1 ((uint32_t)0x08004000) /* Base @ of Sector 1, 16 Kbytes */ +#define ADDR_FLASH_SECTOR_2 ((uint32_t)0x08008000) /* Base @ of Sector 2, 16 Kbytes */ +#define ADDR_FLASH_SECTOR_3 ((uint32_t)0x0800C000) /* Base @ of Sector 3, 16 Kbytes */ +#define ADDR_FLASH_SECTOR_4 ((uint32_t)0x08010000) /* Base @ of Sector 4, 64 Kbytes */ +#define ADDR_FLASH_SECTOR_5 ((uint32_t)0x08020000) /* Base @ of Sector 5, 128 Kbytes */ +#define ADDR_FLASH_SECTOR_6 ((uint32_t)0x08040000) /* Base @ of Sector 6, 128 Kbytes */ +#define ADDR_FLASH_SECTOR_7 ((uint32_t)0x08060000) /* Base @ of Sector 7, 128 Kbytes */ +#define ADDR_FLASH_SECTOR_8 ((uint32_t)0x08080000) /* Base @ of Sector 8, 128 Kbytes */ +#define ADDR_FLASH_SECTOR_9 ((uint32_t)0x080A0000) /* Base @ of Sector 9, 128 Kbytes */ +#define ADDR_FLASH_SECTOR_10 ((uint32_t)0x080C0000) /* Base @ of Sector 10, 128 Kbytes */ +#define ADDR_FLASH_SECTOR_11 ((uint32_t)0x080E0000) /* Base @ of Sector 11, 128 Kbytes */ + +#endif +#endif diff --git a/targets/TARGET_STM/TARGET_STM32F4/pin_device.h b/targets/TARGET_STM/TARGET_STM32F4/pin_device.h index b0b62a9530..1224c5e181 100644 --- a/targets/TARGET_STM/TARGET_STM32F4/pin_device.h +++ b/targets/TARGET_STM/TARGET_STM32F4/pin_device.h @@ -32,75 +32,7 @@ #include "cmsis.h" -// when LL is available, below include can be used -// #include "stm32f4xx_ll_gpio.h" -// until then let's define locally the required functions -#define LL_GPIO_PIN_0 GPIO_BSRR_BS_0 /*!< Select pin 0 */ -#define LL_GPIO_PIN_1 GPIO_BSRR_BS_1 /*!< Select pin 1 */ -#define LL_GPIO_PIN_2 GPIO_BSRR_BS_2 /*!< Select pin 2 */ -#define LL_GPIO_PIN_3 GPIO_BSRR_BS_3 /*!< Select pin 3 */ -#define LL_GPIO_PIN_4 GPIO_BSRR_BS_4 /*!< Select pin 4 */ -#define LL_GPIO_PIN_5 GPIO_BSRR_BS_5 /*!< Select pin 5 */ -#define LL_GPIO_PIN_6 GPIO_BSRR_BS_6 /*!< Select pin 6 */ -#define LL_GPIO_PIN_7 GPIO_BSRR_BS_7 /*!< Select pin 7 */ -#define LL_GPIO_PIN_8 GPIO_BSRR_BS_8 /*!< Select pin 8 */ -#define LL_GPIO_PIN_9 GPIO_BSRR_BS_9 /*!< Select pin 9 */ -#define LL_GPIO_PIN_10 GPIO_BSRR_BS_10 /*!< Select pin 10 */ -#define LL_GPIO_PIN_11 GPIO_BSRR_BS_11 /*!< Select pin 11 */ -#define LL_GPIO_PIN_12 GPIO_BSRR_BS_12 /*!< Select pin 12 */ -#define LL_GPIO_PIN_13 GPIO_BSRR_BS_13 /*!< Select pin 13 */ -#define LL_GPIO_PIN_14 GPIO_BSRR_BS_14 /*!< Select pin 14 */ -#define LL_GPIO_PIN_15 GPIO_BSRR_BS_15 /*!< Select pin 15 */ - -#define LL_GPIO_MODE_INPUT ((uint32_t)0x00000000U) /*!< Select input mode */ -#define LL_GPIO_MODE_OUTPUT GPIO_MODER_MODER0_0 /*!< Select output mode */ -#define LL_GPIO_MODE_ALTERNATE GPIO_MODER_MODER0_1 /*!< Select alternate function mode */ -#define LL_GPIO_MODE_ANALOG GPIO_MODER_MODER0 /*!< Select analog mode */ - -#define LL_GPIO_OUTPUT_PUSHPULL ((uint32_t)0x00000000U) /*!< Select push-pull as output type */ -#define LL_GPIO_OUTPUT_OPENDRAIN GPIO_OTYPER_OT_0 /*!< Select open-drain as output type */ - -#define LL_GPIO_PULL_NO ((uint32_t)0x00000000U) /*!< Select I/O no pull */ -#define LL_GPIO_PULL_UP GPIO_PUPDR_PUPDR0_0 /*!< Select I/O pull up */ -#define LL_GPIO_PULL_DOWN GPIO_PUPDR_PUPDR0_1 /*!< Select I/O pull down */ - -#define LL_GPIO_SPEED_FREQ_LOW ((uint32_t)0x00000000U) /*!< Select I/O low output speed */ -#define LL_GPIO_SPEED_FREQ_MEDIUM GPIO_OSPEEDER_OSPEEDR0_0 /*!< Select I/O medium output speed */ -#define LL_GPIO_SPEED_FREQ_HIGH GPIO_OSPEEDER_OSPEEDR0_1 /*!< Select I/O fast output speed */ -#define LL_GPIO_SPEED_FREQ_VERY_HIGH GPIO_OSPEEDER_OSPEEDR0 /*!< Select I/O high output speed */ - -__STATIC_INLINE void LL_GPIO_SetAFPin_0_7(GPIO_TypeDef *GPIOx, uint32_t Pin, uint32_t Alternate) -{ - MODIFY_REG(GPIOx->AFR[0], (0xFU << (POSITION_VAL(Pin) * 4U)), - (Alternate << (POSITION_VAL(Pin) * 4U))); -} -__STATIC_INLINE void LL_GPIO_SetAFPin_8_15(GPIO_TypeDef *GPIOx, uint32_t Pin, uint32_t Alternate) -{ - MODIFY_REG(GPIOx->AFR[1], (0xFU << (POSITION_VAL(Pin >> 8U) * 4U)), - (Alternate << (POSITION_VAL(Pin >> 8U) * 4U))); -} -__STATIC_INLINE void LL_GPIO_SetPinMode(GPIO_TypeDef *GPIOx, uint32_t Pin, uint32_t Mode) -{ - MODIFY_REG(GPIOx->MODER, (GPIO_MODER_MODER0 << (POSITION_VAL(Pin) * 2U)), (Mode << (POSITION_VAL(Pin) * 2U))); -} -__STATIC_INLINE uint32_t LL_GPIO_GetPinMode(GPIO_TypeDef *GPIOx, uint32_t Pin) -{ - return (uint32_t)(READ_BIT(GPIOx->MODER, ((Pin * Pin) * GPIO_MODER_MODER0)) / (Pin * Pin)); -} -__STATIC_INLINE void LL_GPIO_SetPinPull(GPIO_TypeDef *GPIOx, uint32_t Pin, uint32_t Pull) -{ - MODIFY_REG(GPIOx->PUPDR, (GPIO_PUPDR_PUPDR0 << (POSITION_VAL(Pin) * 2U)), (Pull << (POSITION_VAL(Pin) * 2U))); -} -__STATIC_INLINE void LL_GPIO_SetPinOutputType(GPIO_TypeDef *GPIOx, uint32_t PinMask, uint32_t OutputType) -{ - MODIFY_REG(GPIOx->OTYPER, PinMask, (PinMask * OutputType)); -} -__STATIC_INLINE void LL_GPIO_SetPinSpeed(GPIO_TypeDef *GPIOx, uint32_t Pin, uint32_t Speed) -{ - MODIFY_REG(GPIOx->OSPEEDR, (GPIO_OSPEEDER_OSPEEDR0 << (POSITION_VAL(Pin) * 2U)), - (Speed << (POSITION_VAL(Pin) * 2U))); -} -// Above lines shall be defined in LL when available +#include "stm32f4xx_ll_gpio.h" extern const uint32_t ll_pin_defines[16]; diff --git a/targets/TARGET_STM/TARGET_STM32F7/pin_device.h b/targets/TARGET_STM/TARGET_STM32F7/pin_device.h index 0409682715..8f5619175c 100644 --- a/targets/TARGET_STM/TARGET_STM32F7/pin_device.h +++ b/targets/TARGET_STM/TARGET_STM32F7/pin_device.h @@ -32,77 +32,7 @@ #include "cmsis.h" -// when LL is available, below include can be used -// #include "stm32f7xx_ll_gpio.h" -// until then let's define locally the required functions -#define LL_GPIO_PIN_0 GPIO_BSRR_BS_0 /*!< Select pin 0 */ -#define LL_GPIO_PIN_1 GPIO_BSRR_BS_1 /*!< Select pin 1 */ -#define LL_GPIO_PIN_2 GPIO_BSRR_BS_2 /*!< Select pin 2 */ -#define LL_GPIO_PIN_3 GPIO_BSRR_BS_3 /*!< Select pin 3 */ -#define LL_GPIO_PIN_4 GPIO_BSRR_BS_4 /*!< Select pin 4 */ -#define LL_GPIO_PIN_5 GPIO_BSRR_BS_5 /*!< Select pin 5 */ -#define LL_GPIO_PIN_6 GPIO_BSRR_BS_6 /*!< Select pin 6 */ -#define LL_GPIO_PIN_7 GPIO_BSRR_BS_7 /*!< Select pin 7 */ -#define LL_GPIO_PIN_8 GPIO_BSRR_BS_8 /*!< Select pin 8 */ -#define LL_GPIO_PIN_9 GPIO_BSRR_BS_9 /*!< Select pin 9 */ -#define LL_GPIO_PIN_10 GPIO_BSRR_BS_10 /*!< Select pin 10 */ -#define LL_GPIO_PIN_11 GPIO_BSRR_BS_11 /*!< Select pin 11 */ -#define LL_GPIO_PIN_12 GPIO_BSRR_BS_12 /*!< Select pin 12 */ -#define LL_GPIO_PIN_13 GPIO_BSRR_BS_13 /*!< Select pin 13 */ -#define LL_GPIO_PIN_14 GPIO_BSRR_BS_14 /*!< Select pin 14 */ -#define LL_GPIO_PIN_15 GPIO_BSRR_BS_15 /*!< Select pin 15 */ - -#define LL_GPIO_MODE_INPUT ((uint32_t)0x00000000U) /*!< Select input mode */ -#define LL_GPIO_MODE_OUTPUT GPIO_MODER_MODER0_0 /*!< Select output mode */ -#define LL_GPIO_MODE_ALTERNATE GPIO_MODER_MODER0_1 /*!< Select alternate function mode */ -#define LL_GPIO_MODE_ANALOG GPIO_MODER_MODER0 /*!< Select analog mode */ - -#define LL_GPIO_OUTPUT_PUSHPULL ((uint32_t)0x00000000U) /*!< Select push-pull as output type */ -#define LL_GPIO_OUTPUT_OPENDRAIN GPIO_OTYPER_OT_0 /*!< Select open-drain as output type */ - -#define LL_GPIO_PULL_NO ((uint32_t)0x00000000U) /*!< Select I/O no pull */ -#define LL_GPIO_PULL_UP GPIO_PUPDR_PUPDR0_0 /*!< Select I/O pull up */ -#define LL_GPIO_PULL_DOWN GPIO_PUPDR_PUPDR0_1 /*!< Select I/O pull down */ - -#define LL_GPIO_SPEED_FREQ_LOW ((uint32_t)0x00000000U) /*!< Select I/O low output speed */ -#define LL_GPIO_SPEED_FREQ_MEDIUM GPIO_OSPEEDER_OSPEEDR0_0 /*!< Select I/O medium output speed */ -#define LL_GPIO_SPEED_FREQ_HIGH GPIO_OSPEEDER_OSPEEDR0_1 /*!< Select I/O fast output speed */ -#define LL_GPIO_SPEED_FREQ_VERY_HIGH GPIO_OSPEEDER_OSPEEDR0 /*!< Select I/O high output speed */ - - -__STATIC_INLINE void LL_GPIO_SetAFPin_0_7(GPIO_TypeDef *GPIOx, uint32_t Pin, uint32_t Alternate) -{ - MODIFY_REG(GPIOx->AFR[0], (0xFU << (POSITION_VAL(Pin) * 4U)), - (Alternate << (POSITION_VAL(Pin) * 4U))); -} - -__STATIC_INLINE void LL_GPIO_SetAFPin_8_15(GPIO_TypeDef *GPIOx, uint32_t Pin, uint32_t Alternate) -{ - MODIFY_REG(GPIOx->AFR[1], (0xFU << (POSITION_VAL(Pin >> 8U) * 4U)), - (Alternate << (POSITION_VAL(Pin >> 8U) * 4U))); -} -__STATIC_INLINE void LL_GPIO_SetPinMode(GPIO_TypeDef *GPIOx, uint32_t Pin, uint32_t Mode) -{ - MODIFY_REG(GPIOx->MODER, (GPIO_MODER_MODER0 << (POSITION_VAL(Pin) * 2U)), (Mode << (POSITION_VAL(Pin) * 2U))); -} -__STATIC_INLINE uint32_t LL_GPIO_GetPinMode(GPIO_TypeDef *GPIOx, uint32_t Pin) -{ - return (uint32_t)(READ_BIT(GPIOx->MODER, ((Pin * Pin) * GPIO_MODER_MODER0)) / (Pin * Pin)); -} -__STATIC_INLINE void LL_GPIO_SetPinPull(GPIO_TypeDef *GPIOx, uint32_t Pin, uint32_t Pull) -{ - MODIFY_REG(GPIOx->PUPDR, (GPIO_PUPDR_PUPDR0 << (POSITION_VAL(Pin) * 2U)), (Pull << (POSITION_VAL(Pin) * 2U))); -} -__STATIC_INLINE void LL_GPIO_SetPinOutputType(GPIO_TypeDef *GPIOx, uint32_t PinMask, uint32_t OutputType) -{ - MODIFY_REG(GPIOx->OTYPER, PinMask, (PinMask * OutputType)); -} -__STATIC_INLINE void LL_GPIO_SetPinSpeed(GPIO_TypeDef *GPIOx, uint32_t Pin, uint32_t Speed) -{ - MODIFY_REG(GPIOx->OSPEEDR, (GPIO_OSPEEDER_OSPEEDR0 << (POSITION_VAL(Pin) * 2U)), - (Speed << (POSITION_VAL(Pin) * 2U))); -} -// Above lines shall be defined in LL when available +#include "stm32f7xx_ll_gpio.h" extern const uint32_t ll_pin_defines[16]; diff --git a/targets/targets.json b/targets/targets.json index c2e0d1a2e5..07fc252fb3 100644 --- a/targets/targets.json +++ b/targets/targets.json @@ -1810,7 +1810,7 @@ "supported_toolchains": ["ARM", "uARM", "GCC_ARM"], "program_cycle_s": 2, "extra_labels_add": ["STM32F4", "STM32F407", "STM32F407xG", "STM32F407VG"], - "device_has_add": ["ANALOGOUT", "TRNG"], + "device_has_add": ["ANALOGOUT", "TRNG", "FLASH"], "release_versions": ["2"], "device_name": "STM32F407VG" }, @@ -1922,7 +1922,7 @@ }, "macros_add": ["USB_STM_HAL"], "overrides": {"lse_available": 0}, - "device_has_add": ["ANALOGOUT", "TRNG"], + "device_has_add": ["ANALOGOUT", "TRNG", "FLASH"], "release_versions": ["2", "5"], "device_name": "STM32F407VG" }, diff --git a/tools/toolchains/__init__.py b/tools/toolchains/__init__.py index dbb177e2f7..9a200e8088 100644 --- a/tools/toolchains/__init__.py +++ b/tools/toolchains/__init__.py @@ -331,7 +331,7 @@ class mbedToolchain: """Generate a via file for all includes. ARM, GCC, IAR cross compatible """ - cmd_list = ("-I{}".format(c.replace("\\", "/")) for c in includes if c) + cmd_list = ("\"-I{}\"".format(c.replace("\\", "/")) for c in includes if c) if self.CHROOT: cmd_list = (c.replace(self.CHROOT, '') for c in cmd_list) return self.make_option_file(list(cmd_list), naming=".includes_{}.txt")