mirror of
https://github.com/marqs85/ossc
synced 2026-11-06 15:10:00 +03:00
fix firmware update functionality
This commit is contained in:
1 parent
30d403f157
commit
6198ce7d9e
13 files changed
+1174
-264
No files matched your search
@@ -94,11 +94,11 @@ DWORD __SD_Power_Of_Two(BYTE e)
|
||||
return(partial);
|
||||
}
|
||||
|
||||
inline void __SD_Assert(void){
|
||||
inline void __attribute__((flatten, __section__(".text_bram"))) __SD_Assert(void){
|
||||
SPI_CS_Low();
|
||||
}
|
||||
|
||||
inline void __SD_Deassert(void){
|
||||
inline void __attribute__((flatten, __section__(".text_bram"))) __SD_Deassert(void){
|
||||
SPI_CS_High();
|
||||
}
|
||||
|
||||
@@ -107,7 +107,7 @@ void __SD_Speed_Transfer(BYTE throttle) {
|
||||
else SPI_Freq_Low();
|
||||
}
|
||||
|
||||
BYTE __SD_Send_Cmd(BYTE cmd, DWORD arg)
|
||||
BYTE __attribute__((noinline, flatten, __section__(".text_bram"))) __SD_Send_Cmd(BYTE cmd, DWORD arg)
|
||||
{
|
||||
BYTE wiredata[10];
|
||||
BYTE crc, res;
|
||||
@@ -361,7 +361,7 @@ SDRESULTS SD_Init(SD_DEV *dev)
|
||||
#endif
|
||||
}
|
||||
|
||||
SDRESULTS SD_Read(SD_DEV *dev, void *dat, DWORD sector, WORD ofs, WORD cnt)
|
||||
SDRESULTS __attribute__((noinline, flatten, __section__(".text_bram"))) SD_Read(SD_DEV *dev, void *dat, DWORD sector, WORD ofs, WORD cnt)
|
||||
{
|
||||
#if defined(_M_IX86) // x86
|
||||
// Check the sector query
|
||||
|
||||
@@ -15,11 +15,11 @@ void SPI_Init (void) {
|
||||
I2C_init(SD_SPI_BASE,ALT_CPU_FREQ,400000);
|
||||
}
|
||||
|
||||
void SPI_W(const BYTE *wd, int len) {
|
||||
void __attribute__((noinline, flatten, __section__(".text_bram"))) SPI_W(const BYTE *wd, int len) {
|
||||
SPI_write(SD_SPI_BASE, wd, len);
|
||||
}
|
||||
|
||||
void SPI_R(BYTE *rd, int len) {
|
||||
void __attribute__((noinline, flatten, __section__(".text_bram"))) SPI_R(BYTE *rd, int len) {
|
||||
SPI_read(SD_SPI_BASE, rd, len);
|
||||
}
|
||||
|
||||
@@ -34,16 +34,17 @@ BYTE SPI_RW (BYTE d) {
|
||||
return w;
|
||||
}
|
||||
|
||||
void SPI_Release (void) {
|
||||
void __attribute__((noinline, flatten, __section__(".text_bram"))) SPI_Release (void) {
|
||||
SPI_CS_High();
|
||||
return;
|
||||
}
|
||||
|
||||
inline void SPI_CS_Low (void) {
|
||||
inline void __attribute__((flatten, __section__(".text_bram"))) SPI_CS_Low (void) {
|
||||
sys_ctrl &= ~SD_SPI_SS_N;
|
||||
IOWR_ALTERA_AVALON_PIO_DATA(PIO_0_BASE, sys_ctrl);
|
||||
}
|
||||
|
||||
inline void SPI_CS_High (void){
|
||||
inline void __attribute__((flatten, __section__(".text_bram"))) SPI_CS_High (void){
|
||||
sys_ctrl |= SD_SPI_SS_N;
|
||||
IOWR_ALTERA_AVALON_PIO_DATA(PIO_0_BASE, sys_ctrl);
|
||||
}
|
||||
@@ -56,7 +57,7 @@ inline void SPI_Freq_Low (void) {
|
||||
I2C_init(SD_SPI_BASE,ALT_CPU_FREQ,400000);
|
||||
}
|
||||
|
||||
int SPI_Timer_On (WORD ms) {
|
||||
int __attribute__((noinline, flatten, __section__(".text_bram"))) SPI_Timer_On (WORD ms) {
|
||||
if (!sd_timer_ts) {
|
||||
sd_timer_ts = alt_timestamp() + ms*(TIMER_0_FREQ/1000);
|
||||
return 0;
|
||||
@@ -64,11 +65,11 @@ int SPI_Timer_On (WORD ms) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
inline BOOL SPI_Timer_Status (void) {
|
||||
inline BOOL __attribute__((flatten, __section__(".text_bram"))) SPI_Timer_Status (void) {
|
||||
return alt_timestamp() < sd_timer_ts;
|
||||
}
|
||||
|
||||
inline void SPI_Timer_Off (void) {
|
||||
inline void __attribute__((flatten, __section__(".text_bram"))) SPI_Timer_Off (void) {
|
||||
sd_timer_ts = 0;
|
||||
return;
|
||||
}
|
||||
Reference in new issue
Block a user