|
Pavona Software APIs
|
Asymmetric Cryptographic Coprocessor (ACC) driver. More...
#include "sw/device/lib/base/mmio.h"#include "sw/device/lib/base/status.h"#include "sw/device/lib/dif/dif_acc.h"#include "sw/device/lib/dif/dif_base.h"Go to the source code of this file.
Data Structures | |
| struct | acc_app |
| Information about an embedded ACC application image. More... | |
Macros | |
| #define | ACC_SYMBOL_PTR(app_name, sym) |
| Generate the prefix to add to an ACC symbol name used on the Ibex side. | |
| #define | ACC_SYMBOL_ADDR(app_name, sym) |
| Generate the prefix to add to an ACC symbol name used on the ACC side. | |
| #define | ACC_DECLARE_SYMBOL_PTR(app_name, symbol_name) |
| Makes a symbol in the ACC application image available. | |
| #define | ACC_DECLARE_SYMBOL_ADDR(app_name, symbol_name) |
| Makes the ACC address of a symbol in the ACC application available. | |
| #define | ACC_DECLARE_APP_SYMBOLS(app_name) |
| Makes an embedded ACC application image available for use. | |
| #define | ACC_APP_T_INIT(app_name) |
| Initializes the ACC application information structure. | |
| #define | ACC_ADDR_T_INIT(app_name, symbol_name) |
Initializes an acc_addr_t. | |
Typedefs | |
| typedef struct acc_app | acc_app_t |
| Information about an embedded ACC application image. | |
| typedef uint32_t | acc_addr_t |
| The address of an ACC symbol as seen by ACC. | |
Functions | |
| OT_WARN_UNUSED_RESULT status_t | acc_testutils_load_app (const dif_acc_t *acc, const acc_app_t app) |
| (Re-)loads the application into ACC. | |
| OT_WARN_UNUSED_RESULT status_t | acc_testutils_execute (const dif_acc_t *acc) |
| Starts the ACC execute operation. | |
| OT_WARN_UNUSED_RESULT status_t | acc_testutils_wait_for_done (const dif_acc_t *acc, dif_acc_err_bits_t expected_err_bits) |
| Waits for ACC to be done with the current operation. | |
| OT_WARN_UNUSED_RESULT status_t | acc_testutils_write_data (const dif_acc_t *acc, size_t len_bytes, const void *src, acc_addr_t dest) |
| Copies data from the CPU memory to ACC data memory. | |
| OT_WARN_UNUSED_RESULT status_t | acc_testutils_read_data (const dif_acc_t *acc, size_t len_bytes, acc_addr_t src, void *dest) |
| Copies data from ACC's data memory to CPU memory. | |
| OT_WARN_UNUSED_RESULT status_t | acc_testutils_dump_dmem (const dif_acc_t *acc, uint32_t max_addr) |
| Writes a LOG_INFO message with the contents of each 256b DMEM word. | |
Asymmetric Cryptographic Coprocessor (ACC) driver.
Definition in file acc_testutils.h.
| struct acc_app |
Information about an embedded ACC application image.
All pointers reference data in the normal CPU address space.
Use ACC_DECLARE_APP_SYMBOLS() together with ACC_APP_T_INIT() to initialize this structure.
Definition at line 26 of file acc_testutils.h.
| #define ACC_ADDR_T_INIT | ( | app_name, | |
| symbol_name ) |
Initializes an acc_addr_t.
Definition at line 144 of file acc_testutils.h.
| #define ACC_APP_T_INIT | ( | app_name | ) |
Initializes the ACC application information structure.
After making all required symbols from the application image available through ACC_DECLARE_APP_SYMBOLS(), use this macro to initialize an acc_app_t struct with those symbols.
| app_name | Name of the application to load. |
Definition at line 133 of file acc_testutils.h.
| #define ACC_DECLARE_APP_SYMBOLS | ( | app_name | ) |
Makes an embedded ACC application image available for use.
Make symbols available that indicate the start and the end of instruction and data memory regions, as they are stored in the device memory.
Use this macro instead of manually declaring the symbols as symbol names might change.
| app_name | Name of the application to load, which is typically the name of the main (assembly) source file. |
Definition at line 117 of file acc_testutils.h.
| #define ACC_DECLARE_SYMBOL_ADDR | ( | app_name, | |
| symbol_name ) |
Makes the ACC address of a symbol in the ACC application available.
Symbols are typically function or data pointers, i.e. labels in assembly code. Unlike ACC_DECLARE_SYMBOL_PTR, this will work for symbols in the .bss section (which exist on the ACC side, even though they don't have backing data on Ibex).
Use this macro instead of manually declaring the symbols as symbol names might change.
| app_name | Name of the application the function is contained in. |
| symbol_name | Name of the symbol (function, label). |
Definition at line 102 of file acc_testutils.h.
| #define ACC_DECLARE_SYMBOL_PTR | ( | app_name, | |
| symbol_name ) |
Makes a symbol in the ACC application image available.
This is needed by the ACC driver to support DMEM/IMEM ranges but application code shouldn't need to use this. To get access to ACC addresses, use ACC_DECLARE_SYMBOL_ADDR instead.
Definition at line 85 of file acc_testutils.h.
| #define ACC_SYMBOL_ADDR | ( | app_name, | |
| sym ) |
Generate the prefix to add to an ACC symbol name used on the ACC side.
The result is a pointer whose integer value is the address by which the symbol should be accessed in ACC memory.
This is an internal macro used in ACC_DECLARE_SYMBOL_ADDR and ACC_ADDR_T_INIT but application code shouldn't need to use it directly.
Definition at line 76 of file acc_testutils.h.
| #define ACC_SYMBOL_PTR | ( | app_name, | |
| sym ) |
Generate the prefix to add to an ACC symbol name used on the Ibex side.
The result is a pointer to Ibex's rodata that should be used to initialise memory for that symbol.
This is needed by the ACC driver to support DMEM/IMEM ranges but application code shouldn't need to use this. Use the acc_addr_t type and supporting macros instead.
Definition at line 65 of file acc_testutils.h.
| typedef uint32_t acc_addr_t |
The address of an ACC symbol as seen by ACC.
Use ACC_DECLARE_SYMBOL_ADDR() together with ACC_ADDR_T_INIT() to initialize this type.
Definition at line 53 of file acc_testutils.h.
Information about an embedded ACC application image.
All pointers reference data in the normal CPU address space.
Use ACC_DECLARE_APP_SYMBOLS() together with ACC_APP_T_INIT() to initialize this structure.
| OT_WARN_UNUSED_RESULT status_t acc_testutils_dump_dmem | ( | const dif_acc_t * | acc, |
| uint32_t | max_addr ) |
Writes a LOG_INFO message with the contents of each 256b DMEM word.
| acc | The context object. |
| max_addr | The highest address to dump. Set to 0 to output the whole DMEM. Must be a multiple of WLEN. |
| OT_WARN_UNUSED_RESULT status_t acc_testutils_execute | ( | const dif_acc_t * | acc | ) |
Starts the ACC execute operation.
Use acc_testutils_wait_for_done() to wait for execution to complete.
| acc | The context object. |
Definition at line 87 of file acc_testutils.c.
| OT_WARN_UNUSED_RESULT status_t acc_testutils_load_app | ( | const dif_acc_t * | acc, |
| const acc_app_t | app ) |
(Re-)loads the application into ACC.
Load the application image with both instruction and data segments into ACC.
| acc | The context object. |
| app | The application to load into ACC. |
Definition at line 68 of file acc_testutils.c.
| OT_WARN_UNUSED_RESULT status_t acc_testutils_read_data | ( | const dif_acc_t * | acc, |
| size_t | len_bytes, | ||
| acc_addr_t | src, | ||
| void * | dest ) |
Copies data from ACC's data memory to CPU memory.
| acc | The context object. | |
| len_bytes | The number of bytes to copy. | |
| src | The address in ACC data memory to copy from. | |
| [out] | dest | The destination of the copied data in main memory (preallocated). |
Definition at line 98 of file acc_testutils.c.
| OT_WARN_UNUSED_RESULT status_t acc_testutils_wait_for_done | ( | const dif_acc_t * | acc, |
| dif_acc_err_bits_t | expected_err_bits ) |
Waits for ACC to be done with the current operation.
Polls the status register until ACC is idle. Produces a CHECK-fail if ACC is or becomes locked. Checks that the final error bits match expectations.
| acc | The context object. |
| expected_err_bits | Expected error bits. |
Definition at line 22 of file acc_testutils.c.
| OT_WARN_UNUSED_RESULT status_t acc_testutils_write_data | ( | const dif_acc_t * | acc, |
| size_t | len_bytes, | ||
| const void * | src, | ||
| acc_addr_t | dest ) |
Copies data from the CPU memory to ACC data memory.
| acc | The context object. |
| len_bytes | Number of bytes to copy. |
| dest | Address of the destination in ACC's data memory. |
| src | Source of the data to copy. |
Definition at line 92 of file acc_testutils.c.