From 0edd0722c8e06945d32fc24c517c52235c1482b4 Mon Sep 17 00:00:00 2001 From: laforge Date: Thu, 14 Sep 2006 02:37:42 +0000 Subject: spi_transceive cannot work without a rx_buffer due to hardware restrictions (Bug report by Henryk Ploetz) git-svn-id: https://svn.openpcd.org:2342/trunk@196 6dc7ffe9-61d6-0310-9af1-9938baff3ed1 --- firmware/src/pcd/rc632.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'firmware') diff --git a/firmware/src/pcd/rc632.c b/firmware/src/pcd/rc632.c index 3a91e8f..f5ac8e7 100644 --- a/firmware/src/pcd/rc632.c +++ b/firmware/src/pcd/rc632.c @@ -98,13 +98,11 @@ static void spi_irq(void) static int spi_transceive(const u_int8_t *tx_data, u_int16_t tx_len, u_int8_t *rx_data, u_int16_t *rx_len) { - //tx_len = *rx_len = 65; DEBUGPSPI("DMA Xfer tx=%s\r\n", hexdump(tx_data, tx_len)); if (*rx_len < tx_len) { DEBUGPCRF("rx_len=%u smaller tx_len=%u\n", *rx_len, tx_len); return -1; } - //AT91F_SPI_Disable(pSPI); AT91F_SPI_ReceiveFrame(pSPI, rx_data, tx_len, NULL, 0); AT91F_SPI_SendFrame(pSPI, tx_data, tx_len, NULL, 0); @@ -113,7 +111,6 @@ static int spi_transceive(const u_int8_t *tx_data, u_int16_t tx_len, AT91F_PDC_EnableTx(AT91C_BASE_PDC_SPI); pSPI->SPI_IER = AT91C_SPI_ENDTX|AT91C_SPI_ENDRX; - //pSPI->SPI_IDR = AT91C_SPI_ENDTX|AT91C_SPI_ENDRX; while (! (pSPI->SPI_SR & AT91C_SPI_ENDRX)) ; @@ -211,6 +208,7 @@ int rc632_reg_write(struct rfid_asic_handle *hdl, int rc632_fifo_write(struct rfid_asic_handle *hdl, u_int8_t len, u_int8_t *data, u_int8_t flags) { + u_int16_t rx_len = sizeof(spi_inpuf); if (len > sizeof(spi_outbuf)-1) len = sizeof(spi_outbuf)-1; @@ -219,7 +217,7 @@ int rc632_fifo_write(struct rfid_asic_handle *hdl, DEBUG632("[FIFO] <= %s", hexdump(data, len)); - return spi_transceive(spi_outbuf, len+1, NULL, NULL); + return spi_transceive(spi_outbuf, len+1, spi_inbuf, &rx_len); } int rc632_reg_read(struct rfid_asic_handle *hdl, -- cgit v1.2.3