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 /** USBX Component */ 17 /** */ 18 /** Host Simulator Controller Driver */ 19 /** */ 20 /**************************************************************************/ 21 /**************************************************************************/ 22 23 #define UX_SOURCE_CODE 24 25 26 /* Include necessary system files. */ 27 28 #include "ux_api.h" 29 #include "ux_hcd_sim_host.h" 30 31 #if !defined(UX_HOST_STANDALONE) 32 #include "tx_timer.h" 33 34 35 /**************************************************************************/ 36 /* */ 37 /* FUNCTION RELEASE */ 38 /* */ 39 /* _ux_hcd_sim_host_timer_function PORTABLE C */ 40 /* 6.1.10 */ 41 /* AUTHOR */ 42 /* */ 43 /* Chaoqiong Xiao, Microsoft Corporation */ 44 /* */ 45 /* DESCRIPTION */ 46 /* */ 47 /* This function is the timer function of the simulator. It is */ 48 /* invoked on a timer every tick. */ 49 /* */ 50 /* It's for RTOS mode. */ 51 /* */ 52 /* INPUT */ 53 /* */ 54 /* hcd_sim_host_addr Address of host controller */ 55 /* */ 56 /* OUTPUT */ 57 /* */ 58 /* None */ 59 /* */ 60 /* CALLS */ 61 /* */ 62 /* _ux_utility_semaphore_put Put semaphore */ 63 /* */ 64 /* CALLED BY */ 65 /* */ 66 /* ThreadX */ 67 /* */ 68 /* RELEASE HISTORY */ 69 /* */ 70 /* DATE NAME DESCRIPTION */ 71 /* */ 72 /* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */ 73 /* 09-30-2020 Chaoqiong Xiao Modified comment(s), */ 74 /* resulting in version 6.1 */ 75 /* 01-31-2022 Chaoqiong Xiao Modified comment(s), */ 76 /* used macros to configure */ 77 /* for RTOS mode compile, */ 78 /* resulting in version 6.1.10 */ 79 /* */ 80 /**************************************************************************/ _ux_hcd_sim_host_timer_function(ULONG hcd_sim_host_addr)81VOID _ux_hcd_sim_host_timer_function(ULONG hcd_sim_host_addr) 82 { 83 84 UX_HCD_SIM_HOST *hcd_sim_host; 85 UX_HCD *hcd; 86 87 88 /* Setup pointer to simulator host structure. */ 89 UX_TIMER_EXTENSION_PTR_GET(hcd_sim_host, UX_HCD_SIM_HOST, hcd_sim_host_addr) 90 91 /* Get the pointers to the generic HCD areas. */ 92 hcd = hcd_sim_host -> ux_hcd_sim_host_hcd_owner; 93 94 /* Increase the interrupt count. This indicates the controller is still alive. */ 95 hcd_sim_host -> ux_hcd_sim_host_interrupt_count++; 96 97 /* Check if the controller is operational, if not, skip it. */ 98 if (hcd -> ux_hcd_status == UX_HCD_STATUS_OPERATIONAL) 99 { 100 101 /* Wake up the thread for the controller transaction processing. */ 102 hcd -> ux_hcd_thread_signal++; 103 _ux_host_semaphore_put(&_ux_system_host -> ux_system_host_hcd_semaphore); 104 } 105 } 106 #endif 107