Microchip® Advanced Software Framework

udi_phdc.c File Reference

USB Device Personal Healthcare Device Class (PHDC) interface.

Copyright (c) 2009-2018 Microchip Technology Inc. and its subsidiaries.

#include "conf_usb.h"
#include "usb_protocol.h"
#include "usb_protocol_phdc.h"
#include "udd.h"
#include "udc.h"
#include "udi_phdc.h"
#include <string.h>

Functions

void udi_phdc_disable (void)
 
bool udi_phdc_enable (void)
 
uint8_t udi_phdc_getsetting (void)
 
bool udi_phdc_senddata (udi_phdc_metadata_t *metadata, void(*callback)(uint16_t))
 Send metadata to USB host. More...
 
void udi_phdc_senddata_abort (void)
 Abort of send metadata to USB host. More...
 
bool udi_phdc_setup (void)
 
bool udi_phdc_waitdata (udi_phdc_metadata_t *metadata, void(*callback)(bool, uint16_t))
 Wait metadata from USB host. More...
 
Internal routines
static bool udi_phdc_send_preamplemsg (void)
 This function sends a preample message. More...
 
static void udi_phdc_preamplemsg_ack (udd_ep_status_t status, iram_size_t nb_send, udd_ep_id_t ep)
 Callback called when preample message is sent. More...
 
static bool udi_phdc_send_metadata (void)
 This function sends a metadata. More...
 
static void udi_phdc_metadata_ack (udd_ep_status_t status, iram_size_t nb_send, udd_ep_id_t ep)
 Callback called when metadata is sent. More...
 
static bool udi_phdc_wait_preamplemsg (void)
 This function requests a preample message. More...
 
static void udi_phdc_received_preample (udd_ep_status_t status, iram_size_t nb_received, udd_ep_id_t ep)
 Callback called when metadata is received. More...
 
static bool udi_phdc_wait_metadata (uint8_t bNumTransfers)
 This function request metadata. More...
 
static void udi_phdc_received_metadata (udd_ep_status_t status, iram_size_t nb_received, udd_ep_id_t ep)
 Callback called when metadata is received. More...
 
static void udi_phdc_abort_all_transfers_ongoing (void)
 Aborts all PHDC transfers on-going or pending. More...
 

Variables

UDC_DESC_STORAGE udi_api_t udi_api_phdc
 
Internal variables to manage PHDC
static COMPILER_WORD_ALIGNED le16_t udi_phdc_holding_data
 
static uint8_t udi_phdc_preample_feature
 
struct {
   bool   b_preample_run
 
   bool   b_run
 
   void(*   callback )(uint16_t)
 
   void *   cntx
 
   udi_phdc_metadata_t *   metadata
 
   uint16_t   metadata_pos
 
   usb_phdc_metadata_msg_t   preample_header
 
   uint8_t   preample_opaque_data [UDI_PHDC_EP_SIZE_BULK_IN-sizeof(usb_phdc_metadata_msg_t)]
 
udi_phdc_in_trans
 
struct {
   bool   b_preample_run
 
   bool   b_run
 
   void(*   callback )(bool, uint16_t)
 
   void *   cntx
 
   udi_phdc_metadata_t *   metadata
 
   uint16_t   metadata_pos
 
   usb_phdc_metadata_msg_t   preample_header
 
   uint8_t   preample_opaque_data [UDI_PHDC_EP_SIZE_BULK_OUT-sizeof(usb_phdc_metadata_msg_t)]
 
udi_phdc_out_trans
 

bool b_preample_run
bool b_run
void* cntx
uint16_t metadata_pos
uint8_t preample_opaque_data[UDI_PHDC_EP_SIZE_BULK_OUT-sizeof(usb_phdc_metadata_msg_t)]