struct efm32x_flash_bank {
int probed;
- uint8_t lb_page[LOCKBITS_PAGE_SZ];
+ uint32_t lb_page[LOCKBITS_PAGE_SZ/4];
};
struct efm32_info {
data_size = bank->num_sectors / 8; /* number of data bytes */
data_size /= 4; /* ...and data dwords */
- ptr = (uint32_t *)efm32x_info->lb_page;
+ ptr = efm32x_info->lb_page;
for (i = 0; i < data_size; i++, ptr++) {
ret = target_read_u32(target, EFM32_MSC_LOCK_BITS+i*4, ptr);
/* also, read ULW, DLW and MLW */
/* ULW, word 126 */
- ptr = ((uint32_t *)efm32x_info->lb_page) + 126;
+ ptr = efm32x_info->lb_page + 126;
ret = target_read_u32(target, EFM32_MSC_LOCK_BITS+126*4, ptr);
if (ERROR_OK != ret) {
LOG_ERROR("Failed to read ULW");
}
/* DLW, word 127 */
- ptr = ((uint32_t *)efm32x_info->lb_page) + 127;
+ ptr = efm32x_info->lb_page + 127;
ret = target_read_u32(target, EFM32_MSC_LOCK_BITS+127*4, ptr);
if (ERROR_OK != ret) {
LOG_ERROR("Failed to read DLW");
}
/* MLW, word 125, present in GG and LG */
- ptr = ((uint32_t *)efm32x_info->lb_page) + 125;
+ ptr = efm32x_info->lb_page + 125;
ret = target_read_u32(target, EFM32_MSC_LOCK_BITS+125*4, ptr);
if (ERROR_OK != ret) {
LOG_ERROR("Failed to read MLW");
return ret;
}
- return efm32x_write(bank, efm32x_info->lb_page, EFM32_MSC_LOCK_BITS,
+ return efm32x_write(bank, (uint8_t *)efm32x_info->lb_page, EFM32_MSC_LOCK_BITS,
LOCKBITS_PAGE_SZ);
}
static int efm32x_get_page_lock(struct flash_bank *bank, size_t page)
{
struct efm32x_flash_bank *efm32x_info = bank->driver_priv;
- uint32_t dw = ((uint32_t *)efm32x_info->lb_page)[page >> 5];
+ uint32_t dw = efm32x_info->lb_page[page >> 5];
uint32_t mask = 0;
mask = 1 << (page & 0x1f);
static int efm32x_set_page_lock(struct flash_bank *bank, size_t page, int set)
{
struct efm32x_flash_bank *efm32x_info = bank->driver_priv;
- uint32_t *dw = &((uint32_t *)efm32x_info->lb_page)[page >> 5];
+ uint32_t *dw = &efm32x_info->lb_page[page >> 5];
uint32_t mask = 0;
mask = 1 << (page & 0x1f);