Nut/OS  4.10.3
API Reference
Low Level MMC Interface

Bit banging SPI for MMC. More...

Collaboration diagram for Low Level MMC Interface:

Data Structures

struct  _MMCDCB
 Private data of NPL card interface. More...

Defines

#define SPI0_CS_BIT   6
 Port bit for SPI chip select.
#define SPI0_CLK_BIT   4
 Port bit for SPI clock.
#define SPI0_MOSI_BIT   5
 Port bit for SPI MOSI line.
#define SPI0_MISO_BIT   3
 Port bit for SPI MISO line.
#define MMC0_CLR_BIT(n)   outr(SPI0_SOD_REG, inr(SPI0_SOD_REG) & ~_BV(n))
#define MMC0_SET_BIT(n)   outr(SPI0_SOD_REG, inr(SPI0_SOD_REG) | _BV(n))
#define MMC0_IS_BIT_SET(n)   ((inr(SPI0_SOD_REG) & _BV(n)) == _BV(n))
#define MMC0_TST_BIT(n)   ((inr(SPI0_PDS_REG) & _BV(n)) == _BV(n))
 Query status of a specified MMC input.

Typedefs

typedef struct _MMCDCB MMCDCB
 Private data of NPL card interface.

Functions

int SbiMmCard0Avail (void)
 Check if card is available in slot 0.
int SbiMmCard0WrProt (void)
 Check if card in slot 0 is write protected.

Variables

NUTDEVICE devSbiMmc0
 Multimedia card device information structure.

Detailed Description

Bit banging SPI for MMC.

Low Level Multimedia Card Access.

Low level MMC hardware routines for SPI emulation by software (bit banging).

These routines support SPI mode only and are required by the basic MMC driver.

 *
 * $Log$
 * Revision 1.7  2008/08/11 06:59:42  haraldkipp
 * BSD types replaced by stdint types (feature request #1282721).
 *
 * Revision 1.6  2006/06/28 17:22:34  haraldkipp
 * Make it compile for AT91SAM7X256.
 *
 * Revision 1.5  2006/04/07 12:48:41  haraldkipp
 * Port configuration is now honored.
 *
 * Revision 1.4  2006/03/16 19:07:36  haraldkipp
 * Disabled inline assembly routine for ARM bit banging SPI. Stopped working
 * with optimizing compiler.
 *
 * Revision 1.3  2006/03/02 19:58:16  haraldkipp
 * Too lazy to port the inline assembly to ICCARM.
 *
 * Revision 1.2  2006/02/28 02:16:12  hwmaier
 * Added macro definition MCU_AT90CAN128
 *
 * Revision 1.1  2006/02/23 15:38:03  haraldkipp
 * MMC low level bit banging SPI added. Compiles on all supported platforms,
 * but tested with AT91 only.
 *
 *
 * 

Define Documentation

#define SPI0_CS_BIT   6

Port bit for SPI chip select.

Definition at line 93 of file sbimmc.c.

#define SPI0_CLK_BIT   4

Port bit for SPI clock.

Definition at line 98 of file sbimmc.c.

#define SPI0_MOSI_BIT   5

Port bit for SPI MOSI line.

Definition at line 103 of file sbimmc.c.

#define SPI0_MISO_BIT   3

Port bit for SPI MISO line.

Definition at line 108 of file sbimmc.c.

#define MMC0_CLR_BIT (   n)    outr(SPI0_SOD_REG, inr(SPI0_SOD_REG) & ~_BV(n))

Definition at line 245 of file sbimmc.c.

#define MMC0_SET_BIT (   n)    outr(SPI0_SOD_REG, inr(SPI0_SOD_REG) | _BV(n))

Definition at line 246 of file sbimmc.c.

#define MMC0_IS_BIT_SET (   n)    ((inr(SPI0_SOD_REG) & _BV(n)) == _BV(n))

Definition at line 253 of file sbimmc.c.

#define MMC0_TST_BIT (   n)    ((inr(SPI0_PDS_REG) & _BV(n)) == _BV(n))

Query status of a specified MMC input.

Definition at line 257 of file sbimmc.c.


Typedef Documentation

typedef struct _MMCDCB MMCDCB

Private data of NPL card interface.


Function Documentation

int SbiMmCard0Avail ( void  )

Check if card is available in slot 0.

Todo:
Card change should verify the card identifier. Right now any detection of removing and re-inserting a card counts as a card change.
Returns:
0 if no card is detected, 1 if a card is available or 2 if a card change had been detected after the last mount.

Definition at line 392 of file sbimmc.c.

References _MMCDCB::dcb_avail, and _MMCDCB::dcb_changed.

int SbiMmCard0WrProt ( void  )

Check if card in slot 0 is write protected.

Todo:
Not implemented.
Returns:
Always 0.

Definition at line 410 of file sbimmc.c.


Variable Documentation

Initial value:
 {
    0,                          
    {'M', 'M', 'C', '0', 0, 0, 0, 0, 0}
    ,                           
    0,                          
    0,                          
    0,                          
    &mmc0_ifc,                  
    &mmc0_dcb,                  
    SbiMmcIfcInit,              
    MmCardIOCtl,                
    MmCardBlockRead,            
    MmCardBlockWrite,           

    MmCardBlockWrite_P,         

    MmCardMount,                
    MmCardUnmount,              
    0                           
}

Multimedia card device information structure.

A pointer to this structure must be passed to NutRegisterDevice() to bind this driver to the Nut/OS kernel. An application may then call /verbatim _open("MMC0:", _O_RDWR | _O_BINARY); /endverbatim to mount the first active primary partition with any previously registered file system driver (typically devPhat0).

Definition at line 513 of file sbimmc.c.