1 /**************************************************************************/ 2 /* */ 3 /* Copyright (c) Microsoft Corporation. All rights reserved. */ 4 /* */ 5 /* This software is licensed under the Microsoft Software License */ 6 /* Terms for Microsoft Azure RTOS. Full text of the license can be */ 7 /* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ 8 /* and in the root directory of this software. */ 9 /* */ 10 /**************************************************************************/ 11 12 13 /**************************************************************************/ 14 /**************************************************************************/ 15 /** */ 16 /** USBX Component */ 17 /** */ 18 /** Device Data Pump Class */ 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_class_dpump.h" 30 31 32 /**************************************************************************/ 33 /* */ 34 /* FUNCTION RELEASE */ 35 /* */ 36 /* _ux_device_class_dpump_initialize PORTABLE C */ 37 /* 6.1.12 */ 38 /* AUTHOR */ 39 /* */ 40 /* Chaoqiong Xiao, Microsoft Corporation */ 41 /* */ 42 /* DESCRIPTION */ 43 /* */ 44 /* This function initializes the USB dpump device. */ 45 /* */ 46 /* INPUT */ 47 /* */ 48 /* command Pointer to dpump command */ 49 /* */ 50 /* OUTPUT */ 51 /* */ 52 /* Completion Status */ 53 /* */ 54 /* CALLS */ 55 /* */ 56 /* _ux_utility_memory_allocate Allocate memory */ 57 /* */ 58 /* CALLED BY */ 59 /* */ 60 /* Device Data Pump Class */ 61 /* */ 62 /* RELEASE HISTORY */ 63 /* */ 64 /* DATE NAME DESCRIPTION */ 65 /* */ 66 /* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */ 67 /* 09-30-2020 Chaoqiong Xiao Modified comment(s), */ 68 /* resulting in version 6.1 */ 69 /* 07-29-2022 Chaoqiong Xiao Modified comment(s), */ 70 /* fixed parameter/variable */ 71 /* names conflict C++ keyword, */ 72 /* resulting in version 6.1.12 */ 73 /* */ 74 /**************************************************************************/ _ux_device_class_dpump_initialize(UX_SLAVE_CLASS_COMMAND * command)75UINT _ux_device_class_dpump_initialize(UX_SLAVE_CLASS_COMMAND *command) 76 { 77 78 UX_SLAVE_CLASS_DPUMP *dpump; 79 UX_SLAVE_CLASS *class_ptr; 80 UX_SLAVE_CLASS_DPUMP_PARAMETER *dpump_parameter; 81 82 /* Get the class container. */ 83 class_ptr = command -> ux_slave_class_command_class_ptr; 84 85 /* Create an instance of the device dpump class. */ 86 dpump = _ux_utility_memory_allocate(UX_NO_ALIGN, UX_REGULAR_MEMORY, sizeof(UX_SLAVE_CLASS_DPUMP)); 87 88 /* Check for successful allocation. */ 89 if (dpump == UX_NULL) 90 return(UX_MEMORY_INSUFFICIENT); 91 92 /* Save the address of the DPUMP instance inside the DPUMP container. */ 93 class_ptr -> ux_slave_class_instance = (VOID *) dpump; 94 95 /* Get the pointer to the application parameters for the cdc class. */ 96 dpump_parameter = command -> ux_slave_class_command_parameter; 97 98 /* Store the start and stop signals if needed by the application. */ 99 dpump -> ux_slave_class_dpump_parameter.ux_slave_class_dpump_instance_activate = dpump_parameter -> ux_slave_class_dpump_instance_activate; 100 dpump -> ux_slave_class_dpump_parameter.ux_slave_class_dpump_instance_deactivate = dpump_parameter -> ux_slave_class_dpump_instance_deactivate; 101 102 /* Return completion status. */ 103 return(UX_SUCCESS); 104 } 105 106 107