Skip to content

Commit

Permalink
doc: Fix Timer API documentation and changelog format
Browse files Browse the repository at this point in the history
Signed-off-by: Huaqi Fang <578567190@qq.com>
  • Loading branch information
fanghuaqi committed Jan 13, 2020
1 parent 6e210ab commit b1b41cb
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 9 deletions.
6 changes: 3 additions & 3 deletions NMSIS/Core/Include/core_feature_timer.h
Original file line number Diff line number Diff line change
Expand Up @@ -293,10 +293,10 @@ __STATIC_FORCEINLINE void SysTimer_SoftwareReset(void)
* auto cleared to 0 when MTIMER >= MTIMERCMP.
* - When the variable \ref __Vendor_SysTickConfig is set to 1, then the
* function \ref SysTick_Config is not included.
* - In this case, the file **<Device>.h** must contain a vendor-specific implementation
* - In this case, the file <b><Device>.h</b> must contain a vendor-specific implementation
* of this function.
* - If user need this function to start a period timer interrupt, then in timer interrupt handler
* routine code, user should call \ref SysTimer_SetLoadValue to set counter as 0 to reload the timer.
* routine code, user should call \ref SysTick_Reload with ticks to reload the timer.
* - This function only available when __SYSTIMER_PRESENT == 1 and __ECLIC_PRESENT == 1 and __Vendor_SysTickConfig == 0
* \sa
* - \ref SysTimer_SetCompareValue; SysTimer_SetLoadValue
Expand Down Expand Up @@ -326,7 +326,7 @@ __STATIC_INLINE uint32_t SysTick_Config(uint64_t ticks)
* \ref __Vendor_SysTickConfig to 1, and implement \ref SysTick_Config and \ref SysTick_Reload functions.
* - When the variable \ref __Vendor_SysTickConfig is set to 1, then the
* function \ref SysTick_Reload is not included.
* - In this case, the file <b><Device>.h<\b> must contain a vendor-specific implementation
* - In this case, the file <b><Device>.h</b> must contain a vendor-specific implementation
* of this function.
* - This function only available when __SYSTIMER_PRESENT == 1 and __ECLIC_PRESENT == 1 and __Vendor_SysTickConfig == 0
* \sa
Expand Down
5 changes: 5 additions & 0 deletions NMSIS/doc/source/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,20 @@ V1.0.0-alpha.1
--------------

API changes has been maded to system timer.

- Start from Nuclei N core version 1.4, MSTOP register is renamed to MTIMECTL to provide more features

- Changes made to NMSIS/Core/core_feature_timer.h

- MSTOP register name changed to MTIMECTL due to core spec changes
- SysTimer_SetMstopValue renamed to SysTimer_SetControlValue
- SysTimer_GetMstopValue renamed to SysTimer_GetControlValue
- Add SysTimer_Start and SysTimer_Stop to start or stop system timer counter
- SysTick_Reload function is introduced to reload system timer
- Macro names started with SysTimer_xxx are changed, please check in the code.

- Removed unused lines of code in DSP and NN library source code which has unused macros which will not work for RISCV cores.

- Fix some documentation issues, mainly typos and invalid cross references.


Expand Down
15 changes: 9 additions & 6 deletions NMSIS/doc/source/core/api/core_systick.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ SysTimer API
SysTick Code Example
--------------------

The code below shows the usage of the function :cpp:func:`SysTick_Config` with an GD32VF103.
The code below shows the usage of the function :cpp:func:`SysTick_Config` and :cpp:func:`SysTick_Reload` with an GD32VF103 SoC.

.. code-block:: c
:linenos:
Expand All @@ -30,15 +30,18 @@ The code below shows the usage of the function :cpp:func:`SysTick_Config` with a
volatile uint32_t msTicks = 0; /* Variable to store millisecond ticks */
#define CONFIG_TICKS (SOC_TIMER_FREQ / 1000)
#define SysTick_Handler eclic_mtip_handler
void SysTick_Handler(void) { /* SysTick interrupt Handler. */
SysTimer_SetLoadValue(0); /* Set 0 to Timer counter to reload timer. */
msTicks++; /* See startup file startup_GD32VF103.s for SysTick vector */
SysTimer_Reload(CONFIG_TICKS); /* Call SysTick_Reload to reload timer. */
msTicks++; /* See startup file startup_gd32vf103.S for SysTick vector */
}
int main (void) {
uint32_t returnCode;
returnCode = SysTick_Config(SystemCoreClock / 1000); /* Configure SysTick to generate an interrupt every millisecond */
returnCode = SysTick_Config(CONFIG_TICKS); /* Configure SysTick to generate an interrupt every millisecond */
if (returnCode != 0) { /* Check return code for errors */
// Error Handling
Expand All @@ -64,7 +67,7 @@ The code below shows the usage of various NMSIS Timer Interrupt functions with a
void eclic_mtip_handler(void)
{
uint64_t now = SysTimer_GetLoadValue();
SysTimer_SetCompareValue(now + TIMER_FREQ/100);
SysTimer_SetCompareValue(now + SOC_TIMER_FREQ/100);
}
static uint32_t int_cnt = 0;
Expand Down Expand Up @@ -94,7 +97,7 @@ The code below shows the usage of various NMSIS Timer Interrupt functions with a
void setup_timer(void)
{
SysTimer_SetLoadValue(0);
SysTimer_SetCompareValue(TIMER_FREQ/100);
SysTimer_SetCompareValue(SOC_TIMER_FREQ/100);
}
int main (void)
Expand Down

0 comments on commit b1b41cb

Please sign in to comment.