AM263x 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 
259 typedef struct {
260  volatile uint32_t index;
261  /* index bit*/
262  volatile uint32_t side_ext;
263  /* side extension*/
264  volatile uint32_t recoverable_error;
265  /* recoverable error*/
266  volatile uint32_t cacheway;
267  /* cacheway*/
268 }AIFSR;
269 
270 typedef struct {
271  volatile uint32_t status;
272  /* status */
273  volatile uint32_t sd;
274  /* SD bit */
275 }IFSR;
276 
277 typedef struct {
278  volatile uint32_t index;
279  /* index bit*/
280  volatile uint32_t side_ext;
281  /* side extension*/
282  volatile uint32_t recoverable_error;
283  /* recoverable error*/
284  volatile uint32_t cacheway;
285  /* cacheway*/
286 }ADFSR;
287 typedef struct {
288  volatile uint32_t status;
289  /* status */
290  volatile uint32_t sd;
291  /* SD bit */
292  volatile uint32_t rw;
293  /* read or write error */
294 }DFSR;
295 
296 
297 
298 
305 #ifdef __cplusplus
306 }
307 #endif
308 
309 #endif /* HWIP_H */
HwiP_Params::eventId
uint16_t eventId
Definition: HwiP.h:79
args
void * args
Definition: hsmclient_msg.h:4
ADFSR
Definition: HwiP.h:277
DFSR
Definition: HwiP.h:287
IFSR::sd
volatile uint32_t sd
Definition: HwiP.h:273
HwiP_inISR
uint32_t HwiP_inISR(void)
Check if the caller of this function is inside a ISR or not.
AIFSR
Definition: HwiP.h:259
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:288
IFSR
Definition: HwiP.h:270
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:271
AIFSR::recoverable_error
volatile uint32_t recoverable_error
Definition: HwiP.h:264
ADFSR::recoverable_error
volatile uint32_t recoverable_error
Definition: HwiP.h:282
AIFSR::index
volatile uint32_t index
Definition: HwiP.h:260
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
DFSR::sd
volatile uint32_t sd
Definition: HwiP.h:290
HwiP_Params::callback
HwiP_FxnCallback callback
Definition: HwiP.h:77
ADFSR::cacheway
volatile uint32_t cacheway
Definition: HwiP.h:284
HwiP_init
void HwiP_init(void)
Initialize Hwi module.
HwiP_Object
Opaque Hwi object used with the Hwi APIs.
Definition: HwiP.h:93
AIFSR::side_ext
volatile uint32_t side_ext
Definition: HwiP.h:262
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:278
HwiP_clearInt
void HwiP_clearInt(uint32_t intNum)
Clear a pending specific interrupt.
AIFSR::cacheway
volatile uint32_t cacheway
Definition: HwiP.h:266
ADFSR::side_ext
volatile uint32_t side_ext
Definition: HwiP.h:280
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:292
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