5353#ifndef TX_PORT_H
5454#define TX_PORT_H
5555
56- #ifdef __ASSEMBLER__
57-
58-
59- #if __riscv_xlen == 64
60- # define SLL32 sllw
61- # define STORE sd
62- # define LOAD ld
63- # define LWU lwu
64- # define LOG_REGBYTES 3
65- #else
66- # define SLL32 sll
67- # define STORE sw
68- # define LOAD lw
69- # define LWU lw
70- # define LOG_REGBYTES 2
71- #endif
72- #define REGBYTES (1 << LOG_REGBYTES)
73-
74- #else /*not __ASSEMBLER__ */
75-
7656/* Include for memset. */
7757#include <string.h>
7858
8666 alternately be defined on the command line. */
8767
8868#include "tx_user.h"
89- #endif
90-
91-
92- /* Define compiler library include files. */
69+ #endif /* TX_INCLUDE_USER_DEFINE_FILE */
9370
9471
9572/* Define ThreadX basic types for this port. */
@@ -105,8 +82,6 @@ typedef unsigned long long ULONG64;
10582typedef short SHORT ;
10683typedef unsigned short USHORT ;
10784#define ULONG64_DEFINED
108- #define ALIGN_TYPE_DEFINED
109- #define ALIGN_TYPE ULONG64
11085
11186
11287
@@ -253,25 +228,25 @@ typedef unsigned short USHORT;
253228 is used to define a local function save area for the disable and restore
254229 macros. */
255230
256- #ifdef TX_DISABLE_INLINE
231+ /* Expose helper used to perform an atomic read/modify/write of mstatus.
232+ The helper composes and returns the posture per ThreadX contract. */
233+ UINT _tx_thread_interrupt_control (UINT new_posture );
257234
258- ULONG64 _tx_thread_interrupt_control ( unsigned int new_posture );
235+ #ifdef TX_DISABLE_INLINE
259236
260- #define TX_INTERRUPT_SAVE_AREA register ULONG64 interrupt_save;
237+ #define TX_INTERRUPT_SAVE_AREA register UINT interrupt_save;
261238
262239#define TX_DISABLE interrupt_save = _tx_thread_interrupt_control(TX_INT_DISABLE);
263240#define TX_RESTORE _tx_thread_interrupt_control(interrupt_save);
264241
265242#else
266243
267- #define TX_INTERRUPT_SAVE_AREA ULONG64 interrupt_save;
268- /* Atomically read mstatus into interrupt_save and clear bit 3 of mstatus. */
269- #define TX_DISABLE {__asm__ ("csrrci %0, mstatus, 0x08" : "=r" (interrupt_save) : );};
270- /* We only care about mstatus.mie (bit 3), so mask interrupt_save and write to mstatus. */
271- #define TX_RESTORE {register ULONG64 __tempmask = interrupt_save & 0x08; \
272- __asm__ ("csrrs x0, mstatus, %0 \n\t" : : "r" (__tempmask) : );};
244+ #define TX_INTERRUPT_SAVE_AREA register UINT interrupt_save;
273245
274- #endif
246+ #define TX_DISABLE interrupt_save = _tx_thread_interrupt_control(TX_INT_DISABLE);
247+ #define TX_RESTORE _tx_thread_interrupt_control(interrupt_save);
248+
249+ #endif /* TX_DISABLE_INLINE */
275250
276251
277252/* Define the interrupt lockout macros for each ThreadX object. */
@@ -291,7 +266,6 @@ CHAR _tx_version_id[] =
291266 "Copyright (c) 2024 Microsoft Corporation. * ThreadX RISC-V64/GNU Version 6.4.2 *" ;
292267#else
293268extern CHAR _tx_version_id [];
294- #endif
269+ #endif /* TX_THREAD_INIT */
295270
296- #endif /*not __ASSEMBLER__ */
297- #endif
271+ #endif /* TX_PORT_H */
0 commit comments