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 /**   Module                                                              */
19 /**                                                                       */
20 /**************************************************************************/
21 /**************************************************************************/
22 
23 #define TXM_MODULE
24 #include "txm_module.h"
25 #ifndef TXM_TIMER_CREATE_CALL_NOT_USED
26 /**************************************************************************/
27 /*                                                                        */
28 /*  FUNCTION                                               RELEASE        */
29 /*                                                                        */
30 /*    _txe_timer_create                                   PORTABLE C      */
31 /*                                                           6.1.10       */
32 /*  AUTHOR                                                                */
33 /*                                                                        */
34 /*    Scott Larson, Microsoft Corporation                                 */
35 /*                                                                        */
36 /*  DESCRIPTION                                                           */
37 /*                                                                        */
38 /*    This function checks for errors in the create application timer     */
39 /*    function call.                                                      */
40 /*                                                                        */
41 /*  INPUT                                                                 */
42 /*                                                                        */
43 /*    timer_ptr                         Pointer to timer control block    */
44 /*    name_ptr                          Pointer to timer name             */
45 /*    expiration_function               Application expiration function   */
46 /*    initial_ticks                     Initial expiration ticks          */
47 /*    reschedule_ticks                  Reschedule ticks                  */
48 /*    auto_activate                     Automatic activation flag         */
49 /*    timer_control_block_size          Size of timer control block       */
50 /*                                                                        */
51 /*  OUTPUT                                                                */
52 /*                                                                        */
53 /*    TX_TIMER_ERROR                    Invalid timer control block       */
54 /*    TX_TICK_ERROR                     Invalid initial expiration count  */
55 /*    TX_ACTIVATE_ERROR                 Invalid timer activation option   */
56 /*    TX_CALLER_ERROR                   Invalid caller of this function   */
57 /*    status                            Actual completion status          */
58 /*                                                                        */
59 /*  CALLS                                                                 */
60 /*                                                                        */
61 /*    _txm_module_kernel_call_dispatcher                                  */
62 /*                                                                        */
63 /*  CALLED BY                                                             */
64 /*                                                                        */
65 /*    Module application code                                             */
66 /*                                                                        */
67 /*  RELEASE HISTORY                                                       */
68 /*                                                                        */
69 /*    DATE              NAME                      DESCRIPTION             */
70 /*                                                                        */
71 /*  09-30-2020      Scott Larson            Initial Version 6.1           */
72 /*  01-31-2022      Scott Larson            Modified comments and added   */
73 /*                                            CALL_NOT_USED option,       */
74 /*                                            resulting in version 6.1.10 */
75 /*                                                                        */
76 /**************************************************************************/
_txe_timer_create(TX_TIMER * timer_ptr,CHAR * name_ptr,VOID (* expiration_function)(ULONG),ULONG expiration_input,ULONG initial_ticks,ULONG reschedule_ticks,UINT auto_activate,UINT timer_control_block_size)77 UINT _txe_timer_create(TX_TIMER *timer_ptr, CHAR *name_ptr, VOID (*expiration_function)(ULONG), ULONG expiration_input, ULONG initial_ticks, ULONG reschedule_ticks, UINT auto_activate, UINT timer_control_block_size)
78 {
79 
80 UINT return_value;
81 ALIGN_TYPE extra_parameters[6];
82 
83     extra_parameters[0] = (ALIGN_TYPE) expiration_function;
84     extra_parameters[1] = (ALIGN_TYPE) expiration_input;
85     extra_parameters[2] = (ALIGN_TYPE) initial_ticks;
86     extra_parameters[3] = (ALIGN_TYPE) reschedule_ticks;
87     extra_parameters[4] = (ALIGN_TYPE) auto_activate;
88     extra_parameters[5] = (ALIGN_TYPE) timer_control_block_size;
89 
90     /* Call module manager dispatcher.  */
91     return_value = (UINT) (_txm_module_kernel_call_dispatcher)(TXM_TIMER_CREATE_CALL, (ALIGN_TYPE) timer_ptr, (ALIGN_TYPE) name_ptr, (ALIGN_TYPE) extra_parameters);
92 
93     /* Return value to the caller.  */
94     return(return_value);
95 }
96 #endif
97