GNU Radio 3.3.0 C++ API
|
00001 /* -*- c++ -*- */ 00002 /* 00003 * Copyright 2004 Free Software Foundation, Inc. 00004 * 00005 * This file is part of GNU Radio 00006 * 00007 * GNU Radio is free software; you can redistribute it and/or modify 00008 * it under the terms of the GNU General Public License as published by 00009 * the Free Software Foundation; either version 3, or (at your option) 00010 * any later version. 00011 * 00012 * GNU Radio is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 * GNU General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU General Public License 00018 * along with GNU Radio; see the file COPYING. If not, write to 00019 * the Free Software Foundation, Inc., 51 Franklin Street, 00020 * Boston, MA 02110-1301, USA. 00021 */ 00022 00023 #ifndef INCLUDED_USRP_SPI_DEFS_H 00024 #define INCLUDED_USRP_SPI_DEFS_H 00025 00026 /* 00027 * defines for the VRQ_SPI_READ and VRQ_SPI_WRITE commands 00028 * 00029 * SPI == "Serial Port Interface". SPI is a 3 wire bus plus a 00030 * separate enable for each peripheral. The common lines are SCLK, 00031 * SDI and SDO. The FX2 always drives SCLK and SDI, the clock and 00032 * data lines from the FX2 to the peripheral. When enabled, a 00033 * peripheral may drive SDO, the data line from the peripheral to the 00034 * FX2. 00035 * 00036 * The SPI_READ and SPI_WRITE commands are formatted identically. 00037 * Each specifies which peripherals to enable, whether the bits should 00038 * be transmistted Most Significant Bit first or Least Significant Bit 00039 * first, the number of bytes in the optional header, and the number 00040 * of bytes to read or write in the body. 00041 * 00042 * The body is limited to 64 bytes. The optional header may contain 00043 * 0, 1 or 2 bytes. For an SPI_WRITE, the header bytes are 00044 * transmitted to the peripheral followed by the the body bytes. For 00045 * an SPI_READ, the header bytes are transmitted to the peripheral, 00046 * then len bytes are read back from the peripheral. 00047 */ 00048 00049 /* 00050 * SPI_FMT_* goes in wIndexL 00051 */ 00052 #define SPI_FMT_xSB_MASK (1 << 7) 00053 # define SPI_FMT_LSB (1 << 7) // least signficant bit first 00054 # define SPI_FMT_MSB (0 << 7) // most significant bit first 00055 #define SPI_FMT_HDR_MASK (3 << 5) 00056 # define SPI_FMT_HDR_0 (0 << 5) // 0 header bytes 00057 # define SPI_FMT_HDR_1 (1 << 5) // 1 header byte 00058 # define SPI_FMT_HDR_2 (2 << 5) // 2 header bytes 00059 00060 /* 00061 * SPI_ENABLE_* goes in wIndexH 00062 * 00063 * For the software interface, the enables are active high. 00064 * For reads, it's an error to have more than one enable set. 00065 * 00066 * [FWIW, the hardware implements them as active low. Don't change the 00067 * definitions of these. They are related to usrp_rev1_regs.h] 00068 */ 00069 #define SPI_ENABLE_FPGA 0x01 // select FPGA 00070 #define SPI_ENABLE_CODEC_A 0x02 // select AD9862 A 00071 #define SPI_ENABLE_CODEC_B 0x04 // select AD9862 B 00072 #define SPI_ENABLE_reserved 0x08 00073 #define SPI_ENABLE_TX_A 0x10 // select d'board TX A 00074 #define SPI_ENABLE_RX_A 0x20 // select d'board RX A 00075 #define SPI_ENABLE_TX_B 0x40 // select d'board TX B 00076 #define SPI_ENABLE_RX_B 0x80 // select d'board RX B 00077 00078 /* 00079 * If there's one header byte, it goes in wValueL. 00080 * 00081 * If there are two header bytes, they go in wValueH | wValueL. 00082 * The transmit order of the bytes (and bits within them) is 00083 * determined by SPI_FMT_*SB 00084 */ 00085 00086 #endif /* INCLUDED_USRP_SPI_DEFS_H */