AM64x MCU+ SDK  10.00.00
HwiP.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2018-2023 Texas Instruments Incorporated
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  *
8  * Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  *
11  * Redistributions in binary form must reproduce the above copyright
12  * notice, this list of conditions and the following disclaimer in the
13  * documentation and/or other materials provided with the
14  * distribution.
15  *
16  * Neither the name of Texas Instruments Incorporated nor the names of
17  * its contributors may be used to endorse or promote products derived
18  * from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
32 
33 #ifndef HWIP_H
34 #define HWIP_H
35 
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
39 
40 #include <stdint.h>
41 #include <kernel/dpl/SystemP.h>
42 
43 // #define EN_SAVE_RESTORE_FPU_CONTEXT
44 
59 typedef void (*HwiP_FxnCallback)(void *args);
60 
61 
65 typedef struct HwiP_Config_
66 {
67  uint32_t intcBaseAddr;
69 } HwiP_Config;
70 
74 typedef struct HwiP_Params_ {
75 
76  uint32_t intNum;
78  void *args;
79  uint16_t eventId;
80  uint8_t priority;
81  uint8_t isFIQ;
82  uint8_t isPulse;
84 } HwiP_Params;
85 
89 #define HwiP_OBJECT_SIZE_MAX (32u)
90 
93 typedef struct HwiP_Object_ {
94 
95  uint32_t rsv[HwiP_OBJECT_SIZE_MAX/sizeof(uint32_t)];
97 } HwiP_Object;
98 
107 
116 int32_t HwiP_construct(HwiP_Object *obj, HwiP_Params *params);
117 
118 
127 int32_t HwiP_setArgs(HwiP_Object *obj, void *args);
128 
135 
141 void HwiP_enableInt(uint32_t intNum);
142 
153 uint32_t HwiP_disableInt(uint32_t intNum);
154 
164 void HwiP_restoreInt(uint32_t intNum, uint32_t oldIntState);
165 
171 void HwiP_clearInt(uint32_t intNum);
172 
173 
174 
180 void HwiP_post(uint32_t intNum);
181 
191 uintptr_t HwiP_disable(void);
192 
199 void HwiP_enable(void);
200 
209 void HwiP_restore(uintptr_t oldIntState);
210 
211 
228 uint32_t HwiP_inISR(void);
229 
240 void HwiP_init(void);
241 
250 int32_t HwiP_registerNmiHandler(HwiP_FxnCallback nmiHandler, void *args);
251 
258 
261 #ifdef __cplusplus
262 }
263 #endif
264 
265 #endif /* HWIP_H */
HwiP_Params::eventId
uint16_t eventId
Definition: HwiP.h:79
HwiP_inISR
uint32_t HwiP_inISR(void)
Check if the caller of this function is inside a ISR or not.
HwiP_destruct
void HwiP_destruct(HwiP_Object *obj)
Cleanup, delete, destruct a Hwi object.
SystemP.h
HwiP_disableInt
uint32_t HwiP_disableInt(uint32_t intNum)
Disable a specific interrupt.
HwiP_Params
Parameters passed during HwiP_construct.
Definition: HwiP.h:74
HwiP_post
void HwiP_post(uint32_t intNum)
Force trigger a specific interrupt.
HwiP_restoreInt
void HwiP_restoreInt(uint32_t intNum, uint32_t oldIntState)
Restore a specific interrupt.
HwiP_unregisterNmiHandler
int32_t HwiP_unregisterNmiHandler(void)
This API unregisters the current NMI handler.
HwiP_enable
void HwiP_enable(void)
Enable all interrupts.
HwiP_construct
int32_t HwiP_construct(HwiP_Object *obj, HwiP_Params *params)
Create a Hwi object.
HwiP_Params_init
void HwiP_Params_init(HwiP_Params *params)
Set default values to HwiP_Params.
HwiP_Config::intcBaseAddr
uint32_t intcBaseAddr
Definition: HwiP.h:67
HwiP_enableInt
void HwiP_enableInt(uint32_t intNum)
Enable a specific interrupt.
HwiP_registerNmiHandler
int32_t HwiP_registerNmiHandler(HwiP_FxnCallback nmiHandler, void *args)
This API registers the NMI handler.
HwiP_Params::priority
uint8_t priority
Definition: HwiP.h:80
HwiP_OBJECT_SIZE_MAX
#define HwiP_OBJECT_SIZE_MAX
Max size of Hwi object across no-RTOS and all OS's.
Definition: HwiP.h:89
HwiP_Params::isPulse
uint8_t isPulse
Definition: HwiP.h:82
HwiP_Params::callback
HwiP_FxnCallback callback
Definition: HwiP.h:77
HwiP_init
void HwiP_init(void)
Initialize Hwi module.
HwiP_Object
Opaque Hwi object used with the Hwi APIs.
Definition: HwiP.h:93
HwiP_Params::isFIQ
uint8_t isFIQ
Definition: HwiP.h:81
HwiP_Params::args
void * args
Definition: HwiP.h:78
HwiP_disable
uintptr_t HwiP_disable(void)
Disable all interrupts.
HwiP_restore
void HwiP_restore(uintptr_t oldIntState)
Restores all interrupts to a given state.
HwiP_clearInt
void HwiP_clearInt(uint32_t intNum)
Clear a pending specific interrupt.
HwiP_setArgs
int32_t HwiP_setArgs(HwiP_Object *obj, void *args)
Set argument to pass to the ISR.
HwiP_Params::intNum
uint32_t intNum
Definition: HwiP.h:76
HwiP_FxnCallback
void(* HwiP_FxnCallback)(void *args)
Callback that is called when a HW interrupt is received.
Definition: HwiP.h:59
HwiP_Config
HwiP config parameters, setup as part of SysConfig, not to be set by end-users directly.
Definition: HwiP.h:66