5353#ifndef TX_PORT_H
5454#define TX_PORT_H
5555
56- #ifdef __ASSEMBLER__
57-
58-
59- #else /*not __ASSEMBLER__ */
56+ #ifndef __ASSEMBLER__
6057
6158/* Include for memset. */
6259#include <string.h>
7168 alternately be defined on the command line. */
7269
7370#include "tx_user.h"
74- #endif
71+ #endif /* TX_INCLUDE_USER_DEFINE_FILE */
7572
73+ #endif /* __ASSEMBLER__ */
7674
7775
7876/* Define ThreadX basic types for this port. */
7977
8078#define VOID void
79+
80+ #ifndef __ASSEMBLER__
8181typedef char CHAR ;
8282typedef unsigned char UCHAR ;
8383typedef int INT ;
@@ -88,6 +88,8 @@ typedef unsigned long long ULONG64;
8888typedef short SHORT ;
8989typedef unsigned short USHORT ;
9090#define ULONG64_DEFINED
91+ #endif /* __ASSEMBLER__ */
92+
9193
9294
9395
@@ -233,20 +235,26 @@ typedef unsigned short USHORT;
233235 is used to define a local function save area for the disable and restore
234236 macros. */
235237
238+ /* Expose helper used to perform an atomic read/modify/write of mstatus.
239+ The helper composes and returns the posture per ThreadX contract. */
240+ #ifndef __ASSEMBLER__
241+ UINT _tx_thread_interrupt_control (UINT new_posture );
242+ #endif
243+
236244#ifdef TX_DISABLE_INLINE
237245
238246#define TX_INTERRUPT_SAVE_AREA register UINT interrupt_save;
239247
240248#define TX_DISABLE __asm__ volatile("csrrci %0, mstatus, 8" : "=r" (interrupt_save) :: "memory");
241249#define TX_RESTORE { \
242- unsigned long _temp_mstatus; \
243- __asm__ volatile( \
244- "csrc mstatus, 8\n" \
245- "andi %0, %1, 8\n" \
246- "csrs mstatus, %0" \
247- : "=&r" (_temp_mstatus) \
248- : "r" (interrupt_save) \
249- : "memory"); \
250+ unsigned long _temp_mstatus; \
251+ __asm__ volatile( \
252+ "csrc mstatus, 8\n" \
253+ "andi %0, %1, 8\n" \
254+ "csrs mstatus, %0" \
255+ : "=&r" (_temp_mstatus) \
256+ : "r" (interrupt_save) \
257+ : "memory"); \
250258 }
251259
252260#else
@@ -271,11 +279,13 @@ typedef unsigned short USHORT;
271279
272280/* Define the version ID of ThreadX. This may be utilized by the application. */
273281
282+ #ifndef __ASSEMBLER__
274283#ifdef TX_THREAD_INIT
275284CHAR _tx_version_id [] =
276285 "Copyright (c) 2024 Microsoft Corporation. * ThreadX RISC-V32/GNU Version 6.4.2 *" ;
277286#else
278287extern CHAR _tx_version_id [];
279- #endif /* TX_THREAD_INIT */
280- #endif /* __ASSEMBLER__ */
281- #endif /* TX_PORT_H */
288+ #endif /* TX_THREAD_INIT */
289+ #endif /* __ASSEMBLER__ */
290+
291+ #endif /* TX_PORT_H */
0 commit comments