From 2d80464f0b6f029939163fe11de33de4122d4999 Mon Sep 17 00:00:00 2001 From: nakasima Date: Fri, 28 Sep 2007 05:21:48 +0000 Subject: [PATCH] sdmc_types.h is isolated from sdmc.h. add MI_WRAM_*_SIZE_MAX. git-svn-id: file:///Users/lillianskinner/Downloads/platinum/twl/twl_wrapsdk/trunk@286 4ee2a332-4b2b-5046-8439-1ba90f034370 --- build/tests/fatfs/fatfs_sd/ARM7/Makefile | 1 - include/twl/devices/sdmc/ARM7/sdmc.h | 140 +------------------ include/twl/devices/sdmc/ARM7/sdmc_types.h | 155 +++++++++++++++++++++ include/twl/fatfs/ARM7/attach.h | 2 +- include/twl/fatfs/ARM7/rtfs.h | 6 +- include/twl/fatfs/ARM7/rtfsconf.h | 2 +- include/twl/mi/wram_abc.h | 4 + 7 files changed, 165 insertions(+), 145 deletions(-) create mode 100644 include/twl/devices/sdmc/ARM7/sdmc_types.h diff --git a/build/tests/fatfs/fatfs_sd/ARM7/Makefile b/build/tests/fatfs/fatfs_sd/ARM7/Makefile index 75c2192..3ff5a86 100644 --- a/build/tests/fatfs/fatfs_sd/ARM7/Makefile +++ b/build/tests/fatfs/fatfs_sd/ARM7/Makefile @@ -32,7 +32,6 @@ INCDIR += $(TWLSDK_ROOT)/include/twl \ $(TWLSDK_ROOT)/include/twl/devices/sdmc/ARM7 \ $(TWLSDK_ROOT)/include/twl/fatfs/ARM7 \ -LLIBRARY_DIRS = $(TWLSDK_ROOT)/lib/ARM-BB/Release LLIBRARIES = libfatfs_sp.twl.a \ libsd_sp.twl.a \ libcs_sp.twl.a \ diff --git a/include/twl/devices/sdmc/ARM7/sdmc.h b/include/twl/devices/sdmc/ARM7/sdmc.h index f690ed9..aea572f 100644 --- a/include/twl/devices/sdmc/ARM7/sdmc.h +++ b/include/twl/devices/sdmc/ARM7/sdmc.h @@ -4,6 +4,7 @@ #include #include +#include #ifdef __cplusplus @@ -12,145 +13,6 @@ extern "C" { -/********************************************* - ポート番号 -*********************************************/ -typedef enum { - SDMC_PORT_CARD = 0x400, - SDMC_PORT_NAND = 0x401 -}SDMC_PORT_NO; - - -/********************************************* - DMA番号 -*********************************************/ -typedef enum { - SDMC_USE_DMA_4 = 0, - SDMC_USE_DMA_5 = 1, - SDMC_USE_DMA_6 = 2, - SDMC_USE_DMA_7 = 3, - SDMC_NOUSE_DMA = 0xFF -}SDMC_DMA_NO; - - -/********************************************* - カードエラーコード(カードエラーステータス設定値)アプリケーション固有のSDCARD_ErrStatusに対して -*********************************************/ -typedef enum { - SDMC_NORMAL = 0, /* 正常終了 */ - SDMC_ERR_COMMAND = 0x0001, /* CMDエラー */ - SDMC_ERR_CRC = 0x0002, /* CRCエラー */ - SDMC_ERR_END = 0x0004, /* 実行エラー */ - SDMC_ERR_TIMEOUT = 0x0008, /* コマンドタイムアウト */ - SDMC_ERR_FIFO_OVF = 0x0010, /* FIFO オーバーフローエラー(INFO2のIllegal write access to buffer) */ - SDMC_ERR_FIFO_UDF = 0x0020, /* FIFO アンダーフローエラー(INFO2のIllegal read access to buffer) */ - SDMC_ERR_WP = 0x0040, /* WriteProtectによる書き込みエラー */ - SDMC_ERR_FPGA_TIMEOUT = 0x0100, /* FPGA アクセスタイムアウト */ - SDMC_ERR_PARAM = 0x0200, /* コマンドパラメータエラー */ - SDMC_ERR_R1_STATUS = 0x0800, /* Normal response command カードステータス エラー */ - SDMC_ERR_NUM_WR_SECTORS = 0x1000, /* 書き込み完了セクタ数 エラー */ - SDMC_ERR_RESET = 0x2000, /* 初期化カードリセットコマンド時1.5秒タイムアウトエラー */ - SDMC_ERR_ILA = 0x4000, /* イリーガルアクセスエラー */ - SDMC_ERR_INFO_DETECT = 0x8000 /* カード排出時判別エラービット(IO3) */ -}SDMC_ERR_CODE; - - -/********************************************* - SDドライバ処理結果通知情報構造体 -*********************************************/ -typedef struct { - u16 b_flags; /* 処理内容 */ - u16 result; /* 実行結果 */ - u32 resid; /* 読み(書き)サイズ */ -} SdmcResultInfo; - - - - - -/********************************************* - SDポート状態保存用構造体 -*********************************************/ -typedef struct -{ - u16 SD_CID[8]; /* CID保存用 (Card IDentification register) : ID*/ - u16 SD_CSD[8]; /* CSD保存用 (Card Specific Data register) : spec*/ - u16 SD_OCR[2]; /* OCR保存用 (Operation Condition Register) : voltage and status*/ - u16 SD_SCR[4]; /* SCR保存用 (Sd card Configulation Register) : bus-width, card-ver, etc*/ - u16 SD_RCA; /* RCA保存用 (Relative Card Address register) : address*/ - s16 MMCFlag; - s16 SDHCFlag; - s16 SDFlag; - SDMC_ERR_CODE ErrStatus; /* SDCARD_ErrStatus */ - u32 Status; /* SDCARD_Status */ - u16 SD_CLK_CTRL_VALUE; - u16 SD_OPTION_VALUE; - - s16 OutFlag; - u16 port_no; -} -SDPortContext; - - - - - -/********************************************* - SDスペック構造体 -*********************************************/ -typedef struct { - u32 csd_ver2_flag; //CSDフォーマットバージョン(SDHCのときは1) - u32 memory_capacity; //data areaのサイズ(512Byte単位) - u32 protected_capacity; //protected areaのサイズ(512Byte単位) - u32 card_capacity; //カード全体のサイズ(512Byte単位) - - u32 adjusted_memory_capacity; //memory_capacityをシリンダ(heads*secptrack)の倍数に調整したサイズ(cylinders*heads*secptrackになる) - - u16 heads; - u16 secptrack; - u16 cylinders; - u16 SC; //sectors per cluster - u16 BU; - u16 RDE; //number of root dir entries(512 fix) - u32 SS; //sector size(512 fix) - u32 RSC; //reserved sector count(1 fix) -// u32 TS; //total sectors - u16 FATBITS; //16 or 32 - u16 SF; //sectors per FAT - u32 SSA; //sectors in system area - u32 NOM; //sectors in master boot record -} SdmcSpec; - - -/*FATパラメータ TODO:SdmcSpecを統合すること*/ -typedef struct { - u32 device_capacity; //デバイス全体のサイズ(512Byte単位) - u32 adjusted_device_capacity; - - u32 memory_capacity; //data areaのサイズ(512Byte単位) - u32 adjusted_memory_capacity; //memory_capacityをシリンダ(heads*secptrack)の倍数に調整したサイズ(cylinders*heads*secptrackになる) - - u16 volume_cylinders; - - u16 heads; - u16 secptrack; - u16 cylinders; - u16 SC; //sectors per cluster - u16 BU; - u16 RDE; //number of root dir entries(512 fix) - u32 SS; //sector size(512 fix) - u32 RSC; //reserved sector count(1 fix) - u16 FATBITS; //16 or 32 - u16 SF; //sectors per FAT - u32 SSA; //sectors in system area - u32 NOM; //sectors in master boot record - - u32 begin_sect; -} FATSpec; - - - - /********************************************* RTFS用ドライバインタフェース *********************************************/ diff --git a/include/twl/devices/sdmc/ARM7/sdmc_types.h b/include/twl/devices/sdmc/ARM7/sdmc_types.h new file mode 100644 index 0000000..0f1c5bf --- /dev/null +++ b/include/twl/devices/sdmc/ARM7/sdmc_types.h @@ -0,0 +1,155 @@ + +#ifndef __SDMC_TYPES_H__ +#define __SDMC_TYPES_H__ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + + + +/********************************************* + ポート番号 +*********************************************/ +typedef enum { + SDMC_PORT_CARD = 0x400, + SDMC_PORT_NAND = 0x401 +}SDMC_PORT_NO; + + +/********************************************* + DMA番号 +*********************************************/ +typedef enum { + SDMC_USE_DMA_4 = 0, + SDMC_USE_DMA_5 = 1, + SDMC_USE_DMA_6 = 2, + SDMC_USE_DMA_7 = 3, + SDMC_NOUSE_DMA = 0xFF +}SDMC_DMA_NO; + + +/********************************************* + カードエラーコード(カードエラーステータス設定値)アプリケーション固有のSDCARD_ErrStatusに対して +*********************************************/ +typedef enum { + SDMC_NORMAL = 0, /* 正常終了 */ + SDMC_ERR_COMMAND = 0x0001, /* CMDエラー */ + SDMC_ERR_CRC = 0x0002, /* CRCエラー */ + SDMC_ERR_END = 0x0004, /* 実行エラー */ + SDMC_ERR_TIMEOUT = 0x0008, /* コマンドタイムアウト */ + SDMC_ERR_FIFO_OVF = 0x0010, /* FIFO オーバーフローエラー(INFO2のIllegal write access to buffer) */ + SDMC_ERR_FIFO_UDF = 0x0020, /* FIFO アンダーフローエラー(INFO2のIllegal read access to buffer) */ + SDMC_ERR_WP = 0x0040, /* WriteProtectによる書き込みエラー */ + SDMC_ERR_FPGA_TIMEOUT = 0x0100, /* FPGA アクセスタイムアウト */ + SDMC_ERR_PARAM = 0x0200, /* コマンドパラメータエラー */ + SDMC_ERR_R1_STATUS = 0x0800, /* Normal response command カードステータス エラー */ + SDMC_ERR_NUM_WR_SECTORS = 0x1000, /* 書き込み完了セクタ数 エラー */ + SDMC_ERR_RESET = 0x2000, /* 初期化カードリセットコマンド時1.5秒タイムアウトエラー */ + SDMC_ERR_ILA = 0x4000, /* イリーガルアクセスエラー */ + SDMC_ERR_INFO_DETECT = 0x8000 /* カード排出時判別エラービット(IO3) */ +}SDMC_ERR_CODE; + + +/********************************************* + SDドライバ処理結果通知情報構造体 +*********************************************/ +typedef struct { + u16 b_flags; /* 処理内容 */ + u16 result; /* 実行結果 */ + u32 resid; /* 読み(書き)サイズ */ +} SdmcResultInfo; + + + + + +/********************************************* + SDポート状態保存用構造体 +*********************************************/ +typedef struct +{ + u16 SD_CID[8]; /* CID保存用 (Card IDentification register) : ID*/ + u16 SD_CSD[8]; /* CSD保存用 (Card Specific Data register) : spec*/ + u16 SD_OCR[2]; /* OCR保存用 (Operation Condition Register) : voltage and status*/ + u16 SD_SCR[4]; /* SCR保存用 (Sd card Configulation Register) : bus-width, card-ver, etc*/ + u16 SD_RCA; /* RCA保存用 (Relative Card Address register) : address*/ + s16 MMCFlag; + s16 SDHCFlag; + s16 SDFlag; + SDMC_ERR_CODE ErrStatus; /* SDCARD_ErrStatus */ + u32 Status; /* SDCARD_Status */ + u16 SD_CLK_CTRL_VALUE; + u16 SD_OPTION_VALUE; + + s16 OutFlag; + u16 port_no; +} +SDPortContext; + + + + + +/********************************************* + SDスペック構造体 +*********************************************/ +typedef struct { + u32 csd_ver2_flag; //CSDフォーマットバージョン(SDHCのときは1) + u32 memory_capacity; //data areaのサイズ(512Byte単位) + u32 protected_capacity; //protected areaのサイズ(512Byte単位) + u32 card_capacity; //カード全体のサイズ(512Byte単位) + + u32 adjusted_memory_capacity; //memory_capacityをシリンダ(heads*secptrack)の倍数に調整したサイズ(cylinders*heads*secptrackになる) + + u16 heads; + u16 secptrack; + u16 cylinders; + u16 SC; //sectors per cluster + u16 BU; + u16 RDE; //number of root dir entries(512 fix) + u32 SS; //sector size(512 fix) + u32 RSC; //reserved sector count(1 fix) +// u32 TS; //total sectors + u16 FATBITS; //16 or 32 + u16 SF; //sectors per FAT + u32 SSA; //sectors in system area + u32 NOM; //sectors in master boot record +} SdmcSpec; + + +/*FATパラメータ TODO:SdmcSpecを統合すること*/ +typedef struct { + u32 device_capacity; //デバイス全体のサイズ(512Byte単位) + u32 adjusted_device_capacity; + + u32 memory_capacity; //data areaのサイズ(512Byte単位) + u32 adjusted_memory_capacity; //memory_capacityをシリンダ(heads*secptrack)の倍数に調整したサイズ(cylinders*heads*secptrackになる) + + u16 volume_cylinders; + + u16 heads; + u16 secptrack; + u16 cylinders; + u16 SC; //sectors per cluster + u16 BU; + u16 RDE; //number of root dir entries(512 fix) + u32 SS; //sector size(512 fix) + u32 RSC; //reserved sector count(1 fix) + u16 FATBITS; //16 or 32 + u16 SF; //sectors per FAT + u32 SSA; //sectors in system area + u32 NOM; //sectors in master boot record + + u32 begin_sect; +} FATSpec; + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + + +#endif /*__SDMC_TYPES_H__*/ diff --git a/include/twl/fatfs/ARM7/attach.h b/include/twl/fatfs/ARM7/attach.h index 5443ce9..fe0d25a 100644 --- a/include/twl/fatfs/ARM7/attach.h +++ b/include/twl/fatfs/ARM7/attach.h @@ -10,7 +10,7 @@ #include -#include +#include "rtfs.h" diff --git a/include/twl/fatfs/ARM7/rtfs.h b/include/twl/fatfs/ARM7/rtfs.h index b1fa3b0..a1f7983 100644 --- a/include/twl/fatfs/ARM7/rtfs.h +++ b/include/twl/fatfs/ARM7/rtfs.h @@ -1387,13 +1387,13 @@ typedef struct rtfs_cfg { extern RTFS_CFG *prtfs_cfg; #if (INCLUDE_FAILSAFE_CODE) -#include +#include "prfs.h" #endif /* INCLUDE_FAILSAFE_CODE */ /* Include RTFS Pro features */ -#include //twl modified +#include "rtfspro.h" //twl modified -#include //ctr modified +#include "attach.h" //ctr modified BOOLEAN rtfs_init( void); //ctr modified diff --git a/include/twl/fatfs/ARM7/rtfsconf.h b/include/twl/fatfs/ARM7/rtfsconf.h index 0d0a1fa..16b2c31 100644 --- a/include/twl/fatfs/ARM7/rtfsconf.h +++ b/include/twl/fatfs/ARM7/rtfsconf.h @@ -19,7 +19,7 @@ #define __RTFSCONF__ 1 /* Include CPU and peripheral configuration */ -#include +#include "portconf.h" /* Character set support */ #define INCLUDE_CS_JIS 0 /* Set to 1 to support JIS (kanji) */ diff --git a/include/twl/mi/wram_abc.h b/include/twl/mi/wram_abc.h index 85aa5a7..b201324 100644 --- a/include/twl/mi/wram_abc.h +++ b/include/twl/mi/wram_abc.h @@ -140,6 +140,10 @@ typedef enum MIImageWramC; +#define MI_WRAM_A_SIZE_MAX (MI_WRAM_A_BLOCK_SIZE * MI_WRAM_A_BLOCK_NUM) // 256KB or 128KB +#define MI_WRAM_B_SIZE_MAX (MI_WRAM_B_BLOCK_SIZE * MI_WRAM_B_BLOCK_NUM) // 256KB or 128KB +#define MI_WRAM_C_SIZE_MAX (MI_WRAM_C_BLOCK_SIZE * MI_WRAM_C_BLOCK_NUM) // 256KB or 128KB + #define MI_WRAM_A_BLOCK_SIZE 0x00010000 // 64KB #define MI_WRAM_B_BLOCK_SIZE 0x00008000 // 32KB #define MI_WRAM_C_BLOCK_SIZE 0x00008000 // 32KB