From 53beec60fc922f30f1b2ffb2ede5b240d2961635 Mon Sep 17 00:00:00 2001 From: Fredrik Thulin Date: Wed, 2 Sep 2015 16:47:41 +0200 Subject: remove CR and trailing whitespace --- src/fmc-test/src/main.c | 566 ++++++++++++++++++++++++------------------------ 1 file changed, 283 insertions(+), 283 deletions(-) diff --git a/src/fmc-test/src/main.c b/src/fmc-test/src/main.c index 705a04f..ca3ae18 100644 --- a/src/fmc-test/src/main.c +++ b/src/fmc-test/src/main.c @@ -1,283 +1,283 @@ -//------------------------------------------------------------------------------ -// main.c -//------------------------------------------------------------------------------ - - -//------------------------------------------------------------------------------ -// Headers -//------------------------------------------------------------------------------ -#include "stm32f4xx_hal.h" -#include "stm-fmc.h" - - -//------------------------------------------------------------------------------ -// Defines -//------------------------------------------------------------------------------ -#define GPIO_PORT_LEDS GPIOJ - -#define GPIO_PIN_LED_RED GPIO_PIN_1 -#define GPIO_PIN_LED_YELLOW GPIO_PIN_2 -#define GPIO_PIN_LED_GREEN GPIO_PIN_3 -#define GPIO_PIN_LED_BLUE GPIO_PIN_4 - - -//------------------------------------------------------------------------------ -// Macros -//------------------------------------------------------------------------------ -#define led_on(pin) HAL_GPIO_WritePin(GPIO_PORT_LEDS,pin,GPIO_PIN_SET) -#define led_off(pin) HAL_GPIO_WritePin(GPIO_PORT_LEDS,pin,GPIO_PIN_RESET) -#define led_toggle(pin) HAL_GPIO_TogglePin(GPIO_PORT_LEDS,pin) - - -//------------------------------------------------------------------------------ -// Variables -//------------------------------------------------------------------------------ -RNG_HandleTypeDef rng_inst; - - - -//------------------------------------------------------------------------------ -// Prototypes -//------------------------------------------------------------------------------ -void SystemClock_Config(void); - -static void MX_RNG_Init(void); -static void MX_GPIO_Init(void); - -int test_fpga_data_bus(void); -int test_fpga_address_bus(void); - - -//------------------------------------------------------------------------------ -// Defines -//------------------------------------------------------------------------------ -#define TEST_NUM_ROUNDS 100000 - - -//------------------------------------------------------------------------------ -int main(void) -//------------------------------------------------------------------------------ -{ - // initialize hal - HAL_Init(); - - // configure system clock - SystemClock_Config(); - - // initialize gpio - MX_GPIO_Init(); - - // initialize rng - MX_RNG_Init(); - - // prepare fmc interface - fmc_init(); - - // turn on green led, turn off other leds - led_on(GPIO_PIN_LED_GREEN); - led_off(GPIO_PIN_LED_YELLOW); - led_off(GPIO_PIN_LED_RED); - led_off(GPIO_PIN_LED_BLUE); - - // vars - int test_ok; - - // main loop (test, until an error is detected) - while (1) - { - // test data bus - test_ok = test_fpga_data_bus(); - - // check for errors (abort testing in case of error) - if (test_ok < TEST_NUM_ROUNDS) /*break*/; - - - // test address bus - test_ok = test_fpga_address_bus(); - - // check for errors (abort testing in case of error) - if (test_ok < TEST_NUM_ROUNDS) /*break*/; - - // toggle yellow led to indicate, that we are alive - led_toggle(GPIO_PIN_LED_YELLOW); - } - - // error handler - while (1) - { - // turn on red led, turn off other leds - led_on(GPIO_PIN_LED_RED); - led_off(GPIO_PIN_LED_GREEN); - led_off(GPIO_PIN_LED_YELLOW); - led_off(GPIO_PIN_LED_BLUE); - } - - // should never reach this line -} - - -//------------------------------------------------------------------------------ -int test_fpga_data_bus(void) -//------------------------------------------------------------------------------ -{ - int c, ok; - uint32_t rnd, buf; - HAL_StatusTypeDef hal_result; - - // run some rounds of data bus test - for (c=0; c