AM243x MCU+ SDK  11.01.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 typedef struct HwiP_Object_ {
90 
91  uint32_t intNum;
92 
93 } HwiP_Object;
94 
103 
112 int32_t HwiP_construct(HwiP_Object *obj, HwiP_Params *params);
113 
114 
123 int32_t HwiP_setArgs(HwiP_Object *obj, void *args);
124 
131 
137 void HwiP_enableInt(uint32_t intNum);
138 
149 uint32_t HwiP_disableInt(uint32_t intNum);
150 
160 void HwiP_restoreInt(uint32_t intNum, uint32_t oldIntState);
161 
167 void HwiP_clearInt(uint32_t intNum);
168 
169 
170 
176 void HwiP_post(uint32_t intNum);
177 
187 uintptr_t HwiP_disable(void);
188 
195 void HwiP_enable(void);
196 
205 void HwiP_restore(uintptr_t oldIntState);
206 
207 
224 uint32_t HwiP_inISR(void);
225 
236 void HwiP_init(void);
237 
246 int32_t HwiP_registerNmiHandler(HwiP_FxnCallback nmiHandler, void *args);
247 
254 
255 typedef struct {
256  volatile uint32_t index;
257  /* index bit*/
258  volatile uint32_t side_ext;
259  /* side extension*/
260  volatile uint32_t recoverable_error;
261  /* recoverable error*/
262  volatile uint32_t cacheway;
263  /* cacheway*/
264 }AIFSR;
265 
266 typedef struct {
267  volatile uint32_t status;
268  /* status */
269  volatile uint32_t sd;
270  /* SD bit */
271 }IFSR;
272 
273 typedef struct {
274  volatile uint32_t index;
275  /* index bit*/
276  volatile uint32_t side_ext;
277  /* side extension*/
278  volatile uint32_t recoverable_error;
279  /* recoverable error*/
280  volatile uint32_t cacheway;
281  /* cacheway*/
282 }ADFSR;
283 typedef struct {
284  volatile uint32_t status;
285  /* status */
286  volatile uint32_t sd;
287  /* SD bit */
288  volatile uint32_t rw;
289  /* read or write error */
290 }DFSR;
291 
292 
293 
294 
301 #ifdef __cplusplus
302 }
303 #endif
304 
305 #endif /* HWIP_H */
HwiP_Params::eventId
uint16_t eventId
Definition: HwiP.h:79
ADFSR
Definition: HwiP.h:273
DFSR
Definition: HwiP.h:283
IFSR::sd
volatile uint32_t sd
Definition: HwiP.h:269
HwiP_Object::intNum
uint32_t intNum
Definition: HwiP.h:91
HwiP_inISR
uint32_t HwiP_inISR(void)
Check if the caller of this function is inside a ISR or not.
AIFSR
Definition: HwiP.h:255
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.
DFSR::status
volatile uint32_t status
Definition: HwiP.h:284
IFSR
Definition: HwiP.h:266
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
IFSR::status
volatile uint32_t status
Definition: HwiP.h:267
AIFSR::recoverable_error
volatile uint32_t recoverable_error
Definition: HwiP.h:260
ADFSR::recoverable_error
volatile uint32_t recoverable_error
Definition: HwiP.h:278
AIFSR::index
volatile uint32_t index
Definition: HwiP.h:256
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_Params::isPulse
uint8_t isPulse
Definition: HwiP.h:82
DFSR::sd
volatile uint32_t sd
Definition: HwiP.h:286
HwiP_Params::callback
HwiP_FxnCallback callback
Definition: HwiP.h:77
ADFSR::cacheway
volatile uint32_t cacheway
Definition: HwiP.h:280
HwiP_init
void HwiP_init(void)
Initialize Hwi module.
HwiP_Object
Opaque Hwi object used with the Hwi APIs.
Definition: HwiP.h:89
AIFSR::side_ext
volatile uint32_t side_ext
Definition: HwiP.h:258
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.
ADFSR::index
volatile uint32_t index
Definition: HwiP.h:274
HwiP_clearInt
void HwiP_clearInt(uint32_t intNum)
Clear a pending specific interrupt.
AIFSR::cacheway
volatile uint32_t cacheway
Definition: HwiP.h:262
ADFSR::side_ext
volatile uint32_t side_ext
Definition: HwiP.h:276
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
DFSR::rw
volatile uint32_t rw
Definition: HwiP.h:288
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