Skip to content

Commit 86549a3

Browse files
author
Owen L - SFE
committed
copy variants from bsp
1 parent 3e8fc69 commit 86549a3

File tree

26 files changed

+447
-104
lines changed

26 files changed

+447
-104
lines changed

variants/artemis/bsp/am_bsp.c

Lines changed: 31 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ am_devices_button_t am_bsp_psButtons[AM_BSP_NUM_BUTTONS] =
8686
// Print interface tracking variable.
8787
//
8888
//*****************************************************************************
89-
static uint32_t g_ui32PrintInterface = AM_BSP_PRINT_INFC_NONE;
89+
static uint32_t g_ui32PrintInterface = AM_BSP_PRINT_INFC_UART0;
9090

9191
//*****************************************************************************
9292
//
@@ -172,12 +172,6 @@ static am_hal_uart_config_t g_sBspUartBufferedConfig =
172172
void
173173
am_bsp_low_power_init(void)
174174
{
175-
//
176-
// Make sure SWO/ITM/TPIU is disabled.
177-
// SBL may not get it completely shut down.
178-
//
179-
am_bsp_itm_printf_disable();
180-
181175
//
182176
// Initialize for low power in the power control block
183177
//
@@ -194,9 +188,10 @@ am_bsp_low_power_init(void)
194188
am_hal_clkgen_control(AM_HAL_CLKGEN_CONTROL_XTAL_STOP, 0);
195189

196190
//
197-
// Disable the RTC.
191+
// Make sure SWO/ITM/TPIU is disabled.
192+
// SBL may not get it completely shut down.
198193
//
199-
am_hal_rtc_osc_disable();
194+
am_bsp_itm_printf_disable();
200195

201196
#ifdef AM_BSP_NUM_LEDS
202197
//
@@ -241,7 +236,9 @@ am_bsp_debug_printf_enable(void)
241236
{
242237
if (g_ui32PrintInterface == AM_BSP_PRINT_INFC_SWO)
243238
{
239+
#ifdef AM_BSP_GPIO_ITM_SWO
244240
am_bsp_itm_printf_enable();
241+
#endif
245242
}
246243
else if (g_ui32PrintInterface == AM_BSP_PRINT_INFC_UART0)
247244
{
@@ -284,7 +281,11 @@ am_bsp_debug_printf_disable(void)
284281
//
285282
//*****************************************************************************
286283
void
284+
#ifdef AM_BSP_GPIO_ITM_SWO
287285
am_bsp_itm_printf_enable(void)
286+
#else
287+
am_bsp_itm_printf_enable(uint32_t ui32Pin, am_hal_gpio_pincfg_t sPincfg)
288+
#endif
288289
{
289290
am_hal_tpiu_config_t TPIUcfg;
290291

@@ -297,22 +298,40 @@ am_bsp_itm_printf_enable(void)
297298
// Enable the ITM interface and the SWO pin.
298299
//
299300
am_hal_itm_enable();
300-
// am_hal_gpio_pinconfig(AM_BSP_GPIO_ITM_SWO, g_AM_BSP_GPIO_ITM_SWO);
301301

302302
//
303303
// Enable the ITM and TPIU
304304
// Set the BAUD clock for 1M
305305
//
306-
TPIUcfg.ui32SetItmBaud = AM_HAL_TPIU_BAUD_1M;
306+
TPIUcfg.ui32SetItmBaud = AM_HAL_TPIU_BAUD_2M;
307307
am_hal_tpiu_enable(&TPIUcfg);
308-
// am_hal_gpio_pinconfig(AM_BSP_GPIO_ITM_SWO, g_AM_BSP_GPIO_ITM_SWO);
308+
#ifdef AM_BSP_GPIO_ITM_SWO
309+
am_hal_gpio_pinconfig(AM_BSP_GPIO_ITM_SWO, g_AM_BSP_GPIO_ITM_SWO);
310+
#else
311+
am_hal_gpio_pinconfig(ui32Pin, sPincfg);
312+
#endif
309313

310314
//
311315
// Attach the ITM to the STDIO driver.
312316
//
313317
am_util_stdio_printf_init(am_hal_itm_print);
314318
} // am_bsp_itm_printf_enable()
315319

320+
//*****************************************************************************
321+
//
322+
//! @brief ITM-based string print function.
323+
//!
324+
//! This function is used for printing a string via the ITM.
325+
//!
326+
//! @return None.
327+
//
328+
//*****************************************************************************
329+
void
330+
am_bsp_itm_string_print(char *pcString)
331+
{
332+
am_hal_itm_print(pcString);
333+
}
334+
316335
//*****************************************************************************
317336
//
318337
// @brief Disable printing over ITM.

variants/artemis/bsp/am_bsp.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,12 @@ extern void am_bsp_ios_pins_disable(uint32_t ui32Module, uint32_t ui32IOSMode);
155155
extern void am_bsp_debug_printf_enable(void);
156156
extern void am_bsp_debug_printf_disable(void);
157157

158-
extern void am_bsp_itm_string_print(char *pcString);
158+
#ifdef AM_BSP_GPIO_ITM_SWO
159159
extern void am_bsp_itm_printf_enable(void);
160+
#else
161+
extern void am_bsp_itm_printf_enable(uint32_t ui32Pin, am_hal_gpio_pincfg_t sPincfg);
162+
#endif
163+
extern void am_bsp_itm_string_print(char *pcString);
160164
extern void am_bsp_itm_printf_disable(void);
161165

162166
extern void am_bsp_uart_string_print(char *pcString);

variants/artemis_thing_plus/bsp/am_bsp.c

Lines changed: 31 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ am_devices_button_t am_bsp_psButtons[AM_BSP_NUM_BUTTONS] =
8989
// Print interface tracking variable.
9090
//
9191
//*****************************************************************************
92-
static uint32_t g_ui32PrintInterface = AM_BSP_PRINT_INFC_NONE;
92+
static uint32_t g_ui32PrintInterface = AM_BSP_PRINT_INFC_UART0;
9393

9494
//*****************************************************************************
9595
//
@@ -175,12 +175,6 @@ static am_hal_uart_config_t g_sBspUartBufferedConfig =
175175
void
176176
am_bsp_low_power_init(void)
177177
{
178-
//
179-
// Make sure SWO/ITM/TPIU is disabled.
180-
// SBL may not get it completely shut down.
181-
//
182-
am_bsp_itm_printf_disable();
183-
184178
//
185179
// Initialize for low power in the power control block
186180
//
@@ -197,9 +191,10 @@ am_bsp_low_power_init(void)
197191
am_hal_clkgen_control(AM_HAL_CLKGEN_CONTROL_XTAL_STOP, 0);
198192

199193
//
200-
// Disable the RTC.
194+
// Make sure SWO/ITM/TPIU is disabled.
195+
// SBL may not get it completely shut down.
201196
//
202-
am_hal_rtc_osc_disable();
197+
am_bsp_itm_printf_disable();
203198

204199
#ifdef AM_BSP_NUM_LEDS
205200
//
@@ -244,7 +239,9 @@ am_bsp_debug_printf_enable(void)
244239
{
245240
if (g_ui32PrintInterface == AM_BSP_PRINT_INFC_SWO)
246241
{
242+
#ifdef AM_BSP_GPIO_ITM_SWO
247243
am_bsp_itm_printf_enable();
244+
#endif
248245
}
249246
else if (g_ui32PrintInterface == AM_BSP_PRINT_INFC_UART0)
250247
{
@@ -287,7 +284,11 @@ am_bsp_debug_printf_disable(void)
287284
//
288285
//*****************************************************************************
289286
void
287+
#ifdef AM_BSP_GPIO_ITM_SWO
290288
am_bsp_itm_printf_enable(void)
289+
#else
290+
am_bsp_itm_printf_enable(uint32_t ui32Pin, am_hal_gpio_pincfg_t sPincfg)
291+
#endif
291292
{
292293
am_hal_tpiu_config_t TPIUcfg;
293294

@@ -300,22 +301,40 @@ am_bsp_itm_printf_enable(void)
300301
// Enable the ITM interface and the SWO pin.
301302
//
302303
am_hal_itm_enable();
303-
// am_hal_gpio_pinconfig(AM_BSP_GPIO_ITM_SWO, g_AM_BSP_GPIO_ITM_SWO);
304304

305305
//
306306
// Enable the ITM and TPIU
307307
// Set the BAUD clock for 1M
308308
//
309-
TPIUcfg.ui32SetItmBaud = AM_HAL_TPIU_BAUD_1M;
309+
TPIUcfg.ui32SetItmBaud = AM_HAL_TPIU_BAUD_2M;
310310
am_hal_tpiu_enable(&TPIUcfg);
311-
// am_hal_gpio_pinconfig(AM_BSP_GPIO_ITM_SWO, g_AM_BSP_GPIO_ITM_SWO);
311+
#ifdef AM_BSP_GPIO_ITM_SWO
312+
am_hal_gpio_pinconfig(AM_BSP_GPIO_ITM_SWO, g_AM_BSP_GPIO_ITM_SWO);
313+
#else
314+
am_hal_gpio_pinconfig(ui32Pin, sPincfg);
315+
#endif
312316

313317
//
314318
// Attach the ITM to the STDIO driver.
315319
//
316320
am_util_stdio_printf_init(am_hal_itm_print);
317321
} // am_bsp_itm_printf_enable()
318322

323+
//*****************************************************************************
324+
//
325+
//! @brief ITM-based string print function.
326+
//!
327+
//! This function is used for printing a string via the ITM.
328+
//!
329+
//! @return None.
330+
//
331+
//*****************************************************************************
332+
void
333+
am_bsp_itm_string_print(char *pcString)
334+
{
335+
am_hal_itm_print(pcString);
336+
}
337+
319338
//*****************************************************************************
320339
//
321340
// @brief Disable printing over ITM.

variants/artemis_thing_plus/bsp/am_bsp.h

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -98,13 +98,16 @@ extern "C"
9898
#define AM_BSP_QWIIC_I2C_SCL_PIN AM_BSP_GPIO_IOM4_SCL
9999

100100

101-
// //*****************************************************************************
102-
// //
103-
// // Button definitions.
104-
// //
105-
// //*****************************************************************************
106-
// #define AM_BSP_NUM_BUTTONS 0
107-
// extern am_devices_button_t am_bsp_psButtons[AM_BSP_NUM_BUTTONS];
101+
//*****************************************************************************
102+
//
103+
// Button definitions.
104+
//
105+
//*****************************************************************************
106+
#define AM_BSP_NUM_BUTTONS 1
107+
extern am_devices_button_t am_bsp_psButtons[AM_BSP_NUM_BUTTONS];
108+
109+
#define AM_BSP_GPIO_BUTTON10 AM_BSP_GPIO_BUTTON0
110+
#define AM_BSP_GPIO_SWCH AM_BSP_GPIO_BUTTON0
108111

109112

110113
//*****************************************************************************
@@ -115,6 +118,11 @@ extern "C"
115118
#define AM_BSP_NUM_LEDS 1
116119
extern am_devices_led_t am_bsp_psLEDs[AM_BSP_NUM_LEDS];
117120

121+
// LED Device Array Indices
122+
#define AM_BSP_LED0 0
123+
#define AM_BSP_LED_BLUE AM_BSP_LED0
124+
125+
// Corresponding GPIO Numbers
118126
#define AM_BSP_GPIO_LED AM_BSP_GPIO_LED_BLUE
119127
#define AM_BSP_GPIO_LED0 AM_BSP_GPIO_LED_BLUE
120128
#define AM_BSP_GPIO_LED18 AM_BSP_GPIO_LED_BLUE
@@ -200,8 +208,12 @@ extern void am_bsp_ios_pins_disable(uint32_t ui32Module, uint32_t ui32IOSMode);
200208
extern void am_bsp_debug_printf_enable(void);
201209
extern void am_bsp_debug_printf_disable(void);
202210

203-
extern void am_bsp_itm_string_print(char *pcString);
211+
#ifdef AM_BSP_GPIO_ITM_SWO
204212
extern void am_bsp_itm_printf_enable(void);
213+
#else
214+
extern void am_bsp_itm_printf_enable(uint32_t ui32Pin, am_hal_gpio_pincfg_t sPincfg);
215+
#endif
216+
extern void am_bsp_itm_string_print(char *pcString);
205217
extern void am_bsp_itm_printf_disable(void);
206218

207219
extern void am_bsp_uart_string_print(char *pcString);

variants/artemis_thing_plus/bsp/am_bsp_pins.c

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ const am_hal_gpio_pincfg_t g_AM_BSP_GPIO_MIC_CLK =
7474

7575
//*****************************************************************************
7676
//
77-
// LED_BLUE pin: The BLUE LED.
77+
// LED_BLUE pin: The BLUE LED labelled 18.
7878
//
7979
//*****************************************************************************
8080
const am_hal_gpio_pincfg_t g_AM_BSP_GPIO_LED_BLUE =
@@ -83,6 +83,19 @@ const am_hal_gpio_pincfg_t g_AM_BSP_GPIO_LED_BLUE =
8383
.eDriveStrength = AM_HAL_GPIO_PIN_DRIVESTRENGTH_12MA
8484
};
8585

86+
//*****************************************************************************
87+
//
88+
// BUTTON0 pin: Labeled 10 on the Artemis Thing Plus.
89+
//
90+
//*****************************************************************************
91+
const am_hal_gpio_pincfg_t g_AM_BSP_GPIO_BUTTON0 =
92+
{
93+
.uFuncSel = AM_HAL_PIN_14_GPIO,
94+
.ePullup = AM_HAL_GPIO_PIN_PULLUP_1_5K,
95+
.eDriveStrength = AM_HAL_GPIO_PIN_DRIVESTRENGTH_2MA,
96+
.eGPInput = AM_HAL_GPIO_PIN_INPUT_ENABLE
97+
};
98+
8699
//*****************************************************************************
87100
//
88101
// COM_UART_TX pin: This pin is the COM_UART transmit pin.
@@ -821,6 +834,17 @@ const am_hal_gpio_pincfg_t g_AM_BSP_GPIO_IOS_SDA =
821834
.eGPOutcfg = AM_HAL_GPIO_PIN_OUTCFG_OPENDRAIN
822835
};
823836

837+
//*****************************************************************************
838+
//
839+
// ITM_SWO pin: ITM Serial Wire Output.
840+
//
841+
//*****************************************************************************
842+
const am_hal_gpio_pincfg_t g_AM_BSP_GPIO_ITM_SWO =
843+
{
844+
.uFuncSel = AM_HAL_PIN_33_SWO,
845+
.eDriveStrength = AM_HAL_GPIO_PIN_DRIVESTRENGTH_2MA
846+
};
847+
824848
//*****************************************************************************
825849
//
826850
// SWDCK pin: Cortex Serial Wire DCK.

variants/artemis_thing_plus/bsp/am_bsp_pins.h

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,12 +80,20 @@ extern const am_hal_gpio_pincfg_t g_AM_BSP_GPIO_MIC_CLK;
8080

8181
//*****************************************************************************
8282
//
83-
// LED_BLUE pin: The BLUE LED.
83+
// LED_BLUE pin: The BLUE LED labelled 18.
8484
//
8585
//*****************************************************************************
8686
#define AM_BSP_GPIO_LED_BLUE 26
8787
extern const am_hal_gpio_pincfg_t g_AM_BSP_GPIO_LED_BLUE;
8888

89+
//*****************************************************************************
90+
//
91+
// BUTTON0 pin: Labeled 10 on the Artemis Thing Plus.
92+
//
93+
//*****************************************************************************
94+
#define AM_BSP_GPIO_BUTTON0 14
95+
extern const am_hal_gpio_pincfg_t g_AM_BSP_GPIO_BUTTON0;
96+
8997
//*****************************************************************************
9098
//
9199
// COM_UART_TX pin: This pin is the COM_UART transmit pin.
@@ -544,6 +552,14 @@ extern const am_hal_gpio_pincfg_t g_AM_BSP_GPIO_IOS_SCL;
544552
#define AM_BSP_GPIO_IOS_SDA 1
545553
extern const am_hal_gpio_pincfg_t g_AM_BSP_GPIO_IOS_SDA;
546554

555+
//*****************************************************************************
556+
//
557+
// ITM_SWO pin: ITM Serial Wire Output.
558+
//
559+
//*****************************************************************************
560+
#define AM_BSP_GPIO_ITM_SWO 33
561+
extern const am_hal_gpio_pincfg_t g_AM_BSP_GPIO_ITM_SWO;
562+
547563
//*****************************************************************************
548564
//
549565
// SWDCK pin: Cortex Serial Wire DCK.

0 commit comments

Comments
 (0)