summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorJiaojinxing <jiaojinxing1987@gmail.com>2015-12-06 09:02:28 (GMT)
committer Jiaojinxing <jiaojinxing1987@gmail.com>2015-12-06 09:02:28 (GMT)
commit9fef93ab3a43d2afa66c2f5583ff97918efaed7c (patch)
tree421b9aca10a25282463b07fa3365656aff863b4c
parentfa6f496e8a10b4dd711376f3212e097e949c7dba (diff)
downloadbspam335x-9fef93ab3a43d2afa66c2f5583ff97918efaed7c.zip
bspam335x-9fef93ab3a43d2afa66c2f5583ff97918efaed7c.tar.gz
bspam335x-9fef93ab3a43d2afa66c2f5583ff97918efaed7c.tar.bz2
Fixed SDIO driver bug.
-rw-r--r--.cproject38
-rw-r--r--Makefile9
-rw-r--r--README.txt2
-rw-r--r--SylixOS/driver/sdi/am335x_sdi.c59
-rw-r--r--SylixOSBSP.ld4
-rw-r--r--config.mk17
6 files changed, 82 insertions, 47 deletions
diff --git a/.cproject b/.cproject
index 316b8ae..2465d87 100644
--- a/.cproject
+++ b/.cproject
@@ -1,11 +1,15 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
<storageModule moduleId="org.eclipse.cdt.core.settings">
- <cconfiguration id="com.sylixos.realcoder.toolChain.armsylixeabi.783133971">
- <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.sylixos.realcoder.toolChain.armsylixeabi.783133971" moduleId="org.eclipse.cdt.core.settings" name="Default">
+ <cconfiguration id="com.sylixos.realcoder.toolChain.armsylixeabi.21622006">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.sylixos.realcoder.toolChain.armsylixeabi.21622006" moduleId="org.eclipse.cdt.core.settings" name="Default">
<macros>
- <stringMacro name="SYLIXOS_TOOLCHAIN_PREFIX" type="VALUE_TEXT" value="arm-sylixos-eabi-"/>
- <stringMacro name="SYLIXOS_BASE_PATH" type="VALUE_PATH_DIR" value="D:\workspace\SylixOS_Base"/>
+ <stringMacro name="SYLIXOS_TOOLCHAIN_PATH" type="VALUE_PATH_DIR" value="D:\ACOINFO\arm-sylixos-toolchain"/>
+ <stringMacro name="SYLIXOS_TEMPLATE_ARCH" type="VALUE_TEXT" value="arm"/>
+ <stringMacro name="SYLIXOS_TOOLCHAIN_VER" type="VALUE_TEXT" value="4.9.3"/>
+ <stringMacro name="SYLIXOS_TOOLCHAIN_PREFIX" type="VALUE_TEXT" value="arm-sylixos-eabi"/>
+ <stringMacro name="SYLIXOS_BASE_PATH" type="VALUE_PATH_DIR" value="D:/workspace/sylixos-base"/>
+ <stringMacro name="SYLIXOS_TEMPLATE_NAME" type="VALUE_TEXT" value="arm-none"/>
</macros>
<externalSettings/>
<extensions>
@@ -20,25 +24,25 @@
</extensions>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
- <configuration artifactName="${ProjName}" buildProperties="" description="" id="com.sylixos.realcoder.toolChain.armsylixeabi.783133971" name="Default" parent="org.eclipse.cdt.build.core.emptycfg">
- <folderInfo id="com.sylixos.realcoder.toolChain.armsylixeabi.783133971.2060133264" name="/" resourcePath="">
- <toolChain id="com.sylixos.realcoder.toolChain.armsylixeabi.32415642" name="arm-sylixos-toolchain" superClass="com.sylixos.realcoder.toolChain.armsylixeabi">
- <targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.GNU_ELF" id="com.sylixos.realcoder.targetPlatform.armsylixoseabi.1632066583" isAbstract="false" name="SylixOS TagetPlagform" osList="win32" superClass="com.sylixos.realcoder.targetPlatform.armsylixoseabi"/>
- <builder id="com.sylixos.realcoder.builder.armsylixeabi.2147356729" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="SylixOS Builder" superClass="com.sylixos.realcoder.builder.armsylixeabi"/>
- <tool id="com.sylixos.realcoder.tool.armsylixeabi.2123399133" name="arm-sylixos-eabi-gcc" superClass="com.sylixos.realcoder.tool.armsylixeabi">
- <option id="com.sylixos.realcoder.option.armsylixoseabi.include.592664854" name="Include paths (-I)" superClass="com.sylixos.realcoder.option.armsylixoseabi.include" valueType="includePath">
+ <configuration artifactName="${ProjName}" buildProperties="" description="" id="com.sylixos.realcoder.toolChain.armsylixeabi.21622006" name="Default" parent="org.eclipse.cdt.build.core.emptycfg">
+ <folderInfo id="com.sylixos.realcoder.toolChain.armsylixeabi.21622006.394215299" name="/" resourcePath="">
+ <toolChain id="com.sylixos.realcoder.toolChain.armsylixeabi.465308959" name="SylixOS Toolchain" superClass="com.sylixos.realcoder.toolChain.armsylixeabi">
+ <targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.GNU_ELF" id="com.sylixos.realcoder.targetPlatform.armsylixoseabi.1130510335" isAbstract="false" name="SylixOS TagetPlagform" osList="win32" superClass="com.sylixos.realcoder.targetPlatform.armsylixoseabi"/>
+ <builder id="com.sylixos.realcoder.builder.armsylixeabi.1334573766" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="SylixOS Builder" superClass="com.sylixos.realcoder.builder.armsylixeabi"/>
+ <tool id="com.sylixos.realcoder.tool.armsylixeabi.80463540" name="arm-sylixos-eabi-gcc" superClass="com.sylixos.realcoder.tool.armsylixeabi">
+ <option id="com.sylixos.realcoder.option.armsylixoseabi.include.2092326724" name="Include paths (-I)" superClass="com.sylixos.realcoder.option.armsylixoseabi.include" valueType="includePath">
<listOptionValue builtIn="false" value="&quot;${SYLIXOS_BASE_PATH}/libsylixos/SylixOS&quot;"/>
<listOptionValue builtIn="false" value="&quot;${SYLIXOS_BASE_PATH}/libsylixos/SylixOS/include&quot;"/>
<listOptionValue builtIn="false" value="&quot;${SYLIXOS_BASE_PATH}/libsylixos/SylixOS/include/inet&quot;"/>
- <listOptionValue builtIn="false" value="&quot;D:\ZTHSOFT\arm-sylixos-toolchain/arm-sylixos-eabi/include&quot;"/>
- <listOptionValue builtIn="false" value="&quot;D:\ZTHSOFT\arm-sylixos-toolchain/lib/gcc/arm-sylixos-eabi/4.9.3/include&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SYLIXOS_TOOLCHAIN_PATH}/${SYLIXOS_TOOLCHAIN_PREFIX}/include&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SYLIXOS_TOOLCHAIN_PATH}/lib/gcc/${SYLIXOS_TOOLCHAIN_PREFIX}/${SYLIXOS_TOOLCHAIN_VER}/include&quot;"/>
</option>
- <option id="com.sylixos.realcoder.option.armsylixoseabi.DefinedSymbols.1408416282" name="Defined symbols(-D)" superClass="com.sylixos.realcoder.option.armsylixoseabi.DefinedSymbols" valueType="definedSymbols">
+ <option id="com.sylixos.realcoder.option.armsylixoseabi.DefinedSymbols.872955496" name="Defined symbols(-D)" superClass="com.sylixos.realcoder.option.armsylixoseabi.DefinedSymbols" valueType="definedSymbols">
<listOptionValue builtIn="false" value="__GNUC__=4"/>
<listOptionValue builtIn="false" value="SYLIXOS"/>
</option>
- <inputType id="com.sylixos.realcoder.inputType.armnsylixeabic.231369310" name="SylixOS Input C" superClass="com.sylixos.realcoder.inputType.armnsylixeabic"/>
- <inputType id="com.sylixos.realcoder.inputType.armnsylixeabicpp.2017416729" name="SylixOS Input CPP" superClass="com.sylixos.realcoder.inputType.armnsylixeabicpp"/>
+ <inputType id="com.sylixos.realcoder.inputType.armnsylixeabic.657182802" name="SylixOS Input C" superClass="com.sylixos.realcoder.inputType.armnsylixeabic"/>
+ <inputType id="com.sylixos.realcoder.inputType.armnsylixeabicpp.542599569" name="SylixOS Input CPP" superClass="com.sylixos.realcoder.inputType.armnsylixeabicpp"/>
</tool>
</toolChain>
</folderInfo>
@@ -48,7 +52,7 @@
</cconfiguration>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
- <project id="bspam335x.null.1743349296" name="bspam335x"/>
+ <project id="bspam335x.null.1745186290" name="bspam335x"/>
</storageModule>
<storageModule moduleId="scannerConfiguration">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
diff --git a/Makefile b/Makefile
index b77bb12..e9126f1 100644
--- a/Makefile
+++ b/Makefile
@@ -35,15 +35,6 @@ $(call check_defined, TOOLCHAIN_PREFIX, the prefix name of toolchain)
$(call check_defined, DEBUG_LEVEL, debug level(debug or release))
#*********************************************************************************************************
-# configure area you can set the following config to you own system
-# FPUFLAGS (-mfloat-abi=softfp -mfpu=vfpv3 ...)
-# CPUFLAGS (-mcpu=arm920t ...)
-# NOTICE: libsylixos, BSP and other kernel modules projects CAN NOT use vfp!
-#*********************************************************************************************************
-FPUFLAGS =
-CPUFLAGS = -mcpu=cortex-a8
-
-#*********************************************************************************************************
# toolchain select
#*********************************************************************************************************
CC = $(TOOLCHAIN_PREFIX)gcc
diff --git a/README.txt b/README.txt
index 3de5d78..0185485 100644
--- a/README.txt
+++ b/README.txt
@@ -9,7 +9,7 @@ bspam335x 是 SylixOS 支持 Ti AM335x 系列处理器的 BSP 包,
如果您使用 Eclipse,需要修改 config.mk 文件,设置正确的 SylixOS Base 工程路径和工具链前缀及调试级别;
-如果您使用 RealCoder,则需要对工程进行通用设置,方法请参考 《RealCoder 使用手册》。
+如果您使用 RealEvo-IDE,则需要对工程进行通用设置,方法请参考 《RealEvo-IDE 使用手册》。
根据您使用的开发板,需要修改 Makefile 的 PLATFORM 变量。
diff --git a/SylixOS/driver/sdi/am335x_sdi.c b/SylixOS/driver/sdi/am335x_sdi.c
index d75c67b..500824a 100644
--- a/SylixOS/driver/sdi/am335x_sdi.c
+++ b/SylixOS/driver/sdi/am335x_sdi.c
@@ -19,6 +19,7 @@
** 描 述: am335x SD 主控制器硬件驱动源文件
** BUG:
+2015.09.15 增加通道2的初始化示例,同时修改写保护和卡检测引脚的处理方式.
*********************************************************************************************************/
#define __SYLIXOS_IO
#define __SYLIXOS_KERNEL
@@ -29,7 +30,7 @@
/*********************************************************************************************************
宏定义
*********************************************************************************************************/
-#define __SDI_CHAN_NUM 1 /* 配置使用的通道数量 */
+#define __SDI_CHAN_NUM 2 /* 配置使用的通道数量 */
#define __SDI_CHAN0_BASE (0x48060000)
#define __SDI_CHAN1_BASE (0x481d8000)
@@ -49,8 +50,8 @@
SDHCI_QUIRK_FLG_DO_RESET_AFTER_SET_POWER_ON |\
SDHCI_QUIRK_FLG_RECHECK_INTS_AFTER_ISR |\
SDHCI_QUIRK_FLG_CANNOT_SDIO_INT)
-#define __SDI_CHAN1_QUIRK_FLG 0
-#define __SDI_CHAN2_QUIRK_FLG 0
+#define __SDI_CHAN1_QUIRK_FLG __SDI_CHAN0_QUIRK_FLG
+#define __SDI_CHAN2_QUIRK_FLG __SDI_CHAN0_QUIRK_FLG
/*********************************************************************************************************
GPIO 描述
*********************************************************************************************************/
@@ -103,8 +104,8 @@ static BOOL __sdiQuirkIsCardWp(PLW_SDHCI_HOST_ATTR psdhcihostattr);
** 功能描述: 安装 SDI 控制器驱动
** 输 入: iChannel 通道号
** pPinMux 引脚复用
-** uiCdPin 卡插拔检测引脚 GPIO 编号
-** uiWpPin 卡写保护引脚 GPIO 编号
+** uiCdPin 卡插拔检测引脚 GPIO 编号(如果为0, 表示无热插拔功能)
+** uiWpPin 卡写保护引脚 GPIO 编号(如果为0, 表示无写保护引脚, 默认处理为未写保护)
** 输 出: ERROR CODE
** 全局变量:
** 调用模块:
@@ -191,7 +192,7 @@ static INT __sdiChannelDataInit (INT iChannel, UINT uiCdPin, UINT uiWpPin)
pvRegBase = API_VmmIoRemapNocache((PVOID)__SDI_CHAN0_BASE, LW_CFG_VMM_PAGE_SIZE);
if (!pvRegBase) {
printk(KERN_ERR "__sdiChannelDataInit(): failed to remap host%d register space!\n",
- iChannel);
+ iChannel);
return (PX_ERROR);
}
@@ -208,8 +209,8 @@ static INT __sdiChannelDataInit (INT iChannel, UINT uiCdPin, UINT uiWpPin)
psdhciattr->SDHCIHOST_uiQuirkFlag = __SDI_CHAN0_QUIRK_FLG;
psdhciattr->SDHCIHOST_pvUsrSpec = (VOID *)psdichannel;
- psdigpio->SDIGPIO_uiCdPin = uiCdPin;
- psdigpio->SDIGPIO_uiWpPin = uiWpPin;
+ psdigpio->SDIGPIO_uiCdPin = uiCdPin;
+ psdigpio->SDIGPIO_uiWpPin = uiWpPin;
IntPrioritySet(psdhciattr->SDHCIHOST_ulIntVector,
BSP_CFG_MMCSD0_INT_PRIO,
@@ -217,7 +218,33 @@ static INT __sdiChannelDataInit (INT iChannel, UINT uiCdPin, UINT uiWpPin)
break;
case 1:
- return (PX_ERROR);
+ pvRegBase = API_VmmIoRemapNocache((PVOID)__SDI_CHAN1_BASE, LW_CFG_VMM_PAGE_SIZE);
+ if (!pvRegBase) {
+ printk(KERN_ERR "__sdiChannelDataInit(): failed to remap host%d register space!\n",
+ iChannel);
+ return (PX_ERROR);
+ }
+
+ psdichannel->SDICH_iCardSta = 0;
+ psdichannel->SDICH_cpcHostName = "/bus/sd/1";
+ psdichannel->SDICH_pvRegBase = pvRegBase;
+
+ psdhciattr->SDHCIHOST_pdrvfuncs = LW_NULL;
+ psdhciattr->SDHCIHOST_iRegAccessType = SDHCI_REGACCESS_TYPE_MEM;
+ psdhciattr->SDHCIHOST_ulBasePoint = (ULONG)pvRegBase + __SDI_SDHCI_BASE_OFFSET;
+ psdhciattr->SDHCIHOST_ulIntVector = __SDI_CHAN1_INT;
+ psdhciattr->SDHCIHOST_uiMaxClock = uiClkRate;
+ psdhciattr->SDHCIHOST_pquirkop = &_G_sdiquirkop;
+ psdhciattr->SDHCIHOST_uiQuirkFlag = __SDI_CHAN1_QUIRK_FLG;
+ psdhciattr->SDHCIHOST_pvUsrSpec = (VOID *)psdichannel;
+
+ psdigpio->SDIGPIO_uiCdPin = uiCdPin;
+ psdigpio->SDIGPIO_uiWpPin = uiWpPin;
+
+ IntPrioritySet(psdhciattr->SDHCIHOST_ulIntVector,
+ BSP_CFG_MMCSD1_INT_PRIO,
+ AINTC_HOSTINT_ROUTE_IRQ);
+ break;
case 2:
return (PX_ERROR);
@@ -254,9 +281,11 @@ static UINT32 __sdiClockInit (INT iChannel)
*********************************************************************************************************/
static INT __sdiPortInit (__SDI_CHANNEL *psdichannel)
{
- API_GpioRequestOne(psdichannel->SDICH_sdigpio.SDIGPIO_uiCdPin,
- LW_GPIOF_IN,
- LW_NULL);
+ if (psdichannel->SDICH_sdigpio.SDIGPIO_uiCdPin > 0) {
+ API_GpioRequestOne(psdichannel->SDICH_sdigpio.SDIGPIO_uiCdPin,
+ LW_GPIOF_IN,
+ LW_NULL);
+ }
if (psdichannel->SDICH_sdigpio.SDIGPIO_uiWpPin > 0) {
API_GpioRequestOne(psdichannel->SDICH_sdigpio.SDIGPIO_uiWpPin,
@@ -390,7 +419,11 @@ static INT __sdiCardStaGet (__SDI_CHANNEL *psdichannel)
{
UINT32 uiStatus;
- uiStatus = API_GpioGetValue(psdichannel->SDICH_sdigpio.SDIGPIO_uiCdPin);
+ if (psdichannel->SDICH_sdigpio.SDIGPIO_uiCdPin > 0) {
+ uiStatus = API_GpioGetValue(psdichannel->SDICH_sdigpio.SDIGPIO_uiCdPin);
+ } else {
+ uiStatus = 0;
+ }
return (uiStatus == 0); /* 插入时为低电平 */
}
diff --git a/SylixOSBSP.ld b/SylixOSBSP.ld
index 6aaf155..3d47b10 100644
--- a/SylixOSBSP.ld
+++ b/SylixOSBSP.ld
@@ -1,5 +1,5 @@
/****************************************Copyright (c)****************************************************
-** Beijin ZTHSOFT electronics Co.,LTD.
+** Beijin ACOINFO electronics Co.,LTD.
**
** http://www.sylixos.com
**
@@ -219,6 +219,6 @@ SECTIONS
}
/*********************************************************************************************************
- END FILE
+ END
*********************************************************************************************************/
diff --git a/config.mk b/config.mk
index 184a9e4..ee0bb3c 100644
--- a/config.mk
+++ b/config.mk
@@ -12,16 +12,16 @@
#
# 文 件 名: config.mk
#
-# 创 建 人: RealCoder
+# 创 建 人: RealEvo-IDE
#
-# 文件创建日期: 2015-05-13
+# 文件创建日期: 2015 年12 月06 日
#
-# 描 述: 本文件由RealCoder生成,用于配置Makefile功能,请勿手动修改
+# 描 述: 本文件由 RealEvo-IDE 生成,用于配置 Makefile 功能,请勿手动修改
#*********************************************************************************************************
#*********************************************************************************************************
# SylixOS Base Project path
#*********************************************************************************************************
-SYLIXOS_BASE_PATH = D:\workspace\SylixOS_Base
+SYLIXOS_BASE_PATH = D:/workspace/sylixos-base
#*********************************************************************************************************
# Toolchain prefix
@@ -31,4 +31,11 @@ TOOLCHAIN_PREFIX = arm-sylixos-eabi-
#*********************************************************************************************************
# Debug options (debug or release)
#*********************************************************************************************************
-DEBUG_LEVEL = debug \ No newline at end of file
+DEBUG_LEVEL = debug
+
+#*********************************************************************************************************
+# NOTICE: libsylixos, BSP and other kernel modules projects CAN NOT use vfp!
+#*********************************************************************************************************
+FPUFLAGS =
+CPUFLAGS = -mcpu=cortex-a8 $(FPUFLAGS)
+