-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathldma_handler.c
More file actions
58 lines (48 loc) · 1.11 KB
/
ldma_handler.c
File metadata and controls
58 lines (48 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#include "platform.h"
#include "em_device.h"
#include "em_gpio.h"
#include "em_cmu.h"
#include "ldma_handler.h"
#include "em_ldma.h"
#include "cmsis_os2.h"
#include "sys_panic.h"
#define SIZE_OF_ARRAY(arr) (sizeof(arr))/sizeof(arr[0])
static volatile ldma_handler_conf_t m_head = {0xFF, NULL, 0, 0, NULL};
void LDMA_IRQHandler (void)
{
uint32_t pending = LDMA_IntGet();
while (pending & LDMA_IF_ERROR)
{
//err1("ldma if");
}
ldma_handler_conf_t* ptr = &m_head;
while(ptr != NULL)
{
if ( pending & (1 << ptr->channel) )
{
osThreadFlagsSet(ptr->thrd, ptr->signal);
}
ptr = ptr->next;
}
LDMA_IntClear(pending);
}
void append_to_ldma_stored_configuration(ldma_handler_conf_t * newconf)
{
//append to configuration
ldma_handler_conf_t *ptr = &m_head;
if(!m_head.next)
{
// adding first config
ptr->next = newconf;
}
else
{
//looping to the end of list
while(ptr != NULL && ptr->next != NULL)
{
ptr = ptr->next;
}
//adding new element
ptr->next = newconf;
}
}