xilasu
Vitis Drivers API Documentation
Client APIs AND Error Codes

Data Structures

struct  XAsu_ClientParams
 This structure contains client parameters information. More...
 

Macros

#define XASU_QUEUE_BUFFER_FULL   0xFFU
 To indicate queue full state. More...
 
#define XASU_CLIENT_READY   0xFFFFFFFFU
 To indicate Client is ready. More...
 
#define XASU_TARGET_IPI_INT_MASK   1U
 ASU IPI interrupt mask. More...
 
#define ASU_GLOBAL_BASEADDR   (0xEBF80000U)
 ASU GLOBAL register base address. More...
 
#define ASU_GLOBAL_GLOBAL_CNTRL   (ASU_GLOBAL_BASEADDR + 0x00000000U)
 ASU GLOBAL CNTRL register address. More...
 
#define ASU_GLOBAL_GLOBAL_CNTRL_FW_IS_PRESENT_MASK   0x10U
 ASU FW Present mask value. More...
 
#define XASU_ASUFW_BIT_CHECK_TIMEOUT_VALUE   0xFFFFFU
 ASUFW check timoeout value. More...
 
#define XASU_NO_OF_CONTEXTS   (10U)
 No of contexts can be saved by client. More...
 
#define XASU_PRIORITY_LOW   1U
 LOW priority. More...
 
#define XASU_PRIORITY_HIGH   0U
 High priority. More...
 

Typedefs

typedef void(* XAsuClient_ResponseHandler )(void *CallBackRefPtr, u32 Status)
 Response handler. More...
 

Enumerations

enum  {
  XASU_INVALID_ARGUMENT = 0x10, XASU_QUEUE_FULL, XASU_ASUFW_NOT_PRESENT, XASU_IPI_CONFIG_NOT_FOUND,
  XASU_INVALID_UNIQUE_ID, XASU_CLIENT_NOT_INITIALIZED, XASU_INVALID_PRIORITY, XASU_INVALID_CALL_BACK_REF,
  XASU_INVALID_CLIENT_PARAM, XASU_INVALID_CLIENT_CTX, XASU_FAIL_SAVE_CTX, XASU_INVALID_CURVEINFO
}
 This contains the client error codes. More...
 
enum  { XASU_AES_TAG_MATCHED = 0x3FD, XASU_AES_TAG_READ }
 This contains the non-zero success values returned from server for critical security functionalities and these codes should not be used for failures in client. More...
 

Functions

s32 XAsu_ClientInit (XMailbox *MailboxInstancePtr)
 This function initializes the client instance. More...
 
s32 XAsu_ValidateClientParameters (XAsu_ClientParams *ClientParamPtr)
 This function validates the input client parameters. More...
 
s32 XAsu_UpdateQueueBufferNSendIpi (XAsu_ClientParams *ClientParam, void *ReqBuffer, u32 Size, u32 Header)
 This function updates the queue buffer status to notify the request is present and generates a door bell to ASU. More...
 
u8 XAsu_RegCallBackNGetUniqueId (const XAsu_ClientParams *ClientParamPtr, u8 *RespBufferPtr, u32 Size, u8 IsFinalCall)
 This function registers callback parameters across the generated unique ID per request. More...
 
void XAsu_UpdateCallBackDetails (u8 UniqueId, u8 *RespBufferPtr, u32 Size, u8 IsFinalCall)
 Updates callback details based on the provided unique ID, response buffer, size, and final call flag. More...
 
void XAsu_FreeCtx (void *Context)
 Frees the memory associated with the provided context. More...
 
void * XAsu_UpdateNGetCtx (u8 UniqueId)
 Saves the provided unique ID and returns the address of the saved context. More...
 
s32 XAsu_VerifyNGetUniqueIdCtx (const void *Context, u8 *UniqueId)
 Validates the provided context by comparing it with stored contexts to determine the appropriate multi-update calls. More...
 
u8 XAsu_GetUniqueId (u32 Header)
 This function gets the unique ID from the provided header. More...
 
u32 XAsu_CreateHeader (u8 CmdId, u8 UniqueId, u8 ModuleId, u8 CommandLen)
 This function formats the command header with module ID, command ID and command length. More...
 

Macro Definition Documentation

#define ASU_GLOBAL_BASEADDR   (0xEBF80000U)

ASU GLOBAL register base address.

#define ASU_GLOBAL_GLOBAL_CNTRL   (ASU_GLOBAL_BASEADDR + 0x00000000U)

ASU GLOBAL CNTRL register address.

#define ASU_GLOBAL_GLOBAL_CNTRL_FW_IS_PRESENT_MASK   0x10U

ASU FW Present mask value.

#define XASU_ASUFW_BIT_CHECK_TIMEOUT_VALUE   0xFFFFFU

ASUFW check timoeout value.

#define XASU_CLIENT_READY   0xFFFFFFFFU

To indicate Client is ready.

Referenced by XAsu_UpdateQueueBufferNSendIpi().

#define XASU_NO_OF_CONTEXTS   (10U)

No of contexts can be saved by client.

#define XASU_PRIORITY_HIGH   0U

High priority.

Referenced by main(), and XAsu_UpdateQueueBufferNSendIpi().

#define XASU_PRIORITY_LOW   1U

LOW priority.

#define XASU_QUEUE_BUFFER_FULL   0xFFU

To indicate queue full state.

#define XASU_TARGET_IPI_INT_MASK   1U

ASU IPI interrupt mask.

Typedef Documentation

typedef void(* XAsuClient_ResponseHandler)(void *CallBackRefPtr, u32 Status)

Response handler.

Enumeration Type Documentation

anonymous enum

This contains the client error codes.

Enumerator
XASU_INVALID_ARGUMENT 

0x10 - Invalid argument

XASU_QUEUE_FULL 

0x11 - Channel queue is full

XASU_ASUFW_NOT_PRESENT 

0x12 - ASU application FW is not present

XASU_IPI_CONFIG_NOT_FOUND 

0x13 - IPI configuration is not found

XASU_INVALID_UNIQUE_ID 

0x14 - Invalid unique ID

XASU_CLIENT_NOT_INITIALIZED 

0x15 - Client is not initialized

XASU_INVALID_PRIORITY 

0x16 - Invalid Priority

XASU_INVALID_CALL_BACK_REF 

0x17 - Invalid callback reference

XASU_INVALID_CLIENT_PARAM 

0x18 - Invalid client parameter pointer

XASU_INVALID_CLIENT_CTX 

0x19 - Client context is not valid

XASU_FAIL_SAVE_CTX 

0x1A - Failed in saving the context

XASU_INVALID_CURVEINFO 

0x1B - Invalid curve type or curve length

anonymous enum

This contains the non-zero success values returned from server for critical security functionalities and these codes should not be used for failures in client.

Enumerator
XASU_AES_TAG_MATCHED 

0x3FDU - Successfully verified AES tag

XASU_AES_TAG_READ 

0x3FEU - Successfully read AES tag

Function Documentation

s32 XAsu_ClientInit ( XMailbox *  MailboxInstancePtr)

This function initializes the client instance.

Parameters
MailboxInstancePtrPointer to the Mailbox instance.
Returns
  • XST_SUCCESS, On successful initialization.
  • XST_FAILURE, On failure. ,

Validate client instance pointer.

Check for ASUFW present bit.

Initialize performance measurement.

Map the IPI shared memory of the channel.

Referenced by main().

u32 XAsu_CreateHeader ( u8  CmdId,
u8  UniqueId,
u8  ModuleId,
u8  CommandLen 
)
void XAsu_FreeCtx ( void *  Context)

Frees the memory associated with the provided context.

Parameters
ContextPointer to the XAsu_ClientCtx to be freed.

Referenced by XAsu_AesOperation(), XAsu_HmacCompute(), XAsu_Sha2Operation(), and XAsu_Sha3Operation().

u8 XAsu_GetUniqueId ( u32  Header)

This function gets the unique ID from the provided header.

Parameters
HeaderHeader of the response/request buffer.
Returns
  • Unique ID Returns the unique ID

References XASU_UNIQUE_REQ_ID_MASK, and XASU_UNIQUE_REQ_ID_SHIFT.

u8 XAsu_RegCallBackNGetUniqueId ( const XAsu_ClientParams ClientParamPtr,
u8 *  RespBufferPtr,
u32  Size,
u8  IsFinalCall 
)

This function registers callback parameters across the generated unique ID per request.

Parameters
ClientParamPtrPointer to the XAsu_ClientParams structure which holds the client input arguments.
RespBufferPtrBuffer to hold the response from response buffer, if no data is part of response buffer for the request the value shall be NULL.
SizeSize of the data to be filled in response buffer.
Returns
  • Unique ID used for registration (valid values are 0 to (XASU_UNIQUE_ID_MAX - 1)).
  • XASU_UNIQUE_ID_MAX, if unique ID is unavailable.

Generate unique ID for the request.

Store the callback details.

References XASU_UNIQUE_ID_MAX.

Referenced by XAsu_AesKat(), XAsu_AesOperation(), XAsu_EccGenPubKey(), XAsu_EccGenSign(), XAsu_EccKat(), XAsu_EccVerifySign(), XAsu_EcdhGenSharedSecret(), XAsu_EcdhKat(), XAsu_EciesDecrypt(), XAsu_EciesEncrypt(), XAsu_EciesKat(), XAsu_HmacCompute(), XAsu_HmacKat(), XAsu_KdfGenerate(), XAsu_KdfKat(), XAsu_KeyUnwrap(), XAsu_KeyWrap(), XAsu_KeyWrapKat(), XAsu_RsaCrtDec(), XAsu_RsaDec(), XAsu_RsaEnc(), XAsu_RsaKat(), XAsu_RsaOaepDec(), XAsu_RsaOaepEnc(), XAsu_RsaPssSignGen(), XAsu_RsaPssSignVer(), XAsu_Sha2Kat(), XAsu_Sha2Operation(), XAsu_Sha3Kat(), XAsu_Sha3Operation(), XAsu_TrngGetRandomNum(), and XAsu_TrngKat().

void XAsu_UpdateCallBackDetails ( u8  UniqueId,
u8 *  RespBufferPtr,
u32  Size,
u8  IsFinalCall 
)

Updates callback details based on the provided unique ID, response buffer, size, and final call flag.

Parameters
UniqueIdUnique identifier for the callback update.
RespBufferPtrPointer to the response buffer containing the data.
SizeSize of the response buffer.
IsFinalCallFlag indicating whether this is the final callback (1 if final, 0 otherwise).

Update the callback details.

Referenced by XAsu_AesOperation(), XAsu_HmacCompute(), XAsu_Sha2Operation(), and XAsu_Sha3Operation().

void * XAsu_UpdateNGetCtx ( u8  UniqueId)

Saves the provided unique ID and returns the address of the saved context.

Parameters
UniqueIdUnique ID associated with the request
Returns
Pointer of the XAsu_ClientCtx, which references the saved context.

Find the free index to store the context.

Save the context.

Referenced by XAsu_AesOperation(), XAsu_HmacCompute(), XAsu_Sha2Operation(), and XAsu_Sha3Operation().

s32 XAsu_UpdateQueueBufferNSendIpi ( XAsu_ClientParams ClientParam,
void *  ReqBuffer,
u32  Size,
u32  Header 
)

This function updates the queue buffer status to notify the request is present and generates a door bell to ASU.

Parameters
ClientParamPointer to the XAsu_ClientParams instance.
ReqBufferPointer to the XAsu_ChannelQueueBuf's Request buffer data to be filled.
SizeSize of the request buffer in bytes.
HeaderHeader of the request buffer to be filled.
Returns
  • XST_SUCCESS, if IPI is sent successfully.
  • XST_FAILURE, if there is any failure.
  • XASU_INVALID_ARGUMENT, if the input parameters are invalid.

Validate input parameters.

Get free queue buffer index of selected priority

Copy the request buffer to the free index.

Set IsCmdPresent to XASU_TRUE to indicate the command is present in the queue.

Place an IPI request to ASU.

References XAsu_ReqBuf::Arg, XAsu_ReqBuf::Header, XAsu_ChannelQueue::IsCmdPresent, XAsu_ClientParams::Priority, XAsu_ChannelQueueBuf::ReqBuf, XAsu_ChannelQueueBuf::ReqBufStatus, XAsu_ChannelQueue::ReqSent, XAsu_ChannelQueueBuf::RespBufStatus, XASU_CLIENT_NOT_INITIALIZED, XASU_CLIENT_READY, XASU_COMMAND_IS_PRESENT, XASU_INVALID_ARGUMENT, XASU_MAX_BUFFERS, XASU_PRIORITY_HIGH, and XASU_QUEUE_FULL.

Referenced by XAsu_AesKat(), XAsu_AesOperation(), XAsu_EccGenPubKey(), XAsu_EccGenSign(), XAsu_EccKat(), XAsu_EccVerifySign(), XAsu_EcdhGenSharedSecret(), XAsu_EcdhKat(), XAsu_EciesDecrypt(), XAsu_EciesEncrypt(), XAsu_EciesKat(), XAsu_HmacCompute(), XAsu_HmacKat(), XAsu_KdfGenerate(), XAsu_KdfKat(), XAsu_KeyUnwrap(), XAsu_KeyWrap(), XAsu_KeyWrapKat(), XAsu_RsaCrtDec(), XAsu_RsaDec(), XAsu_RsaEnc(), XAsu_RsaKat(), XAsu_RsaOaepDec(), XAsu_RsaOaepEnc(), XAsu_RsaPssSignGen(), XAsu_RsaPssSignVer(), XAsu_Sha2Kat(), XAsu_Sha2Operation(), XAsu_Sha3Kat(), XAsu_Sha3Operation(), XAsu_TrngGetRandomNum(), and XAsu_TrngKat().

s32 XAsu_ValidateClientParameters ( XAsu_ClientParams ClientParamPtr)

This function validates the input client parameters.

Parameters
ClientParamPtrPointer to the XAsu_ClientParams instance.
Returns
  • XST_SUCCESS, if client parameters validation is successful.
  • XASU_INVALID_ARGUMENT, if the input parameters are invalid.
  • XASU_INVALID_CLIENT_PARAM, if ClientParamPtr is NULL.
  • XASU_INVALID_CALL_BACK_REF, if CallBackFuncPtr is NULL.
  • XASU_INVALID_PRIORITY, if invalid priority is selected.

Validate that the callback function pointer is not NULL.

Validate the priority.

References XASU_INVALID_CLIENT_PARAM.

Referenced by XAsu_AesKat(), XAsu_AesOperation(), XAsu_EccGenPubKey(), XAsu_EccGenSign(), XAsu_EccKat(), XAsu_EccVerifySign(), XAsu_EcdhGenSharedSecret(), XAsu_EcdhKat(), XAsu_EciesDecrypt(), XAsu_EciesEncrypt(), XAsu_EciesKat(), XAsu_HmacCompute(), XAsu_HmacKat(), XAsu_KdfGenerate(), XAsu_KdfKat(), XAsu_KeyUnwrap(), XAsu_KeyWrap(), XAsu_KeyWrapKat(), XAsu_RsaCrtDec(), XAsu_RsaDec(), XAsu_RsaEnc(), XAsu_RsaKat(), XAsu_RsaOaepDec(), XAsu_RsaOaepEnc(), XAsu_RsaPssSignGen(), XAsu_RsaPssSignVer(), XAsu_Sha2Kat(), XAsu_Sha2Operation(), XAsu_Sha3Kat(), XAsu_Sha3Operation(), XAsu_TrngGetRandomNum(), and XAsu_TrngKat().

s32 XAsu_VerifyNGetUniqueIdCtx ( const void *  Context,
u8 *  UniqueId 
)

Validates the provided context by comparing it with stored contexts to determine the appropriate multi-update calls.

Parameters
ContextPointer to the XAsu_ClientCtx reference context.
UniqueIdPointer to the buffer where the corresponding Unique ID will be stored.
Returns
  • XST_SUCCESS if validation is successful.
  • XASU_INVALID_CLIENT_CTX if the provided context is not found.

Referenced by XAsu_AesOperation(), XAsu_HmacCompute(), XAsu_Sha2Operation(), and XAsu_Sha3Operation().