##// END OF EJS Templates
Added ARM CMSIS for fast math and circle drawing function for ili9328 driver.
Added ARM CMSIS for fast math and circle drawing function for ili9328 driver.

File last commit:

r18:bd9ab647f70a default
r41:27c5438a4566 dev_alexis
Show More
sdcard.h
118 lines | 3.8 KiB | text/x-c | CLexer
jeandet@pc-de-jeandet3.LAB-LPP.LOCAL
Now uses qmake to compile an Qt-creator compatible!
r18 /*------------------------------------------------------------------------------
-- This file is a part of the libuc, microcontroler library
-- Copyright (C) 2012, Alexis Jeandet
--
-- 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 3 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, MA 02111-1307 USA
-------------------------------------------------------------------------------
-- Author : Alexis Jeandet
-- Mail : alexis.jeandet@gmail.com
-------------------------------------------------------------------------------*/
#ifndef SDCARD_H
#define SDCARD_H
#include "blkdevice.h"
#include <libucstrings.h>
#include <uhandle.h>
/* MMC/SD command */
#define CMD0 (0) /* GO_IDLE_STATE */
#define CMD1 (1) /* SEND_OP_COND (MMC) */
#define ACMD41 (0x80+41) /* SEND_OP_COND (SDC) */
#define CMD8 (8) /* SEND_IF_COND */
#define CMD9 (9) /* SEND_CSD */
#define CMD10 (10) /* SEND_CID */
#define CMD12 (12) /* STOP_TRANSMISSION */
#define ACMD13 (0x80+13) /* SD_STATUS (SDC) */
#define CMD16 (16) /* SET_BLOCKLEN */
#define CMD17 (17) /* READ_SINGLE_BLOCK */
#define CMD18 (18) /* READ_MULTIPLE_BLOCK */
#define CMD23 (23) /* SET_BLOCK_COUNT (MMC) */
#define ACMD23 (0x80+23) /* SET_WR_BLK_ERASE_COUNT (SDC) */
#define CMD24 (24) /* WRITE_BLOCK */
#define CMD25 (25) /* WRITE_MULTIPLE_BLOCK */
#define CMD32 (32) /* ERASE_ER_BLK_START */
#define CMD33 (33) /* ERASE_ER_BLK_END */
#define CMD38 (38) /* ERASE */
#define CMD55 (55) /* APP_CMD */
#define CMD58 (58) /* READ_OCR */
/* Card type flags (CardType) */
#define CT_MMC 0x01 /* MMC ver 3 */
#define CT_SD1 0x02 /* SD ver 1 */
#define CT_SD2 0x04 /* SD ver 2 */
#define CT_SDC (CT_SD1|CT_SD2) /* SD */
#define CT_BLOCK 0x08 /* Block addressing */
struct sdcard_str
{
UHANDLE phy;
void (*rcvr_mmc) (UHANDLE phy,char *buff,uint32_t bc);
void (*xmit_mmc) (UHANDLE phy,const char *buff,uint32_t bc);
void (*setspeed) (UHANDLE phy,uint32_t speed);
uint32_t (*getspeed) (UHANDLE phy);
DSTATUS Stat;
char CardType;
};
typedef volatile struct sdcard_str sdcardDev;
extern void sdcardmake(sdcardDev* sdcard,UHANDLE phy,void (*rcvr_mmc) (UHANDLE,char *,uint32_t ),void (*xmit_mmc) (UHANDLE,const char *,uint32_t ),void (*setspeed) (UHANDLE phy,uint32_t speed),uint32_t (*getspeed) (UHANDLE phy));
extern void sdcardmakeblkdev(blkdevice* dev,sdcardDev* sdcard, blkdevselect_t select,blkdevpower_t power,blkdevdetect_t detect,blkdevwriteprotected_t writeprotected);
extern int sdcardselect (blkdeviceptr _this);
extern void sdcarddeselect (blkdeviceptr _this);
extern int sdcardwait_ready (sdcardDev* sdcard);
extern int sdcardxmit_datablock (sdcardDev* sdcard,const char *buff,char token);
extern int sdcardrcvr_datablock (sdcardDev* sdcard,char *buff,uint32_t btr);
extern char sdcardsend_cmd (blkdeviceptr _this,char cmd,uint32_t arg);
extern DSTATUS sdcarddisk_status (blkdeviceptr _this);
extern DSTATUS sdcarddisk_initialize (blkdeviceptr _this);
extern DRESULT sdcarddisk_read (blkdeviceptr _this,char *buff,uint32_t sector,char count);
extern DRESULT sdcarddisk_write (blkdeviceptr _this,const char *buff,uint32_t sector,char count);
extern DRESULT sdcarddisk_ioctl (blkdeviceptr _this,char ctrl,void *buff);
#endif