summaryrefslogtreecommitdiff
path: root/common/usbx_device_classes/src/ux_device_class_pima_object_add.c
blob: 7579080de0f15de05f666364cd84e61c25fd2d64 (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
/***************************************************************************
 * 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 Pima Class                                                   */
/**                                                                       */
/**************************************************************************/
/**************************************************************************/

#define UX_SOURCE_CODE


/* Include necessary system files.  */

#include "ux_api.h"
#include "ux_device_class_pima.h"
#include "ux_device_stack.h"


/**************************************************************************/
/*                                                                        */
/*  FUNCTION                                               RELEASE        */
/*                                                                        */
/*    _ux_device_class_pima_object_add                    PORTABLE C      */
/*                                                           6.1          */
/*  AUTHOR                                                                */
/*                                                                        */
/*    Chaoqiong Xiao, Microsoft Corporation                               */
/*                                                                        */
/*  DESCRIPTION                                                           */
/*                                                                        */
/*    This function sends an event to the host to inform that an object   */
/*    has been added.                                                     */
/*                                                                        */
/*  INPUT                                                                 */
/*                                                                        */
/*    pima                                  Pointer to pima class         */
/*    object_handle                         Handle of object to delete    */
/*                                                                        */
/*  OUTPUT                                                                */
/*                                                                        */
/*    Completion Status                                                   */
/*                                                                        */
/*  CALLS                                                                 */
/*                                                                        */
/*    _ux_device_class_pima_event_set       Add PIMA event to queue       */
/*                                                                        */
/*  CALLED BY                                                             */
/*                                                                        */
/*    Device Pima Class                                                   */
/*                                                                        */
/**************************************************************************/
UINT  _ux_device_class_pima_object_add(UX_SLAVE_CLASS_PIMA *pima, ULONG object_handle)
{

UINT                        status;
UX_SLAVE_CLASS_PIMA_EVENT   pima_event;

    /* If trace is enabled, insert this event into the trace buffer.  */
    UX_TRACE_IN_LINE_INSERT(UX_TRACE_DEVICE_CLASS_PIMA_OBJECT_ADD, pima, object_handle, 0, 0, UX_TRACE_DEVICE_CLASS_EVENTS, 0, 0)

    /* Set the pima code for object added.  */
    pima_event.ux_device_class_pima_event_code         = UX_DEVICE_CLASS_PIMA_EC_REQUEST_OBJECT_TRANSFER;

    /* Set the object handle.  */
    pima_event.ux_device_class_pima_event_parameter_1  = object_handle;

    /* Other parameters are not used.  */
    pima_event.ux_device_class_pima_event_parameter_2  = 0;
    pima_event.ux_device_class_pima_event_parameter_3  = 0;

    /* Add the event.  */
    status =  _ux_device_class_pima_event_set(pima, &pima_event);

    /* Return completion status.  */
    return(status);
}