diff --git a/kernel/atom.h b/kernel/atom.h index faa0bdb..a8c2eb3 100755 --- a/kernel/atom.h +++ b/kernel/atom.h @@ -31,7 +31,7 @@ #define __ATOM_H #include "atomtimer.h" -#include "atomuser.h" +#include "atomport.h" /* Data types */ diff --git a/kernel/atomkernel.c b/kernel/atomkernel.c index ec811f2..02a6260 100755 --- a/kernel/atomkernel.c +++ b/kernel/atomkernel.c @@ -146,7 +146,6 @@ #include #include "atom.h" -#include "atomuser.h" /* Global data */ diff --git a/kernel/atommutex.c b/kernel/atommutex.c index 8fc616c..cbb6371 100755 --- a/kernel/atommutex.c +++ b/kernel/atommutex.c @@ -105,7 +105,6 @@ #include "atom.h" #include "atommutex.h" #include "atomtimer.h" -#include "atomuser.h" /* Local data types */ diff --git a/kernel/atomqueue.c b/kernel/atomqueue.c index 7b27729..78599f5 100755 --- a/kernel/atomqueue.c +++ b/kernel/atomqueue.c @@ -97,7 +97,6 @@ #include "atom.h" #include "atomqueue.h" #include "atomtimer.h" -#include "atomuser.h" /* Local data types */ diff --git a/kernel/atomsem.c b/kernel/atomsem.c index 3578413..6c5d32d 100755 --- a/kernel/atomsem.c +++ b/kernel/atomsem.c @@ -92,7 +92,6 @@ #include "atom.h" #include "atomsem.h" #include "atomtimer.h" -#include "atomuser.h" /* Local data types */ diff --git a/kernel/atomtimer.c b/kernel/atomtimer.c index f56822d..5376fcb 100755 --- a/kernel/atomtimer.c +++ b/kernel/atomtimer.c @@ -69,7 +69,6 @@ #include #include "atom.h" -#include "atomuser.h" /* Data types */ diff --git a/kernel/atomtimer.h b/kernel/atomtimer.h index 9e7ccf5..9c182d7 100755 --- a/kernel/atomtimer.h +++ b/kernel/atomtimer.h @@ -30,7 +30,8 @@ #ifndef __ATOM_TIMER_H #define __ATOM_TIMER_H -#include "atomuser.h" +#include "atomport.h" + /* Callback function prototype */ typedef void ( * TIMER_CB_FUNC ) ( POINTER cb_data ) ; diff --git a/ports/avr/atomport-private.h b/ports/avr/atomport-private.h new file mode 100644 index 0000000..866f6b4 --- /dev/null +++ b/ports/avr/atomport-private.h @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2010, Kelvin Lawson. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. No personal names or organizations' names associated with the + * Atomthreads project may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE ATOMTHREADS PROJECT AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef __ATOM_PORT_PRIVATE_H +#define __ATOM_PORT_PRIVATE_H + +/* CPU Frequency */ +#define AVR_CPU_HZ 1000000 + +/* Function prototypes */ +void avrInitSystemTickTimer ( void ); + +#endif /* __ATOM_PORT_PRIVATE_H */ diff --git a/ports/avr/atomuser.h b/ports/avr/atomport-tests.h similarity index 70% rename from ports/avr/atomuser.h rename to ports/avr/atomport-tests.h index 8f611e0..113cfe2 100644 --- a/ports/avr/atomuser.h +++ b/ports/avr/atomport-tests.h @@ -1,59 +1,55 @@ -/* - * Copyright (c) 2010, Kelvin Lawson. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. No personal names or organizations' names associated with the - * Atomthreads project may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE ATOMTHREADS PROJECT AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef __ATOM_USER_H -#define __ATOM_USER_H - -#include -#include -#include - -/* Portable uint8_t and friends available from stdint.h on this platform */ -#include - - -/* Required number of system ticks per second (normally 100 for 10ms tick) */ -#define SYSTEM_TICKS_PER_SEC 100 - - -/** - * Architecture-specific types. - * Most of these are available from stdint.h on this platform, which is - * included above. - */ -#define POINTER void * - - -/* Critical region protection */ -#define CRITICAL_STORE uint8_t sreg -#define CRITICAL_START() sreg = SREG; cli(); -#define CRITICAL_END() SREG = sreg - - -#endif /* __ATOM_USER_H */ +/* + * Copyright (c) 2010, Kelvin Lawson. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. No personal names or organizations' names associated with the + * Atomthreads project may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE ATOMTHREADS PROJECT AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef __ATOM_PORT_TESTS_H +#define __ATOM_PORT_TESTS_H + +/* Include Atomthreads kernel API */ +#include "atom.h" + +/* Prerequisite include for ATOMLOG() macro (via printf) */ +#include + +/* Logger macro for viewing test results */ +#define ATOMLOG printf_P + +/* + * String location macro: for platforms which need to place strings in + * alternative locations, e.g. on avr-gcc strings can be placed in + * program space, saving SRAM. On most platforms this can expand to + * empty. + */ +#define _STR(x) PSTR(x) + +/* Default thread stack size (in bytes) */ +#define TEST_THREAD_STACK_SIZE 128 + + +#endif /* __ATOM_PORT_TESTS_H */ + diff --git a/ports/avr/atomport.c b/ports/avr/atomport.c index 52c6b41..19a1d3c 100644 --- a/ports/avr/atomport.c +++ b/ports/avr/atomport.c @@ -31,7 +31,7 @@ #include #include "atom.h" -#include "atomport.h" +#include "atomport-private.h" /** Forward declarations */ diff --git a/ports/avr/atomport.h b/ports/avr/atomport.h index 426c0a4..89c2793 100644 --- a/ports/avr/atomport.h +++ b/ports/avr/atomport.h @@ -30,10 +30,30 @@ #ifndef __ATOM_PORT_H #define __ATOM_PORT_H -/* CPU Frequency */ -#define AVR_CPU_HZ 1000000 +#include +#include +#include + +/* Portable uint8_t and friends available from stdint.h on this platform */ +#include + + +/* Required number of system ticks per second (normally 100 for 10ms tick) */ +#define SYSTEM_TICKS_PER_SEC 100 + + +/** + * Architecture-specific types. + * Most of these are available from stdint.h on this platform, which is + * included above. + */ +#define POINTER void * + + +/* Critical region protection */ +#define CRITICAL_STORE uint8_t sreg +#define CRITICAL_START() sreg = SREG; cli(); +#define CRITICAL_END() SREG = sreg -/* Function prototypes */ -void avrInitSystemTickTimer ( void ); #endif /* __ATOM_PORT_H */ diff --git a/ports/avr/tests-main.c b/ports/avr/tests-main.c index 13c7876..72e0156 100644 --- a/ports/avr/tests-main.c +++ b/ports/avr/tests-main.c @@ -32,7 +32,7 @@ #include #include "atom.h" -#include "atomport.h" +#include "atomport-private.h" #include "atomtests.h" #include "atomtimer.h" diff --git a/ports/avr/uart.c b/ports/avr/uart.c index d6edcb9..036e299 100644 --- a/ports/avr/uart.c +++ b/ports/avr/uart.c @@ -18,7 +18,7 @@ #include "atom.h" #include "atommutex.h" -#include "atomport.h" +#include "atomport-private.h" #include "uart.h" /* diff --git a/tests/atomtests.h b/tests/atomtests.h index da28159..9e0d0f2 100644 --- a/tests/atomtests.h +++ b/tests/atomtests.h @@ -33,22 +33,9 @@ /* Include Atomthreads kernel API */ #include "atom.h" -/* Prerequisite include for ATOMLOG() macro (via printf) */ -#include +/* Include port-specific test configuration */ +#include "atomport-tests.h" -/* Logger macro for viewing test results */ -#define ATOMLOG printf_P - -/* - * String location macro: for platforms which need to place strings in - * alternative locations, e.g. on avr-gcc strings can be placed in - * program space, saving SRAM. On most platforms this can expand to - * empty. - */ -#define _STR(x) PSTR(x) - -/* Default thread stack size (in bytes) */ -#define TEST_THREAD_STACK_SIZE 128 /* Default thread priority */ #define TEST_THREAD_PRIO 16 diff --git a/tests/mutex1.c b/tests/mutex1.c index 6ca9e47..0ad0630 100644 --- a/tests/mutex1.c +++ b/tests/mutex1.c @@ -31,7 +31,6 @@ #include "atom.h" #include "atommutex.h" #include "atomtests.h" -#include "atomuser.h" /* Test OS objects */ diff --git a/tests/mutex2.c b/tests/mutex2.c index ab97e2b..e2752ec 100644 --- a/tests/mutex2.c +++ b/tests/mutex2.c @@ -31,7 +31,6 @@ #include "atom.h" #include "atommutex.h" #include "atomtests.h" -#include "atomuser.h" /* Test OS objects */ diff --git a/tests/mutex8.c b/tests/mutex8.c index 5ca5745..442d9ff 100644 --- a/tests/mutex8.c +++ b/tests/mutex8.c @@ -31,7 +31,6 @@ #include "atom.h" #include "atommutex.h" #include "atomtests.h" -#include "atomuser.h" /* Test OS objects */ diff --git a/tests/queue1.c b/tests/queue1.c index c8ac594..e1f254d 100644 --- a/tests/queue1.c +++ b/tests/queue1.c @@ -31,7 +31,6 @@ #include "atom.h" #include "atomqueue.h" #include "atomtests.h" -#include "atomuser.h" /* Test queue size */ diff --git a/tests/queue10.c b/tests/queue10.c index 3a5defd..127c27f 100644 --- a/tests/queue10.c +++ b/tests/queue10.c @@ -31,7 +31,6 @@ #include "atom.h" #include "atomqueue.h" #include "atomtests.h" -#include "atomuser.h" /* Test queue size */ diff --git a/tests/queue2.c b/tests/queue2.c index 9a73f0b..d68a6df 100644 --- a/tests/queue2.c +++ b/tests/queue2.c @@ -31,7 +31,6 @@ #include "atom.h" #include "atomqueue.h" #include "atomtests.h" -#include "atomuser.h" /* Test queue size */ diff --git a/tests/queue3.c b/tests/queue3.c index 0d2bbae..ec7359b 100644 --- a/tests/queue3.c +++ b/tests/queue3.c @@ -31,7 +31,6 @@ #include "atom.h" #include "atomqueue.h" #include "atomtests.h" -#include "atomuser.h" /* Test queue size */ diff --git a/tests/queue4.c b/tests/queue4.c index 0ee4233..b584e10 100644 --- a/tests/queue4.c +++ b/tests/queue4.c @@ -31,7 +31,6 @@ #include "atom.h" #include "atomqueue.h" #include "atomtests.h" -#include "atomuser.h" /* Number of queue entries */ diff --git a/tests/queue6.c b/tests/queue6.c index 64343e2..362a001 100644 --- a/tests/queue6.c +++ b/tests/queue6.c @@ -31,7 +31,6 @@ #include "atom.h" #include "atomqueue.h" #include "atomtests.h" -#include "atomuser.h" /* Test queue size */ diff --git a/tests/queue7.c b/tests/queue7.c index b06127d..b9f9f4b 100644 --- a/tests/queue7.c +++ b/tests/queue7.c @@ -31,7 +31,6 @@ #include "atom.h" #include "atomqueue.h" #include "atomtests.h" -#include "atomuser.h" /* Test queue size */ diff --git a/tests/sem1.c b/tests/sem1.c index 554d34c..cc1c1d4 100644 --- a/tests/sem1.c +++ b/tests/sem1.c @@ -31,7 +31,6 @@ #include "atom.h" #include "atomsem.h" #include "atomtests.h" -#include "atomuser.h" /* Test OS objects */ diff --git a/tests/sem2.c b/tests/sem2.c index 7b89e47..925dc53 100644 --- a/tests/sem2.c +++ b/tests/sem2.c @@ -31,7 +31,6 @@ #include "atom.h" #include "atomsem.h" #include "atomtests.h" -#include "atomuser.h" /* Test OS objects */ diff --git a/tests/sem9.c b/tests/sem9.c index 203033e..141a6c1 100644 --- a/tests/sem9.c +++ b/tests/sem9.c @@ -31,7 +31,6 @@ #include "atom.h" #include "atomsem.h" #include "atomtests.h" -#include "atomuser.h" /* Test OS objects */