PDL for FM4  Version1.2
Peripheral Driverl Library for FM4
UsbDeviceCmsisDap.c File Reference
#include "UsbDeviceCmsisDap.h"
#include "DAP_config.h"
#include "DAP.h"
Include dependency graph for UsbDeviceCmsisDap.c:

Go to the source code of this file.

Macros

#define __USBDEVICECMSISDAP_C__
 

Functions

static void RxTxCallback (stc_usbn_t *pstcUsb, struct stc_usbn_endpoint_data *pstcEndpoint)
 Receive or transmitted data callback. More...
 
static void ConfCallback (stc_usbn_t *pstcUsb)
 Configuration change callback, used to see if configuration is set or cleared. More...
 
uint32_t DAP_ProcessVendorCommand (uint8_t *request, uint8_t *response)
 
void UsbDeviceCmsisDap_Init (stc_usbn_t *pstcUsb)
 Initialisation callback. More...
 
boolean_t UsbDeviceCmsisDap_Send (uint8_t *pu8Buffer, en_usbsend_mode_t enMode)
 Send data. More...
 
void UsbDeviceCmsisDap_Tick (void)
 
boolean_t UsbDeviceCmsisDap_IsSending ()
 Check if data transfer is still in process. More...
 
boolean_t UsbDeviceCmsisDap_DataSent ()
 Check if data transfer was transmitted. More...
 
uint32_t UsbDeviceCmsisDap_GetReceivedData (uint8_t *pu8OutBuffer)
 Send data. More...
 

Variables

static volatile uint8_t USB_RequestFlag
 
static volatile uint32_t USB_RequestIn
 
static volatile uint32_t USB_RequestOut
 
static volatile uint8_t USB_ResponseIdle
 
static volatile uint8_t USB_ResponseFlag
 
static volatile uint32_t USB_ResponseIn
 
static volatile uint32_t USB_ResponseOut
 
static stc_usbn_endpoint_buffer_t stcEndpointBufferIN
 
static stc_usbn_endpoint_buffer_t stcEndpointBufferOUT
 
static uint8_t USB_Request [DAP_PACKET_COUNT][DAP_PACKET_SIZE]
 
static uint8_t USB_Response [DAP_PACKET_COUNT][DAP_PACKET_SIZE]
 
uint8_t pu8BufferOUT [64]
 
uint8_t pu8BufferIN [64]
 
static stc_usbn_endpoint_data_t * pstcEndpointIN = NULL
 
static stc_usbn_endpoint_data_t * pstcEndpointOUT = NULL
 
static boolean_t bDataReceived = FALSE
 
static boolean_t bDataSent = TRUE
 
static boolean_t bReady = FALSE
 
static stc_usbn_t * pstcUsbHandle = NULL
 

Detailed Description

CMSIS-DAP HID Communication Backend for protocol layer visit http://www.arm.com

History:

  • 2014-02-28 1.0 MSc First public version

Definition in file UsbDeviceCmsisDap.c.

Macro Definition Documentation

#define __USBDEVICECMSISDAP_C__

Definition at line 50 of file UsbDeviceCmsisDap.c.

Function Documentation

static void ConfCallback ( stc_usbn_t *  pstcUsb)
static

Configuration change callback, used to see if configuration is set or cleared.

Parameters
pstcUsbPointer to USB instance
Returns
none

Definition at line 131 of file UsbDeviceCmsisDap.c.

References bDataReceived, bDataSent, bReady, FALSE, TRUE, USB_RequestFlag, USB_RequestIn, USB_RequestOut, USB_ResponseFlag, USB_ResponseIdle, USB_ResponseIn, USB_ResponseOut, UsbConfigured, and UsbDevice_GetStatus().

Referenced by UsbDeviceCmsisDap_Init().

Here is the call graph for this function:

Here is the caller graph for this function:

uint32_t DAP_ProcessVendorCommand ( uint8_t *  request,
uint8_t *  response 
)

Referenced by UsbDeviceCmsisDap_Tick().

Here is the caller graph for this function:

static void RxTxCallback ( stc_usbn_t *  pstcUsb,
struct stc_usbn_endpoint_data *  pstcEndpoint 
)
static

Receive or transmitted data callback.

Parameters
pstcUsbPointer to USB instance
pstcEndpointPointer to endpoint instance
Returns
none

Definition at line 170 of file UsbDeviceCmsisDap.c.

References bDataReceived, bDataSent, stc_usbn_endpoint_data::pstcEndpointBuffer, stc_usbn_endpoint_buffer::pu8Buffer, pu8BufferOUT, TRUE, stc_usbn_endpoint_data::u8EndpointAddress, USB_Request, USB_RequestFlag, USB_RequestIn, USB_RequestOut, UsbDevice_ReceiveData(), and UsbIRQ.

Referenced by UsbDeviceCmsisDap_Init().

Here is the call graph for this function:

Here is the caller graph for this function:

boolean_t UsbDeviceCmsisDap_DataSent ( void  )

Check if data transfer was transmitted.

Returns
TRUE if data was sent

Definition at line 373 of file UsbDeviceCmsisDap.c.

References bDataSent.

uint32_t UsbDeviceCmsisDap_GetReceivedData ( uint8_t *  pu8OutBuffer)

Send data.

Parameters
pu8OutBufferPointer to data buffer where to write in data
Returns
number of bytes read

Definition at line 387 of file UsbDeviceCmsisDap.c.

References bDataReceived, FALSE, stc_usbn_endpoint_data::pstcEndpointBuffer, pstcUsbHandle, stc_usbn_endpoint_buffer::pu8Buffer, TRUE, stc_usbn_endpoint_buffer::u32BufferSize, UsbDevice_ReceiveData(), and UsbIRQ.

Here is the call graph for this function:

boolean_t UsbDeviceCmsisDap_IsSending ( void  )

Check if data transfer is still in process.

Returns
TRUE on sending

Definition at line 361 of file UsbDeviceCmsisDap.c.

References bDataSent.

boolean_t UsbDeviceCmsisDap_Send ( uint8_t *  pu8Buffer,
en_usbsend_mode_t  enMode 
)

Send data.

Parameters
pu8BufferPointer to data buffer
enModeTransfer mode (UsbPOLL, UsbDMA, UsbIRQ)
Returns
TRUE on success

Definition at line 283 of file UsbDeviceCmsisDap.c.

References bDataSent, bReady, FALSE, pstcUsbHandle, TRUE, USB_ResponseFlag, USB_ResponseIdle, USB_ResponseIn, USB_ResponseOut, UsbDevice_SendData(), and UsbPOLL.

Referenced by UsbDeviceCmsisDap_Tick().

Here is the call graph for this function:

Here is the caller graph for this function:

void UsbDeviceCmsisDap_Tick ( void  )

Variable Documentation

boolean_t bDataReceived = FALSE
static
boolean_t bReady = FALSE
static

Definition at line 110 of file UsbDeviceCmsisDap.c.

Referenced by ConfCallback(), and UsbDeviceCmsisDap_Send().

stc_usbn_endpoint_data_t* pstcEndpointIN = NULL
static

Definition at line 105 of file UsbDeviceCmsisDap.c.

stc_usbn_endpoint_data_t* pstcEndpointOUT = NULL
static

Definition at line 106 of file UsbDeviceCmsisDap.c.

stc_usbn_t* pstcUsbHandle = NULL
static
uint8_t pu8BufferIN[64]

Definition at line 103 of file UsbDeviceCmsisDap.c.

uint8_t pu8BufferOUT[64]

Definition at line 102 of file UsbDeviceCmsisDap.c.

Referenced by RxTxCallback(), and UsbDeviceCmsisDap_Init().

stc_usbn_endpoint_buffer_t stcEndpointBufferIN
static

Definition at line 97 of file UsbDeviceCmsisDap.c.

Referenced by UsbDeviceCmsisDap_Init().

stc_usbn_endpoint_buffer_t stcEndpointBufferOUT
static

Definition at line 98 of file UsbDeviceCmsisDap.c.

Referenced by UsbDeviceCmsisDap_Init().

uint8_t USB_Request[DAP_PACKET_COUNT][DAP_PACKET_SIZE]
static

Definition at line 100 of file UsbDeviceCmsisDap.c.

Referenced by RxTxCallback(), and UsbDeviceCmsisDap_Tick().

volatile uint8_t USB_RequestFlag
static
volatile uint32_t USB_RequestIn
static
volatile uint32_t USB_RequestOut
static
uint8_t USB_Response[DAP_PACKET_COUNT][DAP_PACKET_SIZE]
static

Definition at line 101 of file UsbDeviceCmsisDap.c.

Referenced by UsbDeviceCmsisDap_Tick().

volatile uint8_t USB_ResponseFlag
static
volatile uint8_t USB_ResponseIdle
static
volatile uint32_t USB_ResponseIn
static
volatile uint32_t USB_ResponseOut
static