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_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_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
 
struct {
   bool   b_preample_run
 
   bool   b_run
 
   void(*   callback )(uint16_t)
 
   void *   cntx
 
   udi_phdc_metadata_t *   metadata
 
   uint16_t   metadata_pos
 
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
 
udi_phdc_out_trans
 

bool b_preample_run
bool b_run
void* cntx
uint16_t metadata_pos