Skip to content
This repository was archived by the owner on Oct 23, 2025. It is now read-only.

Commit e8973f3

Browse files
auroraslbwopu-ot
authored andcommitted
Added APIs for ECB
Signed-off-by: Sletnes Bjørlo, Aurora <[email protected]>
1 parent d6ecc00 commit e8973f3

File tree

2 files changed

+71
-0
lines changed

2 files changed

+71
-0
lines changed

src/nrfx/hal/nrf_ecb.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,9 @@ void nrf_ecb_int_enable(NRF_ECB_Type * p_reg, uint32_t mask)
2828
p_reg->INTENSET = mask;
2929
nrf_ecb_regw_sideeffects_INTENSET();
3030
}
31+
32+
void nrf_ecb_int_disable(NRF_ECB_Type * p_reg, uint32_t mask)
33+
{
34+
p_reg->INTENCLR = mask;
35+
nrf_ecb_regw_sideeffects_INTENCLEAR();
36+
}

src/nrfx/hal/nrf_ecb.h

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,25 @@ typedef enum
9595
*/
9696
void nrf_ecb_task_trigger(NRF_ECB_Type * p_reg, nrf_ecb_task_t task);
9797

98+
/**
99+
* @brief Function for clearing the specified ECB event.
100+
*
101+
* @param[in] p_reg Pointer to the peripheral register structure.
102+
* @param[in] event Event to clear.
103+
*/
104+
NRF_STATIC_INLINE void nrf_ecb_event_clear(NRF_ECB_Type * p_reg, nrf_ecb_event_t event);
105+
106+
/**
107+
* @brief Function for retrieving the state of the ECB event.
108+
*
109+
* @param[in] p_reg Pointer to the structure of registers of the peripheral.
110+
* @param[in] event Event to be checked.
111+
*
112+
* @retval true The event has been generated.
113+
* @retval false The event has not been generated.
114+
*/
115+
NRF_STATIC_INLINE bool nrf_ecb_event_check(NRF_ECB_Type const * p_reg, nrf_ecb_event_t event);
116+
98117
/**
99118
* @brief Function for enabling specified interrupts.
100119
*
@@ -111,7 +130,53 @@ void nrf_ecb_int_enable(NRF_ECB_Type * p_reg, uint32_t mask);
111130
*/
112131
void nrf_ecb_int_disable(NRF_ECB_Type * p_reg, uint32_t mask);
113132

133+
/**
134+
* @brief Function for setting the pointer to the ECB data buffer.
135+
*
136+
* @note The buffer has to be placed in the Data RAM region.
137+
* For description of the data structure in this buffer, see the Product Specification.
138+
*
139+
* @param[in] p_reg Pointer to the peripheral register structure.
140+
* @param[in] p_buffer Pointer to the ECB data buffer.
141+
*/
142+
NRF_STATIC_INLINE void nrf_ecb_data_pointer_set(NRF_ECB_Type * p_reg, void const * p_buffer);
114143

144+
/**
145+
* @brief Function for getting the pointer to the ECB data buffer.
146+
*
147+
* @param[in] p_reg Pointer to the peripheral register structure.
148+
*
149+
* @return Pointer to the ECB data buffer.
150+
*/
151+
NRF_STATIC_INLINE void * nrf_ecb_data_pointer_get(NRF_ECB_Type const * p_reg);
152+
153+
/*****************************/
154+
/* Inlined functions bodies: */
155+
/*****************************/
156+
157+
NRF_STATIC_INLINE void nrf_ecb_event_clear(NRF_ECB_Type * p_reg, nrf_ecb_event_t event)
158+
{
159+
*((volatile uint32_t *)((uint8_t *)p_reg + (uint32_t)event)) = 0x0UL;
160+
#if __CORTEX_M == 0x04
161+
volatile uint32_t dummy = *((volatile uint32_t *)((uint8_t *)p_reg + (uint32_t)event));
162+
(void)dummy;
163+
#endif
164+
}
165+
166+
NRF_STATIC_INLINE bool nrf_ecb_event_check(NRF_ECB_Type const * p_reg, nrf_ecb_event_t event)
167+
{
168+
return (bool)*(volatile uint32_t *)((uint8_t *)p_reg + (uint32_t)event);
169+
}
170+
171+
NRF_STATIC_INLINE void nrf_ecb_data_pointer_set(NRF_ECB_Type * p_reg, void const * p_buffer)
172+
{
173+
p_reg->ECBDATAPTR = (uint32_t)p_buffer;
174+
}
175+
176+
NRF_STATIC_INLINE void * nrf_ecb_data_pointer_get(NRF_ECB_Type const * p_reg)
177+
{
178+
return (void *)(p_reg->ECBDATAPTR);
179+
}
115180

116181
#ifdef __cplusplus
117182
}

0 commit comments

Comments
 (0)