summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/common/avb.c20
-rw-r--r--examples/common/avb.h8
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);