further adaption

This commit is contained in:
Markus Fröschle
2012-12-04 18:17:20 +00:00
parent c536c1314b
commit dd0069d2c8
3 changed files with 14 additions and 12 deletions

View File

@@ -7,6 +7,7 @@
<buildSpec> <buildSpec>
<buildCommand> <buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name> <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
<triggers>clean,full,incremental,</triggers>
<arguments> <arguments>
<dictionary> <dictionary>
<key>?children?</key> <key>?children?</key>

View File

@@ -1,3 +1,7 @@
#include <stdint.h>
#include <bas_types.h>
#include "sysinit.h"
/*------------------------------------------------------------------------*/ /*------------------------------------------------------------------------*/
/* Firebee: MMCv3/SDv1/SDv2 (SPI mode) control module */ /* Firebee: MMCv3/SDv1/SDv2 (SPI mode) control module */
/*------------------------------------------------------------------------*/ /*------------------------------------------------------------------------*/
@@ -95,8 +99,7 @@
#define CMD58 (58) /* READ_OCR */ #define CMD58 (58) /* READ_OCR */
static volatile static volatile DSTATUS Stat = STA_NOINIT; /* Physical drive status */
DSTATUS Stat = STA_NOINIT; /* Physical drive status */
static volatile static volatile
UINT Timer1, Timer2; /* 1kHz decrement timer stopped at zero (disk_timerproc()) */ UINT Timer1, Timer2; /* 1kHz decrement timer stopped at zero (disk_timerproc()) */
@@ -169,7 +172,7 @@ static bool card_ready(void)
*/ */
static int wait_ready (UINT wt) static int wait_ready (UINT wt)
{ {
return waitfor(card_ready, wt); return waitfor(wt, card_ready);
} }
@@ -177,13 +180,10 @@ static int wait_ready (UINT wt)
/* /*
* Deselect card and release SPI * Deselect card and release SPI
*/ */
static void deselect (void)
static
void deselect (void)
{ {
CS_HIGH(); /* CS = H */ CS_HIGH(); /* CS = H */
xchg_spi(0xFF); /* Dummy clock (force DO hi-z for multiple slave SPI) */ xchg_spi(0xFF); /* Dummy clock (force DO hi-z for multiple slave SPI) */
} }
@@ -209,9 +209,10 @@ int select (void) /* 1:OK, 0:Timeout */
* Control SPI module (Platform dependent) * Control SPI module (Platform dependent)
*/ */
static static void power_on (void) /* Enable SSP module and attach it to I/O pads */
void power_on (void) /* Enable SSP module and attach it to I/O pads */
{ {
spi_init();
#ifdef _NOT_USED_
__set_PCONP(PCSSPx, 1); /* Enable SSP module */ __set_PCONP(PCSSPx, 1); /* Enable SSP module */
__set_PCLKSEL(PCLKSSPx, PCLKDIV_SSP); /* Select PCLK frequency for SSP */ __set_PCLKSEL(PCLKSSPx, PCLKDIV_SSP); /* Select PCLK frequency for SSP */
SSPxCR0 = 0x0007; /* Set mode: SPI mode 0, 8-bit */ SSPxCR0 = 0x0007; /* Set mode: SPI mode 0, 8-bit */
@@ -228,7 +229,7 @@ void power_on (void) /* Enable SSP module and attach it to I/O pads */
FIO0DIR |= _BV(9)|_BV(7)|_BV(6); /* Set SCK1, MOSI1 and CS# as output */ FIO0DIR |= _BV(9)|_BV(7)|_BV(6); /* Set SCK1, MOSI1 and CS# as output */
#endif #endif
CS_HIGH(); /* Set CS# high */ CS_HIGH(); /* Set CS# high */
#endif /* _NOT_USED_ */
for (Timer1 = 10; Timer1; ) ; /* 10ms */ for (Timer1 = 10; Timer1; ) ; /* 10ms */
} }
@@ -304,8 +305,7 @@ int xmit_datablock ( /* 1:OK, 0:Failed */
/* Send a command packet to the MMC */ /* Send a command packet to the MMC */
/*-----------------------------------------------------------------------*/ /*-----------------------------------------------------------------------*/
static static BYTE send_cmd ( /* Return value: R1 resp (bit7==1:Failed to send) */
BYTE send_cmd ( /* Return value: R1 resp (bit7==1:Failed to send) */
BYTE cmd, /* Command index */ BYTE cmd, /* Command index */
DWORD arg /* Argument */ DWORD arg /* Argument */
) )

View File

@@ -29,6 +29,7 @@
#define __SYSINIT_H__ #define __SYSINIT_H__
extern void wait_10us(void); extern void wait_10us(void);
extern inline bool waitfor(uint32_t us, int (*condition)(void));
/* send a 16-bit word out on the serial port */ /* send a 16-bit word out on the serial port */
#define uart_out_word(a) MCF_PSC0_PSCTB_8BIT = (a) #define uart_out_word(a) MCF_PSC0_PSCTB_8BIT = (a)