REDAC HybridController
Firmware for LUCIDAC/REDAC Teensy
|
Classes | |
struct | _dcp_handle |
union | _dcp_hash_block |
struct | _dcp_hash_ctx_internal |
struct | _dcp_hash_ctx_t |
struct | _dcp_work_packet |
struct | DCP_Type |
DCP - Register Layout Typedef. More... | |
Typedefs | |
typedef enum utils::_dcp_ch_enable | _dcp_ch_enable_t |
typedef enum utils::_dcp_channel | dcp_channel_t |
typedef enum utils::_dcp_key_slot | dcp_key_slot_t |
typedef enum utils::_dcp_swap | dcp_swap_t |
typedef enum utils::_dcp_hash_algo_t | dcp_hash_algo_t |
typedef struct utils::_dcp_hash_ctx_t | dcp_hash_ctx_t |
typedef union utils::_dcp_hash_block | dcp_hash_block_t |
typedef enum utils::_dcp_hash_algo_state | dcp_hash_algo_state_t |
typedef struct utils::_dcp_handle | dcp_handle_t |
typedef struct utils::_dcp_hash_ctx_internal | dcp_hash_ctx_internal_t |
typedef struct utils::_dcp_work_packet | dcp_work_packet_t |
Functions | |
void | check_and_log_crash () |
Logs out what has been captured by the Teensy CrashReport tooling, cf. | |
static FLASHMEM void | dcp_reverse_and_copy (uint8_t *src, uint8_t *dest, size_t src_len) |
static FLASHMEM uint32_t | dcp_get_channel_status (dcp_channel_t channel) |
static FLASHMEM void | dcp_clear_status () |
static FLASHMEM void | dcp_clear_channel_status (uint32_t mask) |
uint32_t | DCP_WaitForChannelComplete (dcp_handle_t *handle) |
static FLASHMEM uint32_t | dcp_schedule_work (dcp_handle_t *handle, dcp_work_packet_t *dcpPacket) |
static FLASHMEM uint32_t | dcp_hash_update_non_blocking (dcp_hash_ctx_internal_t *ctxInternal, dcp_work_packet_t *dcpPacket, const uint8_t *msg, size_t size) |
void | dcp_hash_update (dcp_hash_ctx_internal_t *ctxInternal, const uint8_t *msg, size_t size) |
FLASHMEM void | dcp_hash_process_message_data (dcp_hash_ctx_internal_t *ctxInternal, const uint8_t *message, size_t messageSize) |
FLASHMEM void | DCP_HASH_Init (dcp_handle_t *handle, dcp_hash_ctx_t *ctx, dcp_hash_algo_t algo) |
FLASHMEM void | DCP_HASH_Update (dcp_hash_ctx_t *ctx, const uint8_t *input, size_t inputSize) |
FLASHMEM void | DCP_HASH_Finish (dcp_hash_ctx_t *ctx, uint8_t *output) |
FLASHMEM void | dcp_init () |
FLASHMEM void | prhash (unsigned char *h, int n) |
FLASHMEM void | demo_sha256 () |
FLASHMEM void | demo_crc32 () |
FLASHMEM void | hash (const uint8_t *msg, size_t msg_len, uint8_t *out_hash, dcp_hash_algo_t algo) |
FLASHMEM void | hash_sha256 (const uint8_t *msg, size_t msg_len, uint8_t *out_hash) |
Computes the SHA256 sum of an arbitrary message (large memory segment). | |
FLASHMEM void | hash_sha1 (const uint8_t *msg, size_t msg_len, uint8_t *out_hash) |
uint32_t | rotr (uint32_t x, uint32_t n) |
uint32_t | ch (uint32_t x, uint32_t y, uint32_t z) |
uint32_t | maj (uint32_t x, uint32_t y, uint32_t z) |
uint32_t | sigma0 (uint32_t x) |
uint32_t | sigma1 (uint32_t x) |
Variables | |
constexpr std::array< uint32_t, 64 > | K |
constexpr std::array< uint32_t, 4 > | H1 = {0x67452301, 0xEFCDAB89, 0x98BADCFE, 0x10325476} |
Typedef Documentation
◆ _dcp_ch_enable_t
typedef enum utils::_dcp_ch_enable utils::_dcp_ch_enable_t |
◆ dcp_channel_t
typedef enum utils::_dcp_channel utils::dcp_channel_t |
◆ dcp_handle_t
typedef struct utils::_dcp_handle utils::dcp_handle_t |
◆ dcp_hash_algo_state_t
typedef enum utils::_dcp_hash_algo_state utils::dcp_hash_algo_state_t |
◆ dcp_hash_algo_t
typedef enum utils::_dcp_hash_algo_t utils::dcp_hash_algo_t |
◆ dcp_hash_block_t
typedef union utils::_dcp_hash_block utils::dcp_hash_block_t |
◆ dcp_hash_ctx_internal_t
typedef struct utils::_dcp_hash_ctx_internal utils::dcp_hash_ctx_internal_t |
◆ dcp_hash_ctx_t
typedef struct utils::_dcp_hash_ctx_t utils::dcp_hash_ctx_t |
◆ dcp_key_slot_t
typedef enum utils::_dcp_key_slot utils::dcp_key_slot_t |
◆ dcp_swap_t
typedef enum utils::_dcp_swap utils::dcp_swap_t |
◆ dcp_work_packet_t
typedef struct utils::_dcp_work_packet utils::dcp_work_packet_t |
Enumeration Type Documentation
◆ _dcp_ch_enable
◆ _dcp_channel
enum utils::_dcp_channel |
◆ _dcp_hash_algo_state
◆ _dcp_hash_algo_t
◆ _dcp_hash_digest_len
◆ _dcp_key_slot
enum utils::_dcp_key_slot |
◆ _dcp_swap
enum utils::_dcp_swap |
◆ _dcp_work_packet_bit_definitions
◆ _generic_status
Function Documentation
◆ ch()
◆ check_and_log_crash()
void utils::check_and_log_crash | ( | ) |
Logs out what has been captured by the Teensy CrashReport tooling, cf.
https://www.pjrc.com/teensy/td_crashreport.html
This can help to debug faults generated by the memory protection unit (MPU) such as null pointer references or other pointer arithmetics gone bad. In order to have this work, the microcontroller needs to do a "soft-reboot" which preserves the RAM content so the "post-mortem report" is available.
In order to understand the error codes, have a loook at the IMXRT1060 processor architecture manual, for instance at https://www.pjrc.com/teensy/DDI0403Ee_arm_v7m_ref_manual.pdf at page 611
Definition at line 23 of file crash_report.cpp.
Referenced by setup().
◆ dcp_clear_channel_status()
|
static |
Definition at line 294 of file dcp.cpp.
References DCP, kDCP_Channel0, kDCP_Channel1, kDCP_Channel2, kDCP_Channel3, and uint32_t.
Referenced by dcp_init(), and DCP_WaitForChannelComplete().
◆ dcp_clear_status()
|
static |
Definition at line 289 of file dcp.cpp.
References DCP, utils::DCP_Type::STAT, and uint32_t.
Referenced by dcp_init(), and DCP_WaitForChannelComplete().
◆ dcp_get_channel_status()
|
static |
Definition at line 252 of file dcp.cpp.
References DCP, DCP_CH0SEMA_VALUE_MASK, DCP_CH0STAT_ERROR_CODE_MASK, kDCP_Channel0, kDCP_Channel1, kDCP_Channel2, kDCP_Channel3, kStatus_Fail, kStatus_Success, and uint32_t.
Referenced by DCP_WaitForChannelComplete().
◆ DCP_HASH_Finish()
FLASHMEM void utils::DCP_HASH_Finish | ( | dcp_hash_ctx_t * | ctx, |
uint8_t * | output ) |
Definition at line 492 of file dcp.cpp.
References utils::_dcp_hash_ctx_internal::algo, utils::_dcp_hash_block::b, utils::_dcp_hash_ctx_internal::blk, utils::_dcp_hash_ctx_internal::blksz, utils::_dcp_hash_ctx_internal::ctrl0, dcp_hash_update(), dcp_reverse_and_copy(), kDCP_CONTROL0_HASH_INIT, kDCP_CONTROL0_HASH_TERM, kDCP_Crc32, kDCP_OutLenCrc32, kDCP_OutLenSha1, kDCP_OutLenSha256, kDCP_Sha1, kDCP_Sha256, kDCP_StateHashInit, utils::_dcp_hash_ctx_internal::runningHash, and utils::_dcp_hash_ctx_internal::state.
Referenced by demo_crc32(), demo_sha256(), and hash().
◆ DCP_HASH_Init()
FLASHMEM void utils::DCP_HASH_Init | ( | dcp_handle_t * | handle, |
dcp_hash_ctx_t * | ctx, | ||
dcp_hash_algo_t | algo ) |
Definition at line 451 of file dcp.cpp.
References utils::_dcp_hash_ctx_internal::algo, utils::_dcp_hash_ctx_internal::blk, utils::_dcp_hash_ctx_internal::blksz, utils::_dcp_hash_ctx_internal::fullMessageSize, utils::_dcp_hash_ctx_internal::handle, kDCP_StateHashInit, utils::_dcp_hash_ctx_internal::state, and utils::_dcp_hash_block::w.
Referenced by demo_crc32(), demo_sha256(), and hash().
◆ dcp_hash_process_message_data()
FLASHMEM void utils::dcp_hash_process_message_data | ( | dcp_hash_ctx_internal_t * | ctxInternal, |
const uint8_t * | message, | ||
size_t | messageSize ) |
Definition at line 425 of file dcp.cpp.
References utils::_dcp_hash_block::b, utils::_dcp_hash_ctx_internal::blk, utils::_dcp_hash_ctx_internal::blksz, DCP_HASH_BLOCK_SIZE, dcp_hash_update(), and uint32_t.
Referenced by DCP_HASH_Update().
◆ DCP_HASH_Update()
FLASHMEM void utils::DCP_HASH_Update | ( | dcp_hash_ctx_t * | ctx, |
const uint8_t * | input, | ||
size_t | inputSize ) |
Definition at line 464 of file dcp.cpp.
References utils::_dcp_hash_block::b, utils::_dcp_hash_ctx_internal::blk, utils::_dcp_hash_ctx_internal::blksz, utils::_dcp_hash_ctx_internal::ctrl0, DCP_HASH_BLOCK_SIZE, dcp_hash_process_message_data(), utils::_dcp_hash_ctx_internal::fullMessageSize, kDCP_CONTROL0_HASH_INIT, kDCP_StateHashUpdate, and utils::_dcp_hash_ctx_internal::state.
Referenced by demo_crc32(), demo_sha256(), and hash().
◆ dcp_hash_update()
void utils::dcp_hash_update | ( | dcp_hash_ctx_internal_t * | ctxInternal, |
const uint8_t * | msg, | ||
size_t | size ) |
Definition at line 411 of file dcp.cpp.
References utils::_dcp_hash_ctx_internal::ctrl0, dcp_hash_update_non_blocking(), DCP_WaitForChannelComplete(), utils::_dcp_hash_ctx_internal::handle, kStatus_DCP_Again, size, and uint32_t.
Referenced by DCP_HASH_Finish(), and dcp_hash_process_message_data().
◆ dcp_hash_update_non_blocking()
|
static |
Definition at line 389 of file dcp.cpp.
References utils::_dcp_hash_ctx_internal::algo, utils::_dcp_work_packet::bufferSize, utils::_dcp_work_packet::control0, utils::_dcp_work_packet::control1, utils::_dcp_hash_ctx_internal::ctrl0, dcp_schedule_work(), utils::_dcp_work_packet::destinationBufferAddress, utils::_dcp_hash_ctx_internal::handle, kDCP_CONTROL0_DECR_SEMAPHOR, kDCP_CONTROL0_ENABLE_HASH, kDCP_CONTROL1_HASH_SELECT_CRC32, kDCP_CONTROL1_HASH_SELECT_SHA1, kDCP_CONTROL1_HASH_SELECT_SHA256, kDCP_Crc32, kDCP_Sha1, kDCP_Sha256, utils::_dcp_work_packet::payloadPointer, utils::_dcp_hash_ctx_internal::runningHash, size, utils::_dcp_work_packet::sourceBufferAddress, utils::_dcp_handle::swapConfig, and uint32_t.
Referenced by dcp_hash_update().
◆ dcp_init()
FLASHMEM void utils::dcp_init | ( | ) |
Definition at line 534 of file dcp.cpp.
References DCP, dcp_clear_channel_status(), dcp_clear_status(), kDCP_ch0Enable, kDCP_Channel0, kDCP_Channel1, kDCP_Channel2, and kDCP_Channel3.
Referenced by hash().
◆ dcp_reverse_and_copy()
|
static |
◆ dcp_schedule_work()
|
static |
Definition at line 329 of file dcp.cpp.
References utils::_dcp_handle::channel, DCP, kDCP_Channel0, kDCP_Channel1, kDCP_Channel2, kDCP_Channel3, kStatus_DCP_Again, kStatus_Success, and uint32_t.
Referenced by dcp_hash_update_non_blocking().
◆ DCP_WaitForChannelComplete()
uint32_t utils::DCP_WaitForChannelComplete | ( | dcp_handle_t * | handle | ) |
Definition at line 315 of file dcp.cpp.
References utils::_dcp_handle::channel, DCP, dcp_clear_channel_status(), dcp_clear_status(), dcp_get_channel_status(), kStatus_Fail, kStatus_Success, and uint32_t.
Referenced by dcp_hash_update().
◆ demo_crc32()
FLASHMEM void utils::demo_crc32 | ( | ) |
Definition at line 584 of file dcp.cpp.
References utils::_dcp_handle::channel, DCP_HASH_Finish(), DCP_HASH_Init(), DCP_HASH_Update(), hash(), kDCP_Channel0, kDCP_Crc32, kDCP_KeySlot0, kDCP_NoSwap, utils::_dcp_handle::keySlot, prhash(), utils::_dcp_handle::swapConfig, and uint32_t.
◆ demo_sha256()
FLASHMEM void utils::demo_sha256 | ( | ) |
Definition at line 560 of file dcp.cpp.
References utils::_dcp_handle::channel, DCP_HASH_Finish(), DCP_HASH_Init(), DCP_HASH_Update(), hash(), kDCP_Channel0, kDCP_KeySlot0, kDCP_NoSwap, kDCP_Sha256, utils::_dcp_handle::keySlot, prhash(), utils::_dcp_handle::swapConfig, and uint32_t.
◆ hash()
FLASHMEM void utils::hash | ( | const uint8_t * | msg, |
size_t | msg_len, | ||
uint8_t * | out_hash, | ||
dcp_hash_algo_t | algo ) |
Definition at line 610 of file dcp.cpp.
References utils::_dcp_handle::channel, DCP_HASH_Finish(), DCP_HASH_Init(), DCP_HASH_Update(), dcp_init(), kDCP_Channel0, kDCP_KeySlot0, kDCP_NoSwap, utils::_dcp_handle::keySlot, and utils::_dcp_handle::swapConfig.
Referenced by demo_crc32(), demo_sha256(), hash_sha1(), and hash_sha256().
◆ hash_sha1()
void utils::hash_sha1 | ( | const uint8_t * | msg, |
size_t | msg_len, | ||
uint8_t * | out_hash ) |
◆ hash_sha256()
void utils::hash_sha256 | ( | const uint8_t * | msg, |
size_t | msg_len, | ||
uint8_t * | out_hash ) |
Computes the SHA256 sum of an arbitrary message (large memory segment).
Outputs an uint8_t[32]. Use for instance prhash(out_hash, 32) for a string representation.
Definition at line 630 of file dcp.cpp.
References hash(), and kDCP_Sha256.
◆ maj()
◆ prhash()
FLASHMEM void utils::prhash | ( | unsigned char * | h, |
int | n ) |
Definition at line 549 of file dcp.cpp.
Referenced by demo_crc32(), and demo_sha256().
◆ rotr()
◆ sigma0()
◆ sigma1()
Variable Documentation
◆ H1
|
constexpr |
◆ K
|
constexpr |