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

tools/: cleaned up the gross layering violation in atrf-xtal/atben.c

- include/atrf.h (atrf_ben_regs), lib/atrf.c (atrf_ben_regs),
  lib/driver.h (atben_regs), lib/atben.c (atben_regs): new function to
  get the mmap'ed registers in a less disgusting way
- atrf-xtal/atben.c (base, ben_setup): cleaned up the horrible layering
  violation
This commit is contained in:
Werner Almesberger
2011-04-10 07:25:11 -03:00
parent 7ff1a32ccf
commit 1a27e590d9
5 changed files with 25 additions and 18 deletions

View File

@@ -78,8 +78,6 @@ static void rf_setup(struct atrf_dsc *dsc, int size, int trim)
/* ----- Ben hardware ------------------------------------------------------ */
static volatile void *base;
static volatile uint32_t *icmr, *icmsr, *icmcr;
static uint32_t old_icmr;
@@ -129,22 +127,7 @@ static void enable_lcd(void)
static void ben_setup(struct atrf_dsc *dsc)
{
/*
* @@@ Ugly. Should either mmap the registers again here or add some
* proper means to extract the pointer directly.
*/
struct atrf_dsc {
void *driver;
void *handle;
int chip_id;
};
struct atben_dsc {
int fd;
void *mem;
};
base = ((struct atben_dsc *) ((struct atrf_dsc *) dsc)->handle)->mem;
volatile void *base = atrf_ben_regs(dsc);
icmr = base+0x1004;
icmsr = base+0x1008;