?? mmc.h
字號:
/*
* Copyright (c) 2003-2004 K. John '2B|!2B' Crispin
* Copyright (c) 2005 Stephan Dobretsberger
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA02111-1307USA
*
* Feedback, Bugs, ... mail stephan.dobretsberger@gmx.at
*
*/
//#define MMC_WRITE in the following file
#include "config.h"
#include <avr/io.h>
#include <avr/signal.h>
#include <avr/interrupt.h>
// look in datasheet for complete list of commands
#define MMC_CMD_0_GO_IDLE 0
#define MMC_CMD_1_SEND_OP_COND 1
#define MMC_CMD_9_SEND_CSD 9
#define MMC_CMD_10_SEND_CID 10
#define MMC_CMD_12_STOP 12
#define MMC_CMD_13_SEND_STATUS 13
#define MMC_CMD_16_BLOCKLEN 16
#define MMC_CMD_17_READ_SINGLE 17
#define MMC_CMD_18_READ_MULTIPLE 18
#define MMC_CMD_24_WRITE_SINGLE 24
// bit definitions for R1
#define MMC_R1_IN_IDLE 0x01
#define MMC_R1B_BUSY_BYTE 0x00
// different defines for tokens etc ...
#define MMC_START_TOKEN_SINGLE 0xfe
#define MMC_START_TOKEN_MULTI 0xfc
// return values from a write operation
#define MMC_DATA_ACCEPT 0x02
#define MMC_DATA_CRC 0x05
#define MMC_DATA_WRITE_ERROR 0x06
// errors for fat32
#define FAT_INVALID_ID 0x00
#define FAT_OK 0x01
// this structure holds info on the MMC card currently inserted
typedef struct _VOLUME_INFO
{ u08 size_MB;
u08 sector_multiply;
u16 sector_count;
u08 name[6];
} VOLUME_INFO;
// starts the hardware
void MMC_hw_init(void);
// starts up the MMC card
void MMC_init(void);
// starts the read process of a sector
void MMC_get_sec_start(u16 sectorh, u16 sectorl);
// starts the read process of a part of a sector
void MMC_get_part_sec_start(u16 sectorh, u16 sectorl, u16 offset, u16 length);
// gets the next byte from the MMC card
u08 MMC_get_sec_next(void);
// stop read process of a sector
void MMC_get_sec_stop(void);
// deselcets the MMC
void MMC_CS_deselect(void);
//selects the MMC for transmission
void MMC_CS_select(void);
// allows sending data to the MMC
void MMC_enable(void);
// disables sending data to the MMC
void MMC_disable(void);
// sends receives a byte on the spi bus
u08 MMC_io(u08 data);
void MMC_cleanup(void);
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -