runtime: support for RTIO logging

This commit is contained in:
Sebastien Bourdeauducq 2015-12-26 22:44:50 +08:00
parent ba6c527819
commit 50a463a6fd
4 changed files with 38 additions and 4 deletions

View File

@ -71,7 +71,7 @@ void analyzer_start(void)
analyzer_header.sent_bytes = analyzer_header.total_byte_count; analyzer_header.sent_bytes = analyzer_header.total_byte_count;
analyzer_header.overflow_occured = rtio_analyzer_message_encoder_overflow_read(); analyzer_header.overflow_occured = rtio_analyzer_message_encoder_overflow_read();
analyzer_header.log_channel = 0; analyzer_header.log_channel = CONFIG_RTIO_LOG_CHANNEL;
analyzer_header.dds_channel = CONFIG_RTIO_DDS_CHANNEL; analyzer_header.dds_channel = CONFIG_RTIO_DDS_CHANNEL;
#ifdef DDS_ONEHOT_SEL #ifdef DDS_ONEHOT_SEL
analyzer_header.dds_onehot_sel = 1; analyzer_header.dds_onehot_sel = 1;

View File

@ -107,6 +107,7 @@ static const struct symbol runtime_exports[] = {
/* direct syscalls */ /* direct syscalls */
{"rtio_get_counter", &rtio_get_counter}, {"rtio_get_counter", &rtio_get_counter},
{"rtio_log", &rtio_log},
{"ttl_set_o", &ttl_set_o}, {"ttl_set_o", &ttl_set_o},
{"ttl_set_oe", &ttl_set_oe}, {"ttl_set_oe", &ttl_set_oe},
@ -167,13 +168,15 @@ int fprintf(FILE *stream, const char *fmt, ...)
} }
/* called by libunwind */ /* called by libunwind */
int dladdr (const void *address, Dl_info *info) { int dladdr (const void *address, Dl_info *info)
{
/* we don't try to resolve names */ /* we don't try to resolve names */
return 0; return 0;
} }
/* called by libunwind */ /* called by libunwind */
int dl_iterate_phdr (int (*callback) (struct dl_phdr_info *, size_t, void *), void *data) { int dl_iterate_phdr (int (*callback)(struct dl_phdr_info *, size_t, void *), void *data)
{
Elf32_Ehdr *ehdr; Elf32_Ehdr *ehdr;
struct dl_phdr_info phdr_info; struct dl_phdr_info phdr_info;
int retval; int retval;
@ -200,7 +203,8 @@ int dl_iterate_phdr (int (*callback) (struct dl_phdr_info *, size_t, void *), vo
return retval; return retval;
} }
static Elf32_Addr resolve_runtime_export(const char *name) { static Elf32_Addr resolve_runtime_export(const char *name)
{
const struct symbol *sym = runtime_exports; const struct symbol *sym = runtime_exports;
while(sym->name) { while(sym->name) {
if(!strcmp(sym->name, name)) if(!strcmp(sym->name, name))

View File

@ -38,3 +38,32 @@ void rtio_process_exceptional_status(int status, long long int timestamp, int ch
timestamp, channel, 0); timestamp, channel, 0);
} }
} }
void rtio_log(long long int timestamp, char *message)
{
unsigned int word;
int i;
rtio_chan_sel_write(CONFIG_RTIO_LOG_CHANNEL);
rtio_o_timestamp_write(timestamp);
i = 0;
word = 0;
while(1) {
word >>= 8;
word |= *message << 24;
if(*message == 0) {
rtio_o_data_write(word);
rtio_o_we_write(1);
break;
}
message++;
i++;
if(i == 4) {
rtio_o_data_write(word);
rtio_o_we_write(1);
word = 0;
i = 0;
}
}
}

View File

@ -14,6 +14,7 @@
void rtio_init(void); void rtio_init(void);
long long int rtio_get_counter(void); long long int rtio_get_counter(void);
void rtio_process_exceptional_status(int status, long long int timestamp, int channel); void rtio_process_exceptional_status(int status, long long int timestamp, int channel);
void rtio_log(long long int timestamp, char *message);
static inline void rtio_write_and_process_status(long long int timestamp, int channel) static inline void rtio_write_and_process_status(long long int timestamp, int channel)
{ {