summaryrefslogtreecommitdiff
path: root/hal/phy/maximus/test/src/test_phy_maximus.c
blob: 6f1227a01d8611f283dc8ce5d0301f63f52f4ca7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
/* Cesar project {{{
 *
 * Copyright (C) 2007 Spidcom
 *
 * <<<Licence>>>
 *
 * }}} */
/**
 * \file    hal/phy/maximus/test/src/test_phy_maximus.c
 * \brief   HAL Phy main test function for Maximus.
 * \ingroup hal_phy_maximus
 */

#include "common/std.h"
#include "lib/test.h"
#include "host/station.h"
#include <unistd.h> // for 'open()' and 'close()'
#include <fcntl.h> // for 'open()' and 'close()'

void bridgedma_test_suite (test_t t);
void pbdma_test_suite (test_t t);
void phy_access_test_suite (test_t t);
void phy_ctrl_test_suite (test_t t);
void tmdma_test_suite (test_t t);

uint32_t maximus_pending_isrs;
station_ctx_t my_station;

bool phy_rx_fc_cb (void *user, u32 rx_date, const u32 *fc_av)
{
    return true;    
}

bool phy_access_cb (void *user)
{
    return true;
}

bool phy_access_conf_cb (void *user)
{
    return true;  
}

bool phy_pbdma_cb (void *user, u32 status_word)
{
    return true;   
}

bool phy_tx_false_alarm_cb (void *user)
{
    return true;   
}

bool phy_zero_cross_cb (void *user, const u32 zero_cross_date)
{
    return true;
}

void phy_deferred_cb (void *user)
{
    return;
}

bool phy_extra_timer_cb (void *user)
{
    return true;
}

int
maximus_phy_open (station_ctx_t *station)
{
    int fd;

    #ifdef STATION_SOCK
        fd = station->sock_pair_fd;
    #else /* STATION_SOCK */
        fd =  open(station->pipe_out_name, O_RDONLY);
    #endif /* STATION_SOCK */

    return fd;  
}

void
maximus_phy_close (int fd)
{
    #ifndef STATION_SOCK
        close(fd);
    #endif /* !STATION_SOCK */
}

int
main (int argc, char **argv)
{
    test_t t;
    test_init(t, argc, argv);

    bridgedma_test_suite(t);
    pbdma_test_suite(t);
    phy_access_test_suite(t);
    phy_ctrl_test_suite(t);
    tmdma_test_suite(t);

    test_result(t);
    return test_nb_failed(t) == 0 ? 0 : 1;
}