• R/O
  • SSH
  • HTTPS

chibios: Commit


Commit MetaInfo

Revision13098 (tree)
Time2019-10-15 22:18:54
Authorroccomarco

Log Message

Added ADICUP360 board files (Still incomplete)

Change Summary

Incremental Difference

--- trunk/os/hal/boards/ADICUP360/board.c (nonexistent)
+++ trunk/os/hal/boards/ADICUP360/board.c (revision 13098)
@@ -0,0 +1,154 @@
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+/*
18+ * This file has been automatically generated using ChibiStudio board
19+ * generator plugin. Do not edit manually.
20+ */
21+
22+#include "hal.h"
23+#include "aducm_gp.h"
24+
25+/*===========================================================================*/
26+/* Driver local definitions. */
27+/*===========================================================================*/
28+
29+/*===========================================================================*/
30+/* Driver exported variables. */
31+/*===========================================================================*/
32+
33+/*===========================================================================*/
34+/* Driver local variables and types. */
35+/*===========================================================================*/
36+
37+/**
38+ * @brief Type of ADUCM36x GP port setup.
39+ */
40+typedef struct {
41+ uint32_t con;
42+ uint32_t oen;
43+ uint32_t pul;
44+ uint32_t oce;
45+} gp_setup_t;
46+
47+/**
48+ * @brief Type of ADUCM36x GPIO initialization data.
49+ */
50+typedef struct {
51+ gp_setup_t GP0Data;
52+ gp_setup_t GP1Data;
53+ gp_setup_t GP2Data;
54+} gp_config_t;
55+
56+/**
57+ * @brief STM32 GPIO static initialization data.
58+ */
59+static const gp_config_t gp_default_config = {
60+ {VAL_GP0CON, VAL_GP0OEN, VAL_GP0PUL, VAL_GP0OCE},
61+ {VAL_GP1CON, VAL_GP1OEN, VAL_GP1PUL, VAL_GP1OCE},
62+ {VAL_GP2CON, VAL_GP2OEN, VAL_GP2PUL, VAL_GP2OCE}
63+};
64+
65+/*===========================================================================*/
66+/* Driver local functions. */
67+/*===========================================================================*/
68+
69+static void gp_init(aducm_gp_t *gpp, const gp_setup_t *config) {
70+
71+ gpp->CON = config->con;
72+ gpp->OEN = config->oen;
73+ gpp->PUL = config->pul;
74+ gpp->OCE = config->oce;
75+}
76+
77+static void aducm_gpio_init(void) {
78+
79+ /* Initializing all the defined GP ports.*/
80+ gp_init(GP0, &gp_default_config.GP0Data);
81+ gp_init(GP1, &gp_default_config.GP1Data);
82+ gp_init(GP2, &gp_default_config.GP2Data);
83+}
84+
85+/*===========================================================================*/
86+/* Driver interrupt handlers. */
87+/*===========================================================================*/
88+
89+/*===========================================================================*/
90+/* Driver exported functions. */
91+/*===========================================================================*/
92+
93+/**
94+ * @brief Early initialization code.
95+ * @details GP ports and system clocks are initialized before everything
96+ * else.
97+ */
98+void __early_init(void) {
99+
100+ aducm_gpio_init();
101+ aducm_clock_init();
102+}
103+
104+#if HAL_USE_SDC || defined(__DOXYGEN__)
105+/**
106+ * @brief SDC card detection.
107+ */
108+bool sdc_lld_is_card_inserted(SDCDriver *sdcp) {
109+
110+ (void)sdcp;
111+ /* CHTODO: Fill the implementation.*/
112+ return true;
113+}
114+
115+/**
116+ * @brief SDC card write protection detection.
117+ */
118+bool sdc_lld_is_write_protected(SDCDriver *sdcp) {
119+
120+ (void)sdcp;
121+ /* CHTODO: Fill the implementation.*/
122+ return false;
123+}
124+#endif /* HAL_USE_SDC */
125+
126+#if HAL_USE_MMC_SPI || defined(__DOXYGEN__)
127+/**
128+ * @brief MMC_SPI card detection.
129+ */
130+bool mmc_lld_is_card_inserted(MMCDriver *mmcp) {
131+
132+ (void)mmcp;
133+ /* CHTODO: Fill the implementation.*/
134+ return true;
135+}
136+
137+/**
138+ * @brief MMC_SPI card write protection detection.
139+ */
140+bool mmc_lld_is_write_protected(MMCDriver *mmcp) {
141+
142+ (void)mmcp;
143+ /* CHTODO: Fill the implementation.*/
144+ return false;
145+}
146+#endif
147+
148+/**
149+ * @brief Board-specific initialization code.
150+ * @note You can add your board-specific code here.
151+ */
152+void boardInit(void) {
153+
154+}
--- trunk/os/hal/boards/ADICUP360/board.h (nonexistent)
+++ trunk/os/hal/boards/ADICUP360/board.h (revision 13098)
@@ -0,0 +1,274 @@
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+/*
18+ * This file has been automatically generated using ChibiStudio board
19+ * generator plugin. Do not edit manually.
20+ */
21+
22+#ifndef BOARD_H
23+#define BOARD_H
24+
25+/*===========================================================================*/
26+/* Driver constants. */
27+/*===========================================================================*/
28+
29+/*
30+ * Setup for STMicroelectronics STM32 Nucleo64-F401RE board.
31+ */
32+
33+/*
34+ * Board identifier.
35+ */
36+#define BOARD_ADICUP360
37+#define BOARD_NAME "Analog Devices ADICUP360"
38+
39+/*
40+ * Board oscillators-related settings.
41+ */
42+#if !defined(ADUCM_LFXTAL)
43+#define ADUCM_LFXTAL 32768U
44+#endif
45+
46+/*
47+ * MCU type as defined in the ADI header.
48+ */
49+#define ADUCM360
50+
51+/*
52+ * IO pins assignments.
53+ */
54+#define GP0_0 0U
55+#define GP0_1 1U
56+#define GP0_2 2U
57+#define GP0_3 3U
58+#define GP0_4 4U
59+#define GP0_LED_BLUE 4U
60+#define GP0_5 5U
61+#define GP0_LED_GREEN 5U
62+#define GP0_6 6U
63+#define GP0_7 7U
64+#define GP0_NPOR 7U
65+
66+#define GP1_0 0U
67+#define GP1_1 1U
68+#define GP1_2 2U
69+#define GP1_3 3U
70+#define GP1_4 4U
71+#define GP1_5 5U
72+#define GP1_6 6U
73+#define GP1_7 7U
74+
75+#define GP2_0 0U
76+#define GP2_1 1U
77+#define GP2_2 2U
78+#define GP2_3 3U
79+#define GP2_SWCLK 3U
80+#define GP2_4 4U
81+#define GP2_SWD 4U
82+#define GP2_5 5U
83+#define GP2_6 6U
84+#define GP2_7 7U
85+
86+
87+/*
88+ * IO lines assignments.
89+ */
90+#define LINE_LED_BLUE PAL_LINE(GP0, 4U)
91+#define LINE_LED_GREEN PAL_LINE(GP0, 5U)
92+#define LINE_LED_NPOR PAL_LINE(GP0, 7U)
93+#define LINE_LED_SWCLK PAL_LINE(GP2, 3U)
94+#define LINE_LED_SWD PAL_LINE(GP2, 4U)
95+
96+/*===========================================================================*/
97+/* Driver pre-compile time settings. */
98+/*===========================================================================*/
99+
100+/*===========================================================================*/
101+/* Derived constants and error checks. */
102+/*===========================================================================*/
103+
104+/*===========================================================================*/
105+/* Driver data structures and types. */
106+/*===========================================================================*/
107+
108+/*===========================================================================*/
109+/* Driver macros. */
110+/*===========================================================================*/
111+
112+/*
113+ * I/O ports initial setup, this configuration is established soon after reset
114+ * in the initialization code.
115+ * Please refer to the ADUCM360 Reference Manual for details.
116+ */
117+#define PIN_CON_CON(n, v) ((v) << (n * 2U))
118+#define PIN_OEN_INPUT(n) (0U << (n))
119+#define PIN_OEN_OUTPUT(n) (1U << (n))
120+#define PIN_PUL_FLOATING(n) (0U << (n))
121+#define PIN_PUL_PULLUP(n) (1U << (n))
122+#define PIN_OCE_NORMAL(n) (0U << (n))
123+#define PIN_OCE_HIGHZ(n) (1U << (n))
124+
125+/*
126+ * P0 setup:
127+ *
128+ * P0.0 - PIN0 (CON0, GPIO - input pullup).
129+ * P0.1 - PIN1 (CON0, GPIO - input pullup).
130+ * P0.2 - PIN2 (CON0, GPIO - input pullup).
131+ * P0.3 - PIN3 (CON0, GPIO - input pullup).
132+ * P0.4 - LED_BLUE (CON0, GPIO - output floating).
133+ * P0.5 - LED_GREEN (CON0, GPIO - output floating).
134+ * P0.6 - PIN6 (CON0, GPIO - input pullup).
135+ * P0.7 - NPOR (CON0, NPOR).
136+ */
137+#define VAL_GP0CON (PIN_CON_CON(GP0_0, 0) | \
138+ PIN_CON_CON(GP0_1, 0) | \
139+ PIN_CON_CON(GP0_2, 0) | \
140+ PIN_CON_CON(GP0_3, 0) | \
141+ PIN_CON_CON(GP0_LED_BLUE, 0) | \
142+ PIN_CON_CON(GP0_LED_GREEN, 0) | \
143+ PIN_CON_CON(GP0_6, 0) | \
144+ PIN_CON_CON(GP0_NPOR, 0))
145+#define VAL_GP0OEN (PIN_OEN_INPUT(GP0_0) | \
146+ PIN_OEN_INPUT(GP0_1) | \
147+ PIN_OEN_INPUT(GP0_2) | \
148+ PIN_OEN_INPUT(GP0_3) | \
149+ PIN_OEN_OUTPUT(GP0_LED_BLUE) | \
150+ PIN_OEN_OUTPUT(GP0_LED_GREEN) | \
151+ PIN_OEN_INPUT(GP0_6) | \
152+ PIN_OEN_INPUT(GP0_NPOR))
153+#define VAL_GP0PUL (PIN_PUL_PULLUP(GP0_0) | \
154+ PIN_PUL_PULLUP(GP0_1) | \
155+ PIN_PUL_PULLUP(GP0_2) | \
156+ PIN_PUL_PULLUP(GP0_3) | \
157+ PIN_PUL_FLOATING(GP0_LED_BLUE) | \
158+ PIN_PUL_FLOATING(GP0_LED_GREEN) | \
159+ PIN_PUL_PULLUP(GP0_6) | \
160+ PIN_PUL_PULLUP(GP0_NPOR))
161+#define VAL_GP0OCE (PIN_OCE_NORMAL(GP0_0) | \
162+ PIN_OCE_NORMAL(GP0_1) | \
163+ PIN_OCE_NORMAL(GP0_2) | \
164+ PIN_OCE_NORMAL(GP0_3) | \
165+ PIN_OCE_NORMAL(GP0_LED_BLUE) | \
166+ PIN_OCE_NORMAL(GP0_LED_GREEN) | \
167+ PIN_OCE_NORMAL(GP0_6) | \
168+ PIN_OCE_NORMAL(GP0_NPOR))
169+
170+/*
171+ * P1 setup:
172+ *
173+ * P1.0 - PIN0 (CON0, GPIO - input pullup).
174+ * P1.1 - PIN1 (CON0, GPIO - input pullup).
175+ * P1.2 - PIN2 (CON0, GPIO - input pullup).
176+ * P1.3 - PIN3 (CON0, GPIO - input pullup).
177+ * P1.4 - PIN4 (CON0, GPIO - input pullup).
178+ * P1.5 - PIN5 (CON0, GPIO - input pullup).
179+ * P1.6 - PIN6 (CON0, GPIO - input pullup).
180+ * P1.7 - PIN7 (CON0, GPIO - input pullup).
181+ */
182+#define VAL_GP1CON (PIN_CON_CON(GP1_0, 0) | \
183+ PIN_CON_CON(GP1_1, 0) | \
184+ PIN_CON_CON(GP1_2, 0) | \
185+ PIN_CON_CON(GP1_3, 0) | \
186+ PIN_CON_CON(GP1_4, 0) | \
187+ PIN_CON_CON(GP1_5, 0) | \
188+ PIN_CON_CON(GP1_6, 0) | \
189+ PIN_CON_CON(GP1_7, 0))
190+#define VAL_GP1OEN (PIN_OEN_INPUT(GP1_0) | \
191+ PIN_OEN_INPUT(GP1_1) | \
192+ PIN_OEN_INPUT(GP1_2) | \
193+ PIN_OEN_INPUT(GP1_3) | \
194+ PIN_OEN_INPUT(GP1_4) | \
195+ PIN_OEN_INPUT(GP1_5) | \
196+ PIN_OEN_INPUT(GP1_6) | \
197+ PIN_OEN_INPUT(GP1_7))
198+#define VAL_GP1PUL (PIN_PUL_PULLUP(GP1_0) | \
199+ PIN_PUL_PULLUP(GP1_1) | \
200+ PIN_PUL_PULLUP(GP1_2) | \
201+ PIN_PUL_PULLUP(GP1_3) | \
202+ PIN_PUL_PULLUP(GP1_4) | \
203+ PIN_PUL_PULLUP(GP1_5) | \
204+ PIN_PUL_PULLUP(GP1_6) | \
205+ PIN_PUL_PULLUP(GP1_7))
206+#define VAL_GP1OCE (PIN_OCE_NORMAL(GP1_0) | \
207+ PIN_OCE_NORMAL(GP1_1) | \
208+ PIN_OCE_NORMAL(GP1_2) | \
209+ PIN_OCE_NORMAL(GP1_3) | \
210+ PIN_OCE_NORMAL(GP1_4) | \
211+ PIN_OCE_NORMAL(GP1_5) | \
212+ PIN_OCE_NORMAL(GP1_6) | \
213+ PIN_OCE_NORMAL(GP1_7))
214+
215+/*
216+ * P2 setup:
217+ *
218+ * P2.0 - PIN0 (CON0, GPIO - input pullup).
219+ * P2.1 - PIN1 (CON0, GPIO - input pullup).
220+ * P2.2 - PIN2 (CON0, GPIO - input pullup).
221+ * P2.3 - SWCLK (CON0, SWCLK).
222+ * P2.4 - SWD (CON0, SWD).
223+ * P2.5 - PIN5 (CON0, GPIO - input pullup).
224+ * P2.6 - PIN6 (CON0, GPIO - input pullup).
225+ * P2.7 - PIN7 (CON0, GPIO - input pullup).
226+ */
227+#define VAL_GP2CON (PIN_CON_CON(GP2_0, 0) | \
228+ PIN_CON_CON(GP2_1, 0) | \
229+ PIN_CON_CON(GP2_2, 0) | \
230+ PIN_CON_CON(GP2_SWCLK, 0) | \
231+ PIN_CON_CON(GP2_SWD, 0) | \
232+ PIN_CON_CON(GP2_5, 0) | \
233+ PIN_CON_CON(GP2_6, 0) | \
234+ PIN_CON_CON(GP2_7, 0))
235+#define VAL_GP2OEN (PIN_OEN_INPUT(GP2_0) | \
236+ PIN_OEN_INPUT(GP2_1) | \
237+ PIN_OEN_INPUT(GP2_2) | \
238+ PIN_OEN_INPUT(GP2_SWCLK) | \
239+ PIN_OEN_INPUT(GP2_SWD) | \
240+ PIN_OEN_INPUT(GP2_5) | \
241+ PIN_OEN_INPUT(GP2_6) | \
242+ PIN_OEN_INPUT(GP2_7))
243+#define VAL_GP2PUL (PIN_PUL_PULLUP(GP2_0) | \
244+ PIN_PUL_PULLUP(GP2_1) | \
245+ PIN_PUL_PULLUP(GP2_2) | \
246+ PIN_PUL_PULLUP(GP2_SWCLK) | \
247+ PIN_PUL_PULLUP(GP2_SWD) | \
248+ PIN_PUL_PULLUP(GP2_5) | \
249+ PIN_PUL_PULLUP(GP2_6) | \
250+ PIN_PUL_PULLUP(GP2_7))
251+#define VAL_GP2OCE (PIN_OCE_NORMAL(GP2_0) | \
252+ PIN_OCE_NORMAL(GP2_1) | \
253+ PIN_OCE_NORMAL(GP2_2) | \
254+ PIN_OCE_NORMAL(GP2_SWCLK) | \
255+ PIN_OCE_NORMAL(GP2_SWD) | \
256+ PIN_OCE_NORMAL(GP2_5) | \
257+ PIN_OCE_NORMAL(GP2_6) | \
258+ PIN_OCE_NORMAL(GP2_7))
259+
260+/*===========================================================================*/
261+/* External declarations. */
262+/*===========================================================================*/
263+
264+#if !defined(_FROM_ASM_)
265+#ifdef __cplusplus
266+extern "C" {
267+#endif
268+ void boardInit(void);
269+#ifdef __cplusplus
270+}
271+#endif
272+#endif /* _FROM_ASM_ */
273+
274+#endif /* BOARD_H */
Show on old repository browser