IEEE 802.15.4 subsystem
Sign in or create your account | Project List | Help
IEEE 802.15.4 subsystem Git Source Tree
Root/
| 1 | /* |
| 2 | * lib/driver.h - ATRF driver API |
| 3 | * |
| 4 | * Written 2010-2011, 2013 by Werner Almesberger |
| 5 | * Copyright 2010-2011, 2013 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 | |
| 20 | struct 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, int pulse); |
| 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 | void (*sram_write)(void *dsc, uint8_t addr, uint8_t value); |
| 37 | uint8_t (*sram_read)(void *dsc, uint8_t addr); |
| 38 | int (*interrupt_wait)(void *dsc, int timeout_ms); |
| 39 | void (*rx_mode)(void *dsc, int on); |
| 40 | int (*rx)(void *dsc, void *buf, int size, int timeout_ms, uint8_t *lqi); |
| 41 | void (*tx)(void *dsc, const void *buf, int size); |
| 42 | }; |
| 43 | |
| 44 | |
| 45 | extern struct atrf_driver atusb_driver; |
| 46 | extern struct atrf_driver atusb_spi_driver; |
| 47 | extern struct atrf_driver atben_driver; |
| 48 | extern struct atrf_driver atnet_driver; |
| 49 | |
| 50 | |
| 51 | int atrf_set_clkm_generic( |
| 52 | void (*reg_write)(void *dsc, uint8_t reg, uint8_t value), |
| 53 | void *handle, int mhz); |
| 54 | |
| 55 | void *atben_regs(void *dsc); /* hack for atrf-xtal */ |
| 56 | void *atusb_dev_handle(void *dsc); /* hack for atrf-id */ |
| 57 | |
| 58 | #endif /* !DRIVER_H */ |
| 59 |
