Origin
This commit is contained in:
@@ -0,0 +1,276 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file stm32_adv_trace.h
|
||||
* @author MCD Application Team
|
||||
* @brief Header for stm32_adv_trace.c
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© Copyright (c) 2019 STMicroelectronics.
|
||||
* All rights reserved.</center></h2>
|
||||
*
|
||||
* This software component is licensed by ST under BSD 3-Clause license,
|
||||
* the "License"; You may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at:
|
||||
* opensource.org/licenses/BSD-3-Clause
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __ADV_TRACE_H
|
||||
#define __ADV_TRACE_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stdint.h"
|
||||
#include "utilities_conf.h"
|
||||
|
||||
/** @defgroup ADV_TRACE advanced tracer
|
||||
* @{
|
||||
*/
|
||||
|
||||
/* Exported types ------------------------------------------------------------*/
|
||||
/** @defgroup ADV_TRACE_exported_TypeDef ADV_TRACE exported Typedef
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief prototype of the time stamp function.
|
||||
*/
|
||||
typedef void cb_timestamp(uint8_t *pData, uint16_t *Size);
|
||||
|
||||
/**
|
||||
* @brief prototype of the overrun function.
|
||||
*/
|
||||
typedef void cb_overrun(uint8_t **pData, uint16_t *size);
|
||||
/**
|
||||
* @brief List the Advanced trace function status.
|
||||
* list of the returned status value, any negative value is corresponding to an error.
|
||||
*/
|
||||
typedef enum{
|
||||
UTIL_ADV_TRACE_OK = 0, /*!< Operation terminated successfully.*/
|
||||
UTIL_ADV_TRACE_INVALID_PARAM = -1, /*!< Invalid Parameter. */
|
||||
UTIL_ADV_TRACE_HW_ERROR = -2, /*!< Hardware Error. */
|
||||
UTIL_ADV_TRACE_MEM_FULL = -3, /*!< Memory fifo full. */
|
||||
UTIL_ADV_TRACE_UNKNOWN_ERROR = -4, /*!< Unknown Error. */
|
||||
#if defined(UTIL_ADV_TRACE_CONDITIONNAL)
|
||||
UTIL_ADV_TRACE_GIVEUP = -5, /*!< trace give up */
|
||||
UTIL_ADV_TRACE_REGIONMASKED = -6 /*!< trace region masked */
|
||||
#endif
|
||||
} UTIL_ADV_TRACE_Status_t;
|
||||
|
||||
/**
|
||||
* @brief Advanced trace driver definition
|
||||
*/
|
||||
typedef struct {
|
||||
UTIL_ADV_TRACE_Status_t (* Init)(void (*cb)(void *ptr)); /*!< Media initialization. */
|
||||
UTIL_ADV_TRACE_Status_t (* DeInit)(void); /*!< Media Un-initialization. */
|
||||
UTIL_ADV_TRACE_Status_t (* StartRx)(void (*cb)(uint8_t *pdata, uint16_t size, uint8_t error)); /*!< Media to start RX process. */
|
||||
UTIL_ADV_TRACE_Status_t (* Send)(uint8_t *pdata, uint16_t size); /*!< Media to send data. */
|
||||
}UTIL_ADV_TRACE_Driver_s;
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/* External variables --------------------------------------------------------*/
|
||||
/** @defgroup ADV_TRACE_exported_variables ADV_TRACE exported variables
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* @brief This structure is the linked with the IF layer implementation.
|
||||
*/
|
||||
extern const UTIL_ADV_TRACE_Driver_s UTIL_TraceDriver;
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/* Exported constants --------------------------------------------------------*/
|
||||
/* Exported macros -----------------------------------------------------------*/
|
||||
/* Exported functions ------------------------------------------------------- */
|
||||
/** @defgroup ADV_TRACE_exported_function ADV_TRACE exported function
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief TraceInit Initializes Logging feature
|
||||
* @retval Status based on @ref UTIL_ADV_TRACE_Status_t
|
||||
*/
|
||||
UTIL_ADV_TRACE_Status_t UTIL_ADV_TRACE_Init(void);
|
||||
|
||||
/**
|
||||
* @brief TraceDeInit module DeInitializes.
|
||||
* @retval Status based on @ref UTIL_ADV_TRACE_Status_t
|
||||
*/
|
||||
UTIL_ADV_TRACE_Status_t UTIL_ADV_TRACE_DeInit(void);
|
||||
|
||||
/**
|
||||
* @brief this function check if the buffer is empty.
|
||||
* @retval 1 if the buffer is empty else 0
|
||||
*/
|
||||
uint8_t UTIL_ADV_TRACE_IsBufferEmpty(void);
|
||||
|
||||
/**
|
||||
* @brief start the RX process.
|
||||
* @param UserCallback ptr function used to get the RX data
|
||||
* @retval Status based on @ref UTIL_ADV_TRACE_Status_t
|
||||
*/
|
||||
UTIL_ADV_TRACE_Status_t UTIL_ADV_TRACE_StartRxProcess(void (*UserCallback)(uint8_t *PData, uint16_t Size, uint8_t Error));
|
||||
|
||||
/**
|
||||
* @brief TraceSend decode the strFormat and post it to the circular queue for printing
|
||||
* @param strFormat Trace message and format
|
||||
* @retval Status based on @ref UTIL_ADV_TRACE_Status_t
|
||||
*/
|
||||
UTIL_ADV_TRACE_Status_t UTIL_ADV_TRACE_FSend(const char *strFormat, ...);
|
||||
|
||||
/**
|
||||
* @brief post data to the circular queue
|
||||
* @param *pdata pointer to Data
|
||||
* @param length length of data buffer to be sent
|
||||
* @retval Status based on @ref UTIL_ADV_TRACE_Status_t
|
||||
*/
|
||||
UTIL_ADV_TRACE_Status_t UTIL_ADV_TRACE_Send(const uint8_t *pdata, uint16_t length);
|
||||
|
||||
/**
|
||||
* @brief ZCSend_Allocation allocate the memory and return information to write the data
|
||||
* @param Length trase size
|
||||
* @param pData pointer on the fifo
|
||||
* @param FifoSize size of the fifo
|
||||
* @param WritePos write position of the fifo
|
||||
* @retval Status based on @ref UTIL_ADV_TRACE_Status_t
|
||||
*/
|
||||
UTIL_ADV_TRACE_Status_t UTIL_ADV_TRACE_ZCSend_Allocation(uint16_t Length, uint8_t **pData, uint16_t *FifoSize, uint16_t *WritePos);
|
||||
|
||||
/**
|
||||
* @brief ZCSend finalize the data transfer
|
||||
* @retval Status based on @ref UTIL_ADV_TRACE_Status_t
|
||||
*/
|
||||
UTIL_ADV_TRACE_Status_t UTIL_ADV_TRACE_ZCSend_Finalize(void);
|
||||
/**
|
||||
* @brief Trace send started hook
|
||||
* @retval None
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Trace send pre hook function
|
||||
*/
|
||||
void UTIL_ADV_TRACE_PreSendHook(void);
|
||||
|
||||
/**
|
||||
* @brief Trace send post hook function
|
||||
*/
|
||||
void UTIL_ADV_TRACE_PostSendHook(void);
|
||||
|
||||
#if defined(UTIL_ADV_TRACE_OVERRUN)
|
||||
/**
|
||||
* @brief Register a function used to add overrun info inside the trace
|
||||
* @param cb pointer of function to return overrun information
|
||||
*/
|
||||
void UTIL_ADV_TRACE_RegisterOverRunFunction(cb_overrun *cb);
|
||||
#endif
|
||||
|
||||
#if defined(UTIL_ADV_TRACE_CONDITIONNAL)
|
||||
|
||||
/**
|
||||
* @brief conditional FSend decode the strFormat and post it to the circular queue for printing
|
||||
* @param VerboseLevel verbose level of the trace
|
||||
* @param Region region of the trace
|
||||
* @param TimeStampState 0 no time stamp insertion, 1 time stamp inserted inside the trace data
|
||||
* @param strFormat formatted string
|
||||
* @retval Status based on @ref UTIL_ADV_TRACE_Status_t
|
||||
*/
|
||||
UTIL_ADV_TRACE_Status_t UTIL_ADV_TRACE_COND_FSend(uint32_t VerboseLevel, uint32_t Region,uint32_t TimeStampState, const char *strFormat, ...);
|
||||
|
||||
/**
|
||||
* @brief conditional ZCSend Write user formatted data directly in the FIFO (Z-Cpy)
|
||||
* @param VerboseLevel verbose level of the trace
|
||||
* @param Region region of the trace
|
||||
* @param TimeStampState 0 no time stamp insertion, 1 time stamp inserted inside the trace data
|
||||
* @param length data length
|
||||
* @param pData pointer on the fifo
|
||||
* @param FifoSize size of the fifo
|
||||
* @param WritePos write position of the fifo
|
||||
* @retval Status based on @ref UTIL_ADV_TRACE_Status_t
|
||||
*/
|
||||
UTIL_ADV_TRACE_Status_t UTIL_ADV_TRACE_COND_ZCSend_Allocation(uint32_t VerboseLevel, uint32_t Region, uint32_t TimeStampState, uint16_t length,uint8_t **pData, uint16_t *FifoSize, uint16_t *WritePos);
|
||||
|
||||
/**
|
||||
* @brief conditional ZCSend finalize the data transfer
|
||||
* @retval Status based on @ref UTIL_ADV_TRACE_Status_t
|
||||
*/
|
||||
UTIL_ADV_TRACE_Status_t UTIL_ADV_TRACE_COND_ZCSend_Finalize(void);
|
||||
|
||||
/**
|
||||
* @brief confitionnal Send post data to the circular queue
|
||||
* @param VerboseLevel verbose level of the trace
|
||||
* @param Region region of the trace
|
||||
* @param TimeStampState 0 no time stamp insertion, 1 time stamp inserted inside the trace data
|
||||
* @param *pdata pointer to Data
|
||||
* @param length length of data buffer ro be sent
|
||||
* @retval Status based on @ref UTIL_ADV_TRACE_Status_t
|
||||
*/
|
||||
UTIL_ADV_TRACE_Status_t UTIL_ADV_TRACE_COND_Send(uint32_t VerboseLevel, uint32_t Region, uint32_t TimeStampState, const uint8_t *pdata, uint16_t length);
|
||||
|
||||
/**
|
||||
* @brief Register a function used to add timestamp inside the trace
|
||||
* @param cb pointer of function to return timestamp information
|
||||
*/
|
||||
void UTIL_ADV_TRACE_RegisterTimeStampFunction(cb_timestamp *cb);
|
||||
|
||||
/**
|
||||
* @brief Set the verbose level
|
||||
* @param Level (0 to 255)
|
||||
* @retval None
|
||||
*/
|
||||
void UTIL_ADV_TRACE_SetVerboseLevel(uint8_t Level);
|
||||
|
||||
/**
|
||||
* @brief Get the verbose level
|
||||
* @retval verbose level
|
||||
*/
|
||||
uint8_t UTIL_ADV_TRACE_GetVerboseLevel(void);
|
||||
|
||||
/**
|
||||
* @brief add to the mask a bit field region.
|
||||
* @param Region bit field of region to enable
|
||||
* @retval None
|
||||
*/
|
||||
void UTIL_ADV_TRACE_SetRegion(uint32_t Region);
|
||||
|
||||
/**
|
||||
* @brief add to the mask a bit field region.
|
||||
* @retval None
|
||||
*/
|
||||
uint32_t UTIL_ADV_TRACE_GetRegion(void);
|
||||
|
||||
/**
|
||||
* @brief remove from the mask a bit field region.
|
||||
* @param Region Region bit field of region to disable
|
||||
* @retval None
|
||||
*/
|
||||
void UTIL_ADV_TRACE_ResetRegion(uint32_t Region);
|
||||
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /*__ADV_TRACE_H */
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
@@ -0,0 +1,73 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file stm32_mem.h
|
||||
* @author MCD Application Team
|
||||
* @brief standard memory operation
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© Copyright (c) 2019 STMicroelectronics.
|
||||
* All rights reserved.</center></h2>
|
||||
*
|
||||
* This software component is licensed by ST under BSD 3-Clause license,
|
||||
* the "License"; You may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at:
|
||||
* opensource.org/licenses/BSD-3-Clause
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __STM32_MEM_H__
|
||||
#define __STM32_MEM_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include <stdint.h>
|
||||
#include "utilities_conf.h"
|
||||
|
||||
/* Exported types ------------------------------------------------------------*/
|
||||
/* Exported constants --------------------------------------------------------*/
|
||||
/* Exported macro ------------------------------------------------------------*/
|
||||
/* ---- Memory mapping macros ----------------------------------------------- */
|
||||
#define UTIL_MEM_PLACE_IN_SECTION( __x__ ) UTIL_PLACE_IN_SECTION( __x__ )
|
||||
#define UTIL_MEM_ALIGN ALIGN
|
||||
|
||||
/* Exported functions ------------------------------------------------------- */
|
||||
/**
|
||||
* @brief This API copies one buffer to another
|
||||
* @param dst: output buffer to be filled
|
||||
* @param src: input buffer
|
||||
* @param size: size of 8b data
|
||||
* @retval None
|
||||
*/
|
||||
void UTIL_MEM_cpy_8( void *dst, const void *src, uint16_t size );
|
||||
|
||||
/**
|
||||
* @brief This API copies one buffer to another in reverse
|
||||
* @param dst: output buffer to be filled
|
||||
* @param src: input buffer
|
||||
* @param size: size of 8b data
|
||||
* @retval None
|
||||
*/
|
||||
void UTIL_MEM_cpyr_8( void *dst, const void *src, uint16_t size );
|
||||
|
||||
/**
|
||||
* @brief This API fills a buffer with value
|
||||
* @param dst: output buffer to be filled
|
||||
* @param value: value
|
||||
* @param size: size of 8b data
|
||||
* @retval None
|
||||
*/
|
||||
void UTIL_MEM_set_8( void *dst, uint8_t value, uint16_t size );
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // __STM32_MEM_H__
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
@@ -0,0 +1,279 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file stm32_seq.h
|
||||
* @author MCD Application Team
|
||||
* @brief sequencer interface
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© Copyright (c) 2019 STMicroelectronics.
|
||||
* All rights reserved.</center></h2>
|
||||
*
|
||||
* This software component is licensed by ST under BSD 3-Clause license,
|
||||
* the "License"; You may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at:
|
||||
* opensource.org/licenses/BSD-3-Clause
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef STM32_SEQ_H
|
||||
#define STM32_SEQ_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stdint.h"
|
||||
|
||||
/** @defgroup SEQUENCER sequencer utilities
|
||||
* @{
|
||||
*/
|
||||
|
||||
/* Exported types ------------------------------------------------------------*/
|
||||
/** @defgroup SEQUENCER_Exported_type SEQUENCER exported types
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* @brief bit mapping of the task.
|
||||
* this value is used to represent a list of task (each corresponds to a task).
|
||||
*/
|
||||
|
||||
typedef uint32_t UTIL_SEQ_bm_t;
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/* Exported constants --------------------------------------------------------*/
|
||||
|
||||
/** @defgroup SEQUENCER_Exported_const SEQUENCER exported constants
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief This provides a default value for unused parameter
|
||||
*
|
||||
*/
|
||||
#define UTIL_SEQ_RFU 0
|
||||
|
||||
/**
|
||||
* @brief Default value used to start the scheduling.
|
||||
*
|
||||
* This informs the sequencer that all tasks registered shall be considered
|
||||
*
|
||||
* @note
|
||||
* This should be used in the application\n
|
||||
* while(1)\n
|
||||
* {\n
|
||||
* UTIL_SEQ_Run( UTIL_SEQ_DEFAULT );\n
|
||||
* }\n
|
||||
*
|
||||
*/
|
||||
#define UTIL_SEQ_DEFAULT (~0U)
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/* External variables --------------------------------------------------------*/
|
||||
/* Exported macros -----------------------------------------------------------*/
|
||||
/* Exported functions ------------------------------------------------------- */
|
||||
|
||||
/** @defgroup SEQUENCER_Exported_function SEQUENCER exported functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief This function initializes the sequencer resources.
|
||||
*
|
||||
*/
|
||||
void UTIL_SEQ_Init( void );
|
||||
|
||||
/**
|
||||
* @brief This function un-initializes the sequencer resources.
|
||||
*
|
||||
*/
|
||||
void UTIL_SEQ_DeInit( void );
|
||||
|
||||
/**
|
||||
* @brief This function is called by the sequencer in critical section (PRIMASK bit) when
|
||||
* - there are no more tasks to be executed
|
||||
* AND
|
||||
* - there are no pending event or the pending event is still not set
|
||||
* @note The application should enter low power mode in this function
|
||||
* When this function is not implemented by the application, the sequencer keeps running a while loop (RUN MODE)
|
||||
*
|
||||
*/
|
||||
void UTIL_SEQ_Idle( void );
|
||||
|
||||
/**
|
||||
* @brief This function is called by the sequencer outside critical section just before calling UTIL_SEQ_Idle( )
|
||||
* UTIL_SEQ_PreIdle() is considered as the last task executed before calling UTIL_SEQ_Idle( )
|
||||
* In case a task or an event is set from an interrupt handler just after UTIL_SEQ_PreIdle() is called,
|
||||
* UTIL_SEQ_Idle() will not be called.
|
||||
*
|
||||
*/
|
||||
void UTIL_SEQ_PreIdle( void );
|
||||
|
||||
/**
|
||||
* @brief This function is called by the sequencer outside critical section either
|
||||
* - after calling UTIL_SEQ_Idle( )
|
||||
* OR
|
||||
* - after calling UTIL_SEQ_PreIdle( ) without call to UTIL_SEQ_Idle() due to an incoming task set or event
|
||||
* requested after UTIL_SEQ_PreIdle() has been called.
|
||||
*
|
||||
* Note: UTIL_SEQ_PostIdle() is always called if UTIL_SEQ_PreIdle() has been called and never called otherwise
|
||||
*
|
||||
*/
|
||||
void UTIL_SEQ_PostIdle( void );
|
||||
|
||||
/**
|
||||
* @brief This function requests the sequencer to execute all pending tasks using round robin mechanism.
|
||||
* When no task are pending, it calls UTIL_SEQ_Idle();
|
||||
* This function should be called in a while loop in the application
|
||||
*
|
||||
* @param Mask_bm list of task (bit mapping) that is be kept in the sequencer list.
|
||||
*
|
||||
*/
|
||||
void UTIL_SEQ_Run( UTIL_SEQ_bm_t Mask_bm );
|
||||
|
||||
/**
|
||||
* @brief This function registers a task in the sequencer.
|
||||
*
|
||||
* @param TaskId_bm The Id of the task
|
||||
* @param Flags Flags are reserved param for future use
|
||||
* @param Task Reference of the function to be executed
|
||||
*
|
||||
*/
|
||||
void UTIL_SEQ_RegTask( UTIL_SEQ_bm_t TaskId_bm, uint32_t Flags, void (*Task)( void ) );
|
||||
|
||||
/**
|
||||
* @brief This function requests a task to be executed
|
||||
*
|
||||
* @param TaskId_bm The Id of the task
|
||||
* It shall be (1<<task_id) where task_id is the number assigned when the task has been registered
|
||||
* @param Task_Prio The priority of the task
|
||||
* It shall a number from 0 (high priority) to 31 (low priority)
|
||||
* The priority is checked each time the sequencer needs to select a new task to execute
|
||||
* It does not permit to preempt a running task with lower priority
|
||||
*
|
||||
*/
|
||||
void UTIL_SEQ_SetTask( UTIL_SEQ_bm_t TaskId_bm , uint32_t Task_Prio );
|
||||
|
||||
/**
|
||||
* @brief This function checks if a task could be scheduled.
|
||||
*
|
||||
* @param TaskId_bm The Id of the task
|
||||
* It shall be (1<<task_id) where task_id is the number assigned when the task has been registered
|
||||
* @retval 0 if not 1 if true
|
||||
*/
|
||||
uint32_t UTIL_SEQ_IsSchedulableTask( UTIL_SEQ_bm_t TaskId_bm);
|
||||
|
||||
/**
|
||||
* @brief This function prevents a task to be called by the sequencer even when set with UTIL_SEQ_SetTask()
|
||||
* By default, all tasks are executed by the sequencer when set with UTIL_SEQ_SetTask()
|
||||
* When a task is paused, it is moved out from the sequencer list
|
||||
*
|
||||
* @param TaskId_bm The Id of the task
|
||||
* It shall be (1<<task_id) where task_id is the number assigned when the task has been registered
|
||||
*
|
||||
*/
|
||||
void UTIL_SEQ_PauseTask( UTIL_SEQ_bm_t TaskId_bm );
|
||||
|
||||
/**
|
||||
* @brief This function allows to know if the task has been put in pause.
|
||||
* By default, all tasks are executed by the sequencer when set with UTIL_SEQ_SetTask()
|
||||
* The exit of the pause shall be done by the function UTIL_SEQ_ResumeTask.
|
||||
*
|
||||
* @param TaskId_bm The Id of the task
|
||||
* It shall be (1<<task_id) where task_id is the number assigned when the task has been registered
|
||||
*
|
||||
*/
|
||||
uint32_t UTIL_SEQ_IsPauseTask( UTIL_SEQ_bm_t TaskId_bm );
|
||||
|
||||
/**
|
||||
* @brief This function allows again a task to be called by the sequencer if set with UTIL_SEQ_SetTask()
|
||||
* This is used in relation with UTIL_SEQ_PauseTask()
|
||||
*
|
||||
* @param TaskId_bm The Id of the task
|
||||
* It shall be (1<<task_id) where task_id is the number assigned when the task has been registered
|
||||
*
|
||||
*/
|
||||
void UTIL_SEQ_ResumeTask( UTIL_SEQ_bm_t TaskId_bm );
|
||||
|
||||
/**
|
||||
* @brief This function sets an event that is waited with UTIL_SEQ_WaitEvt()
|
||||
*
|
||||
* @param EvtId_bm event id bit mask
|
||||
*
|
||||
* @note an event shall be a 32 bit mapping where only 1 bit is set
|
||||
*
|
||||
*/
|
||||
void UTIL_SEQ_SetEvt( UTIL_SEQ_bm_t EvtId_bm );
|
||||
|
||||
/**
|
||||
* @brief This function may be used to clear the event before calling UTIL_SEQ_WaitEvt()
|
||||
* This API may be useful when the UTIL_SEQ_SetEvt() is called several time to notify the same event.
|
||||
* Due to Software Architecture where the timings are hard to control, this may be an unwanted case.
|
||||
*
|
||||
* @param EvtId_bm event id bm
|
||||
* It shall be a bit mapping where only 1 bit is set
|
||||
*
|
||||
*/
|
||||
void UTIL_SEQ_ClrEvt( UTIL_SEQ_bm_t EvtId_bm );
|
||||
|
||||
/**
|
||||
* @brief This function waits for a specific event to be set. The sequencer loops UTIL_SEQ_EvtIdle() until the event is set
|
||||
* When called recursively, it acts as a First in / Last out mechanism. The sequencer waits for the
|
||||
* last event requested to be set even though one of the already requested event has been set.
|
||||
*
|
||||
* @param EvtId_bm event id bit mask
|
||||
* It shall be a bit mapping where only 1 bit is set
|
||||
*
|
||||
*/
|
||||
void UTIL_SEQ_WaitEvt( UTIL_SEQ_bm_t EvtId_bm );
|
||||
|
||||
/**
|
||||
* @brief This function returns whether the waited event is pending or not
|
||||
* It is useful only when the UTIL_SEQ_EvtIdle() is overloaded by the application. In that case, when the low
|
||||
* power mode needs to be executed, the application shall first check whether the waited event is pending
|
||||
* or not. Both the event checking and the low power mode processing should be done in critical section
|
||||
*
|
||||
* @retval 0 when the waited event is not there or the evt_id when the waited event is pending
|
||||
*/
|
||||
UTIL_SEQ_bm_t UTIL_SEQ_IsEvtPend( void );
|
||||
|
||||
/**
|
||||
* @brief This function loops until the waited event is set
|
||||
* @param TaskId_bm The task id that is currently running. When task_id_bm = 0, it means UTIL_SEQ_WaitEvt( )
|
||||
* has been called outside a registered task (ie at startup before UTIL_SEQ_Run( ) has been called
|
||||
* @param EvtWaited_bm The event id that is waited.
|
||||
*
|
||||
* @note
|
||||
* When not implemented by the application, it calls UTIL_SEQ_Run(~TaskId_bm) which means the waited
|
||||
* task is suspended until the waited event and the other tasks are running or the application enter
|
||||
* low power mode.
|
||||
* Else the user can redefine his own function for example call sequencer UTIL_SEQ_Run(0) to suspend all
|
||||
* the task and let the sequencer enter the low power mode.
|
||||
*/
|
||||
void UTIL_SEQ_EvtIdle( UTIL_SEQ_bm_t TaskId_bm, UTIL_SEQ_bm_t EvtWaited_bm );
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /*__STM32_SEQ_H */
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
@@ -0,0 +1,255 @@
|
||||
/*!
|
||||
* \file systime.h
|
||||
*
|
||||
* \brief System time functions implementation.
|
||||
*
|
||||
* \copyright Revised BSD License, see section \ref LICENSE.
|
||||
*
|
||||
* \code
|
||||
* ______ _
|
||||
* / _____) _ | |
|
||||
* ( (____ _____ ____ _| |_ _____ ____| |__
|
||||
* \____ \| ___ | (_ _) ___ |/ ___) _ \
|
||||
* _____) ) ____| | | || |_| ____( (___| | | |
|
||||
* (______/|_____)_|_|_| \__)_____)\____)_| |_|
|
||||
* (C)2013-2018 Semtech - STMicroelectronics
|
||||
*
|
||||
* \endcode
|
||||
*
|
||||
* \author Miguel Luis ( Semtech )
|
||||
*
|
||||
* \author Gregory Cristian ( Semtech )
|
||||
*
|
||||
* \author MCD Application Team ( STMicroelectronics International )
|
||||
*/
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file stm32_systime.h
|
||||
* @author MCD Application Team
|
||||
* @brief System time functions implementation
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© Copyright (c) 2019 STMicroelectronics.
|
||||
* All rights reserved.</center></h2>
|
||||
*
|
||||
* This software component is licensed by ST under BSD 3-Clause license,
|
||||
* the "License"; You may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at:
|
||||
* opensource.org/licenses/BSD-3-Clause
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __STM32_SYS_TIME_H__
|
||||
#define __STM32_SYS_TIME_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/** @defgroup SYSTIME timer server
|
||||
* @{
|
||||
*/
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include <stdint.h>
|
||||
#include "time.h"
|
||||
|
||||
|
||||
/* Exported constants --------------------------------------------------------*/
|
||||
/** @defgroup SYSTIME_exported_constants SYSTIME exported constants
|
||||
* @{
|
||||
*/
|
||||
|
||||
/*!
|
||||
* @brief Days, Hours, Minutes and seconds of systime.h
|
||||
*/
|
||||
#define TM_DAYS_IN_LEAP_YEAR ( ( uint32_t ) 366U )
|
||||
#define TM_DAYS_IN_YEAR ( ( uint32_t ) 365U )
|
||||
#define TM_SECONDS_IN_1DAY ( ( uint32_t )86400U )
|
||||
#define TM_SECONDS_IN_1HOUR ( ( uint32_t ) 3600U )
|
||||
#define TM_SECONDS_IN_1MINUTE ( ( uint32_t ) 60U )
|
||||
#define TM_MINUTES_IN_1HOUR ( ( uint32_t ) 60U )
|
||||
#define TM_HOURS_IN_1DAY ( ( uint32_t ) 24U )
|
||||
|
||||
/*!
|
||||
* @brief Months of systime.h
|
||||
*/
|
||||
#define TM_MONTH_JANUARY ( ( uint8_t ) 0U )
|
||||
#define TM_MONTH_FEBRUARY ( ( uint8_t ) 1U )
|
||||
#define TM_MONTH_MARCH ( ( uint8_t ) 2U )
|
||||
#define TM_MONTH_APRIL ( ( uint8_t ) 3U )
|
||||
#define TM_MONTH_MAY ( ( uint8_t ) 4U )
|
||||
#define TM_MONTH_JUNE ( ( uint8_t ) 5U )
|
||||
#define TM_MONTH_JULY ( ( uint8_t ) 6U )
|
||||
#define TM_MONTH_AUGUST ( ( uint8_t ) 7U )
|
||||
#define TM_MONTH_SEPTEMBER ( ( uint8_t ) 8U )
|
||||
#define TM_MONTH_OCTOBER ( ( uint8_t ) 9U )
|
||||
#define TM_MONTH_NOVEMBER ( ( uint8_t )10U )
|
||||
#define TM_MONTH_DECEMBER ( ( uint8_t )11U )
|
||||
|
||||
/*!
|
||||
* @brief Week days of systime.h
|
||||
*/
|
||||
#define TM_WEEKDAY_SUNDAY ( ( uint8_t )0U )
|
||||
#define TM_WEEKDAY_MONDAY ( ( uint8_t )1U )
|
||||
#define TM_WEEKDAY_TUESDAY ( ( uint8_t )2U )
|
||||
#define TM_WEEKDAY_WEDNESDAY ( ( uint8_t )3U )
|
||||
#define TM_WEEKDAY_THURSDAY ( ( uint8_t )4U )
|
||||
#define TM_WEEKDAY_FRIDAY ( ( uint8_t )5U )
|
||||
#define TM_WEEKDAY_SATURDAY ( ( uint8_t )6U )
|
||||
|
||||
/*!
|
||||
* @brief Number of seconds elapsed between Unix epoch and GPS epoch
|
||||
*/
|
||||
#define UNIX_GPS_EPOCH_OFFSET 315964800
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/* External Typedef --------------------------------------------------------*/
|
||||
|
||||
/** @defgroup SYSTIME_exported_TypeDef SYSTIME exported Typedef
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* @brief Structure holding the system time in seconds and milliseconds.
|
||||
*/
|
||||
typedef struct SysTime_s
|
||||
{
|
||||
uint32_t Seconds;
|
||||
int16_t SubSeconds;
|
||||
}SysTime_t;
|
||||
|
||||
/**
|
||||
* @brief SysTime driver definition
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
void (*BKUPWrite_Seconds) ( uint32_t Seconds); /*!< Set the timer differencebetween real time and rtc time */
|
||||
uint32_t (*BKUPRead_Seconds) ( void ); /*!< Get the timer differencebetween real time and rtc time */
|
||||
void (*BKUPWrite_SubSeconds) ( uint32_t SubSeconds); /*!< Set the timer differencebetween real time and rtc time */
|
||||
uint32_t (*BKUPRead_SubSeconds) ( void ); /*!< Get the timer differencebetween real time and rtc time */
|
||||
uint32_t (*GetCalendarTime)( uint16_t* SubSeconds ); /*!< Set the rtc time */
|
||||
} UTIL_SYSTIM_Driver_s;
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/* Exported macros -----------------------------------------------------------*/
|
||||
/* Exported variables ------------------------------------------------------------*/
|
||||
|
||||
/** @defgroup SYSTIME_exported_Variable SYSTIME exported Variable
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* @brief low layer interface to handle systim
|
||||
*
|
||||
* @remark This structure is defined and initialized in the specific platform
|
||||
* timer implementation e.g rtc
|
||||
*/
|
||||
extern const UTIL_SYSTIM_Driver_s UTIL_SYSTIMDriver;
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/* Exported functions ------------------------------------------------------- */
|
||||
/** @defgroup SYSTIME_exported_function SYSTIME exported function
|
||||
* @{
|
||||
*/
|
||||
|
||||
/*!
|
||||
* @brief Adds 2 SysTime_t values
|
||||
*
|
||||
* @param a Value
|
||||
* @param b Value to added
|
||||
*
|
||||
* @retval result Addition result (SysTime_t value)
|
||||
*/
|
||||
SysTime_t SysTimeAdd( SysTime_t a, SysTime_t b );
|
||||
|
||||
/*!
|
||||
* @brief Subtracts 2 SysTime_t values
|
||||
*
|
||||
* @param a Value
|
||||
* @param b Value to be subtracted
|
||||
*
|
||||
* @retval result Subtraction result (SysTime_t value)
|
||||
*/
|
||||
SysTime_t SysTimeSub( SysTime_t a, SysTime_t b );
|
||||
|
||||
/*!
|
||||
* @brief Sets new system time
|
||||
*
|
||||
* @param sysTime New seconds/sub-seconds since UNIX epoch origin
|
||||
*/
|
||||
void SysTimeSet( SysTime_t sysTime );
|
||||
|
||||
/*!
|
||||
* @brief Gets current system time
|
||||
*
|
||||
* @retval sysTime Current seconds/sub-seconds since UNIX epoch origin
|
||||
*/
|
||||
SysTime_t SysTimeGet( void );
|
||||
|
||||
/*!
|
||||
* @brief Gets current MCU system time
|
||||
*
|
||||
* @retval sysTime Current seconds/sub-seconds since Mcu started
|
||||
*/
|
||||
SysTime_t SysTimeGetMcuTime( void );
|
||||
|
||||
/*!
|
||||
* Converts the given SysTime to the equivalent RTC value in milliseconds
|
||||
*
|
||||
* @param [IN] sysTime System time to be converted
|
||||
*
|
||||
* @retval timeMs The RTC converted time value in ms
|
||||
*/
|
||||
uint32_t SysTimeToMs( SysTime_t sysTime );
|
||||
|
||||
/*!
|
||||
* Converts the given RTC value in milliseconds to the equivalent SysTime
|
||||
*
|
||||
* \param [IN] timeMs The RTC time value in ms to be converted
|
||||
*
|
||||
* \retval sysTime Converted system time
|
||||
*/
|
||||
SysTime_t SysTimeFromMs( uint32_t timeMs );
|
||||
|
||||
/*!
|
||||
* @brief Convert a calendar time into time since UNIX epoch as a uint32_t.
|
||||
*
|
||||
* @param [IN] localtime Pointer to the object containing the calendar time
|
||||
* @retval timestamp The calendar time as seconds since UNIX epoch.
|
||||
*/
|
||||
uint32_t SysTimeMkTime( const struct tm* localtime );
|
||||
|
||||
/*!
|
||||
* @brief Converts a given time in seconds since UNIX epoch into calendar time.
|
||||
*
|
||||
* @param [IN] timestamp The time since UNIX epoch to convert into calendar time.
|
||||
* @param [OUT] localtime Pointer to the calendar time object which will contain
|
||||
the result of the conversion.
|
||||
*/
|
||||
void SysTimeLocalTime( const uint32_t timestamp, struct tm *localtime );
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // __STM32_SYS_TIME_H__
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
@@ -0,0 +1,292 @@
|
||||
/*!
|
||||
* \file timer.h
|
||||
*
|
||||
* \brief Timer objects and scheduling management implementation
|
||||
*
|
||||
* \copyright Revised BSD License, see section \ref LICENSE.
|
||||
*
|
||||
* \code
|
||||
* ______ _
|
||||
* / _____) _ | |
|
||||
* ( (____ _____ ____ _| |_ _____ ____| |__
|
||||
* \____ \| ___ | (_ _) ___ |/ ___) _ \
|
||||
* _____) ) ____| | | || |_| ____( (___| | | |
|
||||
* (______/|_____)_|_|_| \__)_____)\____)_| |_|
|
||||
* (C)2013-2017 Semtech
|
||||
*
|
||||
* \endcode
|
||||
*
|
||||
* \author Miguel Luis ( Semtech )
|
||||
*
|
||||
* \author Gregory Cristian ( Semtech )
|
||||
*/
|
||||
|
||||
/******************************************************************************
|
||||
* @file stm32_timer.h
|
||||
* @author MCD Application Team
|
||||
* @brief This is the header of the timer server driver
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© Copyright (c) 2019 STMicroelectronics.
|
||||
* All rights reserved.</center></h2>
|
||||
*
|
||||
* This software component is licensed by ST under BSD 3-Clause license,
|
||||
* the "License"; You may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at:
|
||||
* opensource.org/licenses/BSD-3-Clause
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef UTIL_TIME_SERVER_H__
|
||||
#define UTIL_TIME_SERVER_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** @defgroup TIMER_SERVER timer server
|
||||
* @{
|
||||
*/
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <cmsis_compiler.h>
|
||||
#include "utilities_conf.h"
|
||||
|
||||
/* Exported types ------------------------------------------------------------*/
|
||||
/** @defgroup TIMER_SERVER_exported_TypeDef TIMER_SERVER exported Typedef
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Timer mode
|
||||
*/
|
||||
typedef enum {
|
||||
UTIL_TIMER_ONESHOT = 0, /*!<One-shot timer. */
|
||||
UTIL_TIMER_PERIODIC = 1 /*!<Periodic timer. */
|
||||
} UTIL_TIMER_Mode_t;
|
||||
|
||||
|
||||
/**
|
||||
* @brief Timer status
|
||||
*/
|
||||
typedef enum {
|
||||
UTIL_TIMER_OK = 0, /*!<Operation terminated successfully.*/
|
||||
UTIL_TIMER_INVALID_PARAM = 1, /*!<Invalid Parameter. */
|
||||
UTIL_TIMER_HW_ERROR = 2, /*!<Hardware Error. */
|
||||
UTIL_TIMER_UNKNOWN_ERROR = 3 /*!<Unknown Error. */
|
||||
} UTIL_TIMER_Status_t;
|
||||
|
||||
/**
|
||||
* @brief Timer object description
|
||||
*/
|
||||
typedef struct TimerEvent_s
|
||||
{
|
||||
uint32_t Timestamp; /*!<Expiring timer value in ticks from TimerContext */
|
||||
uint32_t ReloadValue; /*!<Reload Value when Timer is restarted */
|
||||
uint8_t IsPending; /*!<Is the timer waiting for an event */
|
||||
uint8_t IsRunning; /*!<Is the timer running */
|
||||
uint8_t IsReloadStopped; /*!<Is the reload stopped */
|
||||
UTIL_TIMER_Mode_t Mode; /*!<Timer type : one-shot/continuous */
|
||||
void ( *Callback )( void *); /*!<callback function */
|
||||
void *argument; /*!<callback argument */
|
||||
struct TimerEvent_s *Next; /*!<Pointer to the next Timer object. */
|
||||
osTimerId Handle;
|
||||
} UTIL_TIMER_Object_t;
|
||||
|
||||
/**
|
||||
* @brief Timer driver definition
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
UTIL_TIMER_Status_t (* InitTimer )( void ); /*!< Initialisation of the low layer timer */
|
||||
UTIL_TIMER_Status_t (* DeInitTimer )( void ); /*!< Un-Initialisation of the low layer timer */
|
||||
|
||||
uint32_t (* SetTimerContext)( void ); /*!< Set the timer context */
|
||||
uint32_t (* GetTimerContext)( void ); /*!< Get the timer context */
|
||||
|
||||
uint32_t (* GetTimerElapsedTime)( void ); /*!< Get elapsed time */
|
||||
uint32_t (* GetTimerValue)( void ); /*!< Get timer value */
|
||||
uint32_t (* GetMinimumTimeout)( void ); /*!< Get Minimum timeout */
|
||||
|
||||
uint32_t (* ms2Tick)( uint32_t timeMicroSec ); /*!< convert ms to tick */
|
||||
uint32_t (* Tick2ms)( uint32_t tick ); /*!< convert tick into ms */
|
||||
} UTIL_TIMER_Driver_s;
|
||||
|
||||
/**
|
||||
* @brief Timer value on 32 bits
|
||||
*/
|
||||
typedef uint32_t UTIL_TIMER_Time_t;
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/* Exported variables ------------------------------------------------------------*/
|
||||
/** @defgroup TIMER_SERVER_exported_Variable TIMER_SERVER exported Variable
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* @brief low layer interface to handle timing execution
|
||||
*
|
||||
* @remark This structure is defined and initialized in the specific platform
|
||||
* timer implementation
|
||||
*/
|
||||
extern const UTIL_TIMER_Driver_s UTIL_TimerDriver;
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/* Exported constants --------------------------------------------------------*/
|
||||
/* External variables --------------------------------------------------------*/
|
||||
/* Exported macros -----------------------------------------------------------*/
|
||||
/* Exported functions ------------------------------------------------------- */
|
||||
|
||||
/** @defgroup TIMER_SERVER_exported_function TIMER_SERVER exported function
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Initialize the timer server
|
||||
*
|
||||
* @retval Status based on @ref UTIL_TIMER_Status_t
|
||||
*/
|
||||
UTIL_TIMER_Status_t UTIL_TIMER_Init(void);
|
||||
|
||||
/**
|
||||
* @brief Un-Initialize the timer server
|
||||
*
|
||||
* @retval Status based on @ref UTIL_TIMER_Status_t
|
||||
*/
|
||||
UTIL_TIMER_Status_t UTIL_TIMER_DeInit(void);
|
||||
|
||||
/**
|
||||
* @brief Create the timer object
|
||||
*
|
||||
* @remark TimerSetValue function must be called before starting the timer.
|
||||
* this function initializes timestamp and reload value at 0.
|
||||
*
|
||||
* @param TimerObject Structure containing the timer object parameters
|
||||
* @param PeriodValue Period value of the timer in ms
|
||||
* @param Mode @ref UTIL_TIMER_Mode_t
|
||||
* @param Callback Function callback called at the end of the timeout
|
||||
* @param Argument argument for the callback function
|
||||
* @retval Status based on @ref UTIL_TIMER_Status_t
|
||||
*/
|
||||
UTIL_TIMER_Status_t UTIL_TIMER_Create( UTIL_TIMER_Object_t *TimerObject, uint32_t PeriodValue, UTIL_TIMER_Mode_t Mode, void ( *Callback )( void *) , void *Argument);
|
||||
|
||||
/**
|
||||
* @brief Start and adds the timer object to the list of timer events
|
||||
*
|
||||
* @param TimerObject Structure containing the timer object parameters
|
||||
* @retval Status based on @ref UTIL_TIMER_Status_t
|
||||
*/
|
||||
UTIL_TIMER_Status_t UTIL_TIMER_Start( UTIL_TIMER_Object_t *TimerObject );
|
||||
|
||||
/**
|
||||
* @brief Start and adds the timer object to the list of timer events
|
||||
*
|
||||
* @param TimerObject Structure containing the timer object parameters
|
||||
* @param PeriodValue period value of the timer
|
||||
* @retval Status based on @ref UTIL_TIMER_Status_t
|
||||
*/
|
||||
UTIL_TIMER_Status_t UTIL_TIMER_StartWithPeriod( UTIL_TIMER_Object_t *TimerObject, uint32_t PeriodValue);
|
||||
|
||||
/**
|
||||
* @brief Stop and removes the timer object from the list of timer events
|
||||
*
|
||||
* @param TimerObject Structure containing the timer object parameters
|
||||
* @retval Status based on @ref UTIL_TIMER_Status_t
|
||||
*/
|
||||
UTIL_TIMER_Status_t UTIL_TIMER_Stop( UTIL_TIMER_Object_t *TimerObject );
|
||||
|
||||
|
||||
/**
|
||||
* @brief update the period and start the timer
|
||||
*
|
||||
* @param TimerObject Structure containing the timer object parameters
|
||||
* @param NewPeriodValue new period value of the timer
|
||||
* @retval Status based on @ref UTIL_TIMER_Status_t
|
||||
*/
|
||||
UTIL_TIMER_Status_t UTIL_TIMER_SetPeriod(UTIL_TIMER_Object_t *TimerObject, uint32_t NewPeriodValue);
|
||||
|
||||
/**
|
||||
* @brief update the period and start the timer
|
||||
*
|
||||
* @param TimerObject Structure containing the timer object parameters
|
||||
* @param ReloadMode new reload mode @ref UTIL_TIMER_Mode_t
|
||||
* @retval Status based on @ref UTIL_TIMER_Status_t
|
||||
*/
|
||||
UTIL_TIMER_Status_t UTIL_TIMER_SetReloadMode(UTIL_TIMER_Object_t *TimerObject, UTIL_TIMER_Mode_t ReloadMode);
|
||||
|
||||
/**
|
||||
* @brief get the remaining time before timer expiration
|
||||
* *
|
||||
* @param TimerObject Structure containing the timer object parameters
|
||||
* @param Time time before expiration in ms
|
||||
* @retval Status based on @ref UTIL_TIMER_Status_t
|
||||
*/
|
||||
UTIL_TIMER_Status_t UTIL_TIMER_GetRemainingTime(UTIL_TIMER_Object_t *TimerObject, uint32_t *Time);
|
||||
|
||||
/**
|
||||
* @brief return timer state
|
||||
*
|
||||
* @param TimerObject Structure containing the timer object parameters
|
||||
* @retval boolean value is returned 0 = false and 1 = true
|
||||
*/
|
||||
uint32_t UTIL_TIMER_IsRunning( UTIL_TIMER_Object_t *TimerObject );
|
||||
|
||||
|
||||
/**
|
||||
* @brief return the remaining time of the first timer in the chain list
|
||||
*
|
||||
* @retval return the time in ms, the value 0xFFFFFFFF means no timer running
|
||||
*/
|
||||
uint32_t UTIL_TIMER_GetFirstRemainingTime(void);
|
||||
|
||||
/**
|
||||
* @brief return the current time
|
||||
*
|
||||
* @retval time value
|
||||
*/
|
||||
UTIL_TIMER_Time_t UTIL_TIMER_GetCurrentTime(void);
|
||||
|
||||
|
||||
/**
|
||||
* @brief return the elapsed time
|
||||
*
|
||||
* @param past a value returned by the function UTIL_TIMER_GetCurrentTime
|
||||
* @retval elasped time value
|
||||
*/
|
||||
UTIL_TIMER_Time_t UTIL_TIMER_GetElapsedTime(UTIL_TIMER_Time_t past );
|
||||
|
||||
/**
|
||||
* @brief Timer IRQ event handler
|
||||
*
|
||||
* @note Head Timer Object is automatically removed from the List
|
||||
*
|
||||
* @note e.g. it is not needed to stop it
|
||||
*/
|
||||
void UTIL_TIMER_IRQ_Handler( void );
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* UTIL_TIME_SERVER_H__*/
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
Reference in New Issue
Block a user