1 /*************************************************************************** 2 * Copyright (c) 2024 Microsoft Corporation 3 * 4 * This program and the accompanying materials are made available under the 5 * terms of the MIT License which is available at 6 * https://opensource.org/licenses/MIT. 7 * 8 * SPDX-License-Identifier: MIT 9 **************************************************************************/ 10 11 12 /**************************************************************************/ 13 /**************************************************************************/ 14 /** */ 15 /** NetX Component */ 16 /** */ 17 /** User Specific */ 18 /** */ 19 /**************************************************************************/ 20 /**************************************************************************/ 21 22 23 /**************************************************************************/ 24 /* */ 25 /* PORT SPECIFIC C INFORMATION RELEASE */ 26 /* */ 27 /* nx_user.h PORTABLE C */ 28 /* 6.0 */ 29 /* */ 30 /* AUTHOR */ 31 /* */ 32 /* Yuxin Zhou, Microsoft Corporation */ 33 /* */ 34 /* DESCRIPTION */ 35 /* */ 36 /* This file contains user defines for configuring NetX in specific */ 37 /* ways. This file will have an effect only if the application and */ 38 /* NetX library are built with NX_INCLUDE_USER_DEFINE_FILE defined. */ 39 /* Note that all the defines in this file may also be made on the */ 40 /* command line when building NetX library and application objects. */ 41 /* */ 42 /* RELEASE HISTORY */ 43 /* */ 44 /* DATE NAME DESCRIPTION */ 45 /* */ 46 /* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ 47 /* */ 48 /**************************************************************************/ 49 50 #ifndef NX_USER_H 51 #define NX_USER_H 52 53 /* Define the extension to hold the control block for 64-bit mode. */ 54 #define NX_THREAD_EXTENSION_PTR_SET(a, b) { \ 55 TX_THREAD *thread_ptr; \ 56 thread_ptr = (TX_THREAD *) (a); \ 57 (thread_ptr -> tx_thread_extension_ptr) = (VOID *)(b); \ 58 } 59 #define NX_THREAD_EXTENSION_PTR_GET(a, b, c) { \ 60 NX_PARAMETER_NOT_USED(c); \ 61 TX_THREAD *thread_ptr; \ 62 thread_ptr = tx_thread_identify(); \ 63 while(1)\ 64 { \ 65 if (thread_ptr -> tx_thread_extension_ptr) \ 66 { \ 67 (a) = (b *)(thread_ptr -> tx_thread_extension_ptr); \ 68 break; \ 69 } \ 70 tx_thread_sleep(1); \ 71 } \ 72 } 73 #define NX_TIMER_EXTENSION_PTR_SET(a, b) { \ 74 TX_TIMER *timer_ptr; \ 75 timer_ptr = (TX_TIMER *) (a); \ 76 (timer_ptr -> tx_timer_internal.tx_timer_internal_extension_ptr) = (VOID *)(b); \ 77 } 78 #define NX_TIMER_EXTENSION_PTR_GET(a, b, c) { \ 79 NX_PARAMETER_NOT_USED(c); \ 80 if (!_tx_timer_expired_timer_ptr -> tx_timer_internal_extension_ptr) \ 81 return; \ 82 (a) = (b *)(_tx_timer_expired_timer_ptr -> tx_timer_internal_extension_ptr); \ 83 } 84 85 #endif 86 87