🎨 GD32 MFL followup

Followup to #27744
This commit is contained in:
Scott Lahteine 2025-04-01 04:32:04 -05:00
parent 30a10077cf
commit 13db322f0e
4 changed files with 14 additions and 14 deletions

View file

@ -95,7 +95,7 @@ static void MinSerialBegin() {
volatile uint32_t ICER[32];
};
NVICMin *nvicBase = (NVICMin*)0xE000E100;
SBI32(nvicBase->ICER[nvicIndex >> 5], nvicIndex & 0x1F);
// We require memory barriers to properly disable interrupts

View file

@ -160,12 +160,12 @@ private:
info->csd.device_size = (static_cast<uint32_t>(csd_bytes[6] & 0x03U) << 10U) |
(static_cast<uint32_t>(csd_bytes[7]) << 2U) |
(static_cast<uint32_t>((csd_bytes[8] & 0xC0U) >> 6U));
info->csd.device_size_multiplier = static_cast<uint8_t>((csd_bytes[9] & 0x03U) << 1U |
info->csd.device_size_multiplier = static_cast<uint8_t>((csd_bytes[9] & 0x03U) << 1U |
(csd_bytes[10] & 0x80U) >> 7U);
info->block_size = static_cast<uint32_t>(1 << info->csd.read_block_length);
info->capacity = static_cast<uint32_t>((info->csd.device_size + 1U) *
(1U << (info->csd.device_size_multiplier + 2U)) *
info->capacity = static_cast<uint32_t>((info->csd.device_size + 1U) *
(1U << (info->csd.device_size_multiplier + 2U)) *
info->block_size);
}
@ -175,15 +175,15 @@ private:
static_cast<uint32_t>(csd_bytes[9]);
info->block_size = BLOCK_SIZE;
info->capacity = static_cast<uint32_t>((info->csd.device_size + 1U) *
info->capacity = static_cast<uint32_t>((info->csd.device_size + 1U) *
BLOCK_SIZE * KILOBYTE);
}
void process_common_csd_tail(Card_Info* info, const uint8_t* csd_bytes) {
info->csd.sector_size = static_cast<uint8_t>(((csd_bytes[9] & 0x3FU) << 1U) |
info->csd.sector_size = static_cast<uint8_t>(((csd_bytes[9] & 0x3FU) << 1U) |
(csd_bytes[10] & 0x80U) >> 7U);
info->csd.speed_factor = static_cast<uint8_t>((csd_bytes[11] & 0x1CU) >> 2U);
info->csd.write_block_length = static_cast<uint8_t>(((csd_bytes[11] & 0x03U) << 2U) |
info->csd.write_block_length = static_cast<uint8_t>(((csd_bytes[11] & 0x03U) << 2U) |
((csd_bytes[12] & 0xC0U) >> 6U));
info->csd.checksum = static_cast<uint8_t>((csd_bytes[15] & 0xFEU) >> 1U);
}

View file

@ -97,10 +97,10 @@ uint32_t GetStepperTimerClkFreq() {
/**
* @brief Starts a hardware timer
*
*
* If the timer is not already initialized, this function will initialize it with the given frequency.
* The timer is started immediately after initialization
*
*
* @param timer The timer base index to start
* @param frequency The frequency at which the timer should run
* @return None
@ -137,7 +137,7 @@ void HAL_timer_start(const uint8_t timer_number, const uint32_t frequency) {
/**
* @brief Enables the interrupt for the specified timer
*
*
* @param handle The timer handle for which to enable the interrupt
* @return None
*/
@ -154,7 +154,7 @@ void HAL_timer_enable_interrupt(const uint8_t timer_number) {
/**
* @brief Disables the interrupt for the specified timer
*
*
* @param handle The timer handle for which to disable the interrupt
* @return None
*/
@ -168,7 +168,7 @@ void HAL_timer_disable_interrupt(const uint8_t timer_number) {
/**
* @brief Checks if the interrupt is enabled for the specified timer
*
*
* @param handle The timer handle to check
* @return True if the interrupt is enabled, false otherwise
*/

View file

@ -123,8 +123,8 @@ FORCE_INLINE static hal_timer_t HAL_timer_get_count(const uint8_t timer_number)
GeneralTimer& timer = (timer_number == MF_TIMER_STEP) ? Step_Timer : Temp_Timer;
return (timer_number == MF_TIMER_STEP || timer_number == MF_TIMER_TEMP)
? timer.getCounter(TimerFormat::TICK)
return (timer_number == MF_TIMER_STEP || timer_number == MF_TIMER_TEMP)
? timer.getCounter(TimerFormat::TICK)
: 0U;
}