Add casts to eliminate warnings when sizeof(int) is 16-bits

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@2401 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo 2009-12-20 22:35:35 +00:00
parent 43c18e6e70
commit 408d3a135a
6 changed files with 141 additions and 137 deletions

View file

@ -1656,7 +1656,7 @@ pascal-2.0 2010-xx-xx Gregory Nutt <spudmonkey@racsa.co.cr>
stdbool.h. This change was necessary for compatibility
with NuttX-5.0.
buildroot-1.8 2010-xx-xx <spudmonkey@racsa.co.cr>
buildroot-1.8 2010-xx-xx <spudmonkey@racsa.co.cr>
* configs/cortexm3-defconfig-4.3.3: Added support for NuttX NXFLAT
tools.
@ -1665,7 +1665,8 @@ buildroot-1.8 2010-xx-xx &lt;spudmonkey@racsa.co.cr&gt;
* configs/m68hc12-defconfig-4.3.3: Update to m68ch11-defconfig.
* configs/m68hc12-defconfig-3.4.6: There are problems building GCC
4.3.3 for the hc12.
* configs/m32c-defconfig-4.2.4: Added genromfs
* configs/m32c-defconfig-4.3.3: Update to m32c-defconfig-4.2.4
</pre></ul>
<table width ="100%">

View file

@ -283,7 +283,7 @@
/* C_SIZE 62-73 Device size */
#define MMCSD_CSD_CSIZE(csd) (((csd[6] & 3) << 10) | (csd[7] << 2) | (csd[8] >> 6))
#define SD20_CSD_CSIZE(csd) (((csd[7] & 0x3f) << 16) | (csd[8] << 8) | csd[9])
#define SD20_CSD_CSIZE(csd) ((((uint32_t)csd[7] & 0x3f) << 16) | (csd[8] << 8) | csd[9])
/* VDD_R_CURR_MIN 59-61 = Max. read current at Vcc min */

View file

@ -46,6 +46,7 @@
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <semaphore.h>
#include <debug.h>
@ -74,10 +75,11 @@
/* Timing (all in units of microseconds) */
#define MMCSD_POWERUP_DELAY 250 /* 74 clock cycles @ 400KHz = 185uS */
#define MMCSD_IDLE_DELAY (50*1000) /* Short delay to allow change to IDLE state */
#define MMCSD_DSR_DELAY (100*1000) /* Time to wait after setting DSR */
#define MMCSD_CLK_DELAY (500*1000) /* Delay after changing clock speeds */
#define MMCSD_
#define MMCSD_POWERUP_DELAY ((useconds_t)250) /* 74 clock cycles @ 400KHz = 185uS */
#define MMCSD_IDLE_DELAY ((useconds_t)50000) /* Short delay to allow change to IDLE state */
#define MMCSD_DSR_DELAY ((useconds_t)100000) /* Time to wait after setting DSR */
#define MMCSD_CLK_DELAY ((useconds_t)500000) /* Delay after changing clock speeds */
/* Data delays (all in units of milliseconds).
*
@ -905,7 +907,7 @@ static int mmcsd_getR1(FAR struct mmcsd_state_s *priv, FAR uint32_t *r1)
* R1 card status register.
*/
mmcsd_sendcmdpoll(priv, MMCSD_CMD13, priv->rca << 16);
mmcsd_sendcmdpoll(priv, MMCSD_CMD13, (uint32_t)priv->rca << 16);
ret = SDIO_RECVR1(priv->dev, MMCSD_CMD13, &localR1);
if (ret == OK)
{
@ -2210,7 +2212,7 @@ static int mmcsd_mmcinitialize(FAR struct mmcsd_state_s *priv)
/* Select high speed MMC clocking (which may depend on the DSR setting) */
SDIO_CLOCK(priv->dev, CLOCK_MMC_TRANSFER);
up_udelay( MMCSD_CLK_DELAY);
up_udelay(MMCSD_CLK_DELAY);
return OK;
}
#endif
@ -2294,7 +2296,7 @@ static int mmcsd_sdinitialize(FAR struct mmcsd_state_s *priv)
* mode.
*/
mmcsd_sendcmdpoll(priv, MMCSD_CMD9, priv->rca << 16);
mmcsd_sendcmdpoll(priv, MMCSD_CMD9, (uint32_t)priv->rca << 16);
ret = SDIO_RECVR2(priv->dev, MMCSD_CMD9, csd);
if (ret != OK)
{
@ -2308,7 +2310,7 @@ static int mmcsd_sdinitialize(FAR struct mmcsd_state_s *priv)
* card selected all of the time.
*/
mmcsd_sendcmdpoll(priv, MMCSD_CMD7S, priv->rca << 16);
mmcsd_sendcmdpoll(priv, MMCSD_CMD7S, (uint32_t)priv->rca << 16);
ret = mmcsd_recvR1(priv, MMCSD_CMD7S);
if (ret != OK)
{

View file

@ -48,127 +48,128 @@
********************************************************************************************/
/* CMD8 Argument:
* [31:12]: Reserved (shall be set to '0') * [11:8]: Supply Voltage (VHS) 0x1 (Range: 2.7-3.6 V)
* [31:12]: Reserved (shall be set to '0')
* [11:8]: Supply Voltage (VHS) 0x1 (Range: 2.7-3.6 V)
* [7:0]: Check Pattern (recommended 0xaa)
* CMD8 Response: R7
*/
#define MMCSD_CMD8VOLTAGE_SHIFT 8 /* Bits 8-11: Supply voltage */
#define MMCSD_CMD8VOLTAGE_MASK (0x0f << MMCSD_CMD8VOLTAGE_SHIFT)
# define MMCSD_CMD8VOLTAGE_27 (0x01 << MMCSD_CMD8VOLTAGE_SHIFT) /* 2.7-3.6V */
#define MMCSD_CMD8ECHO_SHIFT 0 /* Bits 0-7: Check pattern */
#define MMCSD_CMD8ECHO_MASK (0xff << MMCSD_CMD8ECHO_SHIFT)
# define MMCSD_CMD8CHECKPATTERN (0xaa << MMCSD_CMD8ECHO_SHIFT)
#define MMCSD_CMD8VOLTAGE_SHIFT (8) /* Bits 8-11: Supply voltage */
#define MMCSD_CMD8VOLTAGE_MASK ((uint32_t)0x0f << MMCSD_CMD8VOLTAGE_SHIFT)
# define MMCSD_CMD8VOLTAGE_27 ((uint32_t)0x01 << MMCSD_CMD8VOLTAGE_SHIFT) /* 2.7-3.6V */
#define MMCSD_CMD8ECHO_SHIFT (0) /* Bits 0-7: Check pattern */
#define MMCSD_CMD8ECHO_MASK ((uint32_t)0xff << MMCSD_CMD8ECHO_SHIFT)
# define MMCSD_CMD8CHECKPATTERN ((uint32_t)0xaa << MMCSD_CMD8ECHO_SHIFT)
/* ACMD6 argument */
#define MMCSD_ACMD6_BUSWIDTH_1 (0) /* Bus width = 1-bit */
#define MMCSD_ACMD6_BUSWIDTH_4 (2) /* Bus width = 4-bit */
#define MMCSD_ACMD6_BUSWIDTH_1 ((uint32_t)0) /* Bus width = 1-bit */
#define MMCSD_ACMD6_BUSWIDTH_4 ((uint32_t)2) /* Bus width = 4-bit */
/* ACMD41 argument */
#define MMCSD_ACMD41_VOLTAGEWINDOW 0x80100000
#define MMCSD_ACMD41_HIGHCAPACITY (1 << 30)
#define MMCSD_ACMD41_STDCAPACITY (0)
#define MMCSD_ACMD41_VOLTAGEWINDOW ((uint32_t)0x80100000)
#define MMCSD_ACMD41_HIGHCAPACITY ((uint32_t)1 << 30)
#define MMCSD_ACMD41_STDCAPACITY ((uint32_t)0)
/* ACMD42 argument */
#define MMCSD_ACMD42_CD_DISCONNECT (0) /* Disconnect card detection logic */
#define MMCSD_ACMD42_CD_CONNECT (1) /* Connect card detection logic */
#define MMCSD_ACMD42_CD_DISCONNECT ((uint32_t)0) /* Disconnect card detection logic */
#define MMCSD_ACMD42_CD_CONNECT ((uint32_t)1) /* Connect card detection logic */
/* R1 Card Status bit definitions */
#define MMCSD_R1_OUTOFRANGE (1 << 31) /* Bad argument */
#define MMCSD_R1_ADDRESSERROR (1 << 30) /* Bad address */
#define MMCSD_R1_BLOCKLENERROR (1 << 29) /* Bad block length */
#define MMCSD_R1_ERASESEQERROR (1 << 28) /* Erase cmd error */
#define MMCSD_R1_ERASEPARAM (1 << 27) /* Bad write blocks */
#define MMCSD_R1_WPVIOLATION (1 << 26) /* Erase access failure */
#define MMCSD_R1_CARDISLOCKED (1 << 25) /* Card is locked */
#define MMCSD_R1_LOCKUNLOCKFAILED (1 << 24) /* Password error */
#define MMCSD_R1_COMCRCERROR (1 << 23) /* CRC error */
#define MMCSD_R1_ILLEGALCOMMAND (1 << 22) /* Bad command */
#define MMCSD_R1_CARDECCFAILED (1 << 21) /* Failed to correct data */
#define MMCSD_R1_CCERROR (1 << 20) /* Card controller error */
#define MMCSD_R1_ERROR (1 << 19) /* General error */
#define MMCSD_R1_UNDERRUN (1 << 18) /* Underrun (MMC only) */
#define MMCSD_R1_OVERRRUN (1 << 17) /* Overrun (MMC only) */
#define MMCSD_R1_CIDCSDOVERWRITE (1 << 16) /* CID/CSD error */
#define MMCSD_R1_WPERASESKIP (1 << 15) /* Not all erased */
#define MMCSD_R1_CARDECCDISABLED (1 << 14) /* Internal ECC not used */
#define MMCSD_R1_ERASERESET (1 << 13) /* Reset sequence cleared */
#define MMCSD_R1_STATE_SHIFT (9) /* Current card state */
#define MMCSD_R1_STATE_MASK (15 << MMCSD_R1_STATE_SHIFT)
/* Card identification mode states */
# define MMCSD_R1_STATE_IDLE (0 << MMCSD_R1_STATE_SHIFT) /* 0=Idle state */
# define MMCSD_R1_STATE_READY (1 << MMCSD_R1_STATE_SHIFT) /* 1=Ready state */
# define MMCSD_R1_STATE_IDENT (2 << MMCSD_R1_STATE_SHIFT) /* 2=Identification state */
/* Data transfer states */
# define MMCSD_R1_STATE_STBY (3 << MMCSD_R1_STATE_SHIFT) /* 3=Standby state */
# define MMCSD_R1_STATE_TRAN (4 << MMCSD_R1_STATE_SHIFT) /* 4=Transfer state */
# define MMCSD_R1_STATE_DATA (5 << MMCSD_R1_STATE_SHIFT) /* 5=Sending data state */
# define MMCSD_R1_STATE_RCV (6 << MMCSD_R1_STATE_SHIFT) /* 6=Receiving data state */
# define MMCSD_R1_STATE_PRG (7 << MMCSD_R1_STATE_SHIFT) /* 7=Programming state */
# define MMCSD_R1_STATE_DIS (8 << MMCSD_R1_STATE_SHIFT) /* 8=Disconnect state */
#define MMCSD_R1_READYFORDATA (1 << 8) /* Buffer empty */
#define MMCSD_R1_APPCMD (1 << 5) /* Next CMD is ACMD */
#define MMCSD_R1_AKESEQERROR (1 << 3) /* Authentication error */
#define MMCSD_R1_ERRORMASK 0xfdffe008 /* Error mask */
#define MMCSD_R1_OUTOFRANGE ((uint32_t)1 << 31) /* Bad argument */
#define MMCSD_R1_ADDRESSERROR ((uint32_t)1 << 30) /* Bad address */
#define MMCSD_R1_BLOCKLENERROR ((uint32_t)1 << 29) /* Bad block length */
#define MMCSD_R1_ERASESEQERROR ((uint32_t)1 << 28) /* Erase cmd error */
#define MMCSD_R1_ERASEPARAM ((uint32_t)1 << 27) /* Bad write blocks */
#define MMCSD_R1_WPVIOLATION ((uint32_t)1 << 26) /* Erase access failure */
#define MMCSD_R1_CARDISLOCKED ((uint32_t)1 << 25) /* Card is locked */
#define MMCSD_R1_LOCKUNLOCKFAILED ((uint32_t)1 << 24) /* Password error */
#define MMCSD_R1_COMCRCERROR ((uint32_t)1 << 23) /* CRC error */
#define MMCSD_R1_ILLEGALCOMMAND ((uint32_t)1 << 22) /* Bad command */
#define MMCSD_R1_CARDECCFAILED ((uint32_t)1 << 21) /* Failed to correct data */
#define MMCSD_R1_CCERROR ((uint32_t)1 << 20) /* Card controller error */
#define MMCSD_R1_ERROR ((uint32_t)1 << 19) /* General error */
#define MMCSD_R1_UNDERRUN ((uint32_t)1 << 18) /* Underrun (MMC only) */
#define MMCSD_R1_OVERRRUN ((uint32_t)1 << 17) /* Overrun (MMC only) */
#define MMCSD_R1_CIDCSDOVERWRITE ((uint32_t)1 << 16) /* CID/CSD error */
#define MMCSD_R1_WPERASESKIP ((uint32_t)1 << 15) /* Not all erased */
#define MMCSD_R1_CARDECCDISABLED ((uint32_t)1 << 14) /* Internal ECC not used */
#define MMCSD_R1_ERASERESET ((uint32_t)1 << 13) /* Reset sequence cleared */
#define MMCSD_R1_STATE_SHIFT (9) /* Current card state */
#define MMCSD_R1_STATE_MASK ((uint32_t)15 << MMCSD_R1_STATE_SHIFT)
/* Card identification mode states */
# define MMCSD_R1_STATE_IDLE ((uint32_t)0 << MMCSD_R1_STATE_SHIFT) /* 0=Idle state */
# define MMCSD_R1_STATE_READY ((uint32_t)1 << MMCSD_R1_STATE_SHIFT) /* 1=Ready state */
# define MMCSD_R1_STATE_IDENT ((uint32_t)2 << MMCSD_R1_STATE_SHIFT) /* 2=Identification state */
/* Data transfer states */
# define MMCSD_R1_STATE_STBY ((uint32_t)3 << MMCSD_R1_STATE_SHIFT) /* 3=Standby state */
# define MMCSD_R1_STATE_TRAN ((uint32_t)4 << MMCSD_R1_STATE_SHIFT) /* 4=Transfer state */
# define MMCSD_R1_STATE_DATA ((uint32_t)5 << MMCSD_R1_STATE_SHIFT) /* 5=Sending data state */
# define MMCSD_R1_STATE_RCV ((uint32_t)6 << MMCSD_R1_STATE_SHIFT) /* 6=Receiving data state */
# define MMCSD_R1_STATE_PRG ((uint32_t)7 << MMCSD_R1_STATE_SHIFT) /* 7=Programming state */
# define MMCSD_R1_STATE_DIS ((uint32_t)8 << MMCSD_R1_STATE_SHIFT) /* 8=Disconnect state */
#define MMCSD_R1_READYFORDATA ((uint32_t)1 << 8) /* Buffer empty */
#define MMCSD_R1_APPCMD ((uint32_t)1 << 5) /* Next CMD is ACMD */
#define MMCSD_R1_AKESEQERROR ((uint32_t)1 << 3) /* Authentication error */
#define MMCSD_R1_ERRORMASK ((uint32_t)0xfdffe008) /* Error mask */
#define IS_STATE(v,s) (((v)&MMCSD_R1_STATE_MASK)==(s))
#define IS_STATE(v,s) ((((uint32_t)v)&MMCSD_R1_STATE_MASK)==(s))
/* R3 (OCR) */
#define MMC_VDD_20_36 0x00ffff00 /* VDD voltage 2.0-3.6 */
#define MMC_VDD_20_36 ((uint32_t)0x00ffff00) /* VDD voltage 2.0-3.6 */
#define MMCSD_VDD_145_150 (1 << 0) /* VDD voltage 1.45 - 1.50 */
#define MMCSD_VDD_150_155 (1 << 1) /* VDD voltage 1.50 - 1.55 */
#define MMCSD_VDD_155_160 (1 << 2) /* VDD voltage 1.55 - 1.60 */
#define MMCSD_VDD_160_165 (1 << 3) /* VDD voltage 1.60 - 1.65 */
#define MMCSD_VDD_165_170 (1 << 4) /* VDD voltage 1.65 - 1.70 */
#define MMCSD_VDD_17_18 (1 << 5) /* VDD voltage 1.7 - 1.8 */
#define MMCSD_VDD_18_19 (1 << 6) /* VDD voltage 1.8 - 1.9 */
#define MMCSD_VDD_19_20 (1 << 7) /* VDD voltage 1.9 - 2.0 */
#define MMCSD_VDD_20_21 (1 << 8) /* VDD voltage 2.0-2.1 */
#define MMCSD_VDD_21_22 (1 << 9) /* VDD voltage 2.1-2.2 */
#define MMCSD_VDD_22_23 (1 << 10) /* VDD voltage 2.2-2.3 */
#define MMCSD_VDD_23_24 (1 << 11) /* VDD voltage 2.3-2.4 */
#define MMCSD_VDD_24_25 (1 << 12) /* VDD voltage 2.4-2.5 */
#define MMCSD_VDD_25_26 (1 << 13) /* VDD voltage 2.5-2.6 */
#define MMCSD_VDD_26_27 (1 << 14) /* VDD voltage 2.6-2.7 */
#define MMCSD_VDD_27_28 (1 << 15) /* VDD voltage 2.7-2.8 */
#define MMCSD_VDD_28_29 (1 << 16) /* VDD voltage 2.8-2.9 */
#define MMCSD_VDD_29_30 (1 << 17) /* VDD voltage 2.9-3.0 */
#define MMCSD_VDD_30_31 (1 << 18) /* VDD voltage 3.0-3.1 */
#define MMCSD_VDD_31_32 (1 << 19) /* VDD voltage 3.1-3.2 */
#define MMCSD_VDD_32_33 (1 << 20) /* VDD voltage 3.2-3.3 */
#define MMCSD_VDD_33_34 (1 << 21) /* VDD voltage 3.3-3.4 */
#define MMCSD_VDD_34_35 (1 << 22) /* VDD voltage 3.4-3.5 */
#define MMCSD_VDD_35_36 (1 << 23) /* VDD voltage 3.5-3.6 */
#define MMCSD_R3_HIGHCAPACITY (1 << 30) /* true: Card supports block addressing */
#define MMCSD_CARD_BUSY (1 << 31) /* Card power-up busy bit */
#define MMCSD_VDD_145_150 ((uint32_t)1 << 0) /* VDD voltage 1.45 - 1.50 */
#define MMCSD_VDD_150_155 ((uint32_t)1 << 1) /* VDD voltage 1.50 - 1.55 */
#define MMCSD_VDD_155_160 ((uint32_t)1 << 2) /* VDD voltage 1.55 - 1.60 */
#define MMCSD_VDD_160_165 ((uint32_t)1 << 3) /* VDD voltage 1.60 - 1.65 */
#define MMCSD_VDD_165_170 ((uint32_t)1 << 4) /* VDD voltage 1.65 - 1.70 */
#define MMCSD_VDD_17_18 ((uint32_t)1 << 5) /* VDD voltage 1.7 - 1.8 */
#define MMCSD_VDD_18_19 ((uint32_t)1 << 6) /* VDD voltage 1.8 - 1.9 */
#define MMCSD_VDD_19_20 ((uint32_t)1 << 7) /* VDD voltage 1.9 - 2.0 */
#define MMCSD_VDD_20_21 ((uint32_t)1 << 8) /* VDD voltage 2.0-2.1 */
#define MMCSD_VDD_21_22 ((uint32_t)1 << 9) /* VDD voltage 2.1-2.2 */
#define MMCSD_VDD_22_23 ((uint32_t)1 << 10) /* VDD voltage 2.2-2.3 */
#define MMCSD_VDD_23_24 ((uint32_t)1 << 11) /* VDD voltage 2.3-2.4 */
#define MMCSD_VDD_24_25 ((uint32_t)1 << 12) /* VDD voltage 2.4-2.5 */
#define MMCSD_VDD_25_26 ((uint32_t)1 << 13) /* VDD voltage 2.5-2.6 */
#define MMCSD_VDD_26_27 ((uint32_t)1 << 14) /* VDD voltage 2.6-2.7 */
#define MMCSD_VDD_27_28 ((uint32_t)1 << 15) /* VDD voltage 2.7-2.8 */
#define MMCSD_VDD_28_29 ((uint32_t)1 << 16) /* VDD voltage 2.8-2.9 */
#define MMCSD_VDD_29_30 ((uint32_t)1 << 17) /* VDD voltage 2.9-3.0 */
#define MMCSD_VDD_30_31 ((uint32_t)1 << 18) /* VDD voltage 3.0-3.1 */
#define MMCSD_VDD_31_32 ((uint32_t)1 << 19) /* VDD voltage 3.1-3.2 */
#define MMCSD_VDD_32_33 ((uint32_t)1 << 20) /* VDD voltage 3.2-3.3 */
#define MMCSD_VDD_33_34 ((uint32_t)1 << 21) /* VDD voltage 3.3-3.4 */
#define MMCSD_VDD_34_35 ((uint32_t)1 << 22) /* VDD voltage 3.4-3.5 */
#define MMCSD_VDD_35_36 ((uint32_t)1 << 23) /* VDD voltage 3.5-3.6 */
#define MMCSD_R3_HIGHCAPACITY ((uint32_t)1 << 30) /* true: Card supports block addressing */
#define MMCSD_CARD_BUSY ((uint32_t)1 << 31) /* Card power-up busy bit */
/* R6 Card Status bit definitions */
#define MMCSD_R6_RCA_SHIFT (16) /* New published RCA */
#define MMCSD_R6_RCA_MASK (0xffff << MMCSD_R6_RCA_SHIFT)
#define MMCSD_R6_COMCRCERROR (1 << 15) /* CRC error */
#define MMCSD_R6_ILLEGALCOMMAND (1 << 14) /* Bad command */
#define MMCSD_R6_ERROR (1 << 13) /* General error */
#define MMCSD_R6_STATE_SHIFT (9) /* Current card state */
#define MMCSD_R6_STATE_MASK (15 << MMCSD_R6_STATE_SHIFT)
/* Card identification mode states */
# define MMCSD_R6_STATE_IDLE (0 << MMCSD_R6_STATE_SHIFT) /* 0=Idle state */
# define MMCSD_R6_STATE_READY (1 << MMCSD_R6_STATE_SHIFT) /* 1=Ready state */
# define MMCSD_R6_STATE_IDENT (2 << MMCSD_R6_STATE_SHIFT) /* 2=Identification state */
/* Data transfer states */
# define MMCSD_R6_STATE_STBY (3 << MMCSD_R6_STATE_SHIFT) /* 3=Standby state */
# define MMCSD_R6_STATE_TRAN (4 << MMCSD_R6_STATE_SHIFT) /* 4=Transfer state */
# define MMCSD_R6_STATE_DATA (5 << MMCSD_R6_STATE_SHIFT) /* 5=Sending data state */
# define MMCSD_R6_STATE_RCV (6 << MMCSD_R6_STATE_SHIFT) /* 6=Receiving data state */
# define MMCSD_R6_STATE_PRG (7 << MMCSD_R6_STATE_SHIFT) /* 7=Programming state */
# define MMCSD_R6_STATE_DIS (8 << MMCSD_R6_STATE_SHIFT) /* 8=Disconnect state */
#define MMCSD_R6_ERRORMASK 0x0000e000 /* Error mask */
#define MMCSD_R6_RCA_SHIFT (16) /* New published RCA */
#define MMCSD_R6_RCA_MASK ((uint32_t)0xffff << MMCSD_R6_RCA_SHIFT)
#define MMCSD_R6_COMCRCERROR ((uint32_t)1 << 15) /* CRC error */
#define MMCSD_R6_ILLEGALCOMMAND ((uint32_t)1 << 14) /* Bad command */
#define MMCSD_R6_ERROR ((uint32_t)1 << 13) /* General error */
#define MMCSD_R6_STATE_SHIFT (9) /* Current card state */
#define MMCSD_R6_STATE_MASK ((uint32_t)15 << MMCSD_R6_STATE_SHIFT)
/* Card identification mode states */
# define MMCSD_R6_STATE_IDLE ((uint32_t)0 << MMCSD_R6_STATE_SHIFT) /* 0=Idle state */
# define MMCSD_R6_STATE_READY ((uint32_t)1 << MMCSD_R6_STATE_SHIFT) /* 1=Ready state */
# define MMCSD_R6_STATE_IDENT ((uint32_t)2 << MMCSD_R6_STATE_SHIFT) /* 2=Identification state */
/* Data transfer states */
# define MMCSD_R6_STATE_STBY ((uint32_t)3 << MMCSD_R6_STATE_SHIFT) /* 3=Standby state */
# define MMCSD_R6_STATE_TRAN ((uint32_t)4 << MMCSD_R6_STATE_SHIFT) /* 4=Transfer state */
# define MMCSD_R6_STATE_DATA (5(uint32_t) << MMCSD_R6_STATE_SHIFT) /* 5=Sending data state */
# define MMCSD_R6_STATE_RCV ((uint32_t)6 << MMCSD_R6_STATE_SHIFT) /* 6=Receiving data state */
# define MMCSD_R6_STATE_PRG ((uint32_t)7 << MMCSD_R6_STATE_SHIFT) /* 7=Programming state */
# define MMCSD_R6_STATE_DIS ((uint32_t) << MMCSD_R6_STATE_SHIFT) /* 8=Disconnect state */
#define MMCSD_R6_ERRORMASK ((uint32_t)0x0000e00) /* Error mask */
/* SD Configuration Register (SCR) encoding */
@ -179,14 +180,14 @@
/* Last 4 bytes of the 48-bit R7 response */
#define MMCSD_R7VERSION_SHIFT 28 /* Bits 28-31: Command version number */
#define MMCSD_R7VERSION_MASK (0x0f << MMCSD_R7VERSION_SHIFT)
#define MMCSD_R7VOLTAGE_SHIFT 8 /* Bits 8-11: Voltage accepted */
#define MMCSD_R7VOLTAGE_MASK (0x0f << MMCSD_R7VOLTAGE_SHIFT)
# define MMCSD_R7VOLTAGE_27 (0x01 << MMCSD_R7VOLTAGE_SHIFT) /* 2.7-3.6V */
#define MMCSD_R7ECHO_SHIFT 0 /* Bits 0-7: Echoed check pattern */
#define MMCSD_R7ECHO_MASK (0xff << MMCSD_R7ECHO_SHIFT)
# define MMCSD_R7CHECKPATTERN (0xaa << MMCSD_R7ECHO_SHIFT)
#define MMCSD_R7VERSION_SHIFT (28) /* Bits 28-31: Command version number */
#define MMCSD_R7VERSION_MASK ((uint32_t)0x0f << MMCSD_R7VERSION_SHIFT)
#define MMCSD_R7VOLTAGE_SHIFT (8) /* Bits 8-11: Voltage accepted */
#define MMCSD_R7VOLTAGE_MASK ((uint32_t)0x0f << MMCSD_R7VOLTAGE_SHIFT)
# define MMCSD_R7VOLTAGE_27 ((uint32_t)0x01 << MMCSD_R7VOLTAGE_SHIFT) /* 2.7-3.6V */
#define MMCSD_R7ECHO_SHIFT (0) /* Bits 0-7: Echoed check pattern */
#define MMCSD_R7ECHO_MASK ((uint32_t)0xff << MMCSD_R7ECHO_SHIFT)
# define MMCSD_R7CHECKPATTERN ((uint32_t)0xaa << MMCSD_R7ECHO_SHIFT)
/********************************************************************************************
* Public Types
@ -211,8 +212,8 @@ struct mmcsd_cid_s
struct mmcsd_csd_s
{
uint8_t csdstructure; /* 127:126 CSD structure */
uint8_t mmcspecvers; /* 125:122 MMC Spec version (MMC only) */
uint8_t csdstructure; /* 127:126 CSD structure */
uint8_t mmcspecvers; /* 125:122 MMC Spec version (MMC only) */
struct
{

View file

@ -1570,7 +1570,7 @@ static int mmcsd_mediainitialize(FAR struct mmcsd_slot_s *slot)
result = mmcsd_sendcmd(slot, &g_cmd55, 0);
if (result == MMCSD_SPIR1_IDLESTATE || result == MMCSD_SPIR1_OK)
{
result = mmcsd_sendcmd(slot, &g_acmd41, 1 << 30);
result = mmcsd_sendcmd(slot, &g_acmd41, (uint32_t)1 << 30);
if (result == MMCSD_SPIR1_OK)
{
break;

View file

@ -121,13 +121,13 @@
/* Last 4 bytes of the 5 byte R7 response */
#define MMCSD_SPIR7_VERSION_SHIFT 28 /* Bits 28-31: Command version number */
#define MMCSD_SPIR7_VERSION_MASK (0x0f << MMCSD_SPIR7_VERSION_SHIFT)
#define MMCSD_SPIR7_VOLTAGE_SHIFT 8 /* Bits 8-11: Voltage accepted */
#define MMCSD_SPIR7_VOLTAGE_MASK (0x0f << MMCSD_SPIR7_VOLTAGE_SHIFT)
#define MMCSD_SPIR7_VOLTAGE_27 (0x01 << MMCSD_SPIR7_VOLTAGE_SHIFT) /* 2.7-3.6V */
#define MMCSD_SPIR7_ECHO_SHIFT 0 /* Bits 0-7: Echoed check pattern */
#define MMCSD_SPIR7_ECHO_MASK (0xff << MMCSD_SPIR7_ECHO_SHIFT)
#define MMCSD_SPIR7_VERSION_SHIFT (28) /* Bits 28-31: Command version number */
#define MMCSD_SPIR7_VERSION_MASK ((uint32_t)0x0f << MMCSD_SPIR7_VERSION_SHIFT)
#define MMCSD_SPIR7_VOLTAGE_SHIFT (8) /* Bits 8-11: Voltage accepted */
#define MMCSD_SPIR7_VOLTAGE_MASK ((uint32_t)0x0f << MMCSD_SPIR7_VOLTAGE_SHIFT)
#define MMCSD_SPIR7_VOLTAGE_27 ((uint32_t)0x01 << MMCSD_SPIR7_VOLTAGE_SHIFT) /* 2.7-3.6V */
#define MMCSD_SPIR7_ECHO_SHIFT (0) /* Bits 0-7: Echoed check pattern */
#define MMCSD_SPIR7_ECHO_MASK ((uint32_t)0xff << MMCSD_SPIR7_ECHO_SHIFT)
/* Data Response */
@ -152,17 +152,17 @@
/* Operating Conditions register */
#define MMCSD_OCR_V27 (1 << 15) /* Bit 15: 2.7-2.8V */
#define MMCSD_OCR_V28 (1 << 16) /* Bit 16: 2.8-2.9V */
#define MMCSD_OCR_V29 (1 << 17) /* Bit 17: 2.9-3.0V */
#define MMCSD_OCR_V30 (1 << 18) /* Bit 18: 3.0-3.1V */
#define MMCSD_OCR_V31 (1 << 19) /* Bit 19: 3.1-3.2V */
#define MMCSD_OCR_V32 (1 << 20) /* Bit 20: 3.2-3.3V */
#define MMCSD_OCR_V33 (1 << 21) /* Bit 21: 3.3-3.4V */
#define MMCSD_OCR_V34 (1 << 22) /* Bit 22: 3.4-3.5V */
#define MMCSD_OCR_V35 (1 << 23) /* Bit 23: 3.5-3.6V */
#define MMCSD_OCR_CCS (1 << 30) /* Bit 30: Card capacity status */
#define MMCSD_OCR_BUSY (1 << 31) /* Bit 31: Card powered up status bit */
#define MMCSD_OCR_V27 ((uint32_t)1 << 15) /* Bit 15: 2.7-2.8V */
#define MMCSD_OCR_V28 ((uint32_t)1 << 16) /* Bit 16: 2.8-2.9V */
#define MMCSD_OCR_V29 ((uint32_t)1 << 17) /* Bit 17: 2.9-3.0V */
#define MMCSD_OCR_V30 ((uint32_t)1 << 18) /* Bit 18: 3.0-3.1V */
#define MMCSD_OCR_V31 ((uint32_t)1 << 19) /* Bit 19: 3.1-3.2V */
#define MMCSD_OCR_V32 ((uint32_t)1 << 20) /* Bit 20: 3.2-3.3V */
#define MMCSD_OCR_V33 ((uint32_t)1 << 21) /* Bit 21: 3.3-3.4V */
#define MMCSD_OCR_V34 ((uint32_t)1 << 22) /* Bit 22: 3.4-3.5V */
#define MMCSD_OCR_V35 ((uint32_t)1 << 23) /* Bit 23: 3.5-3.6V */
#define MMCSD_OCR_CCS ((uint32_t)1 << 30) /* Bit 30: Card capacity status */
#define MMCSD_OCR_BUSY ((uint32_t)1 << 31) /* Bit 31: Card powered up status bit */
/****************************************************************************
* Public Types