usbx/ports/linux/gnu/inc/ux_port.h

267 lines
8.9 KiB
C
Raw Permalink Normal View History

2024-01-29 14:21:32 +08:00
/***************************************************************************
* Copyright (c) 2024 Microsoft Corporation
*
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
*
* SPDX-License-Identifier: MIT
**************************************************************************/
2020-11-10 13:37:32 -08:00
/**************************************************************************/
/**************************************************************************/
/** */
/** USBX Component */
/** */
/** Port Specific */
/** */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/* */
/* PORT SPECIFIC C INFORMATION RELEASE */
/* */
/* ux_port.h Linux/GNU */
Update on 23 Oct 2023. Expand to see details. 52c60057 Update headers and readme for 6.3.0 release. 5360ad52 Host H264 frame support. 4b097e80 Add javascript to codeql detection 70278ae3 Fixed use after free issues. 5560620e Improved standalone enum transfer flow. Turn off ASIX in standalone build. Im... 39a01206 Improved host HID clients (mouse/keyboard/remote control) deactivation sequence. be2c7fd5 Improved standalone host CDC ACM control and data instance link management (MSRC 81489,81570) c2368eb2 Improved AC AS management and error handing. b9c23b38 PIMA Host/device optional interrupt endpoint support and host unused semaphore removal. 34ca3af9 Removed interface link in class linked to device. 5d3c9dd0 Improved endpoints get error handling (host CDC-ECM/ACM, storage). Moved stor... 71b08ad1 Improved host audio descriptors validation 4717e3f1 Enable weekly pipeline build to avoid CodeQL expiration ca408b54 Checked XML tag nesting depth in Pictbridge object parsing c300a00c Limited pictbridge array element to hexa output array size. 0e644aaa Reject fake CDC-ECM data interface not located next to its control interface. 911007a9 Improved host HID usage handling. d0576877 Enable dummy check of python for CodeQL 2761e105 Fixed some split transfer issue. db0dbeda Added packet length validation for received nx packet. f5007249 Fix PIMA issues on data set extraction 3ec66399 Fixing device RNDIS bugs with zero copy 1ec77d6b Fix device HID issue when adding class memory man and zero copy. d52e55c0 Add zero copy support in device printer a5cb883f Added zero copy support in device CDC_ECM and RNDIS 1f967ae2 Enable codeql in onebranch pipeline de265dbc Enable zero copy for device audio and video 53aee275 Refined memory management to reduce overhead.
2023-10-23 05:31:40 +00:00
/* 6.3.0 */
2020-11-10 13:37:32 -08:00
/* */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This file contains data type definitions that make USBX function */
/* identically on a variety of different processor architectures. */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
2021-10-13 06:50:29 +00:00
/* 10-15-2021 Chaoqiong Xiao Initial Version 6.1.9 */
2022-01-26 23:54:01 +00:00
/* 01-31-2022 Chaoqiong Xiao Modified comment(s), */
/* moved tx_api.h include and */
/* typedefs from ux_api.h, */
/* resulting in version 6.1.10 */
Update on 23 Oct 2023. Expand to see details. 52c60057 Update headers and readme for 6.3.0 release. 5360ad52 Host H264 frame support. 4b097e80 Add javascript to codeql detection 70278ae3 Fixed use after free issues. 5560620e Improved standalone enum transfer flow. Turn off ASIX in standalone build. Im... 39a01206 Improved host HID clients (mouse/keyboard/remote control) deactivation sequence. be2c7fd5 Improved standalone host CDC ACM control and data instance link management (MSRC 81489,81570) c2368eb2 Improved AC AS management and error handing. b9c23b38 PIMA Host/device optional interrupt endpoint support and host unused semaphore removal. 34ca3af9 Removed interface link in class linked to device. 5d3c9dd0 Improved endpoints get error handling (host CDC-ECM/ACM, storage). Moved stor... 71b08ad1 Improved host audio descriptors validation 4717e3f1 Enable weekly pipeline build to avoid CodeQL expiration ca408b54 Checked XML tag nesting depth in Pictbridge object parsing c300a00c Limited pictbridge array element to hexa output array size. 0e644aaa Reject fake CDC-ECM data interface not located next to its control interface. 911007a9 Improved host HID usage handling. d0576877 Enable dummy check of python for CodeQL 2761e105 Fixed some split transfer issue. db0dbeda Added packet length validation for received nx packet. f5007249 Fix PIMA issues on data set extraction 3ec66399 Fixing device RNDIS bugs with zero copy 1ec77d6b Fix device HID issue when adding class memory man and zero copy. d52e55c0 Add zero copy support in device printer a5cb883f Added zero copy support in device CDC_ECM and RNDIS 1f967ae2 Enable codeql in onebranch pipeline de265dbc Enable zero copy for device audio and video 53aee275 Refined memory management to reduce overhead.
2023-10-23 05:31:40 +00:00
/* 10-31-2023 Chaoqiong Xiao Modified comment(s), */
/* added basic types guards, */
/* improved SLONG typedef, */
Update on 23 Oct 2023. Expand to see details. 52c60057 Update headers and readme for 6.3.0 release. 5360ad52 Host H264 frame support. 4b097e80 Add javascript to codeql detection 70278ae3 Fixed use after free issues. 5560620e Improved standalone enum transfer flow. Turn off ASIX in standalone build. Im... 39a01206 Improved host HID clients (mouse/keyboard/remote control) deactivation sequence. be2c7fd5 Improved standalone host CDC ACM control and data instance link management (MSRC 81489,81570) c2368eb2 Improved AC AS management and error handing. b9c23b38 PIMA Host/device optional interrupt endpoint support and host unused semaphore removal. 34ca3af9 Removed interface link in class linked to device. 5d3c9dd0 Improved endpoints get error handling (host CDC-ECM/ACM, storage). Moved stor... 71b08ad1 Improved host audio descriptors validation 4717e3f1 Enable weekly pipeline build to avoid CodeQL expiration ca408b54 Checked XML tag nesting depth in Pictbridge object parsing c300a00c Limited pictbridge array element to hexa output array size. 0e644aaa Reject fake CDC-ECM data interface not located next to its control interface. 911007a9 Improved host HID usage handling. d0576877 Enable dummy check of python for CodeQL 2761e105 Fixed some split transfer issue. db0dbeda Added packet length validation for received nx packet. f5007249 Fix PIMA issues on data set extraction 3ec66399 Fixing device RNDIS bugs with zero copy 1ec77d6b Fix device HID issue when adding class memory man and zero copy. d52e55c0 Add zero copy support in device printer a5cb883f Added zero copy support in device CDC_ECM and RNDIS 1f967ae2 Enable codeql in onebranch pipeline de265dbc Enable zero copy for device audio and video 53aee275 Refined memory management to reduce overhead.
2023-10-23 05:31:40 +00:00
/* resulting in version 6.3.0 */
2020-11-10 13:37:32 -08:00
/* */
/**************************************************************************/
#ifndef UX_PORT_H
#define UX_PORT_H
/* Remap keywords in the Visual environment. */
#define class usbx_class
#define interface uxbx_interface
/* Determine if the optional USBX user define file should be used. */
#ifdef UX_INCLUDE_USER_DEFINE_FILE
/* Yes, include the user defines in ux_user.h. The defines in this file may
alternately be defined on the command line. */
#include "ux_user.h"
#endif
/* Include library header files. */
#include <stdio.h>
#include <string.h>
2022-01-26 23:54:01 +00:00
#if !defined(UX_STANDALONE)
#include "tx_api.h"
#else
/* VAR types used in UX,
if TX still used, expects tx_api.h included before include this. */
#if !defined(TX_API_H) && !defined(TX_PORT_H)
#include <stdint.h>
#ifndef VOID
#define VOID void
2022-01-26 23:54:01 +00:00
typedef char CHAR;
typedef unsigned char UCHAR;
typedef int INT;
typedef unsigned int UINT;
typedef long LONG;
typedef unsigned long ULONG;
typedef short SHORT;
typedef unsigned short USHORT;
#endif
#ifndef ULONG64_DEFINED
2022-01-26 23:54:01 +00:00
typedef uint64_t ULONG64;
#define ULONG64_DEFINED
#endif
2022-01-26 23:54:01 +00:00
#ifndef ALIGN_TYPE_DEFINED
#define ALIGN_TYPE ULONG
#define ALIGN_TYPE_DEFINED
2022-01-26 23:54:01 +00:00
#endif
#endif
#endif
2020-11-10 13:37:32 -08:00
/* CPU definition for X86 systems without preemptive timer function.
This will make USBX uses the controller for the timer. */
#undef THREADX_X86_NO_PTIMER
/* For X86 systems, the define #define UX_USE_IO_INSTRUCTIONS should be used. */
/* Define additional generic USBX types. */
#ifndef SLONG_DEFINED
typedef LONG SLONG;
#define SLONG_DEFINED
#endif
2020-11-10 13:37:32 -08:00
/* Generic USBX Project constants follow. */
#ifndef UX_PERIODIC_RATE
#define UX_PERIODIC_RATE 100
#endif
#ifndef UX_MAX_CLASS_DRIVER
#define UX_MAX_CLASS_DRIVER 8
#endif
#ifndef UX_MAX_SLAVE_CLASS_DRIVER
#define UX_MAX_SLAVE_CLASS_DRIVER 3
#endif
#ifndef UX_MAX_HCD
#define UX_MAX_HCD 2
#endif
#ifndef UX_MAX_DEVICES
#define UX_MAX_DEVICES 8
#endif
#ifndef UX_MAX_ED
#define UX_MAX_ED 80
#endif
#ifndef UX_MAX_TD
#define UX_MAX_TD 32
#endif
#ifndef UX_MAX_ISO_TD
#define UX_MAX_ISO_TD 128
#endif
#ifndef UX_HOST_ENUM_THREAD_STACK_SIZE
#define UX_HOST_ENUM_THREAD_STACK_SIZE (2*1024)
#endif
#ifndef UX_THREAD_STACK_SIZE
#define UX_THREAD_STACK_SIZE (1*1024)
#endif
#ifndef UX_THREAD_PRIORITY_ENUM
#define UX_THREAD_PRIORITY_ENUM 20
#endif
#ifndef UX_THREAD_PRIORITY_CLASS
#define UX_THREAD_PRIORITY_CLASS 20
#endif
#ifndef UX_THREAD_PRIORITY_KEYBOARD
#define UX_THREAD_PRIORITY_KEYBOARD 20
#endif
#ifndef UX_THREAD_PRIORITY_HCD
#define UX_THREAD_PRIORITY_HCD 2
#endif
#ifndef UX_THREAD_PRIORITY_DCD
#define UX_THREAD_PRIORITY_DCD 2
#endif
#ifndef UX_NO_TIME_SLICE
#define UX_NO_TIME_SLICE 0
#endif
#ifndef UX_MAX_SLAVE_LUN
#define UX_MAX_SLAVE_LUN 2
#endif
#ifndef UX_MAX_HOST_LUN
#define UX_MAX_HOST_LUN 2
#endif
#ifndef UX_HOST_CLASS_STORAGE_MAX_MEDIA
#define UX_HOST_CLASS_STORAGE_MAX_MEDIA 2
#endif
#ifndef UX_SLAVE_REQUEST_CONTROL_MAX_LENGTH
#define UX_SLAVE_REQUEST_CONTROL_MAX_LENGTH 256
#endif
#ifndef UX_SLAVE_REQUEST_DATA_MAX_LENGTH
#define UX_SLAVE_REQUEST_DATA_MAX_LENGTH 4096
#endif
#ifndef UX_USE_IO_INSTRUCTIONS
/* Don't use IO instructions if this define is not set. Default to memory mapped. */
#define inpb(a) *((UCHAR *) (a))
#define inpw(a) *((USHORT *) (a))
#define inpl(a) *((ULONG *) (a))
#define outpb(a, b) *((UCHAR *) (a)) = ((UCHAR) (b))
#define outpw(a, b) *((USHORT *) (a)) = ((USHORT) (b))
#define outpl(a, b) *((ULONG *) (a)) = ((ULONG) (b))
#else
/* Define simple prototypes for non-memory mapped hardware access. */
UCHAR inpb(ULONG);
USHORT inpw(ULONG);
ULONG inpl(ULONG);
UCHAR outpb(ULONG,UCHAR);
USHORT outpw(ULONG,USHORT);
ULONG outpl(ULONG,ULONG);
#endif
/* Define interrupt lockout constructs to protect the memory allocation/release which could happen
under ISR in the device stack. */
#define UX_INT_SAVE_AREA unsigned int old_interrupt_posture;
#define UX_DISABLE_INTS old_interrupt_posture = tx_interrupt_control(TX_INT_DISABLE);
#define UX_RESTORE_INTS tx_interrupt_control(old_interrupt_posture);
/* Define the version ID of USBX. This may be utilized by the application. */
#ifdef UX_SYSTEM_INIT
CHAR _ux_version_id[] =
2024-02-27 06:10:26 +00:00
"Copyright (c) 2024 Microsoft Corporation. * USBX Linux/GNU Version 6.4.1 *";
2020-11-10 13:37:32 -08:00
#else
extern CHAR _ux_version_id[];
#endif
#endif