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