mirror of
https://github.com/zephyrproject-rtos/zephyr
synced 2025-09-03 09:11:56 +00:00
After activation of cube based driver support on L4 and F3 series, this commits performs the clean up of F3 and L4 relative code to native clock control drivers. Indirectly, it makes pwm driver supported de facto on F3 series Change-Id: Idac17103a9b5ef6eab540719343cc8f5865f15fa Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
67 lines
1.6 KiB
C
67 lines
1.6 KiB
C
/*
|
|
* Copyright (c) 2016 RnDity Sp. z o.o.
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
#ifndef DRIVERS_FLASH_FLASH_STM32_H_
|
|
#define DRIVERS_FLASH_FLASH_STM32_H_
|
|
|
|
#include <soc.h>
|
|
#include <flash.h>
|
|
#include <clock_control.h>
|
|
#include <flash_registers.h>
|
|
|
|
struct flash_stm32_dev_config {
|
|
uint32_t *base;
|
|
struct stm32_pclken pclken;
|
|
};
|
|
|
|
struct flash_stm32_dev_data {
|
|
/* For future use. */
|
|
};
|
|
|
|
#define FLASH_CFG(dev) \
|
|
((const struct flash_stm32_dev_config * const)(dev)->config->config_info)
|
|
#define FLASH_DATA(dev) \
|
|
((struct flash_stm32_dev_data * const)(dev)->driver_data)
|
|
#define FLASH_STRUCT(base) \
|
|
(volatile struct stm32_flash *)(base)
|
|
|
|
/* Flash programming timeout definition. */
|
|
#define FLASH_ER_PRG_TIMEOUT ((uint32_t)0x000B0000)
|
|
|
|
enum flash_status {
|
|
FLASH_BUSY = 1,
|
|
FLASH_ERROR_WRITE_PROTECTION,
|
|
FLASH_ERROR_PROGRAM,
|
|
FLASH_COMPLETE,
|
|
FLASH_TIMEOUT
|
|
};
|
|
|
|
void flash_stm32_lock(struct device *flash);
|
|
|
|
void flash_stm32_unlock(struct device *flash);
|
|
|
|
uint8_t flash_stm32_program_halfword(struct device *flash,
|
|
uint32_t address,
|
|
uint16_t data);
|
|
|
|
uint8_t flash_stm32_program_word(struct device *flash,
|
|
uint32_t address,
|
|
uint32_t data);
|
|
|
|
void flash_stm32_read_data(void *data, uint32_t address, size_t len);
|
|
|
|
uint8_t flash_stm32_wait_for_last_operation(struct device *flash,
|
|
uint32_t timeout);
|
|
|
|
uint8_t flash_stm32_get_status(struct device *flash);
|
|
|
|
uint8_t flash_stm32_erase_page(struct device *flash,
|
|
uint32_t page_address);
|
|
|
|
uint8_t flash_stm32_erase_all_pages(struct device *flash);
|
|
|
|
#endif /* DRIVERS_FLASH_FLASH_STM32_H_ */
|