blob: b2c6984774706950322a254439debb26c38d36dd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
|
/***************************************************************************
* Copyright (c) 2024 Microsoft Corporation
* Copyright (c) 2026-present Eclipse ThreadX contributors
*
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
*
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** USBX Component */
/** */
/** Device Stack */
/** */
/**************************************************************************/
/**************************************************************************/
#define UX_SOURCE_CODE
/* Include necessary system files. */
#include "ux_api.h"
#include "ux_device_stack.h"
#if defined(UX_DEVICE_STANDALONE)
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _ux_device_stack_tasks_run PORTABLE C */
/* 6.1.10 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This function runs device stack and registered classes tasks. */
/* */
/* It's for standalone mode. */
/* */
/* INPUT */
/* */
/* */
/* OUTPUT */
/* */
/* UX_STATE_RESET Tasks suspended */
/* UX_STATE_IDLE Activated but no task ran */
/* (others > UX_STATE_IDLE) Tasks running */
/* */
/* CALLS */
/* */
/* (ux_slave_dcd_function) run DCD function */
/* (ux_slave_class_task_function) run Class tasks function */
/* */
/* CALLED BY */
/* */
/* Application */
/* */
/**************************************************************************/
UINT _ux_device_stack_tasks_run(VOID)
{
UX_SLAVE_DCD *dcd;
UX_SLAVE_CLASS *class_instance;
ULONG class_index;
UINT status;
status = UX_STATE_RESET;
/* Run all DCD tasks (pending ISR handle). */
dcd = &_ux_system_slave -> ux_system_slave_dcd;
dcd -> ux_slave_dcd_function(dcd, UX_DCD_TASKS_RUN, UX_NULL);
/* Run all Class instance tasks. */
class_instance = _ux_system_slave -> ux_system_slave_class_array;
for (class_index = 0; class_index < UX_SYSTEM_DEVICE_MAX_CLASS_GET(); class_index++)
{
/* Skip classes not used. */
if (class_instance -> ux_slave_class_status == UX_UNUSED)
continue;
/* Skip classes has no task function. */
if (class_instance -> ux_slave_class_task_function == UX_NULL)
continue;
/* Invoke task function. */
status |= class_instance -> ux_slave_class_task_function(class_instance -> ux_slave_class_instance);
/* Move to the next class. */
class_instance ++;
}
/* Return overall status. */
return(status);
}
#endif
|