NetBurner 3.5.0
PDF Version
 
mmc_mcf.h
1/*NB_REVISION*/
2
3#ifndef _MMC_H_
4#define _MMC_H_
5
6/****************************************************************************
7 *
8 * Copyright (c) 2003 by HCC Embedded
9 *
10 * This software is copyrighted by and is the sole property of
11 * HCC. All rights, title, ownership, or other interests
12 * in the software remain the property of HCC. This
13 * software may only be used in accordance with the corresponding
14 * license agreement. Any unauthorized use, duplication, transmission,
15 * distribution, or disclosure of this software is expressly forbidden.
16 *
17 * This Copyright notice may not be removed or modified without prior
18 * written consent of HCC.
19 *
20 * HCC reserves the right to modify this software without notice.
21 *
22 * HCC Embedded
23 * Budapest 1132
24 * Victor Hugo Utca 11-15
25 * Hungary
26 *
27 * Tel: +36 (1) 450 1302
28 * Fax: +36 (1) 450 1303
29 * http: www.hcc-embedded.com
30 * email: [email protected]
31 *
32 ***************************************************************************/
33
34#include <effs_fat/common.h>
35#include <effs_fat/fat.h>
36#include <effs_fat/mmc_dsc.h>
37
38#ifdef __cplusplus
39extern "C"
40{
41#endif
42/*
43 SD/MMC shares the (Q)SPI with WLAN (wodule) at default installation
44 Uncommenting NB_ENABLE_USER_QSPI in predefs.h changes the driver
45 to the user (Q)SPI driver defined in qspi.h and does not then support
46 using the SD/MMC and wodule in the same system.
47
48 predef.h must precede this include file.
49
50*/
51#ifdef _PREDEF_H_
52#ifndef NB_ENABLE_USER_QSPI
53#define SD_SHARES_SPI (1)
54#endif /* #ifndef NB_ENABLE_USER_QSPI */
55#else /* #ifndef _PREDEF_H_ */
56#error predef.h must be included before mmc_mcf.h is included
57#endif /* #ifndef _PREDEF_H_ */
58
59 /* Uncomment SD_IRQ_SPI definition to enable interrupt driven SPI for the SD
60 Card access. This will have a small decrease in the read and write speeds but
61 will signifigantly lighten the load of the CPU while reading and writing to the SD Card.
62 Other tasks will function more smoothly durring file transfers with IRQs enabled here.
63 */
64 //#define SD_IRQ_SPI
65
66#define SDHC_ENABLE 1 /* enable SDHC support */
67#define USE_CRC 1 /* use CRC for communication */
68#define CRC_ROM_TABLE 1 /* put CRC table in ROM */
69 extern unsigned long MMC_CRC_Enable;
70
71 int spi_init(void); /* init SPI */
72 void spi_set_baudrate(unsigned long); /* set baudrate */
73 unsigned long spi_get_baudrate(void); /* get baudrate */
74 void spi_tx1(unsigned char); /* transmit 1 byte */
75 void spi_tx2(unsigned short); /* transmit 2 bytes */
76 void spi_tx4(unsigned long); /* transmit 4 bytes */
77 void spi_tx512(unsigned char *); /* transmit 512 bytes */
78 unsigned char spi_rx1(void); /* receive 1 byte */
79 void spi_rx512(unsigned char *); /* receive 512 bytes */
80 void spi_cs_lo(void); /* CS low */
81 void spi_cs_hi(void); /* CS high */
82
83 int get_cd(void); /* get Card Detect state */
84 int get_wp(void); /* get Write Protect state */
85
86 extern F_DRIVER *mmc_initfunc(unsigned long driver_param);
87
88#define MMC_ERR_NOTPLUGGED -1 /* for high level */
89
90#define F_MMC_DRIVE0 0
91#define F_MMC_DRIVE1 1
92#define F_MMC_DRIVE2 2
93#define F_MMC_DRIVE3 3
94
95 enum
96 {
97 MMC_NO_ERROR,
98 MMC_ERR_NOTINITIALIZED = 101,
99 MMC_ERR_INIT,
100 MMC_ERR_CMD,
101 MMC_ERR_STARTBIT,
102 MMC_ERR_BUSY,
103 MMC_ERR_CRC,
104 MMC_ERR_WRITE,
105 MMC_ERR_WRITEPROTECT,
106 MMC_ERR_NOTAVAILABLE
107 };
108
109#ifdef __cplusplus
110}
111#endif
112
113/******************************************************************************
114 *
115 * end of mmc.h
116 *
117 *****************************************************************************/
118
119#endif /* _MMC_H_ */