GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: core/src/ux_utility_timer_create.c Lines: 5 5 100.0 %
Date: 2025-07-29 21:51:32 Branches: 2 2 100.0 %

Line Branch Exec Source
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
/** USBX Component                                                        */
16
/**                                                                       */
17
/**   Utility                                                             */
18
/**                                                                       */
19
/**************************************************************************/
20
/**************************************************************************/
21
22
23
/* Include necessary system files.  */
24
25
#define UX_SOURCE_CODE
26
27
#include "ux_api.h"
28
29
30
#if !defined(UX_STANDALONE)
31
/**************************************************************************/
32
/*                                                                        */
33
/*  FUNCTION                                               RELEASE        */
34
/*                                                                        */
35
/*    _ux_utility_timer_create                            PORTABLE C      */
36
/*                                                           6.1.11       */
37
/*  AUTHOR                                                                */
38
/*                                                                        */
39
/*    Chaoqiong Xiao, Microsoft Corporation                               */
40
/*                                                                        */
41
/*  DESCRIPTION                                                           */
42
/*                                                                        */
43
/*    This function creates a timer.                                      */
44
/*                                                                        */
45
/*  INPUT                                                                 */
46
/*                                                                        */
47
/*    timer                                 Pointer to timer              */
48
/*    timer_name                            Name of timer                 */
49
/*                                                                        */
50
/*  OUTPUT                                                                */
51
/*                                                                        */
52
/*    Completion Status                                                   */
53
/*                                                                        */
54
/*  CALLS                                                                 */
55
/*                                                                        */
56
/*    tx_timer_create                       ThreadX timer create          */
57
/*                                                                        */
58
/*  CALLED BY                                                             */
59
/*                                                                        */
60
/*    USBX Components                                                     */
61
/*                                                                        */
62
/*  RELEASE HISTORY                                                       */
63
/*                                                                        */
64
/*    DATE              NAME                      DESCRIPTION             */
65
/*                                                                        */
66
/*  05-19-2020     Chaoqiong Xiao           Initial Version 6.0           */
67
/*  09-30-2020     Chaoqiong Xiao           Modified comment(s),          */
68
/*                                            resulting in version 6.1    */
69
/*  04-25-2022     Chaoqiong Xiao           Modified comment(s),          */
70
/*                                            off in standalone build,    */
71
/*                                            resulting in version 6.1.11 */
72
/*  xx-xx-xxxx     Chaoqiong Xiao           Modified comment(s),          */
73
/*                                            used UX prefix to refer to  */
74
/*                                            TX symbols instead of using */
75
/*                                            them directly,              */
76
/*                                            resulting in version 6.x    */
77
/*                                                                        */
78
/**************************************************************************/
79
373
UINT  _ux_utility_timer_create(UX_TIMER *timer, CHAR *timer_name, VOID (*expiration_function) (ULONG),
80
                                ULONG expiration_input, ULONG initial_ticks, ULONG reschedule_ticks,
81
                                UINT activation_flag)
82
{
83
84
UINT    status;
85
86
87
    /* Call ThreadX to create the timer object.  */
88
373
    status =  tx_timer_create(timer, (CHAR *) timer_name, expiration_function, expiration_input,
89
                                initial_ticks, reschedule_ticks, activation_flag);
90
91
    /* Check status.  */
92
373
    if (status != UX_SUCCESS)
93
94
        /* Error trap. */
95
1
        _ux_system_error_handler(UX_SYSTEM_LEVEL_THREAD, UX_SYSTEM_CONTEXT_UTILITY, status);
96
97
    /* Return completion status.  */
98
373
    return(status);
99
}
100
#endif