summaryrefslogtreecommitdiff
path: root/src/app/deflatetest/main.cc
blob: 7e9013852d46c180fb5fafd2079eb0abc5067a90 (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
/*
 * Copyright 2020 Daniel Friesel
 *
 * SPDX-License-Identifier: BSD-2-Clause
 */
#include "arch.h"
#include "driver/gpio.h"
#include "driver/stdout.h"
#include "driver/uptime.h"
#include "driver/counter.h"

#include "lib/inflate.h"
#include "deflate_data.cc"

int main(void)
{
	arch.setup();
	gpio.setup();
	kout.setup();

	while (1) {
		counter.start();
#ifdef DEFLATE_NOP
		kout << (unsigned char*)inflate_input << endl;
		uint16_t ret = 1;
#else
		int16_t ret = inflate_zlib((unsigned char*)inflate_input, inflate_input_size, deflate_output, deflate_output_size);
#endif
		counter.stop();
		kout << "inflate returned " << ret << endl;
		kout << "Output: " << (char*)deflate_output << endl;
		kout << "took " << counter.value << "/" << counter.overflow << " cycles" << endl;
	}

	arch.idle();

	return 0;
}