software/libbase/bios: rename spi.c/h to spisdcard.h, also rename functions.
This commit is contained in:
parent
939256340f
commit
37f25ed37a
|
@ -489,10 +489,10 @@ void romboot(void)
|
|||
#endif
|
||||
|
||||
// SPI HARDWARE BITBANG
|
||||
#ifdef CSR_SPI_BASE
|
||||
#include <spi.h>
|
||||
#ifdef CSR_SPISDCARD_BASE
|
||||
#include <spisdcard.h>
|
||||
|
||||
void spisdboot(void)
|
||||
void spisdcardboot(void)
|
||||
{
|
||||
printf("SD Card via SPI Initialising\n");
|
||||
if(spi_sdcard_goidle() == 0) {
|
||||
|
|
|
@ -6,8 +6,8 @@ void netboot(void);
|
|||
void flashboot(void);
|
||||
void romboot(void);
|
||||
|
||||
#ifdef CSR_SPI_BASE
|
||||
void spisdboot(void);
|
||||
#ifdef CSR_SPISDCARD_BASE
|
||||
void spisdcardboot(void);
|
||||
#endif
|
||||
|
||||
#endif /* __BOOT_H */
|
||||
|
|
|
@ -395,8 +395,8 @@ static void help(void)
|
|||
puts("sdram_mpr - read SDRAM MPR");
|
||||
puts("sdram_mrwr reg value - write SDRAM mode registers");
|
||||
#endif
|
||||
#ifdef CSR_SPI_BASE
|
||||
puts("spisdboot - boot from SDCard via SPI hardware bitbang");
|
||||
#ifdef CSR_SPISDCARD_BASE
|
||||
puts("spisdcardboot - boot from SDCard via SPI hardware bitbang");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -507,8 +507,8 @@ static void do_command(char *c)
|
|||
sdrhw();
|
||||
}
|
||||
#endif
|
||||
#ifdef CSR_SPI_BASE
|
||||
else if(strcmp(token, "spisdboot") == 0) spisdboot();
|
||||
#ifdef CSR_SPISDCARD_BASE
|
||||
else if(strcmp(token, "spisdcardboot") == 0) spisdcardboot();
|
||||
#endif
|
||||
|
||||
else if(strcmp(token, "") != 0)
|
||||
|
|
|
@ -2,7 +2,7 @@ include ../include/generated/variables.mak
|
|||
include $(SOC_DIRECTORY)/software/common.mak
|
||||
|
||||
OBJECTS=exception.o libc.o errno.o crc16.o crc32.o console.o \
|
||||
system.o id.o uart.o time.o qsort.o strtod.o spiflash.o spi.o strcasecmp.o mdio.o
|
||||
system.o id.o uart.o time.o qsort.o strtod.o spiflash.o spisdcard.o strcasecmp.o mdio.o
|
||||
|
||||
all: crt0-$(CPU)-ctr.o crt0-$(CPU)-xip.o libbase.a libbase-nofloat.a
|
||||
|
||||
|
|
|
@ -20,9 +20,9 @@
|
|||
#include <time.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifdef CSR_SPI_BASE
|
||||
#ifdef CSR_SPISDCARD_BASE
|
||||
// Import prototypes for the functions
|
||||
#include <spi.h>
|
||||
#include <spisdcard.h>
|
||||
|
||||
// SPI
|
||||
// cs line - high to indicate DESELECT
|
||||
|
@ -57,14 +57,14 @@ void spi_write_byte(unsigned char char_to_send)
|
|||
{
|
||||
// Place data into MOSI register
|
||||
// Pulse the START bit and set LENGTH=8
|
||||
spi_mosi_write(char_to_send);
|
||||
spi_control_write(ONEBYTE | SPI_START);
|
||||
spisdcard_mosi_write(char_to_send);
|
||||
spisdcard_control_write(ONEBYTE | SPI_START);
|
||||
|
||||
// Wait for DONE
|
||||
while( (spi_status_read() != SPI_DONE)) {}
|
||||
while( (spisdcard_status_read() != SPI_DONE)) {}
|
||||
|
||||
// Signal end of transfer
|
||||
spi_control_write( 0x00 );
|
||||
spisdcard_control_write( 0x00 );
|
||||
}
|
||||
|
||||
|
||||
|
@ -86,13 +86,13 @@ unsigned char spi_read_rbyte(void)
|
|||
unsigned char r=0;
|
||||
|
||||
// Check if MISO is 0x0xxxxxxx as MSB=0 indicates valid response
|
||||
r = spi_miso_read();
|
||||
r = spisdcard_miso_read();
|
||||
while( ((r&0x80)!=0) && timeout>0) {
|
||||
spi_mosi_write( 0xff );
|
||||
spi_control_write(ONEBYTE | SPI_START);
|
||||
while( (spi_status_read() != SPI_DONE)) {}
|
||||
r = spi_miso_read();
|
||||
spi_control_write( 0x00 );
|
||||
spisdcard_mosi_write( 0xff );
|
||||
spisdcard_control_write(ONEBYTE | SPI_START);
|
||||
while( (spisdcard_status_read() != SPI_DONE)) {}
|
||||
r = spisdcard_miso_read();
|
||||
spisdcard_control_write( 0x00 );
|
||||
timeout--;
|
||||
}
|
||||
|
||||
|
@ -119,7 +119,7 @@ unsigned char spi_read_byte(void)
|
|||
unsigned char r=0;
|
||||
|
||||
spi_write_byte( 0xff );
|
||||
r = spi_miso_read();
|
||||
r = spisdcard_miso_read();
|
||||
|
||||
return r;
|
||||
}
|
||||
|
@ -142,13 +142,13 @@ unsigned char spi_setspimode(void)
|
|||
// Send pulses
|
||||
do {
|
||||
// set CS HIGH and send pulses
|
||||
spi_cs_write(CS_HIGH);
|
||||
spisdcard_cs_write(CS_HIGH);
|
||||
for (i=0; i<10; i++) {
|
||||
spi_write_byte( 0xff );
|
||||
}
|
||||
|
||||
// set CS LOW and send pulses
|
||||
spi_cs_write(CS_LOW);
|
||||
spisdcard_cs_write(CS_LOW);
|
||||
r = spi_read_rbyte();
|
||||
|
||||
timeout--;
|
Loading…
Reference in New Issue