mirror of
https://github.com/azure-rtos/usbx.git
synced 2025-01-28 07:03:07 +08:00
Update on 19 Apr 2023. Expand to see details.
f6854286 USBX host video error checking support. 909e7523 Onboard to Central Feed Services 863cc0c9 Add optional error check for host storage (no FileX). 0e88a565 Added new test case for HID descriptor get. 03944f4e Add error checking to device/host stack and system. 5bec9ee8 Device PIMA error check improvement. Fixing pictbridge issues (client callbacks initialize, host device info buffer length increase). f8c89ae9 Added host printer error checking.
This commit is contained in:
parent
5f758e08fe
commit
3af3626c9b
@ -26,7 +26,7 @@
|
||||
/* APPLICATION INTERFACE DEFINITION RELEASE */
|
||||
/* */
|
||||
/* ux_api.h PORTABLE C */
|
||||
/* 6.2.1 */
|
||||
/* 6.x */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Chaoqiong Xiao, Microsoft Corporation */
|
||||
@ -133,6 +133,9 @@
|
||||
/* max class driver configure, */
|
||||
/* added a new error code, */
|
||||
/* resulting in version 6.2.1 */
|
||||
/* xx-xx-xxxx Chaoqiong Xiao Modified comment(s), */
|
||||
/* added error checks support, */
|
||||
/* resulting in version 6.x */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
|
||||
@ -186,6 +189,24 @@ extern "C" {
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Internal option: enable the basic USBX error checking. This define is typically used
|
||||
while debugging application. */
|
||||
#if defined(UX_ENABLE_ERROR_CHECKING) && !defined(UX_SYSTEM_ENABLE_ERROR_CHECKING)
|
||||
#define UX_SYSTEM_ENABLE_ERROR_CHECKING
|
||||
#endif
|
||||
|
||||
/* Internal option: enable the basic USBX error checking. This define is typically used
|
||||
while debugging application. */
|
||||
#if defined(UX_ENABLE_ERROR_CHECKING) && !defined(UX_DEVICE_STACK_ENABLE_ERROR_CHECKING)
|
||||
#define UX_DEVICE_STACK_ENABLE_ERROR_CHECKING
|
||||
#endif
|
||||
|
||||
/* Internal option: enable the basic USBX error checking. This define is typically used
|
||||
while debugging application. */
|
||||
#if defined(UX_ENABLE_ERROR_CHECKING) && !defined(UX_HOST_STACK_ENABLE_ERROR_CHECKING)
|
||||
#define UX_HOST_STACK_ENABLE_ERROR_CHECKING
|
||||
#endif
|
||||
|
||||
|
||||
/* Define the maximum length for class names (exclude string null-terminator). */
|
||||
#define UX_MAX_CLASS_NAME_LENGTH 63
|
||||
@ -2658,7 +2679,12 @@ typedef struct UX_HOST_CLASS_DPUMP_STRUCT
|
||||
|
||||
/* Define USBX Services. */
|
||||
|
||||
#if defined(UX_SYSTEM_ENABLE_ERROR_CHECKING)
|
||||
#define ux_system_initialize _ux_system_initialize
|
||||
#else
|
||||
#define ux_system_initialize _uxe_system_initialize
|
||||
#endif
|
||||
|
||||
#define ux_system_uninitialize _ux_system_uninitialize
|
||||
#define ux_system_tasks_run _ux_system_tasks_run
|
||||
|
||||
@ -2666,31 +2692,54 @@ typedef struct UX_HOST_CLASS_DPUMP_STRUCT
|
||||
|
||||
#define ux_host_class_storage_entry _ux_host_class_storage_entry
|
||||
|
||||
#if defined(UX_HOST_STACK_ENABLE_ERROR_CHECKING)
|
||||
|
||||
#define ux_host_stack_class_get _uxe_host_stack_class_get
|
||||
#define ux_host_stack_class_instance_get _uxe_host_stack_class_instance_get
|
||||
#define ux_host_stack_class_register _uxe_host_stack_class_register
|
||||
#define ux_host_stack_device_configuration_activate _uxe_host_stack_device_configuration_activate
|
||||
#define ux_host_stack_device_configuration_deactivate _uxe_host_stack_device_configuration_deactivate
|
||||
#define ux_host_stack_device_configuration_get _uxe_host_stack_device_configuration_get
|
||||
#define ux_host_stack_device_get _uxe_host_stack_device_get
|
||||
#define ux_host_stack_device_string_get _uxe_host_stack_device_string_get
|
||||
#define ux_host_stack_endpoint_transfer_abort _uxe_host_stack_endpoint_transfer_abort
|
||||
#define ux_host_stack_hcd_register _uxe_host_stack_hcd_register
|
||||
#define ux_host_stack_hcd_unregister _uxe_host_stack_hcd_unregister
|
||||
#define ux_host_stack_interface_endpoint_get _uxe_host_stack_interface_endpoint_get
|
||||
#define ux_host_stack_interface_setting_select _uxe_host_stack_interface_setting_select
|
||||
#define ux_host_stack_transfer_request _uxe_host_stack_transfer_request
|
||||
#define ux_host_stack_transfer_request_abort _uxe_host_stack_transfer_request_abort
|
||||
|
||||
#else
|
||||
|
||||
#define ux_host_stack_class_get _ux_host_stack_class_get
|
||||
#define ux_host_stack_class_instance_create _ux_host_stack_class_instance_create
|
||||
#define ux_host_stack_class_instance_destroy _ux_host_stack_class_instance_destroy
|
||||
#define ux_host_stack_class_instance_get _ux_host_stack_class_instance_get
|
||||
#define ux_host_stack_class_register _ux_host_stack_class_register
|
||||
#define ux_host_stack_class_unregister _ux_host_stack_class_unregister
|
||||
#define ux_host_stack_configuration_interface_get _ux_host_stack_configuration_interface_get
|
||||
#define ux_host_stack_device_configuration_activate _ux_host_stack_device_configuration_activate
|
||||
#define ux_host_stack_device_configuration_deactivate _ux_host_stack_device_configuration_deactivate
|
||||
#define ux_host_stack_device_configuration_get _ux_host_stack_device_configuration_get
|
||||
#define ux_host_stack_device_configuration_select _ux_host_stack_device_configuration_select
|
||||
#define ux_host_stack_device_get _ux_host_stack_device_get
|
||||
#define ux_host_stack_device_string_get _ux_host_stack_device_string_get
|
||||
#define ux_host_stack_endpoint_transfer_abort _ux_host_stack_endpoint_transfer_abort
|
||||
#define ux_host_stack_hcd_register _ux_host_stack_hcd_register
|
||||
#define ux_host_stack_hcd_unregister _ux_host_stack_hcd_unregister
|
||||
#define ux_host_stack_initialize _ux_host_stack_initialize
|
||||
#define ux_host_stack_uninitialize _ux_host_stack_uninitialize
|
||||
#define ux_host_stack_interface_endpoint_get _ux_host_stack_interface_endpoint_get
|
||||
#define ux_host_stack_interface_setting_select _ux_host_stack_interface_setting_select
|
||||
#define ux_host_stack_transfer_request _ux_host_stack_transfer_request
|
||||
#define ux_host_stack_transfer_request_abort _ux_host_stack_transfer_request_abort
|
||||
|
||||
#endif
|
||||
|
||||
#define ux_host_stack_class_instance_create _ux_host_stack_class_instance_create
|
||||
#define ux_host_stack_class_instance_destroy _ux_host_stack_class_instance_destroy
|
||||
#define ux_host_stack_class_unregister _ux_host_stack_class_unregister
|
||||
#define ux_host_stack_configuration_interface_get _ux_host_stack_configuration_interface_get
|
||||
#define ux_host_stack_device_configuration_reset _ux_host_stack_device_configuration_reset
|
||||
#define ux_host_stack_device_configuration_select _ux_host_stack_device_configuration_select
|
||||
#define ux_host_stack_initialize _ux_host_stack_initialize
|
||||
#define ux_host_stack_uninitialize _ux_host_stack_uninitialize
|
||||
#define ux_host_stack_hnp_polling_thread_entry _ux_host_stack_hnp_polling_thread_entry
|
||||
#define ux_host_stack_role_swap _ux_host_stack_role_swap
|
||||
#define ux_host_stack_device_configuration_reset _ux_host_stack_device_configuration_reset
|
||||
|
||||
#define ux_host_stack_tasks_run _ux_host_stack_tasks_run
|
||||
#define ux_host_stack_transfer_run _ux_host_stack_transfer_run
|
||||
@ -2699,10 +2748,23 @@ typedef struct UX_HOST_CLASS_DPUMP_STRUCT
|
||||
#define ux_utility_pci_read _ux_utility_pci_read
|
||||
#define ux_utility_pci_write _ux_utility_pci_write
|
||||
|
||||
#define ux_device_stack_alternate_setting_get _ux_device_stack_alternate_setting_get
|
||||
#define ux_device_stack_alternate_setting_set _ux_device_stack_alternate_setting_set
|
||||
#if defined(UX_DEVICE_STACK_ENABLE_ERROR_CHECKING)
|
||||
|
||||
#define ux_device_stack_class_register _uxe_device_stack_class_register
|
||||
#define ux_device_stack_class_unregister _uxe_device_stack_class_unregister
|
||||
#define ux_device_stack_initialize _uxe_device_stack_initialize
|
||||
|
||||
#else
|
||||
|
||||
#define ux_device_stack_class_register _ux_device_stack_class_register
|
||||
#define ux_device_stack_class_unregister _ux_device_stack_class_unregister
|
||||
#define ux_device_stack_initialize _ux_device_stack_initialize
|
||||
|
||||
#endif
|
||||
#define ux_device_stack_uninitialize _ux_device_stack_uninitialize
|
||||
|
||||
#define ux_device_stack_alternate_setting_get _ux_device_stack_alternate_setting_get
|
||||
#define ux_device_stack_alternate_setting_set _ux_device_stack_alternate_setting_set
|
||||
#define ux_device_stack_configuration_get _ux_device_stack_configuration_get
|
||||
#define ux_device_stack_configuration_set _ux_device_stack_configuration_set
|
||||
#define ux_device_stack_descriptor_send _ux_device_stack_descriptor_send
|
||||
@ -2710,8 +2772,6 @@ typedef struct UX_HOST_CLASS_DPUMP_STRUCT
|
||||
#define ux_device_stack_disconnect _ux_device_stack_disconnect
|
||||
#define ux_device_stack_endpoint_stall _ux_device_stack_endpoint_stall
|
||||
#define ux_device_stack_host_wakeup _ux_device_stack_host_wakeup
|
||||
#define ux_device_stack_initialize _ux_device_stack_initialize
|
||||
#define ux_device_stack_uninitialize _ux_device_stack_uninitialize
|
||||
#define ux_device_stack_interface_delete _ux_device_stack_interface_delete
|
||||
#define ux_device_stack_interface_get _ux_device_stack_interface_get
|
||||
#define ux_device_stack_interface_set _ux_device_stack_interface_set
|
||||
@ -2740,6 +2800,10 @@ UINT ux_system_initialize(VOID *non_cached_memory_pool_start, ULONG non_cache
|
||||
UINT ux_system_uninitialize(VOID);
|
||||
UINT ux_system_tasks_run(VOID);
|
||||
|
||||
UINT uxe_system_initialize(VOID *non_cached_memory_pool_start, ULONG non_cached_memory_size,
|
||||
VOID *cached_memory_pool_start, ULONG cached_memory_size);
|
||||
|
||||
|
||||
/* Define USBX Host API prototypes. */
|
||||
|
||||
UINT ux_hcd_ehci_initialize(UX_HCD *hcd);
|
||||
|
@ -25,7 +25,7 @@
|
||||
/* COMPONENT DEFINITION RELEASE */
|
||||
/* */
|
||||
/* ux_device_stack.h PORTABLE C */
|
||||
/* 6.1.12 */
|
||||
/* 6.x */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Chaoqiong Xiao, Microsoft Corporation */
|
||||
@ -53,6 +53,9 @@
|
||||
/* fixed parameter/variable */
|
||||
/* names conflict C++ keyword, */
|
||||
/* resulting in version 6.1.12 */
|
||||
/* xx-xx-xxxx Chaoqiong Xiao Modified comment(s), */
|
||||
/* added error checks support, */
|
||||
/* resulting in version 6.x */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
|
||||
@ -109,6 +112,21 @@ UINT _ux_device_stack_uninitialize(VOID);
|
||||
UINT _ux_device_stack_tasks_run(VOID);
|
||||
UINT _ux_device_stack_transfer_run(UX_SLAVE_TRANSFER *transfer_request, ULONG slave_length, ULONG host_length);
|
||||
|
||||
UINT _uxe_device_stack_class_register(UCHAR *class_name,
|
||||
UINT (*class_entry_function)(struct UX_SLAVE_CLASS_COMMAND_STRUCT *),
|
||||
ULONG configuration_number,
|
||||
ULONG interface_number,
|
||||
VOID *parameter);
|
||||
UINT _uxe_device_stack_class_unregister(UCHAR *class_name,
|
||||
UINT (*class_entry_function)(struct UX_SLAVE_CLASS_COMMAND_STRUCT *));
|
||||
|
||||
UINT _uxe_device_stack_initialize(UCHAR * device_framework_high_speed, ULONG device_framework_length_high_speed,
|
||||
UCHAR * device_framework_full_speed, ULONG device_framework_length_full_speed,
|
||||
UCHAR * string_framework, ULONG string_framework_length,
|
||||
UCHAR * language_id_framework, ULONG language_id_framework_length,
|
||||
UINT (*ux_system_slave_change_function)(ULONG));
|
||||
|
||||
|
||||
/* Determine if a C++ compiler is being used. If so, complete the standard
|
||||
C conditional started above. */
|
||||
#ifdef __cplusplus
|
||||
|
@ -26,7 +26,7 @@
|
||||
/* COMPONENT DEFINITION RELEASE */
|
||||
/* */
|
||||
/* ux_host_stack.h PORTABLE C */
|
||||
/* 6.1.12 */
|
||||
/* 6.x */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Chaoqiong Xiao, Microsoft Corporation */
|
||||
@ -65,6 +65,9 @@
|
||||
/* names conflict C++ keyword, */
|
||||
/* added standalone HUB, */
|
||||
/* resulting in version 6.1.12 */
|
||||
/* xx-xx-xxxx Chaoqiong Xiao Modified comment(s), */
|
||||
/* added error checks support, */
|
||||
/* resulting in version 6.x */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
|
||||
@ -82,6 +85,13 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/* Internal option: enable the basic USBX error checking. This define is typically used
|
||||
while debugging application. */
|
||||
#if defined(UX_ENABLE_ERROR_CHECKING) && !defined(UX_HOST_STACK_ENABLE_ERROR_CHECKING)
|
||||
#define UX_HOST_STACK_ENABLE_ERROR_CHECKING
|
||||
#endif
|
||||
|
||||
|
||||
/* Define Host Stack enumeration state machine states. */
|
||||
|
||||
#define UX_HOST_STACK_ENUM_PORT_ENABLE (UX_STATE_STEP + 0)
|
||||
@ -194,6 +204,31 @@ VOID _ux_host_stack_hnp_polling_thread_entry(ULONG id);
|
||||
UINT _ux_host_stack_tasks_run(VOID);
|
||||
UINT _ux_host_stack_transfer_run(UX_TRANSFER *transfer_request);
|
||||
|
||||
|
||||
UINT _uxe_host_stack_class_get(UCHAR *class_name, UX_HOST_CLASS **ux_class);
|
||||
UINT _uxe_host_stack_class_instance_get(UX_HOST_CLASS *class, UINT class_index, VOID **class_instance);
|
||||
UINT _uxe_host_stack_class_register(UCHAR *class_name,
|
||||
UINT (*class_entry_function)(struct UX_HOST_CLASS_COMMAND_STRUCT *));
|
||||
UINT _uxe_host_stack_configuration_interface_get(UX_CONFIGURATION *configuration,
|
||||
UINT interface_index, UINT alternate_setting_index,
|
||||
UX_INTERFACE **ux_interface);
|
||||
UINT _uxe_host_stack_device_configuration_activate(UX_CONFIGURATION *configuration);
|
||||
UINT _uxe_host_stack_device_configuration_deactivate(UX_DEVICE *device);
|
||||
UINT _uxe_host_stack_device_configuration_get(UX_DEVICE *device, UINT configuration_index,
|
||||
UX_CONFIGURATION **configuration);
|
||||
UINT _uxe_host_stack_device_get(ULONG device_index, UX_DEVICE **device);
|
||||
UINT _uxe_host_stack_device_string_get(UX_DEVICE *device, UCHAR *descriptor_buffer, ULONG length, ULONG language_id, ULONG string_index);
|
||||
UINT _uxe_host_stack_endpoint_transfer_abort(UX_ENDPOINT *endpoint);
|
||||
UINT _uxe_host_stack_hcd_register(UCHAR *hcd_name,
|
||||
UINT (*hcd_init_function)(struct UX_HCD_STRUCT *), ULONG hcd_param1, ULONG hcd_param2);
|
||||
UINT _uxe_host_stack_hcd_unregister(UCHAR *hcd_name, ULONG hcd_param1, ULONG hcd_param2);
|
||||
UINT _uxe_host_stack_interface_endpoint_get(UX_INTERFACE *ux_interface, UINT endpoint_index, UX_ENDPOINT **endpoint);
|
||||
UINT _uxe_host_stack_interface_setting_select(UX_INTERFACE *ux_interface);
|
||||
UINT _uxe_host_stack_transfer_request(UX_TRANSFER *transfer_request);
|
||||
UINT _uxe_host_stack_transfer_request_abort(UX_TRANSFER *transfer_request);
|
||||
UINT _uxe_host_stack_transfer_run(UX_TRANSFER *transfer_request);
|
||||
|
||||
|
||||
/* Determine if a C++ compiler is being used. If so, complete the standard
|
||||
C conditional started above. */
|
||||
#ifdef __cplusplus
|
||||
|
@ -26,7 +26,7 @@
|
||||
/* COMPONENT DEFINITION RELEASE */
|
||||
/* */
|
||||
/* ux_system.h PORTABLE C */
|
||||
/* 6.1.11 */
|
||||
/* 6.x */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Chaoqiong Xiao, Microsoft Corporation */
|
||||
@ -53,6 +53,9 @@
|
||||
/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
|
||||
/* added device CCID name, */
|
||||
/* resulting in version 6.1.11 */
|
||||
/* xx-xx-xxxx Chaoqiong Xiao Modified comment(s), */
|
||||
/* added error checks support, */
|
||||
/* resulting in version 6.x */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
|
||||
@ -70,6 +73,9 @@ UINT _ux_system_initialize(VOID *regular_memory_pool_start, ULONG regular_memor
|
||||
VOID *cache_safe_memory_pool_start, ULONG cache_safe_memory_size);
|
||||
UINT _ux_system_uninitialize(VOID);
|
||||
UINT _ux_system_tasks_run(VOID);
|
||||
|
||||
UINT _uxe_system_initialize(VOID *regular_memory_pool_start, ULONG regular_memory_size,
|
||||
VOID *cache_safe_memory_pool_start, ULONG cache_safe_memory_size);
|
||||
#endif
|
||||
|
||||
/* Define System component external data references. */
|
||||
|
@ -166,3 +166,61 @@ ULONG class_index;
|
||||
return(UX_MEMORY_INSUFFICIENT);
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _uxe_device_stack_class_register PORTABLE C */
|
||||
/* 6.x */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Chaoqiong Xiao, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This function checks errors in device stack class register function */
|
||||
/* call. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* class_name Name of class */
|
||||
/* class_function_entry Class entry function */
|
||||
/* configuration_number Configuration # for this class*/
|
||||
/* interface_number Interface # for this class */
|
||||
/* parameter Parameter specific for class */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* None */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _ux_device_stack_class_register Class register */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* Application */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* xx-xx-xxxx Chaoqiong Xiao Initial Version 6.x */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _uxe_device_stack_class_register(UCHAR *class_name,
|
||||
UINT (*class_entry_function)(struct UX_SLAVE_CLASS_COMMAND_STRUCT *),
|
||||
ULONG configuration_number,
|
||||
ULONG interface_number,
|
||||
VOID *parameter)
|
||||
{
|
||||
|
||||
/* Sanity checks. */
|
||||
if ((class_name == UX_NULL) || (class_entry_function == UX_NULL))
|
||||
return(UX_INVALID_PARAMETER);
|
||||
|
||||
/* Invoke class register function. */
|
||||
return(_ux_device_stack_class_register(class_name, class_entry_function,
|
||||
configuration_number, interface_number, parameter));
|
||||
}
|
||||
|
@ -150,3 +150,54 @@ ULONG class_index;
|
||||
return(UX_NO_CLASS_MATCH);
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _uxe_device_stack_class_unregister PORTABLE C */
|
||||
/* 6.x */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Chaoqiong Xiao, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This function checks errors in device stack class unregister */
|
||||
/* function call. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* class_name Name of class */
|
||||
/* class_function_entry Class entry function */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* None */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _ux_device_stack_class_unregister Class unregister */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* Application */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* xx-xx-xxxx Chaoqiong Xiao Initial Version 6.x */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _uxe_device_stack_class_unregister(UCHAR *class_name,
|
||||
UINT (*class_entry_function)(struct UX_SLAVE_CLASS_COMMAND_STRUCT *))
|
||||
{
|
||||
|
||||
/* Sanity checks. */
|
||||
if ((class_name == UX_NULL) || (class_entry_function == UX_NULL))
|
||||
return(UX_INVALID_PARAMETER);
|
||||
|
||||
/* Invoke unregister function. */
|
||||
return(_ux_device_stack_class_unregister(class_name, class_entry_function));
|
||||
}
|
||||
|
@ -32,7 +32,8 @@
|
||||
#if (UX_SLAVE_REQUEST_CONTROL_MAX_LENGTH < UX_DEVICE_DESCRIPTOR_LENGTH) || \
|
||||
(UX_SLAVE_REQUEST_CONTROL_MAX_LENGTH < UX_DEVICE_QUALIFIER_DESCRIPTOR_LENGTH) || \
|
||||
(UX_SLAVE_REQUEST_CONTROL_MAX_LENGTH < UX_OTG_DESCRIPTOR_LENGTH)
|
||||
#error UX_SLAVE_REQUEST_CONTROL_MAX_LENGTH too small, please check
|
||||
/* #error UX_SLAVE_REQUEST_CONTROL_MAX_LENGTH too small, please check */
|
||||
/* Build option checked runtime by UX_ASSERT */
|
||||
#endif
|
||||
|
||||
/**************************************************************************/
|
||||
@ -40,7 +41,7 @@
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _ux_device_stack_descriptor_send PORTABLE C */
|
||||
/* 6.1.11 */
|
||||
/* 6.x */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Chaoqiong Xiao, Microsoft Corporation */
|
||||
@ -88,6 +89,9 @@
|
||||
/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
|
||||
/* internal clean up, */
|
||||
/* resulting in version 6.1.11 */
|
||||
/* xx-xx-xxxx Chaoqiong Xiao Modified comment(s), */
|
||||
/* moved compile option check, */
|
||||
/* resulting in version 6.x */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _ux_device_stack_descriptor_send(ULONG descriptor_type, ULONG request_index, ULONG host_length)
|
||||
@ -115,6 +119,12 @@ UCHAR *string_framework;
|
||||
ULONG string_framework_length;
|
||||
ULONG string_length;
|
||||
|
||||
|
||||
/* Build option check. */
|
||||
UX_ASSERT((UX_SLAVE_REQUEST_CONTROL_MAX_LENGTH >= UX_DEVICE_DESCRIPTOR_LENGTH) &&
|
||||
(UX_SLAVE_REQUEST_CONTROL_MAX_LENGTH >= UX_DEVICE_QUALIFIER_DESCRIPTOR_LENGTH) &&
|
||||
(UX_SLAVE_REQUEST_CONTROL_MAX_LENGTH >= UX_OTG_DESCRIPTOR_LENGTH));
|
||||
|
||||
/* If trace is enabled, insert this event into the trace buffer. */
|
||||
UX_TRACE_IN_LINE_INSERT(UX_TRACE_DEVICE_STACK_DESCRIPTOR_SEND, descriptor_type, request_index, 0, 0, UX_TRACE_DEVICE_STACK_EVENTS, 0, 0)
|
||||
|
||||
|
@ -458,3 +458,64 @@ UCHAR *memory;
|
||||
return(status);
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _uxe_device_stack_initialize PORTABLE C */
|
||||
/* 6.x */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Chaoqiong Xiao, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This function checks errors in device stack initialization */
|
||||
/* function call. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* class_name Name of class */
|
||||
/* class_function_entry Class entry function */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* None */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _ux_device_stack_initialize Device Stack Initialize */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* Application */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* xx-xx-xxxx Chaoqiong Xiao Initial Version 6.x */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _uxe_device_stack_initialize(UCHAR * device_framework_high_speed, ULONG device_framework_length_high_speed,
|
||||
UCHAR * device_framework_full_speed, ULONG device_framework_length_full_speed,
|
||||
UCHAR * string_framework, ULONG string_framework_length,
|
||||
UCHAR * language_id_framework, ULONG language_id_framework_length,
|
||||
UINT (*ux_system_slave_change_function)(ULONG))
|
||||
{
|
||||
|
||||
/* Sanity checks. */
|
||||
if (((device_framework_high_speed == UX_NULL) && (device_framework_length_high_speed != 0)) ||
|
||||
(device_framework_full_speed == UX_NULL) || (device_framework_length_full_speed == 0) ||
|
||||
((string_framework == UX_NULL) && (string_framework_length != 0)) ||
|
||||
(language_id_framework == UX_NULL) || (language_id_framework_length == 0))
|
||||
return(UX_INVALID_PARAMETER);
|
||||
|
||||
/* Invoke stack initialize function. */
|
||||
return(_ux_device_stack_initialize(device_framework_high_speed, device_framework_length_high_speed,
|
||||
device_framework_full_speed, device_framework_length_full_speed,
|
||||
string_framework, string_framework_length,
|
||||
language_id_framework, language_id_framework_length,
|
||||
ux_system_slave_change_function));
|
||||
}
|
||||
|
@ -34,7 +34,7 @@
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _ux_host_stack_class_get PORTABLE C */
|
||||
/* 6.1 */
|
||||
/* 6.x */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Chaoqiong Xiao, Microsoft Corporation */
|
||||
@ -52,7 +52,7 @@
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* class_name Name of class */
|
||||
/* class Class pointer */
|
||||
/* host_class Class pointer */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
@ -78,6 +78,8 @@
|
||||
/* optimized based on compile */
|
||||
/* definitions, */
|
||||
/* resulting in version 6.1 */
|
||||
/* xx-xx-xxxx Chaoqiong Xiao Modified comment(s), */
|
||||
/* resulting in version 6.x */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _ux_host_stack_class_get(UCHAR *class_name, UX_HOST_CLASS **host_class)
|
||||
@ -137,3 +139,52 @@ ULONG class_index;
|
||||
return(UX_HOST_CLASS_UNKNOWN);
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _uxe_host_stack_class_get PORTABLE C */
|
||||
/* 6.x */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Chaoqiong Xiao, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This function checks errors in host stack class get function call. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* class_name Name of class */
|
||||
/* host_class Class pointer */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* None */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _ux_host_stack_class_get Host stack class get */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* Application */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* xx-xx-xxxx Chaoqiong Xiao Initial Version 6.x */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _uxe_host_stack_class_get(UCHAR *class_name, UX_HOST_CLASS **host_class)
|
||||
{
|
||||
|
||||
/* Sanity checks. */
|
||||
if ((class_name == UX_NULL) || (host_class == UX_NULL))
|
||||
return(UX_INVALID_PARAMETER);
|
||||
|
||||
/* Invoke class get function. */
|
||||
return(_ux_host_stack_class_get(class_name, host_class));
|
||||
}
|
||||
|
@ -113,3 +113,54 @@ VOID **current_class_instance;
|
||||
return(UX_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _uxe_host_stack_class_instance_get PORTABLE C */
|
||||
/* 6.x */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Chaoqiong Xiao, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This function checks errors in host stack class get function call. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* class Pointer to class */
|
||||
/* class_index Index of class */
|
||||
/* class_instance Destination of class instance */
|
||||
/* pointer */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* None */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _ux_host_stack_class_instance_get Host stack class instance get */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* Application */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* xx-xx-xxxx Chaoqiong Xiao Initial Version 6.x */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _uxe_host_stack_class_instance_get(UX_HOST_CLASS *host_class, UINT class_index, VOID **class_instance)
|
||||
{
|
||||
|
||||
/* Sanity check. */
|
||||
if ((host_class == UX_NULL) || (class_instance == UX_NULL))
|
||||
return(UX_INVALID_PARAMETER);
|
||||
|
||||
/* Invoke class instance get function. */
|
||||
return(_ux_host_stack_class_instance_get(host_class, class_index, class_instance));
|
||||
}
|
||||
|
@ -173,3 +173,55 @@ ULONG class_index;
|
||||
/* No more entries in the class table. */
|
||||
return(UX_MEMORY_ARRAY_FULL);
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _uxe_host_stack_class_register PORTABLE C */
|
||||
/* 6.x */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Chaoqiong Xiao, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This function checks errors in host stack class register function */
|
||||
/* call. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* class_name Name of class */
|
||||
/* class_entry_function Entry function of the class */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* None */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _ux_host_stack_class_instance_get Host stack class instance get */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* Application */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* xx-xx-xxxx Chaoqiong Xiao Initial Version 6.x */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _uxe_host_stack_class_register(UCHAR *class_name,
|
||||
UINT (*class_entry_function)(struct UX_HOST_CLASS_COMMAND_STRUCT *))
|
||||
{
|
||||
|
||||
/* Sanity checks. */
|
||||
if ((class_name == UX_NULL) || (class_entry_function == UX_NULL))
|
||||
return(UX_INVALID_PARAMETER);
|
||||
|
||||
/* Invoke class register function. */
|
||||
return(_ux_host_stack_class_register(class_name, class_entry_function));
|
||||
}
|
||||
|
@ -187,3 +187,59 @@ UX_INTERFACE *current_interface;
|
||||
return(UX_INTERFACE_HANDLE_UNKNOWN);
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _uxe_host_stack_configuration_interface_get PORTABLE C */
|
||||
/* 6.x */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Chaoqiong Xiao, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This function checks errors in host stack interface get function */
|
||||
/* call. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* configuration Pointer to configuration */
|
||||
/* interface_index Index of interface */
|
||||
/* alternate_setting_index Index of alternate setting */
|
||||
/* interface Destination of interface */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* None */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _ux_host_stack_configuration_interface_get */
|
||||
/* Host stack interface get */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* Application */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* xx-xx-xxxx Chaoqiong Xiao Initial Version 6.x */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _uxe_host_stack_configuration_interface_get(UX_CONFIGURATION *configuration,
|
||||
UINT interface_index, UINT alternate_setting_index,
|
||||
UX_INTERFACE **ux_interface)
|
||||
{
|
||||
|
||||
/* Sanity checks. */
|
||||
if ((configuration == UX_NULL) || (ux_interface == UX_NULL))
|
||||
return(UX_INVALID_PARAMETER);
|
||||
|
||||
/* Invoke interface get function. */
|
||||
return(_ux_host_stack_configuration_interface_get(configuration,
|
||||
interface_index, alternate_setting_index, ux_interface));
|
||||
}
|
||||
|
@ -184,3 +184,54 @@ UINT status;
|
||||
/* Return completion status. */
|
||||
return(status);
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _uxe_host_stack_device_configuration_activate PORTABLE C */
|
||||
/* 6.x */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Chaoqiong Xiao, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This function checks errors in host stack configuration activate */
|
||||
/* function call. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* configuration Pointer to configuration */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* None */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _ux_host_stack_device_configuration_activate */
|
||||
/* Host stack config activate */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* Application */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* xx-xx-xxxx Chaoqiong Xiao Initial Version 6.x */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _uxe_host_stack_device_configuration_activate(UX_CONFIGURATION *configuration)
|
||||
{
|
||||
|
||||
/* Sanity check. */
|
||||
if (configuration == UX_NULL)
|
||||
return(UX_INVALID_PARAMETER);
|
||||
|
||||
/* Invoke configuration activate function. */
|
||||
return(_ux_host_stack_device_configuration_activate(configuration));
|
||||
}
|
||||
|
@ -193,3 +193,54 @@ UINT status;
|
||||
/* Return completion status. */
|
||||
return(status);
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _uxe_host_stack_device_configuration_deactivate PORTABLE C */
|
||||
/* 6.x */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Chaoqiong Xiao, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This function checks errors in host stack configuration deactivate */
|
||||
/* function call. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* device Pointer to device */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* None */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _ux_host_stack_device_configuration_deactivate */
|
||||
/* Host stack config deactivate */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* Application */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* xx-xx-xxxx Chaoqiong Xiao Initial Version 6.x */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _uxe_host_stack_device_configuration_deactivate(UX_DEVICE *device)
|
||||
{
|
||||
|
||||
/* Sanity check. */
|
||||
if (device == UX_NULL)
|
||||
return(UX_INVALID_PARAMETER);
|
||||
|
||||
/* Invoke configuration deactivate function. */
|
||||
return(_ux_host_stack_device_configuration_deactivate(device));
|
||||
}
|
||||
|
@ -134,3 +134,56 @@ UX_CONFIGURATION *current_configuration;
|
||||
return(UX_CONFIGURATION_HANDLE_UNKNOWN);
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _uxe_host_stack_device_configuration_get PORTABLE C */
|
||||
/* 6.x */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Chaoqiong Xiao, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This function checks errors in host stack config get function call. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* device Pointer to device */
|
||||
/* configuration_index Index of configuration */
|
||||
/* configuration Pointer to configuration */
|
||||
/* destination */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* None */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _ux_host_stack_device_configuration_get */
|
||||
/* Host configuration get */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* Application */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* xx-xx-xxxx Chaoqiong Xiao Initial Version 6.x */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _uxe_host_stack_device_configuration_get(UX_DEVICE *device, UINT configuration_index,
|
||||
UX_CONFIGURATION **configuration)
|
||||
{
|
||||
|
||||
/* Sanity checks. */
|
||||
if ((device == UX_NULL) || (configuration == UX_NULL))
|
||||
return(UX_INVALID_PARAMETER);
|
||||
|
||||
/* Invoke configuration get function. */
|
||||
return(_ux_host_stack_device_configuration_get(device, configuration_index, configuration));
|
||||
}
|
||||
|
@ -148,3 +148,53 @@ ULONG current_device_index;
|
||||
/* Return error. */
|
||||
return(UX_DEVICE_HANDLE_UNKNOWN);
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _uxe_host_stack_device_get PORTABLE C */
|
||||
/* 6.x */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Chaoqiong Xiao, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This function checks errors in host stack device get function call. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* device_index Index of device */
|
||||
/* device Destination for device pointer*/
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* None */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _ux_host_stack_device_get Host stack device get */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* Application */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* xx-xx-xxxx Chaoqiong Xiao Initial Version 6.x */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _uxe_host_stack_device_get(ULONG device_index, UX_DEVICE **device)
|
||||
{
|
||||
|
||||
/* Sanity check. */
|
||||
if (device == UX_NULL)
|
||||
return(UX_INVALID_PARAMETER);
|
||||
|
||||
/* Invoke device get function. */
|
||||
return(_ux_host_stack_device_get(device_index, device));
|
||||
}
|
||||
|
@ -147,3 +147,59 @@ UINT status;
|
||||
/* Return completion status. */
|
||||
return(status);
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _uxe_host_stack_device_string_get PORTABLE C */
|
||||
/* 6.x */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Chaoqiong Xiao, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This function checks errors in host stack device get function call. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* device Pointer to device instance */
|
||||
/* descriptor_buffer Pointer to a buffer to fill */
|
||||
/* LANGID or STRING descriptor */
|
||||
/* length Length of buffer */
|
||||
/* language_id 0 to obtain LANGID descriptor */
|
||||
/* valid language ID to obtain */
|
||||
/* string descriptor */
|
||||
/* string_index Index of the string */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* None */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _ux_host_stack_device_string_get String descriptor get */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* Application */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* xx-xx-xxxx Chaoqiong Xiao Initial Version 6.x */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _uxe_host_stack_device_string_get(UX_DEVICE *device, UCHAR *descriptor_buffer, ULONG length, ULONG language_id, ULONG string_index)
|
||||
{
|
||||
|
||||
/* Sanity check. */
|
||||
if ((device == UX_NULL) || (descriptor_buffer == UX_NULL) || (length == 0))
|
||||
return(UX_INVALID_PARAMETER);
|
||||
|
||||
/* Invoke string descriptor get function. */
|
||||
return(_ux_host_stack_device_string_get(device, descriptor_buffer, length, language_id, string_index));
|
||||
}
|
||||
|
@ -92,3 +92,53 @@ UINT status;
|
||||
return(status);
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _uxe_host_stack_endpoint_transfer_abort PORTABLE C */
|
||||
/* 6.x */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Chaoqiong Xiao, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This function checks errors in host stack endpoint transfer abort */
|
||||
/* function call. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* endpoint Endpoint to abort transfer */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* None */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _ux_host_stack_endpoint_transfer_abort */
|
||||
/* Endpoint transfer abort */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* Application */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* xx-xx-xxxx Chaoqiong Xiao Initial Version 6.x */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _uxe_host_stack_endpoint_transfer_abort(UX_ENDPOINT *endpoint)
|
||||
{
|
||||
|
||||
/* Sanity check. */
|
||||
if (endpoint == UX_NULL)
|
||||
return(UX_INVALID_PARAMETER);
|
||||
|
||||
/* Invoke transfer abort function. */
|
||||
return(_ux_host_stack_endpoint_transfer_abort(endpoint));
|
||||
}
|
||||
|
@ -157,3 +157,53 @@ ULONG hcd_index;
|
||||
return(UX_MEMORY_INSUFFICIENT);
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _uxe_host_stack_hcd_register PORTABLE C */
|
||||
/* 6.x */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Chaoqiong Xiao, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This function checks errors in host stack HCD register function */
|
||||
/* call. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* endpoint Endpoint to abort transfer */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* None */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _ux_host_stack_hcd_register HCD register */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* Application */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* xx-xx-xxxx Chaoqiong Xiao Initial Version 6.x */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _uxe_host_stack_hcd_register(UCHAR *hcd_name,
|
||||
UINT (*hcd_init_function)(struct UX_HCD_STRUCT *), ULONG hcd_param1, ULONG hcd_param2)
|
||||
{
|
||||
|
||||
/* Sanity check. */
|
||||
if ((hcd_name == UX_NULL) || (hcd_init_function == UX_NULL))
|
||||
return(UX_INVALID_PARAMETER);
|
||||
|
||||
/* Invoke HCD register function. */
|
||||
return(_ux_host_stack_hcd_register(hcd_name, hcd_init_function, hcd_param1, hcd_param2));
|
||||
}
|
||||
|
@ -195,3 +195,56 @@ UINT hcd_name_length = 0;
|
||||
|
||||
return(UX_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _uxe_host_stack_hcd_unregister PORTABLE C */
|
||||
/* 6.x */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Chaoqiong Xiao, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This function checks errors in host stack HCD unregister function */
|
||||
/* call. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* hcd_name Name of HCD to unregister */
|
||||
/* hcd_param1 Parameter 1 of HCD */
|
||||
/* hcd_param2 Parameter 2 of HCD */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* None */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _ux_host_stack_hcd_unregister HCD unregister */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* Application */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* xx-xx-xxxx Chaoqiong Xiao Initial Version 6.x */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _uxe_host_stack_hcd_unregister(UCHAR *hcd_name,
|
||||
ULONG hcd_param1, ULONG hcd_param2)
|
||||
{
|
||||
|
||||
/* Sanity check. */
|
||||
if (hcd_name == UX_NULL)
|
||||
return(UX_INVALID_PARAMETER);
|
||||
|
||||
/* Invoke HCD unregister function. */
|
||||
return(_ux_host_stack_hcd_unregister(hcd_name, hcd_param1, hcd_param2));
|
||||
}
|
||||
|
@ -136,3 +136,54 @@ UX_ENDPOINT *current_endpoint;
|
||||
return(UX_ENDPOINT_HANDLE_UNKNOWN);
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _uxe_host_stack_interface_endpoint_get PORTABLE C */
|
||||
/* 6.x */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Chaoqiong Xiao, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This function checks errors in host stack endpoint get function */
|
||||
/* call. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* interface_ptr Pointer to interface */
|
||||
/* endpoint_index Index of endpoint to get */
|
||||
/* endpoint Destination for endpoint */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* None */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _ux_host_stack_interface_endpoint_get Endpoint get */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* Application */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* xx-xx-xxxx Chaoqiong Xiao Initial Version 6.x */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _uxe_host_stack_interface_endpoint_get(UX_INTERFACE *interface_ptr, UINT endpoint_index, UX_ENDPOINT **endpoint)
|
||||
{
|
||||
|
||||
/* Sanity checks. */
|
||||
if ((interface_ptr == UX_NULL) || (endpoint == UX_NULL))
|
||||
return(UX_INVALID_PARAMETER);
|
||||
|
||||
/* Invoke endpoint get function. */
|
||||
return(_ux_host_stack_interface_endpoint_get(interface_ptr, endpoint_index, endpoint));
|
||||
}
|
||||
|
@ -215,3 +215,53 @@ UINT status;
|
||||
return(status);
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _uxe_host_stack_interface_setting_select PORTABLE C */
|
||||
/* 6.x */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Chaoqiong Xiao, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This function checks errors in host stack interface select function */
|
||||
/* call. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* interface_ptr Pointer to interface */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* None */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _ux_host_stack_interface_setting_select */
|
||||
/* Interface setting select */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* Application */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* xx-xx-xxxx Chaoqiong Xiao Initial Version 6.x */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _uxe_host_stack_interface_setting_select(UX_INTERFACE *interface_ptr)
|
||||
{
|
||||
|
||||
/* Sanity check. */
|
||||
if (interface_ptr == UX_NULL)
|
||||
return(UX_INVALID_PARAMETER);
|
||||
|
||||
/* Invoke interface setting select function. */
|
||||
return(_ux_host_stack_interface_setting_select(interface_ptr));
|
||||
}
|
||||
|
@ -217,3 +217,58 @@ UINT status;
|
||||
return(status);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _uxe_host_stack_transfer_request PORTABLE C */
|
||||
/* 6.x */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Chaoqiong Xiao, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This function checks errors in host stack transfer function call. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* transfer_request Pointer to transfer */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* None */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _ux_host_stack_transfer_request Issue a transfer request */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* Application */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* xx-xx-xxxx Chaoqiong Xiao Initial Version 6.x */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _uxe_host_stack_transfer_request(UX_TRANSFER *transfer_request)
|
||||
{
|
||||
|
||||
/* Sanity checks. */
|
||||
if (transfer_request == UX_NULL)
|
||||
return(UX_INVALID_PARAMETER);
|
||||
if (transfer_request -> ux_transfer_request_endpoint == UX_NULL)
|
||||
return(UX_ENDPOINT_HANDLE_UNKNOWN);
|
||||
if (transfer_request -> ux_transfer_request_endpoint -> ux_endpoint_device == UX_NULL)
|
||||
return(UX_DEVICE_HANDLE_UNKNOWN);
|
||||
if (UX_DEVICE_HCD_GET(transfer_request -> ux_transfer_request_endpoint -> ux_endpoint_device) == UX_NULL)
|
||||
return(UX_INVALID_PARAMETER);
|
||||
|
||||
/* Invoke transfer request function. */
|
||||
return(_ux_host_stack_transfer_request(transfer_request));
|
||||
}
|
||||
|
@ -147,3 +147,58 @@ ULONG completion_code;
|
||||
return(UX_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _uxe_host_stack_transfer_request_abort PORTABLE C */
|
||||
/* 6.x */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Chaoqiong Xiao, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This function checks errors in host stack transfer abort function */
|
||||
/* call. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* transfer_request Pointer to transfer */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* None */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _ux_host_stack_transfer_request_abort Transfer abort */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* Application */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* xx-xx-xxxx Chaoqiong Xiao Initial Version 6.x */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _uxe_host_stack_transfer_request_abort(UX_TRANSFER *transfer_request)
|
||||
{
|
||||
|
||||
/* Sanity checks. */
|
||||
if (transfer_request == UX_NULL)
|
||||
return(UX_INVALID_PARAMETER);
|
||||
if (transfer_request -> ux_transfer_request_endpoint == UX_NULL)
|
||||
return(UX_ENDPOINT_HANDLE_UNKNOWN);
|
||||
if (transfer_request -> ux_transfer_request_endpoint -> ux_endpoint_device == UX_NULL)
|
||||
return(UX_DEVICE_HANDLE_UNKNOWN);
|
||||
if (UX_DEVICE_HCD_GET(transfer_request -> ux_transfer_request_endpoint -> ux_endpoint_device) == UX_NULL)
|
||||
return(UX_INVALID_PARAMETER);
|
||||
|
||||
/* Invoke transfer abort function. */
|
||||
return(_ux_host_stack_transfer_request_abort(transfer_request));
|
||||
}
|
||||
|
@ -293,4 +293,59 @@ UX_TRANSFER *previous;
|
||||
ux_endpoint_device -> ux_device_flags &= ~UX_DEVICE_FLAG_LOCK;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _uxe_host_stack_transfer_run PORTABLE C */
|
||||
/* 6.x */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Chaoqiong Xiao, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This function checks errors in host stack transfer function call. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* transfer_request Pointer to transfer */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* None */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _ux_host_stack_transfer_run Run a transfer request */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* Application */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* xx-xx-xxxx Chaoqiong Xiao Initial Version 6.x */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _uxe_host_stack_transfer_run(UX_TRANSFER *transfer_request)
|
||||
{
|
||||
|
||||
/* Sanity checks. */
|
||||
if (transfer_request == UX_NULL)
|
||||
return(UX_INVALID_PARAMETER);
|
||||
if (transfer_request -> ux_transfer_request_endpoint == UX_NULL)
|
||||
return(UX_ENDPOINT_HANDLE_UNKNOWN);
|
||||
if (transfer_request -> ux_transfer_request_endpoint -> ux_endpoint_device == UX_NULL)
|
||||
return(UX_DEVICE_HANDLE_UNKNOWN);
|
||||
if (UX_DEVICE_HCD_GET(transfer_request -> ux_transfer_request_endpoint -> ux_endpoint_device) == UX_NULL)
|
||||
return(UX_INVALID_PARAMETER);
|
||||
|
||||
/* Invoke transfer request function. */
|
||||
return(_ux_host_stack_transfer_run(transfer_request));
|
||||
}
|
||||
#endif
|
||||
|
@ -268,3 +268,56 @@ UINT status;
|
||||
return(UX_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _uxe_system_initialize PORTABLE C */
|
||||
/* 6.x */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Chaoqiong Xiao, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This function checks errors in system initialization function call. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* regular_memory_pool_start Start of non cached memory pool */
|
||||
/* regular_memory_size Size of non cached memory pool */
|
||||
/* cache_safe_memory_pool_start Start of cached memory pool */
|
||||
/* cache_safe_memory_size Size of cached memory pool */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* None */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _ux_system_initialize Get encoded feedback */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* Application */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* xx-xx-xxxx Chaoqiong Xiao Initial Version 6.x */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _uxe_system_initialize(VOID *regular_memory_pool_start, ULONG regular_memory_size,
|
||||
VOID *cache_safe_memory_pool_start, ULONG cache_safe_memory_size)
|
||||
{
|
||||
|
||||
/* Sanity check. */
|
||||
if ((regular_memory_pool_start == UX_NULL) || (regular_memory_size == 0))
|
||||
return(UX_INVALID_PARAMETER);
|
||||
|
||||
/* Invoke system initialization function. */
|
||||
return(_ux_system_initialize(regular_memory_pool_start, regular_memory_size,
|
||||
cache_safe_memory_pool_start, cache_safe_memory_size));
|
||||
}
|
||||
|
@ -26,7 +26,7 @@
|
||||
/* COMPONENT DEFINITION RELEASE */
|
||||
/* */
|
||||
/* ux_device_class_pima.h PORTABLE C */
|
||||
/* 6.1.11 */
|
||||
/* 6.x */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Chaoqiong Xiao, Microsoft Corporation */
|
||||
@ -58,6 +58,9 @@
|
||||
/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
|
||||
/* fixed standalone compile, */
|
||||
/* resulting in version 6.1.11 */
|
||||
/* xx-xx-xxxx Chaoqiong Xiao Modified comment(s), */
|
||||
/* added error checks support, */
|
||||
/* resulting in version 6.x */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
|
||||
@ -74,6 +77,14 @@ extern "C" {
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/* Internal option: enable the basic USBX error checking. This define is typically used
|
||||
while debugging application. */
|
||||
#if defined(UX_ENABLE_ERROR_CHECKING) && !defined(UX_DEVICE_CLASS_PIMA_ENABLE_ERROR_CHECKING)
|
||||
#define UX_DEVICE_CLASS_PIMA_ENABLE_ERROR_CHECKING
|
||||
#endif
|
||||
|
||||
|
||||
/* Define PIMA Class constants. */
|
||||
|
||||
#define UX_DEVICE_CLASS_PIMA_TRANSFER_BUFFER_LENGTH UX_SLAVE_REQUEST_DATA_MAX_LENGTH
|
||||
@ -1016,6 +1027,10 @@ UINT _ux_device_class_pima_object_prop_value_set(UX_SLAVE_CLASS_PIMA *pima,
|
||||
UINT _ux_device_class_pima_storage_format(UX_SLAVE_CLASS_PIMA *pima, ULONG storage_id);
|
||||
UINT _ux_device_class_pima_device_reset(UX_SLAVE_CLASS_PIMA *pima);
|
||||
|
||||
|
||||
UINT _uxe_device_class_pima_initialize(UX_SLAVE_CLASS_COMMAND *command);
|
||||
|
||||
|
||||
/* Define Device PIMA Class API prototypes. */
|
||||
|
||||
#define ux_device_class_pima_initialize _ux_device_class_pima_initialize
|
||||
|
@ -31,7 +31,8 @@
|
||||
|
||||
/* Basic buffer length check: larger than DeviceInfo with all string and array 0. */
|
||||
#if UX_DEVICE_CLASS_PIMA_TRANSFER_BUFFER_LENGTH < 35
|
||||
#error UX_DEVICE_CLASS_PIMA_TRANSFER_BUFFER_LENGTH too small
|
||||
/* #error UX_DEVICE_CLASS_PIMA_TRANSFER_BUFFER_LENGTH too small */
|
||||
/* Build option checked runtime by UX_ASSERT */
|
||||
#endif
|
||||
|
||||
/**************************************************************************/
|
||||
@ -39,7 +40,7 @@
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _ux_device_class_pima_device_info_send PORTABLE C */
|
||||
/* 6.1.11 */
|
||||
/* 6.x */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Chaoqiong Xiao, Microsoft Corporation */
|
||||
@ -82,6 +83,10 @@
|
||||
/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
|
||||
/* internal clean up, */
|
||||
/* resulting in version 6.1.11 */
|
||||
/* xx-xx-xxxx Chaoqiong Xiao Modified comment(s), */
|
||||
/* checked compiling options */
|
||||
/* by runtime UX_ASSERT, */
|
||||
/* resulting in version 6.x */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _ux_device_class_pima_device_info_send(UX_SLAVE_CLASS_PIMA *pima)
|
||||
@ -94,6 +99,8 @@ UCHAR *device_info_pointer;
|
||||
ULONG array_field_counter;
|
||||
USHORT *array_pointer;
|
||||
|
||||
/* Build option check. */
|
||||
UX_ASSERT(UX_DEVICE_CLASS_PIMA_TRANSFER_BUFFER_LENGTH >= 35);
|
||||
|
||||
/* If trace is enabled, insert this event into the trace buffer. */
|
||||
UX_TRACE_IN_LINE_INSERT(UX_TRACE_DEVICE_CLASS_PIMA_DEVICE_INFO_SEND, pima, 0, 0, 0, UX_TRACE_DEVICE_CLASS_EVENTS, 0, 0)
|
||||
|
@ -31,7 +31,8 @@
|
||||
|
||||
|
||||
#if UX_DEVICE_CLASS_PIMA_TRANSFER_BUFFER_LENGTH < UX_DEVICE_CLASS_PIMA_DATA_HEADER_SIZE
|
||||
#error UX_DEVICE_CLASS_PIMA_TRANSFER_BUFFER_LENGTH too small, please check
|
||||
/* #error UX_DEVICE_CLASS_PIMA_TRANSFER_BUFFER_LENGTH too small, please check */
|
||||
/* Build option checked runtime by UX_ASSERT */
|
||||
#endif
|
||||
|
||||
/**************************************************************************/
|
||||
@ -39,7 +40,7 @@
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _ux_device_class_pima_device_prop_value_get PORTABLE C */
|
||||
/* 6.1.10 */
|
||||
/* 6.X */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Chaoqiong Xiao, Microsoft Corporation */
|
||||
@ -84,6 +85,10 @@
|
||||
/* updated status handling, */
|
||||
/* improved sanity checks, */
|
||||
/* resulting in version 6.1.10 */
|
||||
/* xx-xx-xxxx Chaoqiong Xiao Modified comment(s), */
|
||||
/* checked compiling options */
|
||||
/* by runtime UX_ASSERT, */
|
||||
/* resulting in version 6.x */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _ux_device_class_pima_device_prop_value_get(UX_SLAVE_CLASS_PIMA *pima,
|
||||
@ -96,6 +101,9 @@ UCHAR *pima_data_buffer;
|
||||
ULONG device_property_value_length;
|
||||
UCHAR *device_property_value;
|
||||
|
||||
/* Build option check. */
|
||||
UX_ASSERT(UX_DEVICE_CLASS_PIMA_TRANSFER_BUFFER_LENGTH >= UX_DEVICE_CLASS_PIMA_DATA_HEADER_SIZE);
|
||||
|
||||
/* If trace is enabled, insert this event into the trace buffer. */
|
||||
UX_TRACE_IN_LINE_INSERT(UX_TRACE_DEVICE_CLASS_PIMA_GET_DEVICE_PROP_VALUE, pima, device_property_code, 0, 0, UX_TRACE_DEVICE_CLASS_EVENTS, 0, 0)
|
||||
|
||||
|
@ -34,7 +34,7 @@
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _ux_device_class_pima_entry PORTABLE C */
|
||||
/* 6.1 */
|
||||
/* 6.x */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Chaoqiong Xiao, Microsoft Corporation */
|
||||
@ -72,6 +72,9 @@
|
||||
/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
|
||||
/* 09-30-2020 Chaoqiong Xiao Modified comment(s), */
|
||||
/* resulting in version 6.1 */
|
||||
/* xx-xx-xxxx Chaoqiong Xiao Modified comment(s), */
|
||||
/* added error checks support, */
|
||||
/* resulting in version 6.x */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _ux_device_class_pima_entry(UX_SLAVE_CLASS_COMMAND *command)
|
||||
@ -88,7 +91,11 @@ UINT status;
|
||||
case UX_SLAVE_CLASS_COMMAND_INITIALIZE:
|
||||
|
||||
/* Call the init function of the PIMA class. */
|
||||
#if defined(UX_DEVICE_CLASS_PIMA_ENABLE_ERROR_CHECKING)
|
||||
status = _uxe_device_class_pima_initialize(command);
|
||||
#else
|
||||
status = _ux_device_class_pima_initialize(command);
|
||||
#endif
|
||||
|
||||
/* Return the completion status. */
|
||||
return(status);
|
||||
|
@ -236,3 +236,87 @@ UX_SLAVE_CLASS *class_ptr;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _uxe_device_class_pima_initialize PORTABLE C */
|
||||
/* 6.x */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Chaoqiong Xiao, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This function checks errors in PIMA initialization function call. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* command Pointer to pima command */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* Completion Status */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _ux_device_class_pima_initialize Initialize pima instance */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* Device PIMA Class */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* xx-xx-xxxx Chaoqiong Xiao Initial Version 6.x */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _uxe_device_class_pima_initialize(UX_SLAVE_CLASS_COMMAND *command)
|
||||
{
|
||||
|
||||
UX_SLAVE_CLASS_PIMA_PARAMETER *pima_parameter;
|
||||
|
||||
/* Get the pointer to the application parameters for the pima class. */
|
||||
pima_parameter = command -> ux_slave_class_command_parameter;
|
||||
|
||||
/* Sanity checks. */
|
||||
if (
|
||||
/* Property lists check. */
|
||||
/* pima_parameter -> ux_device_class_pima_parameter_device_properties_list can be UX_NULL */
|
||||
/* pima_parameter -> ux_device_class_pima_parameter_supported_capture_formats_list can be UX_NULL */
|
||||
/* pima_parameter -> ux_device_class_pima_parameter_supported_image_formats_list can be UX_NULL */
|
||||
|
||||
/* Callback functions check. */
|
||||
/* pima_parameter -> ux_device_class_pima_parameter_cancel can be NULL */
|
||||
(pima_parameter -> ux_device_class_pima_parameter_device_reset == UX_NULL) ||
|
||||
(pima_parameter -> ux_device_class_pima_parameter_device_prop_desc_get == UX_NULL) ||
|
||||
(pima_parameter -> ux_device_class_pima_parameter_device_prop_value_get == UX_NULL) ||
|
||||
(pima_parameter -> ux_device_class_pima_parameter_device_prop_value_set == UX_NULL) ||
|
||||
(pima_parameter -> ux_device_class_pima_parameter_storage_format == UX_NULL) ||
|
||||
/* pima_parameter -> ux_device_class_pima_parameter_storage_info_get can be UX_NULL */
|
||||
(pima_parameter -> ux_device_class_pima_parameter_object_number_get == UX_NULL) ||
|
||||
(pima_parameter -> ux_device_class_pima_parameter_object_handles_get == UX_NULL) ||
|
||||
(pima_parameter -> ux_device_class_pima_parameter_object_info_get == UX_NULL) ||
|
||||
(pima_parameter -> ux_device_class_pima_parameter_object_data_get == UX_NULL) ||
|
||||
(pima_parameter -> ux_device_class_pima_parameter_object_info_send == UX_NULL) ||
|
||||
(pima_parameter -> ux_device_class_pima_parameter_object_data_send == UX_NULL) ||
|
||||
(pima_parameter -> ux_device_class_pima_parameter_object_delete == UX_NULL)
|
||||
#ifdef UX_PIMA_WITH_MTP_SUPPORT
|
||||
|| (pima_parameter -> ux_device_class_pima_parameter_object_properties_list == UX_NULL)
|
||||
|| (pima_parameter -> ux_device_class_pima_parameter_object_prop_desc_get == UX_NULL)
|
||||
|| (pima_parameter -> ux_device_class_pima_parameter_object_prop_value_get == UX_NULL)
|
||||
|| (pima_parameter -> ux_device_class_pima_parameter_object_prop_value_set == UX_NULL)
|
||||
|| (pima_parameter -> ux_device_class_pima_parameter_object_references_get == UX_NULL)
|
||||
|| (pima_parameter -> ux_device_class_pima_parameter_object_references_set == UX_NULL)
|
||||
#endif
|
||||
)
|
||||
{
|
||||
return(UX_INVALID_PARAMETER);
|
||||
}
|
||||
|
||||
/* Invoke PIMA initialize function. */
|
||||
return(_ux_device_class_pima_initialize(command));
|
||||
}
|
||||
|
@ -33,7 +33,8 @@
|
||||
#if UX_DEVICE_CLASS_PIMA_TRANSFER_BUFFER_LENGTH < UX_DEVICE_CLASS_PIMA_DATA_HEADER_SIZE + \
|
||||
4 + \
|
||||
(4 * UX_DEVICE_CLASS_PIMA_MAX_STORAGE_IDS)
|
||||
#error UX_DEVICE_CLASS_PIMA_TRANSFER_BUFFER_LENGTH too small
|
||||
/* #error UX_DEVICE_CLASS_PIMA_TRANSFER_BUFFER_LENGTH too small */
|
||||
/* Build option checked runtime by UX_ASSERT */
|
||||
#endif
|
||||
|
||||
/**************************************************************************/
|
||||
@ -41,7 +42,7 @@
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _ux_device_class_pima_storage_id_send PORTABLE C */
|
||||
/* 6.1.10 */
|
||||
/* 6.X */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Chaoqiong Xiao, Microsoft Corporation */
|
||||
@ -79,6 +80,10 @@
|
||||
/* 01-31-2022 Chaoqiong Xiao Modified comment(s), */
|
||||
/* improved sanity checks, */
|
||||
/* resulting in version 6.1.10 */
|
||||
/* xx-xx-xxxx Chaoqiong Xiao Modified comment(s), */
|
||||
/* checked compiling options */
|
||||
/* by runtime UX_ASSERT, */
|
||||
/* resulting in version 6.x */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _ux_device_class_pima_storage_id_send(UX_SLAVE_CLASS_PIMA *pima)
|
||||
@ -89,6 +94,12 @@ UX_SLAVE_TRANSFER *transfer_request;
|
||||
ULONG storage_id_length;
|
||||
UCHAR *storage_id;
|
||||
|
||||
/* Build option check. */
|
||||
UX_ASSERT(UX_DEVICE_CLASS_PIMA_TRANSFER_BUFFER_LENGTH >=
|
||||
(UX_DEVICE_CLASS_PIMA_DATA_HEADER_SIZE +
|
||||
4 +
|
||||
(4 * UX_DEVICE_CLASS_PIMA_MAX_STORAGE_IDS)));
|
||||
|
||||
/* If trace is enabled, insert this event into the trace buffer. */
|
||||
UX_TRACE_IN_LINE_INSERT(UX_TRACE_DEVICE_CLASS_PIMA_STORAGE_ID_SEND, pima, 0, 0, 0, UX_TRACE_DEVICE_CLASS_EVENTS, 0, 0)
|
||||
|
||||
|
@ -12,8 +12,8 @@
|
||||
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/** */
|
||||
/** USBX Component */
|
||||
/** */
|
||||
/** USBX Component */
|
||||
/** */
|
||||
/** PIMA Class */
|
||||
/** */
|
||||
@ -26,20 +26,20 @@
|
||||
/* COMPONENT DEFINITION RELEASE */
|
||||
/* */
|
||||
/* ux_host_class_pima.h PORTABLE C */
|
||||
/* 6.1.12 */
|
||||
/* 6.x */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Chaoqiong Xiao, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* */
|
||||
/* This file contains all the header and extern functions used by the */
|
||||
/* USBX PIMA class. */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* USBX PIMA class. */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
|
||||
/* 09-30-2020 Chaoqiong Xiao Modified comment(s), */
|
||||
/* used UX prefix to refer to */
|
||||
@ -53,21 +53,32 @@
|
||||
/* 07-29-2022 Chaoqiong Xiao Modified comment(s), */
|
||||
/* improved internal checks, */
|
||||
/* resulting in version 6.1.12 */
|
||||
/* xx-xx-xxxx Chaoqiong Xiao Modified comment(s), */
|
||||
/* increased default buffer */
|
||||
/* length to get device info, */
|
||||
/* added error checks support, */
|
||||
/* resulting in version 6.x */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef UX_HOST_CLASS_PIMA_H
|
||||
#define UX_HOST_CLASS_PIMA_H
|
||||
|
||||
/* Determine if a C++ compiler is being used. If so, ensure that standard
|
||||
C is used to process the API information. */
|
||||
/* Determine if a C++ compiler is being used. If so, ensure that standard
|
||||
C is used to process the API information. */
|
||||
|
||||
#ifdef __cplusplus
|
||||
#ifdef __cplusplus
|
||||
|
||||
/* Yes, C++ compiler is present. Use standard C. */
|
||||
extern "C" {
|
||||
/* Yes, C++ compiler is present. Use standard C. */
|
||||
extern "C" {
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Internal option: enable the basic USBX error checking. This define is typically used
|
||||
while debugging application. */
|
||||
#if defined(UX_ENABLE_ERROR_CHECKING) && !defined(UX_HOST_CLASS_PIMA_ENABLE_ERROR_CHECKING)
|
||||
#define UX_HOST_CLASS_PIMA_ENABLE_ERROR_CHECKING
|
||||
#endif
|
||||
|
||||
/* Define PIMA Class constants. */
|
||||
|
||||
@ -79,7 +90,7 @@ extern "C" {
|
||||
#define UX_HOST_CLASS_PIMA_MAGIC_NUMBER 0x50494D41
|
||||
#define UX_HOST_CLASS_PIMA_UNICODE_MAX_LENGTH 256
|
||||
#define UX_HOST_CLASS_PIMA_ARRAY_MAX_LENGTH 256
|
||||
#define UX_HOST_CLASS_PIMA_DATE_TIME_STRING_MAX_LENGTH 64
|
||||
#define UX_HOST_CLASS_PIMA_DATE_TIME_STRING_MAX_LENGTH 64
|
||||
#define UX_HOST_CLASS_PIMA_MAX_STORAGE_IDS 64
|
||||
#if (UX_OVERFLOW_CHECK_ADD_ULONG(UX_HOST_CLASS_PIMA_MAX_STORAGE_IDS, 1) || \
|
||||
UX_OVERFLOW_CHECK_MULC_ULONG(UX_HOST_CLASS_PIMA_MAX_STORAGE_IDS + 1, 4))
|
||||
@ -133,7 +144,7 @@ extern "C" {
|
||||
#define UX_HOST_CLASS_PIMA_REQUEST_STATUS_OFFSET_LENGTH 0x00
|
||||
#define UX_HOST_CLASS_PIMA_REQUEST_STATUS_OFFSET_CODE 0x02
|
||||
#define UX_HOST_CLASS_PIMA_REQUEST_STATUS_COMMAND_COUNTER 16
|
||||
#define UX_HOST_CLASS_PIMA_REQUEST_STATUS_COMMAND_DELAY 1000
|
||||
#define UX_HOST_CLASS_PIMA_REQUEST_STATUS_COMMAND_DELAY 1000
|
||||
|
||||
/* Define PIMA command container type. */
|
||||
|
||||
@ -169,7 +180,7 @@ extern "C" {
|
||||
#define UX_HOST_CLASS_PIMA_COMMAND_HEADER_PARAMETER_5 0x1C
|
||||
|
||||
#define UX_HOST_CLASS_PIMA_COMMAND_HEADER_SIZE 0x0C
|
||||
#define UX_HOST_CLASS_PIMA_CONTAINER_SIZE 0x40
|
||||
#define UX_HOST_CLASS_PIMA_CONTAINER_SIZE 0x40
|
||||
#define UX_HOST_CLASS_PIMA_ALL_HEADER_SIZE 0x20
|
||||
|
||||
/* Define PIMA Data Header Format. */
|
||||
@ -226,7 +237,7 @@ extern "C" {
|
||||
#define UX_HOST_CLASS_PIMA_OC_FORMAT_STORE 0x100F
|
||||
#define UX_HOST_CLASS_PIMA_OC_RESET_DEVICE 0x1010
|
||||
#define UX_HOST_CLASS_PIMA_OC_SELF_TEST 0x1011
|
||||
#define UX_HOST_CLASS_PIMA_OC_SET_OBJECT_PROTECTION 0x1012
|
||||
#define UX_HOST_CLASS_PIMA_OC_SET_OBJECT_PROTECTION 0x1012
|
||||
#define UX_HOST_CLASS_PIMA_OC_POWER_DOWN 0x1013
|
||||
#define UX_HOST_CLASS_PIMA_OC_GET_DEVICE_PROP_DESC 0x1014
|
||||
#define UX_HOST_CLASS_PIMA_OC_GET_DEVICE_PROP_VALUE 0x1015
|
||||
@ -310,7 +321,7 @@ extern "C" {
|
||||
#define UX_HOST_CLASS_PIMA_OFC_AVI 0x300A
|
||||
#define UX_HOST_CLASS_PIMA_OFC_MPEG 0x300B
|
||||
#define UX_HOST_CLASS_PIMA_OFC_ASF 0x300C
|
||||
#define UX_HOST_CLASS_PIMA_OFC_QT 0x300D
|
||||
#define UX_HOST_CLASS_PIMA_OFC_QT 0x300D
|
||||
#define UX_HOST_CLASS_PIMA_OFC_EXIF_JPEG 0x3801
|
||||
#define UX_HOST_CLASS_PIMA_OFC_TIFF_EP 0x3802
|
||||
#define UX_HOST_CLASS_PIMA_OFC_FLASHPIX 0x3803
|
||||
@ -350,9 +361,9 @@ extern "C" {
|
||||
|
||||
typedef struct UX_HOST_CLASS_PIMA_EVENT_STRUCT
|
||||
{
|
||||
struct UX_HOST_CLASS_PIMA_SESSION_STRUCT
|
||||
struct UX_HOST_CLASS_PIMA_SESSION_STRUCT
|
||||
*ux_host_class_pima_event_session;
|
||||
struct UX_HOST_CLASS_PIMA_STRUCT
|
||||
struct UX_HOST_CLASS_PIMA_STRUCT
|
||||
*ux_host_class_pima_event_pima_instance;
|
||||
ULONG ux_host_class_pima_event_code;
|
||||
ULONG ux_host_class_pima_event_session_id;
|
||||
@ -360,7 +371,7 @@ typedef struct UX_HOST_CLASS_PIMA_EVENT_STRUCT
|
||||
ULONG ux_host_class_pima_event_parameter_1;
|
||||
ULONG ux_host_class_pima_event_parameter_2;
|
||||
ULONG ux_host_class_pima_event_parameter_3;
|
||||
|
||||
|
||||
} UX_HOST_CLASS_PIMA_EVENT;
|
||||
|
||||
/* Define PIMA structure. */
|
||||
@ -368,7 +379,7 @@ typedef struct UX_HOST_CLASS_PIMA_EVENT_STRUCT
|
||||
typedef struct UX_HOST_CLASS_PIMA_STRUCT
|
||||
{
|
||||
|
||||
struct UX_HOST_CLASS_PIMA_STRUCT
|
||||
struct UX_HOST_CLASS_PIMA_STRUCT
|
||||
*ux_host_class_pima_next_instance;
|
||||
UX_HOST_CLASS *ux_host_class_pima_class;
|
||||
UX_DEVICE *ux_host_class_pima_device;
|
||||
@ -389,9 +400,9 @@ typedef struct UX_HOST_CLASS_PIMA_STRUCT
|
||||
UCHAR *ux_host_class_pima_event_buffer_current_offset;
|
||||
ULONG ux_host_class_pima_event_buffer_current_length;
|
||||
ULONG ux_host_class_pima_event_buffer_expected_length;
|
||||
struct UX_HOST_CLASS_PIMA_SESSION_STRUCT
|
||||
struct UX_HOST_CLASS_PIMA_SESSION_STRUCT
|
||||
*ux_host_class_pima_session;
|
||||
UCHAR *ux_host_class_pima_container;
|
||||
UCHAR *ux_host_class_pima_container;
|
||||
UX_SEMAPHORE ux_host_class_pima_semaphore;
|
||||
VOID *ux_host_class_pima_application;
|
||||
ULONG ux_host_class_pima_zlp_flag;
|
||||
@ -406,12 +417,12 @@ typedef struct UX_HOST_CLASS_PIMA_SESSION_STRUCT
|
||||
ULONG ux_host_class_pima_session_magic;
|
||||
ALIGN_TYPE ux_host_class_pima_session_id;
|
||||
ULONG ux_host_class_pima_session_state;
|
||||
struct UX_HOST_CLASS_PIMA_STRUCT
|
||||
struct UX_HOST_CLASS_PIMA_STRUCT
|
||||
*ux_host_class_pima_session_pima_instance;
|
||||
ULONG ux_host_class_pima_session_nb_storage_ids;
|
||||
ULONG ux_host_class_pima_session_nb_objects;
|
||||
VOID (*ux_host_class_pima_session_event_callback)(struct UX_HOST_CLASS_PIMA_EVENT_STRUCT *pima_event);
|
||||
|
||||
|
||||
} UX_HOST_CLASS_PIMA_SESSION;
|
||||
|
||||
|
||||
@ -427,7 +438,7 @@ typedef struct UX_HOST_CLASS_PIMA_COMMAND_STRUCT
|
||||
ULONG ux_host_class_pima_command_parameter_3;
|
||||
ULONG ux_host_class_pima_command_parameter_4;
|
||||
ULONG ux_host_class_pima_command_parameter_5;
|
||||
|
||||
|
||||
} UX_HOST_CLASS_PIMA_COMMAND;
|
||||
|
||||
/* Define PIMA object info structure. */
|
||||
@ -460,13 +471,13 @@ typedef struct UX_HOST_CLASS_PIMA_OBJECT_STRUCT
|
||||
ULONG ux_host_class_pima_object_handle_id;
|
||||
ULONG ux_host_class_pima_object_length;
|
||||
UCHAR *ux_host_class_pima_object_buffer;
|
||||
|
||||
|
||||
} UX_HOST_CLASS_PIMA_OBJECT;
|
||||
|
||||
/* Define PIMA Object decompaction structure. */
|
||||
|
||||
#define UX_HOST_CLASS_PIMA_OBJECT_MAX_LENGTH 512
|
||||
#define UX_HOST_CLASS_PIMA_OBJECT_VARIABLE_OFFSET 52
|
||||
#define UX_HOST_CLASS_PIMA_OBJECT_VARIABLE_OFFSET 52
|
||||
#define UX_HOST_CLASS_PIMA_OBJECT_ENTRIES 15
|
||||
|
||||
/* Define PIMA device info structure. */
|
||||
@ -488,12 +499,12 @@ typedef struct UX_HOST_CLASS_PIMA_DEVICE_STRUCT
|
||||
UCHAR ux_host_class_pima_device_model[UX_HOST_CLASS_PIMA_DATE_TIME_STRING_MAX_LENGTH];
|
||||
UCHAR ux_host_class_pima_device_version[UX_HOST_CLASS_PIMA_DATE_TIME_STRING_MAX_LENGTH];
|
||||
UCHAR ux_host_class_pima_device_serial_number[UX_HOST_CLASS_PIMA_UNICODE_MAX_LENGTH]; /* Null terminated unicode string. */
|
||||
|
||||
|
||||
} UX_HOST_CLASS_PIMA_DEVICE;
|
||||
|
||||
/* Define PIMA Device decompaction structure. */
|
||||
|
||||
#define UX_HOST_CLASS_PIMA_DEVICE_MAX_LENGTH 512
|
||||
#define UX_HOST_CLASS_PIMA_DEVICE_MAX_LENGTH 1024
|
||||
#define UX_HOST_CLASS_PIMA_DEVICE_STANDARD_VERSION 0
|
||||
#define UX_HOST_CLASS_PIMA_DEVICE_VENDOR_EXTENSION_ID 2
|
||||
#define UX_HOST_CLASS_PIMA_DEVICE_VENDOR_EXTENSION_VERSION 6
|
||||
@ -514,14 +525,14 @@ typedef struct UX_HOST_CLASS_PIMA_STORAGE_STRUCT
|
||||
ULONG ux_host_class_pima_storage_free_space_images;
|
||||
UCHAR ux_host_class_pima_storage_description[UX_HOST_CLASS_PIMA_UNICODE_MAX_LENGTH]; /* Null terminated unicode string. */
|
||||
UCHAR ux_host_class_pima_storage_volume_label[UX_HOST_CLASS_PIMA_UNICODE_MAX_LENGTH]; /* Null terminated unicode string. */
|
||||
|
||||
|
||||
} UX_HOST_CLASS_PIMA_STORAGE;
|
||||
|
||||
/* Define PIMA storage decompaction structure. */
|
||||
|
||||
#define UX_HOST_CLASS_PIMA_STORAGE_MAX_LENGTH 512
|
||||
#define UX_HOST_CLASS_PIMA_STORAGE_VARIABLE_OFFSET 26
|
||||
#define UX_HOST_CLASS_PIMA_STORAGE_ENTRIES 8
|
||||
#define UX_HOST_CLASS_PIMA_STORAGE_ENTRIES 8
|
||||
|
||||
/* Define Pima Class function prototypes. */
|
||||
|
||||
@ -532,10 +543,10 @@ UINT _ux_host_class_pima_endpoints_get(UX_HOST_CLASS_PIMA *cdc_acm);
|
||||
UINT _ux_host_class_pima_entry(UX_HOST_CLASS_COMMAND *command);
|
||||
VOID _ux_host_class_pima_notification(UX_TRANSFER *transfer_request);
|
||||
UINT _ux_host_class_pima_command(UX_HOST_CLASS_PIMA *pima, UX_HOST_CLASS_PIMA_COMMAND *command,
|
||||
ULONG direction, UCHAR *data_buffer, ULONG data_length,
|
||||
ULONG direction, UCHAR *data_buffer, ULONG data_length,
|
||||
ULONG max_payload_length);
|
||||
UINT _ux_host_class_pima_device_reset(UX_HOST_CLASS_PIMA *pima);
|
||||
UINT _ux_host_class_pima_num_objects_get(UX_HOST_CLASS_PIMA *pima, UX_HOST_CLASS_PIMA_SESSION *pima_session, ULONG storage_id,
|
||||
UINT _ux_host_class_pima_num_objects_get(UX_HOST_CLASS_PIMA *pima, UX_HOST_CLASS_PIMA_SESSION *pima_session, ULONG storage_id,
|
||||
ULONG object_format_code);
|
||||
UINT _ux_host_class_pima_object_copy(UX_HOST_CLASS_PIMA *pima, UX_HOST_CLASS_PIMA_SESSION *pima_session, ULONG object_handle,
|
||||
ULONG storage_id, ULONG parent_object_handle);
|
||||
@ -559,42 +570,96 @@ UINT _ux_host_class_pima_thumb_get(UX_HOST_CLASS_PIMA *pima, UX_HOST_CLASS_PIMA
|
||||
UCHAR *thumb_buffer, ULONG thumb_buffer_length, ULONG *thumb_actual_length);
|
||||
UINT _ux_host_class_pima_write(UX_HOST_CLASS_PIMA *pima, UCHAR *data_pointer, ULONG data_length, ULONG operation_code, ULONG max_payload_length);
|
||||
UINT _ux_host_class_pima_request_cancel(UX_HOST_CLASS_PIMA *pima);
|
||||
UINT _ux_host_class_pima_object_transfer_abort(UX_HOST_CLASS_PIMA *pima,
|
||||
UINT _ux_host_class_pima_object_transfer_abort(UX_HOST_CLASS_PIMA *pima,
|
||||
UX_HOST_CLASS_PIMA_SESSION *pima_session,
|
||||
ULONG object_handle, UX_HOST_CLASS_PIMA_OBJECT *object);
|
||||
UINT _ux_host_class_pima_object_close(UX_HOST_CLASS_PIMA *pima,
|
||||
UINT _ux_host_class_pima_object_close(UX_HOST_CLASS_PIMA *pima,
|
||||
UX_HOST_CLASS_PIMA_SESSION *pima_session,
|
||||
ULONG object_handle, UX_HOST_CLASS_PIMA_OBJECT *object);
|
||||
UINT _ux_host_class_pima_object_open(UX_HOST_CLASS_PIMA *pima,
|
||||
UINT _ux_host_class_pima_object_open(UX_HOST_CLASS_PIMA *pima,
|
||||
UX_HOST_CLASS_PIMA_SESSION *pima_session,
|
||||
ULONG object_handle, UX_HOST_CLASS_PIMA_OBJECT *object);
|
||||
UINT _ux_host_class_pima_device_info_get(UX_HOST_CLASS_PIMA *pima,
|
||||
UINT _ux_host_class_pima_device_info_get(UX_HOST_CLASS_PIMA *pima,
|
||||
UX_HOST_CLASS_PIMA_DEVICE *pima_device);
|
||||
|
||||
/* Define Device PIMA Class API prototypes. */
|
||||
|
||||
#define ux_host_class_pima_entry _ux_host_class_pima_entry
|
||||
#define ux_host_class_pima_device_info_get _ux_host_class_pima_device_info_get
|
||||
UINT _uxe_host_class_pima_num_objects_get(UX_HOST_CLASS_PIMA *pima, UX_HOST_CLASS_PIMA_SESSION *pima_session, ULONG storage_id,
|
||||
ULONG object_format_code);
|
||||
|
||||
UINT _uxe_host_class_pima_object_delete(UX_HOST_CLASS_PIMA *pima, UX_HOST_CLASS_PIMA_SESSION *pima_session, ULONG object_handle);
|
||||
UINT _uxe_host_class_pima_object_get(UX_HOST_CLASS_PIMA *pima, UX_HOST_CLASS_PIMA_SESSION *pima_session, ULONG object_handle, UX_HOST_CLASS_PIMA_OBJECT *object,
|
||||
UCHAR *object_buffer, ULONG object_buffer_length, ULONG *object_actual_length);
|
||||
UINT _uxe_host_class_pima_object_handles_get(UX_HOST_CLASS_PIMA *pima, UX_HOST_CLASS_PIMA_SESSION *pima_session,
|
||||
ULONG *object_handles_array, ULONG object_handles_length, ULONG storage_id, ULONG object_format_code, ULONG object_handle_association);
|
||||
UINT _uxe_host_class_pima_object_info_get(UX_HOST_CLASS_PIMA *pima, UX_HOST_CLASS_PIMA_SESSION *pima_session, ULONG object_handle, UX_HOST_CLASS_PIMA_OBJECT *object);
|
||||
UINT _uxe_host_class_pima_object_info_send(UX_HOST_CLASS_PIMA *pima, UX_HOST_CLASS_PIMA_SESSION *pima_session, ULONG storage_id, ULONG parent_object_id,
|
||||
UX_HOST_CLASS_PIMA_OBJECT *object);
|
||||
UINT _uxe_host_class_pima_object_send(UX_HOST_CLASS_PIMA *pima, UX_HOST_CLASS_PIMA_SESSION *pima_session, UX_HOST_CLASS_PIMA_OBJECT *object,
|
||||
UCHAR *object_buffer, ULONG object_buffer_length);
|
||||
UINT _uxe_host_class_pima_session_close(UX_HOST_CLASS_PIMA *pima, UX_HOST_CLASS_PIMA_SESSION *pima_session);
|
||||
UINT _uxe_host_class_pima_session_open(UX_HOST_CLASS_PIMA *pima, UX_HOST_CLASS_PIMA_SESSION *pima_session);
|
||||
UINT _uxe_host_class_pima_storage_ids_get(UX_HOST_CLASS_PIMA *pima, UX_HOST_CLASS_PIMA_SESSION *pima_session, ULONG *storage_ids_array, ULONG storage_id_length);
|
||||
UINT _uxe_host_class_pima_storage_info_get(UX_HOST_CLASS_PIMA *pima, UX_HOST_CLASS_PIMA_SESSION *pima_session, ULONG storage_id, UX_HOST_CLASS_PIMA_STORAGE *storage);
|
||||
UINT _uxe_host_class_pima_thumb_get(UX_HOST_CLASS_PIMA *pima, UX_HOST_CLASS_PIMA_SESSION *pima_session, ULONG object_handle, UX_HOST_CLASS_PIMA_OBJECT *object,
|
||||
UCHAR *thumb_buffer, ULONG thumb_buffer_length, ULONG *thumb_actual_length);
|
||||
UINT _uxe_host_class_pima_object_transfer_abort(UX_HOST_CLASS_PIMA *pima,
|
||||
UX_HOST_CLASS_PIMA_SESSION *pima_session,
|
||||
ULONG object_handle, UX_HOST_CLASS_PIMA_OBJECT *object);
|
||||
UINT _uxe_host_class_pima_object_close(UX_HOST_CLASS_PIMA *pima,
|
||||
UX_HOST_CLASS_PIMA_SESSION *pima_session,
|
||||
ULONG object_handle, UX_HOST_CLASS_PIMA_OBJECT *object);
|
||||
UINT _uxe_host_class_pima_object_open(UX_HOST_CLASS_PIMA *pima,
|
||||
UX_HOST_CLASS_PIMA_SESSION *pima_session,
|
||||
ULONG object_handle, UX_HOST_CLASS_PIMA_OBJECT *object);
|
||||
UINT _uxe_host_class_pima_device_info_get(UX_HOST_CLASS_PIMA *pima,
|
||||
UX_HOST_CLASS_PIMA_DEVICE *pima_device);
|
||||
|
||||
/* Define Device PIMA Class API prototypes. */
|
||||
#if defined(UX_HOST_CLASS_PIMA_ENABLE_ERROR_CHECKING)
|
||||
|
||||
#define ux_host_class_pima_entry _ux_host_class_pima_entry
|
||||
#define ux_host_class_pima_device_info_get _uxe_host_class_pima_device_info_get
|
||||
#define ux_host_class_pima_object_info_send _uxe_host_class_pima_object_info_send
|
||||
#define ux_host_class_pima_object_info_get _uxe_host_class_pima_object_info_get
|
||||
#define ux_host_class_pima_object_open _uxe_host_class_pima_object_open
|
||||
#define ux_host_class_pima_object_get _uxe_host_class_pima_object_get
|
||||
#define ux_host_class_pima_thumb_get _uxe_host_class_pima_thumb_get
|
||||
#define ux_host_class_pima_object_send _uxe_host_class_pima_object_send
|
||||
#define ux_host_class_pima_object_delete _uxe_host_class_pima_object_delete
|
||||
#define ux_host_class_pima_object_transfer_abort _uxe_host_class_pima_object_transfer_abort
|
||||
#define ux_host_class_pima_object_close _uxe_host_class_pima_object_close
|
||||
#define ux_host_class_pima_session_open _uxe_host_class_pima_session_open
|
||||
#define ux_host_class_pima_session_close _uxe_host_class_pima_session_close
|
||||
#define ux_host_class_pima_storage_ids_get _uxe_host_class_pima_storage_ids_get
|
||||
#define ux_host_class_pima_storage_info_get _uxe_host_class_pima_storage_info_get
|
||||
#define ux_host_class_pima_object_handles_get _uxe_host_class_pima_object_handles_get
|
||||
#define ux_host_class_pima_num_objects_get _uxe_host_class_pima_num_objects_get
|
||||
|
||||
#else
|
||||
|
||||
#define ux_host_class_pima_entry _ux_host_class_pima_entry
|
||||
#define ux_host_class_pima_device_info_get _ux_host_class_pima_device_info_get
|
||||
#define ux_host_class_pima_object_info_send _ux_host_class_pima_object_info_send
|
||||
#define ux_host_class_pima_object_info_get _ux_host_class_pima_object_info_get
|
||||
#define ux_host_class_pima_object_open _ux_host_class_pima_object_open
|
||||
#define ux_host_class_pima_object_get _ux_host_class_pima_object_get
|
||||
#define ux_host_class_pima_thumb_get _ux_host_class_pima_thumb_get
|
||||
#define ux_host_class_pima_object_info_get _ux_host_class_pima_object_info_get
|
||||
#define ux_host_class_pima_object_open _ux_host_class_pima_object_open
|
||||
#define ux_host_class_pima_object_get _ux_host_class_pima_object_get
|
||||
#define ux_host_class_pima_thumb_get _ux_host_class_pima_thumb_get
|
||||
#define ux_host_class_pima_object_send _ux_host_class_pima_object_send
|
||||
#define ux_host_class_pima_object_delete _ux_host_class_pima_object_delete
|
||||
#define ux_host_class_pima_object_transfer_abort _ux_host_class_pima_object_transfer_abort
|
||||
#define ux_host_class_pima_object_close _ux_host_class_pima_object_close
|
||||
#define ux_host_class_pima_session_open _ux_host_class_pima_session_open
|
||||
#define ux_host_class_pima_session_close _ux_host_class_pima_session_close
|
||||
#define ux_host_class_pima_storage_ids_get _ux_host_class_pima_storage_ids_get
|
||||
#define ux_host_class_pima_object_close _ux_host_class_pima_object_close
|
||||
#define ux_host_class_pima_session_open _ux_host_class_pima_session_open
|
||||
#define ux_host_class_pima_session_close _ux_host_class_pima_session_close
|
||||
#define ux_host_class_pima_storage_ids_get _ux_host_class_pima_storage_ids_get
|
||||
#define ux_host_class_pima_storage_info_get _ux_host_class_pima_storage_info_get
|
||||
#define ux_host_class_pima_object_handles_get _ux_host_class_pima_object_handles_get
|
||||
#define ux_host_class_pima_num_objects_get _ux_host_class_pima_num_objects_get
|
||||
|
||||
/* Determine if a C++ compiler is being used. If so, complete the standard
|
||||
C conditional started above. */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#define ux_host_class_pima_object_handles_get _ux_host_class_pima_object_handles_get
|
||||
#define ux_host_class_pima_num_objects_get _ux_host_class_pima_num_objects_get
|
||||
|
||||
#endif
|
||||
|
||||
/* Determine if a C++ compiler is being used. If so, complete the standard
|
||||
C conditional started above. */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -12,8 +12,8 @@
|
||||
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/** */
|
||||
/** USBX Component */
|
||||
/** */
|
||||
/** USBX Component */
|
||||
/** */
|
||||
/** Printer Class */
|
||||
/** */
|
||||
@ -21,25 +21,25 @@
|
||||
/**************************************************************************/
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* COMPONENT DEFINITION RELEASE */
|
||||
/* */
|
||||
/* ux_host_class_printer.h PORTABLE C */
|
||||
/* 6.1.10 */
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* COMPONENT DEFINITION RELEASE */
|
||||
/* */
|
||||
/* ux_host_class_printer.h PORTABLE C */
|
||||
/* 6.x */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Chaoqiong Xiao, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* */
|
||||
/* This file contains all the header and extern functions used by the */
|
||||
/* USBX printer class. */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* USBX printer class. */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
|
||||
/* 09-30-2020 Chaoqiong Xiao Modified comment(s), */
|
||||
/* used UX prefix to refer to */
|
||||
@ -57,22 +57,30 @@
|
||||
/* added standalone support, */
|
||||
/* added a new protocol const, */
|
||||
/* resulting in version 6.1.10 */
|
||||
/* xx-xx-xxxx Yajun xia Modified comment(s), */
|
||||
/* added error checks support, */
|
||||
/* resulting in version 6.x */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef UX_HOST_CLASS_PRINTER_H
|
||||
#define UX_HOST_CLASS_PRINTER_H
|
||||
|
||||
/* Determine if a C++ compiler is being used. If so, ensure that standard
|
||||
C is used to process the API information. */
|
||||
/* Determine if a C++ compiler is being used. If so, ensure that standard
|
||||
C is used to process the API information. */
|
||||
|
||||
#ifdef __cplusplus
|
||||
#ifdef __cplusplus
|
||||
|
||||
/* Yes, C++ compiler is present. Use standard C. */
|
||||
extern "C" {
|
||||
/* Yes, C++ compiler is present. Use standard C. */
|
||||
extern "C" {
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Internal option: enable the basic USBX error checking. This define is typically used
|
||||
while debugging application. */
|
||||
#if defined(UX_ENABLE_ERROR_CHECKING) && !defined(UX_HOST_CLASS_PRINTER_ENABLE_ERROR_CHECKING)
|
||||
#define UX_HOST_CLASS_PRINTER_ENABLE_ERROR_CHECKING
|
||||
#endif
|
||||
|
||||
/* Define Printer Class constants. */
|
||||
|
||||
@ -107,10 +115,10 @@ extern "C" {
|
||||
|
||||
/* Define Printer Class structure. */
|
||||
|
||||
typedef struct UX_HOST_CLASS_PRINTER_STRUCT
|
||||
typedef struct UX_HOST_CLASS_PRINTER_STRUCT
|
||||
{
|
||||
|
||||
struct UX_HOST_CLASS_PRINTER_STRUCT
|
||||
struct UX_HOST_CLASS_PRINTER_STRUCT
|
||||
*ux_host_class_printer_next_instance;
|
||||
UX_HOST_CLASS *ux_host_class_printer_class;
|
||||
UX_DEVICE *ux_host_class_printer_device;
|
||||
@ -149,14 +157,36 @@ UINT _ux_host_class_printer_endpoints_get(UX_HOST_CLASS_PRINTER *printer);
|
||||
UINT _ux_host_class_printer_entry(UX_HOST_CLASS_COMMAND *command);
|
||||
UINT _ux_host_class_printer_name_get(UX_HOST_CLASS_PRINTER *printer);
|
||||
UINT _ux_host_class_printer_device_id_get(UX_HOST_CLASS_PRINTER *printer, UCHAR *descriptor_buffer, ULONG length);
|
||||
UINT _ux_host_class_printer_read (UX_HOST_CLASS_PRINTER *printer, UCHAR *data_pointer,
|
||||
UINT _ux_host_class_printer_read (UX_HOST_CLASS_PRINTER *printer, UCHAR *data_pointer,
|
||||
ULONG requested_length, ULONG *actual_length);
|
||||
UINT _ux_host_class_printer_soft_reset(UX_HOST_CLASS_PRINTER *printer);
|
||||
UINT _ux_host_class_printer_status_get(UX_HOST_CLASS_PRINTER *printer, ULONG *printer_status);
|
||||
UINT _ux_host_class_printer_write(UX_HOST_CLASS_PRINTER *printer, UCHAR * data_pointer,
|
||||
UINT _ux_host_class_printer_write(UX_HOST_CLASS_PRINTER *printer, UCHAR * data_pointer,
|
||||
ULONG requested_length, ULONG *actual_length);
|
||||
|
||||
// UINT _uxe_host_class_printer_activate(UX_HOST_CLASS_COMMAND *command);
|
||||
UINT _uxe_host_class_printer_name_get(UX_HOST_CLASS_PRINTER *printer);
|
||||
UINT _uxe_host_class_printer_device_id_get(UX_HOST_CLASS_PRINTER *printer, UCHAR *descriptor_buffer, ULONG length);
|
||||
UINT _uxe_host_class_printer_read (UX_HOST_CLASS_PRINTER *printer, UCHAR *data_pointer,
|
||||
ULONG requested_length, ULONG *actual_length);
|
||||
UINT _uxe_host_class_printer_soft_reset(UX_HOST_CLASS_PRINTER *printer);
|
||||
UINT _uxe_host_class_printer_status_get(UX_HOST_CLASS_PRINTER *printer, ULONG *printer_status);
|
||||
UINT _uxe_host_class_printer_write(UX_HOST_CLASS_PRINTER *printer, UCHAR * data_pointer,
|
||||
ULONG requested_length, ULONG *actual_length);
|
||||
|
||||
/* Define Printer Class API prototypes. */
|
||||
#if defined(UX_HOST_CLASS_PRINTER_ENABLE_ERROR_CHECKING)
|
||||
|
||||
#define ux_host_class_printer_entry _ux_host_class_printer_entry
|
||||
#define ux_host_class_printer_activate _ux_host_class_printer_activate
|
||||
#define ux_host_class_printer_name_get _uxe_host_class_printer_name_get
|
||||
#define ux_host_class_printer_device_id_get _uxe_host_class_printer_device_id_get
|
||||
#define ux_host_class_printer_read _uxe_host_class_printer_read
|
||||
#define ux_host_class_printer_soft_reset _uxe_host_class_printer_soft_reset
|
||||
#define ux_host_class_printer_status_get _uxe_host_class_printer_status_get
|
||||
#define ux_host_class_printer_write _uxe_host_class_printer_write
|
||||
|
||||
#else
|
||||
|
||||
#define ux_host_class_printer_entry _ux_host_class_printer_entry
|
||||
#define ux_host_class_printer_activate _ux_host_class_printer_activate
|
||||
@ -167,10 +197,12 @@ UINT _ux_host_class_printer_write(UX_HOST_CLASS_PRINTER *printer, UCHAR * dat
|
||||
#define ux_host_class_printer_status_get _ux_host_class_printer_status_get
|
||||
#define ux_host_class_printer_write _ux_host_class_printer_write
|
||||
|
||||
/* Determine if a C++ compiler is being used. If so, complete the standard
|
||||
C conditional started above. */
|
||||
#endif /* UX_HOST_CLASS_PRINTER_ENABLE_ERROR_CHECKING */
|
||||
|
||||
/* Determine if a C++ compiler is being used. If so, complete the standard
|
||||
C conditional started above. */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -26,7 +26,7 @@
|
||||
/* COMPONENT DEFINITION RELEASE */
|
||||
/* */
|
||||
/* ux_host_class_storage.h PORTABLE C */
|
||||
/* 6.1.10 */
|
||||
/* 6.x */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Chaoqiong Xiao, Microsoft Corporation */
|
||||
@ -64,6 +64,9 @@
|
||||
/* 01-31-2022 Chaoqiong Xiao Modified comment(s), */
|
||||
/* added standalone support, */
|
||||
/* resulting in version 6.1.10 */
|
||||
/* xx-xx-xxxx Chaoqiong Xiao Modified comment(s), */
|
||||
/* added error checks support, */
|
||||
/* resulting in version 6.x */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
|
||||
@ -81,6 +84,13 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/* Internal option: enable the basic USBX error checking. This define is typically used
|
||||
while debugging application. */
|
||||
#if defined(UX_ENABLE_ERROR_CHECKING) && !defined(UX_HOST_CLASS_STORAGE_ENABLE_ERROR_CHECKING)
|
||||
#define UX_HOST_CLASS_STORAGE_ENABLE_ERROR_CHECKING
|
||||
#endif
|
||||
|
||||
|
||||
#if !defined(UX_HOST_CLASS_STORAGE_NO_FILEX) && !defined(UX_HOST_STANDALONE)
|
||||
/* Include the FileX API. */
|
||||
#include "fx_api.h"
|
||||
@ -653,16 +663,23 @@ UINT _ux_host_class_storage_media_lock(UX_HOST_CLASS_STORAGE_MEDIA *storage_m
|
||||
|
||||
#if defined(UX_HOST_STANDALONE)
|
||||
UINT _ux_host_class_storage_lock(UX_HOST_CLASS_STORAGE *storage, ULONG wait);
|
||||
UINT _uxe_host_class_storage_lock(UX_HOST_CLASS_STORAGE *storage, ULONG wait);
|
||||
#define _ux_host_class_storage_unlock(s) do { (s) -> ux_host_class_storage_flags &= ~UX_HOST_CLASS_STORAGE_FLAG_LOCK; } while(0)
|
||||
#define _uxe_host_class_storage_unlock(s) do { if((s) != UX_NULL) (s) -> ux_host_class_storage_flags &= ~UX_HOST_CLASS_STORAGE_FLAG_LOCK; } while(0)
|
||||
#define _ux_host_class_storage_media_unlock(m) _ux_host_class_storage_unlock((m) -> ux_host_class_storage_media_storage)
|
||||
#define _uxe_host_class_storage_media_unlock(m) do { if((m) != UX_NULL) _uxe_host_class_storage_unlock((m) -> ux_host_class_storage_media_storage); } while(0)
|
||||
#else
|
||||
#define _ux_host_class_storage_lock(s,w) _ux_host_semaphore_get(&(s) -> ux_host_class_storage_semaphore, (w))
|
||||
#define _uxe_host_class_storage_lock(s,w) (((s) != UX_NULL) ? _ux_host_semaphore_get(&(s) -> ux_host_class_storage_semaphore, (w)) : UX_INVALID_PARAMETER)
|
||||
#define _ux_host_class_storage_unlock(s) _ux_host_semaphore_put(&(s) -> ux_host_class_storage_semaphore)
|
||||
#define _uxe_host_class_storage_unlock(s) (((s) != UX_NULL) ? _ux_host_semaphore_put(&(s) -> ux_host_class_storage_semaphore) : UX_INVALID_PARAMETER)
|
||||
#define _ux_host_class_storage_media_unlock(m) _ux_host_class_storage_unlock((m) -> ux_host_class_storage_media_storage)
|
||||
#define _uxe_host_class_storage_media_unlock(m) (((m) != UX_NULL) ? _uxe_host_class_storage_unlock((m) -> ux_host_class_storage_media_storage) : UX_INVALID_PARAMETER)
|
||||
#endif
|
||||
#define _ux_host_class_storage_max_lun(s) ((s) -> ux_host_class_storage_max_lun)
|
||||
#define _ux_host_class_storage_lun(s) ((s) -> ux_host_class_storage_lun)
|
||||
#define _ux_host_class_storage_lun_select(s,l) do { (s) -> ux_host_class_storage_lun = (l); } while(0)
|
||||
#define _uxe_host_class_storage_lun_select(s,l) do { if ((s) != UX_NULL) (s) -> ux_host_class_storage_lun = (l); } while(0)
|
||||
#define _ux_host_class_storage_sense_status(s) ((s) -> ux_host_class_storage_sense_code)
|
||||
|
||||
UINT _ux_host_class_storage_media_check(UX_HOST_CLASS_STORAGE *storage);
|
||||
@ -673,10 +690,42 @@ UINT _ux_host_class_storage_check_run(UX_HOST_CLASS_STORAGE *storage);
|
||||
UINT _ux_host_class_storage_read_write_run(UX_HOST_CLASS_STORAGE *storage,
|
||||
ULONG read_write, ULONG sector_start, ULONG sector_count, UCHAR *data_pointer);
|
||||
|
||||
|
||||
UINT _uxe_host_class_storage_media_read(UX_HOST_CLASS_STORAGE *storage, ULONG sector_start,
|
||||
ULONG sector_count, UCHAR *data_pointer);
|
||||
UINT _uxe_host_class_storage_media_write(UX_HOST_CLASS_STORAGE *storage, ULONG sector_start,
|
||||
ULONG sector_count, UCHAR *data_pointer);
|
||||
|
||||
UINT _uxe_host_class_storage_media_check(UX_HOST_CLASS_STORAGE *storage);
|
||||
|
||||
UINT _uxe_host_class_storage_media_get(UX_HOST_CLASS_STORAGE *storage, ULONG media_lun, UX_HOST_CLASS_STORAGE_MEDIA **storage_media);
|
||||
UINT _uxe_host_class_storage_media_lock(UX_HOST_CLASS_STORAGE_MEDIA *storage_media, ULONG wait);
|
||||
|
||||
|
||||
/* Define Storage Class API prototypes. */
|
||||
|
||||
#define ux_host_class_storage_entry _ux_host_class_storage_entry
|
||||
|
||||
#define ux_host_class_storage_sense_status _ux_host_class_storage_sense_status
|
||||
|
||||
#if defined(UX_HOST_CLASS_STORAGE_ENABLE_ERROR_CHECKING)
|
||||
|
||||
#define ux_host_class_storage_lock _uxe_host_class_storage_lock
|
||||
#define ux_host_class_storage_unlock _uxe_host_class_storage_unlock
|
||||
#define ux_host_class_storage_lun_select _uxe_host_class_storage_lun_select
|
||||
|
||||
#define ux_host_class_storage_media_read _uxe_host_class_storage_media_read
|
||||
#define ux_host_class_storage_media_write _uxe_host_class_storage_media_write
|
||||
|
||||
#define ux_host_class_storage_media_get _uxe_host_class_storage_media_get
|
||||
#define ux_host_class_storage_media_lock _uxe_host_class_storage_media_lock
|
||||
#define ux_host_class_storage_media_unlock _uxe_host_class_storage_media_unlock
|
||||
|
||||
#define ux_host_class_storage_media_check _uxe_host_class_storage_media_check
|
||||
|
||||
|
||||
#else
|
||||
|
||||
#define ux_host_class_storage_lock _ux_host_class_storage_lock
|
||||
#define ux_host_class_storage_unlock _ux_host_class_storage_unlock
|
||||
#define ux_host_class_storage_lun_select _ux_host_class_storage_lun_select
|
||||
@ -690,7 +739,8 @@ UINT _ux_host_class_storage_read_write_run(UX_HOST_CLASS_STORAGE *storage,
|
||||
|
||||
#define ux_host_class_storage_media_check _ux_host_class_storage_media_check
|
||||
|
||||
#define ux_host_class_storage_sense_status _ux_host_class_storage_sense_status
|
||||
#endif
|
||||
|
||||
|
||||
/* Determine if a C++ compiler is being used. If so, complete the standard
|
||||
C conditional started above. */
|
||||
|
@ -12,8 +12,8 @@
|
||||
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/** */
|
||||
/** USBX Component */
|
||||
/** */
|
||||
/** USBX Component */
|
||||
/** */
|
||||
/** Video Class */
|
||||
/** */
|
||||
@ -21,25 +21,25 @@
|
||||
/**************************************************************************/
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* COMPONENT DEFINITION RELEASE */
|
||||
/* */
|
||||
/* ux_host_class_video.h PORTABLE C */
|
||||
/* 6.1.8 */
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* COMPONENT DEFINITION RELEASE */
|
||||
/* */
|
||||
/* ux_host_class_video.h PORTABLE C */
|
||||
/* 6.x */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Chaoqiong Xiao, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* */
|
||||
/* This file contains all the header and extern functions used by the */
|
||||
/* USBX video class. */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* USBX video class. */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
|
||||
/* 09-30-2020 Chaoqiong Xiao Modified comment(s), */
|
||||
/* added new definition, field */
|
||||
@ -56,35 +56,44 @@
|
||||
/* according to UVC 1.5 Class */
|
||||
/* specification, */
|
||||
/* resulting in version 6.1.8 */
|
||||
/* */
|
||||
/* xx-xx-xxxx Yajun xia Modified comment(s), */
|
||||
/* added error checks support, */
|
||||
/* resulting in version 6.x */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef UX_HOST_CLASS_VIDEO_H
|
||||
#define UX_HOST_CLASS_VIDEO_H
|
||||
|
||||
/* Determine if a C++ compiler is being used. If so, ensure that standard
|
||||
C is used to process the API information. */
|
||||
/* Determine if a C++ compiler is being used. If so, ensure that standard
|
||||
C is used to process the API information. */
|
||||
|
||||
#ifdef __cplusplus
|
||||
#ifdef __cplusplus
|
||||
|
||||
/* Yes, C++ compiler is present. Use standard C. */
|
||||
extern "C" {
|
||||
/* Yes, C++ compiler is present. Use standard C. */
|
||||
extern "C" {
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Internal option: enable the basic USBX error checking. This define is typically used
|
||||
while debugging application. */
|
||||
#if defined(UX_ENABLE_ERROR_CHECKING) && !defined(UX_HOST_CLASS_VIDEO_ENABLE_ERROR_CHECKING)
|
||||
#define UX_HOST_CLASS_VIDEO_ENABLE_ERROR_CHECKING
|
||||
#endif
|
||||
|
||||
/* Define external static data. */
|
||||
extern UCHAR _ux_system_class_video_interface_descriptor_structure[];
|
||||
extern UCHAR _ux_system_class_video_input_terminal_descriptor_structure[];
|
||||
extern UCHAR _ux_system_class_video_input_header_descriptor_structure[];
|
||||
extern UCHAR _ux_system_class_video_input_terminal_descriptor_structure[];
|
||||
extern UCHAR _ux_system_class_video_input_header_descriptor_structure[];
|
||||
extern UCHAR _ux_system_class_video_processing_unit_descriptor_structure[];
|
||||
extern UCHAR _ux_system_class_video_streaming_interface_descriptor_structure[];
|
||||
extern UCHAR _ux_system_class_video_streaming_endpoint_descriptor_structure[];
|
||||
extern UCHAR _ux_system_class_video_streaming_endpoint_descriptor_structure[];
|
||||
extern UCHAR _ux_system_class_video_frame_descriptor_structure[];
|
||||
|
||||
extern UCHAR _ux_system_host_class_video_name[];
|
||||
extern UCHAR _ux_system_host_class_video_name[];
|
||||
|
||||
/* Define Video Class IOCTL constants. */
|
||||
|
||||
|
||||
#define UX_HOST_CLASS_VIDEO_IOCTL_GET_INPUT_TERMINAL 0x01
|
||||
#define UX_HOST_CLASS_VIDEO_IOCTL_GET_FORMAT_NUMBER 0x02
|
||||
#define UX_HOST_CLASS_VIDEO_IOCTL_GET_FORMAT_DATA 0x03
|
||||
@ -94,11 +103,11 @@ extern UCHAR _ux_system_host_class_video_name[];
|
||||
#define UX_HOST_CLASS_VIDEO_IOCTL_CHANNEL_STOP 0x07
|
||||
#define UX_HOST_CLASS_VIDEO_IOCTL_GET_FRAME_INTERVAL 0x08
|
||||
|
||||
#define UX_HOST_CLASS_VIDEO_IOCTL_ABORT_IN_PIPE 0x80
|
||||
#define UX_HOST_CLASS_VIDEO_IOCTL_ABORT_IN_PIPE 0x80
|
||||
|
||||
/* Define Video Class main constants. */
|
||||
|
||||
#define UX_HOST_CLASS_VIDEO_CLASS_TRANSFER_TIMEOUT 30
|
||||
#define UX_HOST_CLASS_VIDEO_CLASS_TRANSFER_TIMEOUT 30
|
||||
#define UX_HOST_CLASS_VIDEO_CLASS 0x0e
|
||||
#define UX_HOST_CLASS_VIDEO_SUBCLASS_UNDEFINED 0
|
||||
#define UX_HOST_CLASS_VIDEO_SUBCLASS_CONTROL 1
|
||||
@ -110,7 +119,7 @@ extern UCHAR _ux_system_host_class_video_name[];
|
||||
|
||||
#define UX_HOST_CLASS_VIDEO_CS_UNDEFINED 0x20
|
||||
#define UX_HOST_CLASS_VIDEO_CS_DEVICE 0x21
|
||||
#define UX_HOST_CLASS_VIDEO_CS_CONFIGURATION 0x22
|
||||
#define UX_HOST_CLASS_VIDEO_CS_CONFIGURATION 0x22
|
||||
#define UX_HOST_CLASS_VIDEO_CS_STRING 0x23
|
||||
#define UX_HOST_CLASS_VIDEO_CS_INTERFACE 0x24
|
||||
#define UX_HOST_CLASS_VIDEO_CS_ENDPOINT 0x25
|
||||
@ -252,7 +261,7 @@ extern UCHAR _ux_system_host_class_video_name[];
|
||||
#define UX_HOST_CLASS_VIDEO_PROCESSING_UNIT_DESCRIPTOR_LENGTH 9
|
||||
|
||||
#define UX_HOST_CLASS_VIDEO_STREAMING_INTERFACE_DESCRIPTOR_ENTRIES 6
|
||||
#define UX_HOST_CLASS_VIDEO_STREAMING_INTERFACE_DESCRIPTOR_LENGTH 6
|
||||
#define UX_HOST_CLASS_VIDEO_STREAMING_INTERFACE_DESCRIPTOR_LENGTH 6
|
||||
|
||||
#define UX_HOST_CLASS_VIDEO_STREAMING_ENDPOINT_DESCRIPTOR_ENTRIES 6
|
||||
#define UX_HOST_CLASS_VIDEO_STREAMING_ENDPOINT_DESCRIPTOR_LENGTH 6
|
||||
@ -500,7 +509,7 @@ typedef struct UX_HOST_CLASS_VIDEO_PROCESSING_UNIT_DESCRIPTOR_STRUCT
|
||||
typedef struct UX_HOST_CLASS_VIDEO_STRUCT
|
||||
{
|
||||
|
||||
struct UX_HOST_CLASS_VIDEO_STRUCT
|
||||
struct UX_HOST_CLASS_VIDEO_STRUCT
|
||||
*ux_host_class_video_next_instance;
|
||||
UX_HOST_CLASS *ux_host_class_video_class;
|
||||
UX_DEVICE *ux_host_class_video_device;
|
||||
@ -547,7 +556,7 @@ typedef struct UX_HOST_CLASS_VIDEO_TRANSFER_REQUEST_STRUCT
|
||||
UX_SEMAPHORE ux_host_class_video_transfer_request_semaphore;
|
||||
VOID *ux_host_class_video_transfer_request_class_instance;
|
||||
UINT ux_host_class_video_transfer_request_completion_code;
|
||||
struct UX_HOST_CLASS_VIDEO_TRANSFER_REQUEST_STRUCT
|
||||
struct UX_HOST_CLASS_VIDEO_TRANSFER_REQUEST_STRUCT
|
||||
*ux_host_class_video_transfer_request_next_video_transfer_request;
|
||||
UX_TRANSFER ux_host_class_video_transfer_request;
|
||||
} UX_HOST_CLASS_VIDEO_TRANSFER_REQUEST;
|
||||
@ -669,7 +678,48 @@ UINT _ux_host_class_video_control_request(UX_HOST_CLASS_VIDEO *video,
|
||||
UINT entity_id, UINT control_selector,
|
||||
UCHAR *parameter, UINT parameter_size);
|
||||
|
||||
UINT _uxe_host_class_video_control_get(UX_HOST_CLASS_VIDEO *video, UX_HOST_CLASS_VIDEO_CONTROL *video_control);
|
||||
UINT _uxe_host_class_video_control_value_get(UX_HOST_CLASS_VIDEO *video, UX_HOST_CLASS_VIDEO_CONTROL *video_control);
|
||||
UINT _uxe_host_class_video_control_value_set(UX_HOST_CLASS_VIDEO *video, UX_HOST_CLASS_VIDEO_CONTROL *video_control);
|
||||
UINT _uxe_host_class_video_read(UX_HOST_CLASS_VIDEO *video, UX_HOST_CLASS_VIDEO_TRANSFER_REQUEST *video_transfer_request);
|
||||
UINT _uxe_host_class_video_ioctl(UX_HOST_CLASS_VIDEO *video, ULONG ioctl_function, VOID *parameter);
|
||||
UINT _uxe_host_class_video_start(UX_HOST_CLASS_VIDEO *video);
|
||||
UINT _uxe_host_class_video_stop(UX_HOST_CLASS_VIDEO *video);
|
||||
UINT _uxe_host_class_video_frame_parameters_set(UX_HOST_CLASS_VIDEO *video, ULONG frame_format, ULONG width, ULONG height, ULONG frame_interval);
|
||||
ULONG _uxe_host_class_video_max_payload_get(UX_HOST_CLASS_VIDEO *video);
|
||||
UINT _uxe_host_class_video_transfer_buffer_add(UX_HOST_CLASS_VIDEO *video, UCHAR* buffer);
|
||||
UINT _uxe_host_class_video_transfer_buffers_add(UX_HOST_CLASS_VIDEO *video, UCHAR** buffers, ULONG num_buffers);
|
||||
VOID _uxe_host_class_video_transfer_callback_set(UX_HOST_CLASS_VIDEO *video, VOID (*callback_function)(UX_TRANSFER*));
|
||||
UINT _uxe_host_class_video_entities_parse(UX_HOST_CLASS_VIDEO *video,
|
||||
UINT(*parse_function)(VOID *arg,
|
||||
UCHAR *packed_interface_descriptor,
|
||||
UCHAR *packed_entity_descriptor),
|
||||
VOID* arg);
|
||||
UINT _uxe_host_class_video_control_request(UX_HOST_CLASS_VIDEO *video,
|
||||
UINT request, UCHAR interface_index,
|
||||
UINT entity_id, UINT control_selector,
|
||||
UCHAR *parameter, UINT parameter_size);
|
||||
|
||||
/* Define Video Class API prototypes. */
|
||||
#if defined(UX_HOST_CLASS_VIDEO_ENABLE_ERROR_CHECKING)
|
||||
|
||||
#define ux_host_class_video_entry _ux_host_class_video_entry
|
||||
#define ux_host_class_video_control_get _uxe_host_class_video_control_get
|
||||
#define ux_host_class_video_control_value_get _uxe_host_class_video_control_value_get
|
||||
#define ux_host_class_video_control_value_set _uxe_host_class_video_control_value_set
|
||||
#define ux_host_class_video_read _uxe_host_class_video_read
|
||||
#define ux_host_class_video_ioctl _uxe_host_class_video_ioctl
|
||||
#define ux_host_class_video_start _uxe_host_class_video_start
|
||||
#define ux_host_class_video_stop _uxe_host_class_video_stop
|
||||
#define ux_host_class_video_frame_parameters_set _uxe_host_class_video_frame_parameters_set
|
||||
#define ux_host_class_video_max_payload_get _uxe_host_class_video_max_payload_get
|
||||
#define ux_host_class_video_transfer_buffer_add _uxe_host_class_video_transfer_buffer_add
|
||||
#define ux_host_class_video_transfer_buffers_add _uxe_host_class_video_transfer_buffers_add
|
||||
#define ux_host_class_video_transfer_callback_set _uxe_host_class_video_transfer_callback_set
|
||||
#define ux_host_class_video_entities_parse _uxe_host_class_video_entities_parse
|
||||
#define ux_host_class_video_control_request _uxe_host_class_video_control_request
|
||||
|
||||
#else
|
||||
|
||||
#define ux_host_class_video_entry _ux_host_class_video_entry
|
||||
#define ux_host_class_video_control_get _ux_host_class_video_control_get
|
||||
@ -687,11 +737,13 @@ UINT _ux_host_class_video_control_request(UX_HOST_CLASS_VIDEO *video,
|
||||
#define ux_host_class_video_entities_parse _ux_host_class_video_entities_parse
|
||||
#define ux_host_class_video_control_request _ux_host_class_video_control_request
|
||||
|
||||
/* Determine if a C++ compiler is being used. If so, complete the standard
|
||||
C conditional started above. */
|
||||
#endif
|
||||
|
||||
/* Determine if a C++ compiler is being used. If so, complete the standard
|
||||
C conditional started above. */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -35,7 +35,7 @@
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _ux_host_class_cdc_acm_command PORTABLE C */
|
||||
/* 6.1.10 */
|
||||
/* 6.x */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Chaoqiong Xiao, Microsoft Corporation */
|
||||
@ -70,7 +70,7 @@
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* Storage Class */
|
||||
/* Application */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
@ -82,6 +82,8 @@
|
||||
/* 01-31-2022 Chaoqiong Xiao Modified comment(s), */
|
||||
/* added standalone support, */
|
||||
/* resulting in version 6.1.10 */
|
||||
/* xx-xx-xxxx Yajun xia Modified comment(s), */
|
||||
/* resulting in version 6.x */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _ux_host_class_cdc_acm_command(UX_HOST_CLASS_CDC_ACM *cdc_acm, ULONG command,
|
||||
|
@ -12,8 +12,8 @@
|
||||
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/** */
|
||||
/** USBX Component */
|
||||
/** */
|
||||
/** USBX Component */
|
||||
/** */
|
||||
/** CDC ACM Class */
|
||||
/** */
|
||||
@ -30,49 +30,49 @@
|
||||
#include "ux_host_stack.h"
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _ux_host_class_cdc_acm_ioctl PORTABLE C */
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _ux_host_class_cdc_acm_ioctl PORTABLE C */
|
||||
/* 6.x */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Chaoqiong Xiao, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This function is the ioctl entry point for the application to */
|
||||
/* configure the ACM device. */
|
||||
/* */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* cdc_acm Pointer to CDC ACM class */
|
||||
/* ioctl_function ioctl function */
|
||||
/* parameter pointer to structure */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* Completion Status */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* */
|
||||
/* This function is the ioctl entry point for the application to */
|
||||
/* configure the ACM device. */
|
||||
/* */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* cdc_acm Pointer to CDC ACM class */
|
||||
/* ioctl_function ioctl function */
|
||||
/* parameter pointer to structure */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* Completion Status */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _ux_host_stack_endpoint_transfer_abort */
|
||||
/* Abort transfer */
|
||||
/* _ux_host_class_cdc_acm_command Send command to acm device */
|
||||
/* _ux_host_class_cdc_acm_command Send command to acm device */
|
||||
/* _ux_utility_memory_allocate Allocate memory */
|
||||
/* _ux_utility_memory_free Free memory */
|
||||
/* _ux_utility_long_put Put 32-bit value */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* Storage Class */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* Application */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
|
||||
/* 09-30-2020 Chaoqiong Xiao Modified comment(s), */
|
||||
/* resulting in version 6.1 */
|
||||
@ -99,9 +99,9 @@ UX_TRANSFER *transfer;
|
||||
#endif
|
||||
|
||||
/* Ensure the instance is valid. */
|
||||
if ((cdc_acm -> ux_host_class_cdc_acm_state != UX_HOST_CLASS_INSTANCE_LIVE) &&
|
||||
if ((cdc_acm -> ux_host_class_cdc_acm_state != UX_HOST_CLASS_INSTANCE_LIVE) &&
|
||||
(cdc_acm -> ux_host_class_cdc_acm_state != UX_HOST_CLASS_INSTANCE_MOUNTING))
|
||||
{
|
||||
{
|
||||
|
||||
/* If trace is enabled, insert this event into the trace buffer. */
|
||||
UX_TRACE_IN_LINE_INSERT(UX_TRACE_ERROR, UX_HOST_CLASS_INSTANCE_UNKNOWN, cdc_acm, 0, 0, UX_TRACE_ERRORS, 0, 0)
|
||||
@ -114,97 +114,97 @@ UX_TRANSFER *transfer;
|
||||
{
|
||||
|
||||
case UX_HOST_CLASS_CDC_ACM_IOCTL_SET_LINE_CODING:
|
||||
|
||||
|
||||
/* If trace is enabled, insert this event into the trace buffer. */
|
||||
UX_TRACE_IN_LINE_INSERT(UX_TRACE_HOST_CLASS_CDC_ACM_IOCTL_SET_LINE_CODING, cdc_acm, parameter, 0, 0, UX_TRACE_HOST_CLASS_EVENTS, 0, 0)
|
||||
|
||||
|
||||
/* Allocate some cache safe memory for the control command. */
|
||||
data_buffer = _ux_utility_memory_allocate(UX_SAFE_ALIGN, UX_CACHE_SAFE_MEMORY, UX_HOST_CLASS_CDC_ACM_LINE_CODING_LENGTH);
|
||||
|
||||
|
||||
/* Check if error. Return with error if no memory could be allocated. */
|
||||
if (data_buffer == UX_NULL)
|
||||
|
||||
|
||||
/* Do not proceed. Set error code. */
|
||||
status = UX_MEMORY_INSUFFICIENT;
|
||||
else
|
||||
{
|
||||
|
||||
|
||||
/* Build the buffer from the calling parameter. Cast the calling parameter. */
|
||||
line_coding = (UX_HOST_CLASS_CDC_ACM_LINE_CODING *) parameter;
|
||||
|
||||
|
||||
/* Put the data rate. */
|
||||
_ux_utility_long_put(data_buffer + UX_HOST_CLASS_CDC_ACM_LINE_CODING_RATE,
|
||||
_ux_utility_long_put(data_buffer + UX_HOST_CLASS_CDC_ACM_LINE_CODING_RATE,
|
||||
line_coding -> ux_host_class_cdc_acm_line_coding_dter);
|
||||
|
||||
|
||||
/* Then the stop bit. */
|
||||
*(data_buffer + UX_HOST_CLASS_CDC_ACM_LINE_CODING_STOP_BIT) =
|
||||
*(data_buffer + UX_HOST_CLASS_CDC_ACM_LINE_CODING_STOP_BIT) =
|
||||
(UCHAR) line_coding -> ux_host_class_cdc_acm_line_coding_stop_bit;
|
||||
|
||||
|
||||
/* Then the parity. */
|
||||
*(data_buffer + UX_HOST_CLASS_CDC_ACM_LINE_CODING_PARITY) =
|
||||
*(data_buffer + UX_HOST_CLASS_CDC_ACM_LINE_CODING_PARITY) =
|
||||
(UCHAR) line_coding -> ux_host_class_cdc_acm_line_coding_parity;
|
||||
|
||||
|
||||
/* Finally the data bits. */
|
||||
*(data_buffer + UX_HOST_CLASS_CDC_ACM_LINE_CODING_DATA_BIT) =
|
||||
*(data_buffer + UX_HOST_CLASS_CDC_ACM_LINE_CODING_DATA_BIT) =
|
||||
(UCHAR) line_coding -> ux_host_class_cdc_acm_line_coding_data_bits;
|
||||
|
||||
/* Send the command to the device. */
|
||||
status = _ux_host_class_cdc_acm_command(cdc_acm, UX_HOST_CLASS_CDC_ACM_REQ_SET_LINE_CODING,
|
||||
0, data_buffer, UX_HOST_CLASS_CDC_ACM_LINE_CODING_LENGTH);
|
||||
|
||||
|
||||
/* We free the resources allocated no matter what. */
|
||||
_ux_utility_memory_free(data_buffer);
|
||||
}
|
||||
_ux_utility_memory_free(data_buffer);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case UX_HOST_CLASS_CDC_ACM_IOCTL_GET_LINE_CODING:
|
||||
|
||||
|
||||
/* If trace is enabled, insert this event into the trace buffer. */
|
||||
UX_TRACE_IN_LINE_INSERT(UX_TRACE_HOST_CLASS_CDC_ACM_IOCTL_GET_LINE_CODING, cdc_acm, parameter, 0, 0, UX_TRACE_HOST_CLASS_EVENTS, 0, 0)
|
||||
|
||||
|
||||
/* Allocate some cache safe memory for the control command. */
|
||||
data_buffer = _ux_utility_memory_allocate(UX_SAFE_ALIGN, UX_CACHE_SAFE_MEMORY, UX_HOST_CLASS_CDC_ACM_LINE_CODING_LENGTH);
|
||||
|
||||
|
||||
/* Check if error. Return with error if no memory could be allocated. */
|
||||
if (data_buffer == UX_NULL)
|
||||
|
||||
|
||||
/* Do not proceed. Set error code. */
|
||||
status = UX_MEMORY_INSUFFICIENT;
|
||||
else
|
||||
{
|
||||
|
||||
|
||||
/* Send the command to the device. */
|
||||
status = _ux_host_class_cdc_acm_command(cdc_acm, UX_HOST_CLASS_CDC_ACM_REQ_GET_LINE_CODING,
|
||||
0, data_buffer, UX_HOST_CLASS_CDC_ACM_LINE_CODING_LENGTH);
|
||||
|
||||
|
||||
/* Fill in the calling buffer if the result is successful. */
|
||||
if (status == UX_SUCCESS)
|
||||
{
|
||||
|
||||
|
||||
/* Build the buffer from the calling parameter. Cast the calling parameter. */
|
||||
line_coding = (UX_HOST_CLASS_CDC_ACM_LINE_CODING *) parameter;
|
||||
|
||||
|
||||
/* Get the data rate. */
|
||||
line_coding -> ux_host_class_cdc_acm_line_coding_dter = _ux_utility_long_get(data_buffer + UX_HOST_CLASS_CDC_ACM_LINE_CODING_RATE);
|
||||
|
||||
|
||||
/* Then the stop bit. */
|
||||
line_coding -> ux_host_class_cdc_acm_line_coding_stop_bit =
|
||||
line_coding -> ux_host_class_cdc_acm_line_coding_stop_bit =
|
||||
(ULONG) *(data_buffer + UX_HOST_CLASS_CDC_ACM_LINE_CODING_STOP_BIT);
|
||||
|
||||
|
||||
/* Then the parity. */
|
||||
line_coding -> ux_host_class_cdc_acm_line_coding_parity =
|
||||
line_coding -> ux_host_class_cdc_acm_line_coding_parity =
|
||||
(ULONG) *(data_buffer + UX_HOST_CLASS_CDC_ACM_LINE_CODING_PARITY);
|
||||
|
||||
|
||||
/* Finally the data bits. */
|
||||
line_coding -> ux_host_class_cdc_acm_line_coding_data_bits =
|
||||
(ULONG) *(data_buffer + UX_HOST_CLASS_CDC_ACM_LINE_CODING_DATA_BIT);
|
||||
(ULONG) *(data_buffer + UX_HOST_CLASS_CDC_ACM_LINE_CODING_DATA_BIT);
|
||||
}
|
||||
|
||||
/* We free the resources allocated no matter what. */
|
||||
_ux_utility_memory_free(data_buffer);
|
||||
}
|
||||
_ux_utility_memory_free(data_buffer);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case UX_HOST_CLASS_CDC_ACM_IOCTL_SET_LINE_STATE:
|
||||
|
||||
/* If trace is enabled, insert this event into the trace buffer. */
|
||||
@ -212,15 +212,15 @@ UX_TRANSFER *transfer;
|
||||
|
||||
/* Cast the calling parameter. */
|
||||
line_state = (UX_HOST_CLASS_CDC_ACM_LINE_STATE *) parameter;
|
||||
|
||||
|
||||
/* Build the value field. */
|
||||
value = (line_state -> ux_host_class_cdc_acm_line_state_dtr |
|
||||
value = (line_state -> ux_host_class_cdc_acm_line_state_dtr |
|
||||
(line_state -> ux_host_class_cdc_acm_line_state_rts << 1));
|
||||
|
||||
|
||||
/* Send the command to the device. */
|
||||
status = _ux_host_class_cdc_acm_command(cdc_acm, UX_HOST_CLASS_CDC_ACM_REQ_SET_LINE_STATE,
|
||||
value, UX_NULL,0);
|
||||
break;
|
||||
break;
|
||||
|
||||
case UX_HOST_CLASS_CDC_ACM_IOCTL_SEND_BREAK :
|
||||
|
||||
@ -229,11 +229,11 @@ UX_TRANSFER *transfer;
|
||||
|
||||
/* Build the value field. */
|
||||
value = *((ULONG *) parameter);
|
||||
|
||||
|
||||
/* Send the command to the device. */
|
||||
status = _ux_host_class_cdc_acm_command(cdc_acm, UX_HOST_CLASS_CDC_ACM_REQ_SEND_BREAK,
|
||||
value, UX_NULL,0);
|
||||
break;
|
||||
break;
|
||||
|
||||
|
||||
|
||||
@ -326,7 +326,7 @@ UX_TRANSFER *transfer;
|
||||
break;
|
||||
#endif
|
||||
|
||||
default:
|
||||
default:
|
||||
|
||||
/* Error trap. */
|
||||
_ux_system_error_handler(UX_SYSTEM_LEVEL_THREAD, UX_SYSTEM_CONTEXT_CLASS, UX_FUNCTION_NOT_SUPPORTED);
|
||||
@ -336,7 +336,7 @@ UX_TRANSFER *transfer;
|
||||
|
||||
/* Function not supported. Return an error. */
|
||||
status = UX_FUNCTION_NOT_SUPPORTED;
|
||||
}
|
||||
}
|
||||
|
||||
/* Return status to caller. */
|
||||
return(status);
|
||||
|
@ -12,8 +12,8 @@
|
||||
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/** */
|
||||
/** USBX Component */
|
||||
/** */
|
||||
/** USBX Component */
|
||||
/** */
|
||||
/** Generic Serial Host module class */
|
||||
/** */
|
||||
@ -30,58 +30,60 @@
|
||||
#include "ux_host_stack.h"
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _ux_host_class_gser_command PORTABLE C */
|
||||
/* 6.1.10 */
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _ux_host_class_gser_command PORTABLE C */
|
||||
/* 6.x */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Chaoqiong Xiao, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This function will send a command to the ACM device. The command */
|
||||
/* can be one of the following : */
|
||||
/* SET_CONTROL */
|
||||
/* SET_LINE */
|
||||
/* SEND_BREAK */
|
||||
/* */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* acm Pointer to acm class */
|
||||
/* command command value */
|
||||
/* value value to be sent in the */
|
||||
/* command request */
|
||||
/* data_buffer buffer to be sent */
|
||||
/* data_length length of the buffer to send */
|
||||
/* */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* Completion Status */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _ux_host_stack_transfer_request Process transfer request */
|
||||
/* */
|
||||
/* This function will send a command to the ACM device. The command */
|
||||
/* can be one of the following : */
|
||||
/* SET_CONTROL */
|
||||
/* SET_LINE */
|
||||
/* SEND_BREAK */
|
||||
/* */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* acm Pointer to acm class */
|
||||
/* command command value */
|
||||
/* value value to be sent in the */
|
||||
/* command request */
|
||||
/* data_buffer buffer to be sent */
|
||||
/* data_length length of the buffer to send */
|
||||
/* */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* Completion Status */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _ux_host_stack_transfer_request Process transfer request */
|
||||
/* _ux_host_semaphore_get Get semaphore */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* Storage Class */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* Application */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
|
||||
/* 09-30-2020 Chaoqiong Xiao Modified comment(s), */
|
||||
/* resulting in version 6.1 */
|
||||
/* 01-31-2022 Chaoqiong Xiao Modified comment(s), */
|
||||
/* refined macros names, */
|
||||
/* resulting in version 6.1.10 */
|
||||
/* xx-xx-xxxx Yajun xia Modified comment(s), */
|
||||
/* resulting in version 6.x */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _ux_host_class_gser_command(UX_HOST_CLASS_GSER *gser, ULONG interface_index, ULONG command,
|
||||
@ -93,7 +95,7 @@ UX_TRANSFER *transfer_request;
|
||||
UINT status;
|
||||
ULONG request_direction;
|
||||
|
||||
|
||||
|
||||
/* We need to get the default control endpoint transfer request pointer. */
|
||||
control_endpoint = &gser -> ux_host_class_gser_device -> ux_device_control_endpoint;
|
||||
transfer_request = &control_endpoint -> ux_endpoint_transfer_request;
|
||||
@ -101,7 +103,7 @@ ULONG request_direction;
|
||||
/* Check the direction of the command. */
|
||||
switch (command)
|
||||
{
|
||||
|
||||
|
||||
case UX_HOST_CLASS_GSER_REQ_SEND_ENCAPSULATED_COMMAND :
|
||||
case UX_HOST_CLASS_GSER_REQ_SET_COMM_FEATURE :
|
||||
case UX_HOST_CLASS_GSER_REQ_CLEAR_COMM_FEATURE :
|
||||
@ -117,7 +119,7 @@ ULONG request_direction;
|
||||
case UX_HOST_CLASS_GSER_REQ_SET_RINGER_PARMS :
|
||||
case UX_HOST_CLASS_GSER_REQ_SET_OPERATION_PARMS :
|
||||
case UX_HOST_CLASS_GSER_REQ_SET_LINE_PARMS :
|
||||
|
||||
|
||||
/* Direction is out */
|
||||
request_direction = UX_REQUEST_OUT;
|
||||
break;
|
||||
@ -136,21 +138,21 @@ ULONG request_direction;
|
||||
|
||||
|
||||
default :
|
||||
|
||||
|
||||
return(UX_ERROR);
|
||||
|
||||
}
|
||||
|
||||
/* Protect the control endpoint semaphore here. It will be unprotected in the
|
||||
/* Protect the control endpoint semaphore here. It will be unprotected in the
|
||||
transfer request function. */
|
||||
status = _ux_host_semaphore_get(&gser -> ux_host_class_gser_device -> ux_device_protection_semaphore, UX_WAIT_FOREVER);
|
||||
|
||||
/* Check for status. */
|
||||
if (status != UX_SUCCESS)
|
||||
|
||||
|
||||
/* Something went wrong. */
|
||||
return(status);
|
||||
|
||||
|
||||
/* Create a transfer_request for the request. */
|
||||
transfer_request -> ux_transfer_request_data_pointer = data_buffer;
|
||||
transfer_request -> ux_transfer_request_requested_length = data_length;
|
||||
|
@ -12,8 +12,8 @@
|
||||
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/** */
|
||||
/** USBX Component */
|
||||
/** */
|
||||
/** USBX Component */
|
||||
/** */
|
||||
/** Generic Serial Host module class */
|
||||
/** */
|
||||
@ -30,52 +30,54 @@
|
||||
#include "ux_host_stack.h"
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _ux_host_class_gser_ioctl PORTABLE C */
|
||||
/* 6.1 */
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _ux_host_class_gser_ioctl PORTABLE C */
|
||||
/* 6.x */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Chaoqiong Xiao, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This function is the ioctl entry point for the application to */
|
||||
/* configure the ACM device. */
|
||||
/* */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* gser Pointer to gser class */
|
||||
/* ioctl_function ioctl function */
|
||||
/* parameter pointer to structure */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* Completion Status */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _ux_host_class_gser_command Send command to acm device */
|
||||
/* */
|
||||
/* This function is the ioctl entry point for the application to */
|
||||
/* configure the ACM device. */
|
||||
/* */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* gser Pointer to gser class */
|
||||
/* ioctl_function ioctl function */
|
||||
/* parameter pointer to structure */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* Completion Status */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _ux_host_class_gser_command Send command to acm device */
|
||||
/* _ux_host_stack_endpoint_transfer_abort */
|
||||
/* Abort transfer */
|
||||
/* _ux_utility_memory_allocate Allocate memory */
|
||||
/* _ux_utility_memory_free Free memory */
|
||||
/* _ux_utility_long_put Put 32-bit value */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* Storage Class */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* Application */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
|
||||
/* 09-30-2020 Chaoqiong Xiao Modified comment(s), */
|
||||
/* resulting in version 6.1 */
|
||||
/* xx-xx-xxxx Yajun xia Modified comment(s), */
|
||||
/* resulting in version 6.x */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _ux_host_class_gser_ioctl(UX_HOST_CLASS_GSER *gser, ULONG interface_index, ULONG ioctl_function,
|
||||
@ -91,7 +93,7 @@ ULONG value;
|
||||
|
||||
/* Ensure the instance is valid. */
|
||||
if (gser -> ux_host_class_gser_state != UX_HOST_CLASS_INSTANCE_LIVE)
|
||||
{
|
||||
{
|
||||
|
||||
/* If trace is enabled, insert this event into the trace buffer. */
|
||||
UX_TRACE_IN_LINE_INSERT(UX_TRACE_ERROR, UX_HOST_CLASS_INSTANCE_UNKNOWN, gser, 0, 0, UX_TRACE_ERRORS, 0, 0)
|
||||
@ -104,97 +106,97 @@ ULONG value;
|
||||
{
|
||||
|
||||
case UX_HOST_CLASS_GSER_IOCTL_SET_LINE_CODING:
|
||||
|
||||
|
||||
/* If trace is enabled, insert this event into the trace buffer. */
|
||||
UX_TRACE_IN_LINE_INSERT(UX_TRACE_HOST_CLASS_GSER_IOCTL_SET_LINE_CODING, gser, parameter, 0, 0, UX_TRACE_HOST_CLASS_EVENTS, 0, 0)
|
||||
|
||||
|
||||
/* Allocate some cache safe memory for the control command. */
|
||||
data_buffer = _ux_utility_memory_allocate(UX_SAFE_ALIGN, UX_CACHE_SAFE_MEMORY, UX_HOST_CLASS_GSER_LINE_CODING_LENGTH);
|
||||
|
||||
|
||||
/* Check if error. Return with error if no memory could be allocated. */
|
||||
if (data_buffer == UX_NULL)
|
||||
|
||||
|
||||
/* Do not proceed. Set error code. */
|
||||
status = UX_MEMORY_INSUFFICIENT;
|
||||
else
|
||||
{
|
||||
|
||||
|
||||
/* Build the buffer from the calling parameter. Cast the calling parameter. */
|
||||
line_coding = (UX_HOST_CLASS_GSER_LINE_CODING *) parameter;
|
||||
|
||||
|
||||
/* Put the data rate. */
|
||||
_ux_utility_long_put(data_buffer + UX_HOST_CLASS_GSER_LINE_CODING_RATE,
|
||||
_ux_utility_long_put(data_buffer + UX_HOST_CLASS_GSER_LINE_CODING_RATE,
|
||||
line_coding -> ux_host_class_gser_line_coding_dter);
|
||||
|
||||
|
||||
/* Then the stop bit. */
|
||||
*(data_buffer + UX_HOST_CLASS_GSER_LINE_CODING_STOP_BIT) =
|
||||
*(data_buffer + UX_HOST_CLASS_GSER_LINE_CODING_STOP_BIT) =
|
||||
(UCHAR) line_coding -> ux_host_class_gser_line_coding_stop_bit;
|
||||
|
||||
|
||||
/* Then the parity. */
|
||||
*(data_buffer + UX_HOST_CLASS_GSER_LINE_CODING_PARITY) =
|
||||
*(data_buffer + UX_HOST_CLASS_GSER_LINE_CODING_PARITY) =
|
||||
(UCHAR) line_coding -> ux_host_class_gser_line_coding_parity;
|
||||
|
||||
|
||||
/* Finally the data bits. */
|
||||
*(data_buffer + UX_HOST_CLASS_GSER_LINE_CODING_DATA_BIT) =
|
||||
*(data_buffer + UX_HOST_CLASS_GSER_LINE_CODING_DATA_BIT) =
|
||||
(UCHAR) line_coding -> ux_host_class_gser_line_coding_data_bits;
|
||||
|
||||
/* Send the command to the device. */
|
||||
status = _ux_host_class_gser_command(gser, interface_index, UX_HOST_CLASS_GSER_REQ_SET_LINE_CODING,
|
||||
0, data_buffer, UX_HOST_CLASS_GSER_LINE_CODING_LENGTH);
|
||||
|
||||
|
||||
/* We free the resources allocated no matter what. */
|
||||
_ux_utility_memory_free(data_buffer);
|
||||
}
|
||||
_ux_utility_memory_free(data_buffer);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case UX_HOST_CLASS_GSER_IOCTL_GET_LINE_CODING:
|
||||
|
||||
|
||||
/* If trace is enabled, insert this event into the trace buffer. */
|
||||
UX_TRACE_IN_LINE_INSERT(UX_TRACE_HOST_CLASS_GSER_IOCTL_GET_LINE_CODING, gser, parameter, 0, 0, UX_TRACE_HOST_CLASS_EVENTS, 0, 0)
|
||||
|
||||
|
||||
/* Allocate some cache safe memory for the control command. */
|
||||
data_buffer = _ux_utility_memory_allocate(UX_SAFE_ALIGN, UX_CACHE_SAFE_MEMORY, UX_HOST_CLASS_GSER_LINE_CODING_LENGTH);
|
||||
|
||||
|
||||
/* Check if error. Return with error if no memory could be allocated. */
|
||||
if (data_buffer == UX_NULL)
|
||||
|
||||
|
||||
/* Do not proceed. Set error code. */
|
||||
status = UX_MEMORY_INSUFFICIENT;
|
||||
else
|
||||
{
|
||||
|
||||
|
||||
/* Send the command to the device. */
|
||||
status = _ux_host_class_gser_command(gser, interface_index, UX_HOST_CLASS_GSER_REQ_GET_LINE_CODING,
|
||||
0, data_buffer, UX_HOST_CLASS_GSER_LINE_CODING_LENGTH);
|
||||
|
||||
|
||||
/* Fill in the calling buffer if the result is successful. */
|
||||
if (status == UX_SUCCESS)
|
||||
{
|
||||
|
||||
|
||||
/* Build the buffer from the calling parameter. Cast the calling parameter. */
|
||||
line_coding = (UX_HOST_CLASS_GSER_LINE_CODING *) parameter;
|
||||
|
||||
|
||||
/* Get the data rate. */
|
||||
line_coding -> ux_host_class_gser_line_coding_dter = _ux_utility_long_get(data_buffer + UX_HOST_CLASS_GSER_LINE_CODING_RATE);
|
||||
|
||||
|
||||
/* Then the stop bit. */
|
||||
line_coding -> ux_host_class_gser_line_coding_stop_bit =
|
||||
line_coding -> ux_host_class_gser_line_coding_stop_bit =
|
||||
(ULONG) *(data_buffer + UX_HOST_CLASS_GSER_LINE_CODING_STOP_BIT);
|
||||
|
||||
|
||||
/* Then the parity. */
|
||||
line_coding -> ux_host_class_gser_line_coding_parity =
|
||||
line_coding -> ux_host_class_gser_line_coding_parity =
|
||||
(ULONG) *(data_buffer + UX_HOST_CLASS_GSER_LINE_CODING_PARITY);
|
||||
|
||||
|
||||
/* Finally the data bits. */
|
||||
line_coding -> ux_host_class_gser_line_coding_data_bits =
|
||||
(ULONG) *(data_buffer + UX_HOST_CLASS_GSER_LINE_CODING_DATA_BIT);
|
||||
(ULONG) *(data_buffer + UX_HOST_CLASS_GSER_LINE_CODING_DATA_BIT);
|
||||
}
|
||||
|
||||
/* We free the resources allocated no matter what. */
|
||||
_ux_utility_memory_free(data_buffer);
|
||||
}
|
||||
_ux_utility_memory_free(data_buffer);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case UX_HOST_CLASS_GSER_IOCTL_SET_LINE_STATE:
|
||||
|
||||
/* If trace is enabled, insert this event into the trace buffer. */
|
||||
@ -202,15 +204,15 @@ ULONG value;
|
||||
|
||||
/* Cast the calling parameter. */
|
||||
line_state = (UX_HOST_CLASS_GSER_LINE_STATE *) parameter;
|
||||
|
||||
|
||||
/* Build the value field. */
|
||||
value = (line_state -> ux_host_class_gser_line_state_dtr |
|
||||
value = (line_state -> ux_host_class_gser_line_state_dtr |
|
||||
(line_state -> ux_host_class_gser_line_state_rts << 1));
|
||||
|
||||
|
||||
/* Send the command to the device. */
|
||||
status = _ux_host_class_gser_command(gser, interface_index, UX_HOST_CLASS_GSER_REQ_SET_LINE_STATE,
|
||||
value, UX_NULL,0);
|
||||
break;
|
||||
break;
|
||||
|
||||
case UX_HOST_CLASS_GSER_IOCTL_SEND_BREAK :
|
||||
|
||||
@ -219,11 +221,11 @@ ULONG value;
|
||||
|
||||
/* Build the value field. */
|
||||
value = *((ULONG *) parameter);
|
||||
|
||||
|
||||
/* Send the command to the device. */
|
||||
status = _ux_host_class_gser_command(gser, interface_index, UX_HOST_CLASS_GSER_REQ_SEND_BREAK,
|
||||
value, UX_NULL,0);
|
||||
break;
|
||||
break;
|
||||
|
||||
case UX_HOST_CLASS_GSER_IOCTL_ABORT_IN_PIPE :
|
||||
|
||||
@ -232,7 +234,7 @@ ULONG value;
|
||||
|
||||
/* We need to abort transactions on the bulk In pipe. */
|
||||
_ux_host_stack_endpoint_transfer_abort(gser -> ux_host_class_gser_interface_array[interface_index].ux_host_class_gser_bulk_in_endpoint);
|
||||
|
||||
|
||||
/* Status is successful. */
|
||||
status = UX_SUCCESS;
|
||||
break;
|
||||
@ -274,14 +276,14 @@ ULONG value;
|
||||
status = UX_SUCCESS;
|
||||
break;
|
||||
|
||||
default:
|
||||
default:
|
||||
|
||||
/* If trace is enabled, insert this event into the trace buffer. */
|
||||
UX_TRACE_IN_LINE_INSERT(UX_TRACE_ERROR, UX_FUNCTION_NOT_SUPPORTED, 0, 0, 0, UX_TRACE_ERRORS, 0, 0)
|
||||
|
||||
/* Function not supported. Return an error. */
|
||||
status = UX_FUNCTION_NOT_SUPPORTED;
|
||||
}
|
||||
}
|
||||
|
||||
/* Return status to caller. */
|
||||
return(status);
|
||||
|
@ -12,8 +12,8 @@
|
||||
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/** */
|
||||
/** USBX Component */
|
||||
/** */
|
||||
/** USBX Component */
|
||||
/** */
|
||||
/** PIMA Class */
|
||||
/** */
|
||||
@ -30,48 +30,48 @@
|
||||
#include "ux_host_stack.h"
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _ux_host_class_pima_command PORTABLE C */
|
||||
/* 6.1.10 */
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _ux_host_class_pima_command PORTABLE C */
|
||||
/* 6.x */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Chaoqiong Xiao, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This function will send a command to the PIMA device. */
|
||||
/* It will perform a data phase if necessary and the status phase. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* pima Pointer to pima class */
|
||||
/* command pointer to command container */
|
||||
/* direction either IN or OUT */
|
||||
/* data_buffer buffer to be sent or received */
|
||||
/* data_length length of the buffer to send */
|
||||
/* or receive */
|
||||
/* max_payload_length maximum payload length */
|
||||
/* */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* Completion Status */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _ux_host_stack_transfer_request Process transfer request */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* Storage Class */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* */
|
||||
/* This function will send a command to the PIMA device. */
|
||||
/* It will perform a data phase if necessary and the status phase. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* pima Pointer to pima class */
|
||||
/* command pointer to command container */
|
||||
/* direction either IN or OUT */
|
||||
/* data_buffer buffer to be sent or received */
|
||||
/* data_length length of the buffer to send */
|
||||
/* or receive */
|
||||
/* max_payload_length maximum payload length */
|
||||
/* */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* Completion Status */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _ux_host_stack_transfer_request Process transfer request */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* Application */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
|
||||
/* 09-30-2020 Chaoqiong Xiao Modified comment(s), */
|
||||
/* prefixed UX to MS_TO_TICK, */
|
||||
@ -79,10 +79,12 @@
|
||||
/* 01-31-2022 Chaoqiong Xiao Modified comment(s), */
|
||||
/* refined macros names, */
|
||||
/* resulting in version 6.1.10 */
|
||||
/* xx-xx-xxxx Yajun xia Modified comment(s), */
|
||||
/* resulting in version 6.x */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _ux_host_class_pima_command(UX_HOST_CLASS_PIMA *pima, UX_HOST_CLASS_PIMA_COMMAND *command,
|
||||
ULONG direction, UCHAR *data_buffer, ULONG data_length,
|
||||
ULONG direction, UCHAR *data_buffer, ULONG data_length,
|
||||
ULONG max_payload_length)
|
||||
{
|
||||
|
||||
@ -93,41 +95,41 @@ UINT status;
|
||||
|
||||
/* We use the Bulk Out pipe for sending data out.. */
|
||||
transfer_request = &pima -> ux_host_class_pima_bulk_out_endpoint -> ux_endpoint_transfer_request;
|
||||
|
||||
|
||||
/* Get the pointer to the ptp payload. */
|
||||
ptp_payload = pima -> ux_host_class_pima_container ;
|
||||
|
||||
|
||||
/* Calculate the requested length for this payload. */
|
||||
requested_length = UX_HOST_CLASS_PIMA_COMMAND_HEADER_SIZE + ((ULONG)sizeof(ULONG) * command -> ux_host_class_pima_command_nb_parameters);
|
||||
|
||||
/* Fill the command container. First the length of the total header and payload. */
|
||||
_ux_utility_long_put(ptp_payload + UX_HOST_CLASS_PIMA_COMMAND_HEADER_LENGTH, requested_length);
|
||||
|
||||
|
||||
/* Then the type of container : a command block here. */
|
||||
_ux_utility_short_put(ptp_payload + UX_HOST_CLASS_PIMA_COMMAND_HEADER_TYPE, UX_HOST_CLASS_PIMA_CT_COMMAND_BLOCK);
|
||||
|
||||
|
||||
/* Now the command code to send. */
|
||||
_ux_utility_short_put(ptp_payload + UX_HOST_CLASS_PIMA_COMMAND_HEADER_CODE, (USHORT)command -> ux_host_class_pima_command_operation_code);
|
||||
|
||||
/* Save the operation code. */
|
||||
pima -> ux_host_class_pima_operation_code = command -> ux_host_class_pima_command_operation_code;
|
||||
pima -> ux_host_class_pima_operation_code = command -> ux_host_class_pima_command_operation_code;
|
||||
|
||||
/* Put the transaction ID. */
|
||||
_ux_utility_long_put(ptp_payload + UX_HOST_CLASS_PIMA_COMMAND_HEADER_TRANSACTION_ID,
|
||||
_ux_utility_long_put(ptp_payload + UX_HOST_CLASS_PIMA_COMMAND_HEADER_TRANSACTION_ID,
|
||||
pima -> ux_host_class_pima_transaction_id++);
|
||||
|
||||
|
||||
/* Then fill in all the parameters. To make it quick we fill the 5 parameters, regardless
|
||||
of the number contained in the command. But when the payload is transmitted, only the
|
||||
of the number contained in the command. But when the payload is transmitted, only the
|
||||
relevant data is sent over the Bulk Out pipe. */
|
||||
_ux_utility_long_put(ptp_payload + UX_HOST_CLASS_PIMA_COMMAND_HEADER_PARAMETER_1,
|
||||
_ux_utility_long_put(ptp_payload + UX_HOST_CLASS_PIMA_COMMAND_HEADER_PARAMETER_1,
|
||||
command -> ux_host_class_pima_command_parameter_1);
|
||||
_ux_utility_long_put(ptp_payload + UX_HOST_CLASS_PIMA_COMMAND_HEADER_PARAMETER_2,
|
||||
_ux_utility_long_put(ptp_payload + UX_HOST_CLASS_PIMA_COMMAND_HEADER_PARAMETER_2,
|
||||
command -> ux_host_class_pima_command_parameter_2);
|
||||
_ux_utility_long_put(ptp_payload + UX_HOST_CLASS_PIMA_COMMAND_HEADER_PARAMETER_3,
|
||||
_ux_utility_long_put(ptp_payload + UX_HOST_CLASS_PIMA_COMMAND_HEADER_PARAMETER_3,
|
||||
command -> ux_host_class_pima_command_parameter_3);
|
||||
_ux_utility_long_put(ptp_payload + UX_HOST_CLASS_PIMA_COMMAND_HEADER_PARAMETER_4,
|
||||
_ux_utility_long_put(ptp_payload + UX_HOST_CLASS_PIMA_COMMAND_HEADER_PARAMETER_4,
|
||||
command -> ux_host_class_pima_command_parameter_4);
|
||||
_ux_utility_long_put(ptp_payload + UX_HOST_CLASS_PIMA_COMMAND_HEADER_PARAMETER_5,
|
||||
_ux_utility_long_put(ptp_payload + UX_HOST_CLASS_PIMA_COMMAND_HEADER_PARAMETER_5,
|
||||
command -> ux_host_class_pima_command_parameter_5);
|
||||
|
||||
/* Initialize the transfer_request. */
|
||||
@ -140,7 +142,7 @@ UINT status;
|
||||
/* If the transfer is successful, we need to wait for the transfer request to be completed. */
|
||||
if (status == UX_SUCCESS)
|
||||
{
|
||||
|
||||
|
||||
/* Wait for the completion of the transfer request. */
|
||||
status = _ux_host_semaphore_get(&transfer_request -> ux_transfer_request_semaphore, UX_MS_TO_TICK(UX_HOST_CLASS_PIMA_CLASS_TRANSFER_TIMEOUT));
|
||||
|
||||
@ -156,19 +158,19 @@ UINT status;
|
||||
|
||||
/* The endpoint was halted by a transfer error and needs to be reset. */
|
||||
_ux_host_stack_endpoint_reset(pima -> ux_host_class_pima_bulk_out_endpoint);
|
||||
|
||||
|
||||
/* Set the completion code. */
|
||||
transfer_request -> ux_transfer_request_completion_code = UX_TRANSFER_TIMEOUT;
|
||||
|
||||
|
||||
/* Error trap. */
|
||||
_ux_system_error_handler(UX_SYSTEM_LEVEL_THREAD, UX_SYSTEM_CONTEXT_CLASS, UX_TRANSFER_TIMEOUT);
|
||||
|
||||
/* If trace is enabled, insert this event into the trace buffer. */
|
||||
UX_TRACE_IN_LINE_INSERT(UX_TRACE_ERROR, UX_TRANSFER_TIMEOUT, transfer_request, 0, 0, UX_TRACE_ERRORS, 0, 0)
|
||||
|
||||
|
||||
/* There was an error, return to the caller. */
|
||||
return(UX_TRANSFER_TIMEOUT);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -181,20 +183,20 @@ UINT status;
|
||||
Partial transfer is not OK. */
|
||||
if (requested_length == transfer_request -> ux_transfer_request_actual_length)
|
||||
{
|
||||
|
||||
|
||||
/* The command was sent successfully. Now examine the direction and check
|
||||
if we need a data phase. If so which direction. */
|
||||
|
||||
switch (direction)
|
||||
{
|
||||
|
||||
|
||||
/* No data phase, proceed to response directly. */
|
||||
case UX_HOST_CLASS_PIMA_DATA_PHASE_NONE :
|
||||
|
||||
/* No error here. */
|
||||
status = UX_SUCCESS;
|
||||
break;
|
||||
|
||||
|
||||
/* We need to transfer data IN. */
|
||||
case UX_HOST_CLASS_PIMA_DATA_PHASE_IN :
|
||||
status = _ux_host_class_pima_read(pima, data_buffer, data_length, max_payload_length);
|
||||
@ -208,7 +210,7 @@ UINT status;
|
||||
|
||||
default :
|
||||
return(UX_ERROR);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/* Analyze the status. If no errors during the data phase proceed to response code. */
|
||||
@ -217,31 +219,31 @@ UINT status;
|
||||
|
||||
/* We use the Bulk In pipe for receiving the response payload .. */
|
||||
transfer_request = &pima -> ux_host_class_pima_bulk_in_endpoint -> ux_endpoint_transfer_request;
|
||||
|
||||
|
||||
/* Get the pointer to the ptp payload. */
|
||||
ptp_payload = pima -> ux_host_class_pima_container ;
|
||||
|
||||
|
||||
/* Calculate the requested length for this payload. */
|
||||
requested_length = UX_HOST_CLASS_PIMA_RESPONSE_HEADER_SIZE;
|
||||
|
||||
|
||||
/* Initialize the transfer_request. */
|
||||
transfer_request -> ux_transfer_request_data_pointer = ptp_payload;
|
||||
transfer_request -> ux_transfer_request_requested_length = requested_length;
|
||||
|
||||
|
||||
/* Send request to HCD layer. */
|
||||
status = _ux_host_stack_transfer_request(transfer_request);
|
||||
|
||||
|
||||
/* If the transfer is successful, we need to wait for the transfer request to be completed. */
|
||||
if (status == UX_SUCCESS)
|
||||
{
|
||||
|
||||
|
||||
/* Wait for the completion of the transfer request. */
|
||||
status = _ux_host_semaphore_get(&transfer_request -> ux_transfer_request_semaphore, UX_MS_TO_TICK(UX_HOST_CLASS_PIMA_CLASS_TRANSFER_TIMEOUT));
|
||||
|
||||
|
||||
/* If the semaphore did not succeed we probably have a time out. */
|
||||
if (status != UX_SUCCESS)
|
||||
{
|
||||
|
||||
|
||||
/* All transfers pending need to abort. There may have been a partial transfer. */
|
||||
_ux_host_stack_transfer_request_abort(transfer_request);
|
||||
|
||||
@ -250,44 +252,44 @@ UINT status;
|
||||
|
||||
/* The endpoint was halted by a transfer error and needs to be reset. */
|
||||
_ux_host_stack_endpoint_reset(pima -> ux_host_class_pima_bulk_out_endpoint);
|
||||
|
||||
|
||||
/* Set the completion code. */
|
||||
transfer_request -> ux_transfer_request_completion_code = UX_TRANSFER_TIMEOUT;
|
||||
|
||||
|
||||
/* Error trap. */
|
||||
_ux_system_error_handler(UX_SYSTEM_LEVEL_THREAD, UX_SYSTEM_CONTEXT_CLASS, UX_TRANSFER_TIMEOUT);
|
||||
|
||||
/* If trace is enabled, insert this event into the trace buffer. */
|
||||
UX_TRACE_IN_LINE_INSERT(UX_TRACE_ERROR, UX_TRANSFER_TIMEOUT, transfer_request, 0, 0, UX_TRACE_ERRORS, 0, 0)
|
||||
|
||||
|
||||
/* There was an error, return to the caller. */
|
||||
return(UX_TRANSFER_TIMEOUT);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
|
||||
/* There was a non transfer error, no partial transfer to be checked */
|
||||
return(status);
|
||||
}
|
||||
|
||||
|
||||
/* Check to ensure this is a Response packet. */
|
||||
if (_ux_utility_short_get(ptp_payload + UX_HOST_CLASS_PIMA_RESPONSE_HEADER_TYPE) !=
|
||||
if (_ux_utility_short_get(ptp_payload + UX_HOST_CLASS_PIMA_RESPONSE_HEADER_TYPE) !=
|
||||
UX_HOST_CLASS_PIMA_CT_RESPONSE_BLOCK)
|
||||
|
||||
/* We have a wrong packet. */
|
||||
return(UX_ERROR);
|
||||
|
||||
return(UX_ERROR);
|
||||
|
||||
/* Then get all the response parameters. */
|
||||
command -> ux_host_class_pima_command_parameter_1 = _ux_utility_long_get(ptp_payload +
|
||||
command -> ux_host_class_pima_command_parameter_1 = _ux_utility_long_get(ptp_payload +
|
||||
UX_HOST_CLASS_PIMA_RESPONSE_HEADER_PARAMETER_1);
|
||||
command -> ux_host_class_pima_command_parameter_2 = _ux_utility_long_get(ptp_payload +
|
||||
command -> ux_host_class_pima_command_parameter_2 = _ux_utility_long_get(ptp_payload +
|
||||
UX_HOST_CLASS_PIMA_RESPONSE_HEADER_PARAMETER_2);
|
||||
command -> ux_host_class_pima_command_parameter_3 = _ux_utility_long_get(ptp_payload +
|
||||
command -> ux_host_class_pima_command_parameter_3 = _ux_utility_long_get(ptp_payload +
|
||||
UX_HOST_CLASS_PIMA_RESPONSE_HEADER_PARAMETER_3);
|
||||
command -> ux_host_class_pima_command_parameter_4 = _ux_utility_long_get(ptp_payload +
|
||||
command -> ux_host_class_pima_command_parameter_4 = _ux_utility_long_get(ptp_payload +
|
||||
UX_HOST_CLASS_PIMA_RESPONSE_HEADER_PARAMETER_4);
|
||||
command -> ux_host_class_pima_command_parameter_5 = _ux_utility_long_get(ptp_payload +
|
||||
command -> ux_host_class_pima_command_parameter_5 = _ux_utility_long_get(ptp_payload +
|
||||
UX_HOST_CLASS_PIMA_RESPONSE_HEADER_PARAMETER_5);
|
||||
|
||||
/* We are done with the command. */
|
||||
|
@ -360,3 +360,53 @@ UINT status;
|
||||
/* Return completion status. */
|
||||
return(status);
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _uxe_host_class_pima_device_info_get PORTABLE C */
|
||||
/* 6.x */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Yajun Xia, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This function checks errors in pima device info get function call. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* pima Pointer to pima class */
|
||||
/* pima_device Device structure to fill */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* Completion Status */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _ux_host_class_pima_device_info_get Get pima device info */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* USB application */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* xx-xx-xxxx Yajun xia Initial Version 6.x */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _uxe_host_class_pima_device_info_get(UX_HOST_CLASS_PIMA *pima,
|
||||
UX_HOST_CLASS_PIMA_DEVICE *pima_device)
|
||||
{
|
||||
|
||||
/* Sanity Checks. */
|
||||
if ((pima == UX_NULL) || (pima_device == UX_NULL))
|
||||
return(UX_INVALID_PARAMETER);
|
||||
|
||||
/* Call the actual pima device info get function. */
|
||||
return(_ux_host_class_pima_device_info_get(pima, pima_device));
|
||||
}
|
||||
|
@ -12,8 +12,8 @@
|
||||
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/** */
|
||||
/** USBX Component */
|
||||
/** */
|
||||
/** USBX Component */
|
||||
/** */
|
||||
/** PIMA Class */
|
||||
/** */
|
||||
@ -30,48 +30,52 @@
|
||||
#include "ux_host_stack.h"
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _ux_host_class_pima_num_objects_get PORTABLE C */
|
||||
/* 6.1 */
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _ux_host_class_pima_num_objects_get PORTABLE C */
|
||||
/* 6.x */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Chaoqiong Xiao, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This function returns the number of objects for a specific storage. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* pima Pointer to pima class */
|
||||
/* pima_session Pointer to pima session */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* Completion Status */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* */
|
||||
/* This function returns the number of objects for a specific storage. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* pima Pointer to pima class */
|
||||
/* pima_session Pointer to pima session */
|
||||
/* storage_id The storage ID */
|
||||
/* object_format_code The object format code */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* Completion Status */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _ux_host_class_pima_command Pima command function */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* USB application */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* USB application */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
|
||||
/* 09-30-2020 Chaoqiong Xiao Modified comment(s), */
|
||||
/* resulting in version 6.1 */
|
||||
/* xx-xx-xxxx Yajun xia Modified comment(s), */
|
||||
/* resulting in version 6.x */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _ux_host_class_pima_num_objects_get(UX_HOST_CLASS_PIMA *pima,
|
||||
UX_HOST_CLASS_PIMA_SESSION *pima_session,
|
||||
UINT _ux_host_class_pima_num_objects_get(UX_HOST_CLASS_PIMA *pima,
|
||||
UX_HOST_CLASS_PIMA_SESSION *pima_session,
|
||||
ULONG storage_id,
|
||||
ULONG object_format_code)
|
||||
{
|
||||
@ -92,7 +96,7 @@ UINT status;
|
||||
|
||||
/* Issue command to get the storage IDs. 2 parameter. */
|
||||
command.ux_host_class_pima_command_nb_parameters = 2;
|
||||
|
||||
|
||||
/* Parameter 1 is the Storage ID. */
|
||||
command.ux_host_class_pima_command_parameter_1 = storage_id;
|
||||
|
||||
@ -103,7 +107,7 @@ UINT status;
|
||||
command.ux_host_class_pima_command_parameter_3 = 0;
|
||||
command.ux_host_class_pima_command_parameter_4 = 0;
|
||||
command.ux_host_class_pima_command_parameter_5 = 0;
|
||||
|
||||
|
||||
/* Then set the command to GET_NUM_OBJETCS. */
|
||||
command.ux_host_class_pima_command_operation_code = UX_HOST_CLASS_PIMA_OC_GET_NUM_OBJECTS;
|
||||
|
||||
@ -120,3 +124,57 @@ UINT status;
|
||||
return(status);
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _uxe_host_class_pima_num_objects_get PORTABLE C */
|
||||
/* 6.x */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Yajun Xia, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This function checks errors in pima object number get function */
|
||||
/* call. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* pima Pointer to pima class */
|
||||
/* pima_session Pointer to pima session */
|
||||
/* storage_id The storage ID */
|
||||
/* object_format_code The object format code */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* Completion Status */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _ux_host_class_pima_num_objects_get Get pima object number */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* USB application */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* xx-xx-xxxx Yajun xia Initial Version 6.x */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _uxe_host_class_pima_num_objects_get(UX_HOST_CLASS_PIMA *pima,
|
||||
UX_HOST_CLASS_PIMA_SESSION *pima_session,
|
||||
ULONG storage_id,
|
||||
ULONG object_format_code)
|
||||
{
|
||||
|
||||
/* Sanity checks. */
|
||||
if ((pima == UX_NULL) || (pima_session == UX_NULL))
|
||||
return(UX_INVALID_PARAMETER);
|
||||
|
||||
/* Call the actual pima num objects get function. */
|
||||
return(_ux_host_class_pima_num_objects_get(pima, pima_session, storage_id, object_format_code));
|
||||
}
|
@ -12,8 +12,8 @@
|
||||
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/** */
|
||||
/** USBX Component */
|
||||
/** */
|
||||
/** USBX Component */
|
||||
/** */
|
||||
/** PIMA Class */
|
||||
/** */
|
||||
@ -30,45 +30,45 @@
|
||||
#include "ux_host_stack.h"
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _ux_host_class_pima_object_close PORTABLE C */
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _ux_host_class_pima_object_close PORTABLE C */
|
||||
/* 6.1.10 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Chaoqiong Xiao, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This function closes an object, */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* pima Pointer to pima class */
|
||||
/* pima_session Pointer to pima session */
|
||||
/* object_handle The object handle */
|
||||
/* object Pointer to object info */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* Completion Status */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* */
|
||||
/* This function closes an object, */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* pima Pointer to pima class */
|
||||
/* pima_session Pointer to pima session */
|
||||
/* object_handle The object handle */
|
||||
/* object Pointer to object info */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* Completion Status */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _ux_host_stack_transfer_request Transfer request */
|
||||
/* _ux_host_stack_transfer_request_abort Abort transfer */
|
||||
/* _ux_host_stack_endpoint_reset Reset endpoint */
|
||||
/* _ux_host_semaphore_get Get semaphore */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* USB application */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* USB application */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
|
||||
/* 09-30-2020 Chaoqiong Xiao Modified comment(s), */
|
||||
/* prefixed UX to MS_TO_TICK, */
|
||||
@ -78,7 +78,7 @@
|
||||
/* resulting in version 6.1.10 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _ux_host_class_pima_object_close(UX_HOST_CLASS_PIMA *pima,
|
||||
UINT _ux_host_class_pima_object_close(UX_HOST_CLASS_PIMA *pima,
|
||||
UX_HOST_CLASS_PIMA_SESSION *pima_session,
|
||||
ULONG object_handle, UX_HOST_CLASS_PIMA_OBJECT *object)
|
||||
{
|
||||
@ -103,8 +103,8 @@ UINT status;
|
||||
|
||||
/* Check if the object is already closed. */
|
||||
if (object -> ux_host_class_pima_object_state != UX_HOST_CLASS_PIMA_OBJECT_STATE_OPENED)
|
||||
return (UX_HOST_CLASS_PIMA_RC_OBJECT_ALREADY_CLOSED );
|
||||
|
||||
return (UX_HOST_CLASS_PIMA_RC_OBJECT_ALREADY_CLOSED );
|
||||
|
||||
/* Close the object. */
|
||||
object -> ux_host_class_pima_object_state = UX_HOST_CLASS_PIMA_OBJECT_STATE_CLOSED;
|
||||
|
||||
@ -118,40 +118,40 @@ UINT status;
|
||||
/* Check if we had a ZLP condition during the data phase. */
|
||||
if (pima -> ux_host_class_pima_zlp_flag != UX_HOST_CLASS_PIMA_ZLP_NONE)
|
||||
{
|
||||
|
||||
/* We had a ZLP, so we now expect a zero length packet prior to the status phase.
|
||||
|
||||
/* We had a ZLP, so we now expect a zero length packet prior to the status phase.
|
||||
We need to determine the direction. */
|
||||
if (pima -> ux_host_class_pima_zlp_flag == UX_HOST_CLASS_PIMA_ZLP_IN)
|
||||
|
||||
/* We use the Bulk In pipe for receiving the zlp. */
|
||||
transfer_request = &pima -> ux_host_class_pima_bulk_in_endpoint -> ux_endpoint_transfer_request;
|
||||
|
||||
|
||||
else
|
||||
|
||||
|
||||
/* We use the Bulk Out pipe for sending the zlp. */
|
||||
transfer_request = &pima -> ux_host_class_pima_bulk_in_endpoint -> ux_endpoint_transfer_request;
|
||||
|
||||
/* Initialize the payload to zero length. */
|
||||
|
||||
/* Initialize the payload to zero length. */
|
||||
transfer_request -> ux_transfer_request_data_pointer = UX_NULL;
|
||||
transfer_request -> ux_transfer_request_requested_length = 0;
|
||||
|
||||
/* Reset the ZLP now. */
|
||||
pima -> ux_host_class_pima_zlp_flag = UX_HOST_CLASS_PIMA_ZLP_NONE;
|
||||
|
||||
|
||||
/* Send request to HCD layer. */
|
||||
status = _ux_host_stack_transfer_request(transfer_request);
|
||||
|
||||
|
||||
/* If the transfer is successful, we need to wait for the transfer request to be completed. */
|
||||
if (status == UX_SUCCESS)
|
||||
{
|
||||
|
||||
|
||||
/* Wait for the completion of the transfer request. */
|
||||
status = _ux_host_semaphore_get(&transfer_request -> ux_transfer_request_semaphore, UX_MS_TO_TICK(UX_HOST_CLASS_PIMA_CLASS_TRANSFER_TIMEOUT));
|
||||
|
||||
|
||||
/* If the semaphore did not succeed we probably have a time out. */
|
||||
if (status != UX_SUCCESS)
|
||||
{
|
||||
|
||||
|
||||
/* All transfers pending need to abort. There may have been a partial transfer. */
|
||||
_ux_host_stack_transfer_request_abort(transfer_request);
|
||||
|
||||
@ -163,37 +163,37 @@ UINT status;
|
||||
|
||||
/* There was an error, return to the caller. */
|
||||
return(status);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* We use the Bulk In pipe for receiving the response payload. */
|
||||
transfer_request = &pima -> ux_host_class_pima_bulk_in_endpoint -> ux_endpoint_transfer_request;
|
||||
|
||||
|
||||
/* Get the pointer to the ptp payload. */
|
||||
ptp_payload = pima -> ux_host_class_pima_container ;
|
||||
|
||||
/* Calculate the requested length for this payload. */
|
||||
requested_length = UX_HOST_CLASS_PIMA_RESPONSE_HEADER_SIZE;
|
||||
|
||||
|
||||
/* Initialize the transfer_request. */
|
||||
transfer_request -> ux_transfer_request_data_pointer = ptp_payload;
|
||||
transfer_request -> ux_transfer_request_requested_length = requested_length;
|
||||
|
||||
|
||||
/* Send request to HCD layer. */
|
||||
status = _ux_host_stack_transfer_request(transfer_request);
|
||||
|
||||
|
||||
/* If the transfer is successful, we need to wait for the transfer request to be completed. */
|
||||
if (status == UX_SUCCESS)
|
||||
{
|
||||
|
||||
|
||||
/* Wait for the completion of the transfer request. */
|
||||
status = _ux_host_semaphore_get(&transfer_request -> ux_transfer_request_semaphore, UX_MS_TO_TICK(UX_HOST_CLASS_PIMA_CLASS_TRANSFER_TIMEOUT));
|
||||
|
||||
|
||||
/* If the semaphore did not succeed we probably have a time out. */
|
||||
if (status != UX_SUCCESS)
|
||||
{
|
||||
|
||||
|
||||
/* All transfers pending need to abort. There may have been a partial transfer. */
|
||||
_ux_host_stack_transfer_request_abort(transfer_request);
|
||||
|
||||
@ -205,15 +205,15 @@ UINT status;
|
||||
|
||||
/* There was an error, return to the caller. */
|
||||
return(status);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
|
||||
/* There was a non transfer error, no partial transfer to be checked */
|
||||
return(status);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/* The transfer for this transaction is now inactive. */
|
||||
@ -223,3 +223,55 @@ UINT status;
|
||||
return(UX_SUCCESS);
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _uxe_host_class_pima_object_close PORTABLE C */
|
||||
/* 6.x */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Yajun Xia, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This function checks errors in pima object close function call. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* pima Pointer to pima class */
|
||||
/* pima_session Pointer to pima session */
|
||||
/* object_handle The object handle */
|
||||
/* object Pointer to object info */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* Completion Status */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _ux_host_class_pima_object_close Close pima object */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* USB application */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* xx-xx-xxxx Yajun xia Initial Version 6.x */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _uxe_host_class_pima_object_close(UX_HOST_CLASS_PIMA *pima,
|
||||
UX_HOST_CLASS_PIMA_SESSION *pima_session,
|
||||
ULONG object_handle, UX_HOST_CLASS_PIMA_OBJECT *object)
|
||||
{
|
||||
|
||||
/* Sanity checks. */
|
||||
if ((pima == UX_NULL) || (pima_session == UX_NULL) || (object == UX_NULL))
|
||||
return(UX_INVALID_PARAMETER);
|
||||
|
||||
/* Call the actual object close function. */
|
||||
return(_ux_host_class_pima_object_close(pima, pima_session, object_handle, object));
|
||||
}
|
@ -12,8 +12,8 @@
|
||||
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/** */
|
||||
/** USBX Component */
|
||||
/** */
|
||||
/** USBX Component */
|
||||
/** */
|
||||
/** PIMA Class */
|
||||
/** */
|
||||
@ -30,51 +30,51 @@
|
||||
#include "ux_host_stack.h"
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _ux_host_class_pima_object_delete PORTABLE C */
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _ux_host_class_pima_object_delete PORTABLE C */
|
||||
/* 6.1 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Chaoqiong Xiao, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This function deletes an object. If the object handle is set to */
|
||||
/* 0xFFFFFFFF then all objects on the media are deleted. */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* pima Pointer to pima class */
|
||||
/* pima_session Pointer to pima session */
|
||||
/* object_handle The object handle */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* Completion Status */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* */
|
||||
/* This function deletes an object. If the object handle is set to */
|
||||
/* 0xFFFFFFFF then all objects on the media are deleted. */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* pima Pointer to pima class */
|
||||
/* pima_session Pointer to pima session */
|
||||
/* object_handle The object handle */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* Completion Status */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _ux_host_class_pima_command Pima command function */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* USB application */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* USB application */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
|
||||
/* 09-30-2020 Chaoqiong Xiao Modified comment(s), */
|
||||
/* resulting in version 6.1 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _ux_host_class_pima_object_delete(UX_HOST_CLASS_PIMA *pima,
|
||||
UINT _ux_host_class_pima_object_delete(UX_HOST_CLASS_PIMA *pima,
|
||||
UX_HOST_CLASS_PIMA_SESSION *pima_session,
|
||||
ULONG object_handle)
|
||||
{
|
||||
@ -95,10 +95,10 @@ UINT status;
|
||||
|
||||
/* Issue command to get the object info. 1 parameter. */
|
||||
command.ux_host_class_pima_command_nb_parameters = 1;
|
||||
|
||||
|
||||
/* Parameter 1 is the Object Handle. */
|
||||
command.ux_host_class_pima_command_parameter_1 = object_handle;
|
||||
|
||||
|
||||
/* Other parameters unused. */
|
||||
command.ux_host_class_pima_command_parameter_2 = 0;
|
||||
command.ux_host_class_pima_command_parameter_3 = 0;
|
||||
@ -116,3 +116,54 @@ UINT status;
|
||||
return(status);
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _uxe_host_class_pima_object_delete PORTABLE C */
|
||||
/* 6.x */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Yajun Xia, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This function checks errors in pima object delete function call. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* pima Pointer to pima class */
|
||||
/* pima_session Pointer to pima session */
|
||||
/* object_handle The object handle */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* Completion Status */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _ux_host_class_pima_object_delete Delete pima object */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* USB application */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* xx-xx-xxxx Yajun xia Initial Version 6.x */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _uxe_host_class_pima_object_delete(UX_HOST_CLASS_PIMA *pima,
|
||||
UX_HOST_CLASS_PIMA_SESSION *pima_session,
|
||||
ULONG object_handle)
|
||||
{
|
||||
|
||||
/* Sanity checks. */
|
||||
if ((pima == UX_NULL) || (pima_session == UX_NULL))
|
||||
return(UX_INVALID_PARAMETER);
|
||||
|
||||
/* Call the actual pima object delete function. */
|
||||
return(_ux_host_class_pima_object_delete(pima, pima_session, object_handle));
|
||||
}
|
@ -12,8 +12,8 @@
|
||||
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/** */
|
||||
/** USBX Component */
|
||||
/** */
|
||||
/** USBX Component */
|
||||
/** */
|
||||
/** PIMA Class */
|
||||
/** */
|
||||
@ -30,35 +30,35 @@
|
||||
#include "ux_host_stack.h"
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _ux_host_class_pima_object_get PORTABLE C */
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _ux_host_class_pima_object_get PORTABLE C */
|
||||
/* 6.1.10 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Chaoqiong Xiao, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This function gets an object identified by the object_handle */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* pima Pointer to pima class */
|
||||
/* pima_session Pointer to pima session */
|
||||
/* object_handle The object handle */
|
||||
/* object Pointer to object info */
|
||||
/* object_buffer Buffer to be used */
|
||||
/* object_buffer_length Buffer length */
|
||||
/* object_actual_length Length read in that */
|
||||
/* command */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* Completion Status */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* */
|
||||
/* This function gets an object identified by the object_handle */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* pima Pointer to pima class */
|
||||
/* pima_session Pointer to pima session */
|
||||
/* object_handle The object handle */
|
||||
/* object Pointer to object info */
|
||||
/* object_buffer Buffer to be used */
|
||||
/* object_buffer_length Buffer length */
|
||||
/* object_actual_length Length read in that */
|
||||
/* command */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* Completion Status */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _ux_host_stack_transfer_request Transfer request */
|
||||
/* _ux_host_stack_transfer_request_abort Abort transfer */
|
||||
/* _ux_host_stack_endpoint_reset Reset endpoint */
|
||||
@ -67,15 +67,15 @@
|
||||
/* _ux_utility_long_get Get 32-bit value */
|
||||
/* _ux_utility_long_put Put 32-bit value */
|
||||
/* _ux_utility_short_put Put 16-bit value */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* USB application */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* USB application */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
|
||||
/* 09-30-2020 Chaoqiong Xiao Modified comment(s), */
|
||||
/* prefixed UX to MS_TO_TICK, */
|
||||
@ -87,10 +87,10 @@
|
||||
/* resulting in version 6.1.10 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _ux_host_class_pima_object_get(UX_HOST_CLASS_PIMA *pima,
|
||||
UINT _ux_host_class_pima_object_get(UX_HOST_CLASS_PIMA *pima,
|
||||
UX_HOST_CLASS_PIMA_SESSION *pima_session,
|
||||
ULONG object_handle, UX_HOST_CLASS_PIMA_OBJECT *object,
|
||||
UCHAR *object_buffer, ULONG object_buffer_length,
|
||||
UCHAR *object_buffer, ULONG object_buffer_length,
|
||||
ULONG *object_actual_length)
|
||||
{
|
||||
|
||||
@ -114,19 +114,19 @@ UINT status;
|
||||
|
||||
/* Check if the object is already opened. */
|
||||
if (object -> ux_host_class_pima_object_state != UX_HOST_CLASS_PIMA_OBJECT_STATE_OPENED)
|
||||
return (UX_HOST_CLASS_PIMA_RC_OBJECT_NOT_OPENED);
|
||||
return (UX_HOST_CLASS_PIMA_RC_OBJECT_NOT_OPENED);
|
||||
|
||||
/* Check the transfer status. If there was an error or transfer is completed, refuse transfer. */
|
||||
if ((object -> ux_host_class_pima_object_transfer_status == UX_HOST_CLASS_PIMA_OBJECT_TRANSFER_STATUS_COMPLETED) ||
|
||||
(object -> ux_host_class_pima_object_transfer_status == UX_HOST_CLASS_PIMA_OBJECT_TRANSFER_STATUS_ABORTED))
|
||||
return (UX_HOST_CLASS_PIMA_RC_ACCESS_DENIED);
|
||||
return (UX_HOST_CLASS_PIMA_RC_ACCESS_DENIED);
|
||||
|
||||
/* Reset the actual length. */
|
||||
*object_actual_length = 0;
|
||||
|
||||
/* This variable will remain untouched if the offset is not 0 and the requested length is 0. */
|
||||
status = UX_SUCCESS;
|
||||
|
||||
|
||||
/* Check if the offset to be read is at 0, if so, prepare the first read command. */
|
||||
if (object -> ux_host_class_pima_object_offset == 0)
|
||||
{
|
||||
@ -136,38 +136,38 @@ UINT status;
|
||||
|
||||
/* Issue command to get the object info. 1 parameter. */
|
||||
command.ux_host_class_pima_command_nb_parameters = 1;
|
||||
|
||||
|
||||
/* Parameter 1 is the Object Handle. */
|
||||
command.ux_host_class_pima_command_parameter_1 = object_handle;
|
||||
|
||||
|
||||
/* Then set the command to GET_OBJECT. */
|
||||
command.ux_host_class_pima_command_operation_code = UX_HOST_CLASS_PIMA_OC_GET_OBJECT;
|
||||
|
||||
|
||||
/* We use the Bulk Out pipe for sending data out.. */
|
||||
transfer_request = &pima -> ux_host_class_pima_bulk_out_endpoint -> ux_endpoint_transfer_request;
|
||||
|
||||
|
||||
/* Get the pointer to the ptp payload. */
|
||||
ptp_payload = pima -> ux_host_class_pima_container ;
|
||||
|
||||
|
||||
/* Calculate the requested length for this payload. */
|
||||
requested_length = UX_HOST_CLASS_PIMA_COMMAND_HEADER_SIZE + ((ULONG)sizeof(ULONG) * command.ux_host_class_pima_command_nb_parameters);
|
||||
|
||||
/* Fill the command container. First the length of the total header and payload. */
|
||||
_ux_utility_long_put(ptp_payload + UX_HOST_CLASS_PIMA_COMMAND_HEADER_LENGTH, requested_length);
|
||||
|
||||
|
||||
|
||||
|
||||
/* Then the type of container : a command block here. */
|
||||
_ux_utility_short_put(ptp_payload + UX_HOST_CLASS_PIMA_COMMAND_HEADER_TYPE, UX_HOST_CLASS_PIMA_CT_COMMAND_BLOCK);
|
||||
|
||||
|
||||
/* Now the command code to send. */
|
||||
_ux_utility_short_put(ptp_payload + UX_HOST_CLASS_PIMA_COMMAND_HEADER_CODE, (USHORT)command.ux_host_class_pima_command_operation_code);
|
||||
|
||||
/* Put the transaction ID. */
|
||||
_ux_utility_long_put(ptp_payload + UX_HOST_CLASS_PIMA_COMMAND_HEADER_TRANSACTION_ID,
|
||||
_ux_utility_long_put(ptp_payload + UX_HOST_CLASS_PIMA_COMMAND_HEADER_TRANSACTION_ID,
|
||||
pima -> ux_host_class_pima_transaction_id++);
|
||||
|
||||
|
||||
/* Then fill in the parameters. */
|
||||
_ux_utility_long_put(ptp_payload + UX_HOST_CLASS_PIMA_COMMAND_HEADER_PARAMETER_1,
|
||||
_ux_utility_long_put(ptp_payload + UX_HOST_CLASS_PIMA_COMMAND_HEADER_PARAMETER_1,
|
||||
command.ux_host_class_pima_command_parameter_1);
|
||||
|
||||
/* Initialize the transfer_request. */
|
||||
@ -180,7 +180,7 @@ UINT status;
|
||||
/* If the transfer is successful, we need to wait for the transfer request to be completed. */
|
||||
if (status == UX_SUCCESS)
|
||||
{
|
||||
|
||||
|
||||
/* Wait for the completion of the transfer request. */
|
||||
status = _ux_host_semaphore_get(&transfer_request -> ux_transfer_request_semaphore, UX_MS_TO_TICK(UX_HOST_CLASS_PIMA_CLASS_TRANSFER_TIMEOUT));
|
||||
|
||||
@ -196,13 +196,13 @@ UINT status;
|
||||
|
||||
/* The endpoint was halted by a transfer error and needs to be reset. */
|
||||
_ux_host_stack_endpoint_reset(pima -> ux_host_class_pima_bulk_out_endpoint);
|
||||
|
||||
|
||||
/* Set the object transfer status to aborted. */
|
||||
object -> ux_host_class_pima_object_transfer_status = UX_HOST_CLASS_PIMA_OBJECT_TRANSFER_STATUS_ABORTED;
|
||||
|
||||
/* There was an error, return to the caller. */
|
||||
return(UX_TRANSFER_ERROR);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -216,38 +216,38 @@ UINT status;
|
||||
if (requested_length == transfer_request -> ux_transfer_request_actual_length)
|
||||
{
|
||||
|
||||
/* Obtain the first packet. This packet contains the header and some data.
|
||||
/* Obtain the first packet. This packet contains the header and some data.
|
||||
We use the Bulk In pipe for receiving data .. */
|
||||
transfer_request = &pima -> ux_host_class_pima_bulk_in_endpoint -> ux_endpoint_transfer_request;
|
||||
|
||||
|
||||
/* Get the pointer to the ptp payload. */
|
||||
ptp_payload = pima -> ux_host_class_pima_container ;
|
||||
|
||||
|
||||
/* Calculate the requested length for this payload. It is the minimum
|
||||
of the application's requested length and the container size. */
|
||||
if (object_buffer_length < UX_HOST_CLASS_PIMA_CONTAINER_SIZE)
|
||||
requested_length = object_buffer_length;
|
||||
else
|
||||
requested_length = UX_HOST_CLASS_PIMA_CONTAINER_SIZE;
|
||||
|
||||
|
||||
/* Initialize the transfer_request. */
|
||||
transfer_request -> ux_transfer_request_data_pointer = ptp_payload;
|
||||
transfer_request -> ux_transfer_request_requested_length = requested_length;
|
||||
|
||||
|
||||
/* Send request to HCD layer. */
|
||||
status = _ux_host_stack_transfer_request(transfer_request);
|
||||
|
||||
|
||||
/* If the transfer is successful, we need to wait for the transfer request to be completed. */
|
||||
if (status == UX_SUCCESS)
|
||||
{
|
||||
|
||||
|
||||
/* Wait for the completion of the transfer request. */
|
||||
status = _ux_host_semaphore_get(&transfer_request -> ux_transfer_request_semaphore, UX_MS_TO_TICK(UX_HOST_CLASS_PIMA_CLASS_TRANSFER_TIMEOUT));
|
||||
|
||||
|
||||
/* If the semaphore did not succeed we probably have a time out. */
|
||||
if (status != UX_SUCCESS || transfer_request -> ux_transfer_request_completion_code != UX_SUCCESS)
|
||||
{
|
||||
|
||||
|
||||
/* All transfers pending need to abort. There may have been a partial transfer. */
|
||||
_ux_host_stack_transfer_request_abort(transfer_request);
|
||||
|
||||
@ -256,17 +256,17 @@ UINT status;
|
||||
|
||||
/* The endpoint was halted by a transfer error and needs to be reset. */
|
||||
_ux_host_stack_endpoint_reset(pima -> ux_host_class_pima_bulk_out_endpoint);
|
||||
|
||||
|
||||
/* Set the object transfer status to aborted. */
|
||||
object -> ux_host_class_pima_object_transfer_status = UX_HOST_CLASS_PIMA_OBJECT_TRANSFER_STATUS_ABORTED;
|
||||
|
||||
/* There was an error, return to the caller. */
|
||||
return(UX_TRANSFER_ERROR);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
|
||||
/* There was a non transfer error, no partial transfer to be checked */
|
||||
return(status);
|
||||
}
|
||||
@ -274,43 +274,43 @@ UINT status;
|
||||
/* Ensure the transfer is larger than the header. */
|
||||
if (transfer_request -> ux_transfer_request_actual_length > UX_HOST_CLASS_PIMA_DATA_HEADER_SIZE)
|
||||
{
|
||||
|
||||
|
||||
/* We need to skip the header. Copying the necessary partial memory only. */
|
||||
_ux_utility_memory_copy(object_buffer, ptp_payload + UX_HOST_CLASS_PIMA_DATA_HEADER_SIZE,
|
||||
_ux_utility_memory_copy(object_buffer, ptp_payload + UX_HOST_CLASS_PIMA_DATA_HEADER_SIZE,
|
||||
transfer_request -> ux_transfer_request_actual_length - UX_HOST_CLASS_PIMA_DATA_HEADER_SIZE); /* Use case of memcpy is verified. */
|
||||
|
||||
/* Get the size of the entire data payload to be expected in this object transfer (data + header). If the size is on a boundary
|
||||
the pima protocol demands that the last packet is a ZLP. */
|
||||
total_length = _ux_utility_long_get(ptp_payload + UX_HOST_CLASS_PIMA_DATA_HEADER_LENGTH);
|
||||
|
||||
|
||||
/* Check for remainder in last packet. */
|
||||
if ((total_length % pima -> ux_host_class_pima_bulk_in_endpoint -> ux_endpoint_descriptor.wMaxPacketSize) == 0)
|
||||
|
||||
|
||||
/* We have a ZLP condition on a IN. */
|
||||
pima -> ux_host_class_pima_zlp_flag = UX_HOST_CLASS_PIMA_ZLP_IN;
|
||||
else
|
||||
|
||||
|
||||
/* Do not expect a ZLP. */
|
||||
pima -> ux_host_class_pima_zlp_flag = UX_HOST_CLASS_PIMA_ZLP_NONE;
|
||||
|
||||
|
||||
/* Compute the total length of the data only. */
|
||||
total_length -= UX_HOST_CLASS_PIMA_DATA_HEADER_SIZE;
|
||||
|
||||
total_length -= UX_HOST_CLASS_PIMA_DATA_HEADER_SIZE;
|
||||
|
||||
/* Check if the expected length remaining will be more than the current buffer. If so, we need to have a full payload
|
||||
on a packet boundary. */
|
||||
if (total_length > object_buffer_length)
|
||||
if (total_length > object_buffer_length)
|
||||
|
||||
/* Update what is left to be received. */
|
||||
object_buffer_length -= transfer_request -> ux_transfer_request_actual_length;
|
||||
|
||||
else
|
||||
|
||||
|
||||
/* Update what is left to be received. */
|
||||
object_buffer_length -= transfer_request -> ux_transfer_request_actual_length - UX_HOST_CLASS_PIMA_DATA_HEADER_SIZE;
|
||||
|
||||
|
||||
/* Update the actual length. */
|
||||
*object_actual_length = transfer_request -> ux_transfer_request_actual_length - UX_HOST_CLASS_PIMA_DATA_HEADER_SIZE;
|
||||
|
||||
|
||||
/* Update where we will store the next data. */
|
||||
object_buffer += transfer_request -> ux_transfer_request_actual_length - UX_HOST_CLASS_PIMA_DATA_HEADER_SIZE;
|
||||
|
||||
@ -344,36 +344,36 @@ UINT status;
|
||||
|
||||
/* It may take several transactions. */
|
||||
if (object_buffer_length > UX_HOST_CLASS_PIMA_MAX_PAYLOAD)
|
||||
|
||||
|
||||
/* Set the requested length to the payload maximum. */
|
||||
requested_length = UX_HOST_CLASS_PIMA_MAX_PAYLOAD;
|
||||
|
||||
|
||||
else
|
||||
|
||||
|
||||
/* We can use the user supplied length to complete this request. */
|
||||
requested_length = object_buffer_length;
|
||||
|
||||
|
||||
/* Initialize the transfer_request. */
|
||||
transfer_request -> ux_transfer_request_data_pointer = object_buffer;
|
||||
transfer_request -> ux_transfer_request_requested_length = requested_length;
|
||||
|
||||
|
||||
/* Send request to HCD layer. */
|
||||
status = _ux_host_stack_transfer_request(transfer_request);
|
||||
|
||||
|
||||
/* If the transfer is successful, we need to wait for the transfer request to be completed. */
|
||||
if (status == UX_SUCCESS)
|
||||
{
|
||||
|
||||
|
||||
/* Wait for the completion of the transfer request. */
|
||||
status = _ux_host_semaphore_get(&transfer_request -> ux_transfer_request_semaphore, UX_MS_TO_TICK(UX_HOST_CLASS_PIMA_CLASS_TRANSFER_TIMEOUT));
|
||||
|
||||
|
||||
/* If the semaphore did not succeed we probably have a time out. */
|
||||
if (status != UX_SUCCESS || transfer_request -> ux_transfer_request_completion_code != UX_SUCCESS)
|
||||
{
|
||||
|
||||
|
||||
/* All transfers pending need to abort. There may have been a partial transfer. */
|
||||
_ux_host_stack_transfer_request_abort(transfer_request);
|
||||
|
||||
|
||||
/* The endpoint was halted by a transfer error and needs to be reset. */
|
||||
_ux_host_stack_endpoint_reset(pima -> ux_host_class_pima_bulk_in_endpoint);
|
||||
|
||||
@ -385,21 +385,21 @@ UINT status;
|
||||
|
||||
/* There was an error, return to the caller. */
|
||||
return(UX_TRANSFER_ERROR);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
|
||||
/* There was a non transfer error, no partial transfer to be checked */
|
||||
return(status);
|
||||
}
|
||||
|
||||
|
||||
/* Update the object length expected by the user with what we actually received. */
|
||||
object_buffer_length -= transfer_request -> ux_transfer_request_actual_length;
|
||||
|
||||
|
||||
/* Update the actual length. */
|
||||
*object_actual_length += transfer_request -> ux_transfer_request_actual_length;
|
||||
|
||||
|
||||
/* And the offset. */
|
||||
object -> ux_host_class_pima_object_offset += transfer_request -> ux_transfer_request_actual_length;
|
||||
|
||||
@ -408,13 +408,71 @@ UINT status;
|
||||
|
||||
/* Check to see if we are at the end of the object. */
|
||||
if (object -> ux_host_class_pima_object_offset == object -> ux_host_class_pima_object_compressed_size)
|
||||
|
||||
|
||||
/* The transfer for this transaction is completed. */
|
||||
object -> ux_host_class_pima_object_transfer_status = UX_HOST_CLASS_PIMA_OBJECT_TRANSFER_STATUS_COMPLETED;
|
||||
|
||||
|
||||
}
|
||||
|
||||
/* Return completion status. */
|
||||
return(status);
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _uxe_host_class_pima_object_get PORTABLE C */
|
||||
/* 6.x */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Yajun Xia, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This function checks errors in pima object get function call. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* pima Pointer to pima class */
|
||||
/* pima_session Pointer to pima session */
|
||||
/* object_handle The object handle */
|
||||
/* object Pointer to object info */
|
||||
/* object_buffer Buffer to be used */
|
||||
/* object_buffer_length Buffer length */
|
||||
/* object_actual_length Length read in that */
|
||||
/* command */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* Completion Status */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _ux_host_class_pima_object_get Get pima object */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* USB application */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* xx-xx-xxxx Yajun xia Initial Version 6.x */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _uxe_host_class_pima_object_get(UX_HOST_CLASS_PIMA *pima,
|
||||
UX_HOST_CLASS_PIMA_SESSION *pima_session,
|
||||
ULONG object_handle, UX_HOST_CLASS_PIMA_OBJECT *object,
|
||||
UCHAR *object_buffer, ULONG object_buffer_length,
|
||||
ULONG *object_actual_length)
|
||||
{
|
||||
|
||||
/* Sanity checks. */
|
||||
if (pima == UX_NULL || pima_session == UX_NULL || object == UX_NULL || object_buffer == UX_NULL || object_actual_length == UX_NULL)
|
||||
return(UX_INVALID_PARAMETER);
|
||||
|
||||
/* Call the actual pima object get function. */
|
||||
return(_ux_host_class_pima_object_get(pima, pima_session, object_handle, object, object_buffer, object_buffer_length, object_actual_length));
|
||||
}
|
@ -178,3 +178,64 @@ UINT status;
|
||||
/* Return completion status. */
|
||||
return(status);
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _uxe_host_class_pima_object_handles_get PORTABLE C */
|
||||
/* 6.x */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Yajun Xia, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This function checks errors in pima object handles get function */
|
||||
/* call. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* pima Pointer to pima class */
|
||||
/* pima_session Pointer to pima session */
|
||||
/* object_handles_array Pointer to store handles */
|
||||
/* object_handles_length Array length in handles */
|
||||
/* object_format_code Object Format Code */
|
||||
/* object_handle_association Object Handle */
|
||||
/* Association */
|
||||
/* */
|
||||
/* The 2 last parameter are optional and should be set to 0 if not */
|
||||
/* used. */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* Completion Status */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _ux_host_class_pima_object_handles_get Get object handles */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* USB application */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* xx-xx-xxxx Yajun xia Initial Version 6.x */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _uxe_host_class_pima_object_handles_get(UX_HOST_CLASS_PIMA *pima, UX_HOST_CLASS_PIMA_SESSION *pima_session,
|
||||
ULONG *object_handles_array, ULONG object_handles_length,
|
||||
ULONG storage_id, ULONG object_format_code, ULONG object_handle_association)
|
||||
{
|
||||
|
||||
/* Sanity checks. */
|
||||
if ((pima == UX_NULL) || (pima_session == UX_NULL) || (object_handles_array == UX_NULL) || (object_handles_length == 0))
|
||||
return(UX_INVALID_PARAMETER);
|
||||
|
||||
/* Call the actual function. */
|
||||
return(_ux_host_class_pima_object_handles_get(pima, pima_session, object_handles_array, object_handles_length,
|
||||
storage_id, object_format_code, object_handle_association));
|
||||
}
|
@ -12,8 +12,8 @@
|
||||
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/** */
|
||||
/** USBX Component */
|
||||
/** */
|
||||
/** USBX Component */
|
||||
/** */
|
||||
/** PIMA Class */
|
||||
/** */
|
||||
@ -30,47 +30,47 @@
|
||||
#include "ux_host_stack.h"
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _ux_host_class_pima_object_info_get PORTABLE C */
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _ux_host_class_pima_object_info_get PORTABLE C */
|
||||
/* 6.1 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Chaoqiong Xiao, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This function gets the current object information block. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* pima Pointer to pima class */
|
||||
/* pima_session Pointer to pima session */
|
||||
/* object_handle The object handle */
|
||||
/* object Object structure to fill */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* Completion Status */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* */
|
||||
/* This function gets the current object information block. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* pima Pointer to pima class */
|
||||
/* pima_session Pointer to pima session */
|
||||
/* object_handle The object handle */
|
||||
/* object Object structure to fill */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* Completion Status */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _ux_host_class_pima_command Pima command function */
|
||||
/* _ux_utility_descriptor_parse Unpack descriptor */
|
||||
/* _ux_utility_memory_allocate Allocate memory */
|
||||
/* _ux_utility_descriptor_parse Unpack descriptor */
|
||||
/* _ux_utility_memory_allocate Allocate memory */
|
||||
/* _ux_utility_memory_copy Copy memory */
|
||||
/* _ux_utility_memory_free Free allocated memory */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* USB application */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* _ux_utility_memory_free Free allocated memory */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* USB application */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
|
||||
/* 09-30-2020 Chaoqiong Xiao Modified comment(s), */
|
||||
/* verified memset and memcpy */
|
||||
@ -78,7 +78,7 @@
|
||||
/* resulting in version 6.1 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _ux_host_class_pima_object_info_get(UX_HOST_CLASS_PIMA *pima,
|
||||
UINT _ux_host_class_pima_object_info_get(UX_HOST_CLASS_PIMA *pima,
|
||||
UX_HOST_CLASS_PIMA_SESSION *pima_session,
|
||||
ULONG object_handle, UX_HOST_CLASS_PIMA_OBJECT *object)
|
||||
{
|
||||
@ -102,10 +102,10 @@ UINT status;
|
||||
|
||||
/* Issue command to get the object info. 1 parameter. */
|
||||
command.ux_host_class_pima_command_nb_parameters = 1;
|
||||
|
||||
|
||||
/* Parameter 1 is the Object Handle. */
|
||||
command.ux_host_class_pima_command_parameter_1 = object_handle;
|
||||
|
||||
|
||||
/* Other parameters unused. */
|
||||
command.ux_host_class_pima_command_parameter_2 = 0;
|
||||
command.ux_host_class_pima_command_parameter_3 = 0;
|
||||
@ -121,7 +121,7 @@ UINT status;
|
||||
return(UX_MEMORY_INSUFFICIENT);
|
||||
|
||||
/* Issue the command. */
|
||||
status = _ux_host_class_pima_command(pima, &command, UX_HOST_CLASS_PIMA_DATA_PHASE_IN , object_buffer,
|
||||
status = _ux_host_class_pima_command(pima, &command, UX_HOST_CLASS_PIMA_DATA_PHASE_IN , object_buffer,
|
||||
UX_HOST_CLASS_PIMA_OBJECT_MAX_LENGTH, UX_HOST_CLASS_PIMA_OBJECT_MAX_LENGTH);
|
||||
|
||||
/* Check the result. If the result is OK, the object info block was read properly. */
|
||||
@ -135,7 +135,7 @@ UINT status;
|
||||
|
||||
/* Copy the object filename field. Point to the beginning of the object description string. */
|
||||
object_pointer = object_buffer + UX_HOST_CLASS_PIMA_OBJECT_VARIABLE_OFFSET;
|
||||
|
||||
|
||||
/* Get the unicode string length. */
|
||||
unicode_string_length = ((ULONG) *object_pointer * 2) + 1;
|
||||
|
||||
@ -144,7 +144,7 @@ UINT status;
|
||||
|
||||
/* Return error. */
|
||||
status = UX_MEMORY_INSUFFICIENT;
|
||||
|
||||
|
||||
/* Is there enough space? */
|
||||
if (status == UX_SUCCESS)
|
||||
{
|
||||
@ -154,7 +154,7 @@ UINT status;
|
||||
|
||||
/* Point to the next field. */
|
||||
object_pointer += unicode_string_length;
|
||||
|
||||
|
||||
/* Get the unicode string length. */
|
||||
unicode_string_length = ((ULONG) *object_pointer * 2) + 1;
|
||||
|
||||
@ -174,7 +174,7 @@ UINT status;
|
||||
|
||||
/* Point to the next field. */
|
||||
object_pointer += unicode_string_length;
|
||||
|
||||
|
||||
/* Get the unicode string length. */
|
||||
unicode_string_length = ((ULONG) *object_pointer * 2) + 1;
|
||||
|
||||
@ -194,7 +194,7 @@ UINT status;
|
||||
|
||||
/* Point to the next field. */
|
||||
object_pointer += unicode_string_length;
|
||||
|
||||
|
||||
/* Get the unicode string length. */
|
||||
unicode_string_length = ((ULONG) *object_pointer * 2) + 1;
|
||||
|
||||
@ -213,7 +213,7 @@ UINT status;
|
||||
_ux_utility_memory_copy(object -> ux_host_class_pima_object_keywords, object_pointer, unicode_string_length); /* Use case of memcpy is verified. */
|
||||
|
||||
/* Make the object closed. */
|
||||
object -> ux_host_class_pima_object_state = UX_HOST_CLASS_PIMA_OBJECT_STATE_CLOSED;
|
||||
object -> ux_host_class_pima_object_state = UX_HOST_CLASS_PIMA_OBJECT_STATE_CLOSED;
|
||||
|
||||
/* Reset the reading\writing offset */
|
||||
object -> ux_host_class_pima_object_offset = 0;
|
||||
@ -229,10 +229,62 @@ UINT status;
|
||||
}
|
||||
}
|
||||
|
||||
/* Free the original object info buffer. */
|
||||
/* Free the original object info buffer. */
|
||||
_ux_utility_memory_free(object_buffer);
|
||||
|
||||
|
||||
/* Return completion status. */
|
||||
return(status);
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _uxe_host_class_pima_object_info_get PORTABLE C */
|
||||
/* 6.x */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Yajun Xia, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This function checks errors in pima object info get function call. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* pima Pointer to pima class */
|
||||
/* pima_session Pointer to pima session */
|
||||
/* object_handle The object handle */
|
||||
/* object Object structure to fill */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* Completion Status */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _ux_host_class_pima_object_info_get Get pima object info */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* USB application */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* xx-xx-xxxx Yajun xia Initial Version 6.x */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _uxe_host_class_pima_object_info_get(UX_HOST_CLASS_PIMA *pima,
|
||||
UX_HOST_CLASS_PIMA_SESSION *pima_session,
|
||||
ULONG object_handle, UX_HOST_CLASS_PIMA_OBJECT *object)
|
||||
{
|
||||
|
||||
/* Sanity checks. */
|
||||
if ((pima == UX_NULL) || (pima_session == UX_NULL) || (object == UX_NULL))
|
||||
return(UX_INVALID_PARAMETER);
|
||||
|
||||
/* Call the actual pima object info get function. */
|
||||
return(_ux_host_class_pima_object_info_get(pima, pima_session, object_handle, object));
|
||||
}
|
@ -12,8 +12,8 @@
|
||||
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/** */
|
||||
/** USBX Component */
|
||||
/** */
|
||||
/** USBX Component */
|
||||
/** */
|
||||
/** PIMA Class */
|
||||
/** */
|
||||
@ -30,49 +30,49 @@
|
||||
#include "ux_host_stack.h"
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _ux_host_class_pima_object_info_send PORTABLE C */
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _ux_host_class_pima_object_info_send PORTABLE C */
|
||||
/* 6.1 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Chaoqiong Xiao, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This function sends an object information block prior to sending */
|
||||
/* a new object. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* pima Pointer to pima class */
|
||||
/* pima_session Pointer to pima session */
|
||||
/* storage_id StorageID where to store */
|
||||
/* parent_object_id Parent object id */
|
||||
/* object Object info structure */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* Completion Status */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* */
|
||||
/* This function sends an object information block prior to sending */
|
||||
/* a new object. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* pima Pointer to pima class */
|
||||
/* pima_session Pointer to pima session */
|
||||
/* storage_id StorageID where to store */
|
||||
/* parent_object_id Parent object id */
|
||||
/* object Object info structure */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* Completion Status */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _ux_host_class_pima_command Pima command function */
|
||||
/* _ux_utility_memory_allocate Allocate memory */
|
||||
/* _ux_utility_memory_allocate Allocate memory */
|
||||
/* _ux_utility_memory_copy Copy memory */
|
||||
/* _ux_utility_memory_free Free allocated memory */
|
||||
/* _ux_utility_memory_free Free allocated memory */
|
||||
/* _ux_utility_descriptor_pack Pack descriptor */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* USB application */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* USB application */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
|
||||
/* 09-30-2020 Chaoqiong Xiao Modified comment(s), */
|
||||
/* verified memset and memcpy */
|
||||
@ -80,9 +80,9 @@
|
||||
/* resulting in version 6.1 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _ux_host_class_pima_object_info_send(UX_HOST_CLASS_PIMA *pima,
|
||||
UINT _ux_host_class_pima_object_info_send(UX_HOST_CLASS_PIMA *pima,
|
||||
UX_HOST_CLASS_PIMA_SESSION *pima_session,
|
||||
ULONG storage_id,
|
||||
ULONG storage_id,
|
||||
ULONG parent_object_id,
|
||||
UX_HOST_CLASS_PIMA_OBJECT *object)
|
||||
{
|
||||
@ -108,13 +108,13 @@ UINT status;
|
||||
|
||||
/* Issue command to set the object info. 2 parameter. */
|
||||
command.ux_host_class_pima_command_nb_parameters = 2;
|
||||
|
||||
|
||||
/* Parameter 1 is the Storage ID. */
|
||||
command.ux_host_class_pima_command_parameter_1 = storage_id;
|
||||
|
||||
|
||||
/* Parameter 2 is the Parent Object ID. */
|
||||
command.ux_host_class_pima_command_parameter_2 = parent_object_id;
|
||||
|
||||
|
||||
/* Other parameters unused. */
|
||||
command.ux_host_class_pima_command_parameter_3 = 0;
|
||||
command.ux_host_class_pima_command_parameter_4 = 0;
|
||||
@ -132,14 +132,14 @@ UINT status;
|
||||
object_buffer_end = object_buffer + UX_HOST_CLASS_PIMA_OBJECT_MAX_LENGTH;
|
||||
|
||||
/* The object info structure coming from the application needs to be packed. */
|
||||
_ux_utility_descriptor_pack((UCHAR *) object,
|
||||
_ux_utility_descriptor_pack((UCHAR *) object,
|
||||
_ux_system_class_pima_object_structure,
|
||||
UX_HOST_CLASS_PIMA_OBJECT_ENTRIES,
|
||||
object_buffer);
|
||||
|
||||
/* Copy the object filename field. Point to the beginning of the object description string. */
|
||||
object_pointer = object_buffer + UX_HOST_CLASS_PIMA_OBJECT_VARIABLE_OFFSET;
|
||||
|
||||
|
||||
/* Get the unicode string length for the filename. */
|
||||
unicode_string_length = ((ULONG) *object -> ux_host_class_pima_object_filename * 2) + 1;
|
||||
|
||||
@ -153,7 +153,7 @@ UINT status;
|
||||
|
||||
/* Continue. */
|
||||
status = UX_SUCCESS;
|
||||
|
||||
|
||||
/* Is there enough space? */
|
||||
if (status == UX_SUCCESS)
|
||||
{
|
||||
@ -163,7 +163,7 @@ UINT status;
|
||||
|
||||
/* Point to the next field. */
|
||||
object_pointer += unicode_string_length;
|
||||
|
||||
|
||||
/* Get the unicode string length of the capture date. */
|
||||
unicode_string_length = ((ULONG) *object -> ux_host_class_pima_object_capture_date * 2) + 1;
|
||||
|
||||
@ -183,7 +183,7 @@ UINT status;
|
||||
|
||||
/* Point to the next field. */
|
||||
object_pointer += unicode_string_length;
|
||||
|
||||
|
||||
/* Get the unicode string length. */
|
||||
unicode_string_length = ((ULONG) *object -> ux_host_class_pima_object_modification_date * 2) + 1;
|
||||
|
||||
@ -203,7 +203,7 @@ UINT status;
|
||||
|
||||
/* Point to the next field. */
|
||||
object_pointer += unicode_string_length;
|
||||
|
||||
|
||||
/* Get the unicode string length. */
|
||||
unicode_string_length = ((ULONG) *object -> ux_host_class_pima_object_keywords * 2) + 1;
|
||||
|
||||
@ -223,17 +223,17 @@ UINT status;
|
||||
|
||||
/* Point to the next field. */
|
||||
object_pointer += unicode_string_length;
|
||||
|
||||
|
||||
/* Calculate the length of the payload. */
|
||||
object_info_length = (ULONG ) (object_pointer - object_buffer);
|
||||
|
||||
/* Issue the command. */
|
||||
status = _ux_host_class_pima_command(pima, &command, UX_HOST_CLASS_PIMA_DATA_PHASE_OUT , object_buffer,
|
||||
status = _ux_host_class_pima_command(pima, &command, UX_HOST_CLASS_PIMA_DATA_PHASE_OUT , object_buffer,
|
||||
object_info_length, object_info_length);
|
||||
|
||||
/* If the status is OK, the device sent us the Object handle in the response. */
|
||||
if (status == UX_SUCCESS)
|
||||
|
||||
|
||||
/* Update the object handle. */
|
||||
object -> ux_host_class_pima_object_handle_id = command.ux_host_class_pima_command_parameter_2;
|
||||
}
|
||||
@ -247,10 +247,64 @@ UINT status;
|
||||
_ux_system_error_handler(UX_SYSTEM_LEVEL_THREAD, UX_SYSTEM_CONTEXT_CLASS, UX_MEMORY_INSUFFICIENT);
|
||||
}
|
||||
|
||||
/* Free the original object info buffer. */
|
||||
/* Free the original object info buffer. */
|
||||
_ux_utility_memory_free(object_buffer);
|
||||
|
||||
|
||||
/* Return completion status. */
|
||||
return(status);
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _uxe_host_class_pima_object_info_send PORTABLE C */
|
||||
/* 6.x */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Yajun Xia, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This function checks errors in pima object info send function call. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* pima Pointer to pima class */
|
||||
/* pima_session Pointer to pima session */
|
||||
/* storage_id StorageID where to store */
|
||||
/* parent_object_id Parent object id */
|
||||
/* object Object info structure */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* Completion Status */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _ux_host_class_pima_object_info_send Send pima device info */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* USB application */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* xx-xx-xxxx Yajun xia Initial Version 6.x */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _uxe_host_class_pima_object_info_send(UX_HOST_CLASS_PIMA *pima,
|
||||
UX_HOST_CLASS_PIMA_SESSION *pima_session,
|
||||
ULONG storage_id,
|
||||
ULONG parent_object_id,
|
||||
UX_HOST_CLASS_PIMA_OBJECT *object)
|
||||
{
|
||||
|
||||
/* Sanity Checks. */
|
||||
if ((pima == UX_NULL) || (pima_session == UX_NULL) || (object == UX_NULL))
|
||||
return(UX_INVALID_PARAMETER);
|
||||
|
||||
return(_ux_host_class_pima_object_info_send(pima, pima_session, storage_id, parent_object_id, object));
|
||||
}
|
||||
|
@ -12,8 +12,8 @@
|
||||
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/** */
|
||||
/** USBX Component */
|
||||
/** */
|
||||
/** USBX Component */
|
||||
/** */
|
||||
/** PIMA Class */
|
||||
/** */
|
||||
@ -30,48 +30,48 @@
|
||||
#include "ux_host_stack.h"
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _ux_host_class_pima_object_open PORTABLE C */
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _ux_host_class_pima_object_open PORTABLE C */
|
||||
/* 6.1 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Chaoqiong Xiao, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This function opens an object for a read or write operation */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* pima Pointer to pima class */
|
||||
/* pima_session Pointer to pima session */
|
||||
/* object_handle The object handle */
|
||||
/* object Pointer to object info */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* Completion Status */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* */
|
||||
/* This function opens an object for a read or write operation */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* pima Pointer to pima class */
|
||||
/* pima_session Pointer to pima session */
|
||||
/* object_handle The object handle */
|
||||
/* object Pointer to object info */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* Completion Status */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* None */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* USB application */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* USB application */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
|
||||
/* 09-30-2020 Chaoqiong Xiao Modified comment(s), */
|
||||
/* resulting in version 6.1 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _ux_host_class_pima_object_open(UX_HOST_CLASS_PIMA *pima,
|
||||
UINT _ux_host_class_pima_object_open(UX_HOST_CLASS_PIMA *pima,
|
||||
UX_HOST_CLASS_PIMA_SESSION *pima_session,
|
||||
ULONG object_handle, UX_HOST_CLASS_PIMA_OBJECT *object)
|
||||
{
|
||||
@ -89,18 +89,70 @@ UINT _ux_host_class_pima_object_open(UX_HOST_CLASS_PIMA *pima,
|
||||
|
||||
/* Check if the object is already opened. */
|
||||
if (object -> ux_host_class_pima_object_state != UX_HOST_CLASS_PIMA_OBJECT_STATE_CLOSED)
|
||||
return (UX_HOST_CLASS_PIMA_RC_OBJECT_ALREADY_OPENED);
|
||||
return (UX_HOST_CLASS_PIMA_RC_OBJECT_ALREADY_OPENED);
|
||||
|
||||
/* Open the object. */
|
||||
object -> ux_host_class_pima_object_state = UX_HOST_CLASS_PIMA_OBJECT_STATE_OPENED;
|
||||
|
||||
/* Reset the object offset. */
|
||||
object -> ux_host_class_pima_object_offset = 0;
|
||||
|
||||
|
||||
/* Set the object transfer status to inactive. */
|
||||
object -> ux_host_class_pima_object_transfer_status = UX_HOST_CLASS_PIMA_OBJECT_TRANSFER_STATUS_INACTIVE;
|
||||
|
||||
|
||||
/* Return completion status. */
|
||||
return(UX_SUCCESS);
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _uxe_host_class_pima_object_open PORTABLE C */
|
||||
/* 6.x */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Yajun Xia, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This function checks errors in pima object open function call. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* pima Pointer to pima class */
|
||||
/* pima_session Pointer to pima session */
|
||||
/* object_handle The object handle */
|
||||
/* object Pointer to object info */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* Completion Status */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _ux_host_class_pima_object_open Open pima object */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* USB application */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* xx-xx-xxxx Yajun xia Initial Version 6.x */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _uxe_host_class_pima_object_open(UX_HOST_CLASS_PIMA *pima,
|
||||
UX_HOST_CLASS_PIMA_SESSION *pima_session,
|
||||
ULONG object_handle, UX_HOST_CLASS_PIMA_OBJECT *object)
|
||||
{
|
||||
|
||||
/* Sanity checks. */
|
||||
if ((pima == UX_NULL) || (pima_session == UX_NULL) || (object == UX_NULL))
|
||||
return (UX_INVALID_PARAMETER);
|
||||
|
||||
/* Call the actual pima object open function. */
|
||||
return (_ux_host_class_pima_object_open(pima, pima_session, object_handle, object));
|
||||
}
|
@ -12,8 +12,8 @@
|
||||
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/** */
|
||||
/** USBX Component */
|
||||
/** */
|
||||
/** USBX Component */
|
||||
/** */
|
||||
/** PIMA Class */
|
||||
/** */
|
||||
@ -30,53 +30,53 @@
|
||||
#include "ux_host_stack.h"
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _ux_host_class_pima_object_send PORTABLE C */
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _ux_host_class_pima_object_send PORTABLE C */
|
||||
/* 6.1.10 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Chaoqiong Xiao, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This function sends an object to the media. This commands should be */
|
||||
/* be proceeded by a object_info_send command. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* pima Pointer to pima class */
|
||||
/* pima_session Pointer to pima session */
|
||||
/* object Pointer to object info */
|
||||
/* object_buffer Buffer to be used */
|
||||
/* object_buffer_length Buffer length */
|
||||
/* callback_function Application function to */
|
||||
/* callback when buffer */
|
||||
/* needs to be written */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* Completion Status */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* */
|
||||
/* This function sends an object to the media. This commands should be */
|
||||
/* be proceeded by a object_info_send command. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* pima Pointer to pima class */
|
||||
/* pima_session Pointer to pima session */
|
||||
/* object Pointer to object info */
|
||||
/* object_buffer Buffer to be used */
|
||||
/* object_buffer_length Buffer length */
|
||||
/* callback_function Application function to */
|
||||
/* callback when buffer */
|
||||
/* needs to be written */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* Completion Status */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _ux_host_stack_transfer_request Transfer request */
|
||||
/* _ux_host_stack_transfer_request_abort Abort transfer */
|
||||
/* _ux_host_stack_endpoint_reset Reset endpoint */
|
||||
/* _ux_host_semaphore_get Get semaphore */
|
||||
/* _ux_utility_long_put Put 32-bit value */
|
||||
/* _ux_utility_short_put Put 16-bit value */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* USB application */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* USB application */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
|
||||
/* 09-30-2020 Chaoqiong Xiao Modified comment(s), */
|
||||
/* prefixed UX to MS_TO_TICK, */
|
||||
@ -88,7 +88,7 @@
|
||||
/* resulting in version 6.1.10 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _ux_host_class_pima_object_send(UX_HOST_CLASS_PIMA *pima,
|
||||
UINT _ux_host_class_pima_object_send(UX_HOST_CLASS_PIMA *pima,
|
||||
UX_HOST_CLASS_PIMA_SESSION *pima_session,
|
||||
UX_HOST_CLASS_PIMA_OBJECT *object,
|
||||
UCHAR *object_buffer, ULONG object_buffer_length)
|
||||
@ -114,12 +114,12 @@ UINT status;
|
||||
|
||||
/* Check if the object is already opened. */
|
||||
if (object -> ux_host_class_pima_object_state != UX_HOST_CLASS_PIMA_OBJECT_STATE_OPENED)
|
||||
return (UX_HOST_CLASS_PIMA_RC_OBJECT_NOT_OPENED);
|
||||
return (UX_HOST_CLASS_PIMA_RC_OBJECT_NOT_OPENED);
|
||||
|
||||
/* Check the transfer status. If there was an error or transfer is completed, refuse transfer. */
|
||||
if ((object -> ux_host_class_pima_object_transfer_status == UX_HOST_CLASS_PIMA_OBJECT_TRANSFER_STATUS_COMPLETED) ||
|
||||
(object -> ux_host_class_pima_object_transfer_status == UX_HOST_CLASS_PIMA_OBJECT_TRANSFER_STATUS_ABORTED))
|
||||
return (UX_HOST_CLASS_PIMA_RC_ACCESS_DENIED);
|
||||
return (UX_HOST_CLASS_PIMA_RC_ACCESS_DENIED);
|
||||
|
||||
/* This variable will remain untouched if the offset is not 0 and the requested length is 0. */
|
||||
status = UX_SUCCESS;
|
||||
@ -133,30 +133,30 @@ UINT status;
|
||||
|
||||
/* Issue command to get the object info. no parameter. */
|
||||
command.ux_host_class_pima_command_nb_parameters = 0;
|
||||
|
||||
|
||||
/* Then set the command to SEND_OBJECT. */
|
||||
command.ux_host_class_pima_command_operation_code = UX_HOST_CLASS_PIMA_OC_SEND_OBJECT;
|
||||
|
||||
|
||||
/* We use the Bulk Out pipe for sending command out.. */
|
||||
transfer_request = &pima -> ux_host_class_pima_bulk_out_endpoint -> ux_endpoint_transfer_request;
|
||||
|
||||
|
||||
/* Get the pointer to the ptp payload. */
|
||||
ptp_payload = pima -> ux_host_class_pima_container ;
|
||||
|
||||
|
||||
/* Calculate the requested length for this payload. */
|
||||
requested_length = UX_HOST_CLASS_PIMA_COMMAND_HEADER_SIZE + ((ULONG)sizeof(ULONG) * command.ux_host_class_pima_command_nb_parameters);
|
||||
requested_length = UX_HOST_CLASS_PIMA_COMMAND_HEADER_SIZE + ((ULONG)sizeof(ULONG) * command.ux_host_class_pima_command_nb_parameters);
|
||||
|
||||
/* Fill the command container. First the length of the total header and payload. */
|
||||
_ux_utility_long_put(ptp_payload + UX_HOST_CLASS_PIMA_COMMAND_HEADER_LENGTH, requested_length);
|
||||
|
||||
|
||||
/* Then the type of container : a command block here. */
|
||||
_ux_utility_short_put(ptp_payload + UX_HOST_CLASS_PIMA_COMMAND_HEADER_TYPE, UX_HOST_CLASS_PIMA_CT_COMMAND_BLOCK);
|
||||
|
||||
|
||||
/* Now the command code to send. */
|
||||
_ux_utility_short_put(ptp_payload + UX_HOST_CLASS_PIMA_COMMAND_HEADER_CODE, (USHORT)command.ux_host_class_pima_command_operation_code);
|
||||
|
||||
/* Put the transaction ID. */
|
||||
_ux_utility_long_put(ptp_payload + UX_HOST_CLASS_PIMA_COMMAND_HEADER_TRANSACTION_ID,
|
||||
_ux_utility_long_put(ptp_payload + UX_HOST_CLASS_PIMA_COMMAND_HEADER_TRANSACTION_ID,
|
||||
pima -> ux_host_class_pima_transaction_id++);
|
||||
|
||||
/* Initialize the transfer_request. */
|
||||
@ -169,7 +169,7 @@ UINT status;
|
||||
/* If the transfer is successful, we need to wait for the transfer request to be completed. */
|
||||
if (status == UX_SUCCESS)
|
||||
{
|
||||
|
||||
|
||||
/* Wait for the completion of the transfer request. */
|
||||
status = _ux_host_semaphore_get(&transfer_request -> ux_transfer_request_semaphore, UX_MS_TO_TICK(UX_HOST_CLASS_PIMA_CLASS_TRANSFER_TIMEOUT));
|
||||
|
||||
@ -185,13 +185,13 @@ UINT status;
|
||||
|
||||
/* The endpoint was halted by a transfer error and needs to be reset. */
|
||||
_ux_host_stack_endpoint_reset(pima -> ux_host_class_pima_bulk_out_endpoint);
|
||||
|
||||
|
||||
/* Set the object transfer status to aborted. */
|
||||
object -> ux_host_class_pima_object_transfer_status = UX_HOST_CLASS_PIMA_OBJECT_TRANSFER_STATUS_ABORTED;
|
||||
|
||||
/* There was an error, return to the caller. */
|
||||
return(status);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -205,37 +205,37 @@ UINT status;
|
||||
if (requested_length == transfer_request -> ux_transfer_request_actual_length)
|
||||
{
|
||||
|
||||
/* Send the first packet. This packet contains the header and some data.
|
||||
/* Send the first packet. This packet contains the header and some data.
|
||||
We use the Bulk Out pipe for sending data .. */
|
||||
transfer_request = &pima -> ux_host_class_pima_bulk_out_endpoint -> ux_endpoint_transfer_request;
|
||||
|
||||
|
||||
/* Get the pointer to the ptp payload. */
|
||||
ptp_payload = pima -> ux_host_class_pima_container ;
|
||||
|
||||
|
||||
/* Container type is a data type. */
|
||||
*(ptp_payload + UX_HOST_CLASS_PIMA_DATA_HEADER_TYPE) = UX_HOST_CLASS_PIMA_CT_DATA_BLOCK;
|
||||
|
||||
|
||||
/* Fill in the header values. Start with the length of the container. */
|
||||
_ux_utility_long_put(ptp_payload + UX_HOST_CLASS_PIMA_DATA_HEADER_LENGTH,
|
||||
_ux_utility_long_put(ptp_payload + UX_HOST_CLASS_PIMA_DATA_HEADER_LENGTH,
|
||||
object -> ux_host_class_pima_object_compressed_size + UX_HOST_CLASS_PIMA_DATA_HEADER_SIZE);
|
||||
|
||||
/* If the total payload is on a boundary, we need a ZLP to mark the end. */
|
||||
if (((object -> ux_host_class_pima_object_compressed_size + UX_HOST_CLASS_PIMA_DATA_HEADER_SIZE) %
|
||||
if (((object -> ux_host_class_pima_object_compressed_size + UX_HOST_CLASS_PIMA_DATA_HEADER_SIZE) %
|
||||
pima -> ux_host_class_pima_bulk_out_endpoint-> ux_endpoint_descriptor.wMaxPacketSize) == 0)
|
||||
|
||||
|
||||
/* We have a ZLP condition. */
|
||||
pima -> ux_host_class_pima_zlp_flag = UX_HOST_CLASS_PIMA_ZLP_OUT;
|
||||
else
|
||||
|
||||
|
||||
/* Do not expect a ZLP. */
|
||||
pima -> ux_host_class_pima_zlp_flag = UX_HOST_CLASS_PIMA_ZLP_NONE;
|
||||
|
||||
|
||||
/* Calculate the requested length for this payload. */
|
||||
requested_length = UX_HOST_CLASS_PIMA_CONTAINER_SIZE;
|
||||
|
||||
/* Check to see if we have enough to fill the first packet. */
|
||||
if (requested_length > (UX_HOST_CLASS_PIMA_DATA_HEADER_SIZE + object_buffer_length))
|
||||
|
||||
|
||||
/* This is a small object, enough to fit into the fist packet. */
|
||||
requested_length = UX_HOST_CLASS_PIMA_DATA_HEADER_SIZE + object_buffer_length;
|
||||
|
||||
@ -245,31 +245,31 @@ UINT status;
|
||||
|
||||
/* Update the offset. */
|
||||
object -> ux_host_class_pima_object_offset += requested_length - UX_HOST_CLASS_PIMA_DATA_HEADER_SIZE;
|
||||
|
||||
|
||||
/* And the current object buffer pointer. */
|
||||
object_buffer += requested_length - UX_HOST_CLASS_PIMA_DATA_HEADER_SIZE;
|
||||
|
||||
object_buffer += requested_length - UX_HOST_CLASS_PIMA_DATA_HEADER_SIZE;
|
||||
|
||||
/* Adjust the remaining buffer length. */
|
||||
object_buffer_length -= requested_length - UX_HOST_CLASS_PIMA_DATA_HEADER_SIZE;
|
||||
object_buffer_length -= requested_length - UX_HOST_CLASS_PIMA_DATA_HEADER_SIZE;
|
||||
|
||||
/* Initialize the transfer_request. */
|
||||
transfer_request -> ux_transfer_request_data_pointer = ptp_payload;
|
||||
transfer_request -> ux_transfer_request_requested_length = requested_length;
|
||||
|
||||
|
||||
/* Send request to HCD layer. */
|
||||
status = _ux_host_stack_transfer_request(transfer_request);
|
||||
|
||||
|
||||
/* If the transfer is successful, we need to wait for the transfer request to be completed. */
|
||||
if (status == UX_SUCCESS)
|
||||
{
|
||||
|
||||
|
||||
/* Wait for the completion of the transfer request. */
|
||||
status = _ux_host_semaphore_get(&transfer_request -> ux_transfer_request_semaphore, UX_MS_TO_TICK(UX_HOST_CLASS_PIMA_CLASS_TRANSFER_TIMEOUT));
|
||||
|
||||
|
||||
/* If the semaphore did not succeed we probably have a time out. */
|
||||
if (status != UX_SUCCESS)
|
||||
{
|
||||
|
||||
|
||||
/* All transfers pending need to abort. There may have been a partial transfer. */
|
||||
_ux_host_stack_transfer_request_abort(transfer_request);
|
||||
|
||||
@ -278,22 +278,22 @@ UINT status;
|
||||
|
||||
/* The endpoint was halted by a transfer error and needs to be reset. */
|
||||
_ux_host_stack_endpoint_reset(pima -> ux_host_class_pima_bulk_out_endpoint);
|
||||
|
||||
|
||||
/* Set the object transfer status to aborted. */
|
||||
object -> ux_host_class_pima_object_transfer_status = UX_HOST_CLASS_PIMA_OBJECT_TRANSFER_STATUS_ABORTED;
|
||||
|
||||
/* There was an error, return to the caller. */
|
||||
return(status);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
|
||||
/* There was a non transfer error, no partial transfer to be checked */
|
||||
return(status);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
|
||||
@ -311,36 +311,36 @@ UINT status;
|
||||
|
||||
/* It may take several transactions. */
|
||||
if (object_buffer_length > UX_HOST_CLASS_PIMA_MAX_PAYLOAD)
|
||||
|
||||
|
||||
/* Set the requested length to the payload maximum. */
|
||||
requested_length = UX_HOST_CLASS_PIMA_MAX_PAYLOAD;
|
||||
|
||||
|
||||
else
|
||||
|
||||
|
||||
/* We can use the user supplied length to complete this request. */
|
||||
requested_length = object_buffer_length;
|
||||
|
||||
|
||||
/* Initialize the transfer_request. */
|
||||
transfer_request -> ux_transfer_request_data_pointer = object_buffer;
|
||||
transfer_request -> ux_transfer_request_requested_length = requested_length;
|
||||
|
||||
|
||||
/* Send request to HCD layer. */
|
||||
status = _ux_host_stack_transfer_request(transfer_request);
|
||||
|
||||
|
||||
/* If the transfer is successful, we need to wait for the transfer request to be completed. */
|
||||
if (status == UX_SUCCESS)
|
||||
{
|
||||
|
||||
|
||||
/* Wait for the completion of the transfer request. */
|
||||
status = _ux_host_semaphore_get(&transfer_request -> ux_transfer_request_semaphore, UX_MS_TO_TICK(UX_HOST_CLASS_PIMA_CLASS_TRANSFER_TIMEOUT));
|
||||
|
||||
|
||||
/* If the semaphore did not succeed we probably have a time out. */
|
||||
if (status != UX_SUCCESS)
|
||||
{
|
||||
|
||||
|
||||
/* All transfers pending need to abort. There may have been a partial transfer. */
|
||||
_ux_host_stack_transfer_request_abort(transfer_request);
|
||||
|
||||
|
||||
/* The endpoint was halted by a transfer error and needs to be reset. */
|
||||
_ux_host_stack_endpoint_reset(pima -> ux_host_class_pima_bulk_in_endpoint);
|
||||
|
||||
@ -352,33 +352,90 @@ UINT status;
|
||||
|
||||
/* There was an error, return to the caller. */
|
||||
return(status);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
|
||||
/* There was a non transfer error, no partial transfer to be checked */
|
||||
return(status);
|
||||
}
|
||||
|
||||
|
||||
/* Update the object length expected by the user with what we actually sent. */
|
||||
object_buffer_length -= transfer_request -> ux_transfer_request_actual_length;
|
||||
|
||||
|
||||
/* And the offset. */
|
||||
object -> ux_host_class_pima_object_offset += transfer_request -> ux_transfer_request_actual_length;
|
||||
|
||||
|
||||
/* And the object buffer pointer . */
|
||||
object_buffer += transfer_request -> ux_transfer_request_actual_length;
|
||||
|
||||
/* Check to see if we are at the end of the object. */
|
||||
if (object -> ux_host_class_pima_object_offset == object -> ux_host_class_pima_object_compressed_size)
|
||||
|
||||
|
||||
/* The transfer for this transaction is completed. */
|
||||
object -> ux_host_class_pima_object_transfer_status = UX_HOST_CLASS_PIMA_OBJECT_TRANSFER_STATUS_COMPLETED;
|
||||
|
||||
|
||||
}
|
||||
|
||||
/* Return completion status. */
|
||||
return(status);
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _uxe_host_class_pima_object_send PORTABLE C */
|
||||
/* 6.x */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Yajun Xia, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This function checks errors in pima object send function call. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* pima Pointer to pima class */
|
||||
/* pima_session Pointer to pima session */
|
||||
/* object Pointer to object info */
|
||||
/* object_buffer Buffer to be used */
|
||||
/* object_buffer_length Buffer length */
|
||||
/* callback_function Application function to */
|
||||
/* callback when buffer */
|
||||
/* needs to be written */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* Completion Status */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _ux_host_class_pima_object_send Send pima object */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* USB application */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* xx-xx-xxxx Yajun xia Initial Version 6.x */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _uxe_host_class_pima_object_send(UX_HOST_CLASS_PIMA *pima,
|
||||
UX_HOST_CLASS_PIMA_SESSION *pima_session,
|
||||
UX_HOST_CLASS_PIMA_OBJECT *object,
|
||||
UCHAR *object_buffer, ULONG object_buffer_length)
|
||||
{
|
||||
|
||||
/* Sanity checks. */
|
||||
if ((pima == UX_NULL) || (pima_session == UX_NULL) || (object == UX_NULL) || (object_buffer == UX_NULL))
|
||||
return(UX_INVALID_PARAMETER);
|
||||
|
||||
/* Call the actual pima object send function. */
|
||||
return(_ux_host_class_pima_object_send(pima, pima_session, object, object_buffer, object_buffer_length));
|
||||
}
|
@ -12,8 +12,8 @@
|
||||
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/** */
|
||||
/** USBX Component */
|
||||
/** */
|
||||
/** USBX Component */
|
||||
/** */
|
||||
/** PIMA Class */
|
||||
/** */
|
||||
@ -30,48 +30,48 @@
|
||||
#include "ux_host_stack.h"
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _ux_host_class_pima_object_transfer_abort PORTABLE C */
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _ux_host_class_pima_object_transfer_abort PORTABLE C */
|
||||
/* 6.1 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Chaoqiong Xiao, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This function aborts a pending transfer to\from an object. */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* pima Pointer to pima class */
|
||||
/* pima_session Pointer to pima session */
|
||||
/* object_handle The object handle */
|
||||
/* object Pointer to object info */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* Completion Status */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* */
|
||||
/* This function aborts a pending transfer to\from an object. */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* pima Pointer to pima class */
|
||||
/* pima_session Pointer to pima session */
|
||||
/* object_handle The object handle */
|
||||
/* object Pointer to object info */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* Completion Status */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _ux_host_class_pima_request_cancel Cancel request */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* USB application */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* USB application */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
|
||||
/* 09-30-2020 Chaoqiong Xiao Modified comment(s), */
|
||||
/* resulting in version 6.1 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _ux_host_class_pima_object_transfer_abort(UX_HOST_CLASS_PIMA *pima,
|
||||
UINT _ux_host_class_pima_object_transfer_abort(UX_HOST_CLASS_PIMA *pima,
|
||||
UX_HOST_CLASS_PIMA_SESSION *pima_session,
|
||||
ULONG object_handle, UX_HOST_CLASS_PIMA_OBJECT *object)
|
||||
{
|
||||
@ -93,11 +93,11 @@ UINT status;
|
||||
|
||||
/* Check if the object is already closed. */
|
||||
if (object -> ux_host_class_pima_object_state != UX_HOST_CLASS_PIMA_OBJECT_STATE_OPENED)
|
||||
return (UX_HOST_CLASS_PIMA_RC_OBJECT_ALREADY_CLOSED );
|
||||
return (UX_HOST_CLASS_PIMA_RC_OBJECT_ALREADY_CLOSED );
|
||||
|
||||
/* Cancel the current request. */
|
||||
status = _ux_host_class_pima_request_cancel(pima);
|
||||
|
||||
|
||||
/* The transfer for this transaction was aborted. No need to issue a status phase when the object is closed. */
|
||||
object -> ux_host_class_pima_object_transfer_status = UX_HOST_CLASS_PIMA_OBJECT_TRANSFER_STATUS_ABORTED;
|
||||
|
||||
@ -108,3 +108,56 @@ UINT status;
|
||||
return(status);
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _uxe_host_class_pima_object_transfer_abort PORTABLE C */
|
||||
/* 6.x */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Yajun Xia, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This function checks errors in pima object transfer abort function */
|
||||
/* call. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* pima Pointer to pima class */
|
||||
/* pima_session Pointer to pima session */
|
||||
/* object_handle The object handle */
|
||||
/* object Pointer to object info */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* Completion Status */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _ux_host_class_pima_object_transfer_abort Transfer abort */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* USB application */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* xx-xx-xxxx Yajun xia Initial Version 6.x */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _uxe_host_class_pima_object_transfer_abort(UX_HOST_CLASS_PIMA *pima,
|
||||
UX_HOST_CLASS_PIMA_SESSION *pima_session,
|
||||
ULONG object_handle, UX_HOST_CLASS_PIMA_OBJECT *object)
|
||||
{
|
||||
|
||||
/* Sanity checks. */
|
||||
if ((pima == UX_NULL) || (pima_session == UX_NULL) || (object == UX_NULL))
|
||||
return(UX_INVALID_PARAMETER);
|
||||
|
||||
/* Call the actual pima object transfer abort function. */
|
||||
return(_ux_host_class_pima_object_transfer_abort(pima, pima_session, object_handle, object));
|
||||
}
|
@ -12,8 +12,8 @@
|
||||
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/** */
|
||||
/** USBX Component */
|
||||
/** */
|
||||
/** USBX Component */
|
||||
/** */
|
||||
/** PIMA Class */
|
||||
/** */
|
||||
@ -30,43 +30,46 @@
|
||||
#include "ux_host_stack.h"
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _ux_host_class_pima_session_close PORTABLE C */
|
||||
/* 6.1 */
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _ux_host_class_pima_session_close PORTABLE C */
|
||||
/* 6.x */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Chaoqiong Xiao, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This function closes a session with the PIMA device. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* pima Pointer to pima class */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* Completion Status */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* */
|
||||
/* This function closes a session with the PIMA device. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* pima Pointer to pima class */
|
||||
/* pima_session Pointer to pima session */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* Completion Status */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _ux_host_class_pima_command Pima command function */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* USB application */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* USB application */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
|
||||
/* 09-30-2020 Chaoqiong Xiao Modified comment(s), */
|
||||
/* resulting in version 6.1 */
|
||||
/* xx-xx-xxxx Yajun xia Modified comment(s), */
|
||||
/* resulting in version 6.x */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _ux_host_class_pima_session_close(UX_HOST_CLASS_PIMA *pima, UX_HOST_CLASS_PIMA_SESSION *pima_session)
|
||||
@ -88,10 +91,10 @@ UINT status;
|
||||
|
||||
/* The transaction ID in the PIMA instance should be reset. */
|
||||
pima -> ux_host_class_pima_transaction_id = 0;
|
||||
|
||||
|
||||
/* Issue command to close the session with the PIMA device. No parameter. */
|
||||
command.ux_host_class_pima_command_nb_parameters = 0;
|
||||
|
||||
|
||||
/* Then set the command to CLOSE_SESSION. */
|
||||
command.ux_host_class_pima_command_operation_code = UX_HOST_CLASS_PIMA_OC_CLOSE_SESSION;
|
||||
|
||||
@ -111,15 +114,63 @@ UINT status;
|
||||
|
||||
/* Reset the PIMA session in the pima instance. */
|
||||
pima -> ux_host_class_pima_session = UX_NULL;
|
||||
|
||||
|
||||
/* Reset the magic field. */
|
||||
pima_session -> ux_host_class_pima_session_magic = 0;
|
||||
|
||||
|
||||
/* Mark the session as closed. */
|
||||
pima_session -> ux_host_class_pima_session_state = UX_HOST_CLASS_PIMA_SESSION_STATE_CLOSED;
|
||||
}
|
||||
|
||||
|
||||
/* Return completion status. */
|
||||
return(status);
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _uxe_host_class_pima_session_close PORTABLE C */
|
||||
/* 6.x */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Yajun Xia, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This function checks errors in pima session close function call. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* pima Pointer to pima class */
|
||||
/* pima_session Pointer to pima session */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* Completion Status */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _ux_host_class_pima_session_close Close pima session */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* USB application */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* xx-xx-xxxx Yajun xia Initial Version 6.x */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _uxe_host_class_pima_session_close(UX_HOST_CLASS_PIMA *pima, UX_HOST_CLASS_PIMA_SESSION *pima_session)
|
||||
{
|
||||
|
||||
/* Sanity checks. */
|
||||
if ((pima == UX_NULL) || (pima_session == UX_NULL))
|
||||
return (UX_INVALID_PARAMETER);
|
||||
|
||||
/* Call the actual pima session close function. */
|
||||
return(_ux_host_class_pima_session_close(pima, pima_session));
|
||||
}
|
||||
|
@ -12,8 +12,8 @@
|
||||
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/** */
|
||||
/** USBX Component */
|
||||
/** */
|
||||
/** USBX Component */
|
||||
/** */
|
||||
/** PIMA Class */
|
||||
/** */
|
||||
@ -30,45 +30,48 @@
|
||||
#include "ux_host_stack.h"
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _ux_host_class_pima_session_open PORTABLE C */
|
||||
/* 6.1 */
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _ux_host_class_pima_session_open PORTABLE C */
|
||||
/* 6.x */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Chaoqiong Xiao, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This function opens a session with the PIMA device. The session */
|
||||
/* is maintained in this state until the session is closed or the */
|
||||
/* device is unmounted. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* pima Pointer to pima class */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* Completion Status */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* */
|
||||
/* This function opens a session with the PIMA device. The session */
|
||||
/* is maintained in this state until the session is closed or the */
|
||||
/* device is unmounted. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* pima Pointer to pima class */
|
||||
/* pima_session Pointer to pima session */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* Completion Status */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _ux_host_class_pima_command Pima command function */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* USB application */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* USB application */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
|
||||
/* 09-30-2020 Chaoqiong Xiao Modified comment(s), */
|
||||
/* resulting in version 6.1 */
|
||||
/* xx-xx-xxxx Yajun xia Modified comment(s), */
|
||||
/* resulting in version 6.x */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _ux_host_class_pima_session_open(UX_HOST_CLASS_PIMA *pima, UX_HOST_CLASS_PIMA_SESSION *pima_session)
|
||||
@ -86,16 +89,16 @@ ULONG status;
|
||||
|
||||
/* The transaction ID in the PIMA instance should be reset. */
|
||||
pima -> ux_host_class_pima_transaction_id = 0;
|
||||
|
||||
|
||||
/* Issue command to open the session with the PIMA device. First set the number of parameters. */
|
||||
command.ux_host_class_pima_command_nb_parameters = 1;
|
||||
|
||||
|
||||
/* Then set the command to OPEN_SESSION. */
|
||||
command.ux_host_class_pima_command_operation_code = UX_HOST_CLASS_PIMA_OC_OPEN_SESSION;
|
||||
|
||||
/* The session ID is the handle to the session. */
|
||||
command.ux_host_class_pima_command_parameter_1 = (ULONG) (ALIGN_TYPE) pima_session;
|
||||
|
||||
|
||||
/* Other parameters unused. */
|
||||
command.ux_host_class_pima_command_parameter_2 = 0;
|
||||
command.ux_host_class_pima_command_parameter_3 = 0;
|
||||
@ -112,19 +115,67 @@ ULONG status;
|
||||
/* Store the session pointer in the PIMA instance. The PIMA class instance
|
||||
only supports one opened session at a time at this stage. */
|
||||
pima -> ux_host_class_pima_session = pima_session;
|
||||
|
||||
|
||||
/* Save the session ID in the session container. This is not too useful since
|
||||
the session ID is the session structure address. */
|
||||
pima_session -> ux_host_class_pima_session_id = (ALIGN_TYPE) pima_session;
|
||||
|
||||
|
||||
/* Put the magic number in the session instance. */
|
||||
pima_session -> ux_host_class_pima_session_magic = UX_HOST_CLASS_PIMA_MAGIC_NUMBER;
|
||||
|
||||
/* Mark the session as opened. */
|
||||
pima_session -> ux_host_class_pima_session_state = UX_HOST_CLASS_PIMA_SESSION_STATE_OPENED;
|
||||
}
|
||||
|
||||
|
||||
/* Return completion status. */
|
||||
return(status);
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _uxe_host_class_pima_session_open PORTABLE C */
|
||||
/* 6.x */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Yajun Xia, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This function checks errors in pima session open function call. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* pima Pointer to pima class */
|
||||
/* pima_session Pointer to pima session */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* Completion Status */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _ux_host_class_pima_session_open Open pima session */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* USB application */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* xx-xx-xxxx Yajun xia Initial Version 6.x */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _uxe_host_class_pima_session_open(UX_HOST_CLASS_PIMA *pima, UX_HOST_CLASS_PIMA_SESSION *pima_session)
|
||||
{
|
||||
|
||||
/* Sanity checks. */
|
||||
if ((pima == UX_NULL) || (pima_session == UX_NULL))
|
||||
return(UX_INVALID_PARAMETER);
|
||||
|
||||
/* Call the actual pima session open function. */
|
||||
return(_ux_host_class_pima_session_open(pima, pima_session));
|
||||
}
|
@ -162,3 +162,57 @@ ULONG nb_storage_ids;
|
||||
/* Return completion status. */
|
||||
return(status);
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _uxe_host_class_pima_storage_ids_get PORTABLE C */
|
||||
/* 6.x */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Yajun Xia, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This function checks errors in pima session storage ids get */
|
||||
/* function call. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* pima Pointer to pima class */
|
||||
/* pima_session Pointer to pima session */
|
||||
/* storage_ids_array Pointer to buffer to */
|
||||
/* fill storage IDs */
|
||||
/* storage_id_length Array length in N of IDs */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* Completion Status */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _ux_host_class_pima_storage_ids_get Get pima storage ids */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* USB application */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* xx-xx-xxxx Yajun xia Initial Version 6.x */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _uxe_host_class_pima_storage_ids_get(UX_HOST_CLASS_PIMA *pima, UX_HOST_CLASS_PIMA_SESSION *pima_session,
|
||||
ULONG *storage_ids_array, ULONG storage_id_length)
|
||||
{
|
||||
|
||||
/* Check for invalid input pointers. */
|
||||
if ((pima == UX_NULL) || (pima_session == UX_NULL) || (storage_ids_array == UX_NULL))
|
||||
return(UX_INVALID_PARAMETER);
|
||||
|
||||
/* Call the actual pima storage ids get function. */
|
||||
return(_ux_host_class_pima_storage_ids_get(pima, pima_session, storage_ids_array, storage_id_length));
|
||||
}
|
@ -12,8 +12,8 @@
|
||||
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/** */
|
||||
/** USBX Component */
|
||||
/** */
|
||||
/** USBX Component */
|
||||
/** */
|
||||
/** PIMA Class */
|
||||
/** */
|
||||
@ -30,54 +30,57 @@
|
||||
#include "ux_host_stack.h"
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _ux_host_class_pima_storage_info_get PORTABLE C */
|
||||
/* 6.1 */
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _ux_host_class_pima_storage_info_get PORTABLE C */
|
||||
/* 6.x */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Chaoqiong Xiao, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This function gets the current storage information block. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* pima Pointer to pima class */
|
||||
/* pima_session Pointer to pima session */
|
||||
/* storage_id The storage ID */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* Completion Status */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* */
|
||||
/* This function gets the current storage information block. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* pima Pointer to pima class */
|
||||
/* pima_session Pointer to pima session */
|
||||
/* storage_id The storage ID */
|
||||
/* storage Pointer to storage */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* Completion Status */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _ux_host_class_pima_command Pima command function */
|
||||
/* _ux_utility_descriptor_parse Parse descriptor */
|
||||
/* _ux_utility_memory_allocate Allocate memory */
|
||||
/* _ux_utility_memory_copy Copy memory */
|
||||
/* _ux_utility_memory_free Free memory */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* USB application */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* USB application */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
|
||||
/* 09-30-2020 Chaoqiong Xiao Modified comment(s), */
|
||||
/* verified memset and memcpy */
|
||||
/* cases, */
|
||||
/* resulting in version 6.1 */
|
||||
/* xx-xx-xxxx Yajun xia Modified comment(s), */
|
||||
/* resulting in version 6.x */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _ux_host_class_pima_storage_info_get(UX_HOST_CLASS_PIMA *pima,
|
||||
UINT _ux_host_class_pima_storage_info_get(UX_HOST_CLASS_PIMA *pima,
|
||||
UX_HOST_CLASS_PIMA_SESSION *pima_session,
|
||||
ULONG storage_id, UX_HOST_CLASS_PIMA_STORAGE *storage)
|
||||
{
|
||||
@ -101,10 +104,10 @@ ULONG unicode_string_length;
|
||||
|
||||
/* Issue command to get the storage IDs. 1 parameter. */
|
||||
command.ux_host_class_pima_command_nb_parameters = 1;
|
||||
|
||||
|
||||
/* Parameter 1 is the Storage ID. */
|
||||
command.ux_host_class_pima_command_parameter_1 = storage_id;
|
||||
|
||||
|
||||
/* Other parameters unused. */
|
||||
command.ux_host_class_pima_command_parameter_2 = 0;
|
||||
command.ux_host_class_pima_command_parameter_3 = 0;
|
||||
@ -120,7 +123,7 @@ ULONG unicode_string_length;
|
||||
return(UX_MEMORY_INSUFFICIENT);
|
||||
|
||||
/* Issue the command. */
|
||||
status = _ux_host_class_pima_command(pima, &command, UX_HOST_CLASS_PIMA_DATA_PHASE_IN , storage_buffer,
|
||||
status = _ux_host_class_pima_command(pima, &command, UX_HOST_CLASS_PIMA_DATA_PHASE_IN , storage_buffer,
|
||||
UX_HOST_CLASS_PIMA_STORAGE_MAX_LENGTH, UX_HOST_CLASS_PIMA_STORAGE_MAX_LENGTH);
|
||||
|
||||
/* Check the result. If the result is OK, the storage info block was read properly. */
|
||||
@ -134,7 +137,7 @@ ULONG unicode_string_length;
|
||||
|
||||
/* Copy the storage description field. Point to the beginning of the storage description string. */
|
||||
storage_pointer = storage_buffer + UX_HOST_CLASS_PIMA_STORAGE_VARIABLE_OFFSET;
|
||||
|
||||
|
||||
/* Get the unicode string length. */
|
||||
unicode_string_length = (ULONG) *storage_pointer ;
|
||||
|
||||
@ -143,7 +146,7 @@ ULONG unicode_string_length;
|
||||
|
||||
/* Point to the volume label. */
|
||||
storage_pointer = storage_buffer + UX_HOST_CLASS_PIMA_STORAGE_VARIABLE_OFFSET + unicode_string_length;
|
||||
|
||||
|
||||
/* Get the unicode string length. */
|
||||
unicode_string_length = (ULONG) *storage_pointer ;
|
||||
|
||||
@ -154,8 +157,61 @@ ULONG unicode_string_length;
|
||||
|
||||
/* Free the original storage info buffer. */
|
||||
_ux_utility_memory_free(storage_buffer);
|
||||
|
||||
|
||||
/* Return completion status. */
|
||||
return(status);
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _uxe_host_class_pima_storage_info_get PORTABLE C */
|
||||
/* 6.x */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Yajun Xia, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This function checks errors in pima session storage info get */
|
||||
/* function call. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* pima Pointer to pima class */
|
||||
/* pima_session Pointer to pima session */
|
||||
/* storage_id The storage ID */
|
||||
/* storage Pointer to storage */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* Completion Status */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _ue_host_class_pima_storage_info_get Get pima storage info */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* USB application */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* xx-xx-xxxx Yajun xia Initial Version 6.x */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _uxe_host_class_pima_storage_info_get(UX_HOST_CLASS_PIMA *pima,
|
||||
UX_HOST_CLASS_PIMA_SESSION *pima_session,
|
||||
ULONG storage_id, UX_HOST_CLASS_PIMA_STORAGE *storage)
|
||||
{
|
||||
|
||||
/* Sanity check. */
|
||||
if ((pima == UX_NULL) || (pima_session == UX_NULL) || (storage == UX_NULL))
|
||||
return(UX_INVALID_PARAMETER);
|
||||
|
||||
/* Call the actual pima storage info get function. */
|
||||
return(_ux_host_class_pima_storage_info_get(pima, pima_session, storage_id, storage));
|
||||
}
|
@ -12,8 +12,8 @@
|
||||
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/** */
|
||||
/** USBX Component */
|
||||
/** */
|
||||
/** USBX Component */
|
||||
/** */
|
||||
/** PIMA Class */
|
||||
/** */
|
||||
@ -30,51 +30,51 @@
|
||||
#include "ux_host_stack.h"
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _ux_host_class_pima_thumb_get PORTABLE C */
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _ux_host_class_pima_thumb_get PORTABLE C */
|
||||
/* 6.1.10 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Chaoqiong Xiao, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This function gets a thumb image identified by the object_handle */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* pima Pointer to pima class */
|
||||
/* pima_session Pointer to pima session */
|
||||
/* object_handle The object handle */
|
||||
/* object Pointer to object info */
|
||||
/* thumb_buffer Buffer to be used */
|
||||
/* thumb_buffer_length Buffer length */
|
||||
/* thumb_actual_length Length read in that */
|
||||
/* command */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* Completion Status */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* */
|
||||
/* This function gets a thumb image identified by the object_handle */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* pima Pointer to pima class */
|
||||
/* pima_session Pointer to pima session */
|
||||
/* object_handle The object handle */
|
||||
/* object Pointer to object info */
|
||||
/* thumb_buffer Buffer to be used */
|
||||
/* thumb_buffer_length Buffer length */
|
||||
/* thumb_actual_length Length read in that */
|
||||
/* command */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* Completion Status */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _ux_host_stack_transfer_request Transfer request */
|
||||
/* _ux_host_stack_transfer_request_abort Abort transfer request */
|
||||
/* _ux_host_stack_endpoint_reset Reset endpoint */
|
||||
/* _ux_host_semaphore_get Get protection semaphore */
|
||||
/* _ux_utility_short_put Put 16-bit value */
|
||||
/* _ux_utility_long_put Put 32-bit value */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* USB application */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* USB application */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
|
||||
/* 09-30-2020 Chaoqiong Xiao Modified comment(s), */
|
||||
/* prefixed UX to MS_TO_TICK, */
|
||||
@ -86,7 +86,7 @@
|
||||
/* resulting in version 6.1.10 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _ux_host_class_pima_thumb_get(UX_HOST_CLASS_PIMA *pima,
|
||||
UINT _ux_host_class_pima_thumb_get(UX_HOST_CLASS_PIMA *pima,
|
||||
UX_HOST_CLASS_PIMA_SESSION *pima_session,
|
||||
ULONG object_handle, UX_HOST_CLASS_PIMA_OBJECT *object,
|
||||
UCHAR *thumb_buffer, ULONG thumb_buffer_length,
|
||||
@ -112,20 +112,20 @@ UINT status;
|
||||
|
||||
/* Check if the object is already opened. */
|
||||
if (object -> ux_host_class_pima_object_state != UX_HOST_CLASS_PIMA_OBJECT_STATE_OPENED)
|
||||
return (UX_HOST_CLASS_PIMA_RC_OBJECT_NOT_OPENED);
|
||||
return (UX_HOST_CLASS_PIMA_RC_OBJECT_NOT_OPENED);
|
||||
|
||||
/* Check the transfer status. If there was an error or transfer is completed, refuse transfer. */
|
||||
if ((object -> ux_host_class_pima_object_transfer_status == UX_HOST_CLASS_PIMA_OBJECT_TRANSFER_STATUS_COMPLETED) ||
|
||||
(object -> ux_host_class_pima_object_transfer_status == UX_HOST_CLASS_PIMA_OBJECT_TRANSFER_STATUS_ABORTED))
|
||||
return (UX_HOST_CLASS_PIMA_RC_ACCESS_DENIED);
|
||||
|
||||
return (UX_HOST_CLASS_PIMA_RC_ACCESS_DENIED);
|
||||
|
||||
|
||||
/* Reset the actual length. */
|
||||
*thumb_actual_length = 0;
|
||||
|
||||
/* This variable will remain untouched if the offset is not 0 and the requested length is 0. */
|
||||
status = UX_SUCCESS;
|
||||
|
||||
|
||||
/* Check if the offset to be read is at 0, if so, prepare the first read command. */
|
||||
if (object -> ux_host_class_pima_object_offset == 0)
|
||||
{
|
||||
@ -135,37 +135,37 @@ UINT status;
|
||||
|
||||
/* Issue command to get the object info. 1 parameter. */
|
||||
command.ux_host_class_pima_command_nb_parameters = 1;
|
||||
|
||||
|
||||
/* Parameter 1 is the Object Handle. */
|
||||
command.ux_host_class_pima_command_parameter_1 = object_handle;
|
||||
|
||||
|
||||
/* Then set the command to GET_OBJECT. */
|
||||
command.ux_host_class_pima_command_operation_code = UX_HOST_CLASS_PIMA_OC_GET_THUMB;
|
||||
|
||||
|
||||
/* We use the Bulk Out pipe for sending data out.. */
|
||||
transfer_request = &pima -> ux_host_class_pima_bulk_out_endpoint -> ux_endpoint_transfer_request;
|
||||
|
||||
|
||||
/* Get the pointer to the ptp payload. */
|
||||
ptp_payload = pima -> ux_host_class_pima_container ;
|
||||
|
||||
|
||||
/* Calculate the requested length for this payload. */
|
||||
requested_length = UX_HOST_CLASS_PIMA_COMMAND_HEADER_SIZE + ((ULONG)sizeof(ULONG) * command.ux_host_class_pima_command_nb_parameters);
|
||||
|
||||
/* Fill the command container. First the length of the total header and payload. */
|
||||
_ux_utility_long_put(ptp_payload + UX_HOST_CLASS_PIMA_COMMAND_HEADER_LENGTH, requested_length);
|
||||
|
||||
|
||||
/* Then the type of container : a command block here. */
|
||||
_ux_utility_short_put(ptp_payload + UX_HOST_CLASS_PIMA_COMMAND_HEADER_TYPE, UX_HOST_CLASS_PIMA_CT_COMMAND_BLOCK);
|
||||
|
||||
|
||||
/* Now the command code to send. */
|
||||
_ux_utility_short_put(ptp_payload + UX_HOST_CLASS_PIMA_COMMAND_HEADER_CODE, (USHORT)command.ux_host_class_pima_command_operation_code);
|
||||
|
||||
/* Put the transaction ID. */
|
||||
_ux_utility_long_put(ptp_payload + UX_HOST_CLASS_PIMA_COMMAND_HEADER_TRANSACTION_ID,
|
||||
_ux_utility_long_put(ptp_payload + UX_HOST_CLASS_PIMA_COMMAND_HEADER_TRANSACTION_ID,
|
||||
pima -> ux_host_class_pima_transaction_id++);
|
||||
|
||||
|
||||
/* Then fill in the parameters. */
|
||||
_ux_utility_long_put(ptp_payload + UX_HOST_CLASS_PIMA_COMMAND_HEADER_PARAMETER_1,
|
||||
_ux_utility_long_put(ptp_payload + UX_HOST_CLASS_PIMA_COMMAND_HEADER_PARAMETER_1,
|
||||
command.ux_host_class_pima_command_parameter_1);
|
||||
|
||||
/* Initialize the transfer_request. */
|
||||
@ -178,7 +178,7 @@ UINT status;
|
||||
/* If the transfer is successful, we need to wait for the transfer request to be completed. */
|
||||
if (status == UX_SUCCESS)
|
||||
{
|
||||
|
||||
|
||||
/* Wait for the completion of the transfer request. */
|
||||
status = _ux_host_semaphore_get(&transfer_request -> ux_transfer_request_semaphore, UX_MS_TO_TICK(UX_HOST_CLASS_PIMA_CLASS_TRANSFER_TIMEOUT));
|
||||
|
||||
@ -194,13 +194,13 @@ UINT status;
|
||||
|
||||
/* The endpoint was halted by a transfer error and needs to be reset. */
|
||||
_ux_host_stack_endpoint_reset(pima -> ux_host_class_pima_bulk_out_endpoint);
|
||||
|
||||
|
||||
/* Set the thumb transfer status to aborted. */
|
||||
object -> ux_host_class_pima_object_transfer_status = UX_HOST_CLASS_PIMA_OBJECT_TRANSFER_STATUS_ABORTED;
|
||||
|
||||
/* There was an error, return to the caller. */
|
||||
return(status);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -214,34 +214,34 @@ UINT status;
|
||||
if (requested_length == transfer_request -> ux_transfer_request_actual_length)
|
||||
{
|
||||
|
||||
/* Obtain the first packet. This packet contains the header and some data.
|
||||
/* Obtain the first packet. This packet contains the header and some data.
|
||||
We use the Bulk In pipe for receiving data .. */
|
||||
transfer_request = &pima -> ux_host_class_pima_bulk_in_endpoint -> ux_endpoint_transfer_request;
|
||||
|
||||
|
||||
/* Get the pointer to the ptp payload. */
|
||||
ptp_payload = pima -> ux_host_class_pima_container ;
|
||||
|
||||
|
||||
/* Calculate the requested length for this payload. */
|
||||
requested_length = UX_HOST_CLASS_PIMA_CONTAINER_SIZE;
|
||||
|
||||
|
||||
/* Initialize the transfer_request. */
|
||||
transfer_request -> ux_transfer_request_data_pointer = ptp_payload;
|
||||
transfer_request -> ux_transfer_request_requested_length = requested_length;
|
||||
|
||||
|
||||
/* Send request to HCD layer. */
|
||||
status = _ux_host_stack_transfer_request(transfer_request);
|
||||
|
||||
|
||||
/* If the transfer is successful, we need to wait for the transfer request to be completed. */
|
||||
if (status == UX_SUCCESS)
|
||||
{
|
||||
|
||||
|
||||
/* Wait for the completion of the transfer request. */
|
||||
status = _ux_host_semaphore_get(&transfer_request -> ux_transfer_request_semaphore, UX_MS_TO_TICK(UX_HOST_CLASS_PIMA_CLASS_TRANSFER_TIMEOUT));
|
||||
|
||||
|
||||
/* If the semaphore did not succeed we probably have a time out. */
|
||||
if (status != UX_SUCCESS)
|
||||
{
|
||||
|
||||
|
||||
/* All transfers pending need to abort. There may have been a partial transfer. */
|
||||
_ux_host_stack_transfer_request_abort(transfer_request);
|
||||
|
||||
@ -250,17 +250,17 @@ UINT status;
|
||||
|
||||
/* The endpoint was halted by a transfer error and needs to be reset. */
|
||||
_ux_host_stack_endpoint_reset(pima -> ux_host_class_pima_bulk_out_endpoint);
|
||||
|
||||
|
||||
/* Set the thumb transfer status to aborted. */
|
||||
object -> ux_host_class_pima_object_transfer_status = UX_HOST_CLASS_PIMA_OBJECT_TRANSFER_STATUS_ABORTED;
|
||||
|
||||
/* There was an error, return to the caller. */
|
||||
return(status);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
|
||||
/* There was a non transfer error, no partial transfer to be checked */
|
||||
return(status);
|
||||
}
|
||||
@ -276,17 +276,17 @@ UINT status;
|
||||
|
||||
/* Not enough room. Return error. */
|
||||
return(UX_MEMORY_INSUFFICIENT);
|
||||
|
||||
|
||||
/* We need to skip the header. Copying the necessary partial memory only. */
|
||||
_ux_utility_memory_copy(thumb_buffer, ptp_payload + UX_HOST_CLASS_PIMA_DATA_HEADER_SIZE,
|
||||
_ux_utility_memory_copy(thumb_buffer, ptp_payload + UX_HOST_CLASS_PIMA_DATA_HEADER_SIZE,
|
||||
transfer_request -> ux_transfer_request_actual_length - UX_HOST_CLASS_PIMA_DATA_HEADER_SIZE); /* Use case of memcpy is verified. */
|
||||
|
||||
/* Update the actual length. */
|
||||
*thumb_actual_length = transfer_request -> ux_transfer_request_actual_length - UX_HOST_CLASS_PIMA_DATA_HEADER_SIZE;
|
||||
|
||||
|
||||
/* And the offset. */
|
||||
object -> ux_host_class_pima_object_offset += transfer_request -> ux_transfer_request_actual_length - UX_HOST_CLASS_PIMA_DATA_HEADER_SIZE;
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
|
||||
@ -306,36 +306,36 @@ UINT status;
|
||||
|
||||
/* It may take several transactions. */
|
||||
if (thumb_buffer_length > UX_HOST_CLASS_PIMA_MAX_PAYLOAD)
|
||||
|
||||
|
||||
/* Set the requested length to the payload maximum. */
|
||||
requested_length = UX_HOST_CLASS_PIMA_MAX_PAYLOAD;
|
||||
|
||||
|
||||
else
|
||||
|
||||
|
||||
/* We can use the user supplied length to complete this request. */
|
||||
requested_length = thumb_buffer_length;
|
||||
|
||||
|
||||
/* Initialize the transfer_request. */
|
||||
transfer_request -> ux_transfer_request_data_pointer = thumb_buffer;
|
||||
transfer_request -> ux_transfer_request_requested_length = requested_length;
|
||||
|
||||
|
||||
/* Send request to HCD layer. */
|
||||
status = _ux_host_stack_transfer_request(transfer_request);
|
||||
|
||||
|
||||
/* If the transfer is successful, we need to wait for the transfer request to be completed. */
|
||||
if (status == UX_SUCCESS)
|
||||
{
|
||||
|
||||
|
||||
/* Wait for the completion of the transfer request. */
|
||||
status = _ux_host_semaphore_get(&transfer_request -> ux_transfer_request_semaphore, UX_MS_TO_TICK(UX_HOST_CLASS_PIMA_CLASS_TRANSFER_TIMEOUT));
|
||||
|
||||
|
||||
/* If the semaphore did not succeed we probably have a time out. */
|
||||
if (status != UX_SUCCESS)
|
||||
{
|
||||
|
||||
|
||||
/* All transfers pending need to abort. There may have been a partial transfer. */
|
||||
_ux_host_stack_transfer_request_abort(transfer_request);
|
||||
|
||||
|
||||
/* The endpoint was halted by a transfer error and needs to be reset. */
|
||||
_ux_host_stack_endpoint_reset(pima -> ux_host_class_pima_bulk_in_endpoint);
|
||||
|
||||
@ -344,33 +344,33 @@ UINT status;
|
||||
|
||||
/* Set the thumb transfer status to aborted. */
|
||||
object -> ux_host_class_pima_object_transfer_status = UX_HOST_CLASS_PIMA_OBJECT_TRANSFER_STATUS_ABORTED;
|
||||
|
||||
|
||||
/* There was an error, return to the caller. */
|
||||
return(status);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
|
||||
/* There was a non transfer error, no partial transfer to be checked */
|
||||
return(status);
|
||||
}
|
||||
|
||||
|
||||
/* Update the object length expected by the user with what we actually received. */
|
||||
thumb_buffer_length -= transfer_request -> ux_transfer_request_actual_length;
|
||||
|
||||
|
||||
/* Update the actual length. */
|
||||
*thumb_actual_length += transfer_request -> ux_transfer_request_actual_length;
|
||||
|
||||
|
||||
/* And the offset. */
|
||||
object -> ux_host_class_pima_object_offset += transfer_request -> ux_transfer_request_actual_length;
|
||||
|
||||
/* Check to see if we are at the end of the object. */
|
||||
if (object -> ux_host_class_pima_object_offset == object -> ux_host_class_pima_object_thumb_compressed_size)
|
||||
|
||||
|
||||
/* The transfer for this transaction is completed. */
|
||||
object -> ux_host_class_pima_object_transfer_status = UX_HOST_CLASS_PIMA_OBJECT_TRANSFER_STATUS_COMPLETED;
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -378,3 +378,61 @@ UINT status;
|
||||
return(status);
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _uxe_host_class_pima_thumb_get PORTABLE C */
|
||||
/* 6.x */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Yajun Xia, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This function checks errors in pima object thumb function call. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* pima Pointer to pima class */
|
||||
/* pima_session Pointer to pima session */
|
||||
/* object_handle The object handle */
|
||||
/* object Pointer to object info */
|
||||
/* thumb_buffer Buffer to be used */
|
||||
/* thumb_buffer_length Buffer length */
|
||||
/* thumb_actual_length Length read in that */
|
||||
/* command */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* Completion Status */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _ue_host_class_pima_thumb_get Get pima thumb */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* USB application */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* xx-xx-xxxx Yajun xia Initial Version 6.x */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _uxe_host_class_pima_thumb_get(UX_HOST_CLASS_PIMA *pima,
|
||||
UX_HOST_CLASS_PIMA_SESSION *pima_session,
|
||||
ULONG object_handle, UX_HOST_CLASS_PIMA_OBJECT *object,
|
||||
UCHAR *thumb_buffer, ULONG thumb_buffer_length,
|
||||
ULONG *thumb_actual_length)
|
||||
{
|
||||
|
||||
/* Sanity checks. */
|
||||
if ((pima == UX_NULL) || (pima_session == UX_NULL) || (object == UX_NULL) || (thumb_buffer == UX_NULL) || (thumb_actual_length == UX_NULL))
|
||||
return(UX_INVALID_PARAMETER);
|
||||
|
||||
/* Call the actual function. */
|
||||
return(_ux_host_class_pima_thumb_get(pima, pima_session, object_handle, object, thumb_buffer, thumb_buffer_length, thumb_actual_length));
|
||||
}
|
@ -160,3 +160,56 @@ UINT status;
|
||||
/* Return completion status. */
|
||||
return(status);
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _uxe_host_class_printer_device_id_get PORTABLE C */
|
||||
/* 6.x */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Yajun Xia, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This function checks errors in printer device ID get function call. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* printer Pointer to printer class */
|
||||
/* descriptor_buffer Pointer to a buffer to fill */
|
||||
/* IEEE 1284 device ID string */
|
||||
/* (including length in the */
|
||||
/* first two bytes in BE format) */
|
||||
/* length Length of buffer in bytes */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* Completion Status */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _ux_host_class_printer_device_id_get Obtains the printer device ID */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* Application */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* xx-xx-xxxx Yajun xia Initial Version 6.x */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _uxe_host_class_printer_device_id_get(UX_HOST_CLASS_PRINTER *printer, UCHAR *descriptor_buffer, ULONG length)
|
||||
{
|
||||
|
||||
/* Sanity checks. */
|
||||
if ((printer == UX_NULL) || (descriptor_buffer == UX_NULL) || (length == 0))
|
||||
return(UX_INVALID_PARAMETER);
|
||||
|
||||
/* Call the actual printer device ID get function. */
|
||||
return(_ux_host_class_printer_device_id_get(printer, descriptor_buffer, length));
|
||||
}
|
@ -12,8 +12,8 @@
|
||||
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/** */
|
||||
/** USBX Component */
|
||||
/** */
|
||||
/** USBX Component */
|
||||
/** */
|
||||
/** Printer Class */
|
||||
/** */
|
||||
@ -82,7 +82,7 @@ UINT printer_name_length;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* And reduce the remaining length by 1. */
|
||||
descriptor_length--;
|
||||
|
||||
@ -120,46 +120,46 @@ UINT printer_name_length;
|
||||
}
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _ux_host_class_printer_name_get PORTABLE C */
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _ux_host_class_printer_name_get PORTABLE C */
|
||||
/* 6.1.12 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Chaoqiong Xiao, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* */
|
||||
/* This function obtains the printer name. The name is used by the */
|
||||
/* application layer to identify the printer and loads its handler. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* printer Pointer to printer class */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* Completion Status */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _ux_host_stack_transfer_request Process transfer request */
|
||||
/* _ux_utility_memory_allocate Allocate memory block */
|
||||
/* _ux_utility_memory_compare Compare memory block */
|
||||
/* application layer to identify the printer and loads its handler. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* printer Pointer to printer class */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* Completion Status */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _ux_host_stack_transfer_request Process transfer request */
|
||||
/* _ux_utility_memory_allocate Allocate memory block */
|
||||
/* _ux_utility_memory_compare Compare memory block */
|
||||
/* _ux_utility_memory_copy Copy memory block */
|
||||
/* _ux_utility_memory_free Free memory block */
|
||||
/* _ux_utility_short_get_big_endian Get 16-bit value */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* Printer Class */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* _ux_utility_memory_free Free memory block */
|
||||
/* _ux_utility_short_get_big_endian Get 16-bit value */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* Printer Class */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
|
||||
/* 09-30-2020 Chaoqiong Xiao Modified comment(s), */
|
||||
/* verified memset and memcpy */
|
||||
@ -239,3 +239,49 @@ UINT status;
|
||||
#endif
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _uxe_host_class_printer_name_get PORTABLE C */
|
||||
/* 6.x */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Yajun Xia, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This function checks errors in printer name get function call. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* printer Pointer to printer class */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* Completion Status */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _ux_host_class_printer_name_get Obtains the printer name */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* Application */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* xx-xx-xxxx Yajun xia Initial Version 6.x */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _uxe_host_class_printer_name_get(UX_HOST_CLASS_PRINTER *printer)
|
||||
{
|
||||
|
||||
/* Sanity checks. */
|
||||
if (printer == UX_NULL)
|
||||
return(UX_INVALID_PARAMETER);
|
||||
|
||||
return(_ux_host_class_printer_name_get(printer));
|
||||
}
|
@ -12,8 +12,8 @@
|
||||
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/** */
|
||||
/** USBX Component */
|
||||
/** */
|
||||
/** USBX Component */
|
||||
/** */
|
||||
/** Printer Class */
|
||||
/** */
|
||||
@ -30,51 +30,51 @@
|
||||
#include "ux_host_stack.h"
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _ux_host_class_printer_read PORTABLE C */
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _ux_host_class_printer_read PORTABLE C */
|
||||
/* 6.1.10 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Chaoqiong Xiao, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This function reads from the printer interface. The call is */
|
||||
/* blocking and only returns when there is either an error or when */
|
||||
/* */
|
||||
/* This function reads from the printer interface. The call is */
|
||||
/* blocking and only returns when there is either an error or when */
|
||||
/* the transfer is complete. */
|
||||
/* */
|
||||
/* A read is only allowed on bidirectional printers. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* printer Pointer to printer class */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* printer Pointer to printer class */
|
||||
/* data_pointer Pointer to buffer */
|
||||
/* requested_length Requested data read */
|
||||
/* actual_length Actual data read */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* Completion Status */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _ux_host_stack_class_instance_verify Verify the class instance */
|
||||
/* _ux_host_stack_transfer_request Process transfer request */
|
||||
/* _ux_host_stack_transfer_request_abort Abort transfer request */
|
||||
/* _ux_host_semaphore_get Get protection semaphore */
|
||||
/* _ux_host_semaphore_put Release protection semaphore */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* Application */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* Completion Status */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _ux_host_stack_class_instance_verify Verify the class instance */
|
||||
/* _ux_host_stack_transfer_request Process transfer request */
|
||||
/* _ux_host_stack_transfer_request_abort Abort transfer request */
|
||||
/* _ux_host_semaphore_get Get protection semaphore */
|
||||
/* _ux_host_semaphore_put Release protection semaphore */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* Application */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
|
||||
/* 09-30-2020 Chaoqiong Xiao Modified comment(s), */
|
||||
/* prefixed UX to MS_TO_TICK, */
|
||||
@ -85,7 +85,7 @@
|
||||
/* resulting in version 6.1.10 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _ux_host_class_printer_read (UX_HOST_CLASS_PRINTER *printer, UCHAR *data_pointer,
|
||||
UINT _ux_host_class_printer_read (UX_HOST_CLASS_PRINTER *printer, UCHAR *data_pointer,
|
||||
ULONG requested_length, ULONG *actual_length)
|
||||
{
|
||||
|
||||
@ -96,13 +96,13 @@ ULONG transfer_flags;
|
||||
UX_TRANSFER *transfer_request;
|
||||
UINT status;
|
||||
ULONG transfer_request_length;
|
||||
|
||||
|
||||
/* If trace is enabled, insert this event into the trace buffer. */
|
||||
UX_TRACE_IN_LINE_INSERT(UX_TRACE_HOST_CLASS_PRINTER_READ, printer, data_pointer, requested_length, 0, UX_TRACE_HOST_CLASS_EVENTS, 0, 0)
|
||||
|
||||
/* Ensure the instance is valid. */
|
||||
if (printer -> ux_host_class_printer_state != UX_HOST_CLASS_INSTANCE_LIVE)
|
||||
{
|
||||
{
|
||||
|
||||
/* Error trap. */
|
||||
_ux_system_error_handler(UX_SYSTEM_LEVEL_THREAD, UX_SYSTEM_CONTEXT_CLASS, UX_HOST_CLASS_INSTANCE_UNKNOWN);
|
||||
@ -114,9 +114,9 @@ ULONG transfer_request_length;
|
||||
}
|
||||
|
||||
/* Check if the printer is bidirectional. */
|
||||
if ((printer -> ux_host_class_printer_interface -> ux_interface_descriptor.bInterfaceProtocol !=
|
||||
if ((printer -> ux_host_class_printer_interface -> ux_interface_descriptor.bInterfaceProtocol !=
|
||||
UX_HOST_CLASS_PRINTER_PROTOCOL_BI_DIRECTIONAL) &&
|
||||
(printer -> ux_host_class_printer_interface -> ux_interface_descriptor.bInterfaceProtocol !=
|
||||
(printer -> ux_host_class_printer_interface -> ux_interface_descriptor.bInterfaceProtocol !=
|
||||
UX_HOST_CLASS_PRINTER_PROTOCOL_IEEE_1284_4_BI_DIR))
|
||||
{
|
||||
|
||||
@ -127,9 +127,9 @@ ULONG transfer_request_length;
|
||||
UX_TRACE_IN_LINE_INSERT(UX_TRACE_ERROR, UX_FUNCTION_NOT_SUPPORTED, 0, 0, 0, UX_TRACE_ERRORS, 0, 0)
|
||||
|
||||
/* Return an error. */
|
||||
return(UX_FUNCTION_NOT_SUPPORTED);
|
||||
}
|
||||
|
||||
return(UX_FUNCTION_NOT_SUPPORTED);
|
||||
}
|
||||
|
||||
/* Protect thread reentry to this instance. */
|
||||
#if defined(UX_HOST_STANDALONE)
|
||||
UX_DISABLE
|
||||
@ -171,11 +171,11 @@ ULONG transfer_request_length;
|
||||
transfer_request_length = transfer_request -> ux_transfer_request_maximum_length;
|
||||
else
|
||||
transfer_request_length = requested_length;
|
||||
|
||||
|
||||
/* Initialize the transfer request. */
|
||||
transfer_request -> ux_transfer_request_data_pointer = data_pointer;
|
||||
transfer_request -> ux_transfer_request_requested_length = transfer_request_length;
|
||||
|
||||
|
||||
/* Perform the transfer. */
|
||||
status = _ux_host_stack_transfer_request(transfer_request);
|
||||
|
||||
@ -193,26 +193,26 @@ ULONG transfer_request_length;
|
||||
|
||||
/* All transfers pending need to abort. There may have been a partial transfer. */
|
||||
_ux_host_stack_transfer_request_abort(transfer_request);
|
||||
|
||||
/* Update the length of the actual data transferred. We do this after the
|
||||
|
||||
/* Update the length of the actual data transferred. We do this after the
|
||||
abort of the transfer request in case some data was actually received. */
|
||||
*actual_length += transfer_request -> ux_transfer_request_actual_length;
|
||||
|
||||
|
||||
/* Unprotect thread reentry to this instance. */
|
||||
_ux_host_class_printer_unlock(printer);
|
||||
|
||||
/* Set the completion code. */
|
||||
transfer_request -> ux_transfer_request_completion_code = UX_TRANSFER_TIMEOUT;
|
||||
|
||||
|
||||
/* Error trap. */
|
||||
_ux_system_error_handler(UX_SYSTEM_LEVEL_THREAD, UX_SYSTEM_CONTEXT_CLASS, UX_TRANSFER_TIMEOUT);
|
||||
|
||||
/* If trace is enabled, insert this event into the trace buffer. */
|
||||
UX_TRACE_IN_LINE_INSERT(UX_TRACE_ERROR, UX_TRANSFER_TIMEOUT, transfer_request, 0, 0, UX_TRACE_ERRORS, 0, 0)
|
||||
|
||||
|
||||
/* There was an error, return to the caller */
|
||||
return(UX_TRANSFER_TIMEOUT);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else
|
||||
@ -232,7 +232,7 @@ ULONG transfer_request_length;
|
||||
|
||||
/* Update the length of the transfer. Normally all the data has to be received. */
|
||||
*actual_length += transfer_request -> ux_transfer_request_actual_length;
|
||||
|
||||
|
||||
/* Check for completion of transfer. If the transfer is partial, return to caller.
|
||||
The transfer is marked as successful but the caller will need to check the length
|
||||
actually received and determine if a partial transfer is OK. */
|
||||
@ -246,17 +246,17 @@ ULONG transfer_request_length;
|
||||
|
||||
/* Unprotect thread reentry to this instance. */
|
||||
_ux_host_class_printer_unlock(printer);
|
||||
|
||||
|
||||
/* Return success to caller. */
|
||||
return(UX_SUCCESS);
|
||||
}
|
||||
|
||||
/* Update the data pointer for next transfer. */
|
||||
/* Update the data pointer for next transfer. */
|
||||
data_pointer += transfer_request_length;
|
||||
|
||||
|
||||
/* Update what is left to receive. */
|
||||
requested_length -= transfer_request_length;
|
||||
}
|
||||
requested_length -= transfer_request_length;
|
||||
}
|
||||
|
||||
#if defined(UX_HOST_STANDALONE)
|
||||
|
||||
@ -268,6 +268,57 @@ ULONG transfer_request_length;
|
||||
_ux_host_class_printer_unlock(printer);
|
||||
|
||||
/* We get here when all the transfers went through without errors. */
|
||||
return(UX_SUCCESS);
|
||||
return(UX_SUCCESS);
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _uxe_host_class_printer_read PORTABLE C */
|
||||
/* 6.x */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Yajun Xia, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This function checks errors in printer read function call. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* printer Pointer to printer class */
|
||||
/* data_pointer Pointer to buffer */
|
||||
/* requested_length Requested data read */
|
||||
/* actual_length Actual data read */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* Completion Status */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _ux_host_class_printer_read Printer read */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* Application */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* xx-xx-xxxx Yajun xia Initial Version 6.x */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _uxe_host_class_printer_read (UX_HOST_CLASS_PRINTER *printer, UCHAR *data_pointer,
|
||||
ULONG requested_length, ULONG *actual_length)
|
||||
{
|
||||
|
||||
/* Sanity checks. */
|
||||
if ((printer == UX_NULL) || (data_pointer == UX_NULL) || (actual_length == UX_NULL))
|
||||
return(UX_INVALID_PARAMETER);
|
||||
|
||||
/* Call the actual printer read function. */
|
||||
return(_ux_host_class_printer_read(printer, data_pointer, requested_length, actual_length));
|
||||
}
|
@ -12,8 +12,8 @@
|
||||
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/** */
|
||||
/** USBX Component */
|
||||
/** */
|
||||
/** USBX Component */
|
||||
/** */
|
||||
/** Printer Class */
|
||||
/** */
|
||||
@ -30,43 +30,43 @@
|
||||
#include "ux_host_stack.h"
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _ux_host_class_printer_soft_reset PORTABLE C */
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _ux_host_class_printer_soft_reset PORTABLE C */
|
||||
/* 6.1.12 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Chaoqiong Xiao, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This function performs a soft reset of the printer in case the */
|
||||
/* printer gets into an error mode. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* printer Pointer to printer class */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* Completion Status */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _ux_host_stack_transfer_request Process transfer request */
|
||||
/* _ux_host_semaphore_get Get protection semaphore */
|
||||
/* _ux_host_semaphore_put Release protection semaphore */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* Application */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* */
|
||||
/* This function performs a soft reset of the printer in case the */
|
||||
/* printer gets into an error mode. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* printer Pointer to printer class */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* Completion Status */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _ux_host_stack_transfer_request Process transfer request */
|
||||
/* _ux_host_semaphore_get Get protection semaphore */
|
||||
/* _ux_host_semaphore_put Release protection semaphore */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* Application */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
|
||||
/* 09-30-2020 Chaoqiong Xiao Modified comment(s), */
|
||||
/* resulting in version 6.1 */
|
||||
@ -98,7 +98,7 @@ UINT status;
|
||||
|
||||
/* Ensure the instance is valid. */
|
||||
if (printer -> ux_host_class_printer_state != UX_HOST_CLASS_INSTANCE_LIVE)
|
||||
{
|
||||
{
|
||||
|
||||
/* Error trap. */
|
||||
_ux_system_error_handler(UX_SYSTEM_LEVEL_THREAD, UX_SYSTEM_CONTEXT_CLASS, UX_HOST_CLASS_INSTANCE_UNKNOWN);
|
||||
@ -172,3 +172,50 @@ UINT status;
|
||||
return(status);
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _uxe_host_class_printer_soft_reset PORTABLE C */
|
||||
/* 6.x */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Yajun Xia, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This function checks errors in printer soft reset function call. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* printer Pointer to printer class */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* Completion Status */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _ux_host_class_printer_soft_reset Printer soft reset */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* Application */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* xx-xx-xxxx Yajun xia Initial Version 6.x */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _uxe_host_class_printer_soft_reset(UX_HOST_CLASS_PRINTER *printer)
|
||||
{
|
||||
|
||||
/* Sanity checks. */
|
||||
if (printer == UX_NULL)
|
||||
return(UX_INVALID_PARAMETER);
|
||||
|
||||
/* Call the actual printer soft reset function. */
|
||||
return(_ux_host_class_printer_soft_reset(printer));
|
||||
}
|
@ -12,8 +12,8 @@
|
||||
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/** */
|
||||
/** USBX Component */
|
||||
/** */
|
||||
/** USBX Component */
|
||||
/** */
|
||||
/** Printer Class */
|
||||
/** */
|
||||
@ -30,48 +30,48 @@
|
||||
#include "ux_host_stack.h"
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _ux_host_class_printer_status_get PORTABLE C */
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _ux_host_class_printer_status_get PORTABLE C */
|
||||
/* 6.1.12 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Chaoqiong Xiao, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This function obtains the printer status. The printer status is */
|
||||
/* */
|
||||
/* This function obtains the printer status. The printer status is */
|
||||
/* similar to the LPT status (1284 standard). */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* printer Pointer to printer class */
|
||||
/* printer_status Pointer to return status */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* Completion Status */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _ux_host_stack_class_instance_verify Verify the class instance */
|
||||
/* _ux_host_stack_transfer_request Process transfer request */
|
||||
/* _ux_utility_long_get Get 32-bit long word */
|
||||
/* _ux_utility_memory_allocate Allocate memory block */
|
||||
/* _ux_utility_memory_free Free memory block */
|
||||
/* _ux_host_semaphore_get Get protection semaphore */
|
||||
/* _ux_host_semaphore_put Release protection semaphore */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* Application */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* printer Pointer to printer class */
|
||||
/* printer_status Pointer to return status */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* Completion Status */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _ux_host_stack_class_instance_verify Verify the class instance */
|
||||
/* _ux_host_stack_transfer_request Process transfer request */
|
||||
/* _ux_utility_long_get Get 32-bit long word */
|
||||
/* _ux_utility_memory_allocate Allocate memory block */
|
||||
/* _ux_utility_memory_free Free memory block */
|
||||
/* _ux_host_semaphore_get Get protection semaphore */
|
||||
/* _ux_host_semaphore_put Release protection semaphore */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* Application */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
|
||||
/* 09-30-2020 Chaoqiong Xiao Modified comment(s), */
|
||||
/* resulting in version 6.1 */
|
||||
@ -101,7 +101,7 @@ UCHAR * printer_status_buffer;
|
||||
|
||||
/* Ensure the instance is valid. */
|
||||
if (printer -> ux_host_class_printer_state != UX_HOST_CLASS_INSTANCE_LIVE)
|
||||
{
|
||||
{
|
||||
|
||||
/* If trace is enabled, insert this event into the trace buffer. */
|
||||
UX_TRACE_IN_LINE_INSERT(UX_TRACE_ERROR, UX_HOST_CLASS_INSTANCE_UNKNOWN, printer, 0, 0, UX_TRACE_ERRORS, 0, 0)
|
||||
@ -209,3 +209,52 @@ UCHAR * printer_status_buffer;
|
||||
/* Return completion status. */
|
||||
return(status);
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _uxe_host_class_printer_status_get PORTABLE C */
|
||||
/* 6.x */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Yajun Xia, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This function checks errors in printer statis get function call. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* printer Pointer to printer class */
|
||||
/* printer_status Pointer to return status */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* Completion Status */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _ux_host_class_printer_status_get Obtains the printer status */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* Application */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* xx-xx-xxxx Yajun xia Initial Version 6.x */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _uxe_host_class_printer_status_get(UX_HOST_CLASS_PRINTER *printer, ULONG *printer_status)
|
||||
{
|
||||
|
||||
/* Sanity checks. */
|
||||
if ((printer == UX_NULL) || (printer_status == UX_NULL))
|
||||
return(UX_INVALID_PARAMETER);
|
||||
|
||||
/* Call the actual printer status get function. */
|
||||
return(_ux_host_class_printer_status_get(printer, printer_status));
|
||||
}
|
||||
|
@ -12,8 +12,8 @@
|
||||
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/** */
|
||||
/** USBX Component */
|
||||
/** */
|
||||
/** USBX Component */
|
||||
/** */
|
||||
/** Printer Class */
|
||||
/** */
|
||||
@ -30,48 +30,48 @@
|
||||
#include "ux_host_stack.h"
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _ux_host_class_printer_write PORTABLE C */
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _ux_host_class_printer_write PORTABLE C */
|
||||
/* 6.1.10 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Chaoqiong Xiao, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This function writes to the printer interface. The call is blocking */
|
||||
/* and only returns when there is either an error or when the transfer */
|
||||
/* is complete. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* printer Pointer to printer class */
|
||||
/* data_pointer Pointer to data to write */
|
||||
/* requested_length Length of data to write */
|
||||
/* actual_length Actual length of data written */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* Completion Status */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _ux_host_stack_transfer_request Process transfer request */
|
||||
/* _ux_host_stack_transfer_request_abort Abort transfer request */
|
||||
/* _ux_host_semaphore_get Get protection semaphore */
|
||||
/* _ux_host_semaphore_put Release protection semaphore */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* Application */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* */
|
||||
/* This function writes to the printer interface. The call is blocking */
|
||||
/* and only returns when there is either an error or when the transfer */
|
||||
/* is complete. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* printer Pointer to printer class */
|
||||
/* data_pointer Pointer to data to write */
|
||||
/* requested_length Length of data to write */
|
||||
/* actual_length Actual length of data written */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* Completion Status */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _ux_host_stack_transfer_request Process transfer request */
|
||||
/* _ux_host_stack_transfer_request_abort Abort transfer request */
|
||||
/* _ux_host_semaphore_get Get protection semaphore */
|
||||
/* _ux_host_semaphore_put Release protection semaphore */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* Application */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
|
||||
/* 09-30-2020 Chaoqiong Xiao Modified comment(s), */
|
||||
/* prefixed UX to MS_TO_TICK, */
|
||||
@ -84,7 +84,7 @@
|
||||
/* resulting in version 6.1.10 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _ux_host_class_printer_write(UX_HOST_CLASS_PRINTER *printer, UCHAR * data_pointer,
|
||||
UINT _ux_host_class_printer_write(UX_HOST_CLASS_PRINTER *printer, UCHAR * data_pointer,
|
||||
ULONG requested_length, ULONG *actual_length)
|
||||
{
|
||||
|
||||
@ -101,7 +101,7 @@ ULONG transfer_request_length;
|
||||
|
||||
/* Ensure the instance is valid. */
|
||||
if (printer -> ux_host_class_printer_state != UX_HOST_CLASS_INSTANCE_LIVE)
|
||||
{
|
||||
{
|
||||
|
||||
/* Error trap. */
|
||||
_ux_system_error_handler(UX_SYSTEM_LEVEL_THREAD, UX_SYSTEM_CONTEXT_CLASS, UX_HOST_CLASS_INSTANCE_UNKNOWN);
|
||||
@ -154,11 +154,11 @@ ULONG transfer_request_length;
|
||||
transfer_request_length = transfer_request -> ux_transfer_request_maximum_length;
|
||||
else
|
||||
transfer_request_length = requested_length;
|
||||
|
||||
|
||||
/* Initialize the transfer_request. */
|
||||
transfer_request -> ux_transfer_request_data_pointer = data_pointer;
|
||||
transfer_request -> ux_transfer_request_requested_length = transfer_request_length;
|
||||
|
||||
|
||||
/* Perform the transfer. */
|
||||
status = _ux_host_stack_transfer_request(transfer_request);
|
||||
|
||||
@ -176,26 +176,26 @@ ULONG transfer_request_length;
|
||||
|
||||
/* All transfers pending need to abort. There may have been a partial transfer. */
|
||||
_ux_host_stack_transfer_request_abort(transfer_request);
|
||||
|
||||
/* Update the length of the actual data transferred. We do this after the
|
||||
|
||||
/* Update the length of the actual data transferred. We do this after the
|
||||
abort of the transfer_request in case some data actually went out. */
|
||||
*actual_length += transfer_request -> ux_transfer_request_actual_length;
|
||||
|
||||
|
||||
/* Unprotect thread reentry to this instance. */
|
||||
_ux_host_class_printer_unlock(printer);
|
||||
|
||||
/* Set the completion code. */
|
||||
transfer_request -> ux_transfer_request_completion_code = UX_TRANSFER_TIMEOUT;
|
||||
|
||||
|
||||
/* Error trap. */
|
||||
_ux_system_error_handler(UX_SYSTEM_LEVEL_THREAD, UX_SYSTEM_CONTEXT_CLASS, UX_TRANSFER_TIMEOUT);
|
||||
|
||||
/* If trace is enabled, insert this event into the trace buffer. */
|
||||
UX_TRACE_IN_LINE_INSERT(UX_TRACE_ERROR, UX_TRANSFER_TIMEOUT, transfer_request, 0, 0, UX_TRACE_ERRORS, 0, 0)
|
||||
|
||||
|
||||
/* There was an error, return to the caller. */
|
||||
return(UX_TRANSFER_TIMEOUT);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else
|
||||
@ -215,7 +215,7 @@ ULONG transfer_request_length;
|
||||
|
||||
/* Update the length of the transfer. Normally all the data has to be sent. */
|
||||
*actual_length += transfer_request -> ux_transfer_request_actual_length;
|
||||
|
||||
|
||||
/* Check for completion of transfer. If the transfer is partial, return to caller.
|
||||
The transfer is marked as successful but the caller will need to check the length
|
||||
actually sent and determine if a partial transfer is OK. */
|
||||
@ -234,11 +234,11 @@ ULONG transfer_request_length;
|
||||
return(UX_SUCCESS);
|
||||
}
|
||||
|
||||
/* Update the data pointer for next transfer. */
|
||||
/* Update the data pointer for next transfer. */
|
||||
data_pointer += transfer_request_length;
|
||||
|
||||
|
||||
/* Update what is left to send out. */
|
||||
requested_length -= transfer_request_length;
|
||||
requested_length -= transfer_request_length;
|
||||
} while (requested_length);
|
||||
|
||||
#if defined(UX_HOST_STANDALONE)
|
||||
@ -251,6 +251,61 @@ ULONG transfer_request_length;
|
||||
_ux_host_class_printer_unlock(printer);
|
||||
|
||||
/* We get here when all the transfers went through without errors. */
|
||||
return(UX_SUCCESS);
|
||||
return(UX_SUCCESS);
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _uxe_host_class_printer_write PORTABLE C */
|
||||
/* 6.x */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Yajun Xia, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This function checks errors in printer write function call. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* printer Pointer to printer class */
|
||||
/* data_pointer Pointer to data to write */
|
||||
/* requested_length Length of data to write */
|
||||
/* actual_length Actual length of data written */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* Completion Status */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _ux_host_class_printer_write Printer write */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* Application */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* xx-xx-xxxx Yajun xia Initial Version 6.x */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _uxe_host_class_printer_write(UX_HOST_CLASS_PRINTER *printer, UCHAR * data_pointer,
|
||||
ULONG requested_length, ULONG *actual_length)
|
||||
{
|
||||
|
||||
/* Sanity checks. */
|
||||
if ((printer == UX_NULL) ||
|
||||
((data_pointer == UX_NULL) && (requested_length > 0)) ||
|
||||
(actual_length == UX_NULL))
|
||||
{
|
||||
return(UX_INVALID_PARAMETER);
|
||||
}
|
||||
|
||||
/* Call the actual printer write function. */
|
||||
return(_ux_host_class_printer_write(printer, data_pointer, requested_length, actual_length));
|
||||
}
|
||||
|
@ -12,8 +12,8 @@
|
||||
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/** */
|
||||
/** USBX Component */
|
||||
/** */
|
||||
/** USBX Component */
|
||||
/** */
|
||||
/** Prolific Class */
|
||||
/** */
|
||||
@ -30,58 +30,60 @@
|
||||
#include "ux_host_stack.h"
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _ux_host_class_prolific_command PORTABLE C */
|
||||
/* 6.1.10 */
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _ux_host_class_prolific_command PORTABLE C */
|
||||
/* 6.x */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Chaoqiong Xiao, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This function will send a command to the Prolific device. */
|
||||
/* The command can be one of the following : */
|
||||
/* SET_CONTROL */
|
||||
/* SET_LINE */
|
||||
/* SEND_BREAK */
|
||||
/* */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* prolific Pointer to prolific class */
|
||||
/* command command value */
|
||||
/* value value to be sent in the */
|
||||
/* command request */
|
||||
/* data_buffer buffer to be sent */
|
||||
/* data_length length of the buffer to send */
|
||||
/* */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* Completion Status */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _ux_host_stack_transfer_request Process transfer request */
|
||||
/* */
|
||||
/* This function will send a command to the Prolific device. */
|
||||
/* The command can be one of the following : */
|
||||
/* SET_CONTROL */
|
||||
/* SET_LINE */
|
||||
/* SEND_BREAK */
|
||||
/* */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* prolific Pointer to prolific class */
|
||||
/* command command value */
|
||||
/* value value to be sent in the */
|
||||
/* command request */
|
||||
/* data_buffer buffer to be sent */
|
||||
/* data_length length of the buffer to send */
|
||||
/* */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* Completion Status */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _ux_host_stack_transfer_request Process transfer request */
|
||||
/* _ux_host_semaphore_get Get semaphore */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* Storage Class */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* Application */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
|
||||
/* 09-30-2020 Chaoqiong Xiao Modified comment(s), */
|
||||
/* resulting in version 6.1 */
|
||||
/* 01-31-2022 Chaoqiong Xiao Modified comment(s), */
|
||||
/* refined macros names, */
|
||||
/* resulting in version 6.1.10 */
|
||||
/* xx-xx-xxxx Yajun xia Modified comment(s), */
|
||||
/* resulting in version 6.x */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _ux_host_class_prolific_command(UX_HOST_CLASS_PROLIFIC *prolific, ULONG command,
|
||||
@ -92,21 +94,21 @@ UX_ENDPOINT *control_endpoint;
|
||||
UX_TRANSFER *transfer_request;
|
||||
UINT status;
|
||||
|
||||
|
||||
|
||||
/* We need to get the default control endpoint transfer request pointer. */
|
||||
control_endpoint = &prolific -> ux_host_class_prolific_device -> ux_device_control_endpoint;
|
||||
transfer_request = &control_endpoint -> ux_endpoint_transfer_request;
|
||||
|
||||
/* Protect the control endpoint semaphore here. It will be unprotected in the
|
||||
/* Protect the control endpoint semaphore here. It will be unprotected in the
|
||||
transfer request function. */
|
||||
status = _ux_host_semaphore_get(&prolific -> ux_host_class_prolific_device -> ux_device_protection_semaphore, UX_WAIT_FOREVER);
|
||||
|
||||
/* Check for status. */
|
||||
if (status != UX_SUCCESS)
|
||||
|
||||
|
||||
/* Something went wrong. */
|
||||
return(status);
|
||||
|
||||
|
||||
/* Create a transfer_request for the request. */
|
||||
transfer_request -> ux_transfer_request_data_pointer = data_buffer;
|
||||
transfer_request -> ux_transfer_request_requested_length = data_length;
|
||||
|
@ -12,8 +12,8 @@
|
||||
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/** */
|
||||
/** USBX Component */
|
||||
/** */
|
||||
/** USBX Component */
|
||||
/** */
|
||||
/** Prolific Class */
|
||||
/** */
|
||||
@ -30,56 +30,58 @@
|
||||
#include "ux_host_stack.h"
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _ux_host_class_prolific_ioctl PORTABLE C */
|
||||
/* 6.1.11 */
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _ux_host_class_prolific_ioctl PORTABLE C */
|
||||
/* 6.x */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Chaoqiong Xiao, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This function is the ioctl entry point for the application to */
|
||||
/* configure the Prolific device. */
|
||||
/* */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* prolific Pointer to prolific class */
|
||||
/* ioctl_function ioctl function */
|
||||
/* parameter pointer to structure */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* Completion Status */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* */
|
||||
/* This function is the ioctl entry point for the application to */
|
||||
/* configure the Prolific device. */
|
||||
/* */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* prolific Pointer to prolific class */
|
||||
/* ioctl_function ioctl function */
|
||||
/* parameter pointer to structure */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* Completion Status */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _ux_host_stack_transfer_request Transfer request */
|
||||
/* _ux_host_stack_endpoint_transfer_abort */
|
||||
/* Abort transfer */
|
||||
/* _ux_host_class_prolific_command Send command to device */
|
||||
/* _ux_host_class_prolific_command Send command to device */
|
||||
/* _ux_utility_memory_allocate Allocate memory */
|
||||
/* _ux_utility_memory_free Free memory */
|
||||
/* _ux_utility_long_put Put 32-bit value */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* Storage Class */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* Application */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
|
||||
/* 09-30-2020 Chaoqiong Xiao Modified comment(s), */
|
||||
/* resulting in version 6.1 */
|
||||
/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
|
||||
/* internal clean up, */
|
||||
/* resulting in version 6.1.11 */
|
||||
/* xx-xx-xxxx Yajun xia Modified comment(s), */
|
||||
/* resulting in version 6.x */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _ux_host_class_prolific_ioctl(UX_HOST_CLASS_PROLIFIC *prolific, ULONG ioctl_function,
|
||||
@ -96,9 +98,9 @@ UX_TRANSFER *transfer_request;
|
||||
VOID (*callback_function) (struct UX_HOST_CLASS_PROLIFIC_STRUCT *, ULONG );
|
||||
|
||||
/* Ensure the instance is valid. */
|
||||
if ((prolific -> ux_host_class_prolific_state != UX_HOST_CLASS_INSTANCE_LIVE) &&
|
||||
if ((prolific -> ux_host_class_prolific_state != UX_HOST_CLASS_INSTANCE_LIVE) &&
|
||||
(prolific -> ux_host_class_prolific_state != UX_HOST_CLASS_INSTANCE_MOUNTING))
|
||||
{
|
||||
{
|
||||
|
||||
/* Error trap. */
|
||||
_ux_system_error_handler(UX_SYSTEM_LEVEL_THREAD, UX_SYSTEM_CONTEXT_CLASS, UX_ENDPOINT_HANDLE_UNKNOWN);
|
||||
@ -117,129 +119,129 @@ VOID (*callback_function) (struct UX_HOST_CLASS_P
|
||||
|
||||
/* If trace is enabled, insert this event into the trace buffer. */
|
||||
UX_TRACE_IN_LINE_INSERT(UX_TRACE_HOST_CLASS_PROLIFIC_IOCTL_SET_LINE_CODING, prolific, parameter, 0, 0, UX_TRACE_HOST_CLASS_EVENTS, 0, 0)
|
||||
|
||||
|
||||
/* Allocate some cache safe memory for the control command. */
|
||||
data_buffer = _ux_utility_memory_allocate(UX_SAFE_ALIGN, UX_CACHE_SAFE_MEMORY, UX_HOST_CLASS_PROLIFIC_LINE_CODING_LENGTH);
|
||||
|
||||
|
||||
/* Check if error. Return with error if no memory could be allocated. */
|
||||
if (data_buffer == UX_NULL)
|
||||
|
||||
|
||||
/* Do not proceed. Set error code. */
|
||||
status = UX_MEMORY_INSUFFICIENT;
|
||||
else
|
||||
{
|
||||
|
||||
|
||||
/* Build the buffer from the calling parameter. Cast the calling parameter. */
|
||||
line_coding = (UX_HOST_CLASS_PROLIFIC_LINE_CODING *) parameter;
|
||||
|
||||
|
||||
/* Put the data rate. */
|
||||
_ux_utility_long_put(data_buffer + UX_HOST_CLASS_PROLIFIC_LINE_CODING_RATE,
|
||||
_ux_utility_long_put(data_buffer + UX_HOST_CLASS_PROLIFIC_LINE_CODING_RATE,
|
||||
line_coding -> ux_host_class_prolific_line_coding_dter);
|
||||
|
||||
|
||||
/* Then the stop bit. */
|
||||
*(data_buffer + UX_HOST_CLASS_PROLIFIC_LINE_CODING_STOP_BIT) =
|
||||
*(data_buffer + UX_HOST_CLASS_PROLIFIC_LINE_CODING_STOP_BIT) =
|
||||
(UCHAR) line_coding -> ux_host_class_prolific_line_coding_stop_bit;
|
||||
|
||||
|
||||
/* Then the parity. */
|
||||
*(data_buffer + UX_HOST_CLASS_PROLIFIC_LINE_CODING_PARITY) =
|
||||
*(data_buffer + UX_HOST_CLASS_PROLIFIC_LINE_CODING_PARITY) =
|
||||
(UCHAR) line_coding -> ux_host_class_prolific_line_coding_parity;
|
||||
|
||||
|
||||
/* Finally the data bits. */
|
||||
*(data_buffer + UX_HOST_CLASS_PROLIFIC_LINE_CODING_DATA_BIT) =
|
||||
*(data_buffer + UX_HOST_CLASS_PROLIFIC_LINE_CODING_DATA_BIT) =
|
||||
(UCHAR) line_coding -> ux_host_class_prolific_line_coding_data_bits;
|
||||
|
||||
/* Send the command to the device. */
|
||||
status = _ux_host_class_prolific_command(prolific, UX_HOST_CLASS_PROLIFIC_REQ_SET_LINE_CODING,
|
||||
0, data_buffer, UX_HOST_CLASS_PROLIFIC_LINE_CODING_LENGTH);
|
||||
|
||||
|
||||
/* We free the resources allocated no matter what. */
|
||||
_ux_utility_memory_free(data_buffer);
|
||||
}
|
||||
_ux_utility_memory_free(data_buffer);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case UX_HOST_CLASS_PROLIFIC_IOCTL_GET_LINE_CODING:
|
||||
|
||||
/* If trace is enabled, insert this event into the trace buffer. */
|
||||
UX_TRACE_IN_LINE_INSERT(UX_TRACE_HOST_CLASS_PROLIFIC_IOCTL_GET_LINE_CODING, prolific, parameter, 0, 0, UX_TRACE_HOST_CLASS_EVENTS, 0, 0)
|
||||
|
||||
|
||||
/* Allocate some cache safe memory for the control command. */
|
||||
data_buffer = _ux_utility_memory_allocate(UX_SAFE_ALIGN, UX_CACHE_SAFE_MEMORY, UX_HOST_CLASS_PROLIFIC_LINE_CODING_LENGTH);
|
||||
|
||||
|
||||
/* Check if error. Return with error if no memory could be allocated. */
|
||||
if (data_buffer == UX_NULL)
|
||||
|
||||
|
||||
/* Do not proceed. Set error code. */
|
||||
status = UX_MEMORY_INSUFFICIENT;
|
||||
else
|
||||
{
|
||||
|
||||
|
||||
/* Send the command to the device. */
|
||||
status = _ux_host_class_prolific_command(prolific, UX_HOST_CLASS_PROLIFIC_REQ_GET_LINE_CODING,
|
||||
0, data_buffer, UX_HOST_CLASS_PROLIFIC_LINE_CODING_LENGTH);
|
||||
|
||||
|
||||
/* Fill in the calling buffer if the result is successful. */
|
||||
if (status == UX_SUCCESS)
|
||||
{
|
||||
|
||||
|
||||
/* Build the buffer from the calling parameter. Cast the calling parameter. */
|
||||
line_coding = (UX_HOST_CLASS_PROLIFIC_LINE_CODING *) parameter;
|
||||
|
||||
|
||||
/* Get the data rate. */
|
||||
line_coding -> ux_host_class_prolific_line_coding_dter = _ux_utility_long_get(data_buffer + UX_HOST_CLASS_PROLIFIC_LINE_CODING_RATE);
|
||||
|
||||
|
||||
/* Then the stop bit. */
|
||||
line_coding -> ux_host_class_prolific_line_coding_stop_bit =
|
||||
line_coding -> ux_host_class_prolific_line_coding_stop_bit =
|
||||
(ULONG) *(data_buffer + UX_HOST_CLASS_PROLIFIC_LINE_CODING_STOP_BIT);
|
||||
|
||||
|
||||
/* Then the parity. */
|
||||
line_coding -> ux_host_class_prolific_line_coding_parity =
|
||||
line_coding -> ux_host_class_prolific_line_coding_parity =
|
||||
(ULONG) *(data_buffer + UX_HOST_CLASS_PROLIFIC_LINE_CODING_PARITY);
|
||||
|
||||
|
||||
/* Finally the data bits. */
|
||||
line_coding -> ux_host_class_prolific_line_coding_data_bits =
|
||||
(ULONG) *(data_buffer + UX_HOST_CLASS_PROLIFIC_LINE_CODING_DATA_BIT);
|
||||
(ULONG) *(data_buffer + UX_HOST_CLASS_PROLIFIC_LINE_CODING_DATA_BIT);
|
||||
}
|
||||
|
||||
/* We free the resources allocated no matter what. */
|
||||
_ux_utility_memory_free(data_buffer);
|
||||
}
|
||||
_ux_utility_memory_free(data_buffer);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case UX_HOST_CLASS_PROLIFIC_IOCTL_SET_LINE_STATE:
|
||||
|
||||
/* If trace is enabled, insert this event into the trace buffer. */
|
||||
UX_TRACE_IN_LINE_INSERT(UX_TRACE_HOST_CLASS_PROLIFIC_IOCTL_SET_LINE_STATE, prolific, parameter, 0, 0, UX_TRACE_HOST_CLASS_EVENTS, 0, 0)
|
||||
|
||||
|
||||
/* Cast the calling parameter. */
|
||||
line_state = (UX_HOST_CLASS_PROLIFIC_LINE_STATE *) parameter;
|
||||
|
||||
|
||||
/* Build the value field. */
|
||||
value = (line_state -> ux_host_class_prolific_line_state_rts |
|
||||
value = (line_state -> ux_host_class_prolific_line_state_rts |
|
||||
(line_state -> ux_host_class_prolific_line_state_dtr << 1));
|
||||
|
||||
|
||||
/* Send the command to the device. */
|
||||
status = _ux_host_class_prolific_command(prolific, UX_HOST_CLASS_PROLIFIC_REQ_SET_LINE_STATE,
|
||||
value, UX_NULL,0);
|
||||
break;
|
||||
break;
|
||||
|
||||
case UX_HOST_CLASS_PROLIFIC_IOCTL_SEND_BREAK :
|
||||
|
||||
/* If trace is enabled, insert this event into the trace buffer. */
|
||||
UX_TRACE_IN_LINE_INSERT(UX_TRACE_HOST_CLASS_PROLIFIC_IOCTL_SEND_BREAK, prolific, parameter, 0, 0, UX_TRACE_HOST_CLASS_EVENTS, 0, 0)
|
||||
|
||||
|
||||
/* Build the value field. */
|
||||
value = *((ULONG *) parameter);
|
||||
|
||||
|
||||
/* Send the command to the device. */
|
||||
status = _ux_host_class_prolific_command(prolific, UX_HOST_CLASS_PROLIFIC_REQ_SEND_BREAK,
|
||||
value, UX_NULL,0);
|
||||
break;
|
||||
break;
|
||||
|
||||
case UX_HOST_CLASS_PROLIFIC_IOCTL_PURGE :
|
||||
|
||||
/* If trace is enabled, insert this event into the trace buffer. */
|
||||
UX_TRACE_IN_LINE_INSERT(UX_TRACE_HOST_CLASS_PROLIFIC_IOCTL_PURGE, prolific, 0, 0, 0, UX_TRACE_HOST_CLASS_EVENTS, 0, 0)
|
||||
|
||||
|
||||
/* We need to get the default control endpoint transfer request pointer. */
|
||||
control_endpoint = &prolific -> ux_host_class_prolific_device -> ux_device_control_endpoint;
|
||||
transfer_request = &control_endpoint -> ux_endpoint_transfer_request;
|
||||
@ -251,10 +253,10 @@ VOID (*callback_function) (struct UX_HOST_CLASS_P
|
||||
transfer_request -> ux_transfer_request_type = UX_REQUEST_OUT | UX_REQUEST_TYPE_VENDOR | UX_REQUEST_TARGET_DEVICE;
|
||||
transfer_request -> ux_transfer_request_value = UX_HOST_CLASS_PROLIFIC_COMMAND_PIPE1_RESET;
|
||||
transfer_request -> ux_transfer_request_index = 0;
|
||||
|
||||
|
||||
/* Send request to HCD layer. */
|
||||
_ux_host_stack_transfer_request(transfer_request);
|
||||
|
||||
|
||||
/* Reset upstream data pipes part 1. */
|
||||
transfer_request -> ux_transfer_request_data_pointer = UX_NULL;
|
||||
transfer_request -> ux_transfer_request_requested_length = 0;
|
||||
@ -262,20 +264,20 @@ VOID (*callback_function) (struct UX_HOST_CLASS_P
|
||||
transfer_request -> ux_transfer_request_type = UX_REQUEST_OUT | UX_REQUEST_TYPE_VENDOR | UX_REQUEST_TARGET_DEVICE;
|
||||
transfer_request -> ux_transfer_request_value = UX_HOST_CLASS_PROLIFIC_COMMAND_PIPE2_RESET;
|
||||
transfer_request -> ux_transfer_request_index = 0;
|
||||
|
||||
|
||||
/* Send request to HCD layer. */
|
||||
status = _ux_host_stack_transfer_request(transfer_request);
|
||||
|
||||
break;
|
||||
break;
|
||||
|
||||
case UX_HOST_CLASS_PROLIFIC_IOCTL_ABORT_IN_PIPE :
|
||||
|
||||
/* If trace is enabled, insert this event into the trace buffer. */
|
||||
UX_TRACE_IN_LINE_INSERT(UX_TRACE_HOST_CLASS_PROLIFIC_IOCTL_ABORT_IN_PIPE, prolific, prolific -> ux_host_class_prolific_bulk_in_endpoint, 0, 0, UX_TRACE_HOST_CLASS_EVENTS, 0, 0)
|
||||
|
||||
|
||||
/* We need to abort transactions on the bulk In pipe. */
|
||||
_ux_host_stack_endpoint_transfer_abort(prolific -> ux_host_class_prolific_bulk_in_endpoint);
|
||||
|
||||
|
||||
/* Status is successful. */
|
||||
status = UX_SUCCESS;
|
||||
break;
|
||||
@ -284,7 +286,7 @@ VOID (*callback_function) (struct UX_HOST_CLASS_P
|
||||
|
||||
/* If trace is enabled, insert this event into the trace buffer. */
|
||||
UX_TRACE_IN_LINE_INSERT(UX_TRACE_HOST_CLASS_PROLIFIC_IOCTL_ABORT_OUT_PIPE, prolific, prolific -> ux_host_class_prolific_bulk_out_endpoint, 0, 0, UX_TRACE_HOST_CLASS_EVENTS, 0, 0)
|
||||
|
||||
|
||||
/* We need to abort transactions on the bulk Out pipe. */
|
||||
_ux_host_stack_endpoint_transfer_abort(prolific -> ux_host_class_prolific_bulk_out_endpoint);
|
||||
|
||||
@ -296,7 +298,7 @@ VOID (*callback_function) (struct UX_HOST_CLASS_P
|
||||
|
||||
/* If trace is enabled, insert this event into the trace buffer. */
|
||||
UX_TRACE_IN_LINE_INSERT(UX_TRACE_HOST_CLASS_PROLIFIC_IOCTL_REPORT_DEVICE_STATUS_CHANGE, prolific, parameter, 0, 0, UX_TRACE_HOST_CLASS_EVENTS, 0, 0)
|
||||
|
||||
|
||||
/* Register a callback when the line state has changed. */
|
||||
callback_function = ((VOID (*) (struct UX_HOST_CLASS_PROLIFIC_STRUCT *, ULONG )) (ALIGN_TYPE)parameter);
|
||||
prolific -> ux_host_class_prolific_device_status_change_callback = callback_function;
|
||||
@ -309,7 +311,7 @@ VOID (*callback_function) (struct UX_HOST_CLASS_P
|
||||
|
||||
/* If trace is enabled, insert this event into the trace buffer. */
|
||||
UX_TRACE_IN_LINE_INSERT(UX_TRACE_HOST_CLASS_PROLIFIC_IOCTL_GET_DEVICE_STATUS, prolific, prolific -> ux_host_class_prolific_device_state, 0, 0, UX_TRACE_HOST_CLASS_EVENTS, 0, 0)
|
||||
|
||||
|
||||
/* Return the device status. */
|
||||
* ((ULONG *) parameter) = prolific -> ux_host_class_prolific_device_state;
|
||||
|
||||
@ -318,7 +320,7 @@ VOID (*callback_function) (struct UX_HOST_CLASS_P
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
default:
|
||||
|
||||
/* Error trap. */
|
||||
_ux_system_error_handler(UX_SYSTEM_LEVEL_THREAD, UX_SYSTEM_CONTEXT_CLASS, UX_FUNCTION_NOT_SUPPORTED);
|
||||
@ -329,13 +331,12 @@ VOID (*callback_function) (struct UX_HOST_CLASS_P
|
||||
/* Function not supported. Return an error. */
|
||||
status = UX_FUNCTION_NOT_SUPPORTED;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Return status to caller. */
|
||||
return(status);
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
|
@ -158,4 +158,54 @@ UX_DEVICE *device;
|
||||
UX_RESTORE
|
||||
return(UX_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _uxe_host_class_storage_lock PORTABLE C */
|
||||
/* 6.x */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Chaoqiong Xiao, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This function checks errors in storage lock function call. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* storage Pointer to storage to operate */
|
||||
/* wait Wait option */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* Status */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _ux_host_class_storage_lock Lock storage */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* Application */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* xx-xx-xxxx Chaoqiong Xiao Initial Version 6.x */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _uxe_host_class_storage_lock(UX_HOST_CLASS_STORAGE *storage, ULONG wait)
|
||||
{
|
||||
|
||||
/* Sanity check. */
|
||||
if (storage == UX_NULL)
|
||||
return(UX_INVALID_PARAMETER);
|
||||
|
||||
/* Invoke storage lock function. */
|
||||
return(_ux_host_class_storage_lock(storage, wait));
|
||||
}
|
||||
#endif
|
||||
|
@ -83,4 +83,53 @@ UINT status;
|
||||
} while(status == UX_STATE_WAIT);
|
||||
return(storage -> ux_host_class_storage_status);
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _uxe_host_class_storage_media_check PORTABLE C */
|
||||
/* 6.x */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Chaoqiong Xiao, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This function checks errors in storage media check function call. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* storage Pointer to storage class */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* Status */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _ux_host_class_storage_media_check Check storage media */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* Application */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* xx-xx-xxxx Chaoqiong Xiao Initial Version 6.x */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _uxe_host_class_storage_media_check(UX_HOST_CLASS_STORAGE *storage)
|
||||
{
|
||||
|
||||
/* Sanity check. */
|
||||
if (storage == UX_NULL)
|
||||
return(UX_INVALID_PARAMETER);
|
||||
|
||||
/* Invoke storage media check function. */
|
||||
return(_ux_host_class_storage_media_check(storage));
|
||||
}
|
||||
#endif
|
||||
|
@ -134,4 +134,58 @@ UINT scan_index;
|
||||
return(UX_ERROR);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _uxe_host_class_storage_media_get PORTABLE C */
|
||||
/* 6.x */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Chaoqiong Xiao, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This function checks errors in storage media get function call. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* storage Pointer to storage class */
|
||||
/* media_lun Media logical unit No. (LUN) */
|
||||
/* storage_media Holds returned storage media */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* Status */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _ux_host_class_storage_media_get Get storage media */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* Application */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* xx-xx-xxxx Chaoqiong Xiao Initial Version 6.x */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _uxe_host_class_storage_media_get(UX_HOST_CLASS_STORAGE *storage,
|
||||
ULONG media_lun,
|
||||
UX_HOST_CLASS_STORAGE_MEDIA **storage_media)
|
||||
{
|
||||
|
||||
/* Sanity check. */
|
||||
if ((storage == UX_NULL) || (storage_media == UX_NULL))
|
||||
return(UX_INVALID_PARAMETER);
|
||||
|
||||
/* Invoke storage media get function. */
|
||||
return(_ux_host_class_storage_media_get(storage, media_lun, storage_media));
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -103,4 +103,55 @@ UINT status;
|
||||
return(UX_SUCCESS);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _uxe_host_class_storage_media_lock PORTABLE C */
|
||||
/* 6.x */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Chaoqiong Xiao, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This function checks errors in storage media lock function call. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* storage_media Pointer to storage media to */
|
||||
/* select */
|
||||
/* wait Wait option */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* Status */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _ux_host_class_storage_media_lock Lock and select storage media */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* Application */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* xx-xx-xxxx Chaoqiong Xiao Initial Version 6.x */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _uxe_host_class_storage_media_lock(UX_HOST_CLASS_STORAGE_MEDIA *storage_media, ULONG wait)
|
||||
{
|
||||
|
||||
/* Sanity check. */
|
||||
if (storage_media == UX_NULL)
|
||||
return(UX_INVALID_PARAMETER);
|
||||
|
||||
/* Invoke storage media lock function. */
|
||||
return(_ux_host_class_storage_media_lock(storage_media, wait));
|
||||
}
|
||||
#endif
|
||||
|
@ -193,3 +193,56 @@ UINT media_retry;
|
||||
return(UX_HOST_CLASS_STORAGE_SENSE_ERROR);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _ux_host_class_storage_media_read PORTABLE C */
|
||||
/* 6.x */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Chaoqiong Xiao, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This function checks errors in storage media read function call. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* storage Pointer to storage class */
|
||||
/* sector_start Starting sector */
|
||||
/* sector_count Number of sectors to read */
|
||||
/* data_pointer Pointer to data to read */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* Status */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _ux_host_class_storage_media_read Read storage media */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* Application */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* xx-xx-xxxx Chaoqiong Xiao Initial Version 6.x */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _uxe_host_class_storage_media_read(UX_HOST_CLASS_STORAGE *storage, ULONG sector_start,
|
||||
ULONG sector_count, UCHAR *data_pointer)
|
||||
{
|
||||
|
||||
/* Sanity checks. */
|
||||
if ((storage == UX_NULL) || (data_pointer == UX_NULL))
|
||||
return(UX_INVALID_PARAMETER);
|
||||
|
||||
/* Invoke storage media read function. */
|
||||
return(_ux_host_class_storage_media_read(storage, sector_start, sector_count, data_pointer));
|
||||
}
|
||||
|
@ -171,3 +171,55 @@ UINT media_retry;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _ux_host_class_storage_media_write PORTABLE C */
|
||||
/* 6.x */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Chaoqiong Xiao, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This function checks errors in storage media write function call. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* storage Pointer to storage class */
|
||||
/* sector_start Starting sector */
|
||||
/* sector_count Number of sectors to write */
|
||||
/* data_pointer Pointer to data to write */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* Status */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _ux_host_class_storage_media_write write storage media */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* Application */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* xx-xx-xxxx Chaoqiong Xiao Initial Version 6.x */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _uxe_host_class_storage_media_write(UX_HOST_CLASS_STORAGE *storage, ULONG sector_start,
|
||||
ULONG sector_count, UCHAR *data_pointer)
|
||||
{
|
||||
|
||||
/* Sanity check. */
|
||||
if (storage == UX_NULL)
|
||||
return(UX_INVALID_PARAMETER);
|
||||
|
||||
/* Invoke storage media write function. */
|
||||
return(_ux_host_class_storage_media_write(storage, sector_start, sector_count, data_pointer));
|
||||
}
|
||||
|
@ -12,8 +12,8 @@
|
||||
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/** */
|
||||
/** USBX Component */
|
||||
/** */
|
||||
/** USBX Component */
|
||||
/** */
|
||||
/** Host Sierra Wireless AR module class */
|
||||
/** */
|
||||
@ -30,48 +30,50 @@
|
||||
#include "ux_host_stack.h"
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _ux_host_class_swar_ioctl PORTABLE C */
|
||||
/* 6.1 */
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _ux_host_class_swar_ioctl PORTABLE C */
|
||||
/* 6.x */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Chaoqiong Xiao, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This function is the ioctl entry point for the application to */
|
||||
/* configure the Swar device. */
|
||||
/* */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* swar Pointer to swar class */
|
||||
/* ioctl_function ioctl function */
|
||||
/* parameter pointer to structure */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* Completion Status */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* */
|
||||
/* This function is the ioctl entry point for the application to */
|
||||
/* configure the Swar device. */
|
||||
/* */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* swar Pointer to swar class */
|
||||
/* ioctl_function ioctl function */
|
||||
/* parameter pointer to structure */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* Completion Status */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _ux_host_stack_endpoint_transfer_abort */
|
||||
/* Abort transfer */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* Storage Class */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* Abort transfer */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* Application */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
|
||||
/* 09-30-2020 Chaoqiong Xiao Modified comment(s), */
|
||||
/* resulting in version 6.1 */
|
||||
/* xx-xx-xxxx Yajun xia Modified comment(s), */
|
||||
/* resulting in version 6.x */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _ux_host_class_swar_ioctl(UX_HOST_CLASS_SWAR *swar, ULONG ioctl_function,
|
||||
@ -90,10 +92,10 @@ UINT status;
|
||||
|
||||
/* If trace is enabled, insert this event into the trace buffer. */
|
||||
UX_TRACE_IN_LINE_INSERT(UX_TRACE_HOST_CLASS_SWAR_IOCTL_ABORT_IN_PIPE, swar, swar -> ux_host_class_swar_bulk_in_endpoint, 0, 0, UX_TRACE_HOST_CLASS_EVENTS, 0, 0)
|
||||
|
||||
|
||||
/* We need to abort transactions on the bulk In pipe. */
|
||||
_ux_host_stack_endpoint_transfer_abort(swar -> ux_host_class_swar_bulk_in_endpoint);
|
||||
|
||||
|
||||
/* Status is successful. */
|
||||
status = UX_SUCCESS;
|
||||
break;
|
||||
@ -102,7 +104,7 @@ UINT status;
|
||||
|
||||
/* If trace is enabled, insert this event into the trace buffer. */
|
||||
UX_TRACE_IN_LINE_INSERT(UX_TRACE_HOST_CLASS_SWAR_IOCTL_ABORT_OUT_PIPE, swar, swar -> ux_host_class_swar_bulk_out_endpoint, 0, 0, UX_TRACE_HOST_CLASS_EVENTS, 0, 0)
|
||||
|
||||
|
||||
/* We need to abort transactions on the bulk Out pipe. */
|
||||
_ux_host_stack_endpoint_transfer_abort(swar -> ux_host_class_swar_bulk_out_endpoint);
|
||||
|
||||
@ -110,7 +112,7 @@ UINT status;
|
||||
status = UX_SUCCESS;
|
||||
break;
|
||||
|
||||
default:
|
||||
default:
|
||||
|
||||
/* Error trap. */
|
||||
_ux_system_error_handler(UX_SYSTEM_LEVEL_THREAD, UX_SYSTEM_CONTEXT_CLASS, UX_FUNCTION_NOT_SUPPORTED);
|
||||
@ -121,7 +123,7 @@ UINT status;
|
||||
/* Function not supported. Return an error. */
|
||||
status = UX_FUNCTION_NOT_SUPPORTED;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Return status to caller. */
|
||||
return(status);
|
||||
|
@ -12,8 +12,8 @@
|
||||
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/** */
|
||||
/** USBX Component */
|
||||
/** */
|
||||
/** USBX Component */
|
||||
/** */
|
||||
/** Video Class */
|
||||
/** */
|
||||
@ -30,49 +30,49 @@
|
||||
#include "ux_host_stack.h"
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _ux_host_class_video_control_get PORTABLE C */
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _ux_host_class_video_control_get PORTABLE C */
|
||||
/* 6.1.11 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Chaoqiong Xiao, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This function obtains the static values for a single video control */
|
||||
/* on either the master channel or a specific channel. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* video Pointer to video class */
|
||||
/* video_control Pointer to video control */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* Completion Status */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _ux_host_stack_class_instance_verify Verify instance is valid */
|
||||
/* _ux_host_stack_transfer_request Process transfer request */
|
||||
/* _ux_host_semaphore_get Get semaphore */
|
||||
/* _ux_host_semaphore_put Release semaphore */
|
||||
/* _ux_utility_memory_allocate Allocate memory block */
|
||||
/* _ux_utility_memory_free Release memory block */
|
||||
/* _ux_utility_short_get Read 16-bit value */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* Application */
|
||||
/* Video Class */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* */
|
||||
/* This function obtains the static values for a single video control */
|
||||
/* on either the master channel or a specific channel. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* video Pointer to video class */
|
||||
/* video_control Pointer to video control */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* Completion Status */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _ux_host_stack_class_instance_verify Verify instance is valid */
|
||||
/* _ux_host_stack_transfer_request Process transfer request */
|
||||
/* _ux_host_semaphore_get Get semaphore */
|
||||
/* _ux_host_semaphore_put Release semaphore */
|
||||
/* _ux_utility_memory_allocate Allocate memory block */
|
||||
/* _ux_utility_memory_free Release memory block */
|
||||
/* _ux_utility_short_get Read 16-bit value */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* Application */
|
||||
/* Video Class */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
|
||||
/* 09-30-2020 Chaoqiong Xiao Modified comment(s), */
|
||||
/* resulting in version 6.1 */
|
||||
@ -95,7 +95,7 @@ UCHAR * control_buffer;
|
||||
|
||||
/* Ensure the instance is valid. */
|
||||
if (_ux_host_stack_class_instance_verify(_ux_system_host_class_video_name, (VOID *) video) != UX_SUCCESS)
|
||||
{
|
||||
{
|
||||
|
||||
/* Error trap. */
|
||||
_ux_system_error_handler(UX_SYSTEM_LEVEL_THREAD, UX_SYSTEM_CONTEXT_CLASS, UX_HOST_CLASS_INSTANCE_UNKNOWN);
|
||||
@ -119,7 +119,7 @@ UCHAR * control_buffer;
|
||||
control_buffer = _ux_utility_memory_allocate(UX_SAFE_ALIGN, UX_CACHE_SAFE_MEMORY, 2);
|
||||
if (control_buffer == UX_NULL)
|
||||
{
|
||||
|
||||
|
||||
/* Unprotect thread reentry to this instance. */
|
||||
_ux_host_semaphore_put(&video -> ux_host_class_video_semaphore);
|
||||
|
||||
@ -127,16 +127,16 @@ UCHAR * control_buffer;
|
||||
return(UX_MEMORY_INSUFFICIENT);
|
||||
}
|
||||
|
||||
/* Protect the control endpoint semaphore here. It will be unprotected in the
|
||||
/* Protect the control endpoint semaphore here. It will be unprotected in the
|
||||
transfer request function. */
|
||||
status = _ux_host_semaphore_get(&video -> ux_host_class_video_device -> ux_device_protection_semaphore, UX_WAIT_FOREVER);
|
||||
|
||||
/* Check for status. */
|
||||
if (status != UX_SUCCESS)
|
||||
|
||||
|
||||
/* Something went wrong. */
|
||||
return(status);
|
||||
|
||||
|
||||
/* Create a transfer request for the GET_MIN request. */
|
||||
transfer_request -> ux_transfer_request_data_pointer = control_buffer;
|
||||
transfer_request -> ux_transfer_request_requested_length = 2;
|
||||
@ -155,7 +155,7 @@ UCHAR * control_buffer;
|
||||
/* Update the MIN static value for the caller. */
|
||||
video_control -> ux_host_class_video_control_min = (LONG)(SHORT)_ux_utility_short_get(control_buffer);
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
|
||||
/* Free the previous control buffer. */
|
||||
@ -181,7 +181,7 @@ UCHAR * control_buffer;
|
||||
/* Update the MAX static value for the caller. */
|
||||
video_control -> ux_host_class_video_control_max = (LONG)(SHORT)_ux_utility_short_get(control_buffer);
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
|
||||
/* Free the previous control buffer. */
|
||||
@ -218,3 +218,51 @@ UCHAR * control_buffer;
|
||||
return(status);
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _uxe_host_class_video_control_get PORTABLE C */
|
||||
/* 6.x */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Yajun Xia, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This function checks errors in video control get function call. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* video Pointer to video class */
|
||||
/* video_control Pointer to video control */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* Completion Status */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _ux_host_class_video_control_get Get the video control */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* Application */
|
||||
/* Video Class */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* xx-xx-xxxx Yajun xia Initial Version 6.x */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _uxe_host_class_video_control_get(UX_HOST_CLASS_VIDEO *video, UX_HOST_CLASS_VIDEO_CONTROL *video_control)
|
||||
{
|
||||
/* Sanity Checks. */
|
||||
if ((video == UX_NULL) || (video_control == UX_NULL))
|
||||
return(UX_INVALID_PARAMETER);
|
||||
|
||||
/* Call the actual video control get function. */
|
||||
return(_ux_host_class_video_control_get(video, video_control));
|
||||
}
|
||||
|
@ -206,3 +206,66 @@ UCHAR interface_number;
|
||||
/* Return completion status. */
|
||||
return(status);
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _uxe_host_class_video_control_request PORTABLE C */
|
||||
/* 6.x */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Yajun Xia, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This function checks errors in video control request function call. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* video Pointer to video class */
|
||||
/* request The request to issue */
|
||||
/* interface_index The interface index */
|
||||
/* 0: VideoControl interface */
|
||||
/* 1: VideoStreaming 1 */
|
||||
/* N: VideoStreaming N */
|
||||
/* entity_id The terminal or unit ID */
|
||||
/* control_selector The control selector */
|
||||
/* parameter Pointer to parameter block */
|
||||
/* parameter_size Size of parameter block */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* Completion Status */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _ux_host_class_video_control_request Video control request */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* Application */
|
||||
/* Video Class */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* xx-xx-xxxx Yajun xia Initial Version 6.x */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _uxe_host_class_video_control_request(UX_HOST_CLASS_VIDEO *video,
|
||||
UINT request, UCHAR interface_index,
|
||||
UINT entity_id, UINT control_selector,
|
||||
UCHAR *parameter, UINT parameter_size)
|
||||
{
|
||||
|
||||
/* Sanity checks. */
|
||||
if (video == UX_NULL)
|
||||
return(UX_INVALID_PARAMETER);
|
||||
|
||||
/* Call the video control request function. */
|
||||
return(_ux_host_class_video_control_request(video, request, interface_index,
|
||||
entity_id, control_selector,
|
||||
parameter, parameter_size));
|
||||
}
|
||||
|
@ -12,8 +12,8 @@
|
||||
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/** */
|
||||
/** USBX Component */
|
||||
/** */
|
||||
/** USBX Component */
|
||||
/** */
|
||||
/** Video Class */
|
||||
/** */
|
||||
@ -30,10 +30,10 @@
|
||||
#include "ux_host_stack.h"
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _ux_host_class_video_control_value_get PORTABLE C */
|
||||
/* 6.1.11 */
|
||||
/* AUTHOR */
|
||||
@ -41,38 +41,38 @@
|
||||
/* Chaoqiong Xiao, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* */
|
||||
/* This function obtains the current values for a single video control.*/
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* video Pointer to video class */
|
||||
/* video_control Pointer to video control */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* Completion Status */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _ux_host_stack_class_instance_verify Verify instance is valid */
|
||||
/* _ux_host_stack_transfer_request Process transfer request */
|
||||
/* _ux_host_semaphore_get Get semaphore */
|
||||
/* _ux_host_semaphore_put Release semaphore */
|
||||
/* _ux_utility_memory_allocate Allocate memory block */
|
||||
/* _ux_utility_memory_free Release memory block */
|
||||
/* _ux_utility_short_get Read 16-bit value */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* video Pointer to video class */
|
||||
/* video_control Pointer to video control */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* Completion Status */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _ux_host_stack_class_instance_verify Verify instance is valid */
|
||||
/* _ux_host_stack_transfer_request Process transfer request */
|
||||
/* _ux_host_semaphore_get Get semaphore */
|
||||
/* _ux_host_semaphore_put Release semaphore */
|
||||
/* _ux_utility_memory_allocate Allocate memory block */
|
||||
/* _ux_utility_memory_free Release memory block */
|
||||
/* _ux_utility_short_get Read 16-bit value */
|
||||
/* _ux_system_error_handler Log system error */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* Application */
|
||||
/* Video Class */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* Application */
|
||||
/* Video Class */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
|
||||
/* 09-30-2020 Chaoqiong Xiao Modified comment(s), */
|
||||
/* resulting in version 6.1 */
|
||||
@ -95,7 +95,7 @@ UCHAR * control_buffer;
|
||||
|
||||
/* Ensure the instance is valid. */
|
||||
if (_ux_host_stack_class_instance_verify(_ux_system_host_class_video_name, (VOID *) video) != UX_SUCCESS)
|
||||
{
|
||||
{
|
||||
|
||||
/* Error trap. */
|
||||
_ux_system_error_handler(UX_SYSTEM_LEVEL_THREAD, UX_SYSTEM_CONTEXT_CLASS, UX_HOST_CLASS_INSTANCE_UNKNOWN);
|
||||
@ -119,7 +119,7 @@ UCHAR * control_buffer;
|
||||
control_buffer = _ux_utility_memory_allocate(UX_SAFE_ALIGN, UX_CACHE_SAFE_MEMORY, 2);
|
||||
if (control_buffer == UX_NULL)
|
||||
{
|
||||
|
||||
|
||||
/* Unprotect thread reentry to this instance. */
|
||||
_ux_host_semaphore_put(&video -> ux_host_class_video_semaphore);
|
||||
|
||||
@ -127,16 +127,16 @@ UCHAR * control_buffer;
|
||||
return(UX_MEMORY_INSUFFICIENT);
|
||||
}
|
||||
|
||||
/* Protect the control endpoint semaphore here. It will be unprotected in the
|
||||
/* Protect the control endpoint semaphore here. It will be unprotected in the
|
||||
transfer request function. */
|
||||
status = _ux_host_semaphore_get(&video -> ux_host_class_video_device -> ux_device_protection_semaphore, UX_WAIT_FOREVER);
|
||||
|
||||
/* Check for status. */
|
||||
if (status != UX_SUCCESS)
|
||||
|
||||
|
||||
/* Something went wrong. */
|
||||
return(status);
|
||||
|
||||
|
||||
/* Create a transfer request for the GET_MIN request. */
|
||||
transfer_request -> ux_transfer_request_data_pointer = control_buffer;
|
||||
transfer_request -> ux_transfer_request_requested_length = 2;
|
||||
@ -155,7 +155,7 @@ UCHAR * control_buffer;
|
||||
/* Update the MIN static value for the caller. */
|
||||
video_control -> ux_host_class_video_control_cur = (LONG)(SHORT)_ux_utility_short_get(control_buffer);
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
|
||||
/* Free the previous control buffer. */
|
||||
@ -178,3 +178,54 @@ UCHAR * control_buffer;
|
||||
return(status);
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _uxe_host_class_video_control_value_get PORTABLE C */
|
||||
/* 6.x */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Yajun Xia, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This function checks errors in video control value get function */
|
||||
/* call. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* video Pointer to video class */
|
||||
/* video_control Pointer to video control */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* Completion Status */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _ux_host_class_video_control_value_get */
|
||||
/* Get the video control value */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* Application */
|
||||
/* Video Class */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* xx-xx-xxxx Yajun xia Initial Version 6.x */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _uxe_host_class_video_control_value_get(UX_HOST_CLASS_VIDEO *video, UX_HOST_CLASS_VIDEO_CONTROL *video_control)
|
||||
{
|
||||
|
||||
/* Sanity Checks. */
|
||||
if ((video == UX_NULL) || (video_control == UX_NULL))
|
||||
return(UX_INVALID_PARAMETER);
|
||||
|
||||
/* Call the actual video control value get function. */
|
||||
return(_ux_host_class_video_control_value_get(video, video_control));
|
||||
}
|
@ -12,8 +12,8 @@
|
||||
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/** */
|
||||
/** USBX Component */
|
||||
/** */
|
||||
/** USBX Component */
|
||||
/** */
|
||||
/** Video Class */
|
||||
/** */
|
||||
@ -30,10 +30,10 @@
|
||||
#include "ux_host_stack.h"
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _ux_host_class_video_control_value_set PORTABLE C */
|
||||
/* 6.1.11 */
|
||||
/* AUTHOR */
|
||||
@ -41,37 +41,37 @@
|
||||
/* Chaoqiong Xiao, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* */
|
||||
/* This function updates the current values for a single video control.*/
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* video Pointer to video class */
|
||||
/* video_control Pointer to video control */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* Completion Status */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _ux_host_stack_class_instance_verify Verify instance is valid */
|
||||
/* _ux_host_stack_transfer_request Process transfer request */
|
||||
/* _ux_host_semaphore_get Get semaphore */
|
||||
/* _ux_host_semaphore_put Release semaphore */
|
||||
/* _ux_utility_memory_allocate Allocate memory block */
|
||||
/* _ux_utility_memory_free Release memory block */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* video Pointer to video class */
|
||||
/* video_control Pointer to video control */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* Completion Status */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _ux_host_stack_class_instance_verify Verify instance is valid */
|
||||
/* _ux_host_stack_transfer_request Process transfer request */
|
||||
/* _ux_host_semaphore_get Get semaphore */
|
||||
/* _ux_host_semaphore_put Release semaphore */
|
||||
/* _ux_utility_memory_allocate Allocate memory block */
|
||||
/* _ux_utility_memory_free Release memory block */
|
||||
/* _ux_utility_short_put Put 16-bit value */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* Application */
|
||||
/* Video Class */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* Application */
|
||||
/* Video Class */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
|
||||
/* 09-30-2020 Chaoqiong Xiao Modified comment(s), */
|
||||
/* resulting in version 6.1 */
|
||||
@ -94,7 +94,7 @@ UCHAR * control_buffer;
|
||||
|
||||
/* Ensure the instance is valid. */
|
||||
if (_ux_host_stack_class_instance_verify(_ux_system_host_class_video_name, (VOID *) video) != UX_SUCCESS)
|
||||
{
|
||||
{
|
||||
|
||||
/* Error trap. */
|
||||
_ux_system_error_handler(UX_SYSTEM_LEVEL_THREAD, UX_SYSTEM_CONTEXT_CLASS, UX_HOST_CLASS_INSTANCE_UNKNOWN);
|
||||
@ -118,7 +118,7 @@ UCHAR * control_buffer;
|
||||
control_buffer = _ux_utility_memory_allocate(UX_SAFE_ALIGN, UX_CACHE_SAFE_MEMORY, 2);
|
||||
if (control_buffer == UX_NULL)
|
||||
{
|
||||
|
||||
|
||||
/* Unprotect thread reentry to this instance. */
|
||||
_ux_host_semaphore_put(&video -> ux_host_class_video_semaphore);
|
||||
|
||||
@ -129,16 +129,16 @@ UCHAR * control_buffer;
|
||||
/* Update the control buffer with the current control value. */
|
||||
_ux_utility_short_put(control_buffer, (USHORT) video_control -> ux_host_class_video_control_cur);
|
||||
|
||||
/* Protect the control endpoint semaphore here. It will be unprotected in the
|
||||
/* Protect the control endpoint semaphore here. It will be unprotected in the
|
||||
transfer request function. */
|
||||
status = _ux_host_semaphore_get(&video -> ux_host_class_video_device -> ux_device_protection_semaphore, UX_WAIT_FOREVER);
|
||||
|
||||
/* Check for status. */
|
||||
if (status != UX_SUCCESS)
|
||||
|
||||
|
||||
/* Something went wrong. */
|
||||
return(status);
|
||||
|
||||
|
||||
/* Create a transfer request for the GET_MIN request. */
|
||||
transfer_request -> ux_transfer_request_data_pointer = control_buffer;
|
||||
transfer_request -> ux_transfer_request_requested_length = 2;
|
||||
@ -174,3 +174,54 @@ UCHAR * control_buffer;
|
||||
return(status);
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _uxe_host_class_video_control_value_set PORTABLE C */
|
||||
/* 6.x */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Yajun Xia, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This function checks errors in video control value set function */
|
||||
/* call. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* video Pointer to video class */
|
||||
/* video_control Pointer to video control */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* Completion Status */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _ux_host_class_video_control_value_set */
|
||||
/* Set the video control value */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* Application */
|
||||
/* Video Class */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* xx-xx-xxxx Yajun xia Initial Version 6.x */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _uxe_host_class_video_control_value_set(UX_HOST_CLASS_VIDEO *video, UX_HOST_CLASS_VIDEO_CONTROL *video_control)
|
||||
{
|
||||
|
||||
/* Sanity Checks. */
|
||||
if ((video == UX_NULL) || (video_control == UX_NULL))
|
||||
return(UX_INVALID_PARAMETER);
|
||||
|
||||
/* Call the actual video control value set function. */
|
||||
return(_ux_host_class_video_control_value_set(video, video_control));
|
||||
}
|
@ -188,3 +188,59 @@ UINT status;
|
||||
/* We get here when all descriptors scanned. */
|
||||
return(UX_SUCCESS);
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _uxe_host_class_video_entities_parse PORTABLE C */
|
||||
/* 6.x */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Yajun Xia, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This function checks errors in video entities parse function call. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* video Pointer to video instance */
|
||||
/* parse_function Parse function for each */
|
||||
/* video class descriptor */
|
||||
/* arg Parse function argument */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* Completion Status */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _ux_host_class_video_entities_parse Video entities parse */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* Video Class */
|
||||
/* Application */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* xx-xx-xxxx Yajun xia Initial Version 6.x */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _uxe_host_class_video_entities_parse(UX_HOST_CLASS_VIDEO *video,
|
||||
UINT(*parse_function)(VOID *arg,
|
||||
UCHAR *packed_interface_descriptor,
|
||||
UCHAR *packed_entity_descriptor),
|
||||
VOID* arg)
|
||||
{
|
||||
|
||||
/* Sanity checks. */
|
||||
if (video == UX_NULL)
|
||||
return(UX_INVALID_PARAMETER);
|
||||
|
||||
/* Call the actual video entities parse function. */
|
||||
return(_ux_host_class_video_entities_parse(video, parse_function, arg));
|
||||
}
|
@ -12,8 +12,8 @@
|
||||
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/** */
|
||||
/** USBX Component */
|
||||
/** */
|
||||
/** USBX Component */
|
||||
/** */
|
||||
/** Video Class */
|
||||
/** */
|
||||
@ -30,52 +30,52 @@
|
||||
#include "ux_host_stack.h"
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _ux_host_class_video_frame_parameters_set PORTABLE C */
|
||||
/* 6.1.11 */
|
||||
/* 6.x */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Chaoqiong Xiao, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* */
|
||||
/* This function sets the video parameters for the video device. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* video Pointer to video class */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* video Pointer to video class */
|
||||
/* frame_format Video format to use */
|
||||
/* width Video frame width */
|
||||
/* height Video frame height */
|
||||
/* frame_interval Video frame interval */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* Completion Status */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* Completion Status */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _ux_host_class_video_format_data_get Get format data */
|
||||
/* _ux_host_class_video_frame_data_get Get frame data */
|
||||
/* _ux_host_stack_transfer_request Process transfer request */
|
||||
/* _ux_utility_descriptor_parse Parse descriptor */
|
||||
/* _ux_utility_descriptor_parse Parse descriptor */
|
||||
/* _ux_utility_memory_allocate Allocate memory block */
|
||||
/* _ux_utility_memory_free Release memory block */
|
||||
/* _ux_host_semaphore_get Get semaphore */
|
||||
/* _ux_host_semaphore_put Put semaphore */
|
||||
/* _ux_utility_long_get Read 32-bit value */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* Video Class */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* Application */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
|
||||
/* 09-30-2020 Chaoqiong Xiao Modified comment(s), */
|
||||
/* resulting in version 6.1 */
|
||||
@ -89,6 +89,8 @@
|
||||
/* internal clean up, */
|
||||
/* fixed standalone compile, */
|
||||
/* resulting in version 6.1.11 */
|
||||
/* xx-xx-xxxx Yajun xia Modified comment(s), */
|
||||
/* resulting in version 6.x */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _ux_host_class_video_frame_parameters_set(UX_HOST_CLASS_VIDEO *video, ULONG frame_format, ULONG width, ULONG height, ULONG frame_interval)
|
||||
@ -320,3 +322,56 @@ ULONG max_payload_size;
|
||||
}
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _uxe_host_class_video_frame_parameters_set PORTABLE C */
|
||||
/* 6.x */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Yajun Xia, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This function checks errors in video frame parameters set function */
|
||||
/* call. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* video Pointer to video class */
|
||||
/* frame_format Video format to use */
|
||||
/* width Video frame width */
|
||||
/* height Video frame height */
|
||||
/* frame_interval Video frame interval */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* Completion Status */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _ux_host_class_video_frame_parameters_set */
|
||||
/* Video frame parameters set */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* Application */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* xx-xx-xxxx Yajun xia Initial Version 6.x */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _uxe_host_class_video_frame_parameters_set(UX_HOST_CLASS_VIDEO *video, ULONG frame_format, ULONG width, ULONG height, ULONG frame_interval)
|
||||
{
|
||||
|
||||
/* Sanity checks. */
|
||||
if (video == UX_NULL)
|
||||
return(UX_INVALID_PARAMETER);
|
||||
|
||||
/* Call the actual video frame parameters set function. */
|
||||
return(_ux_host_class_video_frame_parameters_set(video, frame_format, width, height, frame_interval));
|
||||
}
|
||||
|
@ -12,8 +12,8 @@
|
||||
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/** */
|
||||
/** USBX Component */
|
||||
/** */
|
||||
/** USBX Component */
|
||||
/** */
|
||||
/** VIDEO Class */
|
||||
/** */
|
||||
@ -30,52 +30,52 @@
|
||||
#include "ux_host_stack.h"
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _ux_host_class_video_ioctl PORTABLE C */
|
||||
/* 6.1.12 */
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _ux_host_class_video_ioctl PORTABLE C */
|
||||
/* 6.x */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Chaoqiong Xiao, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This function is the ioctl entry point for the application to */
|
||||
/* */
|
||||
/* This function is the ioctl entry point for the application to */
|
||||
/* configure the video class based device. */
|
||||
/* */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* video Pointer to video class */
|
||||
/* ioctl_function Ioctl function */
|
||||
/* parameter Pointer to structure */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* Completion Status */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _ux_host_class_video_format_data_get Get video format data. */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* Completion Status */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _ux_host_class_video_format_data_get Get video format data. */
|
||||
/* _ux_host_class_video_frame_data_get Get video frame data */
|
||||
/* _ux_host_class_video_frame_interval_get */
|
||||
/* Get video frame internal data.*/
|
||||
/* Get video frame internal data.*/
|
||||
/* _ux_host_class_video_channel_start Start the video. */
|
||||
/* _ux_host_class_video_stop Stop the video. */
|
||||
/* _ux_host_stack_endpoint_transfer_abort */
|
||||
/* Abort the transfer */
|
||||
/* _ux_system_error_handler Log system error */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* Storage Class */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* Application */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
|
||||
/* 09-30-2020 Chaoqiong Xiao Modified comment(s), */
|
||||
/* resulting in version 6.1 */
|
||||
@ -83,6 +83,8 @@
|
||||
/* reset indexes of requests */
|
||||
/* ring when it is aborted, */
|
||||
/* resulting in version 6.1.12 */
|
||||
/* xx-xx-xxxx Yajun xia Modified comment(s), */
|
||||
/* resulting in version 6.x */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _ux_host_class_video_ioctl(UX_HOST_CLASS_VIDEO *video, ULONG ioctl_function,
|
||||
@ -98,9 +100,9 @@ UX_HOST_CLASS_VIDEO_PARAMETER_CHANNEL *channel_parameter;
|
||||
UX_HOST_CLASS_VIDEO_PARAMETER_FRAME_INTERVAL *interval_parameter;
|
||||
|
||||
/* Ensure the instance is valid. */
|
||||
if ((video -> ux_host_class_video_state != UX_HOST_CLASS_INSTANCE_LIVE) &&
|
||||
if ((video -> ux_host_class_video_state != UX_HOST_CLASS_INSTANCE_LIVE) &&
|
||||
(video -> ux_host_class_video_state != UX_HOST_CLASS_INSTANCE_MOUNTING))
|
||||
{
|
||||
{
|
||||
|
||||
/* If trace is enabled, insert this event into the trace buffer. */
|
||||
//UX_TRACE_IN_LINE_INSERT(UX_TRACE_ERROR, UX_HOST_CLASS_INSTANCE_UNKNOWN, video, 0, 0, UX_TRACE_ERRORS, 0, 0)
|
||||
@ -113,33 +115,33 @@ UX_HOST_CLASS_VIDEO_PARAMETER_FRAME_INTERVAL *interval_parameter;
|
||||
{
|
||||
|
||||
case UX_HOST_CLASS_VIDEO_IOCTL_GET_INPUT_TERMINAL:
|
||||
|
||||
|
||||
/* Set status to error by default. */
|
||||
status = UX_ERROR;
|
||||
|
||||
|
||||
/* Is the video terminal defined ? */
|
||||
if (video -> ux_host_class_video_terminal_id != 0)
|
||||
{
|
||||
|
||||
/* Cast answer. */
|
||||
input_terminal = (UX_HOST_CLASS_VIDEO_PARAMETER_INPUT_TERMINAL *) parameter;
|
||||
|
||||
input_terminal = (UX_HOST_CLASS_VIDEO_PARAMETER_INPUT_TERMINAL *) parameter;
|
||||
|
||||
/* Return input terminal id. */
|
||||
input_terminal -> ux_host_class_video_parameter_input_terminal_id = video -> ux_host_class_video_terminal_id;
|
||||
|
||||
/* Return input terminal type. */
|
||||
input_terminal -> ux_host_class_video_parameter_input_terminal_type = video -> ux_host_class_video_terminal_type;
|
||||
|
||||
|
||||
/* Status ok. */
|
||||
status = UX_SUCCESS;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
|
||||
case UX_HOST_CLASS_VIDEO_IOCTL_GET_FORMAT_NUMBER:
|
||||
|
||||
|
||||
/* Cast answer. */
|
||||
number_formats = (UX_HOST_CLASS_VIDEO_PARAMETER_NUMBER_FORMATS *) parameter;
|
||||
number_formats = (UX_HOST_CLASS_VIDEO_PARAMETER_NUMBER_FORMATS *) parameter;
|
||||
|
||||
/* Save the number of formats. */
|
||||
number_formats -> ux_host_class_video_parameter_number_formats = video -> ux_host_class_video_number_formats;
|
||||
@ -148,20 +150,20 @@ UX_HOST_CLASS_VIDEO_PARAMETER_FRAME_INTERVAL *interval_parameter;
|
||||
status = UX_SUCCESS;
|
||||
|
||||
break;
|
||||
|
||||
|
||||
case UX_HOST_CLASS_VIDEO_IOCTL_GET_FORMAT_DATA:
|
||||
|
||||
/* Cast answer. */
|
||||
format_parameter = (UX_HOST_CLASS_VIDEO_PARAMETER_FORMAT_DATA *) parameter;
|
||||
format_parameter = (UX_HOST_CLASS_VIDEO_PARAMETER_FORMAT_DATA *) parameter;
|
||||
|
||||
/* Get the format data for the format index requested. */
|
||||
status = _ux_host_class_video_format_data_get(video, format_parameter);
|
||||
break;
|
||||
|
||||
|
||||
case UX_HOST_CLASS_VIDEO_IOCTL_GET_FRAME_DATA:
|
||||
|
||||
/* Cast answer. */
|
||||
frame_parameter = (UX_HOST_CLASS_VIDEO_PARAMETER_FRAME_DATA *) parameter;
|
||||
frame_parameter = (UX_HOST_CLASS_VIDEO_PARAMETER_FRAME_DATA *) parameter;
|
||||
|
||||
/* Get the frame data for the frame index requested. */
|
||||
status = _ux_host_class_video_frame_data_get(video, frame_parameter);
|
||||
@ -179,18 +181,18 @@ UX_HOST_CLASS_VIDEO_PARAMETER_FRAME_INTERVAL *interval_parameter;
|
||||
case UX_HOST_CLASS_VIDEO_IOCTL_CHANNEL_START:
|
||||
|
||||
/* Cast answer. */
|
||||
channel_parameter = (UX_HOST_CLASS_VIDEO_PARAMETER_CHANNEL *) parameter;
|
||||
channel_parameter = (UX_HOST_CLASS_VIDEO_PARAMETER_CHANNEL *) parameter;
|
||||
|
||||
/* Start the channel for reading video input. */
|
||||
status = _ux_host_class_video_channel_start(video, channel_parameter);
|
||||
break;
|
||||
|
||||
|
||||
case UX_HOST_CLASS_VIDEO_IOCTL_CHANNEL_STOP:
|
||||
|
||||
/* Stop the channel. */
|
||||
status = _ux_host_class_video_stop(video);
|
||||
break;
|
||||
|
||||
|
||||
|
||||
case UX_HOST_CLASS_VIDEO_IOCTL_ABORT_IN_PIPE :
|
||||
|
||||
@ -203,12 +205,12 @@ UX_HOST_CLASS_VIDEO_PARAMETER_FRAME_INTERVAL *interval_parameter;
|
||||
/* All linked requests are aborted, reset indexes. */
|
||||
video -> ux_host_class_video_transfer_request_start_index = 0;
|
||||
video -> ux_host_class_video_transfer_request_end_index = 0;
|
||||
|
||||
|
||||
/* Status is successful. */
|
||||
status = UX_SUCCESS;
|
||||
break;
|
||||
|
||||
default:
|
||||
default:
|
||||
|
||||
/* Error trap. */
|
||||
_ux_system_error_handler(UX_SYSTEM_LEVEL_THREAD, UX_SYSTEM_CONTEXT_CLASS, UX_FUNCTION_NOT_SUPPORTED);
|
||||
@ -218,9 +220,59 @@ UX_HOST_CLASS_VIDEO_PARAMETER_FRAME_INTERVAL *interval_parameter;
|
||||
|
||||
/* Function not supported. Return an error. */
|
||||
status = UX_FUNCTION_NOT_SUPPORTED;
|
||||
}
|
||||
}
|
||||
|
||||
/* Return status to caller. */
|
||||
return(status);
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _uxe_host_class_video_ioctl PORTABLE C */
|
||||
/* 6.x */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Yajun Xia, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This function checks errors in video ioctl function call. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* video Pointer to video class */
|
||||
/* ioctl_function Ioctl function */
|
||||
/* parameter Pointer to structure */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* Completion Status */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _ux_host_class_video_ioctl Video ioctl */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* Application */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* xx-xx-xxxx Yajun xia Initial Version 6.x */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _uxe_host_class_video_ioctl(UX_HOST_CLASS_VIDEO *video, ULONG ioctl_function,
|
||||
VOID *parameter)
|
||||
{
|
||||
|
||||
/* Sanity checks. */
|
||||
if (video == UX_NULL)
|
||||
return(UX_INVALID_PARAMETER);
|
||||
|
||||
/* Call the actual video ioctl function. */
|
||||
return(_ux_host_class_video_ioctl(video, ioctl_function, parameter));
|
||||
}
|
@ -12,8 +12,8 @@
|
||||
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/** */
|
||||
/** USBX Component */
|
||||
/** */
|
||||
/** USBX Component */
|
||||
/** */
|
||||
/** Video Class */
|
||||
/** */
|
||||
@ -30,10 +30,10 @@
|
||||
#include "ux_host_stack.h"
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _ux_host_class_video_max_payload_get PORTABLE C */
|
||||
/* 6.1 */
|
||||
/* AUTHOR */
|
||||
@ -41,30 +41,30 @@
|
||||
/* Chaoqiong Xiao, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* */
|
||||
/* This function returns the maximum transfer size in a single payload */
|
||||
/* transfer. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* video Pointer to video class */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* video Pointer to video class */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* Maximum payload transfer size */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* None */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* Application */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
|
||||
/* 09-30-2020 Chaoqiong Xiao Modified comment(s), */
|
||||
/* resulting in version 6.1 */
|
||||
@ -77,3 +77,50 @@ ULONG _ux_host_class_video_max_payload_get(UX_HOST_CLASS_VIDEO *video)
|
||||
return(video ->ux_host_class_video_current_max_payload_size);
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _uxe_host_class_video_max_payload_get PORTABLE C */
|
||||
/* 6.x */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Yajun Xia, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This function checks errors in video max payload get function call. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* video Pointer to video class */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* Maximum payload transfer size */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _ux_host_class_video_max_payload_get Video max payload get */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* Application */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* xx-xx-xxxx Yajun xia Initial Version 6.x */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
ULONG _uxe_host_class_video_max_payload_get(UX_HOST_CLASS_VIDEO *video)
|
||||
{
|
||||
|
||||
/* Sanity checks. */
|
||||
if (video == UX_NULL)
|
||||
return(0);
|
||||
|
||||
/* Call the actual video max payload get function. */
|
||||
return(_ux_host_class_video_max_payload_get(video));
|
||||
}
|
@ -12,8 +12,8 @@
|
||||
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/** */
|
||||
/** USBX Component */
|
||||
/** */
|
||||
/** USBX Component */
|
||||
/** */
|
||||
/** Video Class */
|
||||
/** */
|
||||
@ -30,19 +30,19 @@
|
||||
#include "ux_host_stack.h"
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _ux_host_class_video_read PORTABLE C */
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _ux_host_class_video_read PORTABLE C */
|
||||
/* 6.1.11 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Chaoqiong Xiao, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This function reads from the video streaming interface. */
|
||||
/* */
|
||||
/* This function reads from the video streaming interface. */
|
||||
/* */
|
||||
/* Note if the transfer request is not linked (next pointer is NULL), */
|
||||
/* a single request is performed. If the transfer request links into a */
|
||||
@ -50,33 +50,33 @@
|
||||
/* */
|
||||
/* Note check ux_host_class_video_max_payload_get to see request */
|
||||
/* length limitation. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* video Pointer to video class */
|
||||
/* video_transfer_request Pointer to transfer request */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* Completion Status */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _ux_host_class_video_transfer_request Video transfer request */
|
||||
/* _ux_host_stack_class_instance_verify Verify instance is valid */
|
||||
/* _ux_host_semaphore_get Get semaphore */
|
||||
/* _ux_host_semaphore_put Put semaphore */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* video Pointer to video class */
|
||||
/* video_transfer_request Pointer to transfer request */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* Completion Status */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _ux_host_class_video_transfer_request Video transfer request */
|
||||
/* _ux_host_stack_class_instance_verify Verify instance is valid */
|
||||
/* _ux_host_semaphore_get Get semaphore */
|
||||
/* _ux_host_semaphore_put Put semaphore */
|
||||
/* _ux_system_error_handler System error log */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* Application */
|
||||
/* Video Class */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* Application */
|
||||
/* Video Class */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
|
||||
/* 09-30-2020 Chaoqiong Xiao Modified comment(s), */
|
||||
/* resulting in version 6.1 */
|
||||
@ -101,7 +101,7 @@ UX_HOST_CLASS_VIDEO_TRANSFER_REQUEST *transfer_list;
|
||||
|
||||
/* Ensure the instance is valid. */
|
||||
if (_ux_host_stack_class_instance_verify(_ux_system_host_class_video_name, (VOID *) video) != UX_SUCCESS)
|
||||
{
|
||||
{
|
||||
|
||||
/* Error trap. */
|
||||
_ux_system_error_handler(UX_SYSTEM_LEVEL_THREAD, UX_SYSTEM_CONTEXT_CLASS, UX_HOST_CLASS_INSTANCE_UNKNOWN);
|
||||
@ -116,7 +116,7 @@ UX_HOST_CLASS_VIDEO_TRANSFER_REQUEST *transfer_list;
|
||||
|
||||
/* By default the transmission will be successful. */
|
||||
status = UX_SUCCESS;
|
||||
|
||||
|
||||
/* Ensure we have a selected interface that allows isoch transmission. */
|
||||
if ((video -> ux_host_class_video_isochronous_endpoint == UX_NULL) ||
|
||||
(video -> ux_host_class_video_isochronous_endpoint -> ux_endpoint_descriptor.wMaxPacketSize == 0))
|
||||
@ -145,3 +145,52 @@ UX_HOST_CLASS_VIDEO_TRANSFER_REQUEST *transfer_list;
|
||||
return(status);
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _uxe_host_class_video_read PORTABLE C */
|
||||
/* 6.x */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Yajun Xia, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This function checks errors in video read function call. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* video Pointer to video class */
|
||||
/* video_transfer_request Pointer to transfer request */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* Completion Status */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _ux_host_class_video_read Video read */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* Application */
|
||||
/* Video Class */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* xx-xx-xxxx Yajun xia Initial Version 6.x */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _uxe_host_class_video_read(UX_HOST_CLASS_VIDEO *video, UX_HOST_CLASS_VIDEO_TRANSFER_REQUEST *video_transfer_request)
|
||||
{
|
||||
|
||||
/* Sanity checks. */
|
||||
if ((video == UX_NULL) || (video_transfer_request == UX_NULL))
|
||||
return(UX_INVALID_PARAMETER);
|
||||
|
||||
/* Call the actual video read function. */
|
||||
return(_ux_host_class_video_read(video, video_transfer_request));
|
||||
}
|
||||
|
@ -12,8 +12,8 @@
|
||||
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/** */
|
||||
/** USBX Component */
|
||||
/** */
|
||||
/** USBX Component */
|
||||
/** */
|
||||
/** Video Class */
|
||||
/** */
|
||||
@ -30,10 +30,10 @@
|
||||
#include "ux_host_stack.h"
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _ux_host_class_video_start PORTABLE C */
|
||||
/* 6.1 */
|
||||
/* AUTHOR */
|
||||
@ -41,29 +41,29 @@
|
||||
/* Chaoqiong Xiao, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* */
|
||||
/* This function starts the video streaming. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* video Pointer to video class */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* Completion Status */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* video Pointer to video class */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* Completion Status */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _ux_host_class_video_channel_start Start video device */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* Application */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
|
||||
/* 09-30-2020 Chaoqiong Xiao Modified comment(s), */
|
||||
/* resulting in version 6.1 */
|
||||
@ -93,3 +93,50 @@ UINT status;
|
||||
return(status);
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _uxe_host_class_video_start PORTABLE C */
|
||||
/* 6.x */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Yajun Xia, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This function checks errors in video start function call. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* video Pointer to video class */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* Completion Status */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _ux_host_class_video_start Video start */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* Application */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* xx-xx-xxxx Yajun xia Initial Version 6.x */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _uxe_host_class_video_start(UX_HOST_CLASS_VIDEO *video)
|
||||
{
|
||||
|
||||
/* Sanity checks. */
|
||||
if (video == UX_NULL)
|
||||
return(UX_INVALID_PARAMETER);
|
||||
|
||||
/* Call the actual video start function. */
|
||||
return(_ux_host_class_video_start(video));
|
||||
}
|
@ -12,8 +12,8 @@
|
||||
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/** */
|
||||
/** USBX Component */
|
||||
/** */
|
||||
/** USBX Component */
|
||||
/** */
|
||||
/** Video Class */
|
||||
/** */
|
||||
@ -30,10 +30,10 @@
|
||||
#include "ux_host_stack.h"
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _ux_host_class_video_stop PORTABLE C */
|
||||
/* 6.1.12 */
|
||||
/* AUTHOR */
|
||||
@ -41,34 +41,34 @@
|
||||
/* Chaoqiong Xiao, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This function stops the video channel. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* video Pointer to video class */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* Completion Status */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* */
|
||||
/* This function stops the video channel. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* video Pointer to video class */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* Completion Status */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _ux_host_stack_endpoint_transfer_abort */
|
||||
/* Abort outstanding transfer */
|
||||
/* _ux_host_stack_interface_setting_select */
|
||||
/* Select interface */
|
||||
/* _ux_host_semaphore_get Get semaphore */
|
||||
/* _ux_host_semaphore_put Release semaphore */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* Video Class */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* _ux_host_semaphore_get Get semaphore */
|
||||
/* _ux_host_semaphore_put Release semaphore */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* Video Class */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
|
||||
/* 09-30-2020 Chaoqiong Xiao Modified comment(s), */
|
||||
/* resulting in version 6.1 */
|
||||
@ -154,3 +154,50 @@ UINT streaming_interface;
|
||||
return(status);
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _uxe_host_class_video_stop PORTABLE C */
|
||||
/* 6.x */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Yajun Xia, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This function checks errors in video stop function call. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* video Pointer to video class */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* Completion Status */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _ux_host_class_video_stop Video stop */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* Video Class */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* xx-xx-xxxx Yajun xia Initial Version 6.x */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _uxe_host_class_video_stop(UX_HOST_CLASS_VIDEO *video)
|
||||
{
|
||||
|
||||
/* Sanity checks. */
|
||||
if (video == UX_NULL)
|
||||
return(UX_INVALID_PARAMETER);
|
||||
|
||||
/* Call the actual video stop function. */
|
||||
return(_ux_host_class_video_stop(video));
|
||||
}
|
@ -12,8 +12,8 @@
|
||||
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/** */
|
||||
/** USBX Component */
|
||||
/** */
|
||||
/** USBX Component */
|
||||
/** */
|
||||
/** Video Class */
|
||||
/** */
|
||||
@ -30,48 +30,48 @@
|
||||
#include "ux_host_stack.h"
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _ux_host_class_video_transfer_buffer_add PORTABLE C */
|
||||
/* 6.1.12 */
|
||||
/* 6.x */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Chaoqiong Xiao, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* */
|
||||
/* This function adds a buffer for video transfer requests. */
|
||||
/* */
|
||||
/* */
|
||||
/* Note check ux_host_class_video_max_payload_get to see minimum */
|
||||
/* recommended buffer size. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* video Pointer to video class */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* video Pointer to video class */
|
||||
/* buffer Pointer to data buffer */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* Completion Status */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* Completion Status */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _ux_host_stack_class_instance_verify Verify instance is valid */
|
||||
/* _ux_host_stack_transfer_request Process transfer request */
|
||||
/* _ux_host_semaphore_get Get semaphore */
|
||||
/* _ux_host_semaphore_put Release semaphore */
|
||||
/* _ux_system_error_handler Log system error */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* Video Class */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* _ux_system_error_handler Log system error */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* Application */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
|
||||
/* 09-30-2020 Chaoqiong Xiao Modified comment(s), */
|
||||
/* resulting in version 6.1 */
|
||||
@ -88,6 +88,8 @@
|
||||
/* 07-29-2022 Chaoqiong Xiao Modified comment(s), */
|
||||
/* set pending on endpoint, */
|
||||
/* resulting in version 6.1.12 */
|
||||
/* xx-xx-xxxx Yajun xia Modified comment(s), */
|
||||
/* resulting in version 6.x */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _ux_host_class_video_transfer_buffer_add(UX_HOST_CLASS_VIDEO *video, UCHAR* buffer)
|
||||
@ -181,3 +183,54 @@ ULONG packet_size;
|
||||
/* Return completion status. */
|
||||
return(status);
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _uxe_host_class_video_transfer_buffer_add PORTABLE C */
|
||||
/* 6.x */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Yajun Xia, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This function checks errors in video transfer buffer add function */
|
||||
/* call. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* video Pointer to video class */
|
||||
/* buffer Pointer to data buffer */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* Completion Status */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _ux_host_class_video_transfer_buffer_add */
|
||||
/* video transfer buffer add */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* Application */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* xx-xx-xxxx Yajun xia Initial Version 6.x */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _uxe_host_class_video_transfer_buffer_add(UX_HOST_CLASS_VIDEO *video, UCHAR* buffer)
|
||||
{
|
||||
|
||||
/* Sanity checks. */
|
||||
if ((video == UX_NULL) || (buffer == UX_NULL))
|
||||
return(UX_INVALID_PARAMETER);
|
||||
|
||||
/* Call actual video transfer buffer add function. */
|
||||
return(_ux_host_class_video_transfer_buffer_add(video, buffer));
|
||||
}
|
||||
|
@ -35,7 +35,7 @@
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _ux_host_class_video_transfer_buffers_add PORTABLE C */
|
||||
/* 6.1.12 */
|
||||
/* 6.x */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Chaoqiong Xiao, Microsoft Corporation */
|
||||
@ -75,7 +75,7 @@
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* Video Class */
|
||||
/* Application */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
@ -97,6 +97,8 @@
|
||||
/* 07-29-2022 Chaoqiong Xiao Modified comment(s), */
|
||||
/* set pending on endpoint, */
|
||||
/* resulting in version 6.1.12 */
|
||||
/* xx-xx-xxxx Yajun xia Modified comment(s), */
|
||||
/* resulting in version 6.x */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _ux_host_class_video_transfer_buffers_add(UX_HOST_CLASS_VIDEO *video, UCHAR** buffers, ULONG num_buffers)
|
||||
@ -228,3 +230,56 @@ UINT i;
|
||||
/* Return completion status. */
|
||||
return(status);
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _uxe_host_class_video_transfer_buffers_add PORTABLE C */
|
||||
/* 6.x */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Yajun Xia, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This function checks errors in video transfer buffers add function */
|
||||
/* call. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* video Pointer to video class */
|
||||
/* buffers Pointer to data buffer */
|
||||
/* pointers array */
|
||||
/* num_buffers Number of data buffers */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* Completion Status */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _ux_host_class_video_transfer_buffers_add */
|
||||
/* video transfer buffers add */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* Application */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* xx-xx-xxxx Yajun xia Initial Version 6.x */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _uxe_host_class_video_transfer_buffers_add(UX_HOST_CLASS_VIDEO *video, UCHAR** buffers, ULONG num_buffers)
|
||||
{
|
||||
|
||||
/* Sanity checks. */
|
||||
if ((video == UX_NULL) || (buffers == UX_NULL) || (num_buffers == 0))
|
||||
return(UX_INVALID_PARAMETER);
|
||||
|
||||
/* Call the actual video transfer buffers add function. */
|
||||
return(_ux_host_class_video_transfer_buffers_add(video, buffers, num_buffers));
|
||||
}
|
||||
|
@ -12,8 +12,8 @@
|
||||
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/** */
|
||||
/** USBX Component */
|
||||
/** */
|
||||
/** USBX Component */
|
||||
/** */
|
||||
/** Video Class */
|
||||
/** */
|
||||
@ -30,10 +30,10 @@
|
||||
#include "ux_host_stack.h"
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _ux_host_class_video_transfer_callback_set PORTABLE C */
|
||||
/* 6.1 */
|
||||
/* AUTHOR */
|
||||
@ -41,30 +41,30 @@
|
||||
/* Chaoqiong Xiao, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* */
|
||||
/* This function sets the callback function for video transfers. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* video Pointer to video class */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* video Pointer to video class */
|
||||
/* callback_function Pointer to callback function */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* Completion Status */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* Completion Status */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* None */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* Application */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
|
||||
/* 09-30-2020 Chaoqiong Xiao Modified comment(s), */
|
||||
/* resulting in version 6.1 */
|
||||
@ -77,3 +77,59 @@ VOID _ux_host_class_video_transfer_callback_set(UX_HOST_CLASS_VIDEO *video, VOI
|
||||
video -> ux_host_class_video_transfer_completion_function = callback_function;
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _uxe_host_class_video_transfer_callback_set PORTABLE C */
|
||||
/* 6.x */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Yajun Xia, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This function checks errors in video transfer callback set function */
|
||||
/* call. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* video Pointer to video class */
|
||||
/* callback_function Pointer to callback function */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* Completion Status */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _ux_host_class_video_transfer_callback_set */
|
||||
/* video transfer callback set */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* Application */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* xx-xx-xxxx Yajun xia Initial Version 6.x */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
VOID _uxe_host_class_video_transfer_callback_set(UX_HOST_CLASS_VIDEO *video, VOID (*callback_function)(UX_TRANSFER*))
|
||||
{
|
||||
|
||||
/* Sanity checks. */
|
||||
if (video == UX_NULL)
|
||||
{
|
||||
|
||||
/* Return error. */
|
||||
_ux_system_error_handler(UX_SYSTEM_LEVEL_THREAD, UX_SYSTEM_CONTEXT_CLASS, UX_INVALID_PARAMETER);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Call the actual video transfer callback set function. */
|
||||
_ux_host_class_video_transfer_callback_set(video, callback_function);
|
||||
}
|
@ -31,6 +31,118 @@
|
||||
#include "ux_device_class_pima.h"
|
||||
|
||||
|
||||
#ifdef UX_PIMA_WITH_MTP_SUPPORT
|
||||
static USHORT _dpsclient_object_prop_supported[] = {0};
|
||||
static UINT _dpsclient_object_prop_desc_get (struct UX_SLAVE_CLASS_PIMA_STRUCT *pima,
|
||||
ULONG object_property,
|
||||
ULONG object_format_code,
|
||||
UCHAR **object_prop_dataset,
|
||||
ULONG *object_prop_dataset_length)
|
||||
{
|
||||
UX_PARAMETER_NOT_USED(pima);
|
||||
UX_PARAMETER_NOT_USED(object_property);
|
||||
UX_PARAMETER_NOT_USED(object_format_code);
|
||||
UX_PARAMETER_NOT_USED(object_prop_dataset);
|
||||
UX_PARAMETER_NOT_USED(object_prop_dataset_length);
|
||||
return(UX_DEVICE_CLASS_PIMA_RC_OPERATION_NOT_SUPPORTED);
|
||||
}
|
||||
static UINT _dpsclient_object_prop_value_get (struct UX_SLAVE_CLASS_PIMA_STRUCT *pima,
|
||||
ULONG object_handle,
|
||||
ULONG object_property,
|
||||
UCHAR **object_prop_value,
|
||||
ULONG *object_prop_value_length)
|
||||
{
|
||||
UX_PARAMETER_NOT_USED(pima);
|
||||
UX_PARAMETER_NOT_USED(object_handle);
|
||||
UX_PARAMETER_NOT_USED(object_property);
|
||||
UX_PARAMETER_NOT_USED(object_prop_value);
|
||||
UX_PARAMETER_NOT_USED(object_prop_value_length);
|
||||
return(UX_DEVICE_CLASS_PIMA_RC_OPERATION_NOT_SUPPORTED);
|
||||
}
|
||||
static UINT _dpsclient_object_prop_value_set (struct UX_SLAVE_CLASS_PIMA_STRUCT *pima,
|
||||
ULONG object_handle,
|
||||
ULONG object_property,
|
||||
UCHAR *object_prop_value,
|
||||
ULONG object_prop_value_length)
|
||||
{
|
||||
UX_PARAMETER_NOT_USED(pima);
|
||||
UX_PARAMETER_NOT_USED(object_handle);
|
||||
UX_PARAMETER_NOT_USED(object_property);
|
||||
UX_PARAMETER_NOT_USED(object_prop_value);
|
||||
UX_PARAMETER_NOT_USED(object_prop_value_length);
|
||||
return(UX_DEVICE_CLASS_PIMA_RC_OPERATION_NOT_SUPPORTED);
|
||||
}
|
||||
static UINT _dpsclient_object_references_get (struct UX_SLAVE_CLASS_PIMA_STRUCT *pima,
|
||||
ULONG object_handle,
|
||||
UCHAR **object_references_array,
|
||||
ULONG *object_references_array_length)
|
||||
{
|
||||
UX_PARAMETER_NOT_USED(pima);
|
||||
UX_PARAMETER_NOT_USED(object_handle);
|
||||
UX_PARAMETER_NOT_USED(object_references_array);
|
||||
UX_PARAMETER_NOT_USED(object_references_array_length);
|
||||
return(UX_DEVICE_CLASS_PIMA_RC_OPERATION_NOT_SUPPORTED);
|
||||
}
|
||||
static UINT _dpsclient_object_references_set (struct UX_SLAVE_CLASS_PIMA_STRUCT *pima,
|
||||
ULONG object_handle,
|
||||
UCHAR *object_references_array,
|
||||
ULONG object_references_array_length)
|
||||
{
|
||||
UX_PARAMETER_NOT_USED(pima);
|
||||
UX_PARAMETER_NOT_USED(object_handle);
|
||||
UX_PARAMETER_NOT_USED(object_references_array);
|
||||
UX_PARAMETER_NOT_USED(object_references_array_length);
|
||||
return(UX_DEVICE_CLASS_PIMA_RC_OPERATION_NOT_SUPPORTED);
|
||||
}
|
||||
#endif
|
||||
static UINT _dpsclient_device_reset(struct UX_SLAVE_CLASS_PIMA_STRUCT *pima)
|
||||
{
|
||||
UX_PARAMETER_NOT_USED(pima);
|
||||
return(UX_DEVICE_CLASS_PIMA_RC_OPERATION_NOT_SUPPORTED);
|
||||
}
|
||||
static UINT _dpsclient_device_prop_desc_get(struct UX_SLAVE_CLASS_PIMA_STRUCT *pima,
|
||||
ULONG device_property,
|
||||
UCHAR **device_prop_dataset,
|
||||
ULONG *device_prop_dataset_length)
|
||||
|
||||
{
|
||||
UX_PARAMETER_NOT_USED(pima);
|
||||
UX_PARAMETER_NOT_USED(device_property);
|
||||
UX_PARAMETER_NOT_USED(device_prop_dataset);
|
||||
UX_PARAMETER_NOT_USED(device_prop_dataset_length);
|
||||
return(UX_DEVICE_CLASS_PIMA_RC_OPERATION_NOT_SUPPORTED);
|
||||
}
|
||||
static UINT _dpsclient_device_prop_value_get(struct UX_SLAVE_CLASS_PIMA_STRUCT *pima,
|
||||
ULONG device_property,
|
||||
UCHAR **device_prop_value,
|
||||
ULONG *device_prop_value_length)
|
||||
{
|
||||
UX_PARAMETER_NOT_USED(pima);
|
||||
UX_PARAMETER_NOT_USED(device_property);
|
||||
UX_PARAMETER_NOT_USED(device_prop_value);
|
||||
UX_PARAMETER_NOT_USED(device_prop_value_length);
|
||||
return(UX_DEVICE_CLASS_PIMA_RC_OPERATION_NOT_SUPPORTED);
|
||||
}
|
||||
static UINT _dpsclient_device_prop_value_set(struct UX_SLAVE_CLASS_PIMA_STRUCT *pima,
|
||||
ULONG device_property,
|
||||
UCHAR *device_prop_value,
|
||||
ULONG device_prop_value_length)
|
||||
{
|
||||
UX_PARAMETER_NOT_USED(pima);
|
||||
UX_PARAMETER_NOT_USED(device_property);
|
||||
UX_PARAMETER_NOT_USED(device_prop_value);
|
||||
UX_PARAMETER_NOT_USED(device_prop_value_length);
|
||||
return(UX_DEVICE_CLASS_PIMA_RC_OPERATION_NOT_SUPPORTED);
|
||||
}
|
||||
static UINT _dpsclient_storage_format(struct UX_SLAVE_CLASS_PIMA_STRUCT *pima,
|
||||
ULONG storage_id)
|
||||
{
|
||||
UX_PARAMETER_NOT_USED(pima);
|
||||
UX_PARAMETER_NOT_USED(storage_id);
|
||||
return(UX_DEVICE_CLASS_PIMA_RC_OPERATION_NOT_SUPPORTED);
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
@ -73,6 +185,9 @@
|
||||
/* 07-29-2022 Chaoqiong Xiao Modified comment(s), */
|
||||
/* used macros for RTOS calls, */
|
||||
/* resulting in version 6.1.12 */
|
||||
/* xx-xx-xxxx Chaoqiong Xiao Modified comment(s), */
|
||||
/* initialized PIMA callbacks, */
|
||||
/* resulting in version 6.x */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _ux_pictbridge_dpsclient_start(UX_PICTBRIDGE *pictbridge)
|
||||
@ -223,6 +338,7 @@ UX_SLAVE_CLASS_PIMA_OBJECT *object_info;
|
||||
pictbridge -> ux_pictbridge_pima_parameter.ux_device_class_pima_parameter_storage_free_space_image = 0;
|
||||
pictbridge -> ux_pictbridge_pima_parameter.ux_device_class_pima_parameter_storage_description = _ux_pictbridge_volume_description;
|
||||
pictbridge -> ux_pictbridge_pima_parameter.ux_device_class_pima_parameter_storage_volume_label = _ux_pictbridge_volume_label;
|
||||
|
||||
pictbridge -> ux_pictbridge_pima_parameter.ux_device_class_pima_parameter_object_number_get = _ux_pictbridge_dpsclient_object_number_get;
|
||||
pictbridge -> ux_pictbridge_pima_parameter.ux_device_class_pima_parameter_object_handles_get = _ux_pictbridge_dpsclient_object_handles_get;
|
||||
pictbridge -> ux_pictbridge_pima_parameter.ux_device_class_pima_parameter_object_info_get = _ux_pictbridge_dpsclient_object_info_get;
|
||||
@ -231,6 +347,21 @@ UX_SLAVE_CLASS_PIMA_OBJECT *object_info;
|
||||
pictbridge -> ux_pictbridge_pima_parameter.ux_device_class_pima_parameter_object_data_send = _ux_pictbridge_dpsclient_object_data_send;
|
||||
pictbridge -> ux_pictbridge_pima_parameter.ux_device_class_pima_parameter_object_delete = _ux_pictbridge_dpsclient_object_delete;
|
||||
|
||||
#ifdef UX_PIMA_WITH_MTP_SUPPORT
|
||||
pictbridge -> ux_pictbridge_pima_parameter.ux_device_class_pima_parameter_object_properties_list = _dpsclient_object_prop_supported;
|
||||
|
||||
pictbridge -> ux_pictbridge_pima_parameter.ux_device_class_pima_parameter_object_prop_desc_get = _dpsclient_object_prop_desc_get;
|
||||
pictbridge -> ux_pictbridge_pima_parameter.ux_device_class_pima_parameter_object_prop_value_get = _dpsclient_object_prop_value_get;
|
||||
pictbridge -> ux_pictbridge_pima_parameter.ux_device_class_pima_parameter_object_prop_value_set = _dpsclient_object_prop_value_set;
|
||||
pictbridge -> ux_pictbridge_pima_parameter.ux_device_class_pima_parameter_object_references_get = _dpsclient_object_references_get;
|
||||
pictbridge -> ux_pictbridge_pima_parameter.ux_device_class_pima_parameter_object_references_set = _dpsclient_object_references_set;
|
||||
#endif
|
||||
pictbridge -> ux_pictbridge_pima_parameter.ux_device_class_pima_parameter_device_reset = _dpsclient_device_reset;
|
||||
pictbridge -> ux_pictbridge_pima_parameter.ux_device_class_pima_parameter_device_prop_desc_get = _dpsclient_device_prop_desc_get;
|
||||
pictbridge -> ux_pictbridge_pima_parameter.ux_device_class_pima_parameter_device_prop_value_get = _dpsclient_device_prop_value_get;
|
||||
pictbridge -> ux_pictbridge_pima_parameter.ux_device_class_pima_parameter_device_prop_value_set = _dpsclient_device_prop_value_set;
|
||||
pictbridge -> ux_pictbridge_pima_parameter.ux_device_class_pima_parameter_storage_format = _dpsclient_storage_format;
|
||||
|
||||
/* Store the instance owner. */
|
||||
pictbridge -> ux_pictbridge_pima_parameter.ux_device_class_pima_parameter_application = (VOID *) pictbridge;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user