librtlsdr
UNKNOWN
RTL-SDR library
Main Page
Data Structures
Files
File List
reg_field.h
1
#ifndef _REG_FIELD_H
2
#define _REG_FIELD_H
3
4
#include <stdint.h>
5
#include <stdarg.h>
6
7
enum
cmd_op {
8
CMD_OP_GET = (1 << 0),
9
CMD_OP_SET = (1 << 1),
10
CMD_OP_EXEC = (1 << 2),
11
};
12
13
enum
pstate {
14
ST_IN_CMD,
15
ST_IN_ARG,
16
};
17
18
struct
strbuf
{
19
uint8_t idx;
20
char
buf[32];
21
};
22
23
struct
cmd_state
{
24
struct
strbuf
cmd;
25
struct
strbuf
arg;
26
enum
pstate state;
27
void (*out)(
const
char
*format, va_list ap);
28
};
29
30
struct
cmd
{
31
const
char
*
cmd
;
32
uint32_t ops;
33
int (*cb)(
struct
cmd_state
*cs,
enum
cmd_op op,
const
char
*
cmd
,
34
int
argc,
char
**argv);
35
const
char
*help;
36
};
37
38
/* structure describing a field in a register */
39
struct
reg_field
{
40
uint8_t reg;
41
uint8_t shift;
42
uint8_t width;
43
};
44
45
struct
reg_field_ops
{
46
const
struct
reg_field
*fields;
47
const
char
**field_names;
48
uint32_t num_fields;
49
void
*data;
50
int (*write_cb)(
void
*data, uint32_t reg, uint32_t val);
51
uint32_t (*read_cb)(
void
*data, uint32_t reg);
52
};
53
54
uint32_t reg_field_read(
struct
reg_field_ops
*ops,
struct
reg_field
*field);
55
int
reg_field_write(
struct
reg_field_ops
*ops,
struct
reg_field
*field, uint32_t val);
56
int
reg_field_cmd(
struct
cmd_state
*cs,
enum
cmd_op op,
57
const
char
*
cmd
,
int
argc,
char
**argv,
58
struct
reg_field_ops
*ops);
59
60
#endif
include
reg_field.h
Generated on Mon Apr 29 2013 13:43:00 for librtlsdr by
1.8.3.1