Root/tools/lib/driver.h

Source at commit 2961482cac72ca292ad95a4e6bf53500014279b4 created 8 years 11 months ago.
By Werner Almesberger, tools: atrf-id option -s to retrieve driver spec, with necessary infrastructure
1/*
2 * lib/driver.h - ATRF driver API
3 *
4 * Written 2010-2011 by Werner Almesberger
5 * Copyright 2010-2011 Werner Almesberger
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 */
12
13
14#ifndef DRIVER_H
15#define DRIVER_H
16
17#include <stdint.h>
18
19
20struct atrf_driver {
21    const char *name;
22    void *(*open)(const char *arg);
23    void (*close)(void *dsc);
24    const char *(*driver_spec)(void *dsc);
25    int (*error)(void *dsc);
26    int (*clear_error)(void *dsc);
27    void (*reset)(void *dsc);
28    void (*reset_rf)(void *dsc);
29    void (*test_mode)(void *dsc);
30    void (*slp_tr)(void *dsc, int on);
31    int (*set_clkm)(void *dsc, int mhz);
32    void (*reg_write)(void *dsc, uint8_t reg, uint8_t value);
33    uint8_t (*reg_read)(void *dsc, uint8_t reg);
34    void (*buf_write)(void *dsc, const void *buf, int size);
35    int (*buf_read)(void *dsc, void *buf, int size);
36    int (*interrupt)(void *dsc);
37};
38
39
40extern struct atrf_driver atusb_driver;
41extern struct atrf_driver atben_driver;
42extern struct atrf_driver atnet_driver;
43
44
45int atrf_set_clkm_generic(
46    void (*reg_write)(void *dsc, uint8_t reg, uint8_t value),
47    void *handle, int mhz);
48
49void *atben_regs(void *dsc); /* hack for atrf-xtal */
50void *atusb_dev_handle(void *dsc); /* hack for atrf-id */
51
52#endif /* !DRIVER_H */
53

Archive Download this file



interactive