mirror of
https://github.com/rvtr/twl_wrapsdk.git
synced 2025-10-31 06:11:10 -04:00
fix SDIP err
git-svn-id: file:///Users/lillianskinner/Downloads/platinum/twl/twl_wrapsdk/trunk@130 4ee2a332-4b2b-5046-8439-1ba90f034370
This commit is contained in:
parent
d363f96b55
commit
bbaf1a132b
@ -28,11 +28,6 @@ TWL_PROC = ARM7
|
||||
|
||||
SRCDIR = ../common/src src
|
||||
|
||||
INCDIR = ../common
|
||||
INCDIR += $(TWLSDK_ROOT)/include/twl \
|
||||
$(TWLSDK_ROOT)/include/twl/devices/sdmc/ARM7 \
|
||||
$(TWLSDK_ROOT)/include/twl/fatfs/ARM7 \
|
||||
|
||||
SRCS = \
|
||||
sdmc.c \
|
||||
sdif.c \
|
||||
@ -52,6 +47,8 @@ endif
|
||||
|
||||
include $(TWLSDK_ROOT)/build/buildtools/commondefs
|
||||
|
||||
GINCLUDES += $(TWL_INCDIR)/twl/fatfs/ARM7
|
||||
|
||||
INSTALL_TARGETS = $(TARGETS)
|
||||
INSTALL_DIR = $(TWL_INSTALL_LIBDIR)
|
||||
|
||||
|
||||
@ -11,12 +11,12 @@
|
||||
in whole or in part, without the prior written consent of Nintendo.
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
#include <rtfs.h>
|
||||
#include <twl/rtfs.h>
|
||||
#include <portconf.h>
|
||||
//#if (INCLUDE_SD)
|
||||
|
||||
#include "sdmc_config.h"
|
||||
#include "sdmc.h"
|
||||
#include <twl/sdmc.h>
|
||||
#include "sdif_ip.h"
|
||||
#include "sdif_reg.h"
|
||||
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
#include <twl.h>
|
||||
#include "sdmc_config.h"
|
||||
#include "sdif_reg.h" /* IP 対応レジスタ定義 */
|
||||
#include "sdmc.h"
|
||||
#include <twl/sdmc.h>
|
||||
#include "sdif_ip.h" /* IP 対応フラグ定義 */
|
||||
|
||||
#if (SD_DEBUG_PRINT_ON == 1)
|
||||
@ -139,7 +139,7 @@ u16 SD_Command(u16 ucCommand)
|
||||
SD_SetFPGA(SD_CMD,(ucCommand)); /* コマンド発行 */
|
||||
|
||||
while(!SD_CheckFPGAReg(SD_INFO1,SD_INFO1_RES_END)){ /* Response end 待ち */
|
||||
if(SDCARD_ErrStatus & SDMC_ERR_FPGA_TIMEOUT){ /* タイムアウトチェック */
|
||||
if( SDCARD_ErrStatus != SDMC_NORMAL){ /* タイムアウトチェック */
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -196,7 +196,7 @@ u16 SD_AppOpCond(void)
|
||||
{
|
||||
SD_ClrErr((u16)(~SDMC_ERR_FPGA_TIMEOUT)); /* タイムアウト以外のエラーをクリア */
|
||||
|
||||
while(!SDCARD_ErrStatus){ /* エラーが発生しない間は繰り返し */
|
||||
while( !SDCARD_ErrStatus){ /* エラーが発生しない間は繰り返し */
|
||||
/* Argument(31:0) = OCR without busy (0x00100000 = 3.2-3.3V) */
|
||||
/*ホスト側で電圧を選択できる場合などは、初回にSD_ARG1を0にすることにより
|
||||
カードが対応している電圧を問い合わせることができる。CTRは電圧3.3V決め打ち
|
||||
@ -242,7 +242,7 @@ u16 SD_SendOpCond(void)
|
||||
|
||||
SD_ClrErr((u16)(~SDMC_ERR_FPGA_TIMEOUT)); /* タイムアウトエラーをクリア */
|
||||
|
||||
while(!SDCARD_ErrStatus){ /* エラーが発生しない間は繰り返し */
|
||||
while( !SDCARD_ErrStatus){ /* エラーが発生しない間は繰り返し */
|
||||
SD_SetFPGA(SD_ARG0,(0x0000)); /* Argument(15:0) for MMC (None for SD) */
|
||||
SD_SetFPGA(SD_ARG1,(0x0010)); /* Argument(31:16) for MMC (None for SD) */
|
||||
SD_Command(SD_CMD_CMD | SEND_OP_COND); /* CMD1発行、レスポンス(R1)待ち */
|
||||
@ -487,7 +487,7 @@ u16 SD_SendStatus(void)
|
||||
SD_SetFPGA(SD_CMD,(SD_CMD_CMD | SD_SEND_STATUS)); /* CMD13発行 */
|
||||
|
||||
while(!SD_CheckFPGAReg(SD_INFO1,SD_INFO1_RES_END)){ /* Response end (R1)待ち */
|
||||
if(SDCARD_ErrStatus & SDMC_ERR_FPGA_TIMEOUT){
|
||||
if( SDCARD_ErrStatus != SDMC_NORMAL) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1094,7 +1094,7 @@ u16 SD_TransCommand(u16 ucCommand)
|
||||
SD_SetFPGA(SD_CMD,(ucCommand)); /* コマンド発行 */
|
||||
|
||||
while(!SD_CheckFPGAReg(SD_INFO1,SD_INFO1_RES_END)){ /* Response end 待ち */
|
||||
if(SDCARD_ErrStatus & SDMC_ERR_FPGA_TIMEOUT){
|
||||
if( SDCARD_ErrStatus != SDMC_NORMAL) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
//#include <twl/hw/ARM7/ioreg_MI.h>
|
||||
#include "sdmc_config.h"
|
||||
#include "sdif_reg.h" /* IP 対応レジスタ定義 */
|
||||
#include "sdmc.h"
|
||||
#include <twl/sdmc.h>
|
||||
#include "sdif_ip.h" /* IP 対応フラグ定義 */
|
||||
|
||||
/*#if (SD_DEBUG_PRINT_ON == 1)
|
||||
@ -120,9 +120,9 @@ static void SDCARD_Thread( void* arg); //SD
|
||||
static void SDCARD_Intr_Thread( void* arg); //SD割り込み処理スレッド
|
||||
|
||||
SDMC_ERR_CODE sdmcGoIdle( void (*func1)(),void (*func2)());
|
||||
/*static*/ SDMC_ERR_CODE i_sdmcInit( void);
|
||||
/*static*/ SDMC_ERR_CODE SDCARD_Layer_Init(void);
|
||||
/*static*/ SDMC_ERR_CODE i_sdmcMPInit( void); /* カードドライバ初期化(マルチポート対応) */
|
||||
static SDMC_ERR_CODE i_sdmcInit( void);
|
||||
static SDMC_ERR_CODE SDCARD_Layer_Init(void);
|
||||
static SDMC_ERR_CODE i_sdmcMPInit( void); /* カードドライバ初期化(マルチポート対応) */
|
||||
|
||||
static u16 i_sdmcErrProcess(void); /* エラー時の処理 */
|
||||
static u16 i_sdmcGetResid(u32 *pResid); /* 書きこみ完了セクタ数の取得 */
|
||||
@ -394,13 +394,14 @@ static void SDCARD_Dmy_Handler( void)
|
||||
Description: Initialize SD interface and SD card.
|
||||
初期化
|
||||
|
||||
Arguments: func1 : カード挿入時コールバック関数
|
||||
Arguments: dma_no : DMA番号
|
||||
func1 : カード挿入時コールバック関数
|
||||
func2 : カード排出時コールバック関数
|
||||
|
||||
Returns: 0 : success
|
||||
> 0 : error code
|
||||
*---------------------------------------------------------------------------*/
|
||||
SDMC_ERR_CODE sdmcInit(void (*func1)(),void (*func2)())
|
||||
SDMC_ERR_CODE sdmcInit( SDMC_DMA_NO dma_no, void (*func1)(),void (*func2)())
|
||||
{
|
||||
#if (TARGET_OS_CTR == 1)
|
||||
T_CALM calm;
|
||||
@ -580,7 +581,7 @@ SDMC_ERR_CODE sdmcGoIdle( void (*func1)(),void (*func2)())
|
||||
Returns: 0 : success
|
||||
> 0 : error code
|
||||
*---------------------------------------------------------------------------*/
|
||||
/*static*/ SDMC_ERR_CODE i_sdmcInit( void)
|
||||
static SDMC_ERR_CODE i_sdmcInit( void)
|
||||
{
|
||||
i_sdmcEnable();
|
||||
|
||||
@ -663,7 +664,7 @@ SDMC_ERR_CODE sdmcReset( void)
|
||||
|
||||
Returns: None
|
||||
*---------------------------------------------------------------------------*/
|
||||
/*static*/ SDMC_ERR_CODE SDCARD_Layer_Init(void)
|
||||
static SDMC_ERR_CODE SDCARD_Layer_Init(void)
|
||||
{
|
||||
u32 ulCSize;
|
||||
// SYSTIM wait_tim, limit_tim;
|
||||
@ -957,7 +958,7 @@ PRINTDEBUG( "SD_INFO1_MASK : 0x%x\n", (*(vu32 *)(SD_IP_BASE + 0x20)));*/
|
||||
Returns: 0 : success
|
||||
> 0 : error code
|
||||
*---------------------------------------------------------------------------*/
|
||||
/*static*/ SDMC_ERR_CODE i_sdmcMPInit( void)
|
||||
static SDMC_ERR_CODE i_sdmcMPInit( void)
|
||||
{
|
||||
if(((SD_port_number == SDCARD_PORT0) && (!SD_CheckFPGAReg(SD_INFO1,SD_INFO1_DETECT))) ||
|
||||
((SD_port_number == SDCARD_PORT1) && (!SD_CheckFPGAReg(EXT_CD,EXT_CD_PORT1_DETECT))) ||
|
||||
|
||||
@ -20,11 +20,12 @@ include $(TWLSDK_ROOT)/build/buildtools/commondefs
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
SUBDIRS = os \
|
||||
mi \
|
||||
aes \
|
||||
snd \
|
||||
camera \
|
||||
SUBDIRS = os \
|
||||
mi \
|
||||
aes \
|
||||
snd \
|
||||
camera \
|
||||
fatfs \
|
||||
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
@ -16,7 +16,7 @@
|
||||
|
||||
#include <twl_sp.h>
|
||||
#include <twl/fatfs/ARM7/rtfs.h>
|
||||
#include <twl/devices/rom_sdmc/ARM7/sdmc.h>
|
||||
#include <twl/devices/sdmc/ARM7/sdmc.h>
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
定数定義
|
||||
@ -66,10 +66,12 @@ void MY_SdTransferRewind( void)
|
||||
*---------------------------------------------------------------------------*/
|
||||
void TwlSpMain(void)
|
||||
{
|
||||
u16 i;
|
||||
OSHeapHandle heapHandle;
|
||||
SDMC_ERR_CODE result;
|
||||
SdmcResultInfo SdResult;
|
||||
PCFD fd;
|
||||
CHKDISK_STATS dstat;
|
||||
|
||||
// OS初期化
|
||||
OS_Init();
|
||||
@ -175,7 +177,26 @@ void TwlSpMain(void)
|
||||
|
||||
#else
|
||||
/*デバイスドライバの登録*/
|
||||
PRINTDEBUG( "attach start\n");
|
||||
for( i=0; i<2; i++) {
|
||||
if( (i % 2) == 0) {
|
||||
/*NANDからブロックライト/リード*/
|
||||
result = sdmcSelect( (u16)SDMC_PORT_NAND);
|
||||
if( result != 0) {
|
||||
PRINTDEBUG( "sdmcSelect(NAND) failed.\n");
|
||||
}else{
|
||||
PRINTDEBUG( "sdmcSelect(NAND) success.\n");
|
||||
}
|
||||
}else{
|
||||
/*CARDからブロックライト/リード*/
|
||||
result = sdmcSelect( (u16)SDMC_PORT_CARD);
|
||||
if( result != 0) {
|
||||
PRINTDEBUG( "sdmcSelect(CARD) failed.\n");
|
||||
}else{
|
||||
PRINTDEBUG( "sdmcSelect(CARD) success.\n");
|
||||
}
|
||||
}
|
||||
|
||||
PRINTDEBUG( "attach start\n");
|
||||
if( sdmcRtfsAttach( 4) == FALSE) { //sdmcをEドライブにする
|
||||
PRINTDEBUG( "sdmcRtfsAttach failed.\n");
|
||||
}else{
|
||||
@ -193,11 +214,9 @@ void TwlSpMain(void)
|
||||
PRINTDEBUG( "pc_set_default_drive success\n");
|
||||
|
||||
/**/
|
||||
{
|
||||
CHKDISK_STATS dstat;
|
||||
PRINTDEBUG( "pc_check_disk start. please wait.\n");
|
||||
pc_check_disk( (byte*)"E:", &dstat, 0, 1, 1);
|
||||
PRINTDEBUG( "pc_check_disk end.\n");
|
||||
}
|
||||
|
||||
/*----------*/
|
||||
fd = po_open( (byte*)"\\sdmc_twl_test.bin", (PO_CREAT|PO_BINARY|PO_WRONLY), PS_IWRITE);
|
||||
@ -215,6 +234,7 @@ void TwlSpMain(void)
|
||||
}
|
||||
PRINTDEBUG( "po_close success.\n");
|
||||
/*----------*/
|
||||
}
|
||||
#endif
|
||||
|
||||
PRINTDEBUG( "Sample program ends.\n");
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
#define __SDMC_H__
|
||||
|
||||
#include <twl.h>
|
||||
#include <rtfs.h>
|
||||
#include <twl/rtfs.h>
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
@ -21,6 +21,18 @@ typedef enum {
|
||||
}SDMC_PORT_NO;
|
||||
|
||||
|
||||
/*********************************************
|
||||
DMA番号
|
||||
*********************************************/
|
||||
typedef enum {
|
||||
SDMC_USE_DMA_0 = 0,
|
||||
SDMC_USE_DMA_1 = 1,
|
||||
SDMC_USE_DMA_2 = 2,
|
||||
SDMC_USE_DMA_3 = 3,
|
||||
SDMC_NOUSE_DMA = 0xFF
|
||||
}SDMC_DMA_NO;
|
||||
|
||||
|
||||
/*********************************************
|
||||
カードエラーコード(カードエラーステータス設定値)アプリケーション固有のSDCARD_ErrStatusに対して
|
||||
*********************************************/
|
||||
@ -78,6 +90,7 @@ typedef struct
|
||||
s16 OutFlag;
|
||||
u16 WP_PERMANENT;
|
||||
u16 WP_TEMPORARY;
|
||||
u16 port_no;
|
||||
}
|
||||
SDPortContext;
|
||||
|
||||
@ -125,7 +138,7 @@ BOOL sdmcCheckMedia( void);
|
||||
/*********************************************
|
||||
基本API
|
||||
*********************************************/
|
||||
SDMC_ERR_CODE sdmcInit(void (*func1)(void),void (*func2)(void)); /* カードドライバ初期化 */
|
||||
SDMC_ERR_CODE sdmcInit( SDMC_DMA_NO dma_no, void (*func1)(void),void (*func2)(void)); /* カードドライバ初期化 */
|
||||
SDMC_ERR_CODE sdmcReset( void); /* カードリセット */
|
||||
|
||||
SDMC_ERR_CODE sdmcGetStatus(u16 *status); /* カードドライバの現在の状態を取得する */
|
||||
|
||||
17
include/twl/rtfs.h
Normal file
17
include/twl/rtfs.h
Normal file
@ -0,0 +1,17 @@
|
||||
/*---------------------------------------------------------------------------*
|
||||
Project: TwlSDK - IO Register List -
|
||||
File: twl/ioreg.h
|
||||
|
||||
Copyright 2007 Nintendo. All rights reserved.
|
||||
|
||||
These coded instructions, statements, and computer programs contain
|
||||
proprietary information of Nintendo of America Inc. and/or Nintendo
|
||||
Company Ltd., and are protected by Federal copyright law. They may
|
||||
not be disclosed to third parties or copied or duplicated in any form,
|
||||
in whole or in part, without the prior written consent of Nintendo.
|
||||
|
||||
*---------------------------------------------------------------------------*/
|
||||
#ifdef SDK_ARM9
|
||||
#else //SDK_ARM7
|
||||
#include <twl/fatfs/ARM7/rtfs.h>
|
||||
#endif
|
||||
17
include/twl/sdmc.h
Normal file
17
include/twl/sdmc.h
Normal file
@ -0,0 +1,17 @@
|
||||
/*---------------------------------------------------------------------------*
|
||||
Project: TwlSDK - SD driver -
|
||||
File: twl/sdmc.h
|
||||
|
||||
Copyright 2007 Nintendo. All rights reserved.
|
||||
|
||||
These coded instructions, statements, and computer programs contain
|
||||
proprietary information of Nintendo of America Inc. and/or Nintendo
|
||||
Company Ltd., and are protected by Federal copyright law. They may
|
||||
not be disclosed to third parties or copied or duplicated in any form,
|
||||
in whole or in part, without the prior written consent of Nintendo.
|
||||
|
||||
*---------------------------------------------------------------------------*/
|
||||
#ifdef SDK_ARM9
|
||||
#else //SDK_ARM7
|
||||
#include <twl/devices/sdmc/ARM7/sdmc.h>
|
||||
#endif
|
||||
Loading…
Reference in New Issue
Block a user