blob: 25845d0f75307d39e462f72ef5b129e3cc70f146 (
plain) (
blame)
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
|
//======================================================================
//
// test-sha256.c
// -------------
// test program for Cryptech Novena framwwork with EIM interface
// using the sha256 core.
//
//======================================================================
//------------------------------------------------------------------------------
// Headers
//------------------------------------------------------------------------------
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include "novena-eim.h"
//------------------------------------------------------------------------------
// Defines
//------------------------------------------------------------------------------
#define SHA256_PREFIX (0x14)
#define SHA_BASE (EIM_BASE_ADDR + SHA256_PREFIX)
//------------------------------------------------------------------------------
// Testing Parameters
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// main()
//------------------------------------------------------------------------------
int main()
{
unsigned int read_addr;
unsigned int read_data;
// try to setup eim (return value should be 1)
printf("Configuring EIM .. ");
int ok = eim_setup();
if (ok < 1) {
printf("ERROR\n");
return EXIT_FAILURE;
}
else {
printf("EIM Setup ok.\n");
}
// Dump register contents. See if we have the core.
for (unsigned int i = 0 ; i < 100 ; i += 3) {
read_addr = SHA_BASE + i;
eim_read_32(read_addr, &read_data);
printf("address 0x%08x = 0x%08x\n", read_addr, read_data);
}
return 0;
}
//======================================================================
// EOF test-sha256.c
//======================================================================
|