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