-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSWI.h
47 lines (35 loc) · 1.33 KB
/
SWI.h
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
/**
* @brief Mechanism to invoke a software interrupt. This allows execution
* to jump into privileged(interrupt handling) context.
* Depending on priority assigned you could allow selective interruption.
*/
/** @example
// Function we want to execute in SVC
void testSWI(void *args)
{
uint32_t pI = *(uint32_t *)args;
}
uint32_t z = 3.1416;
@usage SWI_Req(1, testSWI, (void*)(&z));
This ensures testSWI will execute as a software interrupt at
1 - interrupt priority level. Any interrupt with priority more than 1
cannot preempt SVC. Any interrupt more or equal to @param pri
cannot prempt execution of this function
*/
#ifndef __SWI_H__
#define __SWI_H__
/* using only one SVC number but can be used to provide different
privileged(OS) services depending on SVC numbers */
#define SVC_NUM 0x01
typedef void (*SWI_func)(void *); /* Functions executed in SVC will have
to be of this type */
/* SVC call which triggers exception */
/* This function call will trigger (SVC 0x01). Each svc call with a different
arg can be aliased to a different function call */
void __svc(SVC_NUM) SWI_Req(uint32_t pri, SWI_func func, void *fargs);
/**
* @brief SVC handler which invokes RL_SWI_handler
* Overrides weak default definition
*/
void SVC_Handler(void);
#endif /* __RL_SWI_H__ */