[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r5197 - gnuradio/branches/developers/matt/u2f/firmware
From: |
matt |
Subject: |
[Commit-gnuradio] r5197 - gnuradio/branches/developers/matt/u2f/firmware |
Date: |
Mon, 30 Apr 2007 16:38:54 -0600 (MDT) |
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 Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r5197 - gnuradio/branches/developers/matt/u2f/firmware,
matt <=