runtime: support configurations without moninj, log or dds

This commit is contained in:
Sebastien Bourdeauducq 2016-11-06 23:52:27 +08:00
parent 7dcc987dd7
commit 453e8b7eb3
3 changed files with 9 additions and 2 deletions

View File

@ -105,13 +105,16 @@ static mut API: &'static [(&'static str, *const ())] = &[
api!(rtio_input_timestamp), api!(rtio_input_timestamp),
api!(rtio_input_data), api!(rtio_input_data),
// #if ((defined CONFIG_RTIO_DDS_COUNT) && (CONFIG_RTIO_DDS_COUNT > 0)) #[cfg(rtio_dds_count)]
api!(dds_init), api!(dds_init),
#[cfg(rtio_dds_count)]
api!(dds_init_sync), api!(dds_init_sync),
#[cfg(rtio_dds_count)]
api!(dds_batch_enter), api!(dds_batch_enter),
#[cfg(rtio_dds_count)]
api!(dds_batch_exit), api!(dds_batch_exit),
#[cfg(rtio_dds_count)]
api!(dds_set), api!(dds_set),
// #endif
api!(i2c_init), api!(i2c_init),
api!(i2c_start), api!(i2c_start),

View File

@ -75,6 +75,7 @@ mod rpc_proto;
mod kernel; mod kernel;
mod session; mod session;
#[cfg(has_rtio_moninj)]
mod moninj; mod moninj;
#[cfg(has_rtio_analyzer)] #[cfg(has_rtio_analyzer)]
mod analyzer; mod analyzer;
@ -109,6 +110,7 @@ pub unsafe extern fn rust_main() {
let mut scheduler = sched::Scheduler::new(); let mut scheduler = sched::Scheduler::new();
scheduler.spawner().spawn(16384, session::thread); scheduler.spawner().spawn(16384, session::thread);
#[cfg(has_rtio_moninj)]
scheduler.spawner().spawn(4096, moninj::thread); scheduler.spawner().spawn(4096, moninj::thread);
#[cfg(has_rtio_analyzer)] #[cfg(has_rtio_analyzer)]
scheduler.spawner().spawn(4096, analyzer::thread); scheduler.spawner().spawn(4096, analyzer::thread);

View File

@ -124,6 +124,7 @@ unsigned int rtio_input_data(int channel)
void rtio_log_va(long long int timestamp, const char *fmt, va_list args) void rtio_log_va(long long int timestamp, const char *fmt, va_list args)
{ {
#ifdef CONFIG_RTIO_LOG_CHANNEL
// This executes on the kernel CPU's stack, which is specifically designed // This executes on the kernel CPU's stack, which is specifically designed
// for allocation of this kind of massive buffers. // for allocation of this kind of massive buffers.
int len = vsnprintf(NULL, 0, fmt, args); int len = vsnprintf(NULL, 0, fmt, args);
@ -152,6 +153,7 @@ void rtio_log_va(long long int timestamp, const char *fmt, va_list args)
i = 0; i = 0;
} }
} }
#endif
} }
void rtio_log(long long int timestamp, const char *fmt, ...) void rtio_log(long long int timestamp, const char *fmt, ...)