1 /*************************************************************************** 2 * Copyright (c) 2024 Microsoft Corporation 3 * 4 * This program and the accompanying materials are made available under the 5 * terms of the MIT License which is available at 6 * https://opensource.org/licenses/MIT. 7 * 8 * SPDX-License-Identifier: MIT 9 **************************************************************************/ 10 11 /**************************************************************************/ 12 /** */ 13 /** USBX Component */ 14 /** */ 15 /** Device CCID Class */ 16 /** */ 17 /**************************************************************************/ 18 /**************************************************************************/ 19 20 #define UX_SOURCE_CODE 21 22 23 /* Include necessary system files. */ 24 25 #include "ux_api.h" 26 #include "ux_device_class_ccid.h" 27 #include "ux_device_stack.h" 28 29 30 /**************************************************************************/ 31 /* */ 32 /* FUNCTION RELEASE */ 33 /* */ 34 /* _ux_device_class_ccid_auto_seq_start PORTABLE C */ 35 /* 6.2.1 */ 36 /* AUTHOR */ 37 /* */ 38 /* Chaoqiong Xiao, Microsoft Corporation */ 39 /* */ 40 /* DESCRIPTION */ 41 /* */ 42 /* This function indicates auto sequence start of the USB CCID device. */ 43 /* */ 44 /* INPUT */ 45 /* */ 46 /* ccid Pointer to ccid instance */ 47 /* slot Slot inserted */ 48 /* */ 49 /* OUTPUT */ 50 /* */ 51 /* Completion Status */ 52 /* */ 53 /* CALLS */ 54 /* */ 55 /* */ 56 /* CALLED BY */ 57 /* */ 58 /* USBX Source Code */ 59 /* */ 60 /* RELEASE HISTORY */ 61 /* */ 62 /* DATE NAME DESCRIPTION */ 63 /* */ 64 /* 04-25-2022 Chaoqiong Xiao Initial Version 6.1.11 */ 65 /* 03-08-2023 Chaoqiong Xiao Modified comment(s), */ 66 /* added standalone support, */ 67 /* resulting in version 6.2.1 */ 68 /* */ 69 /**************************************************************************/ _ux_device_class_ccid_auto_seq_start(UX_DEVICE_CLASS_CCID * ccid,ULONG slot)70UINT _ux_device_class_ccid_auto_seq_start(UX_DEVICE_CLASS_CCID *ccid, ULONG slot) 71 { 72 73 UX_DEVICE_CLASS_CCID_SLOT *ccid_slot; 74 75 /* Sanity check. */ 76 if (slot >= ccid -> ux_device_class_ccid_parameter.ux_device_class_ccid_max_n_slots) 77 return(UX_INVALID_PARAMETER); 78 79 /* Get slot instance. */ 80 ccid_slot = ccid -> ux_device_class_ccid_slots; 81 ccid_slot += slot; 82 83 /* Lock states. */ 84 _ux_device_class_ccid_lock(ccid); 85 86 /* Set state of auto sequencing. */ 87 ccid_slot -> ux_device_class_ccid_slot_flags |= UX_DEVICE_CLASS_CCID_FLAG_AUTO_SEQUENCING; 88 89 /* Unlock states. */ 90 _ux_device_class_ccid_unlock(ccid); 91 92 /* Return transfer status. */ 93 return(UX_SUCCESS); 94 } 95