PDK API Guide for J721E
enet_osal.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) Texas Instruments Incorporated 2020
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 
39 #ifndef ENET_OSAL_H_
40 #define ENET_OSAL_H_
41 
42 /* ========================================================================== */
43 /* Include Files */
44 /* ========================================================================== */
45 
46 #include <stdint.h>
47 #include <stdbool.h>
48 
49 #ifdef __cplusplus
50 extern "C" {
51 #endif
52 
53 /* ========================================================================== */
54 /* Macros */
55 /* ========================================================================== */
56 
57 /* None */
58 
59 /* ========================================================================== */
60 /* Structures and Enums */
61 /* ========================================================================== */
62 
68 typedef uintptr_t (*EnetOsal_DisableAllIntr)(void);
69 
75 typedef void (*EnetOsal_RestoreAllIntr)(uintptr_t cookie);
76 
82 typedef void (*EnetOsal_RestoreIntr)(uint32_t coreIntrNum);
83 
89 typedef void (*EnetOsal_DisableIntr)(uint32_t coreIntrNum);
90 
96 typedef void (*EnetOsal_Isr)(uintptr_t arg);
97 
110 typedef void *(*EnetOsal_RegisterIntr)(EnetOsal_Isr isrFxn,
111  uint32_t coreIntrNum,
112  uint32_t intrPriority,
113  uint32_t triggerType,
114  void *arg);
115 
121 typedef void (*EnetOsal_UnregisterIntr)(void *hHwi);
122 
129 typedef void *(*EnetOsal_CreateMutex)(void);
130 
136 typedef void (*EnetOsal_DeleteMutex)(void *hMutex);
137 
143 typedef void (*EnetOsal_LockMutex)(void *hMutex);
144 
150 typedef void (*EnetOsal_UnlockMutex)(void *hMutex);
151 
157 typedef bool (*EnetOsal_IsCacheCoherent)(void);
158 
165 typedef void (*EnetOsal_CacheInv)(const void *addr,
166  int32_t size);
167 
174 typedef void (*EnetOsal_CacheWb)(const void *addr,
175  int32_t size);
176 
183 typedef void (*EnetOsal_CacheWbInv)(const void *addr,
184  int32_t size);
185 
191 typedef uint32_t (*EnetOsal_TimerRead)(void);
192 
196 typedef struct EnetOsal_Cfg_s
197 {
200 
203 
206 
209 
212 
215 
218 
221 
224 
227 
230 
233 
236 
239 
242 } EnetOsal_Cfg;
243 
244 /* ========================================================================== */
245 /* Global Variables Declarations */
246 /* ========================================================================== */
247 
248 /* None */
249 
250 /* ========================================================================== */
251 /* Function Declarations */
252 /* ========================================================================== */
253 
262 void EnetOsal_init(const EnetOsal_Cfg *cfg);
263 
270 void EnetOsal_deinit(void);
271 
277 uintptr_t EnetOsal_disableAllIntr(void);
278 
284 void EnetOsal_restoreAllIntr(uintptr_t cookie);
285 
298  uint32_t coreIntrNum,
299  uint32_t intrPriority,
300  uint32_t intrTrigType,
301  void *arg);
302 
308 void EnetOsal_unregisterIntr(void *hHwi);
309 
315 void EnetOsal_enableIntr(uint32_t coreIntrNum);
316 
322 void EnetOsal_disableIntr(uint32_t coreIntrNum);
323 
329 void *EnetOsal_createMutex(void);
330 
336 void EnetOsal_deleteMutex(void *hMutex);
337 
343 void EnetOsal_lockMutex(void *hMutex);
344 
350 void EnetOsal_unlockMutex(void *hMutex);
351 
360 void EnetOsal_cacheInv(const void *addr,
361  int32_t size);
362 
371 void EnetOsal_cacheWb(const void *addr,
372  int32_t size);
373 
382 void EnetOsal_cacheWbInv(const void *addr,
383  int32_t size);
384 
393 uint32_t EnetOsal_timerGetDiff(uint32_t startTime);
394 
400 uint32_t EnetOsal_timerRead(void);
401 
402 /* ========================================================================== */
403 /* Deprecated Function Declarations */
404 /* ========================================================================== */
405 
406 /* None */
407 
408 #ifdef __cplusplus
409 }
410 #endif
411 
412 #endif /* ENET_OSAL_H_ */
EnetOsal_CacheWbInv cacheWbInv
Definition: enet_osal.h:238
void(* EnetOsal_DeleteMutex)(void *hMutex)
Enet OSAL mutex delete function prototype.
Definition: enet_osal.h:136
void(* EnetOsal_UnlockMutex)(void *hMutex)
Enet OSAL mutex lock function prototype.
Definition: enet_osal.h:150
EnetOsal_DeleteMutex deleteMutex
Definition: enet_osal.h:220
uint32_t EnetOsal_timerGetDiff(uint32_t startTime)
Get the time difference with respect to timestamp.
void(* EnetOsal_LockMutex)(void *hMutex)
Enet OSAL mutex lock function prototype.
Definition: enet_osal.h:143
void(* EnetOsal_RestoreIntr)(uint32_t coreIntrNum)
Enet OSAL intr restore function prototype.
Definition: enet_osal.h:82
void(* EnetOsal_DisableIntr)(uint32_t coreIntrNum)
Enet OSAL intr disable function prototype.
Definition: enet_osal.h:89
void EnetOsal_cacheWbInv(const void *addr, int32_t size)
Write-back and invalidate cache.
void(* EnetOsal_CacheWbInv)(const void *addr, int32_t size)
Enet OSAL cache writeback invalidate function prototype.
Definition: enet_osal.h:183
void EnetOsal_disableIntr(uint32_t coreIntrNum)
Disable interrupt.
Enet OSAL configuration paramters.
Definition: enet_osal.h:196
uint32_t(* EnetOsal_TimerRead)(void)
Enet OSAL timer read function prototype.
Definition: enet_osal.h:191
void *(* EnetOsal_RegisterIntr)(EnetOsal_Isr isrFxn, uint32_t coreIntrNum, uint32_t intrPriority, uint32_t triggerType, void *arg)
Enet OSAL ISR register function prototype.
Definition: enet_osal.h:110
EnetOsal_RestoreIntr restoreIntr
Definition: enet_osal.h:208
EnetOsal_CacheInv cacheInv
Definition: enet_osal.h:232
EnetOsal_CacheWb cacheWb
Definition: enet_osal.h:235
EnetOsal_IsCacheCoherent isCacheCoherent
Definition: enet_osal.h:229
EnetOsal_LockMutex lockMutex
Definition: enet_osal.h:223
EnetOsal_DisableIntr disableIntr
Definition: enet_osal.h:205
EnetOsal_UnlockMutex unlockMutex
Definition: enet_osal.h:226
void * EnetOsal_registerIntr(EnetOsal_Isr isrFxn, uint32_t coreIntrNum, uint32_t intrPriority, uint32_t intrTrigType, void *arg)
Register an ISR for an interrupt.
void EnetOsal_deleteMutex(void *hMutex)
Delete a mutex.
uint64_t addr
Definition: csl_udmap_tr.h:214
bool(* EnetOsal_IsCacheCoherent)(void)
Enet OSAL cache coherency check function prototype.
Definition: enet_osal.h:157
EnetOsal_TimerRead timerRead
Definition: enet_osal.h:241
EnetOsal_DisableAllIntr disableAllIntr
Definition: enet_osal.h:199
void EnetOsal_cacheWb(const void *addr, int32_t size)
Write-back cache.
void EnetOsal_deinit(void)
Deinitialize OSAL.
uintptr_t EnetOsal_disableAllIntr(void)
Enet OSAL intr disable function prototype.
EnetOsal_RegisterIntr registerIntr
Definition: enet_osal.h:211
void EnetOsal_enableIntr(uint32_t coreIntrNum)
Enable interrupt.
void(* EnetOsal_Isr)(uintptr_t arg)
Enet OSAL ISR callback function prototype.
Definition: enet_osal.h:96
void * EnetOsal_createMutex(void)
Create a mutex.
EnetOsal_RestoreAllIntr restoreAllIntr
Definition: enet_osal.h:202
void *(* EnetOsal_CreateMutex)(void)
Enet OSAL mutex create function prototype to protect critical section.
Definition: enet_osal.h:129
void EnetOsal_cacheInv(const void *addr, int32_t size)
Invalidate cache.
void EnetOsal_init(const EnetOsal_Cfg *cfg)
Initialize OSAL with provided configuration.
void EnetOsal_unregisterIntr(void *hHwi)
Unregister an interrupt.
uint16_t size
Definition: tisci_boardcfg.h:112
void EnetOsal_unlockMutex(void *hMutex)
Unlock a mutex.
void(* EnetOsal_CacheInv)(const void *addr, int32_t size)
Enet OSAL cache invalidate function prototype.
Definition: enet_osal.h:165
void(* EnetOsal_CacheWb)(const void *addr, int32_t size)
Enet OSAL cache writeback function prototype.
Definition: enet_osal.h:174
void(* EnetOsal_UnregisterIntr)(void *hHwi)
Enet OSAL ISR unregister function prototype.
Definition: enet_osal.h:121
void EnetOsal_lockMutex(void *hMutex)
Lock a mutex.
uintptr_t(* EnetOsal_DisableAllIntr)(void)
Enet OSAL intr disable function prototype.
Definition: enet_osal.h:68
EnetOsal_CreateMutex createMutex
Definition: enet_osal.h:217
void(* EnetOsal_RestoreAllIntr)(uintptr_t cookie)
Enet OSAL intr restore function prototype.
Definition: enet_osal.h:75
EnetOsal_UnregisterIntr unregisterIntr
Definition: enet_osal.h:214
void EnetOsal_restoreAllIntr(uintptr_t cookie)
Enet OSAL intr restore function prototype.
uint32_t EnetOsal_timerRead(void)
Read current timer value.