summaryrefslogtreecommitdiff
path: root/hal/phy/maximus/test/src/test_phy_access.c
diff options
context:
space:
mode:
Diffstat (limited to 'hal/phy/maximus/test/src/test_phy_access.c')
-rw-r--r--hal/phy/maximus/test/src/test_phy_access.c120
1 files changed, 105 insertions, 15 deletions
diff --git a/hal/phy/maximus/test/src/test_phy_access.c b/hal/phy/maximus/test/src/test_phy_access.c
index 5c3b80830b..17d8140799 100644
--- a/hal/phy/maximus/test/src/test_phy_access.c
+++ b/hal/phy/maximus/test/src/test_phy_access.c
@@ -58,8 +58,12 @@ void phy_access_backoff_start_test_case(test_t t)
set_node_t *found_node;
// open pipe
+#ifdef STATION_SOCK
+ fd_in = my_station.sock_pair_fd;
+#else /* STATION_SOCK */
fd_in = open(my_station.pipe_out_name, O_RDONLY);
-
+#endif /* STATION_SOCK */
+
// read sci and netclock headers
memset(data, '\0', 256);
test_fail_unless ((-1 != fd_in)
@@ -73,7 +77,9 @@ void phy_access_backoff_start_test_case(test_t t)
test_fail_unless (date == ntohl(netclock_hdr->tick_low));
// close pipe
+#ifndef STATION_SOCK
close(fd_in);
+#endif /* !STATION_SOCK */
// get new network tick
msg_tick_tck = (((unsigned long long)(ntohl(netclock_hdr->tick_high))) << 32)
@@ -114,8 +120,12 @@ void phy_access_backoff_start_test_case(test_t t)
set_node_t *found_node;
// open pipe
+#ifdef STATION_SOCK
+ fd_in = my_station.sock_pair_fd;
+#else /* STATION_SOCK */
fd_in = open(my_station.pipe_out_name, O_RDONLY);
-
+#endif /* STATION_SOCK */
+
// read sci and netclock headers
memset(data, '\0', 256);
test_fail_unless ((-1 != fd_in)
@@ -129,7 +139,9 @@ void phy_access_backoff_start_test_case(test_t t)
test_fail_unless ((my_station.current_tick_tck & 0x00000000FFFFFFFF) + (unsigned long)MAC_SLOT_TCK == ntohl(netclock_hdr->tick_low));
// close pipe
+#ifndef STATION_SOCK
close(fd_in);
+#endif /* !STATION_SOCK */
/* Remove netclock callback. */
@@ -156,8 +168,12 @@ void phy_access_backoff_start_test_case(test_t t)
set_node_t *found_node;
// open pipe
+#ifdef STATION_SOCK
+ fd_in = my_station.sock_pair_fd;
+#else /* STATION_SOCK */
fd_in = open(my_station.pipe_out_name, O_RDONLY);
-
+#endif /* STATION_SOCK */
+
// read sci and netclock headers
memset(data, '\0', 256);
test_fail_unless ((-1 != fd_in)
@@ -171,7 +187,9 @@ void phy_access_backoff_start_test_case(test_t t)
test_fail_unless ((my_station.current_tick_tck & 0x00000000FFFFFFFF) + (unsigned long)MAXIMUS_PHY_PRS_DETECTION_DELAY_TCK == ntohl(netclock_hdr->tick_low));
// close pipe
+#ifndef STATION_SOCK
close(fd_in);
+#endif /* !STATION_SOCK */
// get new network tick
msg_tick_tck = (((unsigned long long)(ntohl(netclock_hdr->tick_high))) << 32)
@@ -212,8 +230,12 @@ void phy_access_backoff_start_test_case(test_t t)
uint8_t prs0 = 1;
// open pipe
+#ifdef STATION_SOCK
+ fd_in = my_station.sock_pair_fd;
+#else /* STATION_SOCK */
fd_in = open(my_station.pipe_out_name, O_RDONLY);
-
+#endif /* STATION_SOCK */
+
// read sci and phy headers
memset(data, '\0', SCI_MSG_MAX_SIZE);
test_fail_unless ((-1 != fd_in)
@@ -233,7 +255,9 @@ void phy_access_backoff_start_test_case(test_t t)
test_fail_unless (0 == memcmp(&prs0, data+sizeof(sci_msg_hdr_t)+sizeof(phy_msg_hdr_t), sizeof(u8)));
// close pipe
+#ifndef STATION_SOCK
close(fd_in);
+#endif /* !STATION_SOCK */
} test_end;
// check that the correct netclock message has been sent to Maximus
@@ -248,8 +272,12 @@ void phy_access_backoff_start_test_case(test_t t)
set_node_t *found_node;
// open pipe
+#ifdef STATION_SOCK
+ fd_in = my_station.sock_pair_fd;
+#else /* STATION_SOCK */
fd_in = open(my_station.pipe_out_name, O_RDONLY);
-
+#endif /* STATION_SOCK */
+
// read sci and netclock headers
memset(data, '\0', 256);
test_fail_unless ((-1 != fd_in)
@@ -264,7 +292,9 @@ void phy_access_backoff_start_test_case(test_t t)
test_fail_unless ((my_station.current_tick_tck & 0x00000000FFFFFFFF) + (unsigned long)MAC_SLOT_TCK - (unsigned long)MAXIMUS_PHY_PRS_DETECTION_DELAY_TCK == ntohl(netclock_hdr->tick_low));
// close pipe
+#ifndef STATION_SOCK
close(fd_in);
+#endif /* !STATION_SOCK */
// get new network tick
msg_tick_tck = (((unsigned long long)(ntohl(sci_hdr->netclock_high))) << 32)
@@ -307,8 +337,12 @@ void phy_access_backoff_start_test_case(test_t t)
set_node_t *found_node;
// open pipe
+#ifdef STATION_SOCK
+ fd_in = my_station.sock_pair_fd;
+#else /* STATION_SOCK */
fd_in = open(my_station.pipe_out_name, O_RDONLY);
-
+#endif /* STATION_SOCK */
+
// read sci and netclock headers
memset(data, '\0', 256);
test_fail_unless ((-1 != fd_in)
@@ -322,7 +356,9 @@ void phy_access_backoff_start_test_case(test_t t)
test_fail_unless ((my_station.current_tick_tck & 0x00000000FFFFFFFF) + (unsigned long)MAC_SLOT_TCK == ntohl(netclock_hdr->tick_low));
// close pipe
+#ifndef STATION_SOCK
close(fd_in);
+#endif /* !STATION_SOCK */
/* Remove netclock callback. */
@@ -362,8 +398,12 @@ void phy_access_backoff_start_test_case(test_t t)
set_node_t *found_node;
// open pipe
+#ifdef STATION_SOCK
+ fd_in = my_station.sock_pair_fd;
+#else /* STATION_SOCK */
fd_in = open(my_station.pipe_out_name, O_RDONLY);
-
+#endif /* STATION_SOCK */
+
// read sci and netclock headers
memset(data, '\0', 256);
test_fail_unless ((-1 != fd_in)
@@ -378,7 +418,9 @@ void phy_access_backoff_start_test_case(test_t t)
test_fail_unless ((my_station.current_tick_tck & 0x00000000FFFFFFFF) + (unsigned long)MAXIMUS_PHY_PRS_DETECTION_DELAY_TCK == ntohl(netclock_hdr->tick_low));
// close pipe
+#ifndef STATION_SOCK
close(fd_in);
+#endif /* !STATION_SOCK */
// get new network tick
msg_tick_tck = (((unsigned long long)(ntohl(sci_hdr->netclock_high))) << 32)
@@ -419,8 +461,12 @@ void phy_access_backoff_start_test_case(test_t t)
uint8_t prs1 = 1;
// open pipe
+#ifdef STATION_SOCK
+ fd_in = my_station.sock_pair_fd;
+#else /* STATION_SOCK */
fd_in = open(my_station.pipe_out_name, O_RDONLY);
-
+#endif /* STATION_SOCK */
+
// read sci and phy headers
memset(data, '\0', SCI_MSG_MAX_SIZE);
test_fail_unless ((-1 != fd_in)
@@ -440,7 +486,9 @@ void phy_access_backoff_start_test_case(test_t t)
test_fail_unless (0 == memcmp(&prs1, data+sizeof(sci_msg_hdr_t)+sizeof(phy_msg_hdr_t), sizeof(u8)));
// close pipe
+#ifndef STATION_SOCK
close(fd_in);
+#endif /* !STATION_SOCK */
} test_end;
// check that the correct netclock message has been sent to Maximus
@@ -452,8 +500,12 @@ void phy_access_backoff_start_test_case(test_t t)
int fd_in = -1;
// open pipe
+#ifdef STATION_SOCK
+ fd_in = my_station.sock_pair_fd;
+#else /* STATION_SOCK */
fd_in = open(my_station.pipe_out_name, O_RDONLY);
-
+#endif /* STATION_SOCK */
+
// read sci and netclock headers
memset(data, '\0', 256);
test_fail_unless ((-1 != fd_in)
@@ -468,7 +520,9 @@ void phy_access_backoff_start_test_case(test_t t)
test_fail_unless ((my_station.current_tick_tck & 0x00000000FFFFFFFF) + (unsigned long)MAC_SLOT_TCK - (unsigned long)MAXIMUS_PHY_PRS_DETECTION_DELAY_TCK == ntohl(netclock_hdr->tick_low));
// close pipe
+#ifndef STATION_SOCK
close(fd_in);
+#endif /* !STATION_SOCK */
// get new network tick
msg_tick_tck = (((unsigned long long)(ntohl(sci_hdr->netclock_high))) << 32)
@@ -496,8 +550,12 @@ void phy_access_backoff_start_test_case(test_t t)
int fd_in = -1;
// open pipe
+#ifdef STATION_SOCK
+ fd_in = my_station.sock_pair_fd;
+#else /* STATION_SOCK */
fd_in = open(my_station.pipe_out_name, O_RDONLY);
-
+#endif /* STATION_SOCK */
+
// read sci and netclock headers
memset(data, '\0', 256);
test_fail_unless ((-1 != fd_in)
@@ -511,7 +569,9 @@ void phy_access_backoff_start_test_case(test_t t)
test_fail_unless (ntohs(netclock_hdr->id) == id);
// close pipe
+#ifndef STATION_SOCK
close(fd_in);
+#endif /* !STATION_SOCK */
} test_end;
// check that the correct netclock message has been sent to Maximus
@@ -522,8 +582,12 @@ void phy_access_backoff_start_test_case(test_t t)
int fd_in = -1;
// open pipe
+#ifdef STATION_SOCK
+ fd_in = my_station.sock_pair_fd;
+#else /* STATION_SOCK */
fd_in = open(my_station.pipe_out_name, O_RDONLY);
-
+#endif /* STATION_SOCK */
+
// read sci and netclock headers
memset(data, '\0', 256);
test_fail_unless ((-1 != fd_in)
@@ -540,7 +604,9 @@ void phy_access_backoff_start_test_case(test_t t)
test_fail_unless (ntohs(netclock_hdr->id) == ctx->access.backoff_start_netclock_id);
// close pipe
+#ifndef STATION_SOCK
close(fd_in);
+#endif /* !STATION_SOCK */
} test_end;
// test the prp result callback
@@ -627,8 +693,12 @@ void phy_access_timer_program_test_case(test_t t)
int fd_in = -1;
// open pipe
+#ifdef STATION_SOCK
+ fd_in = my_station.sock_pair_fd;
+#else /* STATION_SOCK */
fd_in = open(my_station.pipe_out_name, O_RDONLY);
-
+#endif /* STATION_SOCK */
+
// read sci and netclock headers
memset(data, '\0', 256);
test_fail_unless ((-1 != fd_in)
@@ -645,7 +715,9 @@ void phy_access_timer_program_test_case(test_t t)
test_fail_unless (ntohs(netclock_hdr->id) == ctx->access.timer_program_netclock_id);
// close pipe
+#ifndef STATION_SOCK
close(fd_in);
+#endif /* !STATION_SOCK */
} test_end;
id = ctx->access.timer_program_netclock_id;
@@ -659,8 +731,12 @@ void phy_access_timer_program_test_case(test_t t)
int fd_in = -1;
// open pipe
+#ifdef STATION_SOCK
+ fd_in = my_station.sock_pair_fd;
+#else /* STATION_SOCK */
fd_in = open(my_station.pipe_out_name, O_RDONLY);
-
+#endif /* STATION_SOCK */
+
// read sci and netclock headers
memset(data, '\0', 256);
test_fail_unless ((-1 != fd_in)
@@ -674,7 +750,9 @@ void phy_access_timer_program_test_case(test_t t)
test_fail_unless (ntohs(netclock_hdr->id) == id);
// close pipe
+#ifndef STATION_SOCK
close(fd_in);
+#endif /* !STATION_SOCK */
} test_end;
// check that the correct netclock message has been sent to Maximus
@@ -688,8 +766,12 @@ void phy_access_timer_program_test_case(test_t t)
set_node_t *found_node;
// open pipe
+#ifdef STATION_SOCK
+ fd_in = my_station.sock_pair_fd;
+#else /* STATION_SOCK */
fd_in = open(my_station.pipe_out_name, O_RDONLY);
-
+#endif /* STATION_SOCK */
+
// read sci and netclock headers
memset(data, '\0', 256);
test_fail_unless ((-1 != fd_in)
@@ -706,7 +788,9 @@ void phy_access_timer_program_test_case(test_t t)
test_fail_unless (ntohs(netclock_hdr->id) == ctx->access.timer_program_netclock_id);
// close pipe
+#ifndef STATION_SOCK
close(fd_in);
+#endif /* !STATION_SOCK */
/* Remove netclock callback. */
@@ -765,8 +849,12 @@ void phy_access_timer_cancel_test_case(test_t t)
int fd_in = -1;
// open pipe
+#ifdef STATION_SOCK
+ fd_in = my_station.sock_pair_fd;
+#else /* STATION_SOCK */
fd_in = open(my_station.pipe_out_name, O_RDONLY);
-
+#endif /* STATION_SOCK */
+
// read sci and netclock headers
memset(data, '\0', 256);
test_fail_unless ((-1 != fd_in)
@@ -780,7 +868,9 @@ void phy_access_timer_cancel_test_case(test_t t)
test_fail_unless (ntohs(netclock_hdr->id) == id);
// close pipe
+#ifndef STATION_SOCK
close(fd_in);
+#endif /* !STATION_SOCK */
} test_end;
return;