ArmSys Support
ArmsysApi  0.12.18
BUsbRaw.cpp File Reference
#include <BUsbRaw.h>
#include <BSys.h>
#include <bstdio.h>
#include <BDebug.h>
#include <usbd_conf.h>
#include <usbd_def.h>
#include <usbd_ioreq.h>

Macros

#define BDEBUGL1   0
 
#define BDEBUGL2   0
 
#define BDEBUGL3   0
 
#define printf   bprintf
 
#define USBD_VID   busbConfig.vendorId
 
#define USBD_PID   busbConfig.productId
 
#define USBD_LANGID_STRING   0x409
 
#define USBD_MANUFACTURER_STRING   busbConfig.manufacturer
 
#define USBD_PRODUCT_STRING   busbConfig.product
 
#define USBD_SERIALNUMBER_STRING   busbConfig.serialNumber
 
#define USBD_CONFIGURATION_STRING   "Config"
 
#define USBD_INTERFACE_STRING   "Interface"
 
#define MS_VendorCode   'P'
 
#define USB_WINUSBCOMM_COMPAT_ID_OS_DESC_SIZ   (16 + 24)
 

Functions

BUInt8USBD_Desc_DeviceDescriptor (USBD_SpeedTypeDef speed, uint16_t *length)
 
BUInt8USBD_Desc_LangIDStrDescriptor (USBD_SpeedTypeDef speed, uint16_t *length)
 
BUInt8USBD_Desc_ProductStrDescriptor (USBD_SpeedTypeDef speed, uint16_t *length)
 
BUInt8USBD_Desc_ManufacturerStrDescriptor (USBD_SpeedTypeDef speed, uint16_t *length)
 
BUInt8USBD_Desc_SerialStrDescriptor (USBD_SpeedTypeDef speed, uint16_t *length)
 
BUInt8USBD_Desc_ConfigStrDescriptor (USBD_SpeedTypeDef speed, uint16_t *length)
 
BUInt8USBD_Desc_InterfaceStrDescriptor (USBD_SpeedTypeDef speed, uint16_t *length)
 
void HAL_PCD_SetupStageCallback (PCD_HandleTypeDef *hpcd)
 
void HAL_PCD_DataOutStageCallback (PCD_HandleTypeDef *hpcd, BUInt8 epnum)
 
void HAL_PCD_DataInStageCallback (PCD_HandleTypeDef *hpcd, BUInt8 epnum)
 
void HAL_PCD_SOFCallback (PCD_HandleTypeDef *hpcd)
 
void HAL_PCD_ResetCallback (PCD_HandleTypeDef *hpcd)
 
void HAL_PCD_SuspendCallback (PCD_HandleTypeDef *hpcd)
 
void HAL_PCD_ResumeCallback (PCD_HandleTypeDef *hpcd)
 
void HAL_PCD_ISOOUTIncompleteCallback (PCD_HandleTypeDef *hpcd, BUInt8 epnum)
 
void HAL_PCD_ISOINIncompleteCallback (PCD_HandleTypeDef *hpcd, BUInt8 epnum)
 
void HAL_PCD_ConnectCallback (PCD_HandleTypeDef *hpcd)
 
void HAL_PCD_DisconnectCallback (PCD_HandleTypeDef *hpcd)
 
USBD_StatusTypeDef USBD_LL_DeInit (USBD_HandleTypeDef *pdev)
 
USBD_StatusTypeDef USBD_LL_Start (USBD_HandleTypeDef *pdev)
 
USBD_StatusTypeDef USBD_LL_Stop (USBD_HandleTypeDef *pdev)
 
USBD_StatusTypeDef USBD_LL_OpenEP (USBD_HandleTypeDef *pdev, BUInt8 ep_addr, BUInt8 ep_type, uint16_t ep_mps)
 
USBD_StatusTypeDef USBD_LL_CloseEP (USBD_HandleTypeDef *pdev, BUInt8 ep_addr)
 
USBD_StatusTypeDef USBD_LL_FlushEP (USBD_HandleTypeDef *pdev, BUInt8 ep_addr)
 
USBD_StatusTypeDef USBD_LL_StallEP (USBD_HandleTypeDef *pdev, BUInt8 ep_addr)
 
USBD_StatusTypeDef USBD_LL_ClearStallEP (USBD_HandleTypeDef *pdev, BUInt8 ep_addr)
 
BUInt8 USBD_LL_IsStallEP (USBD_HandleTypeDef *pdev, BUInt8 ep_addr)
 
USBD_StatusTypeDef USBD_LL_SetUSBAddress (USBD_HandleTypeDef *pdev, BUInt8 dev_addr)
 
USBD_StatusTypeDef USBD_LL_Transmit (USBD_HandleTypeDef *pdev, BUInt8 ep_addr, BUInt8 *pbuf, uint16_t size)
 
USBD_StatusTypeDef USBD_LL_PrepareReceive (USBD_HandleTypeDef *pdev, BUInt8 ep_addr, BUInt8 *pbuf, uint16_t size)
 
uint32_t USBD_LL_GetRxDataSize (USBD_HandleTypeDef *pdev, BUInt8 ep_addr)
 
void USBD_LL_Delay (uint32_t Delay)
 
USBD_StatusTypeDef USBD_LL_Init (USBD_HandleTypeDef *pdev)
 
void OTG_FS_IRQHandler (void)
 
void OTG_HS_IRQHandler (void)
 
static BUInt8 usbdInit (USBD_HandleTypeDef *pdev, BUInt8 cfgidx)
 
static BUInt8 usbdDeInit (USBD_HandleTypeDef *pdev, BUInt8 cfgidx)
 
static BUInt8 usbdSetup (USBD_HandleTypeDef *pdev, USBD_SetupReqTypedef *req)
 
static BUInt8 usbdRx0 (USBD_HandleTypeDef *pdev)
 
static BUInt8 usbdRx (USBD_HandleTypeDef *pdev, BUInt8 epnum)
 
static BUInt8 usbdTxSent (USBD_HandleTypeDef *pdev, BUInt8 epnum)
 
static BUInt8usbdGetHSCfgDesc (uint16_t *length)
 
static BUInt8usbdGetFSCfgDesc (uint16_t *length)
 
static BUInt8usbdGetDeviceQualifierDescriptor (uint16_t *length)
 
static BUInt8usbdGetUsrStrDescriptor (struct _USBD_HandleTypeDef *pdev, uint8_t index, uint16_t *length)
 
static BUInt8 usbdGetMSExtendedCompatIDOSDescriptor (USBD_HandleTypeDef *pdev, USBD_SetupReqTypedef *req)
 
static BUInt8 usbdGetMSExtendedPropertiesOSDescriptor (USBD_HandleTypeDef *pdev, USBD_SetupReqTypedef *req)
 
static BUInt8 usbdSetupVendor (USBD_HandleTypeDef *pdev, USBD_SetupReqTypedef *req)
 
static int usbWrite (const char *data, int nBytes)
 

Variables

const int PacketSizeHighSpeed = 512
 
const int PacketSizeFullSpeed = 64
 
const int PacketSizeCmd = 8
 
const int ConfigDescriptorSize = 32
 
const int EndPointCmd = 0x82
 
const int EndPointTx = 0x81
 
const int EndPointRx = 0x01
 
static BUsbConfig busbConfig
 
static BUsbRawusbSerial
 
__ALIGN_BEGIN BUInt8 hUSBDDeviceDesc [USB_LEN_DEV_DESC] __ALIGN_END
 
USBD_DescriptorsTypeDef descriptors
 
USBD_ClassTypeDef usbdClass
 

Macro Definition Documentation

◆ BDEBUGL1

#define BDEBUGL1   0

◆ BDEBUGL2

#define BDEBUGL2   0

◆ BDEBUGL3

#define BDEBUGL3   0

◆ MS_VendorCode

#define MS_VendorCode   'P'

◆ printf

#define printf   bprintf

◆ USB_WINUSBCOMM_COMPAT_ID_OS_DESC_SIZ

#define USB_WINUSBCOMM_COMPAT_ID_OS_DESC_SIZ   (16 + 24)

◆ USBD_CONFIGURATION_STRING

#define USBD_CONFIGURATION_STRING   "Config"

◆ USBD_INTERFACE_STRING

#define USBD_INTERFACE_STRING   "Interface"

◆ USBD_LANGID_STRING

#define USBD_LANGID_STRING   0x409

◆ USBD_MANUFACTURER_STRING

#define USBD_MANUFACTURER_STRING   busbConfig.manufacturer

◆ USBD_PID

#define USBD_PID   busbConfig.productId

◆ USBD_PRODUCT_STRING

#define USBD_PRODUCT_STRING   busbConfig.product

◆ USBD_SERIALNUMBER_STRING

#define USBD_SERIALNUMBER_STRING   busbConfig.serialNumber

◆ USBD_VID

#define USBD_VID   busbConfig.vendorId

Function Documentation

◆ HAL_PCD_ConnectCallback()

void HAL_PCD_ConnectCallback ( PCD_HandleTypeDef *  hpcd)

◆ HAL_PCD_DataInStageCallback()

void HAL_PCD_DataInStageCallback ( PCD_HandleTypeDef *  hpcd,
BUInt8  epnum 
)

◆ HAL_PCD_DataOutStageCallback()

void HAL_PCD_DataOutStageCallback ( PCD_HandleTypeDef *  hpcd,
BUInt8  epnum 
)

◆ HAL_PCD_DisconnectCallback()

void HAL_PCD_DisconnectCallback ( PCD_HandleTypeDef *  hpcd)

◆ HAL_PCD_ISOINIncompleteCallback()

void HAL_PCD_ISOINIncompleteCallback ( PCD_HandleTypeDef *  hpcd,
BUInt8  epnum 
)

◆ HAL_PCD_ISOOUTIncompleteCallback()

void HAL_PCD_ISOOUTIncompleteCallback ( PCD_HandleTypeDef *  hpcd,
BUInt8  epnum 
)

◆ HAL_PCD_ResetCallback()

void HAL_PCD_ResetCallback ( PCD_HandleTypeDef *  hpcd)

◆ HAL_PCD_ResumeCallback()

void HAL_PCD_ResumeCallback ( PCD_HandleTypeDef *  hpcd)

◆ HAL_PCD_SetupStageCallback()

void HAL_PCD_SetupStageCallback ( PCD_HandleTypeDef *  hpcd)

◆ HAL_PCD_SOFCallback()

void HAL_PCD_SOFCallback ( PCD_HandleTypeDef *  hpcd)

◆ HAL_PCD_SuspendCallback()

void HAL_PCD_SuspendCallback ( PCD_HandleTypeDef *  hpcd)

◆ OTG_FS_IRQHandler()

void OTG_FS_IRQHandler ( void  )

◆ OTG_HS_IRQHandler()

void OTG_HS_IRQHandler ( void  )

◆ USBD_Desc_ConfigStrDescriptor()

BUInt8* USBD_Desc_ConfigStrDescriptor ( USBD_SpeedTypeDef  speed,
uint16_t *  length 
)

◆ USBD_Desc_DeviceDescriptor()

BUInt8* USBD_Desc_DeviceDescriptor ( USBD_SpeedTypeDef  speed,
uint16_t *  length 
)

◆ USBD_Desc_InterfaceStrDescriptor()

BUInt8* USBD_Desc_InterfaceStrDescriptor ( USBD_SpeedTypeDef  speed,
uint16_t *  length 
)

◆ USBD_Desc_LangIDStrDescriptor()

BUInt8* USBD_Desc_LangIDStrDescriptor ( USBD_SpeedTypeDef  speed,
uint16_t *  length 
)

◆ USBD_Desc_ManufacturerStrDescriptor()

BUInt8* USBD_Desc_ManufacturerStrDescriptor ( USBD_SpeedTypeDef  speed,
uint16_t *  length 
)

◆ USBD_Desc_ProductStrDescriptor()

BUInt8* USBD_Desc_ProductStrDescriptor ( USBD_SpeedTypeDef  speed,
uint16_t *  length 
)

◆ USBD_Desc_SerialStrDescriptor()

BUInt8* USBD_Desc_SerialStrDescriptor ( USBD_SpeedTypeDef  speed,
uint16_t *  length 
)

◆ USBD_LL_ClearStallEP()

USBD_StatusTypeDef USBD_LL_ClearStallEP ( USBD_HandleTypeDef *  pdev,
BUInt8  ep_addr 
)

◆ USBD_LL_CloseEP()

USBD_StatusTypeDef USBD_LL_CloseEP ( USBD_HandleTypeDef *  pdev,
BUInt8  ep_addr 
)

◆ USBD_LL_DeInit()

USBD_StatusTypeDef USBD_LL_DeInit ( USBD_HandleTypeDef *  pdev)

◆ USBD_LL_Delay()

void USBD_LL_Delay ( uint32_t  Delay)

◆ USBD_LL_FlushEP()

USBD_StatusTypeDef USBD_LL_FlushEP ( USBD_HandleTypeDef *  pdev,
BUInt8  ep_addr 
)

◆ USBD_LL_GetRxDataSize()

uint32_t USBD_LL_GetRxDataSize ( USBD_HandleTypeDef *  pdev,
BUInt8  ep_addr 
)

◆ USBD_LL_Init()

USBD_StatusTypeDef USBD_LL_Init ( USBD_HandleTypeDef *  pdev)

◆ USBD_LL_IsStallEP()

BUInt8 USBD_LL_IsStallEP ( USBD_HandleTypeDef *  pdev,
BUInt8  ep_addr 
)

◆ USBD_LL_OpenEP()

USBD_StatusTypeDef USBD_LL_OpenEP ( USBD_HandleTypeDef *  pdev,
BUInt8  ep_addr,
BUInt8  ep_type,
uint16_t  ep_mps 
)

◆ USBD_LL_PrepareReceive()

USBD_StatusTypeDef USBD_LL_PrepareReceive ( USBD_HandleTypeDef *  pdev,
BUInt8  ep_addr,
BUInt8 pbuf,
uint16_t  size 
)

◆ USBD_LL_SetUSBAddress()

USBD_StatusTypeDef USBD_LL_SetUSBAddress ( USBD_HandleTypeDef *  pdev,
BUInt8  dev_addr 
)

◆ USBD_LL_StallEP()

USBD_StatusTypeDef USBD_LL_StallEP ( USBD_HandleTypeDef *  pdev,
BUInt8  ep_addr 
)

◆ USBD_LL_Start()

USBD_StatusTypeDef USBD_LL_Start ( USBD_HandleTypeDef *  pdev)

◆ USBD_LL_Stop()

USBD_StatusTypeDef USBD_LL_Stop ( USBD_HandleTypeDef *  pdev)

◆ USBD_LL_Transmit()

USBD_StatusTypeDef USBD_LL_Transmit ( USBD_HandleTypeDef *  pdev,
BUInt8  ep_addr,
BUInt8 pbuf,
uint16_t  size 
)

◆ usbdDeInit()

static BUInt8 usbdDeInit ( USBD_HandleTypeDef *  pdev,
BUInt8  cfgidx 
)
static

◆ usbdGetDeviceQualifierDescriptor()

static BUInt8* usbdGetDeviceQualifierDescriptor ( uint16_t *  length)
static

◆ usbdGetFSCfgDesc()

static BUInt8* usbdGetFSCfgDesc ( uint16_t *  length)
static

◆ usbdGetHSCfgDesc()

static BUInt8* usbdGetHSCfgDesc ( uint16_t *  length)
static

◆ usbdGetMSExtendedCompatIDOSDescriptor()

static BUInt8 usbdGetMSExtendedCompatIDOSDescriptor ( USBD_HandleTypeDef *  pdev,
USBD_SetupReqTypedef *  req 
)
static

◆ usbdGetMSExtendedPropertiesOSDescriptor()

static BUInt8 usbdGetMSExtendedPropertiesOSDescriptor ( USBD_HandleTypeDef *  pdev,
USBD_SetupReqTypedef *  req 
)
static

◆ usbdGetUsrStrDescriptor()

static BUInt8* usbdGetUsrStrDescriptor ( struct _USBD_HandleTypeDef *  pdev,
uint8_t  index,
uint16_t *  length 
)
static

◆ usbdInit()

static BUInt8 usbdInit ( USBD_HandleTypeDef *  pdev,
BUInt8  cfgidx 
)
static

◆ usbdRx()

static BUInt8 usbdRx ( USBD_HandleTypeDef *  pdev,
BUInt8  epnum 
)
static

◆ usbdRx0()

static BUInt8 usbdRx0 ( USBD_HandleTypeDef *  pdev)
static

◆ usbdSetup()

static BUInt8 usbdSetup ( USBD_HandleTypeDef *  pdev,
USBD_SetupReqTypedef *  req 
)
static

◆ usbdSetupVendor()

static BUInt8 usbdSetupVendor ( USBD_HandleTypeDef *  pdev,
USBD_SetupReqTypedef *  req 
)
static

◆ usbdTxSent()

static BUInt8 usbdTxSent ( USBD_HandleTypeDef *  pdev,
BUInt8  epnum 
)
static

◆ usbWrite()

static int usbWrite ( const char *  data,
int  nBytes 
)
static

Variable Documentation

◆ __ALIGN_END

__ALIGN_BEGIN uint8_t USBD_WinUSBComm_Extended_Properties_OS_Desc [0xCC] __ALIGN_END
Initial value:
= {
0x12,
USB_DESC_TYPE_DEVICE,
0x00,
0x02,
USB_MAX_EP0_SIZE,
LOBYTE(USBD_VID),
HIBYTE(USBD_VID),
LOBYTE(USBD_PID),
HIBYTE(USBD_PID),
USBD_IDX_MFC_STR,
USBD_IDX_PRODUCT_STR,
USBD_IDX_SERIAL_STR,
USBD_MAX_NUM_CONFIGURATION
}
BUInt8 devClass
Definition: BUsbRaw.h:29
BUInt16 productRelease
Definition: BUsbRaw.h:35
BUInt8 devProtocol
Definition: BUsbRaw.h:31
static BUsbConfig busbConfig
Definition: BUsbRaw.cpp:33
#define USBD_VID
Definition: BUsbRaw.cpp:55
#define USBD_PID
Definition: BUsbRaw.cpp:56
BUInt8 devSubClass
Definition: BUsbRaw.h:30

◆ busbConfig

BUsbConfig busbConfig
static
Initial value:
= {
0x0483,
0x5740,
0x00,
0x00,
0x00,
"Beam",
"Armsys",
"0",
0
}

◆ ConfigDescriptorSize

const int ConfigDescriptorSize = 32

◆ descriptors

USBD_DescriptorsTypeDef descriptors
Initial value:
= {
}
BUInt8 * USBD_Desc_DeviceDescriptor(USBD_SpeedTypeDef speed, uint16_t *length)
Definition: BUsbRaw.cpp:96
BUInt8 * USBD_Desc_SerialStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length)
Definition: BUsbRaw.cpp:116
BUInt8 * USBD_Desc_InterfaceStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length)
Definition: BUsbRaw.cpp:126
BUInt8 * USBD_Desc_LangIDStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length)
Definition: BUsbRaw.cpp:101
BUInt8 * USBD_Desc_ProductStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length)
Definition: BUsbRaw.cpp:106
BUInt8 * USBD_Desc_ConfigStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length)
Definition: BUsbRaw.cpp:121
BUInt8 * USBD_Desc_ManufacturerStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length)
Definition: BUsbRaw.cpp:111

◆ EndPointCmd

const int EndPointCmd = 0x82

◆ EndPointRx

const int EndPointRx = 0x01

◆ EndPointTx

const int EndPointTx = 0x81

◆ PacketSizeCmd

const int PacketSizeCmd = 8

◆ PacketSizeFullSpeed

const int PacketSizeFullSpeed = 64

◆ PacketSizeHighSpeed

const int PacketSizeHighSpeed = 512

◆ usbdClass

USBD_ClassTypeDef usbdClass
Initial value:
= {
NULL,
NULL,
NULL,
NULL,
}
static BUInt8 usbdSetup(USBD_HandleTypeDef *pdev, USBD_SetupReqTypedef *req)
Definition: BUsbRaw.cpp:564
static BUInt8 * usbdGetHSCfgDesc(uint16_t *length)
Definition: BUsbRaw.cpp:589
static BUInt8 usbdRx(USBD_HandleTypeDef *pdev, BUInt8 epnum)
Definition: BUsbRaw.cpp:574
static BUInt8 usbdInit(USBD_HandleTypeDef *pdev, BUInt8 cfgidx)
Definition: BUsbRaw.cpp:556
static BUInt8 usbdRx0(USBD_HandleTypeDef *pdev)
Definition: BUsbRaw.cpp:568
static BUInt8 * usbdGetFSCfgDesc(uint16_t *length)
Definition: BUsbRaw.cpp:594
static BUInt8 usbdTxSent(USBD_HandleTypeDef *pdev, BUInt8 epnum)
Definition: BUsbRaw.cpp:578
static BUInt8 * usbdGetUsrStrDescriptor(struct _USBD_HandleTypeDef *pdev, uint8_t index, uint16_t *length)
Definition: BUsbRaw.cpp:605
static BUInt8 usbdDeInit(USBD_HandleTypeDef *pdev, BUInt8 cfgidx)
Definition: BUsbRaw.cpp:560
static BUInt8 * usbdGetDeviceQualifierDescriptor(uint16_t *length)
Definition: BUsbRaw.cpp:599

◆ usbSerial

BUsbRaw* usbSerial
static