staging:keucr: Remove typedefs

As suggested by Pablo, this patch uses a coccinelle script to remove the
typedefs:
typedef u8 BOOLEAN;  <-- use "bool" instead.
typedef u8 BYTE;     <-- use "u8"
typedef u8 *PBYTE;   <-- use "u8 *"
typedef u16 WORD;    <-- use "u16"
typedef u16 *PWORD;  <-- use "u16 *"
typedef u32 DWORD;   <-- use "u32"
typedef u32 *PDWORD; <-- use "u32 *"
in common.h.

The coccinelle script is:
/* coccinelle script to remove typedefs. */
@remove_typedef@
@@
-typedef bool BOOLEAN;
-typedef u8 BYTE;
-typedef u8 *PBYTE;
-typedef u16 WORD;
-typedef u16 *PWORD;
-typedef u32 DWORD;
-typedef u32 *PDWORD;

@fix_usage@
typedef BOOLEAN;
@@
-BOOLEAN
+bool

@fix_usage1@
typedef BYTE;
@@
-BYTE
+u8

@fix_usage2@
typedef PBYTE;
@@
-PBYTE
+u8 *

@fix_usage3@
typedef WORD;
@@
-WORD
+u16

@fix_usage4@
typedef PWORD;
@@
-PWORD
+u16 *

@fix_usage5@
typedef DWORD;
identifier f;
@@
-DWORD
+u32

@fix_usage6@
typedef PDWORD;
@@
-PDWORD
+u32 *

Signed-off-by: Himangi Saraogi <himangi774@gmail.com>
Signed-off-by: Peter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com>
This commit is contained in:
Himangi Saraogi 2014-03-16 03:14:57 +05:30 committed by Peter P Waskiewicz Jr
parent 68b350073f
commit 432f8574a7
12 changed files with 289 additions and 297 deletions

View File

@ -1,14 +1,6 @@
#ifndef COMMON_INCD #ifndef COMMON_INCD
#define COMMON_INCD #define COMMON_INCD
typedef u8 BOOLEAN;
typedef u8 BYTE;
typedef u8 *PBYTE;
typedef u16 WORD;
typedef u16 *PWORD;
typedef u32 DWORD;
typedef u32 *PDWORD;
#define BYTE_MASK 0xff #define BYTE_MASK 0xff
#endif #endif

View File

@ -17,7 +17,7 @@
int ENE_InitMedia(struct us_data *us) int ENE_InitMedia(struct us_data *us)
{ {
int result; int result;
BYTE MiscReg03 = 0; u8 MiscReg03 = 0;
dev_info(&us->pusb_dev->dev, "--- Init Media ---\n"); dev_info(&us->pusb_dev->dev, "--- Init Media ---\n");
result = ene_read_byte(us, REG_CARD_STATUS, &MiscReg03); result = ene_read_byte(us, REG_CARD_STATUS, &MiscReg03);
@ -41,7 +41,7 @@ int ENE_InitMedia(struct us_data *us)
/* /*
* ene_read_byte() : * ene_read_byte() :
*/ */
int ene_read_byte(struct us_data *us, WORD index, void *buf) int ene_read_byte(struct us_data *us, u16 index, void *buf)
{ {
struct bulk_cb_wrap *bcb = (struct bulk_cb_wrap *) us->iobuf; struct bulk_cb_wrap *bcb = (struct bulk_cb_wrap *) us->iobuf;
int result; int result;
@ -51,8 +51,8 @@ int ene_read_byte(struct us_data *us, WORD index, void *buf)
bcb->DataTransferLength = 0x01; bcb->DataTransferLength = 0x01;
bcb->Flags = 0x80; bcb->Flags = 0x80;
bcb->CDB[0] = 0xED; bcb->CDB[0] = 0xED;
bcb->CDB[2] = (BYTE)(index>>8); bcb->CDB[2] = (u8)(index>>8);
bcb->CDB[3] = (BYTE)index; bcb->CDB[3] = (u8)index;
result = ENE_SendScsiCmd(us, FDIR_READ, buf, 0); result = ENE_SendScsiCmd(us, FDIR_READ, buf, 0);
return result; return result;
@ -65,7 +65,7 @@ int ENE_SMInit(struct us_data *us)
{ {
struct bulk_cb_wrap *bcb = (struct bulk_cb_wrap *) us->iobuf; struct bulk_cb_wrap *bcb = (struct bulk_cb_wrap *) us->iobuf;
int result; int result;
BYTE buf[0x200]; u8 buf[0x200];
dev_dbg(&us->pusb_dev->dev, "transport --- ENE_SMInit\n"); dev_dbg(&us->pusb_dev->dev, "transport --- ENE_SMInit\n");
@ -122,12 +122,12 @@ int ENE_SMInit(struct us_data *us)
/* /*
* ENE_LoadBinCode() * ENE_LoadBinCode()
*/ */
int ENE_LoadBinCode(struct us_data *us, BYTE flag) int ENE_LoadBinCode(struct us_data *us, u8 flag)
{ {
struct bulk_cb_wrap *bcb = (struct bulk_cb_wrap *) us->iobuf; struct bulk_cb_wrap *bcb = (struct bulk_cb_wrap *) us->iobuf;
int result; int result;
/* void *buf; */ /* void *buf; */
PBYTE buf; u8 *buf;
/* dev_info(&us->pusb_dev->dev, "transport --- ENE_LoadBinCode\n"); */ /* dev_info(&us->pusb_dev->dev, "transport --- ENE_LoadBinCode\n"); */
if (us->BIN_FLAG == flag) if (us->BIN_FLAG == flag)
@ -164,7 +164,7 @@ int ENE_LoadBinCode(struct us_data *us, BYTE flag)
/* /*
* ENE_SendScsiCmd(): * ENE_SendScsiCmd():
*/ */
int ENE_SendScsiCmd(struct us_data *us, BYTE fDir, void *buf, int use_sg) int ENE_SendScsiCmd(struct us_data *us, u8 fDir, void *buf, int use_sg)
{ {
struct bulk_cb_wrap *bcb = (struct bulk_cb_wrap *) us->iobuf; struct bulk_cb_wrap *bcb = (struct bulk_cb_wrap *) us->iobuf;
struct bulk_cs_wrap *bcs = (struct bulk_cs_wrap *) us->iobuf; struct bulk_cs_wrap *bcs = (struct bulk_cs_wrap *) us->iobuf;

View File

@ -1,11 +1,11 @@
#include "common.h" #include "common.h"
extern DWORD MediaChange; extern u32 MediaChange;
extern int Check_D_MediaFmt(struct us_data *); extern int Check_D_MediaFmt(struct us_data *);
static BYTE SM_Init[] = { static u8 SM_Init[] = {
0x7B, 0x09, 0x7C, 0xF0, 0x7D, 0x10, 0x7E, 0xE9, 0x7B, 0x09, 0x7C, 0xF0, 0x7D, 0x10, 0x7E, 0xE9,
0x7F, 0xCC, 0x12, 0x2F, 0x71, 0x90, 0xE9, 0xCC, 0x7F, 0xCC, 0x12, 0x2F, 0x71, 0x90, 0xE9, 0xCC,
0xE0, 0xB4, 0x07, 0x12, 0x90, 0xFF, 0x09, 0xE0, 0xE0, 0xB4, 0x07, 0x12, 0x90, 0xFF, 0x09, 0xE0,
@ -263,7 +263,7 @@ static BYTE SM_Init[] = {
0x58, 0x44, 0x2D, 0x49, 0x6E, 0x69, 0x74, 0x20, 0x58, 0x44, 0x2D, 0x49, 0x6E, 0x69, 0x74, 0x20,
0x20, 0x20, 0x20, 0x31, 0x30, 0x30, 0x30, 0x31 }; 0x20, 0x20, 0x20, 0x31, 0x30, 0x30, 0x30, 0x31 };
static BYTE SM_Rdwr[] = { static u8 SM_Rdwr[] = {
0x7B, 0x0C, 0x7C, 0xF0, 0x7D, 0x10, 0x7E, 0xE9, 0x7B, 0x0C, 0x7C, 0xF0, 0x7D, 0x10, 0x7E, 0xE9,
0x7F, 0xCC, 0x12, 0x2F, 0x71, 0x90, 0xE9, 0xC3, 0x7F, 0xCC, 0x12, 0x2F, 0x71, 0x90, 0xE9, 0xC3,
0xE0, 0xB4, 0x73, 0x04, 0x74, 0x40, 0x80, 0x09, 0xE0, 0xB4, 0x73, 0x04, 0x74, 0x40, 0x80, 0x09,

View File

@ -169,29 +169,29 @@ SmartMedia Model & Attribute
Struct Definition Struct Definition
***************************************************************************/ ***************************************************************************/
struct keucr_media_info { struct keucr_media_info {
BYTE Model; u8 Model;
BYTE Attribute; u8 Attribute;
BYTE MaxZones; u8 MaxZones;
BYTE MaxSectors; u8 MaxSectors;
WORD MaxBlocks; u16 MaxBlocks;
WORD MaxLogBlocks; u16 MaxLogBlocks;
}; };
struct keucr_media_address { struct keucr_media_address {
BYTE Zone; /* Zone Number */ u8 Zone; /* Zone Number */
BYTE Sector; /* Sector(512byte) Number on Block */ u8 Sector; /* Sector(512byte) Number on Block */
WORD PhyBlock; /* Physical Block Number on Zone */ u16 PhyBlock; /* Physical Block Number on Zone */
WORD LogBlock; /* Logical Block Number of Zone */ u16 LogBlock; /* Logical Block Number of Zone */
}; };
struct keucr_media_area { struct keucr_media_area {
BYTE Sector; /* Sector(512byte) Number on Block */ u8 Sector; /* Sector(512byte) Number on Block */
WORD PhyBlock; /* Physical Block Number on Zone 0 */ u16 PhyBlock; /* Physical Block Number on Zone 0 */
}; };
extern WORD ReadBlock; extern u16 ReadBlock;
extern WORD WriteBlock; extern u16 WriteBlock;
extern DWORD MediaChange; extern u32 MediaChange;
extern struct keucr_media_info Ssfdc; extern struct keucr_media_info Ssfdc;
extern struct keucr_media_address Media; extern struct keucr_media_address Media;
@ -204,24 +204,24 @@ extern struct keucr_media_area CisArea;
int Init_D_SmartMedia(void); int Init_D_SmartMedia(void);
int Pwoff_D_SmartMedia(void); int Pwoff_D_SmartMedia(void);
int Check_D_SmartMedia(void); int Check_D_SmartMedia(void);
int Check_D_Parameter(struct us_data *, WORD *, BYTE *, BYTE *); int Check_D_Parameter(struct us_data *, u16 *, u8 *, u8 *);
int Media_D_ReadSector(struct us_data *, DWORD, WORD, BYTE *); int Media_D_ReadSector(struct us_data *, u32, u16, u8 *);
int Media_D_WriteSector(struct us_data *, DWORD, WORD, BYTE *); int Media_D_WriteSector(struct us_data *, u32, u16, u8 *);
int Media_D_CopySector(struct us_data *, DWORD, WORD, BYTE *); int Media_D_CopySector(struct us_data *, u32, u16, u8 *);
int Media_D_EraseBlock(struct us_data *, DWORD, WORD); int Media_D_EraseBlock(struct us_data *, u32, u16);
int Media_D_EraseAll(struct us_data *); int Media_D_EraseAll(struct us_data *);
/******************************************/ /******************************************/
int Media_D_OneSectWriteStart(struct us_data *, DWORD, BYTE *); int Media_D_OneSectWriteStart(struct us_data *, u32, u8 *);
int Media_D_OneSectWriteNext(struct us_data *, BYTE *); int Media_D_OneSectWriteNext(struct us_data *, u8 *);
int Media_D_OneSectWriteFlush(struct us_data *); int Media_D_OneSectWriteFlush(struct us_data *);
/******************************************/ /******************************************/
extern int SM_FreeMem(void); /* ENE SM function */ extern int SM_FreeMem(void); /* ENE SM function */
void SM_EnableLED(struct us_data *, BOOLEAN); void SM_EnableLED(struct us_data *, bool);
void Led_D_TernOn(void); void Led_D_TernOn(void);
void Led_D_TernOff(void); void Led_D_TernOff(void);
int Media_D_EraseAllRedtData(DWORD Index, BOOLEAN CheckBlock); int Media_D_EraseAllRedtData(u32 Index, bool CheckBlock);
/*DWORD Media_D_GetMediaInfo(struct us_data * fdoExt, /*DWORD Media_D_GetMediaInfo(struct us_data * fdoExt,
PIOCTL_MEDIA_INFO_IN pParamIn, PIOCTL_MEDIA_INFO_OUT pParamOut); */ PIOCTL_MEDIA_INFO_IN pParamIn, PIOCTL_MEDIA_INFO_OUT pParamOut); */
@ -229,31 +229,31 @@ int Media_D_EraseAllRedtData(DWORD Index, BOOLEAN CheckBlock);
* SMILSub.c * SMILSub.c
*/ */
/******************************************/ /******************************************/
int Check_D_DataBlank(BYTE *); int Check_D_DataBlank(u8 *);
int Check_D_FailBlock(BYTE *); int Check_D_FailBlock(u8 *);
int Check_D_DataStatus(BYTE *); int Check_D_DataStatus(u8 *);
int Load_D_LogBlockAddr(BYTE *); int Load_D_LogBlockAddr(u8 *);
void Clr_D_RedundantData(BYTE *); void Clr_D_RedundantData(u8 *);
void Set_D_LogBlockAddr(BYTE *); void Set_D_LogBlockAddr(u8 *);
void Set_D_FailBlock(BYTE *); void Set_D_FailBlock(u8 *);
void Set_D_DataStaus(BYTE *); void Set_D_DataStaus(u8 *);
/******************************************/ /******************************************/
void Ssfdc_D_Reset(struct us_data *); void Ssfdc_D_Reset(struct us_data *);
int Ssfdc_D_ReadCisSect(struct us_data *, BYTE *, BYTE *); int Ssfdc_D_ReadCisSect(struct us_data *, u8 *, u8 *);
void Ssfdc_D_WriteRedtMode(void); void Ssfdc_D_WriteRedtMode(void);
void Ssfdc_D_ReadID(BYTE *, BYTE); void Ssfdc_D_ReadID(u8 *, u8);
int Ssfdc_D_ReadSect(struct us_data *, BYTE *, BYTE *); int Ssfdc_D_ReadSect(struct us_data *, u8 *, u8 *);
int Ssfdc_D_ReadBlock(struct us_data *, WORD, BYTE *, BYTE *); int Ssfdc_D_ReadBlock(struct us_data *, u16, u8 *, u8 *);
int Ssfdc_D_WriteSect(struct us_data *, BYTE *, BYTE *); int Ssfdc_D_WriteSect(struct us_data *, u8 *, u8 *);
int Ssfdc_D_WriteBlock(struct us_data *, WORD, BYTE *, BYTE *); int Ssfdc_D_WriteBlock(struct us_data *, u16, u8 *, u8 *);
int Ssfdc_D_CopyBlock(struct us_data *, WORD, BYTE *, BYTE *); int Ssfdc_D_CopyBlock(struct us_data *, u16, u8 *, u8 *);
int Ssfdc_D_WriteSectForCopy(struct us_data *, BYTE *, BYTE *); int Ssfdc_D_WriteSectForCopy(struct us_data *, u8 *, u8 *);
int Ssfdc_D_EraseBlock(struct us_data *); int Ssfdc_D_EraseBlock(struct us_data *);
int Ssfdc_D_ReadRedtData(struct us_data *, BYTE *); int Ssfdc_D_ReadRedtData(struct us_data *, u8 *);
int Ssfdc_D_WriteRedtData(struct us_data *, BYTE *); int Ssfdc_D_WriteRedtData(struct us_data *, u8 *);
int Ssfdc_D_CheckStatus(void); int Ssfdc_D_CheckStatus(void);
int Set_D_SsfdcModel(BYTE); int Set_D_SsfdcModel(u8);
void Cnt_D_Reset(void); void Cnt_D_Reset(void);
int Cnt_D_PowerOn(void); int Cnt_D_PowerOn(void);
void Cnt_D_PowerOff(void); void Cnt_D_PowerOff(void);
@ -263,26 +263,26 @@ int Check_D_CntPower(void);
int Check_D_CardExist(void); int Check_D_CardExist(void);
int Check_D_CardStsChg(void); int Check_D_CardStsChg(void);
int Check_D_SsfdcWP(void); int Check_D_SsfdcWP(void);
int SM_ReadBlock(struct us_data *, BYTE *, BYTE *); int SM_ReadBlock(struct us_data *, u8 *, u8 *);
int Ssfdc_D_ReadSect_DMA(struct us_data *, BYTE *, BYTE *); int Ssfdc_D_ReadSect_DMA(struct us_data *, u8 *, u8 *);
int Ssfdc_D_ReadSect_PIO(struct us_data *, BYTE *, BYTE *); int Ssfdc_D_ReadSect_PIO(struct us_data *, u8 *, u8 *);
int Ssfdc_D_WriteSect_DMA(struct us_data *, BYTE *, BYTE *); int Ssfdc_D_WriteSect_DMA(struct us_data *, u8 *, u8 *);
int Ssfdc_D_WriteSect_PIO(struct us_data *, BYTE *, BYTE *); int Ssfdc_D_WriteSect_PIO(struct us_data *, u8 *, u8 *);
/******************************************/ /******************************************/
int Check_D_ReadError(BYTE *); int Check_D_ReadError(u8 *);
int Check_D_Correct(BYTE *, BYTE *); int Check_D_Correct(u8 *, u8 *);
int Check_D_CISdata(BYTE *, BYTE *); int Check_D_CISdata(u8 *, u8 *);
void Set_D_RightECC(BYTE *); void Set_D_RightECC(u8 *);
/* /*
* SMILECC.c * SMILECC.c
*/ */
void calculate_ecc(BYTE *, BYTE *, BYTE *, BYTE *, BYTE *); void calculate_ecc(u8 *, u8 *, u8 *, u8 *, u8 *);
BYTE correct_data(BYTE *, BYTE *, BYTE, BYTE, BYTE); u8 correct_data(u8 *, u8 *, u8, u8, u8);
int _Correct_D_SwECC(BYTE *, BYTE *, BYTE *); int _Correct_D_SwECC(u8 *, u8 *, u8 *);
void _Calculate_D_SwECC(BYTE *, BYTE *); void _Calculate_D_SwECC(u8 *, u8 *);
void SM_Init(void); void SM_Init(void);

View File

@ -13,7 +13,7 @@
/* #include "EMCRIOS.h" */ /* #include "EMCRIOS.h" */
/* CP0-CP5 code table */ /* CP0-CP5 code table */
static BYTE ecctable[256] = { static u8 ecctable[256] = {
0x00, 0x55, 0x56, 0x03, 0x59, 0x0C, 0x0F, 0x5A, 0x5A, 0x0F, 0x0C, 0x59, 0x03, 0x00, 0x55, 0x56, 0x03, 0x59, 0x0C, 0x0F, 0x5A, 0x5A, 0x0F, 0x0C, 0x59, 0x03,
0x56, 0x55, 0x00, 0x65, 0x30, 0x33, 0x66, 0x3C, 0x69, 0x6A, 0x3F, 0x3F, 0x6A, 0x56, 0x55, 0x00, 0x65, 0x30, 0x33, 0x66, 0x3C, 0x69, 0x6A, 0x3F, 0x3F, 0x6A,
0x69, 0x3C, 0x66, 0x33, 0x30, 0x65, 0x66, 0x33, 0x30, 0x65, 0x3F, 0x6A, 0x69, 0x69, 0x3C, 0x66, 0x33, 0x30, 0x65, 0x66, 0x33, 0x30, 0x65, 0x3F, 0x6A, 0x69,
@ -36,7 +36,7 @@ static BYTE ecctable[256] = {
0x5A, 0x5A, 0x0F, 0x0C, 0x59, 0x03, 0x56, 0x55, 0x00 0x5A, 0x5A, 0x0F, 0x0C, 0x59, 0x03, 0x56, 0x55, 0x00
}; };
static void trans_result(BYTE, BYTE, BYTE *, BYTE *); static void trans_result(u8, u8, u8 *, u8 *);
#define BIT7 0x80 #define BIT7 0x80
#define BIT6 0x40 #define BIT6 0x40
@ -57,11 +57,11 @@ static void trans_result(BYTE, BYTE, BYTE *, BYTE *);
* *ecc1; * LP15,LP14,LP13,... * *ecc1; * LP15,LP14,LP13,...
* *ecc2; * LP07,LP06,LP05,... * *ecc2; * LP07,LP06,LP05,...
*/ */
static void trans_result(BYTE reg2, BYTE reg3, BYTE *ecc1, BYTE *ecc2) static void trans_result(u8 reg2, u8 reg3, u8 *ecc1, u8 *ecc2)
{ {
BYTE a; /* Working for reg2,reg3 */ u8 a; /* Working for reg2,reg3 */
BYTE b; /* Working for ecc1,ecc2 */ u8 b; /* Working for ecc1,ecc2 */
BYTE i; /* For counting */ u8 i; /* For counting */
a = BIT7; b = BIT7; /* 80h=10000000b */ a = BIT7; b = BIT7; /* 80h=10000000b */
*ecc1 = *ecc2 = 0; /* Clear ecc1,ecc2 */ *ecc1 = *ecc2 = 0; /* Clear ecc1,ecc2 */
@ -95,21 +95,21 @@ static void trans_result(BYTE reg2, BYTE reg3, BYTE *ecc1, BYTE *ecc2)
* *ecc2; * LP07,LP06,LP05,... * *ecc2; * LP07,LP06,LP05,...
* *ecc3; * CP5,CP4,CP3,...,"1","1" * *ecc3; * CP5,CP4,CP3,...,"1","1"
*/ */
void calculate_ecc(BYTE *table, BYTE *data, BYTE *ecc1, BYTE *ecc2, BYTE *ecc3) void calculate_ecc(u8 *table, u8 *data, u8 *ecc1, u8 *ecc2, u8 *ecc3)
{ {
DWORD i; /* For counting */ u32 i; /* For counting */
BYTE a; /* Working for table */ u8 a; /* Working for table */
BYTE reg1; /* D-all,CP5,CP4,CP3,... */ u8 reg1; /* D-all,CP5,CP4,CP3,... */
BYTE reg2; /* LP14,LP12,L10,... */ u8 reg2; /* LP14,LP12,L10,... */
BYTE reg3; /* LP15,LP13,L11,... */ u8 reg3; /* LP15,LP13,L11,... */
reg1 = reg2 = reg3 = 0; /* Clear parameter */ reg1 = reg2 = reg3 = 0; /* Clear parameter */
for (i = 0; i < 256; ++i) { for (i = 0; i < 256; ++i) {
a = table[data[i]]; /* Get CP0-CP5 code from table */ a = table[data[i]]; /* Get CP0-CP5 code from table */
reg1 ^= (a&MASK_CPS); /* XOR with a */ reg1 ^= (a&MASK_CPS); /* XOR with a */
if ((a&BIT6) != 0) { /* If D_all(all bit XOR) = 1 */ if ((a&BIT6) != 0) { /* If D_all(all bit XOR) = 1 */
reg3 ^= (BYTE)i; /* XOR with counter */ reg3 ^= (u8)i; /* XOR with counter */
reg2 ^= ~((BYTE)i); /* XOR with inv. of counter */ reg2 ^= ~((u8)i); /* XOR with inv. of counter */
} }
} }
@ -127,22 +127,22 @@ void calculate_ecc(BYTE *table, BYTE *data, BYTE *ecc1, BYTE *ecc2, BYTE *ecc3)
* ecc2; * LP07,LP06,LP05,... * ecc2; * LP07,LP06,LP05,...
* ecc3; * CP5,CP4,CP3,...,"1","1" * ecc3; * CP5,CP4,CP3,...,"1","1"
*/ */
BYTE correct_data(BYTE *data, BYTE *eccdata, BYTE ecc1, BYTE ecc2, BYTE ecc3) u8 correct_data(u8 *data, u8 *eccdata, u8 ecc1, u8 ecc2, u8 ecc3)
{ {
DWORD l; /* Working to check d */ u32 l; /* Working to check d */
DWORD d; /* Result of comparison */ u32 d; /* Result of comparison */
DWORD i; /* For counting */ u32 i; /* For counting */
BYTE d1, d2, d3; /* Result of comparison */ u8 d1, d2, d3; /* Result of comparison */
BYTE a; /* Working for add */ u8 a; /* Working for add */
BYTE add; /* Byte address of cor. DATA */ u8 add; /* Byte address of cor. DATA */
BYTE b; /* Working for bit */ u8 b; /* Working for bit */
BYTE bit; /* Bit address of cor. DATA */ u8 bit; /* Bit address of cor. DATA */
d1 = ecc1^eccdata[1]; d2 = ecc2^eccdata[0]; /* Compare LP's */ d1 = ecc1^eccdata[1]; d2 = ecc2^eccdata[0]; /* Compare LP's */
d3 = ecc3^eccdata[2]; /* Compare CP's */ d3 = ecc3^eccdata[2]; /* Compare CP's */
d = ((DWORD)d1<<16) /* Result of comparison */ d = ((u32)d1<<16) /* Result of comparison */
+((DWORD)d2<<8) +((u32)d2<<8)
+(DWORD)d3; +(u32)d3;
if (d == 0) if (d == 0)
return 0; /* If No error, return */ return 0; /* If No error, return */
@ -188,9 +188,9 @@ BYTE correct_data(BYTE *data, BYTE *eccdata, BYTE ecc1, BYTE ecc2, BYTE ecc3)
return 3; /* Uncorrectable error */ return 3; /* Uncorrectable error */
} }
int _Correct_D_SwECC(BYTE *buf, BYTE *redundant_ecc, BYTE *calculate_ecc) int _Correct_D_SwECC(u8 *buf, u8 *redundant_ecc, u8 *calculate_ecc)
{ {
DWORD err; u32 err;
err = correct_data(buf, redundant_ecc, *(calculate_ecc + 1), err = correct_data(buf, redundant_ecc, *(calculate_ecc + 1),
*(calculate_ecc), *(calculate_ecc + 2)); *(calculate_ecc), *(calculate_ecc + 2));
@ -203,7 +203,7 @@ int _Correct_D_SwECC(BYTE *buf, BYTE *redundant_ecc, BYTE *calculate_ecc)
return -1; return -1;
} }
void _Calculate_D_SwECC(BYTE *buf, BYTE *ecc) void _Calculate_D_SwECC(u8 *buf, u8 *ecc)
{ {
calculate_ecc(ecctable, buf, ecc+1, ecc+0, ecc+2); calculate_ecc(ecctable, buf, ecc+1, ecc+0, ecc+2);
} }

View File

@ -4,11 +4,11 @@
#include "smcommon.h" #include "smcommon.h"
#include "smil.h" #include "smil.h"
static int Conv_D_MediaAddr(struct us_data *, DWORD); static int Conv_D_MediaAddr(struct us_data *, u32);
static int Inc_D_MediaAddr(struct us_data *); static int Inc_D_MediaAddr(struct us_data *);
static int Media_D_ReadOneSect(struct us_data *, WORD, BYTE *); static int Media_D_ReadOneSect(struct us_data *, u16, u8 *);
static int Copy_D_BlockAll(struct us_data *, DWORD); static int Copy_D_BlockAll(struct us_data *, u32);
static int Assign_D_WriteBlock(void); static int Assign_D_WriteBlock(void);
static int Release_D_ReadBlock(struct us_data *); static int Release_D_ReadBlock(struct us_data *);
@ -16,7 +16,7 @@ static int Release_D_WriteBlock(struct us_data *);
static int Release_D_CopySector(struct us_data *); static int Release_D_CopySector(struct us_data *);
static int Copy_D_PhyOneSect(struct us_data *); static int Copy_D_PhyOneSect(struct us_data *);
static int Read_D_PhyOneSect(struct us_data *, WORD, BYTE *); static int Read_D_PhyOneSect(struct us_data *, u16, u8 *);
static int Erase_D_PhyOneBlock(struct us_data *); static int Erase_D_PhyOneBlock(struct us_data *);
static int Set_D_PhyFmtValue(struct us_data *); static int Set_D_PhyFmtValue(struct us_data *);
@ -25,24 +25,24 @@ static int Make_D_LogTable(struct us_data *);
static int MarkFail_D_PhyOneBlock(struct us_data *); static int MarkFail_D_PhyOneBlock(struct us_data *);
static DWORD ErrCode; static u32 ErrCode;
static BYTE WorkBuf[SECTSIZE]; static u8 WorkBuf[SECTSIZE];
static BYTE Redundant[REDTSIZE]; static u8 Redundant[REDTSIZE];
static BYTE WorkRedund[REDTSIZE]; static u8 WorkRedund[REDTSIZE];
/* 128 x 1000, Log2Phy[MAX_ZONENUM][MAX_LOGBLOCK]; */ /* 128 x 1000, Log2Phy[MAX_ZONENUM][MAX_LOGBLOCK]; */
static WORD *Log2Phy[MAX_ZONENUM]; static u16 *Log2Phy[MAX_ZONENUM];
static BYTE Assign[MAX_ZONENUM][MAX_BLOCKNUM / 8]; static u8 Assign[MAX_ZONENUM][MAX_BLOCKNUM / 8];
static WORD AssignStart[MAX_ZONENUM]; static u16 AssignStart[MAX_ZONENUM];
WORD ReadBlock; u16 ReadBlock;
WORD WriteBlock; u16 WriteBlock;
DWORD MediaChange; u32 MediaChange;
static DWORD SectCopyMode; static u32 SectCopyMode;
/* BIT Control Macro */ /* BIT Control Macro */
static BYTE BitData[] = { 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80 }; static u8 BitData[] = { 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80 };
#define Set_D_Bit(a, b) (a[(BYTE)((b) / 8)] |= BitData[(b) % 8]) #define Set_D_Bit(a, b) (a[(u8)((b) / 8)] |= BitData[(b) % 8])
#define Clr_D_Bit(a, b) (a[(BYTE)((b) / 8)] &= ~BitData[(b) % 8]) #define Clr_D_Bit(a, b) (a[(u8)((b) / 8)] &= ~BitData[(b) % 8])
#define Chk_D_Bit(a, b) (a[(BYTE)((b) / 8)] & BitData[(b) % 8]) #define Chk_D_Bit(a, b) (a[(u8)((b) / 8)] & BitData[(b) % 8])
/* ----- SM_FreeMem() ------------------------------------------------- */ /* ----- SM_FreeMem() ------------------------------------------------- */
int SM_FreeMem(void) int SM_FreeMem(void)
@ -62,9 +62,9 @@ int SM_FreeMem(void)
/* SmartMedia Read/Write/Erase Function */ /* SmartMedia Read/Write/Erase Function */
/* ----- Media_D_ReadSector() ------------------------------------------- */ /* ----- Media_D_ReadSector() ------------------------------------------- */
int Media_D_ReadSector(struct us_data *us, DWORD start, WORD count, BYTE *buf) int Media_D_ReadSector(struct us_data *us, u32 start, u16 count, u8 *buf)
{ {
WORD len, bn; u16 len, bn;
if (Conv_D_MediaAddr(us, start)) if (Conv_D_MediaAddr(us, start))
return ErrCode; return ErrCode;
@ -97,9 +97,9 @@ int Media_D_ReadSector(struct us_data *us, DWORD start, WORD count, BYTE *buf)
} }
/* here */ /* here */
/* ----- Media_D_CopySector() ------------------------------------------ */ /* ----- Media_D_CopySector() ------------------------------------------ */
int Media_D_CopySector(struct us_data *us, DWORD start, WORD count, BYTE *buf) int Media_D_CopySector(struct us_data *us, u32 start, u16 count, u8 *buf)
{ {
WORD len, bn; u16 len, bn;
/* pr_info("Media_D_CopySector !!!\n"); */ /* pr_info("Media_D_CopySector !!!\n"); */
if (Conv_D_MediaAddr(us, start)) if (Conv_D_MediaAddr(us, start))
@ -186,12 +186,12 @@ int Check_D_MediaFmt(struct us_data *us)
/* SmartMedia Physical Address Control Subroutine */ /* SmartMedia Physical Address Control Subroutine */
/* ----- Conv_D_MediaAddr() --------------------------------------------- */ /* ----- Conv_D_MediaAddr() --------------------------------------------- */
static int Conv_D_MediaAddr(struct us_data *us, DWORD addr) static int Conv_D_MediaAddr(struct us_data *us, u32 addr)
{ {
DWORD temp; u32 temp;
temp = addr / Ssfdc.MaxSectors; temp = addr / Ssfdc.MaxSectors;
Media.Zone = (BYTE) (temp / Ssfdc.MaxLogBlocks); Media.Zone = (u8) (temp / Ssfdc.MaxLogBlocks);
if (Log2Phy[Media.Zone] == NULL) { if (Log2Phy[Media.Zone] == NULL) {
if (Make_D_LogTable(us)) { if (Make_D_LogTable(us)) {
@ -200,8 +200,8 @@ static int Conv_D_MediaAddr(struct us_data *us, DWORD addr)
} }
} }
Media.Sector = (BYTE) (addr % Ssfdc.MaxSectors); Media.Sector = (u8) (addr % Ssfdc.MaxSectors);
Media.LogBlock = (WORD) (temp % Ssfdc.MaxLogBlocks); Media.LogBlock = (u16) (temp % Ssfdc.MaxLogBlocks);
if (Media.Zone < Ssfdc.MaxZones) { if (Media.Zone < Ssfdc.MaxZones) {
Clr_D_RedundantData(Redundant); Clr_D_RedundantData(Redundant);
@ -217,7 +217,7 @@ static int Conv_D_MediaAddr(struct us_data *us, DWORD addr)
/* ----- Inc_D_MediaAddr() ---------------------------------------------- */ /* ----- Inc_D_MediaAddr() ---------------------------------------------- */
static int Inc_D_MediaAddr(struct us_data *us) static int Inc_D_MediaAddr(struct us_data *us)
{ {
WORD LogBlock = Media.LogBlock; u16 LogBlock = Media.LogBlock;
if (++Media.Sector < Ssfdc.MaxSectors) if (++Media.Sector < Ssfdc.MaxSectors)
return SMSUCCESS; return SMSUCCESS;
@ -265,9 +265,9 @@ static int Inc_D_MediaAddr(struct us_data *us)
/* SmartMedia Read/Write Subroutine with Retry */ /* SmartMedia Read/Write Subroutine with Retry */
/* ----- Media_D_ReadOneSect() ------------------------------------------ */ /* ----- Media_D_ReadOneSect() ------------------------------------------ */
static int Media_D_ReadOneSect(struct us_data *us, WORD count, BYTE *buf) static int Media_D_ReadOneSect(struct us_data *us, u16 count, u8 *buf)
{ {
DWORD err, retry; u32 err, retry;
if (!Read_D_PhyOneSect(us, count, buf)) if (!Read_D_PhyOneSect(us, count, buf))
return SMSUCCESS; return SMSUCCESS;
@ -309,9 +309,9 @@ static int Media_D_ReadOneSect(struct us_data *us, WORD count, BYTE *buf)
/* SmartMedia Physical Sector Data Copy Subroutine */ /* SmartMedia Physical Sector Data Copy Subroutine */
/* ----- Copy_D_BlockAll() ---------------------------------------------- */ /* ----- Copy_D_BlockAll() ---------------------------------------------- */
static int Copy_D_BlockAll(struct us_data *us, DWORD mode) static int Copy_D_BlockAll(struct us_data *us, u32 mode)
{ {
BYTE sect; u8 sect;
sect = Media.Sector; sect = Media.Sector;
@ -381,7 +381,7 @@ static int Assign_D_WriteBlock(void)
/* ----- Release_D_ReadBlock() ------------------------------------------ */ /* ----- Release_D_ReadBlock() ------------------------------------------ */
static int Release_D_ReadBlock(struct us_data *us) static int Release_D_ReadBlock(struct us_data *us)
{ {
DWORD mode; u32 mode;
mode = SectCopyMode; mode = SectCopyMode;
SectCopyMode = COMPLETED; SectCopyMode = COMPLETED;
@ -430,7 +430,7 @@ static int Release_D_WriteBlock(struct us_data *us)
static int Copy_D_PhyOneSect(struct us_data *us) static int Copy_D_PhyOneSect(struct us_data *us)
{ {
int i; int i;
DWORD err, retry; u32 err, retry;
/* pr_info("Copy_D_PhyOneSect --- Sector = %x\n", Media.Sector); */ /* pr_info("Copy_D_PhyOneSect --- Sector = %x\n", Media.Sector); */
if (ReadBlock != NO_ASSIGN) { if (ReadBlock != NO_ASSIGN) {
@ -504,10 +504,10 @@ static int Copy_D_PhyOneSect(struct us_data *us)
/* SmartMedia Physical Sector Read/Write/Erase Subroutine */ /* SmartMedia Physical Sector Read/Write/Erase Subroutine */
/* ----- Read_D_PhyOneSect() -------------------------------------------- */ /* ----- Read_D_PhyOneSect() -------------------------------------------- */
static int Read_D_PhyOneSect(struct us_data *us, WORD count, BYTE *buf) static int Read_D_PhyOneSect(struct us_data *us, u16 count, u8 *buf)
{ {
int i; int i;
DWORD retry; u32 retry;
if (Media.PhyBlock == NO_ASSIGN) { if (Media.PhyBlock == NO_ASSIGN) {
for (i = 0; i < SECTSIZE; i++) for (i = 0; i < SECTSIZE; i++)
@ -637,10 +637,10 @@ static int Search_D_CIS(struct us_data *us)
/* ----- Make_D_LogTable() ---------------------------------------------- */ /* ----- Make_D_LogTable() ---------------------------------------------- */
static int Make_D_LogTable(struct us_data *us) static int Make_D_LogTable(struct us_data *us)
{ {
WORD phyblock, logblock; u16 phyblock, logblock;
if (Log2Phy[Media.Zone] == NULL) { if (Log2Phy[Media.Zone] == NULL) {
Log2Phy[Media.Zone] = kmalloc(MAX_LOGBLOCK * sizeof(WORD), Log2Phy[Media.Zone] = kmalloc(MAX_LOGBLOCK * sizeof(u16),
GFP_KERNEL); GFP_KERNEL);
/* pr_info("ExAllocatePool Zone = %x, Addr = %x\n", /* pr_info("ExAllocatePool Zone = %x, Addr = %x\n",
Media.Zone, Log2Phy[Media.Zone]); */ Media.Zone, Log2Phy[Media.Zone]); */
@ -693,7 +693,7 @@ static int Make_D_LogTable(struct us_data *us)
phyblock = Media.PhyBlock; phyblock = Media.PhyBlock;
logblock = Media.LogBlock; logblock = Media.LogBlock;
Media.Sector = (BYTE)(Ssfdc.MaxSectors - 1); Media.Sector = (u8)(Ssfdc.MaxSectors - 1);
if (Ssfdc_D_ReadRedtData(us, Redundant)) { if (Ssfdc_D_ReadRedtData(us, Redundant)) {
Ssfdc_D_Reset(us); Ssfdc_D_Reset(us);
@ -738,7 +738,7 @@ static int Make_D_LogTable(struct us_data *us)
/* ----- MarkFail_D_PhyOneBlock() --------------------------------------- */ /* ----- MarkFail_D_PhyOneBlock() --------------------------------------- */
static int MarkFail_D_PhyOneBlock(struct us_data *us) static int MarkFail_D_PhyOneBlock(struct us_data *us)
{ {
BYTE sect; u8 sect;
sect = Media.Sector; sect = Media.Sector;
Set_D_FailBlock(WorkRedund); Set_D_FailBlock(WorkRedund);

View File

@ -6,16 +6,16 @@
#include "smcommon.h" #include "smcommon.h"
#include "smil.h" #include "smil.h"
static BYTE _Check_D_DevCode(BYTE); static u8 _Check_D_DevCode(u8);
static DWORD ErrXDCode; static u32 ErrXDCode;
static BYTE IsSSFDCCompliance; static u8 IsSSFDCCompliance;
static BYTE IsXDCompliance; static u8 IsXDCompliance;
struct keucr_media_info Ssfdc; struct keucr_media_info Ssfdc;
struct keucr_media_address Media; struct keucr_media_address Media;
struct keucr_media_area CisArea; struct keucr_media_area CisArea;
static BYTE EccBuf[6]; static u8 EccBuf[6];
#define EVEN 0 /* Even Page for 256byte/page */ #define EVEN 0 /* Even Page for 256byte/page */
#define ODD 1 /* Odd Page for 256byte/page */ #define ODD 1 /* Odd Page for 256byte/page */
@ -24,7 +24,7 @@ static BYTE EccBuf[6];
/* SmartMedia Redundant buffer data Control Subroutine /* SmartMedia Redundant buffer data Control Subroutine
*----- Check_D_DataBlank() -------------------------------------------- *----- Check_D_DataBlank() --------------------------------------------
*/ */
int Check_D_DataBlank(BYTE *redundant) int Check_D_DataBlank(u8 *redundant)
{ {
char i; char i;
@ -36,7 +36,7 @@ int Check_D_DataBlank(BYTE *redundant)
} }
/* ----- Check_D_FailBlock() -------------------------------------------- */ /* ----- Check_D_FailBlock() -------------------------------------------- */
int Check_D_FailBlock(BYTE *redundant) int Check_D_FailBlock(u8 *redundant)
{ {
redundant += REDT_BLOCK; redundant += REDT_BLOCK;
@ -51,7 +51,7 @@ int Check_D_FailBlock(BYTE *redundant)
} }
/* ----- Check_D_DataStatus() ------------------------------------------- */ /* ----- Check_D_DataStatus() ------------------------------------------- */
int Check_D_DataStatus(BYTE *redundant) int Check_D_DataStatus(u8 *redundant)
{ {
redundant += REDT_DATA; redundant += REDT_DATA;
@ -70,14 +70,14 @@ int Check_D_DataStatus(BYTE *redundant)
} }
/* ----- Load_D_LogBlockAddr() ------------------------------------------ */ /* ----- Load_D_LogBlockAddr() ------------------------------------------ */
int Load_D_LogBlockAddr(BYTE *redundant) int Load_D_LogBlockAddr(u8 *redundant)
{ {
WORD addr1, addr2; u16 addr1, addr2;
addr1 = (WORD)*(redundant + REDT_ADDR1H)*0x0100 + addr1 = (u16)*(redundant + REDT_ADDR1H)*0x0100 +
(WORD)*(redundant + REDT_ADDR1L); (u16)*(redundant + REDT_ADDR1L);
addr2 = (WORD)*(redundant + REDT_ADDR2H)*0x0100 + addr2 = (u16)*(redundant + REDT_ADDR2H)*0x0100 +
(WORD)*(redundant + REDT_ADDR2L); (u16)*(redundant + REDT_ADDR2L);
if (addr1 == addr2) if (addr1 == addr2)
if ((addr1 & 0xF000) == 0x1000) { if ((addr1 & 0xF000) == 0x1000) {
@ -85,7 +85,7 @@ int Load_D_LogBlockAddr(BYTE *redundant)
return SMSUCCESS; return SMSUCCESS;
} }
if (hweight16((WORD)(addr1^addr2)) != 0x01) if (hweight16((u16)(addr1^addr2)) != 0x01)
return ERROR; return ERROR;
if ((addr1 & 0xF000) == 0x1000) if ((addr1 & 0xF000) == 0x1000)
@ -104,7 +104,7 @@ int Load_D_LogBlockAddr(BYTE *redundant)
} }
/* ----- Clr_D_RedundantData() ------------------------------------------ */ /* ----- Clr_D_RedundantData() ------------------------------------------ */
void Clr_D_RedundantData(BYTE *redundant) void Clr_D_RedundantData(u8 *redundant)
{ {
char i; char i;
@ -113,9 +113,9 @@ void Clr_D_RedundantData(BYTE *redundant)
} }
/* ----- Set_D_LogBlockAddr() ------------------------------------------- */ /* ----- Set_D_LogBlockAddr() ------------------------------------------- */
void Set_D_LogBlockAddr(BYTE *redundant) void Set_D_LogBlockAddr(u8 *redundant)
{ {
WORD addr; u16 addr;
*(redundant + REDT_BLOCK) = 0xFF; *(redundant + REDT_BLOCK) = 0xFF;
*(redundant + REDT_DATA) = 0xFF; *(redundant + REDT_DATA) = 0xFF;
@ -125,20 +125,20 @@ void Set_D_LogBlockAddr(BYTE *redundant)
addr++; addr++;
*(redundant + REDT_ADDR1H) = *(redundant + REDT_ADDR2H) = *(redundant + REDT_ADDR1H) = *(redundant + REDT_ADDR2H) =
(BYTE)(addr / 0x0100); (u8)(addr / 0x0100);
*(redundant + REDT_ADDR1L) = *(redundant + REDT_ADDR2L) = (BYTE)addr; *(redundant + REDT_ADDR1L) = *(redundant + REDT_ADDR2L) = (u8)addr;
} }
/*----- Set_D_FailBlock() ---------------------------------------------- */ /*----- Set_D_FailBlock() ---------------------------------------------- */
void Set_D_FailBlock(BYTE *redundant) void Set_D_FailBlock(u8 *redundant)
{ {
char i; char i;
for (i = 0; i < REDTSIZE; i++) for (i = 0; i < REDTSIZE; i++)
*redundant++ = (BYTE)((i == REDT_BLOCK) ? 0xF0 : 0xFF); *redundant++ = (u8)((i == REDT_BLOCK) ? 0xF0 : 0xFF);
} }
/* ----- Set_D_DataStaus() ---------------------------------------------- */ /* ----- Set_D_DataStaus() ---------------------------------------------- */
void Set_D_DataStaus(BYTE *redundant) void Set_D_DataStaus(u8 *redundant)
{ {
redundant += REDT_DATA; redundant += REDT_DATA;
*redundant = 0x00; *redundant = 0x00;
@ -154,10 +154,10 @@ void Ssfdc_D_Reset(struct us_data *us)
} }
/* ----- Ssfdc_D_ReadCisSect() ------------------------------------------ */ /* ----- Ssfdc_D_ReadCisSect() ------------------------------------------ */
int Ssfdc_D_ReadCisSect(struct us_data *us, BYTE *buf, BYTE *redundant) int Ssfdc_D_ReadCisSect(struct us_data *us, u8 *buf, u8 *redundant)
{ {
BYTE zone, sector; u8 zone, sector;
WORD block; u16 block;
zone = Media.Zone; block = Media.PhyBlock; sector = Media.Sector; zone = Media.Zone; block = Media.PhyBlock; sector = Media.Sector;
Media.Zone = 0; Media.Zone = 0;
@ -177,11 +177,11 @@ int Ssfdc_D_ReadCisSect(struct us_data *us, BYTE *buf, BYTE *redundant)
/* 6250 CMD 1 */ /* 6250 CMD 1 */
/* ----- Ssfdc_D_ReadSect() --------------------------------------------- */ /* ----- Ssfdc_D_ReadSect() --------------------------------------------- */
int Ssfdc_D_ReadSect(struct us_data *us, BYTE *buf, BYTE *redundant) int Ssfdc_D_ReadSect(struct us_data *us, u8 *buf, u8 *redundant)
{ {
struct bulk_cb_wrap *bcb = (struct bulk_cb_wrap *) us->iobuf; struct bulk_cb_wrap *bcb = (struct bulk_cb_wrap *) us->iobuf;
int result; int result;
WORD addr; u16 addr;
result = ENE_LoadBinCode(us, SM_RW_PATTERN); result = ENE_LoadBinCode(us, SM_RW_PATTERN);
if (result != USB_STOR_XFER_GOOD) { if (result != USB_STOR_XFER_GOOD) {
@ -190,8 +190,8 @@ int Ssfdc_D_ReadSect(struct us_data *us, BYTE *buf, BYTE *redundant)
return USB_STOR_TRANSPORT_ERROR; return USB_STOR_TRANSPORT_ERROR;
} }
addr = (WORD)Media.Zone*Ssfdc.MaxBlocks + Media.PhyBlock; addr = (u16)Media.Zone*Ssfdc.MaxBlocks + Media.PhyBlock;
addr = addr*(WORD)Ssfdc.MaxSectors + Media.Sector; addr = addr*(u16)Ssfdc.MaxSectors + Media.Sector;
/* Read sect data */ /* Read sect data */
memset(bcb, 0, sizeof(struct bulk_cb_wrap)); memset(bcb, 0, sizeof(struct bulk_cb_wrap));
@ -200,8 +200,8 @@ int Ssfdc_D_ReadSect(struct us_data *us, BYTE *buf, BYTE *redundant)
bcb->Flags = 0x80; bcb->Flags = 0x80;
bcb->CDB[0] = 0xF1; bcb->CDB[0] = 0xF1;
bcb->CDB[1] = 0x02; bcb->CDB[1] = 0x02;
bcb->CDB[4] = (BYTE)addr; bcb->CDB[4] = (u8)addr;
bcb->CDB[3] = (BYTE)(addr / 0x0100); bcb->CDB[3] = (u8)(addr / 0x0100);
bcb->CDB[2] = Media.Zone / 2; bcb->CDB[2] = Media.Zone / 2;
result = ENE_SendScsiCmd(us, FDIR_READ, buf, 0); result = ENE_SendScsiCmd(us, FDIR_READ, buf, 0);
@ -215,8 +215,8 @@ int Ssfdc_D_ReadSect(struct us_data *us, BYTE *buf, BYTE *redundant)
bcb->Flags = 0x80; bcb->Flags = 0x80;
bcb->CDB[0] = 0xF1; bcb->CDB[0] = 0xF1;
bcb->CDB[1] = 0x03; bcb->CDB[1] = 0x03;
bcb->CDB[4] = (BYTE)addr; bcb->CDB[4] = (u8)addr;
bcb->CDB[3] = (BYTE)(addr / 0x0100); bcb->CDB[3] = (u8)(addr / 0x0100);
bcb->CDB[2] = Media.Zone / 2; bcb->CDB[2] = Media.Zone / 2;
bcb->CDB[8] = 0; bcb->CDB[8] = 0;
bcb->CDB[9] = 1; bcb->CDB[9] = 1;
@ -229,12 +229,12 @@ int Ssfdc_D_ReadSect(struct us_data *us, BYTE *buf, BYTE *redundant)
} }
/* ----- Ssfdc_D_ReadBlock() --------------------------------------------- */ /* ----- Ssfdc_D_ReadBlock() --------------------------------------------- */
int Ssfdc_D_ReadBlock(struct us_data *us, WORD count, BYTE *buf, int Ssfdc_D_ReadBlock(struct us_data *us, u16 count, u8 *buf,
BYTE *redundant) u8 *redundant)
{ {
struct bulk_cb_wrap *bcb = (struct bulk_cb_wrap *) us->iobuf; struct bulk_cb_wrap *bcb = (struct bulk_cb_wrap *) us->iobuf;
int result; int result;
WORD addr; u16 addr;
result = ENE_LoadBinCode(us, SM_RW_PATTERN); result = ENE_LoadBinCode(us, SM_RW_PATTERN);
if (result != USB_STOR_XFER_GOOD) { if (result != USB_STOR_XFER_GOOD) {
@ -243,8 +243,8 @@ int Ssfdc_D_ReadBlock(struct us_data *us, WORD count, BYTE *buf,
return USB_STOR_TRANSPORT_ERROR; return USB_STOR_TRANSPORT_ERROR;
} }
addr = (WORD)Media.Zone*Ssfdc.MaxBlocks + Media.PhyBlock; addr = (u16)Media.Zone*Ssfdc.MaxBlocks + Media.PhyBlock;
addr = addr*(WORD)Ssfdc.MaxSectors + Media.Sector; addr = addr*(u16)Ssfdc.MaxSectors + Media.Sector;
/* Read sect data */ /* Read sect data */
memset(bcb, 0, sizeof(struct bulk_cb_wrap)); memset(bcb, 0, sizeof(struct bulk_cb_wrap));
@ -253,8 +253,8 @@ int Ssfdc_D_ReadBlock(struct us_data *us, WORD count, BYTE *buf,
bcb->Flags = 0x80; bcb->Flags = 0x80;
bcb->CDB[0] = 0xF1; bcb->CDB[0] = 0xF1;
bcb->CDB[1] = 0x02; bcb->CDB[1] = 0x02;
bcb->CDB[4] = (BYTE)addr; bcb->CDB[4] = (u8)addr;
bcb->CDB[3] = (BYTE)(addr / 0x0100); bcb->CDB[3] = (u8)(addr / 0x0100);
bcb->CDB[2] = Media.Zone / 2; bcb->CDB[2] = Media.Zone / 2;
result = ENE_SendScsiCmd(us, FDIR_READ, buf, 0); result = ENE_SendScsiCmd(us, FDIR_READ, buf, 0);
@ -268,8 +268,8 @@ int Ssfdc_D_ReadBlock(struct us_data *us, WORD count, BYTE *buf,
bcb->Flags = 0x80; bcb->Flags = 0x80;
bcb->CDB[0] = 0xF1; bcb->CDB[0] = 0xF1;
bcb->CDB[1] = 0x03; bcb->CDB[1] = 0x03;
bcb->CDB[4] = (BYTE)addr; bcb->CDB[4] = (u8)addr;
bcb->CDB[3] = (BYTE)(addr / 0x0100); bcb->CDB[3] = (u8)(addr / 0x0100);
bcb->CDB[2] = Media.Zone / 2; bcb->CDB[2] = Media.Zone / 2;
bcb->CDB[8] = 0; bcb->CDB[8] = 0;
bcb->CDB[9] = 1; bcb->CDB[9] = 1;
@ -283,12 +283,12 @@ int Ssfdc_D_ReadBlock(struct us_data *us, WORD count, BYTE *buf,
/* ----- Ssfdc_D_CopyBlock() -------------------------------------------- */ /* ----- Ssfdc_D_CopyBlock() -------------------------------------------- */
int Ssfdc_D_CopyBlock(struct us_data *us, WORD count, BYTE *buf, int Ssfdc_D_CopyBlock(struct us_data *us, u16 count, u8 *buf,
BYTE *redundant) u8 *redundant)
{ {
struct bulk_cb_wrap *bcb = (struct bulk_cb_wrap *) us->iobuf; struct bulk_cb_wrap *bcb = (struct bulk_cb_wrap *) us->iobuf;
int result; int result;
WORD ReadAddr, WriteAddr; u16 ReadAddr, WriteAddr;
result = ENE_LoadBinCode(us, SM_RW_PATTERN); result = ENE_LoadBinCode(us, SM_RW_PATTERN);
if (result != USB_STOR_XFER_GOOD) { if (result != USB_STOR_XFER_GOOD) {
@ -297,10 +297,10 @@ int Ssfdc_D_CopyBlock(struct us_data *us, WORD count, BYTE *buf,
return USB_STOR_TRANSPORT_ERROR; return USB_STOR_TRANSPORT_ERROR;
} }
ReadAddr = (WORD)Media.Zone*Ssfdc.MaxBlocks + ReadBlock; ReadAddr = (u16)Media.Zone*Ssfdc.MaxBlocks + ReadBlock;
ReadAddr = ReadAddr*(WORD)Ssfdc.MaxSectors; ReadAddr = ReadAddr*(u16)Ssfdc.MaxSectors;
WriteAddr = (WORD)Media.Zone*Ssfdc.MaxBlocks + WriteBlock; WriteAddr = (u16)Media.Zone*Ssfdc.MaxBlocks + WriteBlock;
WriteAddr = WriteAddr*(WORD)Ssfdc.MaxSectors; WriteAddr = WriteAddr*(u16)Ssfdc.MaxSectors;
/* Write sect data */ /* Write sect data */
memset(bcb, 0, sizeof(struct bulk_cb_wrap)); memset(bcb, 0, sizeof(struct bulk_cb_wrap));
@ -309,16 +309,16 @@ int Ssfdc_D_CopyBlock(struct us_data *us, WORD count, BYTE *buf,
bcb->Flags = 0x00; bcb->Flags = 0x00;
bcb->CDB[0] = 0xF0; bcb->CDB[0] = 0xF0;
bcb->CDB[1] = 0x08; bcb->CDB[1] = 0x08;
bcb->CDB[7] = (BYTE)WriteAddr; bcb->CDB[7] = (u8)WriteAddr;
bcb->CDB[6] = (BYTE)(WriteAddr / 0x0100); bcb->CDB[6] = (u8)(WriteAddr / 0x0100);
bcb->CDB[5] = Media.Zone / 2; bcb->CDB[5] = Media.Zone / 2;
bcb->CDB[8] = *(redundant + REDT_ADDR1H); bcb->CDB[8] = *(redundant + REDT_ADDR1H);
bcb->CDB[9] = *(redundant + REDT_ADDR1L); bcb->CDB[9] = *(redundant + REDT_ADDR1L);
bcb->CDB[10] = Media.Sector; bcb->CDB[10] = Media.Sector;
if (ReadBlock != NO_ASSIGN) { if (ReadBlock != NO_ASSIGN) {
bcb->CDB[4] = (BYTE)ReadAddr; bcb->CDB[4] = (u8)ReadAddr;
bcb->CDB[3] = (BYTE)(ReadAddr / 0x0100); bcb->CDB[3] = (u8)(ReadAddr / 0x0100);
bcb->CDB[2] = Media.Zone / 2; bcb->CDB[2] = Media.Zone / 2;
} else } else
bcb->CDB[11] = 1; bcb->CDB[11] = 1;
@ -331,11 +331,11 @@ int Ssfdc_D_CopyBlock(struct us_data *us, WORD count, BYTE *buf,
} }
/* ----- Ssfdc_D_WriteSectForCopy() ------------------------------------- */ /* ----- Ssfdc_D_WriteSectForCopy() ------------------------------------- */
int Ssfdc_D_WriteSectForCopy(struct us_data *us, BYTE *buf, BYTE *redundant) int Ssfdc_D_WriteSectForCopy(struct us_data *us, u8 *buf, u8 *redundant)
{ {
struct bulk_cb_wrap *bcb = (struct bulk_cb_wrap *) us->iobuf; struct bulk_cb_wrap *bcb = (struct bulk_cb_wrap *) us->iobuf;
int result; int result;
WORD addr; u16 addr;
result = ENE_LoadBinCode(us, SM_RW_PATTERN); result = ENE_LoadBinCode(us, SM_RW_PATTERN);
if (result != USB_STOR_XFER_GOOD) { if (result != USB_STOR_XFER_GOOD) {
@ -345,8 +345,8 @@ int Ssfdc_D_WriteSectForCopy(struct us_data *us, BYTE *buf, BYTE *redundant)
} }
addr = (WORD)Media.Zone*Ssfdc.MaxBlocks + Media.PhyBlock; addr = (u16)Media.Zone*Ssfdc.MaxBlocks + Media.PhyBlock;
addr = addr*(WORD)Ssfdc.MaxSectors + Media.Sector; addr = addr*(u16)Ssfdc.MaxSectors + Media.Sector;
/* Write sect data */ /* Write sect data */
memset(bcb, 0, sizeof(struct bulk_cb_wrap)); memset(bcb, 0, sizeof(struct bulk_cb_wrap));
@ -355,8 +355,8 @@ int Ssfdc_D_WriteSectForCopy(struct us_data *us, BYTE *buf, BYTE *redundant)
bcb->Flags = 0x00; bcb->Flags = 0x00;
bcb->CDB[0] = 0xF0; bcb->CDB[0] = 0xF0;
bcb->CDB[1] = 0x04; bcb->CDB[1] = 0x04;
bcb->CDB[7] = (BYTE)addr; bcb->CDB[7] = (u8)addr;
bcb->CDB[6] = (BYTE)(addr / 0x0100); bcb->CDB[6] = (u8)(addr / 0x0100);
bcb->CDB[5] = Media.Zone / 2; bcb->CDB[5] = Media.Zone / 2;
bcb->CDB[8] = *(redundant + REDT_ADDR1H); bcb->CDB[8] = *(redundant + REDT_ADDR1H);
bcb->CDB[9] = *(redundant + REDT_ADDR1L); bcb->CDB[9] = *(redundant + REDT_ADDR1L);
@ -374,7 +374,7 @@ int Ssfdc_D_EraseBlock(struct us_data *us)
{ {
struct bulk_cb_wrap *bcb = (struct bulk_cb_wrap *) us->iobuf; struct bulk_cb_wrap *bcb = (struct bulk_cb_wrap *) us->iobuf;
int result; int result;
WORD addr; u16 addr;
result = ENE_LoadBinCode(us, SM_RW_PATTERN); result = ENE_LoadBinCode(us, SM_RW_PATTERN);
if (result != USB_STOR_XFER_GOOD) { if (result != USB_STOR_XFER_GOOD) {
@ -383,8 +383,8 @@ int Ssfdc_D_EraseBlock(struct us_data *us)
return USB_STOR_TRANSPORT_ERROR; return USB_STOR_TRANSPORT_ERROR;
} }
addr = (WORD)Media.Zone*Ssfdc.MaxBlocks + Media.PhyBlock; addr = (u16)Media.Zone*Ssfdc.MaxBlocks + Media.PhyBlock;
addr = addr*(WORD)Ssfdc.MaxSectors; addr = addr*(u16)Ssfdc.MaxSectors;
memset(bcb, 0, sizeof(struct bulk_cb_wrap)); memset(bcb, 0, sizeof(struct bulk_cb_wrap));
bcb->Signature = cpu_to_le32(US_BULK_CB_SIGN); bcb->Signature = cpu_to_le32(US_BULK_CB_SIGN);
@ -392,8 +392,8 @@ int Ssfdc_D_EraseBlock(struct us_data *us)
bcb->Flags = 0x80; bcb->Flags = 0x80;
bcb->CDB[0] = 0xF2; bcb->CDB[0] = 0xF2;
bcb->CDB[1] = 0x06; bcb->CDB[1] = 0x06;
bcb->CDB[7] = (BYTE)addr; bcb->CDB[7] = (u8)addr;
bcb->CDB[6] = (BYTE)(addr / 0x0100); bcb->CDB[6] = (u8)(addr / 0x0100);
bcb->CDB[5] = Media.Zone / 2; bcb->CDB[5] = Media.Zone / 2;
result = ENE_SendScsiCmd(us, FDIR_READ, NULL, 0); result = ENE_SendScsiCmd(us, FDIR_READ, NULL, 0);
@ -405,12 +405,12 @@ int Ssfdc_D_EraseBlock(struct us_data *us)
/* 6250 CMD 2 */ /* 6250 CMD 2 */
/*----- Ssfdc_D_ReadRedtData() ----------------------------------------- */ /*----- Ssfdc_D_ReadRedtData() ----------------------------------------- */
int Ssfdc_D_ReadRedtData(struct us_data *us, BYTE *redundant) int Ssfdc_D_ReadRedtData(struct us_data *us, u8 *redundant)
{ {
struct bulk_cb_wrap *bcb = (struct bulk_cb_wrap *) us->iobuf; struct bulk_cb_wrap *bcb = (struct bulk_cb_wrap *) us->iobuf;
int result; int result;
WORD addr; u16 addr;
BYTE *buf; u8 *buf;
result = ENE_LoadBinCode(us, SM_RW_PATTERN); result = ENE_LoadBinCode(us, SM_RW_PATTERN);
if (result != USB_STOR_XFER_GOOD) { if (result != USB_STOR_XFER_GOOD) {
@ -419,8 +419,8 @@ int Ssfdc_D_ReadRedtData(struct us_data *us, BYTE *redundant)
return USB_STOR_TRANSPORT_ERROR; return USB_STOR_TRANSPORT_ERROR;
} }
addr = (WORD)Media.Zone*Ssfdc.MaxBlocks + Media.PhyBlock; addr = (u16)Media.Zone*Ssfdc.MaxBlocks + Media.PhyBlock;
addr = addr*(WORD)Ssfdc.MaxSectors + Media.Sector; addr = addr*(u16)Ssfdc.MaxSectors + Media.Sector;
memset(bcb, 0, sizeof(struct bulk_cb_wrap)); memset(bcb, 0, sizeof(struct bulk_cb_wrap));
bcb->Signature = cpu_to_le32(US_BULK_CB_SIGN); bcb->Signature = cpu_to_le32(US_BULK_CB_SIGN);
@ -428,8 +428,8 @@ int Ssfdc_D_ReadRedtData(struct us_data *us, BYTE *redundant)
bcb->Flags = 0x80; bcb->Flags = 0x80;
bcb->CDB[0] = 0xF1; bcb->CDB[0] = 0xF1;
bcb->CDB[1] = 0x03; bcb->CDB[1] = 0x03;
bcb->CDB[4] = (BYTE)addr; bcb->CDB[4] = (u8)addr;
bcb->CDB[3] = (BYTE)(addr / 0x0100); bcb->CDB[3] = (u8)(addr / 0x0100);
bcb->CDB[2] = Media.Zone / 2; bcb->CDB[2] = Media.Zone / 2;
bcb->CDB[8] = 0; bcb->CDB[8] = 0;
bcb->CDB[9] = 1; bcb->CDB[9] = 1;
@ -446,11 +446,11 @@ int Ssfdc_D_ReadRedtData(struct us_data *us, BYTE *redundant)
/* 6250 CMD 4 */ /* 6250 CMD 4 */
/* ----- Ssfdc_D_WriteRedtData() ---------------------------------------- */ /* ----- Ssfdc_D_WriteRedtData() ---------------------------------------- */
int Ssfdc_D_WriteRedtData(struct us_data *us, BYTE *redundant) int Ssfdc_D_WriteRedtData(struct us_data *us, u8 *redundant)
{ {
struct bulk_cb_wrap *bcb = (struct bulk_cb_wrap *) us->iobuf; struct bulk_cb_wrap *bcb = (struct bulk_cb_wrap *) us->iobuf;
int result; int result;
WORD addr; u16 addr;
result = ENE_LoadBinCode(us, SM_RW_PATTERN); result = ENE_LoadBinCode(us, SM_RW_PATTERN);
if (result != USB_STOR_XFER_GOOD) { if (result != USB_STOR_XFER_GOOD) {
@ -459,8 +459,8 @@ int Ssfdc_D_WriteRedtData(struct us_data *us, BYTE *redundant)
return USB_STOR_TRANSPORT_ERROR; return USB_STOR_TRANSPORT_ERROR;
} }
addr = (WORD)Media.Zone*Ssfdc.MaxBlocks + Media.PhyBlock; addr = (u16)Media.Zone*Ssfdc.MaxBlocks + Media.PhyBlock;
addr = addr*(WORD)Ssfdc.MaxSectors + Media.Sector; addr = addr*(u16)Ssfdc.MaxSectors + Media.Sector;
memset(bcb, 0, sizeof(struct bulk_cb_wrap)); memset(bcb, 0, sizeof(struct bulk_cb_wrap));
bcb->Signature = cpu_to_le32(US_BULK_CB_SIGN); bcb->Signature = cpu_to_le32(US_BULK_CB_SIGN);
@ -468,8 +468,8 @@ int Ssfdc_D_WriteRedtData(struct us_data *us, BYTE *redundant)
bcb->Flags = 0x80; bcb->Flags = 0x80;
bcb->CDB[0] = 0xF2; bcb->CDB[0] = 0xF2;
bcb->CDB[1] = 0x05; bcb->CDB[1] = 0x05;
bcb->CDB[7] = (BYTE)addr; bcb->CDB[7] = (u8)addr;
bcb->CDB[6] = (BYTE)(addr / 0x0100); bcb->CDB[6] = (u8)(addr / 0x0100);
bcb->CDB[5] = Media.Zone / 2; bcb->CDB[5] = Media.Zone / 2;
bcb->CDB[8] = *(redundant + REDT_ADDR1H); bcb->CDB[8] = *(redundant + REDT_ADDR1H);
bcb->CDB[9] = *(redundant + REDT_ADDR1L); bcb->CDB[9] = *(redundant + REDT_ADDR1L);
@ -492,7 +492,7 @@ int Ssfdc_D_CheckStatus(void)
/* SmartMedia ID Code Check & Mode Set Subroutine /* SmartMedia ID Code Check & Mode Set Subroutine
* ----- Set_D_SsfdcModel() --------------------------------------------- * ----- Set_D_SsfdcModel() ---------------------------------------------
*/ */
int Set_D_SsfdcModel(BYTE dcode) int Set_D_SsfdcModel(u8 dcode)
{ {
switch (_Check_D_DevCode(dcode)) { switch (_Check_D_DevCode(dcode)) {
case SSFDC1MB: case SSFDC1MB:
@ -600,7 +600,7 @@ int Set_D_SsfdcModel(BYTE dcode)
} }
/* ----- _Check_D_DevCode() --------------------------------------------- */ /* ----- _Check_D_DevCode() --------------------------------------------- */
static BYTE _Check_D_DevCode(BYTE dcode) static u8 _Check_D_DevCode(u8 dcode)
{ {
switch (dcode) { switch (dcode) {
case 0x6E: case 0x6E:
@ -630,21 +630,21 @@ static BYTE _Check_D_DevCode(BYTE dcode)
/* SmartMedia ECC Control Subroutine /* SmartMedia ECC Control Subroutine
* ----- Check_D_ReadError() ---------------------------------------------- * ----- Check_D_ReadError() ----------------------------------------------
*/ */
int Check_D_ReadError(BYTE *redundant) int Check_D_ReadError(u8 *redundant)
{ {
return SMSUCCESS; return SMSUCCESS;
} }
/* ----- Check_D_Correct() ---------------------------------------------- */ /* ----- Check_D_Correct() ---------------------------------------------- */
int Check_D_Correct(BYTE *buf, BYTE *redundant) int Check_D_Correct(u8 *buf, u8 *redundant)
{ {
return SMSUCCESS; return SMSUCCESS;
} }
/* ----- Check_D_CISdata() ---------------------------------------------- */ /* ----- Check_D_CISdata() ---------------------------------------------- */
int Check_D_CISdata(BYTE *buf, BYTE *redundant) int Check_D_CISdata(u8 *buf, u8 *redundant)
{ {
BYTE cis[] = {0x01, 0x03, 0xD9, 0x01, 0xFF, 0x18, 0x02, u8 cis[] = {0x01, 0x03, 0xD9, 0x01, 0xFF, 0x18, 0x02,
0xDF, 0x01, 0x20}; 0xDF, 0x01, 0x20};
int cis_len = sizeof(cis); int cis_len = sizeof(cis);
@ -669,7 +669,7 @@ int Check_D_CISdata(BYTE *buf, BYTE *redundant)
} }
/* ----- Set_D_RightECC() ---------------------------------------------- */ /* ----- Set_D_RightECC() ---------------------------------------------- */
void Set_D_RightECC(BYTE *redundant) void Set_D_RightECC(u8 *redundant)
{ {
/* Driver ECC Check */ /* Driver ECC Check */
return; return;

View File

@ -68,7 +68,7 @@ static int SM_SCSI_Test_Unit_Ready(struct us_data *us, struct scsi_cmnd *srb)
/* ----- SM_SCSI_Inquiry() --------------------------------------------- */ /* ----- SM_SCSI_Inquiry() --------------------------------------------- */
static int SM_SCSI_Inquiry(struct us_data *us, struct scsi_cmnd *srb) static int SM_SCSI_Inquiry(struct us_data *us, struct scsi_cmnd *srb)
{ {
BYTE data_ptr[36] = {0x00, 0x80, 0x02, 0x00, 0x1F, 0x00, 0x00, 0x00, u8 data_ptr[36] = {0x00, 0x80, 0x02, 0x00, 0x1F, 0x00, 0x00, 0x00,
0x55, 0x53, 0x42, 0x32, 0x2E, 0x30, 0x20, 0x55, 0x53, 0x42, 0x32, 0x2E, 0x30, 0x20,
0x20, 0x43, 0x61, 0x72, 0x64, 0x52, 0x65, 0x20, 0x43, 0x61, 0x72, 0x64, 0x52, 0x65,
0x61, 0x64, 0x65, 0x72, 0x20, 0x20, 0x20, 0x61, 0x64, 0x65, 0x72, 0x20, 0x20, 0x20,
@ -82,9 +82,9 @@ static int SM_SCSI_Inquiry(struct us_data *us, struct scsi_cmnd *srb)
/* ----- SM_SCSI_Mode_Sense() ------------------------------------------ */ /* ----- SM_SCSI_Mode_Sense() ------------------------------------------ */
static int SM_SCSI_Mode_Sense(struct us_data *us, struct scsi_cmnd *srb) static int SM_SCSI_Mode_Sense(struct us_data *us, struct scsi_cmnd *srb)
{ {
BYTE mediaNoWP[12] = {0x0b, 0x00, 0x00, 0x08, 0x00, 0x00, u8 mediaNoWP[12] = {0x0b, 0x00, 0x00, 0x08, 0x00, 0x00,
0x71, 0xc0, 0x00, 0x00, 0x02, 0x00}; 0x71, 0xc0, 0x00, 0x00, 0x02, 0x00};
BYTE mediaWP[12] = {0x0b, 0x00, 0x80, 0x08, 0x00, 0x00, u8 mediaWP[12] = {0x0b, 0x00, 0x80, 0x08, 0x00, 0x00,
0x71, 0xc0, 0x00, 0x00, 0x02, 0x00}; 0x71, 0xc0, 0x00, 0x00, 0x02, 0x00};
if (us->SM_Status.WtP) if (us->SM_Status.WtP)
@ -101,9 +101,9 @@ static int SM_SCSI_Read_Capacity(struct us_data *us, struct scsi_cmnd *srb)
{ {
unsigned int offset = 0; unsigned int offset = 0;
struct scatterlist *sg = NULL; struct scatterlist *sg = NULL;
DWORD bl_num; u32 bl_num;
WORD bl_len; u16 bl_len;
BYTE buf[8]; u8 buf[8];
dev_dbg(&us->pusb_dev->dev, "SM_SCSI_Read_Capacity\n"); dev_dbg(&us->pusb_dev->dev, "SM_SCSI_Read_Capacity\n");
@ -132,13 +132,13 @@ static int SM_SCSI_Read_Capacity(struct us_data *us, struct scsi_cmnd *srb)
static int SM_SCSI_Read(struct us_data *us, struct scsi_cmnd *srb) static int SM_SCSI_Read(struct us_data *us, struct scsi_cmnd *srb)
{ {
int result = 0; int result = 0;
PBYTE Cdb = srb->cmnd; u8 *Cdb = srb->cmnd;
DWORD bn = ((Cdb[2] << 24) & 0xff000000) | u32 bn = ((Cdb[2] << 24) & 0xff000000) |
((Cdb[3] << 16) & 0x00ff0000) | ((Cdb[3] << 16) & 0x00ff0000) |
((Cdb[4] << 8) & 0x0000ff00) | ((Cdb[4] << 8) & 0x0000ff00) |
((Cdb[5] << 0) & 0x000000ff); ((Cdb[5] << 0) & 0x000000ff);
WORD blen = ((Cdb[7] << 8) & 0xff00) | ((Cdb[8] << 0) & 0x00ff); u16 blen = ((Cdb[7] << 8) & 0xff00) | ((Cdb[8] << 0) & 0x00ff);
DWORD blenByte = blen * 0x200; u32 blenByte = blen * 0x200;
void *buf; void *buf;
@ -164,13 +164,13 @@ static int SM_SCSI_Read(struct us_data *us, struct scsi_cmnd *srb)
static int SM_SCSI_Write(struct us_data *us, struct scsi_cmnd *srb) static int SM_SCSI_Write(struct us_data *us, struct scsi_cmnd *srb)
{ {
int result = 0; int result = 0;
PBYTE Cdb = srb->cmnd; u8 *Cdb = srb->cmnd;
DWORD bn = ((Cdb[2] << 24) & 0xff000000) | u32 bn = ((Cdb[2] << 24) & 0xff000000) |
((Cdb[3] << 16) & 0x00ff0000) | ((Cdb[3] << 16) & 0x00ff0000) |
((Cdb[4] << 8) & 0x0000ff00) | ((Cdb[4] << 8) & 0x0000ff00) |
((Cdb[5] << 0) & 0x000000ff); ((Cdb[5] << 0) & 0x000000ff);
WORD blen = ((Cdb[7] << 8) & 0xff00) | ((Cdb[8] << 0) & 0x00ff); u16 blen = ((Cdb[7] << 8) & 0xff00) | ((Cdb[8] << 0) & 0x00ff);
DWORD blenByte = blen * 0x200; u32 blenByte = blen * 0x200;
void *buf; void *buf;

View File

@ -83,8 +83,8 @@ static int usb_stor_msg_common(struct us_data *us, int timeout)
*/ */
static void usb_stor_print_cmd(struct us_data *us, struct scsi_cmnd *srb) static void usb_stor_print_cmd(struct us_data *us, struct scsi_cmnd *srb)
{ {
PBYTE Cdb = srb->cmnd; u8 *Cdb = srb->cmnd;
DWORD cmd = Cdb[0]; u32 cmd = Cdb[0];
switch (cmd) { switch (cmd) {
case TEST_UNIT_READY: case TEST_UNIT_READY:
@ -545,8 +545,8 @@ Handle_Errors:
*/ */
void BuildSenseBuffer(struct scsi_cmnd *srb, int SrbStatus) void BuildSenseBuffer(struct scsi_cmnd *srb, int SrbStatus)
{ {
BYTE *buf = srb->sense_buffer; u8 *buf = srb->sense_buffer;
BYTE asc; u8 asc;
pr_info("transport --- BuildSenseBuffer\n"); pr_info("transport --- BuildSenseBuffer\n");
switch (SrbStatus) { switch (SrbStatus) {

View File

@ -58,9 +58,9 @@ extern void usb_stor_set_xfer_buf(struct us_data*, unsigned char *buffer,
extern void ENE_stor_invoke_transport(struct scsi_cmnd *, struct us_data *); extern void ENE_stor_invoke_transport(struct scsi_cmnd *, struct us_data *);
extern int ENE_InitMedia(struct us_data *); extern int ENE_InitMedia(struct us_data *);
extern int ENE_SMInit(struct us_data *); extern int ENE_SMInit(struct us_data *);
extern int ENE_SendScsiCmd(struct us_data*, BYTE, void*, int); extern int ENE_SendScsiCmd(struct us_data*, u8, void*, int);
extern int ENE_LoadBinCode(struct us_data*, BYTE); extern int ENE_LoadBinCode(struct us_data*, u8);
extern int ene_read_byte(struct us_data*, WORD index, void *buf); extern int ene_read_byte(struct us_data*, u16 index, void *buf);
extern int ENE_Read_Data(struct us_data*, void *buf, unsigned int length); extern int ENE_Read_Data(struct us_data*, void *buf, unsigned int length);
extern int ENE_Write_Data(struct us_data*, void *buf, unsigned int length); extern int ENE_Write_Data(struct us_data*, void *buf, unsigned int length);
extern void BuildSenseBuffer(struct scsi_cmnd *, int); extern void BuildSenseBuffer(struct scsi_cmnd *, int);

View File

@ -50,7 +50,7 @@ static int eucr_suspend(struct usb_interface *iface, pm_message_t message)
static int eucr_resume(struct usb_interface *iface) static int eucr_resume(struct usb_interface *iface)
{ {
BYTE tmp = 0; u8 tmp = 0;
struct us_data *us = usb_get_intfdata(iface); struct us_data *us = usb_get_intfdata(iface);
pr_info("--- eucr_resume---\n"); pr_info("--- eucr_resume---\n");
@ -71,7 +71,7 @@ static int eucr_resume(struct usb_interface *iface)
static int eucr_reset_resume(struct usb_interface *iface) static int eucr_reset_resume(struct usb_interface *iface)
{ {
BYTE tmp = 0; u8 tmp = 0;
struct us_data *us = usb_get_intfdata(iface); struct us_data *us = usb_get_intfdata(iface);
pr_info("--- eucr_reset_resume---\n"); pr_info("--- eucr_reset_resume---\n");
@ -528,7 +528,7 @@ static int eucr_probe(struct usb_interface *intf,
struct Scsi_Host *host; struct Scsi_Host *host;
struct us_data *us; struct us_data *us;
int result; int result;
BYTE MiscReg03 = 0; u8 MiscReg03 = 0;
struct task_struct *th; struct task_struct *th;
pr_info("usb --- eucr_probe\n"); pr_info("usb --- eucr_probe\n");

View File

@ -52,34 +52,34 @@ struct us_unusual_dev {
#define FDIR_READ 1 #define FDIR_READ 1
struct keucr_sd_status { struct keucr_sd_status {
BYTE Insert:1; u8 Insert:1;
BYTE Ready:1; u8 Ready:1;
BYTE MediaChange:1; u8 MediaChange:1;
BYTE IsMMC:1; u8 IsMMC:1;
BYTE HiCapacity:1; u8 HiCapacity:1;
BYTE HiSpeed:1; u8 HiSpeed:1;
BYTE WtP:1; u8 WtP:1;
BYTE Reserved:1; u8 Reserved:1;
}; };
struct keucr_ms_status { struct keucr_ms_status {
BYTE Insert:1; u8 Insert:1;
BYTE Ready:1; u8 Ready:1;
BYTE MediaChange:1; u8 MediaChange:1;
BYTE IsMSPro:1; u8 IsMSPro:1;
BYTE IsMSPHG:1; u8 IsMSPHG:1;
BYTE Reserved1:1; u8 Reserved1:1;
BYTE WtP:1; u8 WtP:1;
BYTE Reserved2:1; u8 Reserved2:1;
}; };
struct keucr_sm_status { struct keucr_sm_status {
BYTE Insert:1; u8 Insert:1;
BYTE Ready:1; u8 Ready:1;
BYTE MediaChange:1; u8 MediaChange:1;
BYTE Reserved:3; u8 Reserved:3;
BYTE WtP:1; u8 WtP:1;
BYTE IsMS:1; u8 IsMS:1;
}; };
/* SD Block Length */ /* SD Block Length */
@ -184,38 +184,38 @@ struct us_data {
/* ----- SD Control Data ---------------- */ /* ----- SD Control Data ---------------- */
/* SD_REGISTER SD_Regs; */ /* SD_REGISTER SD_Regs; */
WORD SD_Block_Mult; u16 SD_Block_Mult;
BYTE SD_READ_BL_LEN; u8 SD_READ_BL_LEN;
WORD SD_C_SIZE; u16 SD_C_SIZE;
BYTE SD_C_SIZE_MULT; u8 SD_C_SIZE_MULT;
/* SD/MMC New spec. */ /* SD/MMC New spec. */
BYTE SD_SPEC_VER; u8 SD_SPEC_VER;
BYTE SD_CSD_VER; u8 SD_CSD_VER;
BYTE SD20_HIGH_CAPACITY; u8 SD20_HIGH_CAPACITY;
DWORD HC_C_SIZE; u32 HC_C_SIZE;
BYTE MMC_SPEC_VER; u8 MMC_SPEC_VER;
BYTE MMC_BusWidth; u8 MMC_BusWidth;
BYTE MMC_HIGH_CAPACITY; u8 MMC_HIGH_CAPACITY;
/* ----- MS Control Data ---------------- */ /* ----- MS Control Data ---------------- */
BOOLEAN MS_SWWP; bool MS_SWWP;
DWORD MSP_TotalBlock; u32 MSP_TotalBlock;
/* MS_LibControl MS_Lib; */ /* MS_LibControl MS_Lib; */
BOOLEAN MS_IsRWPage; bool MS_IsRWPage;
WORD MS_Model; u16 MS_Model;
/* ----- SM Control Data ---------------- */ /* ----- SM Control Data ---------------- */
BYTE SM_DeviceID; u8 SM_DeviceID;
BYTE SM_CardID; u8 SM_CardID;
PBYTE testbuf; u8 *testbuf;
BYTE BIN_FLAG; u8 BIN_FLAG;
DWORD bl_num; u32 bl_num;
int SrbStatus; int SrbStatus;
/* ------Power Managerment --------------- */ /* ------Power Managerment --------------- */
BOOLEAN Power_IsResum; bool Power_IsResum;
}; };
/* Convert between us_data and the corresponding Scsi_Host */ /* Convert between us_data and the corresponding Scsi_Host */