|
Pavona Software APIs
|
ACC Device Interface Functions. More...
#include <stddef.h>#include <stdint.h>#include "sw/device/lib/base/mmio.h"#include "sw/device/lib/dif/dif_base.h"#include "sw/device/lib/dif/autogen/dif_acc_autogen.h"Go to the source code of this file.
Typedefs | |
| typedef enum dif_acc_cmd | dif_acc_cmd_t |
| ACC commands. | |
| typedef enum dif_acc_status | dif_acc_status_t |
| ACC status. | |
| typedef enum dif_acc_err_bits | dif_acc_err_bits_t |
| ACC Errors. | |
Enumerations | |
| enum | dif_acc_cmd { kDifAccCmdExecute = 0xd8 , kDifAccCmdSecWipeDmem = 0xc3 , kDifAccCmdSecWipeImem = 0x1e } |
| ACC commands. More... | |
| enum | dif_acc_status { kDifAccStatusIdle = 0x00 , kDifAccStatusBusyExecute = 0x01 , kDifAccStatusBusySecWipeDmem = 0x02 , kDifAccStatusBusySecWipeImem = 0x03 , kDifAccStatusBusySecWipeInt = 0x04 , kDifAccStatusLocked = 0xFF } |
| ACC status. More... | |
| enum | dif_acc_err_bits { kDifAccErrBitsNoError = 0 , kDifAccErrBitsBadDataAddr = (1 << 0) , kDifAccErrBitsBadInsnAddr = (1 << 1) , kDifAccErrBitsCallStack = (1 << 2) , kDifAccErrBitsIllegalInsn = (1 << 3) , kDifAccErrBitsLoop = (1 << 4) , kDifAccErrBitsRndFipsChkFail = (1 << 7) , kDifAccErrBitsImemIntgViolation = (1 << 16) , kDifAccErrBitsDmemIntgViolation = (1 << 17) , kDifAccErrBitsRegIntgViolation = (1 << 18) , kDifAccErrBitsBusIntgViolation = (1 << 19) , kDifAccErrBitsBadInternalState = (1 << 20) , kDifAccErrBitsIllegalBusAccess = (1 << 21) , kDifAccErrBitsLifecycleEscalation = (1 << 22) , kDifAccErrBitsFatalSoftware = (1 << 23) } |
| ACC Errors. More... | |
Functions | |
| OT_WARN_UNUSED_RESULT dif_result_t | dif_acc_reset (const dif_acc_t *acc) |
| Reset ACC device. | |
| OT_WARN_UNUSED_RESULT dif_result_t | dif_acc_write_cmd (const dif_acc_t *acc, dif_acc_cmd_t cmd) |
| Start an operation by issuing a command. | |
| OT_WARN_UNUSED_RESULT dif_result_t | dif_acc_get_status (const dif_acc_t *acc, dif_acc_status_t *status) |
| Gets the current status of ACC. | |
| OT_WARN_UNUSED_RESULT dif_result_t | dif_acc_get_err_bits (const dif_acc_t *acc, dif_acc_err_bits_t *err_bits) |
| Get the error bits set by the device if the operation failed. | |
| OT_WARN_UNUSED_RESULT dif_result_t | dif_acc_get_insn_cnt (const dif_acc_t *acc, uint32_t *insn_cnt) |
| Gets the number of executed ACC instructions. | |
| OT_WARN_UNUSED_RESULT dif_result_t | dif_acc_get_load_checksum (const dif_acc_t *acc, uint32_t *insn_cnt) |
| Gets the content of the load checksum register. | |
| OT_WARN_UNUSED_RESULT dif_result_t | dif_acc_clear_load_checksum (const dif_acc_t *acc) |
| Clears the load checksum register. | |
| OT_WARN_UNUSED_RESULT dif_result_t | dif_acc_imem_write (const dif_acc_t *acc, uint32_t offset_bytes, const void *src, size_t len_bytes) |
| Write an ACC application into its instruction memory (IMEM). | |
| OT_WARN_UNUSED_RESULT dif_result_t | dif_acc_imem_read (const dif_acc_t *acc, uint32_t offset_bytes, void *dest, size_t len_bytes) |
| Read from ACC's instruction memory (IMEM). | |
| OT_WARN_UNUSED_RESULT dif_result_t | dif_acc_dmem_write (const dif_acc_t *acc, uint32_t offset_bytes, const void *src, size_t len_bytes) |
| Write to ACC's data memory (DMEM). | |
| OT_WARN_UNUSED_RESULT dif_result_t | dif_acc_dmem_read (const dif_acc_t *acc, uint32_t offset_bytes, void *dest, size_t len_bytes) |
| Read from ACC's data memory (DMEM). | |
| OT_WARN_UNUSED_RESULT dif_result_t | dif_acc_set_ctrl_software_errs_fatal (const dif_acc_t *acc, bool enable) |
| Sets the software errors are fatal bit in the control register. | |
| size_t | dif_acc_get_dmem_size_bytes (const dif_acc_t *acc) |
| Get the size of ACC's data memory in bytes. | |
| size_t | dif_acc_get_imem_size_bytes (const dif_acc_t *acc) |
| Get the size of ACC's instruction memory in bytes. | |
| typedef enum dif_acc_err_bits dif_acc_err_bits_t |
ACC Errors.
ACC uses a bitfield to indicate which errors have been seen. Multiple errors can be seen at the same time. This enum gives the individual bits that may be set for different errors.
| enum dif_acc_cmd |
| enum dif_acc_err_bits |
ACC Errors.
ACC uses a bitfield to indicate which errors have been seen. Multiple errors can be seen at the same time. This enum gives the individual bits that may be set for different errors.
| enum dif_acc_status |
| OT_WARN_UNUSED_RESULT dif_result_t dif_acc_clear_load_checksum | ( | const dif_acc_t * | acc | ) |
| OT_WARN_UNUSED_RESULT dif_result_t dif_acc_dmem_read | ( | const dif_acc_t * | acc, |
| uint32_t | offset_bytes, | ||
| void * | dest, | ||
| size_t | len_bytes ) |
Read from ACC's data memory (DMEM).
Only 32b-aligned 32b word accesses are allowed.
| acc | ACC instance | |
| offset_bytes | the byte offset in DMEM the first word is read from. | |
| [out] | dest | the main memory location to copy the data to (preallocated). |
| len_bytes | number of bytes to copy. |
| OT_WARN_UNUSED_RESULT dif_result_t dif_acc_dmem_write | ( | const dif_acc_t * | acc, |
| uint32_t | offset_bytes, | ||
| const void * | src, | ||
| size_t | len_bytes ) |
Write to ACC's data memory (DMEM).
Only 32b-aligned 32b word accesses are allowed.
| acc | ACC instance. |
| offset_bytes | the byte offset in DMEM the first word is written to. |
| src | the main memory location to start reading from. |
| len_bytes | number of bytes to copy. |
| size_t dif_acc_get_dmem_size_bytes | ( | const dif_acc_t * | acc | ) |
| OT_WARN_UNUSED_RESULT dif_result_t dif_acc_get_err_bits | ( | const dif_acc_t * | acc, |
| dif_acc_err_bits_t * | err_bits ) |
| size_t dif_acc_get_imem_size_bytes | ( | const dif_acc_t * | acc | ) |
| OT_WARN_UNUSED_RESULT dif_result_t dif_acc_get_insn_cnt | ( | const dif_acc_t * | acc, |
| uint32_t * | insn_cnt ) |
Gets the number of executed ACC instructions.
Gets the number of instructions executed so far in the current ACC run if there is one. Otherwise, gets the number executed in total in the previous ACC run.
| acc | ACC instance. | |
| [out] | insn_cnt | The number of instructions executed by ACC. |
| OT_WARN_UNUSED_RESULT dif_result_t dif_acc_get_load_checksum | ( | const dif_acc_t * | acc, |
| uint32_t * | insn_cnt ) |
| OT_WARN_UNUSED_RESULT dif_result_t dif_acc_get_status | ( | const dif_acc_t * | acc, |
| dif_acc_status_t * | status ) |
| OT_WARN_UNUSED_RESULT dif_result_t dif_acc_imem_read | ( | const dif_acc_t * | acc, |
| uint32_t | offset_bytes, | ||
| void * | dest, | ||
| size_t | len_bytes ) |
Read from ACC's instruction memory (IMEM).
Only 32b-aligned 32b word accesses are allowed.
| acc | ACC instance | |
| offset_bytes | the byte offset in IMEM the first word is read from. | |
| [out] | dest | the main memory location to copy the data to (preallocated). |
| len_bytes | number of bytes to copy. |
| OT_WARN_UNUSED_RESULT dif_result_t dif_acc_imem_write | ( | const dif_acc_t * | acc, |
| uint32_t | offset_bytes, | ||
| const void * | src, | ||
| size_t | len_bytes ) |
Write an ACC application into its instruction memory (IMEM).
Only 32b-aligned 32b word accesses are allowed.
| acc | ACC instance. |
| offset_bytes | the byte offset in IMEM the first word is written to. |
| src | the main memory location to start reading from. |
| len_bytes | number of bytes to copy. |
| OT_WARN_UNUSED_RESULT dif_result_t dif_acc_reset | ( | const dif_acc_t * | acc | ) |
| OT_WARN_UNUSED_RESULT dif_result_t dif_acc_set_ctrl_software_errs_fatal | ( | const dif_acc_t * | acc, |
| bool | enable ) |
Sets the software errors are fatal bit in the control register.
When set any software error becomes a fatal error. The bit can only be changed when the ACC status is IDLE.
| acc | ACC instance. |
| enable | Enable or disable whether software errors are fatal. |
kDifUnavailable is returned when the requested change cannot be made. | OT_WARN_UNUSED_RESULT dif_result_t dif_acc_write_cmd | ( | const dif_acc_t * | acc, |
| dif_acc_cmd_t | cmd ) |