1 /**************************************************************************/ 2 /* */ 3 /* Copyright (c) Microsoft Corporation. All rights reserved. */ 4 /* */ 5 /* This software is licensed under the Microsoft Software License */ 6 /* Terms for Microsoft Azure RTOS. Full text of the license can be */ 7 /* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ 8 /* and in the root directory of this software. */ 9 /* */ 10 /**************************************************************************/ 11 12 13 /**************************************************************************/ 14 /**************************************************************************/ 15 /** */ 16 /** ThreadX Component */ 17 /** */ 18 /** Timer - High Level SMP Support */ 19 /** */ 20 /**************************************************************************/ 21 /**************************************************************************/ 22 23 #define TX_SOURCE_CODE 24 #define TX_THREAD_SMP_SOURCE_CODE 25 26 27 /* Include necessary system files. */ 28 29 #include "tx_api.h" 30 #include "tx_initialize.h" 31 #include "tx_timer.h" 32 #include "tx_thread.h" 33 34 35 /**************************************************************************/ 36 /* */ 37 /* FUNCTION RELEASE */ 38 /* */ 39 /* _tx_timer_smp_core_exclude PORTABLE SMP */ 40 /* 6.1 */ 41 /* AUTHOR */ 42 /* */ 43 /* William E. Lamie, Microsoft Corporation */ 44 /* */ 45 /* DESCRIPTION */ 46 /* */ 47 /* This function allows the application to exclude one or more cores */ 48 /* from executing the specified timer. */ 49 /* */ 50 /* INPUT */ 51 /* */ 52 /* timer_ptr Pointer to the timer */ 53 /* exclusion_map Bit map of exclusion list, */ 54 /* where bit 0 set means that */ 55 /* this thread cannot run on */ 56 /* core0, etc. */ 57 /* */ 58 /* OUTPUT */ 59 /* */ 60 /* Status */ 61 /* */ 62 /* CALLS */ 63 /* */ 64 /* None */ 65 /* */ 66 /* CALLED BY */ 67 /* */ 68 /* Application Code */ 69 /* */ 70 /* RELEASE HISTORY */ 71 /* */ 72 /* DATE NAME DESCRIPTION */ 73 /* */ 74 /* 09-30-2020 William E. Lamie Initial Version 6.1 */ 75 /* */ 76 /**************************************************************************/ _tx_timer_smp_core_exclude(TX_TIMER * timer_ptr,ULONG exclusion_map)77UINT _tx_timer_smp_core_exclude(TX_TIMER *timer_ptr, ULONG exclusion_map) 78 { 79 80 TX_INTERRUPT_SAVE_AREA 81 82 UINT status; 83 84 85 /* First, make sure the timer pointer is valid. */ 86 if (timer_ptr == TX_NULL) 87 { 88 89 /* Return pointer error. */ 90 status = TX_TIMER_ERROR; 91 } 92 93 /* Check for valid ID. */ 94 else if (timer_ptr -> tx_timer_id != TX_TIMER_ID) 95 { 96 97 /* Return pointer error. */ 98 status = TX_TIMER_ERROR; 99 } 100 else 101 { 102 103 /* Disable interrupts. */ 104 TX_DISABLE 105 106 /* Now store in the core exclusion information. */ 107 timer_ptr -> tx_timer_internal.tx_timer_internal_smp_cores_excluded = (timer_ptr -> tx_timer_internal.tx_timer_internal_smp_cores_excluded & ~(((ULONG) TX_THREAD_SMP_CORE_MASK))) | 108 (exclusion_map & ((ULONG) TX_THREAD_SMP_CORE_MASK)); 109 110 /* Restore interrupts. */ 111 TX_RESTORE 112 113 /* Return success. */ 114 status = TX_SUCCESS; 115 } 116 117 /* Return success. */ 118 return(status); 119 } 120 121