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 |
|
|
/**************************************************************************/ |
31 |
|
|
/* */ |
32 |
|
|
/* FUNCTION RELEASE */ |
33 |
|
|
/* */ |
34 |
|
|
/* _gx_system_event_fold PORTABLE C */ |
35 |
|
|
/* 6.1 */ |
36 |
|
|
/* AUTHOR */ |
37 |
|
|
/* */ |
38 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
39 |
|
|
/* */ |
40 |
|
|
/* DESCRIPTION */ |
41 |
|
|
/* */ |
42 |
|
|
/* This service folds GUIX events. */ |
43 |
|
|
/* */ |
44 |
|
|
/* INPUT */ |
45 |
|
|
/* */ |
46 |
|
|
/* event Pointer to event */ |
47 |
|
|
/* */ |
48 |
|
|
/* OUTPUT */ |
49 |
|
|
/* */ |
50 |
|
|
/* status Completion status */ |
51 |
|
|
/* */ |
52 |
|
|
/* CALLS */ |
53 |
|
|
/* */ |
54 |
|
|
/* TX_DISABLE */ |
55 |
|
|
/* TX_RESTORE */ |
56 |
|
|
/* _gx_system_pen_speed_update */ |
57 |
|
|
/* _gx_system_event_send Send GUIX events */ |
58 |
|
|
/* */ |
59 |
|
|
/* CALLED BY */ |
60 |
|
|
/* */ |
61 |
|
|
/* GUIX Internal Code */ |
62 |
|
|
/* */ |
63 |
|
|
/**************************************************************************/ |
64 |
|
13808 |
UINT _gx_system_event_fold(GX_EVENT *in_event) |
65 |
|
|
{ |
66 |
|
|
#ifdef GX_THREADX_BINDING |
67 |
|
|
TX_INTERRUPT_SAVE_AREA |
68 |
|
|
|
69 |
|
|
GX_EVENT *pEvent; |
70 |
|
|
ULONG *pSrc; |
71 |
|
|
TX_QUEUE *pQueue; |
72 |
|
|
|
73 |
|
13808 |
TX_DISABLE |
74 |
|
|
|
75 |
|
13808 |
pQueue = &_gx_system_event_queue; |
76 |
|
|
|
77 |
✓✓ |
13808 |
if (pQueue -> tx_queue_enqueued) |
78 |
|
|
{ |
79 |
|
237 |
pSrc = pQueue -> tx_queue_read; |
80 |
|
|
|
81 |
|
|
do |
82 |
|
|
{ |
83 |
|
2591 |
pEvent = (GX_EVENT *)pSrc; |
84 |
|
|
|
85 |
✓✓ |
2591 |
if (pEvent -> gx_event_type == in_event -> gx_event_type && |
86 |
✓✓ |
183 |
pEvent -> gx_event_target == in_event -> gx_event_target) |
87 |
|
|
{ |
88 |
|
|
/* we found a matching event, just update the existing event data |
89 |
|
|
rather than posting a new event |
90 |
|
|
*/ |
91 |
|
|
|
92 |
|
|
/* for timer event, update tick count */ |
93 |
✓✓ |
157 |
if (pEvent -> gx_event_type == GX_EVENT_TIMER) |
94 |
|
|
{ |
95 |
|
1 |
pEvent -> gx_event_payload.gx_event_ulongdata++; |
96 |
|
|
} |
97 |
|
|
else |
98 |
|
|
{ |
99 |
|
|
/* for all other event types, just copy payload */ |
100 |
|
156 |
pEvent -> gx_event_payload.gx_event_ulongdata = in_event -> gx_event_payload.gx_event_ulongdata; |
101 |
|
|
} |
102 |
|
157 |
TX_RESTORE |
103 |
|
|
|
104 |
✓✓ |
157 |
if (pEvent -> gx_event_type == GX_EVENT_PEN_DRAG) |
105 |
|
|
{ |
106 |
|
1 |
_gx_system_pen_speed_update(&pEvent -> gx_event_payload.gx_event_pointdata); |
107 |
|
|
} |
108 |
|
157 |
return GX_SUCCESS; |
109 |
|
|
} |
110 |
|
|
|
111 |
|
2434 |
pSrc += pQueue -> tx_queue_message_size; |
112 |
|
|
|
113 |
✓✓ |
2434 |
if (pSrc >= pQueue -> tx_queue_end) |
114 |
|
|
{ |
115 |
|
9 |
pSrc = pQueue -> tx_queue_start; |
116 |
|
|
} |
117 |
✓✓ |
2434 |
} while (pSrc != pQueue->tx_queue_write); |
118 |
|
|
} |
119 |
|
|
|
120 |
|
13651 |
TX_RESTORE |
121 |
|
|
|
122 |
|
|
/* we didn't find a matching event, so post a new event */ |
123 |
|
13651 |
return _gx_system_event_send(in_event); |
124 |
|
|
#else |
125 |
|
|
return(GX_EVENT_FOLD(in_event)); |
126 |
|
|
#endif |
127 |
|
|
} |
128 |
|
|
|