-#warning This file is deprecated, use switch_ctx_arm.S
-#include "switch_ctx_arm.S"
+#include <cfg/cfg_arch.h>
+
+#if !(ARCH & ARCH_NIGHTTEST)
+ #warning This file is deprecated, use switch_ctx_arm.S
+ #include "switch_ctx_arm.S"
+#endif
-#warning This file is deprecated, use switch_ctx_avr.S
-#include "switch_ctx_avr.S"
+#include <cfg/cfg_arch.h>
+
+#if !(ARCH & ARCH_NIGHTTEST)
+ #warning This file is deprecated, use switch_ctx_avr.S
+ #include "switch_ctx_avr.S"
+#endif
*
* (see drv/datafalsh_test.c for more detail)
*/
-int dataflash_testSetUp(void);
+int dataflash_testSetup(void);
+/* For backward compatibility */
+#define dataflash_testSetUp() dataflash_testSetup()
int dataflash_testRun(void);
int dataflash_testTearDown(void);
* Setup all needed to test dataflash memory
*
*/
-int dataflash_testSetUp(void)
+int dataflash_testSetup(void)
{
- kfile_testSetUp();
+ kfile_testSetup();
LOG_INFO("KFILE setup..ok\n");
LOG_INFO("Check if kernel is enable (if enable you should see the assert message.)\n");
LOG_INFO("Run KFILE test.\n");
SILENT_ASSERT("bertos/drv/dataflash.c:405: Assertion failed: fd->fd.seek_pos + size <= fd->fd.size");
- if (kfile_testRun(&dflash_fd.fd, test_buf, save_buf, sizeof(test_buf)) != EOF)
+ if (kfile_testRunGeneric(&dflash_fd.fd, test_buf, save_buf, sizeof(test_buf)) != EOF)
{
LOG_INFO("KFILE test..ok\n");
}
proc_init();
#endif
- if (!dataflash_testSetUp())
+ if (!dataflash_testSetup())
{
LOG_INFO("DATAFLASH setup..ok\n");
}
* Launche a kfile test interface.
*/
kprintf("Kfile test start..\n");
- if (!kfile_testRun(&fd.fd, test_buf, NULL, sizeof(test_buf)))
+ if (!kfile_testRunGeneric(&fd.fd, test_buf, NULL, sizeof(test_buf)))
return false;
return true;
kfile_putc(MCP41_WRITE_DATA, ch);
kfile_putc(((MCP41_HW_MAX * (uint32_t)res) + (MCP41_MAX / 2)) / MCP41_MAX, ch);
kfile_flush(ch);
- ser_drain(spi_ser);
MCP41_OFF(dev);
}
#include <math.h>
-#warning TODO:Generalize this moduele for all target supported.
-
-#if 0
/** Array of triacs */
static Triac triacs[TRIAC_CNT];
triacs[dev].running = false;
SET_TRIAC_DDR(dev);
TRIAC_OFF(dev);
- timer_set_event_softint(&triacs[dev].timer, (Hook)phase_softint, (void *)dev);
+ timer_setSoftint(&triacs[dev].timer, (Hook)phase_softint, (void *)dev);
}
IRQ_SAVE_DISABLE(flags);
DB(phase_initialized = true;)
IRQ_RESTORE(flags);
}
-#endif
*
* \version $Id$
*
- * \brief Phase control driver, to manage triac swicth.
+ * \brief Phase partialization driver with TRIACs.
*
* \version $Id$
* \author Francesco Sacchi <batt@develer.com>
*
* See pwm_test.c for implemntation of these functions.
*/
-int pwm_testRun(void);
-int pwm_testSetUp(void);
+void pwm_testRun(void);
+int pwm_testSetup(void);
+/* For backward compatibility */
+#define pwm_testSetUp() pwm_testSetup()
int pwm_testTearDown(void);
#endif /* DRV_PWM_H */
* Setup all needed to test PWM on AT91
*
*/
-int pwm_testSetUp(void)
+int pwm_testSetup(void)
{
LOG_INFO("Init pwm..");
pwm_init();
* Test suit for genation of pwm waveform.
*
*/
-int pwm_testRun(void)
+void NORETURN pwm_testRun(void)
{
pwm_duty_t duty = 0;
int delay = 0;
- pwm_testSetUp();
+ pwm_testSetup();
LOG_INFO("\n\n===== BeRTOS PWM test =====\n\n");
}
delay++;
}
-
- return 0;
}
/**
#if 0
int main(void)
{
- IRQ_ENABLE;
+ IRQ_ENABLE;
kdbg_init();
pwm_testRun();
- for(;;)
- {
- }
+ for(;;)
+ {
+ }
}
#endif
*
* \brief BattFS: a filesystem for embedded platforms (implementation).
*
- * \version $Id:$
+ * \version $Id$
*
* \author Francesco Sacchi <batt@develer.com>
*
#warning TODO:This is an example implementation, you must implement it!
+#define TRIAC_MAX_DUTY 100
+#define TRIAC_MAX_POWER 100
+
#define PHASE_HW_INIT do { /* Implement me! */ }while (0)
INLINE void TRIAC_OFF(TriacDev i)
(void)i;
}
+INLINE void SET_TRIAC_DDR(TriacDev i)
+{
+ /* Implement me! */
+
+ //Only for test remove when implement this function
+ (void)i;
+}
+
+void zerocross_isr(void);
+#define DEFINE_ZEROCROSS_ISR() void zerocross_isr(void)
+
#endif /* HW_PHASE_H */
* Define the macros needed to set the serial input bit of SIPO device
* low or high.
*/
-#define SIPO_SI_HIGH()/* Implement me! */
-#define SIPO_SI_LOW() /* Implement me! */
+#define SIPO_SI_HIGH() do { /* Implement me! */ } while (0)
+#define SIPO_SI_LOW() do { /* Implement me! */ } while (0)
/**
* Drive pin to load the bit, presented in serial-in pin,
* Kfile test function.
*/
int kfile_testSetup(void);
+int kfile_testRun(void);
int kfile_testRunGeneric(KFile *fd, uint8_t *test_buf, uint8_t *save_buf, size_t size);
int kfile_testTearDown(void);
static size_t fake_write(KFile *fd, const void *buf, size_t size)
{
- fake_t *src = (fake_t *)buf;
+ const fake_t *src = (const fake_t *)buf;
size_t wr_len;
wr_len = MIN((kfile_off_t)size, fd->size - fd->seek_pos);
return wr_len;
}
-int fake_flush(KFile *fd)
+static int fake_flush(KFile *fd)
{
(void)fd;
return 0;
}
-void fake_kfileInit(void)
+static void fake_kfileInit(void)
{
// Setup data flash programming functions.
fd.reopen = kfile_genericReopen;
*/
static void init_testBuf(void)
{
- #include <stdlib.h>
kprintf("Init fake buffer..\n");
for (int i = 0; i < BUF_TEST_LEN; i++)
{
- test_disk[i] = random();
+ test_disk[i] = i;
kprintf("%d ", test_disk[i]);
}
kprintf("\nend\n");
#include <cpu/types.h>
-#if CONFIG_KERN_MONITOR
-
/**
* Start the kernel monitor. It is a special process which checks every second the stacks of the
* running processes trying to detect stack overflows.
/** Print a report of the stack status through kdebug */
void monitor_report(void);
-
-#endif /* CONFIG_KERN_MONITOR */
#endif /* KERN_MONITOR_H */
msg_put(msg->replyPort, msg);
}
+int msg_testRun(void);
+int msg_testSetup(void);
+int msg_testTearDown(void);
+
#endif /* KERN_MSG_H */
#include <kern/msg.h>
#include <kern/proc.h>
-#include <kern/irq.h>
+#include <kern/signal.h>
+
+#include <mware/event.h>
#include <drv/timer.h>
+/*
+ * In the nightly build test, signals are disables, so this
+ * code won't compile.
+ * Since this code is used when we run "make check" it will be
+ * compiled and therefor tested there.
+ */
+#if CONFIG_KERN_SIGNALS
+
+
// Global settings for the test.
#define MAX_GLOBAL_COUNT 11040
#define TEST_TIME_OUT_MS 10
/*
* These macros generate the code needed to create the test process functions.
*/
-#define RECV_PROC(num, sig) static void receiver_proc##num(void) \
- { \
- TestMsg *rec_msg; \
- for (;;) \
- { \
- sig_wait(sig); \
- kprintf("Proc[%d]..get message\n", num); \
- rec_msg = containerof(msg_get(&test_port##num), TestMsg, msg); \
- timer_delay(rec_msg->delay); \
- rec_msg->result += rec_msg->val; \
- kprintf("Proc[%d]..process message val[%d],delay[%d],res[%d]\n", num, rec_msg->val, rec_msg->delay, rec_msg->result); \
- msg_reply(&rec_msg->msg); \
- kprintf("Proc[%d] reply\n", num); \
- } \
- }
+#define RECV_PROC(num, sig) \
+static void receiver_proc##num(void) \
+{ \
+ TestMsg *rec_msg; \
+ for (;;) \
+ { \
+ sig_wait(sig); \
+ kprintf("Proc[%d]..get message\n", num); \
+ rec_msg = containerof(msg_get(&test_port##num), TestMsg, msg); \
+ timer_delay(rec_msg->delay); \
+ rec_msg->result += rec_msg->val; \
+ kprintf("Proc[%d]..process message val[%d],delay[%d],res[%d]\n", num, rec_msg->val, rec_msg->delay, rec_msg->result); \
+ msg_reply(&rec_msg->msg); \
+ kprintf("Proc[%d] reply\n", num); \
+ } \
+}
#define SEND_MSG(num) \
do { \
#define RECV_STACK(num) static cpu_stack_t receiver_stack##num[CONFIG_KERN_MINSTACKSIZE / sizeof(cpu_stack_t)]
#define RECV_INIT_PROC(num) proc_new(receiver_proc##num, NULL, sizeof(receiver_stack##num), receiver_stack##num)
-#define RECV_INIT_MSG(num, proc,sig) msg_initPort(&test_port##num, event_createSignal(proc, sig))
+#define RECV_INIT_MSG(num, proc, sig) msg_initPort(&test_port##num, event_createSignal(proc, sig))
// A test message with the parameters and a result.
typedef struct
}
TEST_MAIN(msg);
+
+#endif /* CONFIG_KERN_SIGNALS */
void sem_release(struct Semaphore *s);
/* \} */
+int sem_testRun(void);
+int sem_testSetup(void);
+int sem_testTearDown(void);
+
#endif /* KERN_SEM_H */
sigmask_t sig_wait(sigmask_t sigs);
sigmask_t sig_waitTimeout(sigmask_t sigs, ticks_t timeout);
+int signal_testRun(void);
+int signal_testSetup(void);
+int signal_testTearDown(void);
/**
* \name Signal definitions
/*
* These macros generate the code needed to create the test process functions.
*/
-#define PROC_TEST_SLAVE(index, signal) static void proc_test##index(void) \
+#define PROC_TEST_SLAVE(index, signal) \
+static void NORETURN proc_test##index(void) \
{ \
for(;;) \
{ \
armtest_PREFIX = arm-none-eabi-
armtest_CPPAFLAGS = -O0 -g -gdwarf-2 -g -gen-debug
-armtest_CPPFLAGS = -O0 -D'ARCH=ARCH_NIGHTTEST' -D__ARM_AT91SAM7S256__ -g3 -gdwarf-2 -fverbose-asm -Iexamples/test -Ibertos/cpu/arm
+armtest_CPPFLAGS = -O0 -D'ARCH=ARCH_NIGHTTEST' -D__ARM_AT91SAM7S256__ -D'CPU_FREQ=(48023000UL)' -g3 -gdwarf-2 -fverbose-asm -Iexamples/test -Ibertos/cpu/arm
armtest_LDFLAGS = -nostartfiles -T bertos/cpu/arm/scripts/at91sam7_256_rom.ld -Wl,--no-warn-mismatch
armtest_CPU = arm7tdmi
avrtest_PCSRC += bertos/mware/formatwr.c
avrtest_PREFIX = avr-
-avrtest_CPPFLAGS = -D'ARCH=ARCH_NIGHTTEST' -Iexamples/test -Ibertos/cpu/avr
+avrtest_CPPFLAGS = -D'ARCH=ARCH_NIGHTTEST' -D'CPU_FREQ=(12288000UL)' -Iexamples/test -Ibertos/cpu/avr
avrtest_CFLAGS = -Os -mcall-prologues -fno-strict-aliasing
#Directory to exclude
OS_DIR="${BERTOS_DIR}/os"
EMUL_DIR="${BERTOS_DIR}/emul"
+WIZARD_DIR="./wizard"
APP_DIR="./examples"
if [ $# \< 2 ] ; then
fi
CPU_TARGET=$1
#Create a list of source file without a cpu specific source
-GEN_SRC=`find . \( -name \.svn -prune -o -path $COPY_DIR -prune -o -path $CPU_DIR -prune -o -path $APP_DIR -prune -o -path $OS_DIR -prune -o -path $EMUL_DIR -prune \) -o -name *.${2} -print | xargs`
+GEN_SRC=`find . \( -name \.svn -prune -o -path $COPY_DIR -prune -o -path $CPU_DIR -prune -o -path $APP_DIR -prune -o -path $OS_DIR -prune -o -path $WIZARD_DIR -prune -o -path $EMUL_DIR -prune \) -o -name *.${2} -print | xargs`
#Select c and asm sources for selected cpu target
TRG_SRC=`find ${CPU_DIR}/$CPU_TARGET -name \.svn -prune -o -name *.${2} -print | xargs`
if [ $# = 1 ] ; then
if [ $1 = "-h" ] ; then
printf "Nightly test help.\n"
- printf "\t--no-silent disable the silent of the TODO/FIXME warning message.\n"
+ printf "\t--no-silent disable the silent of the TODO/FIXME warning messages.\n"
exit 1
elif [ $1 = "--no-silent" ] ; then
OPTS=0
if [ $OPTS = 1 ] ; then
#Copy BeRTOS sources
printf "Starting nightlytest..\n"
- printf "Silent mode enable, removing the TODO/FIXME message warning.\n"
+ printf "Silent mode enable, removing the TODO/FIXME message warnings.\n"
cp -R $BERTOS_DIR $BERTOS_DIR_BAK || exit 1
#Strip away TODOs and FIXME
find $BERTOS_DIR -name "*.[ch]" | xargs perl -p -i -e 's/^\s*#warning\s*(TODO|FIXME).*//g;'
fi
-#Cpu target that we want to test
+#Cpu targets that we want to test
TRG="avr arm"
for i in $TRG ;
int main(void)
{
return 0;
-}
\ No newline at end of file
+}
+