[prev in list] [next in list] [prev in thread] [next in thread]
List: gnuradio-commit
Subject: [Commit-gnuradio] r5197 - gnuradio/branches/developers/matt/u2f/firmware
From: matt () gnuradio ! org
Date: 2007-04-30 22:38:54
Message-ID: 20070430223854.9BC35380064 () nyquist ! gnuradio ! org
[Download RAW message or body]
Author: matt
Date: 2007-04-30 16:38:54 -0600 (Mon, 30 Apr 2007)
New Revision: 5197
Modified:
gnuradio/branches/developers/matt/u2f/firmware/spi.c
Log:
handle the serial dac which wants data on the wrong edge for some reason
Modified: gnuradio/branches/developers/matt/u2f/firmware/spi.c
===================================================================
--- gnuradio/branches/developers/matt/u2f/firmware/spi.c 2007-04-30 22:38:17 UTC (rev 5196)
+++ gnuradio/branches/developers/matt/u2f/firmware/spi.c 2007-04-30 22:38:54 UTC (rev 5197)
@@ -6,7 +6,7 @@
// Set divider
p = (int *)(SPI_BASE+SPI_DIV);
- *p = 1; // Div-by-4. For div-by-2 use 0 here
+ *p = 0; // 0 = Div by 2, 1 = Div-by-4
}
void
@@ -18,8 +18,15 @@
}
int
-spi_transact(int readback, int slave, int data, int length) {
+spi_transact(int readback, int slave, int data, int length, int inv_tx) {
volatile int *p;
+ int flags;
+
+ if(inv_tx)
+ flags = SPI_CTRL_ASS | (SPI_CTRL_CHAR_LEN & length);
+ else
+ flags = SPI_CTRL_ASS | SPI_CTRL_TXNEG | (SPI_CTRL_CHAR_LEN & length);
+
spi_wait();
// Tell it which SPI device to access
@@ -32,12 +39,12 @@
// Run it -- write once and rewrite with GO set
p = (int *)(SPI_BASE+SPI_CTRL);
- *p = SPI_CTRL_ASS | SPI_CTRL_TXNEG | (SPI_CTRL_CHAR_LEN & length);
- *p = SPI_CTRL_GO_BSY | SPI_CTRL_ASS | SPI_CTRL_TXNEG | (SPI_CTRL_CHAR_LEN & length);
+ *p = flags;
+ *p = flags | SPI_CTRL_GO_BSY;
if(readback) {
spi_wait();
- p = (int *)(SPI_BASE+SPI_TXRX1);
+ p = (int *)(SPI_BASE+SPI_TXRX0);
return *p;
}
else
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic