1 |
|
|
/*************************************************************************** |
2 |
|
|
* Copyright (c) 2024 Microsoft Corporation |
3 |
|
|
* Copyright (c) 2026-present Eclipse ThreadX contributors |
4 |
|
|
* |
5 |
|
|
* This program and the accompanying materials are made available under the |
6 |
|
|
* terms of the MIT License which is available at |
7 |
|
|
* https://opensource.org/licenses/MIT. |
8 |
|
|
* |
9 |
|
|
* SPDX-License-Identifier: MIT |
10 |
|
|
**************************************************************************/ |
11 |
|
|
|
12 |
|
|
|
13 |
|
|
/**************************************************************************/ |
14 |
|
|
/**************************************************************************/ |
15 |
|
|
/** */ |
16 |
|
|
/** GUIX Component */ |
17 |
|
|
/** */ |
18 |
|
|
/** System Management (System) */ |
19 |
|
|
/** */ |
20 |
|
|
/**************************************************************************/ |
21 |
|
|
|
22 |
|
|
#define GX_SOURCE_CODE |
23 |
|
|
|
24 |
|
|
|
25 |
|
|
/* Include necessary system files. */ |
26 |
|
|
|
27 |
|
|
#include "gx_api.h" |
28 |
|
|
#include "gx_system.h" |
29 |
|
|
|
30 |
|
|
/* Bring in externs for caller checking code. */ |
31 |
|
|
GX_CALLER_CHECKING_EXTERNS |
32 |
|
|
|
33 |
|
|
/**************************************************************************/ |
34 |
|
|
/* */ |
35 |
|
|
/* FUNCTION RELEASE */ |
36 |
|
|
/* */ |
37 |
|
|
/* _gxe_system_timer_start PORTABLE C */ |
38 |
|
|
/* 6.1 */ |
39 |
|
|
/* AUTHOR */ |
40 |
|
|
/* */ |
41 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
42 |
|
|
/* */ |
43 |
|
|
/* DESCRIPTION */ |
44 |
|
|
/* */ |
45 |
|
|
/* This function checks for errors in system timer start call. */ |
46 |
|
|
/* */ |
47 |
|
|
/* INPUT */ |
48 |
|
|
/* */ |
49 |
|
|
/* owner Pointer to widget control */ |
50 |
|
|
/* block */ |
51 |
|
|
/* timer_id ID of timer */ |
52 |
|
|
/* initial ticks Initial expiration ticks */ |
53 |
|
|
/* reschedule_ticks Periodic expiration ticks */ |
54 |
|
|
/* */ |
55 |
|
|
/* OUTPUT */ |
56 |
|
|
/* */ |
57 |
|
|
/* status Completion status */ |
58 |
|
|
/* */ |
59 |
|
|
/* CALLS */ |
60 |
|
|
/* */ |
61 |
|
|
/* _gx_system_timer_start Actual system timer start call*/ |
62 |
|
|
/* */ |
63 |
|
|
/* CALLED BY */ |
64 |
|
|
/* */ |
65 |
|
|
/* GUIX Application */ |
66 |
|
|
/* */ |
67 |
|
|
/**************************************************************************/ |
68 |
|
70 |
UINT _gxe_system_timer_start(GX_WIDGET *owner, UINT timer_id, UINT initial_ticks, UINT reschedule_ticks) |
69 |
|
|
{ |
70 |
|
|
UINT status; |
71 |
|
|
|
72 |
|
|
/* Check for invalid caller. */ |
73 |
✓✓✓✓ ✓✓ |
70 |
GX_INIT_AND_THREADS_CALLER_CHECKING |
74 |
|
|
|
75 |
|
|
/* Check for no more timers. */ |
76 |
✓✓ |
68 |
if (!_gx_system_free_timer_list) |
77 |
|
|
{ |
78 |
|
1 |
return(GX_OUT_OF_TIMERS); |
79 |
|
|
} |
80 |
|
|
|
81 |
|
|
/* Check for invalid pointer. */ |
82 |
✓✓ |
67 |
if (owner == GX_NULL) |
83 |
|
|
{ |
84 |
|
2 |
return(GX_PTR_ERROR); |
85 |
|
|
} |
86 |
|
|
|
87 |
|
|
/* Check for invalid widget. */ |
88 |
✓✓ |
65 |
if (owner -> gx_widget_type <= 0) |
89 |
|
|
{ |
90 |
|
1 |
return(GX_INVALID_WIDGET); |
91 |
|
|
} |
92 |
|
|
|
93 |
|
|
/* Check for invalid time values. */ |
94 |
✓✓ |
64 |
if (initial_ticks == 0) |
95 |
|
|
{ |
96 |
|
1 |
return(GX_INVALID_VALUE); |
97 |
|
|
} |
98 |
|
|
|
99 |
|
|
/* Call actual system timer start. */ |
100 |
|
63 |
status = _gx_system_timer_start(owner, timer_id, initial_ticks, reschedule_ticks); |
101 |
|
|
|
102 |
|
|
/* Return status. */ |
103 |
|
63 |
return(status); |
104 |
|
|
} |
105 |
|
|
|