mirror of https://github.com/ARMmbed/mbed-os.git
commit
0404701b5f
|
@ -106,6 +106,7 @@ public:
|
||||||
*/
|
*/
|
||||||
DigitalIn &operator[](int index);
|
DigitalIn &operator[](int index);
|
||||||
|
|
||||||
|
#if !defined(DOXYGEN_ONLY)
|
||||||
protected:
|
protected:
|
||||||
DigitalIn *_pin[16];
|
DigitalIn *_pin[16];
|
||||||
|
|
||||||
|
@ -120,6 +121,7 @@ protected:
|
||||||
private:
|
private:
|
||||||
virtual void lock();
|
virtual void lock();
|
||||||
virtual void unlock();
|
virtual void unlock();
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace mbed
|
} // namespace mbed
|
||||||
|
|
|
@ -83,15 +83,15 @@ public:
|
||||||
*/
|
*/
|
||||||
int read();
|
int read();
|
||||||
|
|
||||||
/** Set as an output
|
/** Set all the pins in bus as output
|
||||||
*/
|
*/
|
||||||
void output();
|
void output();
|
||||||
|
|
||||||
/** Set as an input
|
/** Set all the pins in bus as an input
|
||||||
*/
|
*/
|
||||||
void input();
|
void input();
|
||||||
|
|
||||||
/** Set the input pin mode
|
/** Set the input pin mode for all the pins in bus
|
||||||
*
|
*
|
||||||
* @param pull PullUp, PullDown, PullNone
|
* @param pull PullUp, PullDown, PullNone
|
||||||
*/
|
*/
|
||||||
|
@ -124,7 +124,7 @@ public:
|
||||||
* \sa BusInOut::read()
|
* \sa BusInOut::read()
|
||||||
*/
|
*/
|
||||||
operator int();
|
operator int();
|
||||||
|
#if !defined(DOXYGEN_ONLY)
|
||||||
protected:
|
protected:
|
||||||
virtual void lock();
|
virtual void lock();
|
||||||
virtual void unlock();
|
virtual void unlock();
|
||||||
|
@ -137,6 +137,7 @@ protected:
|
||||||
int _nc_mask;
|
int _nc_mask;
|
||||||
|
|
||||||
PlatformMutex _mutex;
|
PlatformMutex _mutex;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace mbed
|
} // namespace mbed
|
||||||
|
|
|
@ -108,7 +108,7 @@ public:
|
||||||
* \sa BusOut::read()
|
* \sa BusOut::read()
|
||||||
*/
|
*/
|
||||||
operator int();
|
operator int();
|
||||||
|
#if !defined(DOXYGEN_ONLY)
|
||||||
protected:
|
protected:
|
||||||
virtual void lock();
|
virtual void lock();
|
||||||
virtual void unlock();
|
virtual void unlock();
|
||||||
|
@ -121,6 +121,7 @@ protected:
|
||||||
int _nc_mask;
|
int _nc_mask;
|
||||||
|
|
||||||
PlatformMutex _mutex;
|
PlatformMutex _mutex;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace mbed
|
} // namespace mbed
|
||||||
|
|
|
@ -138,6 +138,7 @@ public:
|
||||||
*/
|
*/
|
||||||
uint8_t get_erase_value() const;
|
uint8_t get_erase_value() const;
|
||||||
|
|
||||||
|
#if !defined(DOXYGEN_ONLY)
|
||||||
private:
|
private:
|
||||||
|
|
||||||
/* Check if address and size are aligned to a sector
|
/* Check if address and size are aligned to a sector
|
||||||
|
@ -151,6 +152,7 @@ private:
|
||||||
flash_t _flash;
|
flash_t _flash;
|
||||||
uint8_t *_page_buf;
|
uint8_t *_page_buf;
|
||||||
static SingletonPtr<PlatformMutex> _mutex;
|
static SingletonPtr<PlatformMutex> _mutex;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
} /* namespace mbed */
|
} /* namespace mbed */
|
||||||
|
|
|
@ -108,7 +108,7 @@ public:
|
||||||
* @param data Pointer to the byte-array to read data in to
|
* @param data Pointer to the byte-array to read data in to
|
||||||
* @param length Number of bytes to read
|
* @param length Number of bytes to read
|
||||||
* @param repeated Repeated start, true - don't send stop at end
|
* @param repeated Repeated start, true - don't send stop at end
|
||||||
* default value is false.
|
* default value is false.
|
||||||
*
|
*
|
||||||
* @returns
|
* @returns
|
||||||
* 0 on success (ack),
|
* 0 on success (ack),
|
||||||
|
@ -134,7 +134,7 @@ public:
|
||||||
* @param data Pointer to the byte-array data to send
|
* @param data Pointer to the byte-array data to send
|
||||||
* @param length Number of bytes to send
|
* @param length Number of bytes to send
|
||||||
* @param repeated Repeated start, true - do not send stop at end
|
* @param repeated Repeated start, true - do not send stop at end
|
||||||
* default value is false.
|
* default value is false.
|
||||||
*
|
*
|
||||||
* @returns
|
* @returns
|
||||||
* 0 on success (ack),
|
* 0 on success (ack),
|
||||||
|
@ -188,8 +188,8 @@ public:
|
||||||
* @param event The logical OR of events to modify
|
* @param event The logical OR of events to modify
|
||||||
* @param callback The event callback function
|
* @param callback The event callback function
|
||||||
* @param repeated Repeated start, true - do not send stop at end
|
* @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
|
* @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);
|
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();
|
void abort_transfer();
|
||||||
|
|
||||||
|
#if !defined(DOXYGEN_ONLY)
|
||||||
protected:
|
protected:
|
||||||
/** Lock deep sleep only if it is not yet locked */
|
/** Lock deep sleep only if it is not yet locked */
|
||||||
void lock_deep_sleep();
|
void lock_deep_sleep();
|
||||||
|
@ -211,6 +212,7 @@ protected:
|
||||||
DMAUsage _usage;
|
DMAUsage _usage;
|
||||||
bool _deep_sleep_locked;
|
bool _deep_sleep_locked;
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#if !defined(DOXYGEN_ONLY)
|
#if !defined(DOXYGEN_ONLY)
|
||||||
protected:
|
protected:
|
||||||
|
@ -222,7 +224,6 @@ protected:
|
||||||
static SingletonPtr<PlatformMutex> _mutex;
|
static SingletonPtr<PlatformMutex> _mutex;
|
||||||
PinName _sda;
|
PinName _sda;
|
||||||
PinName _scl;
|
PinName _scl;
|
||||||
#endif
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/** Recover I2C bus, when stuck with SDA low
|
/** Recover I2C bus, when stuck with SDA low
|
||||||
|
@ -237,6 +238,7 @@ private:
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
int recover(PinName sda, PinName scl);
|
int recover(PinName sda, PinName scl);
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace mbed
|
} // namespace mbed
|
||||||
|
|
|
@ -166,6 +166,7 @@ public:
|
||||||
"public API of mbed-os and is being removed in the future.")
|
"public API of mbed-os and is being removed in the future.")
|
||||||
bool remove_handler(pFunctionPointer_t handler, IRQn_Type irq);
|
bool remove_handler(pFunctionPointer_t handler, IRQn_Type irq);
|
||||||
|
|
||||||
|
#if !defined(DOXYGEN_ONLY)
|
||||||
private:
|
private:
|
||||||
InterruptManager();
|
InterruptManager();
|
||||||
~InterruptManager();
|
~InterruptManager();
|
||||||
|
@ -198,6 +199,7 @@ private:
|
||||||
CallChain *_chains[NVIC_NUM_VECTORS];
|
CallChain *_chains[NVIC_NUM_VECTORS];
|
||||||
static InterruptManager *_instance;
|
static InterruptManager *_instance;
|
||||||
PlatformMutex _mutex;
|
PlatformMutex _mutex;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace mbed
|
} // namespace mbed
|
||||||
|
|
|
@ -33,12 +33,13 @@ namespace mbed {
|
||||||
* @ingroup drivers
|
* @ingroup drivers
|
||||||
*/
|
*/
|
||||||
class LowPowerTimeout : public LowPowerTicker, private NonCopyable<LowPowerTimeout> {
|
class LowPowerTimeout : public LowPowerTicker, private NonCopyable<LowPowerTimeout> {
|
||||||
|
#if !defined(DOXYGEN_ONLY)
|
||||||
private:
|
private:
|
||||||
virtual void handler(void)
|
virtual void handler(void)
|
||||||
{
|
{
|
||||||
_function.call();
|
_function.call();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -302,6 +302,7 @@ public:
|
||||||
return width;
|
return width;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if !defined(DOXYGEN_ONLY)
|
||||||
private:
|
private:
|
||||||
uint32_t _initial_value;
|
uint32_t _initial_value;
|
||||||
uint32_t _final_xor;
|
uint32_t _final_xor;
|
||||||
|
@ -546,6 +547,7 @@ private:
|
||||||
}
|
}
|
||||||
_mode = (_crc_table != NULL) ? TABLE : BITWISE;
|
_mode = (_crc_table != NULL) ? TABLE : BITWISE;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
#if defined ( __CC_ARM )
|
#if defined ( __CC_ARM )
|
||||||
|
|
|
@ -208,6 +208,7 @@ public:
|
||||||
*/
|
*/
|
||||||
int set_dma_usage(DMAUsage usage);
|
int set_dma_usage(DMAUsage usage);
|
||||||
|
|
||||||
|
#if !defined(DOXYGEN_ONLY)
|
||||||
protected:
|
protected:
|
||||||
/** SPI interrupt handler.
|
/** 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);
|
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:
|
private:
|
||||||
/** Lock deep sleep only if it is not yet locked */
|
/** Lock deep sleep only if it is not yet locked */
|
||||||
void lock_deep_sleep();
|
void lock_deep_sleep();
|
||||||
|
@ -294,7 +293,6 @@ private:
|
||||||
#endif //DEVICE_SPI_ASYNCH
|
#endif //DEVICE_SPI_ASYNCH
|
||||||
|
|
||||||
#if !defined(DOXYGEN_ONLY)
|
#if !defined(DOXYGEN_ONLY)
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/* Internal SPI object identifying the resources */
|
/* Internal SPI object identifying the resources */
|
||||||
spi_t _spi;
|
spi_t _spi;
|
||||||
|
|
|
@ -141,6 +141,7 @@ public:
|
||||||
*/
|
*/
|
||||||
void send_break();
|
void send_break();
|
||||||
|
|
||||||
|
#if !defined(DOXYGEN_ONLY)
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
/** Acquire exclusive access to this serial port
|
/** Acquire exclusive access to this serial port
|
||||||
|
@ -150,7 +151,7 @@ protected:
|
||||||
/** Release exclusive access to this serial port
|
/** Release exclusive access to this serial port
|
||||||
*/
|
*/
|
||||||
virtual void unlock(void);
|
virtual void unlock(void);
|
||||||
|
#endif
|
||||||
public:
|
public:
|
||||||
|
|
||||||
#if DEVICE_SERIAL_FC
|
#if DEVICE_SERIAL_FC
|
||||||
|
@ -235,12 +236,15 @@ public:
|
||||||
*/
|
*/
|
||||||
int set_dma_usage_rx(DMAUsage usage);
|
int set_dma_usage_rx(DMAUsage usage);
|
||||||
|
|
||||||
|
#if !defined(DOXYGEN_ONLY)
|
||||||
protected:
|
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_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 start_write(const void *buffer, int buffer_size, char buffer_width, const event_callback_t &callback, int event);
|
||||||
void interrupt_handler_asynch(void);
|
void interrupt_handler_asynch(void);
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(DOXYGEN_ONLY)
|
||||||
protected:
|
protected:
|
||||||
SerialBase(PinName tx, PinName rx, int baud);
|
SerialBase(PinName tx, PinName rx, int baud);
|
||||||
virtual ~SerialBase();
|
virtual ~SerialBase();
|
||||||
|
@ -259,7 +263,7 @@ protected:
|
||||||
serial_t _serial;
|
serial_t _serial;
|
||||||
Callback<void()> _irq[IrqCnt];
|
Callback<void()> _irq[IrqCnt];
|
||||||
int _baud;
|
int _baud;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace mbed
|
} // namespace mbed
|
||||||
|
|
|
@ -56,8 +56,10 @@ namespace mbed {
|
||||||
*/
|
*/
|
||||||
class Timeout : public Ticker, private NonCopyable<Timeout> {
|
class Timeout : public Ticker, private NonCopyable<Timeout> {
|
||||||
|
|
||||||
|
#if !defined(DOXYGEN_ONLY)
|
||||||
protected:
|
protected:
|
||||||
virtual void handler();
|
virtual void handler();
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace mbed
|
} // namespace mbed
|
||||||
|
|
|
@ -43,6 +43,7 @@ public:
|
||||||
*/
|
*/
|
||||||
virtual ~TimerEvent();
|
virtual ~TimerEvent();
|
||||||
|
|
||||||
|
#if !defined(DOXYGEN_ONLY)
|
||||||
protected:
|
protected:
|
||||||
// The handler called to service the timer event of the derived class
|
// The handler called to service the timer event of the derived class
|
||||||
virtual void handler() = 0;
|
virtual void handler() = 0;
|
||||||
|
@ -77,6 +78,7 @@ protected:
|
||||||
ticker_event_t event;
|
ticker_event_t event;
|
||||||
|
|
||||||
const ticker_data_t *_ticker_data;
|
const ticker_data_t *_ticker_data;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace mbed
|
} // namespace mbed
|
||||||
|
|
|
@ -32,76 +32,7 @@
|
||||||
|
|
||||||
#include "cmsis.h"
|
#include "cmsis.h"
|
||||||
|
|
||||||
// when LL is available, below include can be used
|
#include "stm32f2xx_ll_gpio.h"
|
||||||
// #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
|
|
||||||
|
|
||||||
extern const uint32_t ll_pin_defines[16];
|
extern const uint32_t ll_pin_defines[16];
|
||||||
|
|
||||||
|
|
|
@ -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 <stdint.h>
|
||||||
|
|
||||||
|
#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
|
|
@ -32,75 +32,7 @@
|
||||||
|
|
||||||
#include "cmsis.h"
|
#include "cmsis.h"
|
||||||
|
|
||||||
// when LL is available, below include can be used
|
#include "stm32f4xx_ll_gpio.h"
|
||||||
// #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
|
|
||||||
|
|
||||||
extern const uint32_t ll_pin_defines[16];
|
extern const uint32_t ll_pin_defines[16];
|
||||||
|
|
||||||
|
|
|
@ -32,77 +32,7 @@
|
||||||
|
|
||||||
#include "cmsis.h"
|
#include "cmsis.h"
|
||||||
|
|
||||||
// when LL is available, below include can be used
|
#include "stm32f7xx_ll_gpio.h"
|
||||||
// #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
|
|
||||||
|
|
||||||
extern const uint32_t ll_pin_defines[16];
|
extern const uint32_t ll_pin_defines[16];
|
||||||
|
|
||||||
|
|
|
@ -1810,7 +1810,7 @@
|
||||||
"supported_toolchains": ["ARM", "uARM", "GCC_ARM"],
|
"supported_toolchains": ["ARM", "uARM", "GCC_ARM"],
|
||||||
"program_cycle_s": 2,
|
"program_cycle_s": 2,
|
||||||
"extra_labels_add": ["STM32F4", "STM32F407", "STM32F407xG", "STM32F407VG"],
|
"extra_labels_add": ["STM32F4", "STM32F407", "STM32F407xG", "STM32F407VG"],
|
||||||
"device_has_add": ["ANALOGOUT", "TRNG"],
|
"device_has_add": ["ANALOGOUT", "TRNG", "FLASH"],
|
||||||
"release_versions": ["2"],
|
"release_versions": ["2"],
|
||||||
"device_name": "STM32F407VG"
|
"device_name": "STM32F407VG"
|
||||||
},
|
},
|
||||||
|
@ -1922,7 +1922,7 @@
|
||||||
},
|
},
|
||||||
"macros_add": ["USB_STM_HAL"],
|
"macros_add": ["USB_STM_HAL"],
|
||||||
"overrides": {"lse_available": 0},
|
"overrides": {"lse_available": 0},
|
||||||
"device_has_add": ["ANALOGOUT", "TRNG"],
|
"device_has_add": ["ANALOGOUT", "TRNG", "FLASH"],
|
||||||
"release_versions": ["2", "5"],
|
"release_versions": ["2", "5"],
|
||||||
"device_name": "STM32F407VG"
|
"device_name": "STM32F407VG"
|
||||||
},
|
},
|
||||||
|
|
|
@ -331,7 +331,7 @@ class mbedToolchain:
|
||||||
"""Generate a via file for all includes.
|
"""Generate a via file for all includes.
|
||||||
ARM, GCC, IAR cross compatible
|
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:
|
if self.CHROOT:
|
||||||
cmd_list = (c.replace(self.CHROOT, '') for c in cmd_list)
|
cmd_list = (c.replace(self.CHROOT, '') for c in cmd_list)
|
||||||
return self.make_option_file(list(cmd_list), naming=".includes_{}.txt")
|
return self.make_option_file(list(cmd_list), naming=".includes_{}.txt")
|
||||||
|
|
Loading…
Reference in New Issue