Cascoda SDK
Cascoda SDK for building software to run with CA-821x transceivers
hid_transfer.c File Reference
#include <stdio.h>
#include <string.h>
#include "NuMicro.h"
#include "cascoda-bm/cascoda_usb.h"
#include "cascoda-bm/cascoda_usbhid.h"
#include "cascoda-util/cascoda_hash.h"
#include "ldrom_hid.h"
Include dependency graph for hid_transfer.c:

Macros

#define EP0_MAX_PKT_SIZE   HID_CTRL_MAX_SIZE
 
#define EP1_MAX_PKT_SIZE   HID_CTRL_MAX_SIZE
 
#define EP2_MAX_PKT_SIZE   HID_FRAGMENT_SIZE
 
#define EP3_MAX_PKT_SIZE   HID_FRAGMENT_SIZE
 
#define INT_IN_EP_NUM   HID_IN_EP_NO
 
#define INT_OUT_EP_NUM   HID_OUT_EP_NO
 
#define SETUP_BUF_BASE   0
 
#define SETUP_BUF_LEN   8
 
#define EP0_BUF_BASE   (SETUP_BUF_BASE + SETUP_BUF_LEN)
 
#define EP0_BUF_LEN   EP0_MAX_PKT_SIZE
 
#define EP1_BUF_BASE   (SETUP_BUF_BASE + SETUP_BUF_LEN)
 
#define EP1_BUF_LEN   EP1_MAX_PKT_SIZE
 
#define EP2_BUF_BASE   (EP1_BUF_BASE + EP1_BUF_LEN)
 
#define EP2_BUF_LEN   EP2_MAX_PKT_SIZE
 
#define EP3_BUF_BASE   (EP2_BUF_BASE + EP2_BUF_LEN)
 
#define EP3_BUF_LEN   EP3_MAX_PKT_SIZE
 
#define MAX_FRAG_SIZE   64
 
#define FRAG_LEN_MASK   0x3F
 
#define FRAG_LAST_MASK   (1 << 7)
 
#define FRAG_FIRST_MASK   (1 << 6)
 

Functions

void EP2_Handler (void)
 
void EP3_Handler (void)
 
void RxHandled (void)
 
void TxReady (void)
 
uint64_t HASH_fnv1a_64 (const void *data_in, size_t num_bytes)
 Calculate the 64-bit fnv1a non-crypto hash of a block of data. More...
 
void HID_Init (void)
 USBD Endpoint Config. More...
 

Variables

struct SerialBuf gRxBuffer
 
struct SerialBuf gTxBuffer
 
uint8_t gu8BOSDescriptor []
 
const S_USBD_INFO_T gsInfo
 

Macro Definition Documentation

◆ EP0_BUF_BASE

#define EP0_BUF_BASE   (SETUP_BUF_BASE + SETUP_BUF_LEN)

◆ EP0_BUF_LEN

#define EP0_BUF_LEN   EP0_MAX_PKT_SIZE

◆ EP0_MAX_PKT_SIZE

#define EP0_MAX_PKT_SIZE   HID_CTRL_MAX_SIZE

◆ EP1_BUF_BASE

#define EP1_BUF_BASE   (SETUP_BUF_BASE + SETUP_BUF_LEN)

◆ EP1_BUF_LEN

#define EP1_BUF_LEN   EP1_MAX_PKT_SIZE

◆ EP1_MAX_PKT_SIZE

#define EP1_MAX_PKT_SIZE   HID_CTRL_MAX_SIZE

◆ EP2_BUF_BASE

#define EP2_BUF_BASE   (EP1_BUF_BASE + EP1_BUF_LEN)

◆ EP2_BUF_LEN

#define EP2_BUF_LEN   EP2_MAX_PKT_SIZE

◆ EP2_MAX_PKT_SIZE

#define EP2_MAX_PKT_SIZE   HID_FRAGMENT_SIZE

◆ EP3_BUF_BASE

#define EP3_BUF_BASE   (EP2_BUF_BASE + EP2_BUF_LEN)

◆ EP3_BUF_LEN

#define EP3_BUF_LEN   EP3_MAX_PKT_SIZE

◆ EP3_MAX_PKT_SIZE

#define EP3_MAX_PKT_SIZE   HID_FRAGMENT_SIZE

◆ FRAG_FIRST_MASK

#define FRAG_FIRST_MASK   (1 << 6)

◆ FRAG_LAST_MASK

#define FRAG_LAST_MASK   (1 << 7)

◆ FRAG_LEN_MASK

#define FRAG_LEN_MASK   0x3F

◆ INT_IN_EP_NUM

#define INT_IN_EP_NUM   HID_IN_EP_NO

◆ INT_OUT_EP_NUM

#define INT_OUT_EP_NUM   HID_OUT_EP_NO

◆ MAX_FRAG_SIZE

#define MAX_FRAG_SIZE   64

◆ SETUP_BUF_BASE

#define SETUP_BUF_BASE   0

◆ SETUP_BUF_LEN

#define SETUP_BUF_LEN   8

Function Documentation

◆ EP2_Handler()

void EP2_Handler ( void  )

◆ EP3_Handler()

void EP3_Handler ( void  )

◆ HID_Init()

void HID_Init ( void  )

USBD Endpoint Config.

◆ RxHandled()

void RxHandled ( void  )

◆ TxReady()

void TxReady ( void  )

Variable Documentation

◆ gRxBuffer

struct SerialBuf gRxBuffer

◆ gsInfo

const S_USBD_INFO_T gsInfo
Initial value:
= {(uint8_t *)&HidDeviceDescriptor,
(uint8_t *)&HidConfDesc,
USB_STRINGS,
HidReport,
HidReportLen,
ConfigHidDescIdx}
uint8_t gu8BOSDescriptor[]
Definition: hid_transfer.c:80

◆ gTxBuffer

struct SerialBuf gTxBuffer

◆ gu8BOSDescriptor

uint8_t gu8BOSDescriptor[]
Initial value:
= {
LEN_BOS,
DESC_BOS,
0x0C & 0x00FF,
((0x0C & 0xFF00) >> 8),
0x01,
LEN_BOSCAP,
DESC_CAPABILITY,
CAP_USB20_EXT,
0x02,
0x00,
0x00,
0x00
}