aboutsummaryrefslogtreecommitdiff
path: root/lib/chibios/os/hal/boards/ST_EVB_SPC560BC
diff options
context:
space:
mode:
Diffstat (limited to 'lib/chibios/os/hal/boards/ST_EVB_SPC560BC')
-rw-r--r--lib/chibios/os/hal/boards/ST_EVB_SPC560BC/board.c66
-rw-r--r--lib/chibios/os/hal/boards/ST_EVB_SPC560BC/board.h68
-rw-r--r--lib/chibios/os/hal/boards/ST_EVB_SPC560BC/board.mk9
3 files changed, 143 insertions, 0 deletions
diff --git a/lib/chibios/os/hal/boards/ST_EVB_SPC560BC/board.c b/lib/chibios/os/hal/boards/ST_EVB_SPC560BC/board.c
new file mode 100644
index 000000000..058a32762
--- /dev/null
+++ b/lib/chibios/os/hal/boards/ST_EVB_SPC560BC/board.c
@@ -0,0 +1,66 @@
1/*
2 ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
3
4 Licensed under the Apache License, Version 2.0 (the "License");
5 you may not use this file except in compliance with the License.
6 You may obtain a copy of the License at
7
8 http://www.apache.org/licenses/LICENSE-2.0
9
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
15*/
16
17#include "hal.h"
18
19#if HAL_USE_PAL || defined(__DOXYGEN__)
20/* Initial setup of all defined pads, the list is terminated by a {-1, 0, 0}.*/
21static const spc_siu_init_t spc_siu_init[] = {
22 {PCR(PORT_B, PB_LIN0_TDX), PAL_HIGH, PAL_MODE_OUTPUT_ALTERNATE(1)},
23 {PCR(PORT_B, PB_LIN0_RDX), PAL_HIGH, PAL_MODE_INPUT},
24 {PCR(PORT_E, PE_BUTTON1), PAL_LOW, PAL_MODE_INPUT},
25 {PCR(PORT_E, PE_BUTTON2), PAL_LOW, PAL_MODE_INPUT},
26 {PCR(PORT_E, PE_BUTTON3), PAL_LOW, PAL_MODE_INPUT},
27 {PCR(PORT_E, PE_BUTTON4), PAL_LOW, PAL_MODE_INPUT},
28 {PCR(PORT_E, PE_LED1), PAL_HIGH, PAL_MODE_OUTPUT_PUSHPULL},
29 {PCR(PORT_E, PE_LED2), PAL_HIGH, PAL_MODE_OUTPUT_PUSHPULL},
30 {PCR(PORT_E, PE_LED3), PAL_HIGH, PAL_MODE_OUTPUT_PUSHPULL},
31 {PCR(PORT_E, PE_LED4), PAL_HIGH, PAL_MODE_OUTPUT_PUSHPULL},
32 {-1, 0, 0}
33};
34
35/* Initialization array for the PSMI registers.*/
36static const uint8_t spc_padsels_init[SPC5_SIUL_NUM_PADSELS] = {
37 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
38 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
39};
40
41/**
42 * @brief PAL setup.
43 */
44const PALConfig pal_default_config = {
45 PAL_MODE_UNCONNECTED, /* Default mode for all undefined pads. */
46 spc_siu_init,
47 spc_padsels_init
48};
49#endif
50
51/*
52 * Early initialization code.
53 * This initialization must be performed just after stack setup and before
54 * any other initialization.
55 */
56void __early_init(void) {
57
58 spc_clock_init();
59}
60
61/*
62 * Board-specific initialization code.
63 */
64void boardInit(void) {
65
66}
diff --git a/lib/chibios/os/hal/boards/ST_EVB_SPC560BC/board.h b/lib/chibios/os/hal/boards/ST_EVB_SPC560BC/board.h
new file mode 100644
index 000000000..4b7a4ceab
--- /dev/null
+++ b/lib/chibios/os/hal/boards/ST_EVB_SPC560BC/board.h
@@ -0,0 +1,68 @@
1/*
2 ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
3
4 Licensed under the Apache License, Version 2.0 (the "License");
5 you may not use this file except in compliance with the License.
6 You may obtain a copy of the License at
7
8 http://www.apache.org/licenses/LICENSE-2.0
9
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
15*/
16
17#ifndef _BOARD_H_
18#define _BOARD_H_
19
20/*
21 * Setup for a generic SPC560B/Cxx proto board.
22 */
23
24/*
25 * Board identifiers.
26 */
27#define BOARD_GENERIC_SPC560BC
28#define BOARD_NAME "Generic SPC560B/Cxx"
29
30/*
31 * Board frequencies.
32 */
33#if !defined(SPC5_XOSC_CLK)
34#define SPC5_XOSC_CLK 8000000
35#endif
36
37/*
38 * I/O definitions.
39 */
40#define PB_LIN0_TDX 2
41#define PB_LIN0_RDX 3
42
43#define PE_BUTTON1 0
44#define PE_BUTTON2 1
45#define PE_BUTTON3 2
46#define PE_BUTTON4 3
47
48#define PE_LED1 4
49#define PE_LED2 5
50#define PE_LED3 6
51#define PE_LED4 7
52
53/*
54 * Support macros.
55 */
56#define PCR(port, pin) (((port) * 16) + (pin))
57
58#if !defined(_FROM_ASM_)
59#ifdef __cplusplus
60extern "C" {
61#endif
62 void boardInit(void);
63#ifdef __cplusplus
64}
65#endif
66#endif /* _FROM_ASM_ */
67
68#endif /* _BOARD_H_ */
diff --git a/lib/chibios/os/hal/boards/ST_EVB_SPC560BC/board.mk b/lib/chibios/os/hal/boards/ST_EVB_SPC560BC/board.mk
new file mode 100644
index 000000000..8c979c85b
--- /dev/null
+++ b/lib/chibios/os/hal/boards/ST_EVB_SPC560BC/board.mk
@@ -0,0 +1,9 @@
1# List of all the board related files.
2BOARDSRC = ${CHIBIOS}/os/hal/boards/ST_EVB_SPC560BC/board.c
3
4# Required include directories
5BOARDINC = ${CHIBIOS}/os/hal/boards/ST_EVB_SPC560BC
6
7# Shared variables
8ALLCSRC += $(BOARDSRC)
9ALLINC += $(BOARDINC)