summaryrefslogtreecommitdiffstats
path: root/model.c
blob: 28391a2337bdd4b517a0d3fb7b794a206ab3cfb4 (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
#define _PCIDEV_MODEL_C

#include <stdio.h>
#include <strings.h>

#include <pcilib.h>
#include <pcilib/model.h>

#include "version.h"

#include "registers.h"
#include "dma.h"
#include "events.h"
#include "model.h"




static const pcilib_event_description_t pcidev_events[] = {
    {PCILIB_EVENT0, "new_event", ""},
    {0, NULL, NULL}
};

static const pcilib_event_data_type_description_t pcidev_data_types[] = {
    {PCIDEV_RAW_DATA,		PCILIB_EVENT0, "raw", 	"raw data from device" },
    {PCIDEV_STANDARD_DATA,	PCILIB_EVENT0, "std",	"processed data" },
    {0, 0, NULL, NULL}
};


pcilib_event_api_description_t pcidev_event_api = {
    PCIDEV_VERSION,

    pcidev_init,
    pcidev_free,

    pcidev_init_dma,

    pcidev_reset,
    pcidev_start,
    pcidev_stop,
    pcidev_trigger,

    pcidev_stream,
    NULL,
    pcidev_get_data,
    pcidev_return_data
};


static const pcilib_model_description_t pcidev_models[] = {{
    PCILIB_EVENT_INTERFACE_VERSION,
    &pcidev_event_api,
    &pcidev_dma,
    NULL, // Registers are defined in XML
    NULL, // Banks are defined in XML
    &pcidev_protocols,
    NULL, // Register ranges are defined in XML
    NULL,
    NULL,
    pcidev_events,
    pcidev_data_types,
    "pcidev",
    "Sample Plugin"
}, { 0 }};


const pcilib_model_description_t *pcilib_get_event_model(pcilib_t *pcilib, unsigned short vendor_id, unsigned short device_id, const char *model) {
	// Enumeration call
    if ((!vendor_id)&&(!device_id)&&(!model)) {
	return pcidev_models;
    }

    if ((model)&&(strcasecmp(model, "pcidev")))
	return NULL;

    return &pcidev_models[0];
}