fixed formatting
This commit is contained in:
@@ -232,8 +232,7 @@ static void power_on(void) /* Enable SSP module */
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static
|
static void power_off (void) /* Disable SPI function */
|
||||||
void power_off (void) /* Disable SPI function */
|
|
||||||
{
|
{
|
||||||
select(); /* Wait for card ready */
|
select(); /* Wait for card ready */
|
||||||
deselect();
|
deselect();
|
||||||
@@ -243,11 +242,7 @@ void power_off (void) /* Disable SPI function */
|
|||||||
/*-----------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------*/
|
||||||
/* Receive a data packet from the MMC */
|
/* Receive a data packet from the MMC */
|
||||||
/*-----------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------*/
|
||||||
static
|
static int rcvr_datablock(uint8_t *buff, uint32_t btr)
|
||||||
int rcvr_datablock ( /* 1:OK, 0:Error */
|
|
||||||
uint8_t *buff, /* Data buffer */
|
|
||||||
uint32_t btr /* Data block length (byte) */
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
uint8_t token;
|
uint8_t token;
|
||||||
int32_t target = MCF_SLT_SCNT(0) - (200L * 1000L * 132L);
|
int32_t target = MCF_SLT_SCNT(0) - (200L * 1000L * 132L);
|
||||||
@@ -277,11 +272,7 @@ int rcvr_datablock ( /* 1:OK, 0:Error */
|
|||||||
/*-----------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------*/
|
||||||
|
|
||||||
#if _USE_WRITE
|
#if _USE_WRITE
|
||||||
static
|
static int xmit_datablock(const uint8_t *buff, uint8_t token)
|
||||||
int xmit_datablock ( /* 1:OK, 0:Failed */
|
|
||||||
const uint8_t *buff, /* Ponter to 512 byte data to be sent */
|
|
||||||
uint8_t token /* Token */
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
uint8_t resp;
|
uint8_t resp;
|
||||||
|
|
||||||
@@ -306,14 +297,10 @@ int xmit_datablock ( /* 1:OK, 0:Failed */
|
|||||||
/* Send a command packet to the MMC */
|
/* Send a command packet to the MMC */
|
||||||
/*-----------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------*/
|
||||||
|
|
||||||
static uint8_t send_cmd ( /* Return value: R1 resp (bit7==1:Failed to send) */
|
static uint8_t send_cmd(uint8_t cmd, uint32_t arg)
|
||||||
uint8_t cmd, /* Command index */
|
|
||||||
uint32_t arg /* Argument */
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
uint8_t n, res;
|
uint8_t n, res;
|
||||||
|
|
||||||
|
|
||||||
if (cmd & 0x80) { /* Send a CMD55 prior to ACMD<n> */
|
if (cmd & 0x80) { /* Send a CMD55 prior to ACMD<n> */
|
||||||
cmd &= 0x7F;
|
cmd &= 0x7F;
|
||||||
res = send_cmd(CMD55, 0);
|
res = send_cmd(CMD55, 0);
|
||||||
@@ -448,12 +435,7 @@ DSTATUS disk_status(uint8_t drv)
|
|||||||
/* Read sector(s) */
|
/* Read sector(s) */
|
||||||
/*-----------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------*/
|
||||||
|
|
||||||
DRESULT disk_read (
|
DRESULT disk_read(uint8_t drv, uint8_t *buff, uint32_t sector, uint8_t count)
|
||||||
uint8_t drv, /* Physical drive number (0) */
|
|
||||||
uint8_t *buff, /* Pointer to the data buffer to store read data */
|
|
||||||
uint32_t sector, /* Start sector number (LBA) */
|
|
||||||
uint8_t count /* Number of sectors to read (1..128) */
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
if (drv || !count) return RES_PARERR; /* Check parameter */
|
if (drv || !count) return RES_PARERR; /* Check parameter */
|
||||||
if (Stat & STA_NOINIT) return RES_NOTRDY; /* Check if drive is ready */
|
if (Stat & STA_NOINIT) return RES_NOTRDY; /* Check if drive is ready */
|
||||||
@@ -486,12 +468,7 @@ DRESULT disk_read (
|
|||||||
/*-----------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------*/
|
||||||
|
|
||||||
#if _USE_WRITE
|
#if _USE_WRITE
|
||||||
DRESULT disk_write (
|
DRESULT disk_write(uint8_t drv, const uint8_t *buff, uint32_t sector, uint8_t count)
|
||||||
uint8_t drv, /* Physical drive number (0) */
|
|
||||||
const uint8_t *buff, /* Ponter to the data to write */
|
|
||||||
uint32_t sector, /* Start sector number (LBA) */
|
|
||||||
uint8_t count /* Number of sectors to write (1..128) */
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
if (drv || !count) return RES_PARERR; /* Check parameter */
|
if (drv || !count) return RES_PARERR; /* Check parameter */
|
||||||
if (Stat & STA_NOINIT) return RES_NOTRDY; /* Check drive status */
|
if (Stat & STA_NOINIT) return RES_NOTRDY; /* Check drive status */
|
||||||
@@ -527,11 +504,7 @@ DRESULT disk_write (
|
|||||||
/*-----------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------*/
|
||||||
|
|
||||||
#if _USE_IOCTL
|
#if _USE_IOCTL
|
||||||
DRESULT disk_ioctl (
|
DRESULT disk_ioctl(uint8_t drv, uint8_t ctrl, void *buff)
|
||||||
uint8_t drv, /* Physical drive number (0) */
|
|
||||||
uint8_t ctrl, /* Control command code */
|
|
||||||
void *buff /* Pointer to the conrtol data */
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
DRESULT res;
|
DRESULT res;
|
||||||
uint8_t n, csd[16], *ptr = buff;
|
uint8_t n, csd[16], *ptr = buff;
|
||||||
|
|||||||
Reference in New Issue
Block a user