?? sdconfig.h
字號:
/****************************************Copyright (c)**************************************************
** Guangzhou ZLG-MCU Development Co.,LTD.
** graduate school
** http://www.zlgmcu.com
**
**--------------File Info-------------------------------------------------------------------------------
** File name: sdconfig.h
** Last modified Date: 2005-3-11
** Last Version: V2.0
** Descriptions: SD/MMC 卡讀寫模塊: 配置文件
** Soft Packet of SD/MMC Card: configuration header file
**
**------------------------------------------------------------------------------------------------------
** Created by: Ming Yuan Zheng
** Created date: 2005-1-6
** Version: V1.0
** Descriptions: 初始版本 The original version
**
**------------------------------------------------------------------------------------------------------
** Modified by: Ming Yuan Zheng
** Modified date: 2005-3-11
** Version: V2.0
** Descriptions: 增加了LPC22xx的硬件配置
** add LPC22xx hardware configuration
**------------------------------------------------------------------------------------------------------
** Modified by:
** Modified date:
** Version:
** Descriptions:
**
********************************************************************************************************/
#ifndef __SDCONFIG_H__
#define __SDCONFIG_H__
#define SD_UCOSII_EN 0 /* 是否在UCOS-II上運行本模塊 */
#define SD_CRC_EN 1 /* 設置數據傳輸時是否使用CRC */
#define SPI_CLOCK 5529600 /* 正常通信時,SPI時鐘頻率 frequency (Hz) */
#define SD_BLOCKSIZE 512 /* SD卡塊的長度 */
#define SD_BLOCKSIZE_NBITS 9
/* 下面函數不常用,如果用戶不需要,可置為 0 裁剪指定函數 */
#define SD_ReadMultiBlock_EN 0 /* 是否使能讀多塊函數 */
#define SD_WriteMultiBlock_EN 0 /* 是否使能寫多塊函數 */
#define SD_EraseBlock_EN 1 /* 是否使能擦卡函數 */
#define SD_ProgramCSD_EN 0 /* 是否使能寫CSD寄存器函數 */
#define SD_ReadCID_EN 0 /* 是否使能讀CID寄存器函數 */
#define SD_ReadSD_Status_EN 0 /* 是否使能讀SD_Status寄存器函數 */
#define SD_ReadSCR_EN 0 /* 是否使能讀SCR寄存器函數 */
/* LPC22xx_EN 硬件配置 */
/* CS 引腳 */
#define SD_CS (0x01 << 18)
#define SD_CS_GPIO() PINSEL1 &= ~(0x03 << 4)
#define SD_CS_OUT() IO0DIR |= SD_CS
#define SD_CS_HIGH() IO0SET |= SD_CS
#define SD_CS_LOW() IO0CLR |= SD_CS
/* 電源控制引腳 */
#define SD_POWER (0x01 << 17)
#define SD_POWER_GPIO() PINSEL1 &= ~(0x03 << 2) /* 設置 POWER 口為GPIO口 */
#define SD_POWER_OUT() IO0DIR |= SD_POWER /* 設置 POWER 口為輸出口 */
#define SD_POWER_OFF() IO0SET = SD_POWER /* 置 POWER 為高電平 */
#define SD_POWER_ON() IO0CLR = SD_POWER /* 置 POWER 為低電平 */
/* 卡完全插入卡座檢測引腳 */
#define SD_INSERT (0x01 << 19)
#define SD_INSERT_GPIO() PINSEL1 &= ~(0x03 << 6) /* 設置 INSERT 口為GPIO口 */
#define SD_INSERT_IN() IO0DIR &= ~SD_INSERT /* 設置 INSERT 口為輸出口 */
#define SD_INSERT_STATUS() (IO0PIN & SD_INSERT) /* 讀取 INSERT 口的狀態 */
// Change P0.20 to check WP -------JOSEPH 2006.11.08
/* 卡寫保護檢測引腳 */
#define SD_WP (0x01 << 20) // 29
#define SD_WP_GPIO() PINSEL1 &= ~(0x03 << 8) // 26 /* 設置 WP 口為GPIO口 */
#define SD_WP_IN() IO0DIR &= ~SD_WP /* 設置 WP 口為輸出口 */
#define SD_WP_STATUS() (IO0PIN & SD_WP) /* 讀取 WP 口的狀態 */
#endif
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -