Statistics
| Branch: | Tag: | Revision:

root / host / apps / omap_debug / usrp_e.h @ f2454f90

History | View | Annotate | Download (2.05 KB)

1

    
2
/*
3
 *  Copyright (C) 2010 Ettus Research, LLC
4
 *
5
 *  Written by Philip Balister <philip@opensdr.com>
6
 *
7
 *  This program is free software; you can redistribute it and/or modify
8
 *  it under the terms of the GNU General Public License as published by
9
 *  the Free Software Foundation; either version 2 of the License, or
10
 *  (at your option) any later version.
11
 */
12

    
13
#ifndef __USRP_E_H
14
#define __USRP_E_H
15

    
16
#include <linux/types.h>
17
#include <linux/ioctl.h>
18

    
19
struct usrp_e_ctl16 {
20
        __u32 offset;
21
        __u32 count;
22
        __u16 buf[20];
23
};
24

    
25
struct usrp_e_ctl32 {
26
        __u32 offset;
27
        __u32 count;
28
        __u32 buf[10];
29
};
30

    
31
// SPI interface
32

    
33
#define UE_SPI_TXONLY        0
34
#define UE_SPI_TXRX        1
35

    
36
// Defines for spi ctrl register
37
#define UE_SPI_CTRL_ASS                (1<<13)
38
#define UE_SPI_CTRL_IE                (1<<12)
39
#define UE_SPI_CTRL_LSB                (1<<11)
40
#define UE_SPI_CTRL_TXNEG        (1<<10)
41
#define UE_SPI_CTRL_RXNEG        (1<<9)
42
#define UE_SPI_CTRL_GO_BSY        (1<<8)
43
#define UE_SPI_CTRL_CHAR_LEN_MASK        0x7f
44

    
45
#define UE_SPI_PUSH_RISE        0
46
#define UE_SPI_PUSH_FALL        UE_SPI_CTRL_TXNEG
47
#define UE_SPI_LATCH_RISE        0
48
#define UE_SPI_LATCH_FALL        UE_SPI_CTRL_RXNEG
49

    
50
struct usrp_e_spi {
51
        __u8 readback;
52
        __u32 slave;
53
        __u32 data;
54
        __u32 length;
55
        __u32 flags;
56
};
57

    
58
struct usrp_e_i2c {
59
        __u8 addr;
60
        __u32 len;
61
        __u8 data[];
62
};
63

    
64
#define USRP_E_IOC_MAGIC        'u'
65
#define USRP_E_WRITE_CTL16        _IOW(USRP_E_IOC_MAGIC, 0x20, struct usrp_e_ctl16)
66
#define USRP_E_READ_CTL16        _IOWR(USRP_E_IOC_MAGIC, 0x21, struct usrp_e_ctl16)
67
#define USRP_E_WRITE_CTL32        _IOW(USRP_E_IOC_MAGIC, 0x22, struct usrp_e_ctl32)
68
#define USRP_E_READ_CTL32        _IOWR(USRP_E_IOC_MAGIC, 0x23, struct usrp_e_ctl32)
69
#define USRP_E_SPI                _IOW(USRP_E_IOC_MAGIC, 0x24, struct usrp_e_spi)
70
#define USRP_E_I2C_READ                _IOR(USRP_E_IOC_MAGIC, 0x25, struct usrp_e_i2c)
71
#define USRP_E_I2C_WRITE        _IOW(USRP_E_IOC_MAGIC, 0x26, struct usrp_e_i2c)
72

    
73
// Data transfer frame definition
74

    
75
struct usrp_transfer_frame {
76
        __u32 flags;
77
        __u32 len;
78
        __u8  buf[];
79
};
80

    
81
// Flag defines
82
#define RB_USER (1 << 0)
83
#define RB_KERNEL (1 << 1)
84
#define RB_OVERRUN (1 << 2)
85

    
86
struct ring_buffer_entry {
87
        unsigned long dma_addr;
88
        struct usrp_transfer_frame *frame_addr;
89
};
90

    
91
#endif