fixed some remaining bugs

sipo
Ondřej Hruška 7 years ago
parent ab2dfe3a76
commit a5d9635cee
Signed by: MightyPork
GPG Key ID: 2C5FD5035250423D
  1. 6
      platform/debug_uart.c
  2. 3
      platform/lock_jumper.c
  3. 80
      platform/platform.c
  4. 3
      platform/status_led.c
  5. 2
      utils/error.h

@ -13,10 +13,8 @@
void DebugUart_Init(void)
{
// Debug UART
bool ok = true;
ok &= rsc_claim(&UNIT_SYSTEM, R_USART2);
ok &= rsc_claim(&UNIT_SYSTEM, R_PA2);
assert_param(ok);
assert_param(E_SUCCESS == rsc_claim(&UNIT_SYSTEM, R_USART2));
assert_param(E_SUCCESS == rsc_claim(&UNIT_SYSTEM, R_PA2));
}
/** Init the hardware peripheral - this is called early in the boot process */

@ -33,8 +33,7 @@ void LockJumper_Init(void)
Resource rsc = pin2resource(LOCK_JUMPER_PORT, LOCK_JUMPER_PIN, &suc);
assert_param(suc);
suc &= rsc_claim(&UNIT_SYSTEM, rsc);
assert_param(suc);
assert_param(E_SUCCESS == rsc_claim(&UNIT_SYSTEM, rsc));
// Resolve pin
lock_periph = port2periph(LOCK_JUMPER_PORT, &suc);

@ -16,6 +16,8 @@
void plat_init_resources(void)
{
uint32_t rv = 0;
__HAL_RCC_GPIOA_CLK_ENABLE();
__HAL_RCC_GPIOB_CLK_ENABLE();
__HAL_RCC_GPIOC_CLK_ENABLE();
@ -50,23 +52,19 @@ void plat_init_resources(void)
// Claim resources not available due to board layout or internal usage
{
bool ok = true;
// HAL timebase
ok &= rsc_claim(&UNIT_SYSTEM, R_TIM1);
rv |= rsc_claim(&UNIT_SYSTEM, R_TIM1);
// HSE crystal
ok &= rsc_claim(&UNIT_SYSTEM, R_PD0);
ok &= rsc_claim(&UNIT_SYSTEM, R_PD1);
rv |= rsc_claim(&UNIT_SYSTEM, R_PD0);
rv |= rsc_claim(&UNIT_SYSTEM, R_PD1);
// SWD
ok &= rsc_claim(&UNIT_SYSTEM, R_PA13);
ok &= rsc_claim(&UNIT_SYSTEM, R_PA14);
rv |= rsc_claim(&UNIT_SYSTEM, R_PA13);
rv |= rsc_claim(&UNIT_SYSTEM, R_PA14);
// USB
ok &= rsc_claim(&UNIT_SYSTEM, R_PA11);
ok &= rsc_claim(&UNIT_SYSTEM, R_PA12);
rv |= rsc_claim(&UNIT_SYSTEM, R_PA11);
rv |= rsc_claim(&UNIT_SYSTEM, R_PA12);
// BOOT pin(s)
ok &= rsc_claim(&UNIT_SYSTEM, R_PB2); // BOOT1
assert_param(ok);
rv |= rsc_claim(&UNIT_SYSTEM, R_PB2); // BOOT1
}
#elif defined(GEX_PLAT_F072_DISCOVERY)
// Platform STM32F073RBT
@ -105,23 +103,19 @@ void plat_init_resources(void)
// Claim resources not available due to board layout or internal usage
{
bool ok = true;
// HAL timebase
ok &= rsc_claim(&UNIT_SYSTEM, R_TIM1);
rv |= rsc_claim(&UNIT_SYSTEM, R_TIM1);
// HSE crystal
ok &= rsc_claim(&UNIT_SYSTEM, R_PF0);
//ok &= rsc_claim(&UNIT_SYSTEM, R_PF1); // - not used in BYPASS mode
rv |= rsc_claim(&UNIT_SYSTEM, R_PF0);
//rv |= rsc_claim(&UNIT_SYSTEM, R_PF1); // - not used in BYPASS mode
// SWD
ok &= rsc_claim(&UNIT_SYSTEM, R_PA13);
ok &= rsc_claim(&UNIT_SYSTEM, R_PA14);
rv |= rsc_claim(&UNIT_SYSTEM, R_PA13);
rv |= rsc_claim(&UNIT_SYSTEM, R_PA14);
// USB
ok &= rsc_claim(&UNIT_SYSTEM, R_PA11);
ok &= rsc_claim(&UNIT_SYSTEM, R_PA12);
rv |= rsc_claim(&UNIT_SYSTEM, R_PA11);
rv |= rsc_claim(&UNIT_SYSTEM, R_PA12);
// BOOT pin(s)
ok &= rsc_claim(&UNIT_SYSTEM, R_PB2); // BOOT1
assert_param(ok);
rv |= rsc_claim(&UNIT_SYSTEM, R_PB2); // BOOT1
}
#elif defined(GEX_PLAT_F303_DISCOVERY)
// Platform STM32F303VCT
@ -162,23 +156,19 @@ void plat_init_resources(void)
// Claim resources not available due to board layout or internal usage
{
bool ok = true;
// HAL timebase
ok &= rsc_claim(&UNIT_SYSTEM, R_TIM1);
rv |= rsc_claim(&UNIT_SYSTEM, R_TIM1);
// HSE crystal
ok &= rsc_claim(&UNIT_SYSTEM, R_PF0);
//ok &= rsc_claim(&UNIT_SYSTEM, R_PF1); // - not used in BYPASS mode
rv |= rsc_claim(&UNIT_SYSTEM, R_PF0);
//rv |= rsc_claim(&UNIT_SYSTEM, R_PF1); // - not used in BYPASS mode
// SWD
ok &= rsc_claim(&UNIT_SYSTEM, R_PA13);
ok &= rsc_claim(&UNIT_SYSTEM, R_PA14);
rv |= rsc_claim(&UNIT_SYSTEM, R_PA13);
rv |= rsc_claim(&UNIT_SYSTEM, R_PA14);
// USB
ok &= rsc_claim(&UNIT_SYSTEM, R_PA11);
ok &= rsc_claim(&UNIT_SYSTEM, R_PA12);
rv |= rsc_claim(&UNIT_SYSTEM, R_PA11);
rv |= rsc_claim(&UNIT_SYSTEM, R_PA12);
// BOOT pin(s)
ok &= rsc_claim(&UNIT_SYSTEM, R_PB2); // BOOT1
assert_param(ok);
rv |= rsc_claim(&UNIT_SYSTEM, R_PB2); // BOOT1
}
#elif defined(GEX_PLAT_F407_DISCOVERY)
// Platform STM32F407VGT
@ -218,26 +208,24 @@ void plat_init_resources(void)
// Claim resources not available due to board layout or internal usage
{
bool ok = true;
// HAL timebase
ok &= rsc_claim(&UNIT_SYSTEM, R_TIM1);
rv |= rsc_claim(&UNIT_SYSTEM, R_TIM1);
// HSE crystal
// H0 and H1
// SWD
ok &= rsc_claim(&UNIT_SYSTEM, R_PA13);
ok &= rsc_claim(&UNIT_SYSTEM, R_PA14);
rv |= rsc_claim(&UNIT_SYSTEM, R_PA13);
rv |= rsc_claim(&UNIT_SYSTEM, R_PA14);
// USB
ok &= rsc_claim(&UNIT_SYSTEM, R_PA11);
ok &= rsc_claim(&UNIT_SYSTEM, R_PA12);
rv |= rsc_claim(&UNIT_SYSTEM, R_PA11);
rv |= rsc_claim(&UNIT_SYSTEM, R_PA12);
// BOOT pin(s)
ok &= rsc_claim(&UNIT_SYSTEM, R_PB2); // BOOT1
assert_param(ok);
rv |= rsc_claim(&UNIT_SYSTEM, R_PB2); // BOOT1
}
#else
#error "BAD PLATFORM!"
#endif
assert_param(rv == 0);
}

@ -56,8 +56,7 @@ void Indicator_Init(void)
Resource rsc = pin2resource(STATUS_LED_PORT, STATUS_LED_PIN, &suc);
assert_param(suc);
suc &= rsc_claim(&UNIT_SYSTEM, rsc);
assert_param(suc);
assert_param(E_SUCCESS == rsc_claim(&UNIT_SYSTEM, rsc));
}
/** Set indicator ON */

@ -29,7 +29,7 @@
// fields: name, msg. If msg is NULL, name as string will be used instead.
#define X_ERROR_CODES \
/* Shared errors */ \
X(SUCCESS, NULL) /* operation succeeded / unit loaded */ \
X(SUCCESS, NULL) /* operation succeeded / unit loaded. Must be 0 */ \
X(FAILURE, NULL) /* generic error */ \
X(INTERNAL_ERROR, NULL) /* a bug */ \
X(LOADING, NULL) /* unit is loading */ \

Loading…
Cancel
Save