CryptoAuthLib
Atmel 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 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 busNum, ATCAIfaceCfg cfg[], int *found)
 discover any CryptoAuth devices on a given logical bus number 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, uint8_t *txdata, int txlength)
 HAL implementation of send over USB CDC. More...
 
ATCA_STATUS kit_phy_receive (ATCAIface iface, uint8_t *rxdata, int *rxsize)
 HAL implementation of kit protocol send over USB CDC. 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 send over USB CDC. More...
 
ATCA_STATUS hal_kit_cdc_wake (ATCAIface iface)
 Call the wake for kit protocol. More...
 
ATCA_STATUS hal_kit_cdc_idle (ATCAIface iface)
 Call the idle for kit protocol. More...
 
ATCA_STATUS hal_kit_cdc_sleep (ATCAIface iface)
 Call the sleep for kit protocol. 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 i2c_buses[], int max_buses)
 
ATCA_STATUS hal_kit_cdc_discover_devices (int busNum, ATCAIfaceCfg *cfg, int *found)
 

Variables

atcacdc_t _gCdc
 

Detailed Description

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

Copyright (c) 2015 Atmel Corporation. All rights reserved.

Function Documentation

ATCA_STATUS hal_cdc_discover_buses ( int  i2c_buses[],
int  max_buses 
)

discover all CDC kits available 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
ATCA_STATUS hal_cdc_discover_devices ( int  busNum,
ATCAIfaceCfg  cfg[],
int *  found 
)

discover any CryptoAuth devices on a given logical bus number

Parameters
[in]busNum- 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
ATCA_STATUS hal_kit_cdc_discover_buses ( int  i2c_buses[],
int  max_buses 
)
ATCA_STATUS hal_kit_cdc_discover_devices ( int  busNum,
ATCAIfaceCfg cfg,
int *  found 
)
ATCA_STATUS hal_kit_cdc_idle ( ATCAIface  iface)

Call the idle for kit protocol.

Parameters
[in]ifaceATCAIface instance that is the interface object to send the bytes over
Returns
ATCA_STATUS
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_STATUS
ATCA_STATUS hal_kit_cdc_post_init ( ATCAIface  iface)

HAL implementation of Kit USB CDC post init.

Parameters
[in]ifaceinstance
Returns
ATCA_STATUS
ATCA_STATUS hal_kit_cdc_receive ( ATCAIface  iface,
uint8_t *  rxdata,
uint16_t *  rxsize 
)

HAL implementation of send over USB CDC.

Parameters
[in]ifaceinstance
[in]rxdatapointer to space to receive the data
[in,out]rxsizeptr to expected number of receive bytes to request
Returns
ATCA_STATUS
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_STATUS
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_STATUS
ATCA_STATUS hal_kit_cdc_sleep ( ATCAIface  iface)

Call the sleep for kit protocol.

Parameters
[in]ifaceATCAIface instance that is the interface object to send the bytes over
Returns
ATCA_STATUS
ATCA_STATUS hal_kit_cdc_wake ( ATCAIface  iface)

Call the wake for kit protocol.

Parameters
[in]ifaceATCAIface instance that is the interface object to send the bytes over
Returns
ATCA_STATUS
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_STATUS
ATCA_STATUS kit_phy_receive ( ATCAIface  iface,
uint8_t *  rxdata,
int *  rxsize 
)

HAL implementation of kit protocol send over USB CDC.

Parameters
[in]ifaceinstance
[out]rxdatapointer to space to receive the data
[in,out]rxsizeptr to expected number of receive bytes to request
Returns
ATCA_STATUS
ATCA_STATUS kit_phy_send ( ATCAIface  iface,
uint8_t *  txdata,
int  txlength 
)

HAL implementation of send over USB CDC.

Parameters
[in]ifaceinstance
[in]txdatapointer to bytes to send
[in]txlengthnumber of bytes to send
Returns
ATCA_STATUS

Variable Documentation

atcacdc_t _gCdc