Skip to content

Commit

Permalink
Error message code in src. Message improved.
Browse files Browse the repository at this point in the history
  • Loading branch information
dkfellows committed Jan 31, 2020
1 parent aff435b commit 289d9c9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
9 changes: 7 additions & 2 deletions c_common/front_end_common_lib/include/recording.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,12 @@ static inline bool recording_record(
return recording_do_record_and_notify(channel, data, size_bytes, NULL);
}

//! \brief Prints an error about DMA API abuse and RTEs.
//! \param[in] data the pointer to the data.
//! \param[in] size the number of bytes in the data.
__attribute__((noreturn)) void recording_bad_offset(
void *data, uint32_t size);

//! \brief records some data into a specific recording channel, calling a
//! callback function once complete
//! \param[in] channel the channel to store the data into.
Expand All @@ -108,8 +114,7 @@ static inline bool recording_record_and_notify(
uint8_t channel, void *data, uint32_t size_bytes,
recording_complete_callback_t callback) {
if ((size_bytes & 3 || ((uint32_t) data) & 3) && callback != NULL) {
io_printf(IO_BUF, "ERROR: DMA transfer of non-word data quantity!");
rt_error(RTE_SWERR);
recording_bad_offset(data, size_bytes);
}
return recording_do_record_and_notify(channel, data, size_bytes, callback);
}
Expand Down
7 changes: 7 additions & 0 deletions c_common/front_end_common_lib/src/recording.c
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,13 @@ bool recording_do_record_and_notify(
return false;
}

__attribute__((noreturn)) void recording_bad_offset(
void *data, uint32_t size) {
log_error("DMA transfer of non-word data quantity in recording! "
"(data=0x%08x, size=0x%x)", data, size);
rt_error(RTE_SWERR);
}

//! \brief this writes the state data to the regions
static void recording_buffer_state_data_write(void) {
for (uint32_t recording_region_id = 0;
Expand Down

0 comments on commit 289d9c9

Please sign in to comment.