PTPC driver. More...
Data Structures | |
| struct | ptpc_config_t |
| Timer config. More... | |
Macros | |
| #define | PTPC_EVENT_COMPARE0_MASK PTPC_INT_STS_COMP_INT_STS0_MASK |
| #define | PTPC_EVENT_CAPTURE0_MASK PTPC_INT_STS_CAPTURE_INT_STS0_MASK |
| #define | PTPC_EVENT_PPS0_MASK PTPC_INT_STS_PPS_INT_STS0_MASK |
| #define | PTPC_EVENT_COMPARE1_MASK PTPC_INT_STS_COMP_INT_STS1_MASK |
| #define | PTPC_EVENT_CAPTURE1_MASK PTPC_INT_STS_CAPTURE_INT_STS1_MASK |
| #define | PTPC_EVENT_PPS1_MASK PTPC_INT_STS_PPS_INT_STS1_MASK |
| #define | PTPC_MAX_NS_COUNTER (0x3B9ACA00UL) |
Typedefs | |
| typedef enum ptpc_ns_counter_rollover_type | ptpc_ns_counter_rollover_type_t |
| Counter types. More... | |
| typedef enum ptpc_capture_trigger_type | ptpc_capture_trigger_type_t |
| Capture trigger types. More... | |
| typedef enum ptpc_counting_mode | ptpc_counting_mode |
| Capture trigger types. More... | |
Enumerations | |
| enum | ptpc_ns_counter_rollover_type { ptpc_ns_counter_rollover_binary = 0 , ptpc_ns_counter_rollover_digital = 1 } |
| Counter types. More... | |
| enum | ptpc_capture_trigger_type { ptpc_capture_trigger_none = 0 , ptpc_capture_trigger_on_rising_edge = PTPC_PTPC_CTRL0_CAPT_SNAP_POS_EN_MASK , ptpc_capture_trigger_on_failing_edge = PTPC_PTPC_CTRL0_CAPT_SNAP_NEG_EN_MASK , ptpc_capture_trigger_on_both_edges } |
| Capture trigger types. More... | |
| enum | ptpc_counting_mode { ptpc_counting_increment = 0 , ptpc_counting_decrement = 1 } |
| Capture trigger types. More... | |
Functions | |
| static void | ptpc_set_ns_counter_rollover (PTPC_Type *ptr, uint8_t index, ptpc_ns_counter_rollover_type_t rollover) |
| Configure ns counter rollover mode. More... | |
| static void | ptpc_enable_capture_keep (PTPC_Type *ptr, uint8_t index) |
| Enable capture keep. More... | |
| static void | ptpc_disable_capture_keep (PTPC_Type *ptr, uint8_t index) |
| Disable capture keep. More... | |
| static void | ptpc_set_ns_counter_update_type (PTPC_Type *ptr, uint8_t index, bool coarse_update) |
| Update ns counter update type. More... | |
| static void | ptpc_set_ns_counter_step (PTPC_Type *ptr, uint8_t index, uint32_t ns_step) |
| Set ns counter increment step. More... | |
| static void | ptpc_set_second_update (PTPC_Type *ptr, uint8_t index, uint32_t sec) |
| Set Second portion update value. More... | |
| hpm_stat_t | ptpc_set_ns_update (PTPC_Type *ptr, uint8_t index, uint32_t ns, ptpc_counting_mode mode) |
| Set ns portion update value. More... | |
| static uint32_t | ptpc_get_timestamp_second (PTPC_Type *ptr, uint8_t index) |
| Get current timestamp Second portion. More... | |
| static uint32_t | ptpc_get_timestamp_ns (PTPC_Type *ptr, uint8_t index) |
| Get timestamp ns portion. More... | |
| static void | ptpc_config_compare (PTPC_Type *ptr, uint8_t index, uint32_t sec, uint32_t ns) |
| Config compare. More... | |
| static void | ptpc_update_timestamp_second (PTPC_Type *ptr, uint8_t index, uint32_t sec) |
| Update Second portion. More... | |
| static void | ptpc_update_timestamp_ns (PTPC_Type *ptr, uint8_t index, uint32_t ns, ptpc_counting_mode mode) |
| Update Ns portion. More... | |
| static void | ptpc_enable_timer (PTPC_Type *ptr, uint8_t index) |
| Enable timer. More... | |
| static void | ptpc_disable_timer (PTPC_Type *ptr, uint8_t index) |
| Disable timer. More... | |
| static void | ptpc_config_capture (PTPC_Type *ptr, uint8_t index, ptpc_capture_trigger_type_t trigger) |
| Config capture trigger event. More... | |
| static uint32_t | ptpc_get_capture_ns (PTPC_Type *ptr, uint8_t index) |
| Get snapped ns value. More... | |
| static uint32_t | ptpc_get_capture_second (PTPC_Type *ptr, uint8_t index) |
| Get captured second. More... | |
| static void | ptpc_clear_irq_status (PTPC_Type *ptr, uint32_t mask) |
| Clear interrupt status. More... | |
| static uint32_t | ptpc_get_irq_status (PTPC_Type *ptr) |
| Get interrupt status. More... | |
| static void | ptpc_irq_disable (PTPC_Type *ptr, uint32_t mask) |
| Disable interrupt with mask. More... | |
| static void | ptpc_irq_enable (PTPC_Type *ptr, uint32_t mask) |
| Enable interrupt with mask. More... | |
| hpm_stat_t | ptpc_init (PTPC_Type *ptr, uint8_t index, ptpc_config_t *config) |
| Initialize PTPC module. More... | |
| hpm_stat_t | ptpc_set_timer_output (PTPC_Type *ptr, uint8_t can_index, bool use_ptpc1) |
| Set PTPC output destination. More... | |
| void | ptpc_get_default_config (PTPC_Type *ptr, ptpc_config_t *config) |
| Get default config. More... | |
| void | ptpc_init_timer (PTPC_Type *ptr, uint8_t index) |
| Initialize timer to count from 0. More... | |
| hpm_stat_t | ptpc_init_timer_with_initial (PTPC_Type *ptr, uint8_t index, uint32_t sec, uint32_t ns, ptpc_counting_mode mode) |
| Initialize timer with initial values. More... | |
| hpm_stat_t | ptpc_update_timer (PTPC_Type *ptr, uint8_t index, uint32_t sec, uint32_t ns, ptpc_counting_mode mode) |
| Update timestamp counter. More... | |
| hpm_stat_t | ptpc_set_pps (PTPC_Type *ptr, uint8_t index, uint8_t p) |
| Set period of pulse generated per second. More... | |
PTPC driver.
| #define PTPC_EVENT_CAPTURE0_MASK PTPC_INT_STS_CAPTURE_INT_STS0_MASK |
#include <drivers/inc/hpm_ptpc_drv.h>
| #define PTPC_EVENT_CAPTURE1_MASK PTPC_INT_STS_CAPTURE_INT_STS1_MASK |
#include <drivers/inc/hpm_ptpc_drv.h>
| #define PTPC_EVENT_COMPARE0_MASK PTPC_INT_STS_COMP_INT_STS0_MASK |
#include <drivers/inc/hpm_ptpc_drv.h>
| #define PTPC_EVENT_COMPARE1_MASK PTPC_INT_STS_COMP_INT_STS1_MASK |
#include <drivers/inc/hpm_ptpc_drv.h>
| #define PTPC_EVENT_PPS0_MASK PTPC_INT_STS_PPS_INT_STS0_MASK |
#include <drivers/inc/hpm_ptpc_drv.h>
| #define PTPC_EVENT_PPS1_MASK PTPC_INT_STS_PPS_INT_STS1_MASK |
#include <drivers/inc/hpm_ptpc_drv.h>
| #define PTPC_MAX_NS_COUNTER (0x3B9ACA00UL) |
#include <drivers/inc/hpm_ptpc_drv.h>
| typedef enum ptpc_capture_trigger_type ptpc_capture_trigger_type_t |
#include <drivers/inc/hpm_ptpc_drv.h>
Capture trigger types.
| typedef enum ptpc_counting_mode ptpc_counting_mode |
#include <drivers/inc/hpm_ptpc_drv.h>
Capture trigger types.
#include <drivers/inc/hpm_ptpc_drv.h>
Counter types.
#include <drivers/inc/hpm_ptpc_drv.h>
Capture trigger types.
| Enumerator | |
|---|---|
| ptpc_capture_trigger_none | |
| ptpc_capture_trigger_on_rising_edge | |
| ptpc_capture_trigger_on_failing_edge | |
| ptpc_capture_trigger_on_both_edges | |
| enum ptpc_counting_mode |
#include <drivers/inc/hpm_ptpc_drv.h>
Capture trigger types.
| Enumerator | |
|---|---|
| ptpc_counting_increment | Increment the counter |
| ptpc_counting_decrement | Decrement the counter |
#include <drivers/inc/hpm_ptpc_drv.h>
Counter types.
| Enumerator | |
|---|---|
| ptpc_ns_counter_rollover_binary | binary mode, resolution ~0.466ns, overflow at 0x7FFFFFFF |
| ptpc_ns_counter_rollover_digital | digital mode, resolution 1ns, overflow at 0x3B9ACA00 |
|
inlinestatic |
#include <drivers/inc/hpm_ptpc_drv.h>
Clear interrupt status.
| [in] | ptr | PTPC base address |
| [in] | mask | Mask of interrupts to be cleared |
|
inlinestatic |
#include <drivers/inc/hpm_ptpc_drv.h>
Config capture trigger event.
| [in] | ptr | PTPC base address |
| [in] | index | Target index |
| [in] | trigger | Capture trigger type |
|
inlinestatic |
#include <drivers/inc/hpm_ptpc_drv.h>
Config compare.
| [in] | ptr | PTPC base address |
| [in] | index | Target index |
| [in] | sec | Target second |
| [in] | ns | Target ns |
|
inlinestatic |
#include <drivers/inc/hpm_ptpc_drv.h>
Disable capture keep.
| [in] | ptr | PTPC base address |
| [in] | index | Target index |
|
inlinestatic |
#include <drivers/inc/hpm_ptpc_drv.h>
Disable timer.
| [in] | ptr | PTPC base address |
| [in] | index | Target index |
|
inlinestatic |
#include <drivers/inc/hpm_ptpc_drv.h>
Enable capture keep.
| [in] | ptr | PTPC base address |
| [in] | index | Target index |
|
inlinestatic |
#include <drivers/inc/hpm_ptpc_drv.h>
Enable timer.
| [in] | ptr | PTPC base address |
| [in] | index | Target index |
|
inlinestatic |
#include <drivers/inc/hpm_ptpc_drv.h>
Get snapped ns value.
| [in] | ptr | PTPC base address |
| [in] | index | Target index |
|
inlinestatic |
#include <drivers/inc/hpm_ptpc_drv.h>
Get captured second.
| [in] | ptr | PTPC base address |
| [in] | index | Target index |
| void ptpc_get_default_config | ( | PTPC_Type * | ptr, |
| ptpc_config_t * | config | ||
| ) |
#include <drivers/inc/hpm_ptpc_drv.h>
Get default config.
| [in] | ptr | PTPC base address |
| [out] | config | Pointer of config struct |
|
inlinestatic |
#include <drivers/inc/hpm_ptpc_drv.h>
Get interrupt status.
| [in] | ptr | PTPC base address |
|
inlinestatic |
#include <drivers/inc/hpm_ptpc_drv.h>
Get timestamp ns portion.
| [in] | ptr | PTPC base address |
| [in] | index | Target index |
|
inlinestatic |
#include <drivers/inc/hpm_ptpc_drv.h>
Get current timestamp Second portion.
| [in] | ptr | PTPC base address |
| [in] | index | Target index |
| hpm_stat_t ptpc_init | ( | PTPC_Type * | ptr, |
| uint8_t | index, | ||
| ptpc_config_t * | config | ||
| ) |
#include <drivers/inc/hpm_ptpc_drv.h>
Initialize PTPC module.
| [in] | ptr | PTPC base address |
| [in] | index | Target index |
| [in] | config | Pointer to configuration struct |
| void ptpc_init_timer | ( | PTPC_Type * | ptr, |
| uint8_t | index | ||
| ) |
#include <drivers/inc/hpm_ptpc_drv.h>
Initialize timer to count from 0.
| [in] | ptr | PTPC base address |
| [in] | index | Target index |
| hpm_stat_t ptpc_init_timer_with_initial | ( | PTPC_Type * | ptr, |
| uint8_t | index, | ||
| uint32_t | sec, | ||
| uint32_t | ns, | ||
| ptpc_counting_mode | mode | ||
| ) |
#include <drivers/inc/hpm_ptpc_drv.h>
Initialize timer with initial values.
| [in] | ptr | PTPC base address |
| [in] | index | Target index |
| [in] | sec | Seconds |
| [in] | ns | Ns |
| [in] | mode | Counting mode |
|
inlinestatic |
#include <drivers/inc/hpm_ptpc_drv.h>
Disable interrupt with mask.
| [in] | ptr | PTPC base address |
| [in] | mask | Mask of interrupts to be disabled |
|
inlinestatic |
#include <drivers/inc/hpm_ptpc_drv.h>
Enable interrupt with mask.
| [in] | ptr | PTPC base address |
| [in] | mask | Mask of interrupts to be enabled |
|
inlinestatic |
#include <drivers/inc/hpm_ptpc_drv.h>
Configure ns counter rollover mode.
| [in] | ptr | PTPC base address |
| [in] | index | Index of target counter |
| [in] | rollover | Rollover type |
|
inlinestatic |
#include <drivers/inc/hpm_ptpc_drv.h>
Set ns counter increment step.
| [in] | ptr | PTPC base address |
| [in] | index | Target index |
| [in] | ns_step | Increment step |
|
inlinestatic |
#include <drivers/inc/hpm_ptpc_drv.h>
Update ns counter update type.
| [in] | ptr | PTPC base address |
| [in] | index | Index of target counter |
| [in] | coarse_update | Counter will be increment by 1 on |
| hpm_stat_t ptpc_set_ns_update | ( | PTPC_Type * | ptr, |
| uint8_t | index, | ||
| uint32_t | ns, | ||
| ptpc_counting_mode | mode | ||
| ) |
#include <drivers/inc/hpm_ptpc_drv.h>
Set ns portion update value.
| [in] | ptr | PTPC base address |
| [in] | index | Target index |
| [in] | ns | Ns value (31 bits, 0x3B9ACA00 max) |
| [in] | mode | Counting mode |
| hpm_stat_t ptpc_set_pps | ( | PTPC_Type * | ptr, |
| uint8_t | index, | ||
| uint8_t | p | ||
| ) |
#include <drivers/inc/hpm_ptpc_drv.h>
Set period of pulse generated per second.
| [in] | ptr | PTPC base address |
| [in] | index | Target index |
| [in] | p | (2^power Hz, from [0 - 15]) |
|
inlinestatic |
#include <drivers/inc/hpm_ptpc_drv.h>
Set Second portion update value.
| [in] | ptr | PTPC base address |
| [in] | index | Target index |
| [in] | sec | Second value |
| hpm_stat_t ptpc_set_timer_output | ( | PTPC_Type * | ptr, |
| uint8_t | can_index, | ||
| bool | use_ptpc1 | ||
| ) |
#include <drivers/inc/hpm_ptpc_drv.h>
Set PTPC output destination.
| [in] | ptr | PTPC base address |
| [in] | can_index | Target CAN instance |
| [in] | use_ptpc1 | Use PTPC1 if set to true, otherwise PTPC0 |
| hpm_stat_t ptpc_update_timer | ( | PTPC_Type * | ptr, |
| uint8_t | index, | ||
| uint32_t | sec, | ||
| uint32_t | ns, | ||
| ptpc_counting_mode | mode | ||
| ) |
#include <drivers/inc/hpm_ptpc_drv.h>
Update timestamp counter.
| [in] | ptr | PTPC base address |
| [in] | index | Target index |
| [in] | sec | Seconds |
| [in] | ns | Ns |
| [in] | mode | Counting mode |
|
inlinestatic |
#include <drivers/inc/hpm_ptpc_drv.h>
Update Ns portion.
| [in] | ptr | PTPC base address |
| [in] | index | Target index |
| [in] | ns | Target ns |
| [in] | mode | Counting mode |
|
inlinestatic |
#include <drivers/inc/hpm_ptpc_drv.h>
Update Second portion.
| [in] | ptr | PTPC base address |
| [in] | index | Target index |
| [in] | sec | Target second |