aboutsummaryrefslogtreecommitdiff
path: root/include/linux/fsm_rfic_ftr.h
blob: 6288a335739a73a93bcfb3283cd76b4cb761bea1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/* Copyright (c) 2010-2012, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
 * only version 2 as published by the Free Software Foundation.
 *
 * 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.
 */

#ifndef _FSM_RFIC_FTR_H_
#define _FSM_RFIC_FTR_H_

#include <linux/ioctl.h>

/*
 * Device interface
 */

#define RFIC_FTR_DEVICE_NAME		"rfic_ftr"

/*
 * IOCTL interface
 */

/*
    Macro to associate the "bus" and "address" pair when accessing the RFIC.
    Using a 32 bit address, reserve the upper 8 bits for the bus value, and
    the lower 24 bits for the address.
 */
#define RFIC_FTR_ADDR(bus, addr)	(((bus&0x03)<<24)|(addr&0xFFFFFF))
#define RFIC_FTR_GET_ADDR(busAddr)	(busAddr&0xFFFFFF)
#define RFIC_FTR_GET_BUS(busAddr)	((busAddr>>24)&0x03)

struct rfic_write_register_param {
	unsigned int rficAddr;
	unsigned int value;
};

struct rfic_write_register_mask_param {
	unsigned int rficAddr;
	unsigned int value;
	unsigned int mask;
};

struct rfic_grfc_param {
	unsigned int grfcId;
	unsigned int maskValue;
	unsigned int ctrlValue;
};

#define RFIC_IOCTL_MAGIC				'f'
#define RFIC_IOCTL_READ_REGISTER \
	_IOC(_IOC_READ, RFIC_IOCTL_MAGIC, 0x01, \
		sizeof(unsigned int *))
#define RFIC_IOCTL_WRITE_REGISTER \
	_IOC(_IOC_WRITE, RFIC_IOCTL_MAGIC, 0x02, \
		sizeof(struct rfic_write_register_param *))
#define RFIC_IOCTL_WRITE_REGISTER_WITH_MASK \
	_IOC(_IOC_WRITE, RFIC_IOCTL_MAGIC, 0x03, \
		sizeof(struct rfic_write_register_mask_param *))
#define RFIC_IOCTL_GET_GRFC \
	_IOC(_IOC_WRITE, RFIC_IOCTL_MAGIC, 0x10, \
		sizeof(struct rfic_grfc_param *))
#define RFIC_IOCTL_SET_GRFC \
	_IOC(_IOC_WRITE, RFIC_IOCTL_MAGIC, 0x11, \
		sizeof(struct rfic_grfc_param *))

#endif /* _FSM_RFIC_FTR_H_ */