pps_gen.h 1.19 KB
Newer Older
1 2 3 4 5
/*
 * This work is part of the White Rabbit project
 *
 * Released according to the GNU GPL, version 2 or any later version.
 */
Tomasz Wlostowski's avatar
Tomasz Wlostowski committed
6 7 8
#ifndef __PPS_GEN_H
#define __PPS_GEN_H

9 10 11 12
#include <stdint.h>

#define PPSG_ADJUST_SEC 0x1
#define PPSG_ADJUST_NSEC 0x2
13 14 15
#define PPSG_SET_SEC 0x1
#define PPSG_SET_NSEC 0x2
#define PPSG_SET_ALL 0x3
16 17

/* Initializes the PPS Generator. 0 on success, negative on failure. */
18
void shw_pps_gen_init(void);
19 20

/* Adjusts the <counter> (PPSG_ADJUST_SEC/NSEC) by (how_much) seconds/nanoseconds */
21
int shw_pps_gen_adjust(int counter, int64_t how_much);
22 23

/* Returns 1 when the PPS is busy adjusting its time counters, 0 if PPS gen idle */
24
int shw_pps_gen_busy(void);
25 26

/* Enables/disables PPS Generator PPS output */
27
int shw_pps_gen_enable_output(int enable);
28

29 30 31
/* Time valid */
int shw_pps_gen_time_valid(int valid);

32 33 34
/* Masks/unmasks PPS output when link is down (useful in master mode) */
int shw_pps_gen_unmask_output(int unmask);

35
/* Reads the current time and stores at <seconds,nanoseconds>. */
36
void shw_pps_gen_get_time(uint64_t * seconds, uint32_t * nanoseconds);
37 38

/* Sets the time to <seconds,nanoseconds>. */
39
void shw_pps_gen_set_time(uint64_t seconds, uint32_t nanoseconds, int counter);
40

Tomasz Wlostowski's avatar
Tomasz Wlostowski committed
41
#endif