Microchip® Advanced Software Framework

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages

Class internal implementation.

Functions

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_waitdata (udi_phdc_metadata_t *metadata, void(*callback)(bool, uint16_t))
 Wait metadata from USB host. More...
 

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
 

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...
 

static void udi_phdc_abort_all_transfers_ongoing ( void  )
static
static void udi_phdc_metadata_ack ( udd_ep_status_t  status,
iram_size_t  nb_send,
udd_ep_id_t  ep 
)
static

Callback called when metadata is sent.

Return values
statusTransfer state (UDD_EP_TRANSFER_ABORT/_OK)
nb_sendNumber of data sent

References cpu_to_le16, UDI_PHDC_EP_BULK_IN, UDI_PHDC_EP_INTERRUPT_IN, udi_phdc_holding_data, udi_phdc_in_trans, USB_EP_ADDR_MASK, and USB_PHDC_QOS_LOW_GOOD.

Referenced by udi_phdc_send_metadata().

static void udi_phdc_preamplemsg_ack ( udd_ep_status_t  status,
iram_size_t  nb_send,
udd_ep_id_t  ep 
)
static

Callback called when preample message is sent.

Return values
statusTransfer state (UDD_EP_TRANSFER_ABORT/_OK)
nb_sendNumber of data sent

References cpu_to_le16, UDD_EP_TRANSFER_ABORT, UDI_PHDC_EP_SIZE_BULK_IN, udi_phdc_holding_data, udi_phdc_in_trans, udi_phdc_send_metadata(), and USB_EP_ADDR_MASK.

Referenced by udi_phdc_send_preamplemsg().

static void udi_phdc_received_metadata ( udd_ep_status_t  status,
iram_size_t  nb_received,
udd_ep_id_t  ep 
)
static

Callback called when metadata is received.

Return values
statusTransfer state (UDD_EP_TRANSFER_ABORT/_OK)
nb_receivedNumber of data received

References UDD_EP_TRANSFER_OK, and udi_phdc_out_trans.

Referenced by udi_phdc_wait_metadata().

static void udi_phdc_received_preample ( udd_ep_status_t  status,
iram_size_t  nb_received,
udd_ep_id_t  ep 
)
static

Callback called when metadata is received.

Return values
statusTransfer state (UDD_EP_TRANSFER_ABORT/_OK)
nb_receivedNumber of data received

References usb_phdc_metadata_msg_t::bmLatencyReliability, METADATA_MESSAGE_SIG, preample_header, udd_ep_set_halt(), UDD_EP_TRANSFER_ABORT, UDI_PHDC_EP_BULK_OUT, UDI_PHDC_EP_SIZE_BULK_OUT, udi_phdc_out_trans, UDI_PHDC_QOS_OUT, udi_phdc_wait_metadata(), and USB_PHDC_QOS_ENCODING_VERSION_1.

Referenced by udi_phdc_wait_preamplemsg().

static bool udi_phdc_send_metadata ( void  )
static
static bool udi_phdc_send_preamplemsg ( void  )
static
bool udi_phdc_senddata ( udi_phdc_metadata_t metadata,
void(*)(uint16_t)  callback 
)

Send metadata to USB host.

Parameters
metadataInformation about metadata to send
callbackFunction to call at the end of transfer.
Returns
1 if function was successfully done, otherwise 0.

References callback, cpu_irq_restore(), cpu_irq_save(), metadata, udi_phdc_metadata_t::qos, udi_phdc_in_trans, udi_phdc_preample_feature, UDI_PHDC_QOS_IN, udi_phdc_send_metadata(), udi_phdc_send_preamplemsg(), and USB_PHDC_QOS_LOW_GOOD.

Referenced by ieee11073_decode_metadata(), ieee11073_send_association(), and ieee11073_send_mesure().

void udi_phdc_senddata_abort ( void  )
static bool udi_phdc_wait_metadata ( uint8_t  bNumTransfers)
static

This function request metadata.

Return values
truewhen success

References Assert, udd_ep_run(), UDI_PHDC_EP_BULK_OUT, UDI_PHDC_EP_SIZE_BULK_OUT, udi_phdc_out_trans, and udi_phdc_received_metadata().

Referenced by udi_phdc_received_preample(), and udi_phdc_waitdata().

static bool udi_phdc_wait_preamplemsg ( void  )
static

This function requests a preample message.

Return values
truewhen success

References udd_ep_run(), UDI_PHDC_EP_BULK_OUT, UDI_PHDC_EP_SIZE_BULK_OUT, udi_phdc_out_trans, and udi_phdc_received_preample().

Referenced by udi_phdc_waitdata().

bool udi_phdc_waitdata ( udi_phdc_metadata_t metadata,
void(*)(bool, uint16_t)  callback 
)

Wait metadata from USB host.

Parameters
metadataInformation about expected metadata
callbackFunction to call at the end of transfer.
Returns
1 if function was successfully done, otherwise 0.

References callback, cpu_irq_restore(), cpu_irq_save(), metadata, UDI_PHDC_EP_SIZE_BULK_OUT, udi_phdc_out_trans, udi_phdc_preample_feature, UDI_PHDC_QOS_OUT, udi_phdc_wait_metadata(), and udi_phdc_wait_preamplemsg().

Referenced by ieee11073_enable_reception().

bool { ... } b_preample_run
bool { ... } b_preample_run
bool { ... } b_run
bool { ... } b_run
void(* { ... } callback)(uint16_t)
void(* { ... } callback)(bool, uint16_t)
void* { ... } cntx
void* { ... } cntx
udi_phdc_metadata_t* { ... } metadata
udi_phdc_metadata_t* { ... } metadata
uint16_t { ... } metadata_pos
uint16_t { ... } metadata_pos
usb_phdc_metadata_msg_t { ... } preample_header
usb_phdc_metadata_msg_t { ... } preample_header
uint8_t { ... } preample_opaque_data[UDI_PHDC_EP_SIZE_BULK_IN-sizeof(usb_phdc_metadata_msg_t)]
uint8_t { ... } preample_opaque_data[UDI_PHDC_EP_SIZE_BULK_OUT-sizeof(usb_phdc_metadata_msg_t)]
uint8_t udi_phdc_preample_feature
static