GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: core/src/ux_device_stack_configuration_get.c Lines: 9 9 100.0 %
Date: 2026-03-06 18:57:10 Branches: 0 0 - %

Line Branch Exec Source
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
/** USBX Component                                                        */
17
/**                                                                       */
18
/**   Device Stack                                                        */
19
/**                                                                       */
20
/**************************************************************************/
21
/**************************************************************************/
22
23
#define UX_SOURCE_CODE
24
25
26
/* Include necessary system files.  */
27
28
#include "ux_api.h"
29
#include "ux_device_stack.h"
30
31
32
/**************************************************************************/
33
/*                                                                        */
34
/*  FUNCTION                                               RELEASE        */
35
/*                                                                        */
36
/*    _ux_device_stack_configuration_get                  PORTABLE C      */
37
/*                                                           6.1          */
38
/*  AUTHOR                                                                */
39
/*                                                                        */
40
/*    Chaoqiong Xiao, Microsoft Corporation                               */
41
/*                                                                        */
42
/*  DESCRIPTION                                                           */
43
/*                                                                        */
44
/*    This function gets the current configuration for the device.        */
45
/*                                                                        */
46
/*  INPUT                                                                 */
47
/*                                                                        */
48
/*    None                                                                */
49
/*                                                                        */
50
/*  OUTPUT                                                                */
51
/*                                                                        */
52
/*    Completion Status                                                   */
53
/*                                                                        */
54
/*  CALLS                                                                 */
55
/*                                                                        */
56
/*    _ux_device_stack_transfer_request     Transfer request              */
57
/*                                                                        */
58
/*  CALLED BY                                                             */
59
/*                                                                        */
60
/*    Application                                                         */
61
/*    Device Stack                                                        */
62
/*                                                                        */
63
/**************************************************************************/
64
1
UINT  _ux_device_stack_configuration_get(VOID)
65
{
66
67
UX_SLAVE_TRANSFER       *transfer_request;
68
UX_SLAVE_DEVICE         *device;
69
UX_SLAVE_ENDPOINT       *endpoint;
70
UINT                    status;
71
72
    /* Get the pointer to the device.  */
73
1
    device =  &_ux_system_slave -> ux_system_slave_device;
74
75
    /* Get the control endpoint for the device.  */
76
1
    endpoint =  &device -> ux_slave_device_control_endpoint;
77
78
    /* Get the pointer to the transfer request associated with the endpoint.  */
79
1
    transfer_request =  &endpoint -> ux_slave_endpoint_transfer_request;
80
81
    /* Set the value of the configuration in the buffer.  */
82
1
    *transfer_request -> ux_slave_transfer_request_data_pointer =
83
1
                (UCHAR) device -> ux_slave_device_configuration_selected;
84
85
    /* If trace is enabled, insert this event into the trace buffer.  */
86
    UX_TRACE_IN_LINE_INSERT(UX_TRACE_DEVICE_STACK_CONFIGURATION_GET, device -> ux_slave_device_configuration_selected, 0, 0, 0, UX_TRACE_DEVICE_STACK_EVENTS, 0, 0)
87
88
    /* Set the phase of the transfer to data out.  */
89
1
    transfer_request -> ux_slave_transfer_request_phase =  UX_TRANSFER_PHASE_DATA_OUT;
90
91
    /* Send the descriptor with the appropriate length to the host.  */
92
1
    status =  _ux_device_stack_transfer_request(transfer_request, 1, 1);
93
94
    /* Return the function status.  */
95
1
    return(status);
96
}
97