Lines Matching +full:static +full:- +full:address

4  * SPDX-License-Identifier: Apache-2.0
28 static const struct flash_parameters flash_gecko_parameters = {
33 static bool write_range_is_valid(off_t offset, uint32_t size);
34 static bool read_range_is_valid(off_t offset, uint32_t size);
35 static int erase_flash_block(off_t offset, size_t size);
36 static void flash_gecko_write_protection(bool enable);
38 static int flash_gecko_read(const struct device *dev, off_t offset, in flash_gecko_read()
43 return -EINVAL; in flash_gecko_read()
55 static int flash_gecko_write(const struct device *dev, off_t offset, in flash_gecko_write()
58 struct flash_gecko_data *const dev_data = dev->data; in flash_gecko_write()
60 void *address; in flash_gecko_write() local
64 return -EINVAL; in flash_gecko_write()
71 k_sem_take(&dev_data->mutex, K_FOREVER); in flash_gecko_write()
74 address = (uint8_t *)CONFIG_FLASH_BASE_ADDRESS + offset; in flash_gecko_write()
75 msc_ret = MSC_WriteWord(address, data, size); in flash_gecko_write()
77 ret = -EIO; in flash_gecko_write()
81 k_sem_give(&dev_data->mutex); in flash_gecko_write()
86 static int flash_gecko_erase(const struct device *dev, off_t offset, in flash_gecko_erase()
89 struct flash_gecko_data *const dev_data = dev->data; in flash_gecko_erase()
93 return -EINVAL; in flash_gecko_erase()
98 return -EINVAL; in flash_gecko_erase()
103 return -EINVAL; in flash_gecko_erase()
110 k_sem_take(&dev_data->mutex, K_FOREVER); in flash_gecko_erase()
116 k_sem_give(&dev_data->mutex); in flash_gecko_erase()
121 static void flash_gecko_write_protection(bool enable) in flash_gecko_write_protection()
125 MSC->LOCK = 0; in flash_gecko_write_protection()
129 MSC->LOCK = MSC_LOCK_LOCKKEY_UNLOCK; in flash_gecko_write_protection()
131 MSC->LOCK = MSC_UNLOCK_CODE; in flash_gecko_write_protection()
137 * - A flash address to write to must be aligned to words.
138 * - Number of bytes to write must be divisible by 4.
140 static bool write_range_is_valid(off_t offset, uint32_t size) in write_range_is_valid()
147 static bool read_range_is_valid(off_t offset, uint32_t size) in read_range_is_valid()
152 static int erase_flash_block(off_t offset, size_t size) in erase_flash_block()
155 void *address; in erase_flash_block() local
159 address = (uint8_t *)CONFIG_FLASH_BASE_ADDRESS + tmp; in erase_flash_block()
160 msc_ret = MSC_ErasePage(address); in erase_flash_block()
162 ret = -EIO; in erase_flash_block()
171 static const struct flash_pages_layout flash_gecko_0_pages_layout = {
186 static const struct flash_parameters *
194 static int flash_gecko_get_size(const struct device *dev, uint64_t *size) in flash_gecko_get_size()
203 static int flash_gecko_init(const struct device *dev) in flash_gecko_init()
205 struct flash_gecko_data *const dev_data = dev->data; in flash_gecko_init()
207 k_sem_init(&dev_data->mutex, 1, 1); in flash_gecko_init()
212 MSC->LOCK = 0; in flash_gecko_init()
214 LOG_INF("Device %s initialized", dev->name); in flash_gecko_init()
219 static DEVICE_API(flash, flash_gecko_driver_api) = {
230 static struct flash_gecko_data flash_gecko_0_data;