FreeRTOS/Demo/RISC-V_RV64_PolarFire_SoftConsole/polarfire_hal/platform/mpfs_hal/common/mss_clint.c
/**
 * Configure system tick
 * @return SUCCESS or FAIL
 */
Configure system tick
@return SUCCESS or FAIL
Configure system tick @return SUCCESS or FAIL
uint32_t SysTick_Config(void)
{
    const uint32_t tick_rate[5] = {HART0_TICK_RATE_MS,    HART1_TICK_RATE_MS    ,HART2_TICK_RATE_MS    ,HART3_TICK_RATE_MS    ,HART4_TICK_RATE_MS};
    volatile uint32_t ret_val = ERROR;
    uint64_t mhart_id = read_csr(mhartid);
    g_systick_increment[mhart_id] = ((LIBERO_SETTING_MSS_RTC_TOGGLE_CLK/1000U)  * tick_rate[mhart_id]);
    if (g_systick_increment[mhart_id] > 0ULL)
    {
        CLINT->MTIMECMP[mhart_id] = CLINT->MTIME + g_systick_increment[mhart_id];
        set_csr(mie, MIP_MTIP);   
        __enable_irq();
        ret_val = SUCCESS;
    }
    return (ret_val);
}
uint32_t SysTick_Config ( void ) { const uint32_t tick_rate [ 5 ] = { HART0_TICK_RATE_MS , HART1_TICK_RATE_MS , HART2_TICK_RATE_MS , HART3_TICK_RATE_MS , HART4_TICK_RATE_MS } ; volatile uint32_t ret_val = ERROR ; uint64_t mhart_id = read_csr ( mhartid ) ; g_systick_increment [ mhart_id ] = ( ( LIBERO_SETTING_MSS_RTC_TOGGLE_CLK / 1000U ) * tick_rate [ mhart_id ] ) ; if ( g_systick_increment [ mhart_id ] > 0ULL ) { CLINT -> MTIMECMP [ mhart_id ] = CLINT -> MTIME + g_systick_increment [ mhart_id ] ; set_csr ( mie , MIP_MTIP ) ; __enable_irq ( ) ; ret_val = SUCCESS ; } return ( ret_val ) ; }
Configure system tick
 @return SUCCESS or FAIL
Configure system tick @return SUCCESS or FAIL
/*
     * We are assuming the tick rate is in milli-seconds
     *
     * convert RTC frequency into milliseconds and multiple by the tick rate
     *
     */ /* mie Register - Machine Timer Interrupt Enable */