CryptoAuthLib
Microchip CryptoAuthentication Library
hal_win_kit_cdc.c File Reference

ATCA Hardware abstraction layer for Windows using kit protocol over a USB CDC device. More...

#include "atca_hal.h"
#include "kit_phy.h"
#include "hal_win_kit_cdc.h"
#include "kit_protocol.h"
#include <SetupAPI.h>
#include <stdlib.h>
#include <tchar.h>
#include <stdio.h>

Functions

ATCA_STATUS hal_kit_cdc_init (void *hal, ATCAIfaceCfg *cfg)
 HAL implementation of Kit USB CDC init. More...
 
ATCA_STATUS hal_cdc_discover_buses (int i2c_buses[], int max_buses)
 discover all CDC kits available.This function is currently not implemented. this maintains a list of logical to physical bus mappings freeing the application of the a-priori knowledge More...
 
ATCA_STATUS hal_cdc_discover_devices (int bus_num, ATCAIfaceCfg cfg[], int *found)
 discover any CryptoAuth devices on a given logical bus number.This function is currently not implemented. More...
 
ATCA_STATUS hal_kit_cdc_post_init (ATCAIface iface)
 HAL implementation of Kit USB CDC post init. More...
 
ATCA_STATUS kit_phy_send (ATCAIface iface, const char *txdata, int txlength)
 HAL implementation of kit protocol send .It is called by the top layer. More...
 
ATCA_STATUS kit_phy_receive (ATCAIface iface, char *rxdata, int *rxsize)
 HAL implementation of kit protocol receive data.It is called by the top layer. More...
 
ATCA_STATUS hal_kit_phy_num_found (int8_t *num_found)
 Number of USB CDC devices found. More...
 
ATCA_STATUS hal_kit_cdc_send (ATCAIface iface, uint8_t *txdata, int txlength)
 HAL implementation of kit protocol send over USB CDC. More...
 
ATCA_STATUS hal_kit_cdc_receive (ATCAIface iface, uint8_t *rxdata, uint16_t *rxsize)
 HAL implementation of kit protocol receive over USB CDC. More...
 
ATCA_STATUS hal_kit_cdc_wake (ATCAIface iface)
 Call the wake for kit protocol over USB CDC. More...
 
ATCA_STATUS hal_kit_cdc_idle (ATCAIface iface)
 Call the idle for kit protocol over USB CDC. More...
 
ATCA_STATUS hal_kit_cdc_sleep (ATCAIface iface)
 Call the sleep for kit protocol over USB CDC. More...
 
ATCA_STATUS hal_kit_cdc_release (void *hal_data)
 Close the physical port for CDC. More...
 
ATCA_STATUS hal_kit_cdc_discover_buses (int cdc_buses[], int max_buses)
 discover cdc buses available for this hardware this maintains a list of logical to physical bus mappings freeing the application of the a-priori knowledge.This function is currently not implemented. More...
 
ATCA_STATUS hal_kit_cdc_discover_devices (int bus_num, ATCAIfaceCfg *cfg, int *found)
 discover any CryptoAuth devices on a given logical bus number More...
 

Variables

atcacdc_t _gCdc
 

Detailed Description

ATCA Hardware abstraction layer for Windows using kit protocol over a USB CDC device.

Function Documentation

◆ hal_cdc_discover_buses()

ATCA_STATUS hal_cdc_discover_buses ( int  i2c_buses[],
int  max_buses 
)

discover all CDC kits available.This function is currently not implemented. this maintains a list of logical to physical bus mappings freeing the application of the a-priori knowledge

Parameters
[in]i2c_buses- an array of logical bus numbers
[in]max_buses- maximum number of buses the app wants to attempt to discover
Returns
ATCA_UNIMPLEMENTED

◆ hal_cdc_discover_devices()

ATCA_STATUS hal_cdc_discover_devices ( int  bus_num,
ATCAIfaceCfg  cfg[],
int *  found 
)

discover any CryptoAuth devices on a given logical bus number.This function is currently not implemented.

Parameters
[in]bus_num- logical bus number on which to look for CryptoAuth devices
[out]cfg[]- pointer to head of an array of interface config structures which get filled in by this method
[out]*found- number of devices found on this bus
Returns
ATCA_UNIMPLEMENTED

◆ hal_kit_cdc_discover_buses()

ATCA_STATUS hal_kit_cdc_discover_buses ( int  cdc_buses[],
int  max_buses 
)

discover cdc buses available for this hardware this maintains a list of logical to physical bus mappings freeing the application of the a-priori knowledge.This function is currently not implemented.

Parameters
[in]cdc_buses- an array of logical bus numbers
[in]max_buses- maximum number of buses the app wants to attempt to discover
Returns
ATCA_UNIMPLEMENTED

◆ hal_kit_cdc_discover_devices()

ATCA_STATUS hal_kit_cdc_discover_devices ( int  bus_num,
ATCAIfaceCfg cfg,
int *  found 
)

discover any CryptoAuth devices on a given logical bus number

Parameters
[in]bus_num- logical bus number on which to look for CryptoAuth devices
[out]cfg[]- pointer to head of an array of interface config structures which get filled in by this method
[out]*found- number of devices found on this bus
Returns
ATCA_UNIMPLEMENTED

◆ hal_kit_cdc_idle()

ATCA_STATUS hal_kit_cdc_idle ( ATCAIface  iface)

Call the idle for kit protocol over USB CDC.

Parameters
[in]ifaceATCAIface instance that is the interface object to send the bytes over
Returns
ATCA_SUCCESS on success, otherwise an error code.

◆ hal_kit_cdc_init()

ATCA_STATUS hal_kit_cdc_init ( void *  hal,
ATCAIfaceCfg cfg 
)

HAL implementation of Kit USB CDC init.

Parameters
[in]halpointer to HAL specific data that is maintained by this HAL
[in]cfgpointer to HAL specific configuration data that is used to initialize this HAL
Returns
ATCA_SUCCESS on success, otherwise an error code.

◆ hal_kit_cdc_post_init()

ATCA_STATUS hal_kit_cdc_post_init ( ATCAIface  iface)

HAL implementation of Kit USB CDC post init.

Parameters
[in]ifaceinstance
Returns
ATCA_SUCCESS on success, otherwise an error code.

◆ hal_kit_cdc_receive()

ATCA_STATUS hal_kit_cdc_receive ( ATCAIface  iface,
uint8_t *  rxdata,
uint16_t *  rxsize 
)

HAL implementation of kit protocol receive over USB CDC.

Parameters
[in]ifaceDevice to interact with.
[out]rxdataData received will be returned here.
[in,out]rxsizeAs input, the size of the rxdata buffer. As output, the number of bytes received.
Returns
ATCA_SUCCESS on success, otherwise an error code.

◆ hal_kit_cdc_release()

ATCA_STATUS hal_kit_cdc_release ( void *  hal_data)

Close the physical port for CDC.

Parameters
[in]hal_dataThe hardware abstraction data specific to this HAL
Returns
ATCA_SUCCESS on success, otherwise an error code.

◆ hal_kit_cdc_send()

ATCA_STATUS hal_kit_cdc_send ( ATCAIface  iface,
uint8_t *  txdata,
int  txlength 
)

HAL implementation of kit protocol send over USB CDC.

Parameters
[in]ifaceinstance
[in]txdatapointer to bytes to send
[in]txlengthnumber of bytes to send
Returns
ATCA_SUCCESS on success, otherwise an error code.

◆ hal_kit_cdc_sleep()

ATCA_STATUS hal_kit_cdc_sleep ( ATCAIface  iface)

Call the sleep for kit protocol over USB CDC.

Parameters
[in]ifaceATCAIface instance that is the interface object to send the bytes over
Returns
ATCA_SUCCESS on success, otherwise an error code.

◆ hal_kit_cdc_wake()

ATCA_STATUS hal_kit_cdc_wake ( ATCAIface  iface)

Call the wake for kit protocol over USB CDC.

Parameters
[in]ifaceATCAIface instance that is the interface object to send the bytes over
Returns
ATCA_SUCCESS on success, otherwise an error code.

◆ hal_kit_phy_num_found()

ATCA_STATUS hal_kit_phy_num_found ( int8_t *  num_found)

Number of USB CDC devices found.

Parameters
[out]num_foundNumber of USB CDC devices found returned here
Returns
ATCA_SUCCESS

◆ kit_phy_receive()

ATCA_STATUS kit_phy_receive ( ATCAIface  iface,
char *  rxdata,
int *  rxsize 
)

HAL implementation of kit protocol receive data.It is called by the top layer.

Parameters
[in]ifaceinstance
[out]rxdatapointer to space to receive the data
[in,out]rxsizeptr to expected number of receive bytes to request
Returns
ATCA_SUCCESS on success, otherwise an error code.

◆ kit_phy_send()

ATCA_STATUS kit_phy_send ( ATCAIface  iface,
const char *  txdata,
int  txlength 
)

HAL implementation of kit protocol send .It is called by the top layer.

Parameters
[in]ifaceinstance
[in]txdatapointer to bytes to send
[in]txlengthnumber of bytes to send
Returns
ATCA_SUCCESS on success, otherwise an error code.

Variable Documentation

◆ _gCdc

atcacdc_t _gCdc