summaryrefslogtreecommitdiff
path: root/cesar/test_general/hard/bridgedma/src/bridgedma_init.c
blob: 4cef5b36afacee93d853f5bd447431c60aef9619 (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
/* Cesar project {{{
 *
 * Copyright (C) 2008 Spidcom
 *
 * <<<Licence>>>
 *
 * }}} */
/**
 * \file    src/bridgedma.c
 * \brief   « brief description »
 * \ingroup « module »
 *
 * « long description »
 */
#include "common/std.h"
#include "lib/test.h"

#include "hal/phy/bridgedma.h"
#include "hal/phy/inc/bridgedma.h"

/* WARNING: callback are not possible to test inside UNIT TEST */
bool
_bridgedma_isr_cb(void *data, u32 status)
{
    return true;
}

/* WARNING: callback are not possible to test inside UNIT TEST */
void
_bridgedma_dsr_cb (void *toto)
{
}

void bridgedma_init_test_case(test_t t)
{
    phy_bridgedma_t *bridgedma_ctx;

    test_case_begin(t, "init");

    test_begin(t, "init")
    {
        bridgedma_ctx = NULL;
        bridgedma_ctx = phy_bridgedma_init(NULL, _bridgedma_isr_cb,
                                           _bridgedma_dsr_cb);


        test_fail_if (bridgedma_ctx == NULL);
        test_fail_if (bridgedma_ctx->bridge.job_tail != NULL);
        test_fail_if (bridgedma_ctx->bridge.user_data != NULL);
        test_fail_if (bridgedma_ctx->bridge.bridgedma_cb != _bridgedma_isr_cb);
        test_fail_if (bridgedma_ctx->bridge.deferred_cb != _bridgedma_dsr_cb);
        test_fail_if (phy_bridgedma_status (bridgedma_ctx) != false);
    }
    test_end;
    return;
}


int
main (void)
{
    test_t test;

    test_init (test, 0, NULL);

    bridgedma_init_test_case(test);

    test_result (test);

#ifndef __sparc__
    HAL_PLATFORM_EXIT (test_nb_failed (test) == 0 ? 0 : 1);
#endif
    return test_nb_failed (test) == 0 ? 0 : 1;
}