/* -*- mode: c -*- * * Copyright 2012 Michael Ossmann * * This file is part of HackRF. * * 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, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. */ #ifndef __RFFC5071_REGS_DEF #define __RFFC5071_REGS_DEF #define RFFC5071_REG_SET_CLEAN(_d, _r) (_d->regs_dirty &= ~(1UL<<_r)) #define RFFC5071_REG_SET_DIRTY(_d, _r) (_d->regs_dirty |= (1UL<<_r)) #define RFFC5071_READBACK_REG 31 /* Generate static inline accessors that operate on the global * regs. Done this way to (1) allow defs to be scraped out and used * elsewhere, e.g. in scripts, (2) to avoid dealing with endian * (structs). This may be used in firmware, or on host predefined * register loads. */ /* On set_, register is always set dirty, even if nothing * changed. This makes sure that writes that have side effects, * e.g. frequency setting, are not skipped. */ /* n=name, r=regnum, o=offset (bits from LSB) of LSB of field, * l=length (bits) */ #define __MREG__(n,r,o,l) \ static inline uint16_t get_##n(rffc5071_driver_t* const _d) { \ return (_d->regs[r] >> o) & ((1L<regs[r] &= (uint16_t)(~(((1L<regs[r] |= (uint16_t)(((v&((1L<