From efb5332373ccaa36b2d2e465b3bceb2b7f4b7655 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Tue, 4 Nov 2014 09:40:51 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@7473 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/boards/ST_EVB_SPC560B/board.c | 66 +++++++++++++++++++++++++ os/hal/boards/ST_EVB_SPC560B/board.h | 73 ++++++++++++++++++++++++++++ os/hal/boards/ST_EVB_SPC560B/board.mk | 5 ++ os/nil/ports/ARMCMx/compilers/GCC/niltypes.h | 9 ++++ os/nil/ports/ARMCMx/nilcore.h | 9 ---- os/nil/ports/AVR/compilers/GCC/niltypes.h | 9 ++++ os/nil/ports/e200/compilers/GCC/niltypes.h | 9 ++++ os/nil/ports/e200/nilcore.h | 9 ---- os/nil/templates/nilcore.h | 9 ---- os/nil/templates/niltypes.h | 9 ++++ os/rt/include/ch.h | 2 +- os/rt/include/chsystypes.h | 9 ++++ os/rt/ports/ARM/chcore.h | 9 ---- os/rt/ports/ARMCMx/chcore.h | 9 ---- os/rt/ports/AVR/compilers/GCC/chtypes.h | 1 - os/rt/ports/SIMIA32/chcore.h | 4 +- os/rt/ports/SIMIA32/compilers/GCC/port.mk | 5 +- os/rt/ports/e200/chcore.h | 9 ---- 18 files changed, 195 insertions(+), 60 deletions(-) create mode 100644 os/hal/boards/ST_EVB_SPC560B/board.c create mode 100644 os/hal/boards/ST_EVB_SPC560B/board.h create mode 100644 os/hal/boards/ST_EVB_SPC560B/board.mk (limited to 'os') diff --git a/os/hal/boards/ST_EVB_SPC560B/board.c b/os/hal/boards/ST_EVB_SPC560B/board.c new file mode 100644 index 000000000..4ecf10fd9 --- /dev/null +++ b/os/hal/boards/ST_EVB_SPC560B/board.c @@ -0,0 +1,66 @@ +/* + SPC5 HAL - Copyright (C) 2013 STMicroelectronics + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include "hal.h" + +#if HAL_USE_PAL || defined(__DOXYGEN__) +/* Initial setup of all defined pads, the list is terminated by a {-1, 0, 0}.*/ +static const spc_siu_init_t spc_siu_init[] = { + {PCR(PORT_B, PB_LIN0_TDX), PAL_HIGH, PAL_MODE_OUTPUT_ALTERNATE(1)}, + {PCR(PORT_B, PB_LIN0_RDX), PAL_HIGH, PAL_MODE_INPUT}, + {PCR(PORT_E, PE_BUTTON1), PAL_LOW, PAL_MODE_INPUT}, + {PCR(PORT_E, PE_BUTTON2), PAL_LOW, PAL_MODE_INPUT}, + {PCR(PORT_E, PE_BUTTON3), PAL_LOW, PAL_MODE_INPUT}, + {PCR(PORT_E, PE_BUTTON4), PAL_LOW, PAL_MODE_INPUT}, + {PCR(PORT_E, PE_LED1), PAL_HIGH, PAL_MODE_OUTPUT_PUSHPULL}, + {PCR(PORT_E, PE_LED2), PAL_HIGH, PAL_MODE_OUTPUT_PUSHPULL}, + {PCR(PORT_E, PE_LED3), PAL_HIGH, PAL_MODE_OUTPUT_PUSHPULL}, + {PCR(PORT_E, PE_LED4), PAL_HIGH, PAL_MODE_OUTPUT_PUSHPULL}, + {-1, 0, 0} +}; + +/* Initialization array for the PSMI registers.*/ +static const uint8_t spc_padsels_init[SPC5_SIUL_NUM_PADSELS] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; + +/** + * @brief PAL setup. + */ +const PALConfig pal_default_config = { + PAL_MODE_UNCONNECTED, /* Default mode for all undefined pads. */ + spc_siu_init, + spc_padsels_init +}; +#endif + +/* + * Early initialization code. + * This initialization must be performed just after stack setup and before + * any other initialization. + */ +void __early_init(void) { + + spc_clock_init(); +} + +/* + * Board-specific initialization code. + */ +void boardInit(void) { + +} diff --git a/os/hal/boards/ST_EVB_SPC560B/board.h b/os/hal/boards/ST_EVB_SPC560B/board.h new file mode 100644 index 000000000..ef2132778 --- /dev/null +++ b/os/hal/boards/ST_EVB_SPC560B/board.h @@ -0,0 +1,73 @@ +/* + SPC5 HAL - Copyright (C) 2013 STMicroelectronics + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#ifndef _BOARD_H_ +#define _BOARD_H_ + +/* + * Setup for a generic SPC560Bxx proto board. + */ + +/* + * Board identifiers. + */ +#define BOARD_GENERIC_SPC560BC +#define BOARD_NAME "EVB with SPC560Bxx Mini Module" + +/* + * Device identifier. + */ +#define _SPC560B60L7_ + +/* + * Board frequencies. + */ +#if !defined(SPC5_XOSC_CLK) +#define SPC5_XOSC_CLK 8000000 +#endif + +/* + * I/O definitions. + */ +#define PB_LIN0_TDX 2 +#define PB_LIN0_RDX 3 + +#define PE_BUTTON1 0 +#define PE_BUTTON2 1 +#define PE_BUTTON3 2 +#define PE_BUTTON4 3 + +#define PE_LED1 4 +#define PE_LED2 5 +#define PE_LED3 6 +#define PE_LED4 7 + +/* + * Support macros. + */ +#define PCR(port, pin) (((port) * 16) + (pin)) + +#if !defined(_FROM_ASM_) +#ifdef __cplusplus +extern "C" { +#endif + void boardInit(void); +#ifdef __cplusplus +} +#endif +#endif /* _FROM_ASM_ */ + +#endif /* _BOARD_H_ */ diff --git a/os/hal/boards/ST_EVB_SPC560B/board.mk b/os/hal/boards/ST_EVB_SPC560B/board.mk new file mode 100644 index 000000000..4aa644777 --- /dev/null +++ b/os/hal/boards/ST_EVB_SPC560B/board.mk @@ -0,0 +1,5 @@ +# List of all the board related files. +BOARDSRC = ${CHIBIOS}/os/hal/boards/ST_EVB_SPC560B/board.c + +# Required include directories +BOARDINC = ${CHIBIOS}/os/hal/boards/ST_EVB_SPC560B diff --git a/os/nil/ports/ARMCMx/compilers/GCC/niltypes.h b/os/nil/ports/ARMCMx/compilers/GCC/niltypes.h index 30750c31d..a594d8ad9 100644 --- a/os/nil/ports/ARMCMx/compilers/GCC/niltypes.h +++ b/os/nil/ports/ARMCMx/compilers/GCC/niltypes.h @@ -58,6 +58,15 @@ typedef uint32_t eventmask_t; /**< Mask of event identifiers. */ typedef int32_t cnt_t; /**< Generic signed counter. */ typedef uint32_t ucnt_t; /**< Generic unsigned counter. */ +/** + * @brief Type of system time. + */ +#if (NIL_CFG_ST_RESOLUTION == 32) || defined(__DOXYGEN__) +typedef uint32_t systime_t; +#else +typedef uint16_t systime_t; +#endif + /** * @brief ROM constant modifier. * @note It is set to use the "const" keyword in this port. diff --git a/os/nil/ports/ARMCMx/nilcore.h b/os/nil/ports/ARMCMx/nilcore.h index eb6fc0f0c..8a9d98b8f 100644 --- a/os/nil/ports/ARMCMx/nilcore.h +++ b/os/nil/ports/ARMCMx/nilcore.h @@ -127,15 +127,6 @@ asm module.*/ #if !defined(_FROM_ASM_) -/** - * @brief Type of system time. - */ -#if (NIL_CFG_ST_RESOLUTION == 32) || defined(__DOXYGEN__) -typedef uint32_t systime_t; -#else -typedef uint16_t systime_t; -#endif - /** * @brief Type of a generic ARM register. */ diff --git a/os/nil/ports/AVR/compilers/GCC/niltypes.h b/os/nil/ports/AVR/compilers/GCC/niltypes.h index 022ec9d56..a5a74d48f 100644 --- a/os/nil/ports/AVR/compilers/GCC/niltypes.h +++ b/os/nil/ports/AVR/compilers/GCC/niltypes.h @@ -58,6 +58,15 @@ typedef uint8_t eventmask_t; /**< Mask of event identifiers. */ typedef int8_t cnt_t; /**< Generic signed counter. */ typedef uint8_t ucnt_t; /**< Generic unsigned counter. */ +/** + * @brief Type of system time. + */ +#if (NIL_CFG_ST_RESOLUTION == 32) || defined(__DOXYGEN__) +typedef uint32_t systime_t; +#else +typedef uint16_t systime_t; +#endif + /** * @brief ROM constant modifier. * @note It is set to use the "const" keyword in this port. diff --git a/os/nil/ports/e200/compilers/GCC/niltypes.h b/os/nil/ports/e200/compilers/GCC/niltypes.h index 6ea0f76de..1b9267801 100644 --- a/os/nil/ports/e200/compilers/GCC/niltypes.h +++ b/os/nil/ports/e200/compilers/GCC/niltypes.h @@ -58,6 +58,15 @@ typedef uint32_t eventmask_t; /**< Mask of event identifiers. */ typedef int32_t cnt_t; /**< Generic signed counter. */ typedef uint32_t ucnt_t; /**< Generic unsigned counter. */ +/** + * @brief Type of system time. + */ +#if (NIL_CFG_ST_RESOLUTION == 32) || defined(__DOXYGEN__) +typedef uint32_t systime_t; +#else +typedef uint16_t systime_t; +#endif + /** * @brief ROM constant modifier. * @note It is set to use the "const" keyword in this port. diff --git a/os/nil/ports/e200/nilcore.h b/os/nil/ports/e200/nilcore.h index 2fbfbf911..93ca1ea8e 100644 --- a/os/nil/ports/e200/nilcore.h +++ b/os/nil/ports/e200/nilcore.h @@ -150,15 +150,6 @@ asm module.*/ #if !defined(_FROM_ASM_) -/** - * @brief Type of system time. - */ -#if (NIL_CFG_ST_RESOLUTION == 32) || defined(__DOXYGEN__) -typedef uint32_t systime_t; -#else -typedef uint16_t systime_t; -#endif - /** * @brief Type of stack and memory alignment enforcement. */ diff --git a/os/nil/templates/nilcore.h b/os/nil/templates/nilcore.h index a868e74d8..2317ee852 100644 --- a/os/nil/templates/nilcore.h +++ b/os/nil/templates/nilcore.h @@ -108,15 +108,6 @@ asm module.*/ #if !defined(_FROM_ASM_) -/** - * @brief Type of system time. - */ -#if (NIL_CFG_ST_RESOLUTION == 32) || defined(__DOXYGEN__) -typedef uint32_t systime_t; -#else -typedef uint16_t systime_t; -#endif - /** * @brief Type of stack and memory alignment enforcement. */ diff --git a/os/nil/templates/niltypes.h b/os/nil/templates/niltypes.h index c7d535a1a..64ae606ee 100644 --- a/os/nil/templates/niltypes.h +++ b/os/nil/templates/niltypes.h @@ -58,6 +58,15 @@ typedef uint32_t eventmask_t; /**< Mask of event identifiers. */ typedef int32_t cnt_t; /**< Generic signed counter. */ typedef uint32_t ucnt_t; /**< Generic unsigned counter. */ +/** + * @brief Type of system time. + */ +#if (NIL_CFG_ST_RESOLUTION == 32) || defined(__DOXYGEN__) +typedef uint32_t systime_t; +#else +typedef uint16_t systime_t; +#endif + /** * @brief ROM constant modifier. * @note It is set to use the "const" keyword in this port. diff --git a/os/rt/include/ch.h b/os/rt/include/ch.h index 5e67aa202..d49aa21fb 100644 --- a/os/rt/include/ch.h +++ b/os/rt/include/ch.h @@ -63,8 +63,8 @@ /** @} */ /* Core headers.*/ -#include "chsystypes.h" #include "chtypes.h" +#include "chsystypes.h" #include "chconf.h" #include "chcore.h" #include "chdebug.h" diff --git a/os/rt/include/chsystypes.h b/os/rt/include/chsystypes.h index 6cf0c147b..74a45b8a2 100644 --- a/os/rt/include/chsystypes.h +++ b/os/rt/include/chsystypes.h @@ -45,6 +45,15 @@ /* Module data structures and types. */ /*===========================================================================*/ +/** + * @brief Type of system time. + */ +#if (CH_CFG_ST_RESOLUTION == 32) || defined(__DOXYGEN__) +typedef uint32_t systime_t; +#else +typedef uint16_t systime_t; +#endif + /** * @extends threads_queue_t * diff --git a/os/rt/ports/ARM/chcore.h b/os/rt/ports/ARM/chcore.h index 69c019fdf..8a377010b 100644 --- a/os/rt/ports/ARM/chcore.h +++ b/os/rt/ports/ARM/chcore.h @@ -174,15 +174,6 @@ asm module.*/ #if !defined(_FROM_ASM_) -/** - * @brief Type of system time. - */ -#if (CH_CFG_ST_RESOLUTION == 32) || defined(__DOXYGEN__) -typedef uint32_t systime_t; -#else -typedef uint16_t systime_t; -#endif - /** * @brief Type of stack and memory alignment enforcement. * @note In this architecture the stack alignment is enforced to 64 bits. diff --git a/os/rt/ports/ARMCMx/chcore.h b/os/rt/ports/ARMCMx/chcore.h index 0f2030744..773d7a85c 100644 --- a/os/rt/ports/ARMCMx/chcore.h +++ b/os/rt/ports/ARMCMx/chcore.h @@ -128,15 +128,6 @@ asm module.*/ #if !defined(_FROM_ASM_) -/** - * @brief Type of system time. - */ -#if (CH_CFG_ST_RESOLUTION == 32) || defined(__DOXYGEN__) -typedef uint32_t systime_t; -#else -typedef uint16_t systime_t; -#endif - /** * @brief Type of a generic ARM register. */ diff --git a/os/rt/ports/AVR/compilers/GCC/chtypes.h b/os/rt/ports/AVR/compilers/GCC/chtypes.h index 56880c08a..4ef04189b 100644 --- a/os/rt/ports/AVR/compilers/GCC/chtypes.h +++ b/os/rt/ports/AVR/compilers/GCC/chtypes.h @@ -62,7 +62,6 @@ typedef int16_t msg_t; /**< Inter-thread message. */ typedef uint8_t eventid_t; /**< Event Id. */ typedef uint8_t eventmask_t; /**< Event mask. */ typedef uint8_t eventflags_t; /**< Event flags. */ -typedef uint16_t systime_t; /**< System time. */ typedef int8_t cnt_t; /**< Resources counter. */ /** diff --git a/os/rt/ports/SIMIA32/chcore.h b/os/rt/ports/SIMIA32/chcore.h index 70e16199a..9c8cd2587 100644 --- a/os/rt/ports/SIMIA32/chcore.h +++ b/os/rt/ports/SIMIA32/chcore.h @@ -147,7 +147,7 @@ struct port_intctx { * @p port_intctx structure representing the stack pointer * at context switch time. */ -struct port_context { +struct context { struct intctx volatile *esp; }; @@ -230,7 +230,7 @@ struct port_context { #ifdef __cplusplus extern "C" { #endif - __attribute__((fastcall)) void port_switch(Thread *ntp, Thread *otp); + __attribute__((fastcall)) void port_switch(thread_t *ntp, thread_t *otp); __attribute__((cdecl, noreturn)) void _port_thread_start(msg_t (*pf)(void *), void *p); void _sim_check_for_interrupts(void); diff --git a/os/rt/ports/SIMIA32/compilers/GCC/port.mk b/os/rt/ports/SIMIA32/compilers/GCC/port.mk index 8f053abc4..0d5f0903d 100644 --- a/os/rt/ports/SIMIA32/compilers/GCC/port.mk +++ b/os/rt/ports/SIMIA32/compilers/GCC/port.mk @@ -1,6 +1,7 @@ # List of the ChibiOS/RT SIMIA32 port files. -PORTSRC = ${CHIBIOS}/os/ports/GCC/SIMIA32/chcore.c +PORTSRC = ${CHIBIOS}/os/rt/ports/SIMIA32/chcore.c PORTASM = -PORTINC = ${CHIBIOS}/os/ports/GCC/SIMIA32 +PORTINC = ${CHIBIOS}/os/rt/ports/SIMIA32/compilers/GCC \ + ${CHIBIOS}/os/rt/ports/SIMIA32 diff --git a/os/rt/ports/e200/chcore.h b/os/rt/ports/e200/chcore.h index 7f97beeff..f5ecf2616 100644 --- a/os/rt/ports/e200/chcore.h +++ b/os/rt/ports/e200/chcore.h @@ -181,15 +181,6 @@ asm module.*/ #if !defined(_FROM_ASM_) -/** - * @brief Type of system time. - */ -#if (CH_CFG_ST_RESOLUTION == 32) || defined(__DOXYGEN__) -typedef uint32_t systime_t; -#else -typedef uint16_t systime_t; -#endif - /** * @brief Type of stack and memory alignment enforcement. * @note In this architecture the stack alignment is enforced to 64 bits. -- cgit v1.2.3