From 4be5e54c38390f56fea7f2169641c8cbcf748f53 Mon Sep 17 00:00:00 2001 From: Serge Vakulenko Date: Wed, 7 May 2014 11:15:56 -0700 Subject: [PATCH] Assembler and spi driver fixed for compatibility with latest gcc. --- src/cmd/as/as.c | 9 ++++-- sys/pic32/spi_bus.c | 76 ++++++++++++++++++++++----------------------- 2 files changed, 45 insertions(+), 40 deletions(-) diff --git a/src/cmd/as/as.c b/src/cmd/as/as.c index 61befad..6b958c0 100644 --- a/src/cmd/as/as.c +++ b/src/cmd/as/as.c @@ -2198,7 +2198,7 @@ void pass1 () case LSECTION: /* .section name[,"flags"[,type[,entsize]]] */ clex = getlex (&cval); - if (clex != LNAME && clex != LBSS) + if (clex != LNAME && clex != LBSS && clex != LTEXT && clex != LDATA) uerror ("bad name of .section"); setsection(); clex = getlex (&cval); @@ -2206,7 +2206,12 @@ void pass1 () ungetlex (clex, cval); break; } - skipstring(); + clex = getlex (&cval); + if (clex == '"') { + ungetlex (clex, cval); + skipstring(); + } else if (clex != LNAME) + uerror ("bad type of .section"); clex = getlex (&cval); if (clex != ',') { ungetlex (clex, cval); diff --git a/sys/pic32/spi_bus.c b/sys/pic32/spi_bus.c index 3966197..130478c 100644 --- a/sys/pic32/spi_bus.c +++ b/sys/pic32/spi_bus.c @@ -103,7 +103,7 @@ void spi_close(int dno) if(spi_devices[dno].bus==NULL) return; - + if (spi_devices[dno].cs_tris != NULL) { // Revert the CS pin to input. TRIS_CLR(*spi_devices[dno].cs_tris) = 1<= MAXSPIDEV) return; - + if(spi_devices[dno].bus==NULL) return; - if (spi_devices[dno].cs_tris == NULL) + if (spi_devices[dno].cs_tris == NULL) return; spi_devices[dno].bus->brg = spi_devices[dno].baud; @@ -139,11 +139,11 @@ void spi_deselect(int dno) { if(dno >= MAXSPIDEV) return; - + if(spi_devices[dno].bus==NULL) return; - if (spi_devices[dno].cs_tris == NULL) + if (spi_devices[dno].cs_tris == NULL) return; LAT_SET(*spi_devices[dno].cs_tris) = 1<= MAXSPIDEV) return; - + if(spi_devices[dno].bus==NULL) return; - + spi_devices[dno].mode |= set; } @@ -168,10 +168,10 @@ void spi_clr(int dno, unsigned int set) { if(dno >= MAXSPIDEV) return; - + if(spi_devices[dno].bus==NULL) return; - + spi_devices[dno].mode &= ~set; } @@ -181,10 +181,10 @@ unsigned int spi_status(int dno) { if(dno >= MAXSPIDEV) return 0; - + if(spi_devices[dno].bus==NULL) return 0; - + return spi_devices[dno].bus->stat; } @@ -199,7 +199,7 @@ unsigned char spi_transfer(int dno, unsigned char data) if(dno >= MAXSPIDEV) return 0xF0; - + if(spi_devices[dno].bus==NULL) return 0xF1; @@ -229,10 +229,10 @@ void spi_bulk_write_32_be(int dno, unsigned int len, char *data) if(dno >= MAXSPIDEV) return; - + if(spi_devices[dno].bus==NULL) return; - + nread = 0; nwritten = words; @@ -245,7 +245,7 @@ void spi_bulk_write_32_be(int dno, unsigned int len, char *data) nwritten--; } - if(!(spi_devices[dno].bus->stat & PIC32_SPISTAT_SPIRBE)) + if(!(spi_devices[dno].bus->stat & PIC32_SPISTAT_SPIRBE)) { (void) spi_devices[dno].bus->buf; nread++; @@ -263,10 +263,10 @@ void spi_bulk_write_32(int dno, unsigned int len, char *data) if(dno >= MAXSPIDEV) return; - + if(spi_devices[dno].bus==NULL) return; - + nread = 0; nwritten = words; @@ -279,7 +279,7 @@ void spi_bulk_write_32(int dno, unsigned int len, char *data) nwritten--; } - if(!(spi_devices[dno].bus->stat & PIC32_SPISTAT_SPIRBE)) + if(!(spi_devices[dno].bus->stat & PIC32_SPISTAT_SPIRBE)) { (void) spi_devices[dno].bus->buf; nread++; @@ -297,10 +297,10 @@ void spi_bulk_write_16(int dno, unsigned int len, char *data) if(dno >= MAXSPIDEV) return; - + if(spi_devices[dno].bus==NULL) return; - + nread = 0; nwritten = words; @@ -313,7 +313,7 @@ void spi_bulk_write_16(int dno, unsigned int len, char *data) nwritten--; } - if(!(spi_devices[dno].bus->stat & PIC32_SPISTAT_SPIRBE)) + if(!(spi_devices[dno].bus->stat & PIC32_SPISTAT_SPIRBE)) { (void) spi_devices[dno].bus->buf; nread++; @@ -326,18 +326,18 @@ void spi_bulk_write(int dno, unsigned int len, unsigned char *data) { unsigned char *data8 = data; unsigned int i; - unsigned char in,out; + unsigned char out; if(dno >= MAXSPIDEV) return; - + if(spi_devices[dno].bus==NULL) return; for(i=0; i= MAXSPIDEV) return; - + if(spi_devices[dno].bus==NULL) return; @@ -371,7 +371,7 @@ void spi_bulk_read_32_be(int dno, unsigned int len, char *data) nwritten--; } - if(!(spi_devices[dno].bus->stat & PIC32_SPISTAT_SPIRBE)) + if(!(spi_devices[dno].bus->stat & PIC32_SPISTAT_SPIRBE)) { *data32++ = mips_bswap(spi_devices[dno].bus->buf); nread++; @@ -389,7 +389,7 @@ void spi_bulk_read_32(int dno, unsigned int len, char *data) if(dno >= MAXSPIDEV) return; - + if(spi_devices[dno].bus==NULL) return; @@ -405,7 +405,7 @@ void spi_bulk_read_32(int dno, unsigned int len, char *data) nwritten--; } - if(!(spi_devices[dno].bus->stat & PIC32_SPISTAT_SPIRBE)) + if(!(spi_devices[dno].bus->stat & PIC32_SPISTAT_SPIRBE)) { *data32++ = spi_devices[dno].bus->buf; nread++; @@ -423,7 +423,7 @@ void spi_bulk_read_16(int dno, unsigned int len, char *data) if(dno >= MAXSPIDEV) return; - + if(spi_devices[dno].bus==NULL) return; @@ -439,7 +439,7 @@ void spi_bulk_read_16(int dno, unsigned int len, char *data) nwritten--; } - if(!(spi_devices[dno].bus->stat & PIC32_SPISTAT_SPIRBE)) + if(!(spi_devices[dno].bus->stat & PIC32_SPISTAT_SPIRBE)) { *data16++ = mips_bswap(spi_devices[dno].bus->buf); nread++; @@ -456,7 +456,7 @@ void spi_bulk_read(int dno, unsigned int len, unsigned char *data) if(dno >= MAXSPIDEV) return; - + if(spi_devices[dno].bus==NULL) return; @@ -479,7 +479,7 @@ void spi_bulk_rw_32_be(int dno, unsigned int len, char *data) if(dno >= MAXSPIDEV) return; - + if(spi_devices[dno].bus==NULL) return; @@ -495,7 +495,7 @@ void spi_bulk_rw_32_be(int dno, unsigned int len, char *data) nwritten--; } - if(!(spi_devices[dno].bus->stat & PIC32_SPISTAT_SPIRBE)) + if(!(spi_devices[dno].bus->stat & PIC32_SPISTAT_SPIRBE)) { *read32++ = mips_bswap(spi_devices[dno].bus->buf); nread++; @@ -514,7 +514,7 @@ void spi_bulk_rw_32(int dno, unsigned int len, char *data) if(dno >= MAXSPIDEV) return; - + if(spi_devices[dno].bus==NULL) return; @@ -530,7 +530,7 @@ void spi_bulk_rw_32(int dno, unsigned int len, char *data) nwritten--; } - if(!(spi_devices[dno].bus->stat & PIC32_SPISTAT_SPIRBE)) + if(!(spi_devices[dno].bus->stat & PIC32_SPISTAT_SPIRBE)) { *read32++ = spi_devices[dno].bus->buf; nread++; @@ -549,7 +549,7 @@ void spi_bulk_rw_16(int dno, unsigned int len, char *data) if(dno >= MAXSPIDEV) return; - + if(spi_devices[dno].bus==NULL) return; @@ -565,7 +565,7 @@ void spi_bulk_rw_16(int dno, unsigned int len, char *data) nwritten--; } - if(!(spi_devices[dno].bus->stat & PIC32_SPISTAT_SPIRBE)) + if(!(spi_devices[dno].bus->stat & PIC32_SPISTAT_SPIRBE)) { *read16++ = mips_bswap(spi_devices[dno].bus->buf); nread++; @@ -582,7 +582,7 @@ void spi_bulk_rw(int dno, unsigned int len, unsigned char *data) if(dno >= MAXSPIDEV) return; - + if(spi_devices[dno].bus==NULL) return;