-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdemo_hw_task.h
67 lines (47 loc) · 1.58 KB
/
demo_hw_task.h
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
/*
* Fred for Linux. Experimental support.
*
* Copyright (C) 2018-2021, Marco Pagani, ReTiS Lab.
* <marco.pag(at)outlook.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*/
#ifndef DEMO_HW_TASK_H_
#define DEMO_HW_TASK_H_
#include <stdint.h>
#include <assert.h>
typedef uint32_t data_t;
//---------------------------------------------------------------------------------------------
struct demo_hw_task {
uint32_t hw_id;
struct fred_data *fred_data;
struct fred_hw_task *fred_hw_task;
data_t *in_a;
data_t *in_b;
data_t *out;
data_t (*op)(data_t in_a, data_t in_b);
};
//---------------------------------------------------------------------------------------------
int demo_hw_task_init(struct demo_hw_task *self, uint32_t hw_id, data_t (*op)(data_t, data_t));
int demo_hw_task_accel(struct demo_hw_task *self);
void demo_hw_task_free(struct demo_hw_task *self);
//---------------------------------------------------------------------------------------------
static inline
uint32_t demo_hw_task_get_hw_id(const struct demo_hw_task *self)
{
assert(self);
return self->hw_id;
}
static inline
int demo_hw_task_wrapper(void *self)
{
struct demo_hw_task *task;
assert(self);
task = (struct demo_hw_task *)self;
return demo_hw_task_accel(task);
}
//---------------------------------------------------------------------------------------------
#endif /* DEMO_HW_TASK_H_ */