Commit ef95d642 authored by Federico Vaga's avatar Federico Vaga

sw:fw: move message print func to lib

There is not a true reason to have them in the framework. It can be
useful with just the library as well
Signed-off-by: Federico Vaga's avatarFederico Vaga <federico.vaga@cern.ch>
parent 0ac5af8c
......@@ -460,59 +460,6 @@ int trtl_fw_mq_send_buf(enum trtl_mq_type type,
}
/**
* It prints on the serial interface the given message header
* @param[in] h message header to print
*/
void trtl_fw_print_header(struct trtl_hmq_header *h)
{
if (!HAS_MOCKTURTLE_FRAMEWORK_DEBUG_ENABLE) {
return;
}
pr_debug("\tapp_id 0x%04"PRIx16" | flags 0x%02"PRIx8" | msg_id 0x%02"PRIx8"\r\n",
h->rt_app_id, h->flags, h->msg_id);
delay(1000);
pr_debug("\tlen 0x%04"PRIx16" | sync_id 0x%04"PRIx16"\r\n",
h->len, h->sync_id);
delay(1000);
pr_debug("\tseq 0x%08"PRIx32"\r\n",
h->seq);
delay(1000);
}
/**
* It prints on the serial interface a buffer
* @param[in] d buffer data
* @param[in] count number of 32bit words to show
*/
void trtl_fw_print_data(uint32_t *d, unsigned int count)
{
int i;
if (!HAS_MOCKTURTLE_FRAMEWORK_DEBUG_ENABLE) {
return;
}
for (i = 0; i < count; i++) {
pr_debug("%s: data[%d] = 0x%"PRIx32"\n\r", __func__, i , d[i]);
delay(1000);
}
}
/**
* It prints on the serial console the given message
* @param[in] msg a mock turtle message
*/
void trtl_fw_print_message(struct trtl_fw_msg *msg)
{
pr_debug("Message\n\r");
trtl_fw_print_header(msg->header);
trtl_fw_print_data(msg->payload, msg->header->len);
}
/**
* It get the current time from the internal WRNC timer
* @param[out] seconds
......
......@@ -112,9 +112,6 @@ static inline struct trtl_fw_application *trtl_fw_application_get(void)
extern void trtl_fw_time(uint32_t *seconds, uint32_t *cycles);
extern void trtl_fw_print_header(struct trtl_hmq_header *h);
extern void trtl_fw_print_data(uint32_t *d, unsigned int count);
extern void trtl_fw_print_message(struct trtl_fw_msg *msg);
extern int trtl_fw_mq_send_uint32(enum trtl_mq_type type,
unsigned int idx_mq,
uint8_t msg_id,
......
......@@ -45,3 +45,49 @@ int puts(const char *p)
return p - p_orig;
}
/**
* It prints on the serial interface the given message header
* @param[in] h message header to print
*/
void trtl_fw_print_header(struct trtl_hmq_header *h)
{
pr_debug("\tapp_id 0x%04"PRIx16" | flags 0x%02"PRIx8" | msg_id 0x%02"PRIx8"\r\n",
h->rt_app_id, h->flags, h->msg_id);
delay(1000);
pr_debug("\tlen 0x%04"PRIx16" | sync_id 0x%04"PRIx16"\r\n",
h->len, h->sync_id);
delay(1000);
pr_debug("\tseq 0x%08"PRIx32"\r\n",
h->seq);
delay(1000);
}
/**
* It prints on the serial interface a buffer
* @param[in] d buffer data
* @param[in] count number of 32bit words to show
*/
void trtl_fw_print_data(uint32_t *d, unsigned int count)
{
int i;
for (i = 0; i < count; i++) {
pr_debug("%s: data[%d] = 0x%"PRIx32"\n\r", __func__, i , d[i]);
delay(1000);
}
}
/**
* It prints on the serial console the given message
* @param[in] msg a mock turtle message
*/
void trtl_fw_print_message(struct trtl_fw_msg *msg)
{
pr_debug("Message\n\r");
trtl_fw_print_header(msg->header);
trtl_fw_print_data(msg->payload, msg->header->len);
}
......@@ -788,5 +788,9 @@ static inline int smem_atomic_test_and_set(int *p)
return *(volatile int *)(p + (TRTL_SMEM_TYPE_TST_SET >> 2));
}
extern void trtl_fw_print_header(struct trtl_hmq_header *h);
extern void trtl_fw_print_data(uint32_t *d, unsigned int count);
extern void trtl_fw_print_message(struct trtl_fw_msg *msg);
#endif
/**@}*/
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment