summaryrefslogtreecommitdiff
path: root/cesar/hle/test/src/hle_send_to_arm.c
blob: 677501f0d70d1f5169e742aad5066627c034ce3a (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
/* Cesar project {{{
 *
 * Copyright (C) 2007 Spidcom
 *
 * <<<Licence>>>
 *
 * }}} */
/**
 * \file    test/hle_recv.c
 * \brief   unit test to test the hle when it sends a data to the CL. 
 * \ingroup hle
 *
 * « long description »
 */
#include "common/std.h"

#include <stdlib.h>
#include <string.h>
#include <stdio.h>

#include "lib/test.h"
#include "lib/blk.h"
#include "lib/trace.h"

#include "cl/cl.h"

#include "hle/hle.h"
#include "lib/test.h"

#include "hle/inc/trace.h"

unsigned int packet1 []__attribute__((aligned(2048))) =
{   0xa1b2c3d4, 0x00040002, 0x00000000, 0x00000000,
    0x0000ffff, 0x00000001, 0x46973299, 0x0007c33e,
    0x00000042, 0x00000042, 0x12005452, 0x00080235,
    0x4c205227, 0x00450008, 0x4e043400, 0x06400040,
    0x000a1917, 0x79cb0f02, 0x1b04d547, 0x6b285000,
    0x0000babc, 0x02800000, 0x396bf0fa, 0x04020000,
    0x0301b405, 0x01010003, 0x00000204};
unsigned int packet1_len = 106;

unsigned int packet2[] = { 0xa1b2c3d4, 0x00040002, 0x00000000, 0x00000000,
        0x0000ffff, 0x00000001, 0x469732d4, 0x0000da24, 0x0000005d,
        0x0000005d, 0x12005452, 0x00080235, 0x4c205227, 0x00450008,
        0x09064f00, 0x06400040, 0x000a901c, 0x000a0f02, 0x01040202,
        0x46d6bd01, 0x0d0071cf, 0x185072c5, 0x4b65b0f9, 0x00000000,
        0x53ff2300, 0x0071424d, 0x18000000, 0x0000c807, 0x00000000,
        0x00000000, 0x00010000, 0x0000feff, 0x00000a01, 0x00000000 };
unsigned int packet2_len = 133;

test_t test;

int main (void)
{    
    hle_t *hle;
    cl_t *cl;
    
    test_init(test, 0, NULL);
    trace_init ();

    // The function cl_init has been overided.
    cl = cl_init (NULL, NULL);
    hle = hle_init (cl);

    hle_data_recv(hle, (u8 *) packet1, packet1_len);
    hle_mme_recv(hle, (u8 *) packet1, packet1_len); 

    hle_trace_print (hle);

    hle_uninit (hle);
    cl_uninit (cl);
    
    test_begin (test, "Memory test")
    {
        test_fail_if (blk_check_memory() == false, "Memory not freed");
    }
    test_end;

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