1
0
mirror of git://projects.qi-hardware.com/ben-wpan.git synced 2025-04-21 12:27:27 +03:00

tools: give the driver control over CLKM (for ATmega32U2 boards)

- include/atrf.h (atrf_set_clkm), lib/atrf.c (atrf_set_clkm): set or
  disable CLKM
- lib/driver.h (atrf_set_clkm_generic), lib/atrf.c (atrf_set_clkm_generic):
  generic function to set CLKM without restrictions
- lib/driver.h (struct atrf_driver): added driver operation "set_clkm"
  to set CLKM
- lib/atusb.c (atusb_set_clkm, atusb_driver): restrict CLKM on ATmega32U2
  boards
- atrf-txrx/atrf-txrx.c (init_txrx): use atrf_set_clkm to set CLKM
- atrf-txrx/atrf-txrx.c (init_txrx, main): pass CLKM frequency in MHz
  instead of code point
This commit is contained in:
Werner Almesberger
2011-02-10 23:11:34 -03:00
parent e73ca5fcd5
commit b0c15b7e7c
5 changed files with 111 additions and 19 deletions

View File

@@ -1,8 +1,8 @@
/*
* lib/driver.h - ATRF driver API
*
* Written 2010 by Werner Almesberger
* Copyright 2010 Werner Almesberger
* Written 2010-2011 by Werner Almesberger
* Copyright 2010-2011 Werner Almesberger
*
* 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
@@ -26,6 +26,7 @@ struct atrf_driver {
void (*reset)(void *dsc);
void (*reset_rf)(void *dsc);
void (*test_mode)(void *dsc);
int (*set_clkm)(void *dsc, int mhz);
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);
@@ -33,4 +34,9 @@ struct atrf_driver {
int (*interrupt)(void *dsc);
};
int atrf_set_clkm_generic(
void (*reg_write)(void *dsc, uint8_t reg, uint8_t value),
void *handle, int mhz);
#endif /* !DRIVER_H */