2010-09-06 00:59:42 +03:00
|
|
|
/*
|
2010-11-11 14:04:36 +02:00
|
|
|
* lib/driver.h - ATRF driver API
|
2010-09-06 00:59:42 +03:00
|
|
|
*
|
2013-02-12 21:19:09 +02:00
|
|
|
* Written 2010-2011, 2013 by Werner Almesberger
|
|
|
|
* Copyright 2010-2011, 2013 Werner Almesberger
|
2010-09-06 00:59:42 +03:00
|
|
|
*
|
|
|
|
* 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 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef DRIVER_H
|
|
|
|
#define DRIVER_H
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
|
2010-11-11 14:04:36 +02:00
|
|
|
struct atrf_driver {
|
2010-09-06 00:59:42 +03:00
|
|
|
const char *name;
|
2011-04-10 03:00:48 +03:00
|
|
|
void *(*open)(const char *arg);
|
2010-09-06 00:59:42 +03:00
|
|
|
void (*close)(void *dsc);
|
tools: atrf-id option -s to retrieve driver spec, with necessary infrastructure
- include/atrf.h (atrf_driver_spec), lib/atrf.c (atrf_driver_spec):
new function to retrieve the local or remote/final driver spec
- lib/atrf.c (struct atrf_dsc, atrf_open, atrf_close): record the local
driver spec
- lib/driver.h (struct atrf_driver): new driver function "driver_spec"
to retrieve the driver spec
- lib/atnet.c (struct atnet_dsc, atnet_open, atnet_close): maintain a
cache for the driver spec
- lib/atnet.c (atnet_driver_spec, atnet_driver): added support for the
"driver_spec" function
- atrf-proxy/PROTOCOL, atrf-proxy/atrf-proxy.c (cmd_zero): added command
SPEC to retrieve the (final) driver spec
- atrf-id/atrf-id.c (usage, main): added option -s to retrieve the
driver spec. One -s retrieves the local spec, -s -s the remote/final.
2011-04-20 14:58:17 +03:00
|
|
|
const char *(*driver_spec)(void *dsc);
|
Merged uSD driver into unified tool build, completed conversion of tools.
- atusd/tools/lib/atusd.c: moved to tools/lib/
- atusd/tools/lib/atusd.h: removed, we can now use tools/include/atspi.h
- tools/lib/atusd.c: added copyright header
- tools/lib/atusd.c: updated for driver API
- tools/lib/Makefile: added atusd.o
- tools/Makefile.common: moved common elements from all other makefiles in
tools/*/ here
- tools/Makefile.common: added target-specific compiler and flags
- tools/atspi-id/Makefile, tools/atspi-reset/Makefile,
tools/atspi-rssi/Makefile, tools/atspi-trim/Makefile,
tools/atspi-txrx/Makefile, tools/lib/Makefile: used Makefile.common
- tools/lib/Makefile: differentiate USB and uSD build
- tools/atspi-id/atspi-id.c, tools/atspi-reset/atspi-reset.c,
tools/atspi-rssi/atspi-rssi.c, tools/atspi-trim/atspi-trim.c,
tools/atspi-txr/atspi-txr.c: updated for driver-agnostic API
- tools/atspi-id/atspi-id.c, tools/atspi-reset/atspi-reset.c,
tools/atspi-rssi/atspi-rssi.c, tools/atspi-trim/atspi-trim.c,
tools/atspi-txr/atspi-txr.c: corrected AF86RF230 typo in title
- tools/include/atspi.h, tools/lib/atspi.c, tools/lib/driver.c,
tools/lib/atusb.c: brought back support for atspi_error and
atspi_clear_error
- tools/atspi-id/atspi-id.c (atspi_get_protocol): renamed to get_protocol,
to make it clear that it's not from libatspi
- tools/atspi-id/atspi-id.c (atspi_get_build): renamed to get_build, to
make it clear that it's not from libatspi
- tools/include/atspi.h, tools/lib/atspi.c (atspi_usb_handle): new function
to obtain a driver's USB device handle (or NULL if the driver doesn't use
USB)
2010-09-06 02:32:58 +03:00
|
|
|
int (*error)(void *dsc);
|
|
|
|
int (*clear_error)(void *dsc);
|
2010-09-06 00:59:42 +03:00
|
|
|
void (*reset)(void *dsc);
|
|
|
|
void (*reset_rf)(void *dsc);
|
2010-11-11 07:29:07 +02:00
|
|
|
void (*test_mode)(void *dsc);
|
2011-06-06 03:08:48 +03:00
|
|
|
void (*slp_tr)(void *dsc, int on, int pulse);
|
2011-02-11 04:11:34 +02:00
|
|
|
int (*set_clkm)(void *dsc, int mhz);
|
2010-09-06 00:59:42 +03:00
|
|
|
void (*reg_write)(void *dsc, uint8_t reg, uint8_t value);
|
|
|
|
uint8_t (*reg_read)(void *dsc, uint8_t reg);
|
|
|
|
void (*buf_write)(void *dsc, const void *buf, int size);
|
|
|
|
int (*buf_read)(void *dsc, void *buf, int size);
|
2011-06-03 19:52:13 +03:00
|
|
|
void (*sram_write)(void *dsc, uint8_t addr, uint8_t value);
|
|
|
|
uint8_t (*sram_read)(void *dsc, uint8_t addr);
|
2011-06-20 22:01:59 +03:00
|
|
|
int (*interrupt_wait)(void *dsc, int timeout_ms);
|
2011-07-12 18:03:12 +03:00
|
|
|
void (*rx_mode)(void *dsc, int on);
|
2013-02-12 21:19:09 +02:00
|
|
|
int (*rx)(void *dsc, void *buf, int size, int timeout_ms, uint8_t *lqi);
|
2011-07-12 18:03:12 +03:00
|
|
|
void (*tx)(void *dsc, const void *buf, int size);
|
2010-09-06 00:59:42 +03:00
|
|
|
};
|
|
|
|
|
2011-02-11 04:11:34 +02:00
|
|
|
|
2011-04-10 23:29:07 +03:00
|
|
|
extern struct atrf_driver atusb_driver;
|
2011-06-19 21:11:30 +03:00
|
|
|
extern struct atrf_driver atusb_spi_driver;
|
2011-04-10 23:29:07 +03:00
|
|
|
extern struct atrf_driver atben_driver;
|
2011-04-10 23:45:19 +03:00
|
|
|
extern struct atrf_driver atnet_driver;
|
2011-04-10 23:29:07 +03:00
|
|
|
|
|
|
|
|
2011-02-11 04:11:34 +02:00
|
|
|
int atrf_set_clkm_generic(
|
|
|
|
void (*reg_write)(void *dsc, uint8_t reg, uint8_t value),
|
|
|
|
void *handle, int mhz);
|
|
|
|
|
2011-04-10 13:25:11 +03:00
|
|
|
void *atben_regs(void *dsc); /* hack for atrf-xtal */
|
2011-04-12 15:22:40 +03:00
|
|
|
void *atusb_dev_handle(void *dsc); /* hack for atrf-id */
|
2011-04-10 13:25:11 +03:00
|
|
|
|
2010-09-06 00:59:42 +03:00
|
|
|
#endif /* !DRIVER_H */
|