diff options
author | Rikus Wessels <rikus@umantec.net> | 2016-06-06 09:51:32 +0200 |
---|---|---|
committer | Rikus Wessels <rikus@umantec.net> | 2016-06-06 09:51:32 +0200 |
commit | 28e5d33f6d028697606f287f6e12f1acabf21307 (patch) | |
tree | b7ee5f66ffdab7c30874f004f5621be7be6e8084 /examples | |
parent | 040c4fb533b24de4265f6d1e99435a736fa6b18e (diff) | |
download | Open-AVB-28e5d33f6d028697606f287f6e12f1acabf21307.tar.gz |
Added gptpgetdata
Diffstat (limited to 'examples')
-rw-r--r-- | examples/common/avb.c | 20 | ||||
-rw-r--r-- | examples/common/avb.h | 8 |
2 files changed, 21 insertions, 7 deletions
diff --git a/examples/common/avb.c b/examples/common/avb.c index 7c23b460..a914605f 100644 --- a/examples/common/avb.c +++ b/examples/common/avb.c @@ -154,13 +154,13 @@ int gptpdeinit(int *igb_shm_fd, char **igb_mmap) } /** - * @brief Read the ptp data from IPC memory and print its contents + * @brief Read the ptp data from IPC memory * @param igb_mmap [in] Pointer to mapping * @param td [inout] Struct to read the data into * @return 0 for success, negative for failure */ -int gptpscaling(char *igb_mmap, gPtpTimeData *td) +int gptpgetdata(char *igb_mmap, gPtpTimeData *td) { if (NULL == igb_mmap || NULL == td) { return -1; @@ -169,6 +169,22 @@ int gptpscaling(char *igb_mmap, gPtpTimeData *td) memcpy(td, igb_mmap + sizeof(pthread_mutex_t), sizeof(*td)); pthread_mutex_unlock((pthread_mutex_t *) igb_mmap); + return 0; +} + +/** + * @brief Read the ptp data from IPC memory and print its contents + * @param igb_mmap [in] Pointer to mapping + * @param td [inout] Struct to read the data into + * @return 0 for success, negative for failure + */ + +int gptpscaling(char *igb_mmap, gPtpTimeData *td) //change this function name ?? +{ + int i; + if ((i = gptpgetdata(igb_mmap, td)) < 0) { + return i; + } fprintf(stderr, "ml_phoffset = %" PRId64 ", ls_phoffset = %" PRId64 "\n", td->ml_phoffset, td->ls_phoffset); fprintf(stderr, "ml_freqffset = %Lf, ls_freqoffset = %Lf\n", diff --git a/examples/common/avb.h b/examples/common/avb.h index 360ae7ed..04a8bd09 100644 --- a/examples/common/avb.h +++ b/examples/common/avb.h @@ -112,14 +112,12 @@ typedef enum { false = 0, true = 1 } bool; int pci_connect(device_t * igb_dev); +int gptpinit(int *shm_fd, char **memory_offset_buffer); +int gptpdeinit(int *shm_fd, char **memory_offset_buffer); +int gptpgetdata(char *igb_mmap, gPtpTimeData *td); int gptpscaling(char *igb_mmap, gPtpTimeData *td); - bool gptplocaltime(const gPtpTimeData * td, uint64_t* now_local); -int gptpdeinit(int *shm_fd, char **memory_offset_buffer); - -int gptpinit(int *shm_fd, char **memory_offset_buffer); - void avb_set_1722_cd_indicator(seventeen22_header *h1722, uint64_t cd_indicator); uint64_t avb_get_1722_cd_indicator(seventeen22_header *h1722); void avb_set_1722_subtype(seventeen22_header *h1722, uint64_t subtype); |