E:/Projects/AvrLib/FatFS/Xmmc.c File Reference

#include <avr/io.h>
#include <avr/interrupt.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include "global.h"
#include "Xspi.h"
#include "task.h"
#include "MessageQueue.h"
#include "curses.h"
#include "io.h"
#include "cio.h"
#include "utils.h"
#include "Xmmc.h"
#include "ff.h"
#include "mmcconf.h"

Include dependency graph for Xmmc.c:

Go to the source code of this file.

Functions

void MMCTask (void *arg) __attribute__((noreturn))
void mmcInit (void)
int mmcResponse (unsigned char response)
u08 mmcReset (void)
unsigned short mmcSendStatus (void)
u08 mmcSendCommand (u08 cmd, u32 arg)
u08 mmcRead (u32 sector, u08 *buffer)
u08 mmcWrite (u32 sector, u08 *buffer)
u08 mmcCommand (u08 cmd, u32 arg, char *b)
void SecDump (int fd, char *b)
void MsgMMCReset (void)
void MsgMMCReadSector (unsigned long sector)
void MsgMMCWriteSector (unsigned long sector, char *b, int n)
void MsgMMCSendStatus (void)
void MsgMMCWriteTestFile (void)

Variables

MESSAGE_QUEUESDcardMSG
TCB Tmmc
static WINDOWmmcW


Function Documentation

u08 mmcCommand ( u08  cmd,
u32  arg,
char *  b 
)

Internal command function. Issues a generic MMC command as specified by cmd and arg.

Definition at line 305 of file Xmmc.c.

References XspiTransfer(), and XspiTransferByte().

Referenced by mmcRead(), mmcSendCommand(), mmcSendStatus(), and mmcWrite().

void mmcInit ( void   ) 

Initialize AVR<->MMC hardware interface. Prepares hardware for MMC access.

Definition at line 53 of file Xmmc.c.

References ActiveTasks, CreateTask(), Insert(), MMCTask(), MqInit(), and XSPI_CLR_CE.

u08 mmcRead ( u32  sector,
u08 buffer 
)

Read 512-byte sector from card to buffer Returns zero if successful.

Definition at line 219 of file Xmmc.c.

References free, malloc, MMC_READ_SINGLE_BLOCK, MMC_STARTBLOCK_READ, mmcCommand(), wprintw(), XSPI_CLR_CE, XSPI_SET_CE, XspiTransfer(), and XspiTransferByte().

Referenced by disk_read(), and MMCTask().

u08 mmcReset ( void   ) 

Initialize the card and prepare it for use. Returns zero if successful.

Definition at line 82 of file Xmmc.c.

References free, malloc, MMC_APP_CMD, MMC_GO_IDLE_STATE, MMC_SEND_OP_COND_A, MMC_SET_BLOCKLEN, mmcResponse(), TimeDelay(), wprintw(), XSPI_CLR_CE, XSPI_SET_CE, XspiTransfer(), and XspiTransferByte().

Referenced by disk_initialize(), and MMCTask().

int mmcResponse ( unsigned char  response  ) 

Definition at line 63 of file Xmmc.c.

References XspiTransferByte().

Referenced by mmcReset().

u08 mmcSendCommand ( u08  cmd,
u32  arg 
)

Send card an MMC command. Returns R1 result code.

Definition at line 205 of file Xmmc.c.

References free, malloc, mmcCommand(), XSPI_CLR_CE, and XSPI_SET_CE.

unsigned short mmcSendStatus ( void   ) 

Definition at line 187 of file Xmmc.c.

References free, malloc, MMC_SEND_STATUS, mmcCommand(), XSPI_CLR_CE, XSPI_SET_CE, and XspiTransferByte().

Referenced by disk_status(), and MMCTask().

void MMCTask ( void *  arg  ) 

u08 mmcWrite ( u32  sector,
u08 buffer 
)

Write 512-byte sector from buffer to card Returns zero if successful.

Definition at line 263 of file Xmmc.c.

References free, malloc, MMC_DR_ACCEPT, MMC_DR_MASK, MMC_STARTBLOCK_WRITE, MMC_WRITE_BLOCK, mmcCommand(), wprintw(), XSPI_CLR_CE, XSPI_SET_CE, XspiTransfer(), and XspiTransferByte().

Referenced by disk_write(), and MMCTask().

void MsgMMCReadSector ( unsigned long  sector  ) 

Definition at line 459 of file Xmmc.c.

References MMC_CMD_RDSECTOR, MqPut(), _msg::MsgCmd, NewMSG(), and _msg::Payload.

void MsgMMCReset ( void   ) 

Definition at line 450 of file Xmmc.c.

References MMC_CMD_RESET, MqPut(), _msg::MsgCmd, and NewMSG().

void MsgMMCSendStatus ( void   ) 

Definition at line 487 of file Xmmc.c.

References MMC_CMD_STATUS, MqPut(), _msg::MsgCmd, and NewMSG().

void MsgMMCWriteSector ( unsigned long  sector,
char *  b,
int  n 
)

Definition at line 471 of file Xmmc.c.

References memcpy(), MMC_CMD_WDSECTOR, MqPut(), _msg::MsgCmd, NewMSG(), and _msg::Payload.

void MsgMMCWriteTestFile ( void   ) 

Definition at line 496 of file Xmmc.c.

References MMC_CMD_WRITE_FILE, MqPut(), _msg::MsgCmd, and NewMSG().

void SecDump ( int  fd,
char *  b 
)

Definition at line 332 of file Xmmc.c.

References _write(), CharToHex(), free, isprint(), malloc, and UnsignedToHex().

Referenced by MMCTask().


Variable Documentation

WINDOW* mmcW [static]

Definition at line 49 of file Xmmc.c.

Definition at line 47 of file Xmmc.c.

Definition at line 48 of file Xmmc.c.


Generated on Sun Aug 31 13:30:10 2008 for FrankenRTOS by  doxygen 1.5.6