Lines Matching +full:address +full:- +full:aligned

4  * SPDX-License-Identifier: Apache-2.0
35 struct flash_xmc4xxx_data *dev_data = dev->data; in flash_xmc4xxx_init()
37 k_sem_init(&dev_data->sem, 1, 1); in flash_xmc4xxx_init()
58 const struct flash_xmc4xxx_config *dev_config = dev->config; in flash_xmc4xxx_read()
60 if (offset < 0 || offset + len > dev_config->size) { in flash_xmc4xxx_read()
61 return -1; in flash_xmc4xxx_read()
63 memcpy(data, (void *)(dev_config->base + offset), len); in flash_xmc4xxx_read()
72 struct flash_xmc4xxx_data *dev_data = dev->data; in flash_xmc4xxx_write()
73 const struct flash_xmc4xxx_config *dev_config = dev->config; in flash_xmc4xxx_write()
75 uint32_t flash_addr = dev_config->base; in flash_xmc4xxx_write()
79 if (offset < 0 || offset + len > dev_config->size) { in flash_xmc4xxx_write()
80 return -1; in flash_xmc4xxx_write()
83 if (len % dev_config->parameters.write_block_size || in flash_xmc4xxx_write()
84 offset % dev_config->parameters.write_block_size > 0) { in flash_xmc4xxx_write()
85 return -1; in flash_xmc4xxx_write()
88 k_sem_take(&dev_data->sem, K_FOREVER); in flash_xmc4xxx_write()
90 /* erase and write operations must be on the uncached base address */ in flash_xmc4xxx_write()
94 num_pages = len / dev_config->parameters.write_block_size; in flash_xmc4xxx_write()
98 /* XMC_FLASH_ProgramPage() needs a 32 bit aligned input. */ in flash_xmc4xxx_write()
99 /* Copy the data to an aligned array if needed. */ in flash_xmc4xxx_write()
101 memcpy(aligned_page, src, dev_config->parameters.write_block_size); in flash_xmc4xxx_write()
108 flash_addr += dev_config->parameters.write_block_size; in flash_xmc4xxx_write()
109 src += dev_config->parameters.write_block_size; in flash_xmc4xxx_write()
112 k_sem_give(&dev_data->sem); in flash_xmc4xxx_write()
119 struct flash_xmc4xxx_data *dev_data = dev->data; in flash_xmc4xxx_erase()
120 const struct flash_xmc4xxx_config *dev_config = dev->config; in flash_xmc4xxx_erase()
125 if (offset < 0 || offset > dev_config->size) { in flash_xmc4xxx_erase()
126 return -1; in flash_xmc4xxx_erase()
129 k_sem_take(&dev_data->sem, K_FOREVER); in flash_xmc4xxx_erase()
134 /* erase and write operations must be on the uncached base address */ in flash_xmc4xxx_erase()
135 uint32_t flash_addr = dev_config->base | 0xc000000; in flash_xmc4xxx_erase()
143 size -= pages_size; in flash_xmc4xxx_erase()
153 /* page not aligned with offset address */ in flash_xmc4xxx_erase()
155 ret = -1; in flash_xmc4xxx_erase()
162 k_sem_give(&dev_data->sem); in flash_xmc4xxx_erase()
172 return -ENOTSUP; in flash_xmc4xxx_erase()
178 const struct flash_xmc4xxx_config *dev_config = dev->config; in flash_xmc4xxx_get_parameters()
180 return &dev_config->parameters; in flash_xmc4xxx_get_parameters()