AVR: Fix compilation errors for ICU testhal program.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@10821 35acf78f-673a-0410-8e92-d51de3d6d3f4
This commit is contained in:
parent
41641dc844
commit
f96e940380
|
@ -28,6 +28,9 @@
|
||||||
#ifndef CHCONF_H
|
#ifndef CHCONF_H
|
||||||
#define CHCONF_H
|
#define CHCONF_H
|
||||||
|
|
||||||
|
#define _CHIBIOS_RT_CONF_
|
||||||
|
#define _CHIBIOS_RT_CONF_VER_5_0_
|
||||||
|
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
/**
|
/**
|
||||||
* @name System timers settings
|
* @name System timers settings
|
||||||
|
@ -46,7 +49,7 @@
|
||||||
* @details Frequency of the system timer that drives the system ticks. This
|
* @details Frequency of the system timer that drives the system ticks. This
|
||||||
* setting also defines the system tick time unit.
|
* setting also defines the system tick time unit.
|
||||||
*/
|
*/
|
||||||
#define CH_CFG_ST_FREQUENCY 1000
|
#define CH_CFG_ST_FREQUENCY 15624
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Time delta constant for the tick-less mode.
|
* @brief Time delta constant for the tick-less mode.
|
||||||
|
@ -56,7 +59,7 @@
|
||||||
* The value one is not valid, timeouts are rounded up to
|
* The value one is not valid, timeouts are rounded up to
|
||||||
* this value.
|
* this value.
|
||||||
*/
|
*/
|
||||||
#define CH_CFG_ST_TIMEDELTA 0
|
#define CH_CFG_ST_TIMEDELTA 2
|
||||||
|
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
|
@ -78,7 +81,7 @@
|
||||||
* @note Disabling the round robin preemption makes the kernel more compact
|
* @note Disabling the round robin preemption makes the kernel more compact
|
||||||
* and generally faster.
|
* and generally faster.
|
||||||
*/
|
*/
|
||||||
#define CH_CFG_TIME_QUANTUM 20
|
#define CH_CFG_TIME_QUANTUM 0
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Managed RAM size.
|
* @brief Managed RAM size.
|
||||||
|
@ -180,16 +183,6 @@
|
||||||
*/
|
*/
|
||||||
#define CH_CFG_USE_SEMAPHORES_PRIORITY FALSE
|
#define CH_CFG_USE_SEMAPHORES_PRIORITY FALSE
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Atomic semaphore API.
|
|
||||||
* @details If enabled then the semaphores the @p chSemSignalWait() API
|
|
||||||
* is included in the kernel.
|
|
||||||
*
|
|
||||||
* @note The default is @p TRUE.
|
|
||||||
* @note Requires @p CH_CFG_USE_SEMAPHORES.
|
|
||||||
*/
|
|
||||||
#define CH_USE_SEMSW TRUE
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Mutexes APIs.
|
* @brief Mutexes APIs.
|
||||||
* @details If enabled then the mutexes APIs are included in the kernel.
|
* @details If enabled then the mutexes APIs are included in the kernel.
|
||||||
|
@ -296,18 +289,6 @@
|
||||||
*/
|
*/
|
||||||
#define CH_CFG_USE_HEAP TRUE
|
#define CH_CFG_USE_HEAP TRUE
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief C-runtime allocator.
|
|
||||||
* @details If enabled the the heap allocator APIs just wrap the C-runtime
|
|
||||||
* @p malloc() and @p free() functions.
|
|
||||||
*
|
|
||||||
* @note The default is @p FALSE.
|
|
||||||
* @note Requires @p CH_CFG_USE_HEAP.
|
|
||||||
* @note The C-runtime may or may not require @p CH_CFG_USE_MEMCORE, see the
|
|
||||||
* appropriate documentation.
|
|
||||||
*/
|
|
||||||
#define CH_CFG_USE_MALLOC_HEAP TRUE
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Memory Pools Allocator APIs.
|
* @brief Memory Pools Allocator APIs.
|
||||||
* @details If enabled then the memory pools allocator APIs are included
|
* @details If enabled then the memory pools allocator APIs are included
|
||||||
|
@ -437,7 +418,14 @@
|
||||||
*
|
*
|
||||||
* @note The default is @p FALSE.
|
* @note The default is @p FALSE.
|
||||||
*/
|
*/
|
||||||
#define CH_DBG_ENABLE_TRACE FALSE
|
#define CH_DBG_ENABLE_TRACE CH_DBG_TRACE_MASK_DISABLED
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Trace buffer entries.
|
||||||
|
* @note The trace buffer is only allocated if @p CH_DBG_TRACE_MASK is
|
||||||
|
* different from @p CH_DBG_TRACE_MASK_DISABLED.
|
||||||
|
*/
|
||||||
|
#define CH_DBG_TRACE_BUFFER_SIZE 128
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Debug option, stack checks.
|
* @brief Debug option, stack checks.
|
||||||
|
@ -483,9 +471,9 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Threads descriptor structure extension.
|
* @brief Threads descriptor structure extension.
|
||||||
* @details User fields added to the end of the @p Thread structure.
|
* @details User fields added to the end of the @p thread_t structure.
|
||||||
*/
|
*/
|
||||||
#define THREAD_EXT_FIELDS \
|
#define CH_CFG_THREAD_EXTRA_FIELDS \
|
||||||
/* Add threads custom fields here.*/
|
/* Add threads custom fields here.*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -495,19 +483,15 @@
|
||||||
* @note It is invoked from within @p chThdInit() and implicitly from all
|
* @note It is invoked from within @p chThdInit() and implicitly from all
|
||||||
* the threads creation APIs.
|
* the threads creation APIs.
|
||||||
*/
|
*/
|
||||||
#define THREAD_EXT_INIT_HOOK(tp) { \
|
#define CH_CFG_THREAD_INIT_HOOK(tp) { \
|
||||||
/* Add threads initialization code here.*/ \
|
/* Add threads initialization code here.*/ \
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Threads finalization hook.
|
* @brief Threads finalization hook.
|
||||||
* @details User finalization code added to the @p chThdExit() API.
|
* @details User finalization code added to the @p chThdExit() API.
|
||||||
*
|
|
||||||
* @note It is inserted into lock zone.
|
|
||||||
* @note It is also invoked when the threads simply return in order to
|
|
||||||
* terminate.
|
|
||||||
*/
|
*/
|
||||||
#define THREAD_EXT_EXIT_HOOK(tp) { \
|
#define CH_CFG_THREAD_EXIT_HOOK(tp) { \
|
||||||
/* Add threads finalization code here.*/ \
|
/* Add threads finalization code here.*/ \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -519,6 +503,40 @@
|
||||||
/* Context switch code here.*/ \
|
/* Context switch code here.*/ \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief ISR enter hook.
|
||||||
|
*/
|
||||||
|
#define CH_CFG_IRQ_PROLOGUE_HOOK() { \
|
||||||
|
/* IRQ prologue code here.*/ \
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief ISR exit hook.
|
||||||
|
*/
|
||||||
|
#define CH_CFG_IRQ_EPILOGUE_HOOK() { \
|
||||||
|
/* IRQ epilogue code here.*/ \
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Idle thread enter hook.
|
||||||
|
* @note This hook is invoked within a critical zone, no OS functions
|
||||||
|
* should be invoked from here.
|
||||||
|
* @note This macro can be used to activate a power saving mode.
|
||||||
|
*/
|
||||||
|
#define CH_CFG_IDLE_ENTER_HOOK() { \
|
||||||
|
/* Idle-enter code here.*/ \
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Idle thread leave hook.
|
||||||
|
* @note This hook is invoked within a critical zone, no OS functions
|
||||||
|
* should be invoked from here.
|
||||||
|
* @note This macro can be used to deactivate a power saving mode.
|
||||||
|
*/
|
||||||
|
#define CH_CFG_IDLE_LEAVE_HOOK() { \
|
||||||
|
/* Idle-leave code here.*/ \
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Idle Loop hook.
|
* @brief Idle Loop hook.
|
||||||
* @details This hook is continuously invoked by the idle thread loop.
|
* @details This hook is continuously invoked by the idle thread loop.
|
||||||
|
@ -532,7 +550,7 @@
|
||||||
* @details This hook is invoked in the system tick handler immediately
|
* @details This hook is invoked in the system tick handler immediately
|
||||||
* after processing the virtual timers queue.
|
* after processing the virtual timers queue.
|
||||||
*/
|
*/
|
||||||
#define SYSTEM_TICK_EVENT_HOOK() { \
|
#define CH_CFG_SYSTEM_TICK_HOOK() { \
|
||||||
/* System tick event code here.*/ \
|
/* System tick event code here.*/ \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -541,10 +559,19 @@
|
||||||
* @details This hook is invoked in case to a system halting error before
|
* @details This hook is invoked in case to a system halting error before
|
||||||
* the system is halted.
|
* the system is halted.
|
||||||
*/
|
*/
|
||||||
#define SYSTEM_HALT_HOOK() { \
|
#define CH_CFG_SYSTEM_HALT_HOOK(reason) { \
|
||||||
/* System halt code here.*/ \
|
/* System halt code here.*/ \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Trace hook.
|
||||||
|
* @details This hook is invoked each time a new record is written in the
|
||||||
|
* trace buffer.
|
||||||
|
*/
|
||||||
|
#define CH_CFG_TRACE_HOOK(tep) { \
|
||||||
|
/* Trace code here.*/ \
|
||||||
|
}
|
||||||
|
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
|
|
|
@ -57,7 +57,7 @@ void output_single_cycle(const uint16_t low, const uint16_t high) {
|
||||||
palClearPad(IOPORT4, 4);
|
palClearPad(IOPORT4, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
static WORKING_AREA(waThread1, 64);
|
static THD_WORKING_AREA(waThread1, 64);
|
||||||
static THD_FUNCTION(Thread1, arg) {
|
static THD_FUNCTION(Thread1, arg) {
|
||||||
|
|
||||||
BaseSequentialStream *serp = (BaseSequentialStream *) &SD1;
|
BaseSequentialStream *serp = (BaseSequentialStream *) &SD1;
|
||||||
|
@ -73,7 +73,7 @@ static THD_FUNCTION(Thread1, arg) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static WORKING_AREA(waThread2, 64);
|
static THD_WORKING_AREA(waThread2, 64);
|
||||||
static THD_FUNCTION(Thread2, arg) {
|
static THD_FUNCTION(Thread2, arg) {
|
||||||
|
|
||||||
BaseSequentialStream *serp = (BaseSequentialStream *) &SD1;
|
BaseSequentialStream *serp = (BaseSequentialStream *) &SD1;
|
||||||
|
@ -115,26 +115,26 @@ int main(void) {
|
||||||
BaseSequentialStream *serp = (BaseSequentialStream *) &SD1;
|
BaseSequentialStream *serp = (BaseSequentialStream *) &SD1;
|
||||||
|
|
||||||
chprintf(serp, "Testing 50 duty cycle\r\n");
|
chprintf(serp, "Testing 50 duty cycle\r\n");
|
||||||
icuEnable(&ICUD3);
|
icuStartCapture(&ICUD3);
|
||||||
output_single_cycle(500, 500);
|
output_single_cycle(500, 500);
|
||||||
icuDisable(&ICUD3);
|
icuStopCapture(&ICUD3);
|
||||||
chEvtWaitAny((eventmask_t) 3);
|
chEvtWaitAny((eventmask_t) 3);
|
||||||
|
|
||||||
chprintf(serp, "Testing 25 duty cycle\r\n");
|
chprintf(serp, "Testing 25 duty cycle\r\n");
|
||||||
icuEnable(&ICUD3);
|
icuStartCapture(&ICUD3);
|
||||||
output_single_cycle(250, 750);
|
output_single_cycle(250, 750);
|
||||||
icuDisable(&ICUD3);
|
icuStopCapture(&ICUD3);
|
||||||
chEvtWaitAny((eventmask_t) 3);
|
chEvtWaitAny((eventmask_t) 3);
|
||||||
|
|
||||||
chprintf(serp, "Testing 75 duty cycle\r\n");
|
chprintf(serp, "Testing 75 duty cycle\r\n");
|
||||||
icuEnable(&ICUD3);
|
icuStartCapture(&ICUD3);
|
||||||
output_single_cycle(750, 250);
|
output_single_cycle(750, 250);
|
||||||
icuDisable(&ICUD3);
|
icuStopCapture(&ICUD3);
|
||||||
chEvtWaitAny((eventmask_t) 3);
|
chEvtWaitAny((eventmask_t) 3);
|
||||||
|
|
||||||
chprintf(serp, "Testing overflow\r\n");
|
chprintf(serp, "Testing overflow\r\n");
|
||||||
icuEnable(&ICUD3);
|
icuStartCapture(&ICUD3);
|
||||||
chEvtWaitAny((eventmask_t) 3);
|
chEvtWaitAny((eventmask_t) 3);
|
||||||
icuDisable(&ICUD3);
|
icuStopCapture(&ICUD3);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue