summaryrefslogtreecommitdiff
path: root/hal/hle/maximus/test/src/test_maximus_hle.c
blob: cce8d7e0005112285d0bb09cdff407101336b2df (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
/* Cesar project {{{
 *
 * Copyright (C) 2007 Spidcom
 *
 * <<<Licence>>>
 *
 * }}} */
/**
 * \file    hal/hle/maximus/test/src/test_maximus_hle.c
 * \brief   HAL HLE main test function for Maximus.
 * \ingroup hal_hle_maximus
 */

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

void ipmbox_test_suite (test_t t);
void ether_test_suite (test_t t);

uint32_t maximus_pending_isrs;
station_ctx_t my_station;

void
ipmbox_rx_cb (void *user_data, u32 *first_msg, uint length)
{
    int *my_data = (int *)user_data;
    *my_data = 987654321;
    return;
}

int
maximus_ether_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_ether_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);

    ether_test_suite(t);
    ipmbox_test_suite(t);

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