hal: nrf_common: Fix address checking in nrf_dma_accessible_check

Function was not covering whole DMA capable regions.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
This commit is contained in:
Krzysztof Chruściński 2024-04-02 15:45:08 +02:00
parent 13ac55b5b5
commit bd404dbe92
1 changed files with 3 additions and 6 deletions

View File

@ -241,20 +241,17 @@ NRF_STATIC_INLINE bool nrf_dma_accessible_check(void const * p_reg, void const *
#if defined(HALTIUM_XXAA)
if (nrf_address_bus_get((uint32_t)p_reg, 0x10000) == 0x8E)
{
/* Bitwise operation to unify secure/non-secure memory address */
uint32_t addr = (uint32_t)p_object & 0xEFFFFFFFu;
/* When peripheral instance is high-speed check whether */
/* p_object is placed in GRAM2x or GRAM0x */
bool gram0x = (addr >= 0x2F000000u) && (addr < 0x2F038000);
bool gram2x = (addr >= 0x2F880000u) && (addr < 0x2F886200);
bool gram0x = ((uint32_t)p_object & 0xEFF00000) == 0x2F000000;
bool gram2x = ((uint32_t)p_object & 0xEFF80000) == 0x2F880000;
return gram0x || gram2x;
}
else
{
/* When peripheral instance is low-speed check whether */
/* p_object is placed in GRAM3x */
return ((((uint32_t)p_object) & 0xEFFF8000u) == 0x2FC00000u);
return ((((uint32_t)p_object) & 0xEFFE0000u) == 0x2FC00000u);
}
#else
(void)p_reg;