CryptoAuthLib
Microchip CryptoAuthentication Library
atca_execution.c File Reference

Implements an execution handler that executes a given command on a device and returns the results. More...

#include <stdlib.h>
#include <string.h>
#include "atca_command.h"
#include "atca_device.h"
#include "atca_execution.h"
#include "atca_devtypes.h"
#include "hal/atca_hal.h"

Macros

#define ATCA_POLLING_INIT_TIME_MSEC   1
 
#define ATCA_POLLING_FREQUENCY_TIME_MSEC   2
 
#define ATCA_POLLING_MAX_TIME_MSEC   2500
 

Functions

ATCA_STATUS atca_execute_command (ATCAPacket *packet, ATCADevice device)
 Wakes up device, sends the packet, waits for command completion, receives response, and puts the device into the idle state. More...
 

Detailed Description

Implements an execution handler that executes a given command on a device and returns the results.

This implementation wraps Polling and No polling (simple wait) schemes into a single method and use it across the library. Polling is used by default, however, by defining the ATCA_NO_POLL symbol the code will instead wait an estimated max execution time before requesting the result.

Macro Definition Documentation

◆ ATCA_POLLING_FREQUENCY_TIME_MSEC

#define ATCA_POLLING_FREQUENCY_TIME_MSEC   2

◆ ATCA_POLLING_INIT_TIME_MSEC

#define ATCA_POLLING_INIT_TIME_MSEC   1

◆ ATCA_POLLING_MAX_TIME_MSEC

#define ATCA_POLLING_MAX_TIME_MSEC   2500

Function Documentation

◆ atca_execute_command()

ATCA_STATUS atca_execute_command ( ATCAPacket packet,
ATCADevice  device 
)

Wakes up device, sends the packet, waits for command completion, receives response, and puts the device into the idle state.

Parameters
[in,out]packetAs input, the packet to be sent. As output, the data buffer in the packet structure will contain the response.
[in]deviceCryptoAuthentication device to send the command to.
Returns
ATCA_SUCCESS on success, otherwise an error code.