Commit 50d487e3 authored by Ruslan Pisarev's avatar Ruslan Pisarev Committed by Greg Kroah-Hartman

Staging: keucr: fix comments, braces, whitespaces coding style issue in tm6000.h

This is a patch to the smilsub.c file that fixed up comment, braces,
whitespaces error found by the checkpatch.pl tools.
Signed-off-by: default avatarRuslan Pisarev <ruslan@rpisarev.org.ua>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 74a5e01e
...@@ -6,31 +6,31 @@ ...@@ -6,31 +6,31 @@
#include "smcommon.h" #include "smcommon.h"
#include "smil.h" #include "smil.h"
void _Set_D_SsfdcRdCmd (BYTE); void _Set_D_SsfdcRdCmd(BYTE);
void _Set_D_SsfdcRdAddr (BYTE); void _Set_D_SsfdcRdAddr(BYTE);
void _Set_D_SsfdcRdChip (void); void _Set_D_SsfdcRdChip(void);
void _Set_D_SsfdcRdStandby (void); void _Set_D_SsfdcRdStandby(void);
void _Start_D_SsfdcRdHwECC (void); void _Start_D_SsfdcRdHwECC(void);
void _Stop_D_SsfdcRdHwECC (void); void _Stop_D_SsfdcRdHwECC(void);
void _Load_D_SsfdcRdHwECC (BYTE); void _Load_D_SsfdcRdHwECC(BYTE);
void _Set_D_SsfdcWrCmd (BYTE); void _Set_D_SsfdcWrCmd(BYTE);
void _Set_D_SsfdcWrAddr (BYTE); void _Set_D_SsfdcWrAddr(BYTE);
void _Set_D_SsfdcWrBlock (void); void _Set_D_SsfdcWrBlock(void);
void _Set_D_SsfdcWrStandby (void); void _Set_D_SsfdcWrStandby(void);
void _Start_D_SsfdcWrHwECC (void); void _Start_D_SsfdcWrHwECC(void);
void _Load_D_SsfdcWrHwECC (BYTE); void _Load_D_SsfdcWrHwECC(BYTE);
int _Check_D_SsfdcBusy (WORD); int _Check_D_SsfdcBusy(WORD);
int _Check_D_SsfdcStatus (void); int _Check_D_SsfdcStatus(void);
void _Reset_D_SsfdcErr (void); void _Reset_D_SsfdcErr(void);
void _Read_D_SsfdcBuf (BYTE *); void _Read_D_SsfdcBuf(BYTE *);
void _Write_D_SsfdcBuf (BYTE *); void _Write_D_SsfdcBuf(BYTE *);
void _Read_D_SsfdcByte (BYTE *); void _Read_D_SsfdcByte(BYTE *);
void _ReadRedt_D_SsfdcBuf (BYTE *); void _ReadRedt_D_SsfdcBuf(BYTE *);
void _WriteRedt_D_SsfdcBuf (BYTE *); void _WriteRedt_D_SsfdcBuf(BYTE *);
BYTE _Check_D_DevCode (BYTE); BYTE _Check_D_DevCode(BYTE);
void _Set_D_ECCdata (BYTE,BYTE *); void _Set_D_ECCdata(BYTE, BYTE *);
void _Calc_D_ECCdata (BYTE *); void _Calc_D_ECCdata(BYTE *);
struct SSFDCTYPE Ssfdc; struct SSFDCTYPE Ssfdc;
...@@ -46,173 +46,177 @@ extern WORD WriteBlock; ...@@ -46,173 +46,177 @@ extern WORD WriteBlock;
#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 */
//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(BYTE *redundant)
{ {
char i; char i;
for(i=0; i<REDTSIZE; i++) for (i = 0; i < REDTSIZE; i++)
if (*redundant++!=0xFF) if (*redundant++ != 0xFF)
return(ERROR); return ERROR;
return(SMSUCCESS); return SMSUCCESS;
} }
//----- Check_D_FailBlock() -------------------------------------------- /* ----- Check_D_FailBlock() -------------------------------------------- */
int Check_D_FailBlock(BYTE *redundant) int Check_D_FailBlock(BYTE *redundant)
{ {
redundant+=REDT_BLOCK; redundant += REDT_BLOCK;
if (*redundant==0xFF) if (*redundant == 0xFF)
return(SMSUCCESS); return SMSUCCESS;
if (!*redundant) if (!*redundant)
return(ERROR); return ERROR;
if (hweight8(*redundant)<7) if (hweight8(*redundant) < 7)
return(ERROR); return ERROR;
return(SMSUCCESS); return SMSUCCESS;
} }
//----- Check_D_DataStatus() ------------------------------------------- /* ----- Check_D_DataStatus() ------------------------------------------- */
int Check_D_DataStatus(BYTE *redundant) int Check_D_DataStatus(BYTE *redundant)
{ {
redundant+=REDT_DATA; redundant += REDT_DATA;
if (*redundant==0xFF) if (*redundant == 0xFF)
return(SMSUCCESS); return SMSUCCESS;
if (!*redundant) if (!*redundant) {
{
ErrXDCode = ERR_DataStatus; ErrXDCode = ERR_DataStatus;
return(ERROR); return ERROR;
} } else
else
ErrXDCode = NO_ERROR; ErrXDCode = NO_ERROR;
if (hweight8(*redundant)<5) if (hweight8(*redundant) < 5)
return(ERROR); return ERROR;
return(SMSUCCESS); return SMSUCCESS;
} }
//----- Load_D_LogBlockAddr() ------------------------------------------ /* ----- Load_D_LogBlockAddr() ------------------------------------------ */
int Load_D_LogBlockAddr(BYTE *redundant) int Load_D_LogBlockAddr(BYTE *redundant)
{ {
WORD addr1,addr2; WORD addr1, addr2;
addr1=(WORD)*(redundant+REDT_ADDR1H)*0x0100+(WORD)*(redundant+REDT_ADDR1L); addr1 = (WORD)*(redundant + REDT_ADDR1H)*0x0100 + (WORD)*(redundant + REDT_ADDR1L);
addr2=(WORD)*(redundant+REDT_ADDR2H)*0x0100+(WORD)*(redundant+REDT_ADDR2L); addr2 = (WORD)*(redundant + REDT_ADDR2H)*0x0100 + (WORD)*(redundant + REDT_ADDR2L);
if (addr1==addr2) if (addr1 == addr2)
if ((addr1 &0xF000)==0x1000) if ((addr1 & 0xF000) == 0x1000) {
{ Media.LogBlock=(addr1 &0x0FFF)/2; return(SMSUCCESS); } Media.LogBlock = (addr1 & 0x0FFF) / 2;
return SMSUCCESS;
}
if (hweight16((WORD)(addr1^addr2))!=0x01) return(ERROR); if (hweight16((WORD)(addr1^addr2)) != 0x01)
return ERROR;
if ((addr1 &0xF000)==0x1000) if ((addr1 & 0xF000) == 0x1000)
if (!(hweight16(addr1) &0x01)) if (!(hweight16(addr1) & 0x01)) {
{ Media.LogBlock=(addr1 &0x0FFF)/2; return(SMSUCCESS); } Media.LogBlock = (addr1 & 0x0FFF) / 2;
return SMSUCCESS;
}
if ((addr2 &0xF000)==0x1000) if ((addr2 & 0xF000) == 0x1000)
if (!(hweight16(addr2) &0x01)) if (!(hweight16(addr2) & 0x01)) {
{ Media.LogBlock=(addr2 &0x0FFF)/2; return(SMSUCCESS); } Media.LogBlock = (addr2 & 0x0FFF) / 2;
return SMSUCCESS;
}
return(ERROR); return ERROR;
} }
//----- Clr_D_RedundantData() ------------------------------------------ /* ----- Clr_D_RedundantData() ------------------------------------------ */
void Clr_D_RedundantData(BYTE *redundant) void Clr_D_RedundantData(BYTE *redundant)
{ {
char i; char i;
for(i=0; i<REDTSIZE; i++) for (i = 0; i < REDTSIZE; i++)
*(redundant+i)=0xFF; *(redundant + i) = 0xFF;
} }
//----- Set_D_LogBlockAddr() ------------------------------------------- /* ----- Set_D_LogBlockAddr() ------------------------------------------- */
void Set_D_LogBlockAddr(BYTE *redundant) void Set_D_LogBlockAddr(BYTE *redundant)
{ {
WORD addr; WORD addr;
*(redundant+REDT_BLOCK)=0xFF; *(redundant + REDT_BLOCK) = 0xFF;
*(redundant+REDT_DATA) =0xFF; *(redundant + REDT_DATA) = 0xFF;
addr=Media.LogBlock*2+0x1000; addr = Media.LogBlock*2 + 0x1000;
if ((hweight16(addr)%2)) if ((hweight16(addr) % 2))
addr++; addr++;
*(redundant+REDT_ADDR1H)=*(redundant+REDT_ADDR2H)=(BYTE)(addr/0x0100); *(redundant + REDT_ADDR1H) = *(redundant + REDT_ADDR2H) = (BYTE)(addr / 0x0100);
*(redundant+REDT_ADDR1L)=*(redundant+REDT_ADDR2L)=(BYTE)addr; *(redundant + REDT_ADDR1L) = *(redundant + REDT_ADDR2L) = (BYTE)addr;
} }
//----- Set_D_FailBlock() ---------------------------------------------- /*----- Set_D_FailBlock() ---------------------------------------------- */
void Set_D_FailBlock(BYTE *redundant) void Set_D_FailBlock(BYTE *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++=(BYTE)((i==REDT_BLOCK)?0xF0:0xFF);
} }
//----- Set_D_DataStaus() ---------------------------------------------- /* ----- Set_D_DataStaus() ---------------------------------------------- */
void Set_D_DataStaus(BYTE *redundant) void Set_D_DataStaus(BYTE *redundant)
{ {
redundant+=REDT_DATA; redundant += REDT_DATA;
*redundant=0x00; *redundant = 0x00;
} }
//SmartMedia Function Command Subroutine /* SmartMedia Function Command Subroutine
// 6250 CMD 6 * 6250 CMD 6
//----- Ssfdc_D_Reset() ------------------------------------------------ */
/* ----- Ssfdc_D_Reset() ------------------------------------------------ */
void Ssfdc_D_Reset(struct us_data *us) void Ssfdc_D_Reset(struct us_data *us)
{ {
return; return;
} }
//----- 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, BYTE *buf, BYTE *redundant)
{ {
BYTE zone,sector; BYTE zone, sector;
WORD block; WORD 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;
Media.PhyBlock=CisArea.PhyBlock; Media.PhyBlock = CisArea.PhyBlock;
Media.Sector=CisArea.Sector; Media.Sector = CisArea.Sector;
if (Ssfdc_D_ReadSect(us,buf,redundant)) if (Ssfdc_D_ReadSect(us, buf, redundant)) {
{ Media.Zone = zone; Media.PhyBlock = block; Media.Sector = sector;
Media.Zone=zone; Media.PhyBlock=block; Media.Sector=sector; return ERROR;
return(ERROR);
} }
Media.Zone=zone; Media.PhyBlock=block; Media.Sector=sector; Media.Zone = zone; Media.PhyBlock = block; Media.Sector = sector;
return(SMSUCCESS); return SMSUCCESS;
} }
// 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, BYTE *buf, BYTE *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; WORD 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) {
{
printk("Load SM RW Code Fail !!\n"); printk("Load SM RW Code Fail !!\n");
return USB_STOR_TRANSPORT_ERROR; return USB_STOR_TRANSPORT_ERROR;
} }
addr = (WORD)Media.Zone*Ssfdc.MaxBlocks+Media.PhyBlock; addr = (WORD)Media.Zone*Ssfdc.MaxBlocks + Media.PhyBlock;
addr = addr*(WORD)Ssfdc.MaxSectors+Media.Sector; addr = addr*(WORD)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));
bcb->Signature = cpu_to_le32(US_BULK_CB_SIGN); bcb->Signature = cpu_to_le32(US_BULK_CB_SIGN);
bcb->DataTransferLength = 0x200; bcb->DataTransferLength = 0x200;
...@@ -220,14 +224,14 @@ int Ssfdc_D_ReadSect(struct us_data *us, BYTE *buf,BYTE *redundant) ...@@ -220,14 +224,14 @@ int Ssfdc_D_ReadSect(struct us_data *us, BYTE *buf,BYTE *redundant)
bcb->CDB[0] = 0xF1; bcb->CDB[0] = 0xF1;
bcb->CDB[1] = 0x02; bcb->CDB[1] = 0x02;
bcb->CDB[4] = (BYTE)addr; bcb->CDB[4] = (BYTE)addr;
bcb->CDB[3] = (BYTE)(addr/0x0100); bcb->CDB[3] = (BYTE)(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);
if (result != USB_STOR_XFER_GOOD) if (result != USB_STOR_XFER_GOOD)
return USB_STOR_TRANSPORT_ERROR; return USB_STOR_TRANSPORT_ERROR;
// Read redundant /* Read redundant */
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);
bcb->DataTransferLength = 0x10; bcb->DataTransferLength = 0x10;
...@@ -235,8 +239,8 @@ int Ssfdc_D_ReadSect(struct us_data *us, BYTE *buf,BYTE *redundant) ...@@ -235,8 +239,8 @@ int Ssfdc_D_ReadSect(struct us_data *us, BYTE *buf,BYTE *redundant)
bcb->CDB[0] = 0xF1; bcb->CDB[0] = 0xF1;
bcb->CDB[1] = 0x03; bcb->CDB[1] = 0x03;
bcb->CDB[4] = (BYTE)addr; bcb->CDB[4] = (BYTE)addr;
bcb->CDB[3] = (BYTE)(addr/0x0100); bcb->CDB[3] = (BYTE)(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;
...@@ -247,24 +251,23 @@ int Ssfdc_D_ReadSect(struct us_data *us, BYTE *buf,BYTE *redundant) ...@@ -247,24 +251,23 @@ int Ssfdc_D_ReadSect(struct us_data *us, BYTE *buf,BYTE *redundant)
return USB_STOR_TRANSPORT_GOOD; return USB_STOR_TRANSPORT_GOOD;
} }
//----- Ssfdc_D_ReadBlock() --------------------------------------------- /* ----- Ssfdc_D_ReadBlock() --------------------------------------------- */
int Ssfdc_D_ReadBlock(struct us_data *us, WORD count, BYTE *buf,BYTE *redundant) int Ssfdc_D_ReadBlock(struct us_data *us, WORD count, BYTE *buf, BYTE *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; WORD 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) {
{
printk("Load SM RW Code Fail !!\n"); printk("Load SM RW Code Fail !!\n");
return USB_STOR_TRANSPORT_ERROR; return USB_STOR_TRANSPORT_ERROR;
} }
addr = (WORD)Media.Zone*Ssfdc.MaxBlocks+Media.PhyBlock; addr = (WORD)Media.Zone*Ssfdc.MaxBlocks + Media.PhyBlock;
addr = addr*(WORD)Ssfdc.MaxSectors+Media.Sector; addr = addr*(WORD)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));
bcb->Signature = cpu_to_le32(US_BULK_CB_SIGN); bcb->Signature = cpu_to_le32(US_BULK_CB_SIGN);
bcb->DataTransferLength = 0x200*count; bcb->DataTransferLength = 0x200*count;
...@@ -272,14 +275,14 @@ int Ssfdc_D_ReadBlock(struct us_data *us, WORD count, BYTE *buf,BYTE *redundant) ...@@ -272,14 +275,14 @@ int Ssfdc_D_ReadBlock(struct us_data *us, WORD count, BYTE *buf,BYTE *redundant)
bcb->CDB[0] = 0xF1; bcb->CDB[0] = 0xF1;
bcb->CDB[1] = 0x02; bcb->CDB[1] = 0x02;
bcb->CDB[4] = (BYTE)addr; bcb->CDB[4] = (BYTE)addr;
bcb->CDB[3] = (BYTE)(addr/0x0100); bcb->CDB[3] = (BYTE)(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);
if (result != USB_STOR_XFER_GOOD) if (result != USB_STOR_XFER_GOOD)
return USB_STOR_TRANSPORT_ERROR; return USB_STOR_TRANSPORT_ERROR;
// Read redundant /* Read redundant */
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);
bcb->DataTransferLength = 0x10; bcb->DataTransferLength = 0x10;
...@@ -287,8 +290,8 @@ int Ssfdc_D_ReadBlock(struct us_data *us, WORD count, BYTE *buf,BYTE *redundant) ...@@ -287,8 +290,8 @@ int Ssfdc_D_ReadBlock(struct us_data *us, WORD count, BYTE *buf,BYTE *redundant)
bcb->CDB[0] = 0xF1; bcb->CDB[0] = 0xF1;
bcb->CDB[1] = 0x03; bcb->CDB[1] = 0x03;
bcb->CDB[4] = (BYTE)addr; bcb->CDB[4] = (BYTE)addr;
bcb->CDB[3] = (BYTE)(addr/0x0100); bcb->CDB[3] = (BYTE)(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;
...@@ -300,26 +303,25 @@ int Ssfdc_D_ReadBlock(struct us_data *us, WORD count, BYTE *buf,BYTE *redundant) ...@@ -300,26 +303,25 @@ int Ssfdc_D_ReadBlock(struct us_data *us, WORD count, BYTE *buf,BYTE *redundant)
} }
//----- Ssfdc_D_CopyBlock() -------------------------------------------- /* ----- Ssfdc_D_CopyBlock() -------------------------------------------- */
int Ssfdc_D_CopyBlock(struct us_data *us, WORD count, BYTE *buf,BYTE *redundant) int Ssfdc_D_CopyBlock(struct us_data *us, WORD count, BYTE *buf, BYTE *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; WORD 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) {
{
printk("Load SM RW Code Fail !!\n"); printk("Load SM RW Code Fail !!\n");
return USB_STOR_TRANSPORT_ERROR; return USB_STOR_TRANSPORT_ERROR;
} }
ReadAddr = (WORD)Media.Zone*Ssfdc.MaxBlocks+ReadBlock; ReadAddr = (WORD)Media.Zone*Ssfdc.MaxBlocks + ReadBlock;
ReadAddr = ReadAddr*(WORD)Ssfdc.MaxSectors; ReadAddr = ReadAddr*(WORD)Ssfdc.MaxSectors;
WriteAddr = (WORD)Media.Zone*Ssfdc.MaxBlocks+WriteBlock; WriteAddr = (WORD)Media.Zone*Ssfdc.MaxBlocks + WriteBlock;
WriteAddr = WriteAddr*(WORD)Ssfdc.MaxSectors; WriteAddr = WriteAddr*(WORD)Ssfdc.MaxSectors;
// Write sect data /* Write sect data */
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);
bcb->DataTransferLength = 0x200*count; bcb->DataTransferLength = 0x200*count;
...@@ -327,19 +329,17 @@ int Ssfdc_D_CopyBlock(struct us_data *us, WORD count, BYTE *buf,BYTE *redundant) ...@@ -327,19 +329,17 @@ int Ssfdc_D_CopyBlock(struct us_data *us, WORD count, BYTE *buf,BYTE *redundant)
bcb->CDB[0] = 0xF0; bcb->CDB[0] = 0xF0;
bcb->CDB[1] = 0x08; bcb->CDB[1] = 0x08;
bcb->CDB[7] = (BYTE)WriteAddr; bcb->CDB[7] = (BYTE)WriteAddr;
bcb->CDB[6] = (BYTE)(WriteAddr/0x0100); bcb->CDB[6] = (BYTE)(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] = (BYTE)ReadAddr;
bcb->CDB[3] = (BYTE)(ReadAddr/0x0100); bcb->CDB[3] = (BYTE)(ReadAddr / 0x0100);
bcb->CDB[2] = Media.Zone/2; bcb->CDB[2] = Media.Zone / 2;
} } else
else
bcb->CDB[11] = 1; bcb->CDB[11] = 1;
result = ENE_SendScsiCmd(us, FDIR_WRITE, buf, 0); result = ENE_SendScsiCmd(us, FDIR_WRITE, buf, 0);
...@@ -349,7 +349,7 @@ int Ssfdc_D_CopyBlock(struct us_data *us, WORD count, BYTE *buf,BYTE *redundant) ...@@ -349,7 +349,7 @@ int Ssfdc_D_CopyBlock(struct us_data *us, WORD count, BYTE *buf,BYTE *redundant)
return USB_STOR_TRANSPORT_GOOD; return USB_STOR_TRANSPORT_GOOD;
} }
//----- 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, BYTE *buf, BYTE *redundant)
{ {
struct bulk_cb_wrap *bcb = (struct bulk_cb_wrap *) us->iobuf; struct bulk_cb_wrap *bcb = (struct bulk_cb_wrap *) us->iobuf;
...@@ -357,17 +357,16 @@ int Ssfdc_D_WriteSectForCopy(struct us_data *us, BYTE *buf, BYTE *redundant) ...@@ -357,17 +357,16 @@ int Ssfdc_D_WriteSectForCopy(struct us_data *us, BYTE *buf, BYTE *redundant)
WORD addr; WORD 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) {
{
printk("Load SM RW Code Fail !!\n"); printk("Load SM RW Code Fail !!\n");
return USB_STOR_TRANSPORT_ERROR; return USB_STOR_TRANSPORT_ERROR;
} }
addr = (WORD)Media.Zone*Ssfdc.MaxBlocks+Media.PhyBlock; addr = (WORD)Media.Zone*Ssfdc.MaxBlocks + Media.PhyBlock;
addr = addr*(WORD)Ssfdc.MaxSectors+Media.Sector; addr = addr*(WORD)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));
bcb->Signature = cpu_to_le32(US_BULK_CB_SIGN); bcb->Signature = cpu_to_le32(US_BULK_CB_SIGN);
bcb->DataTransferLength = 0x200; bcb->DataTransferLength = 0x200;
...@@ -375,10 +374,10 @@ int Ssfdc_D_WriteSectForCopy(struct us_data *us, BYTE *buf, BYTE *redundant) ...@@ -375,10 +374,10 @@ int Ssfdc_D_WriteSectForCopy(struct us_data *us, BYTE *buf, BYTE *redundant)
bcb->CDB[0] = 0xF0; bcb->CDB[0] = 0xF0;
bcb->CDB[1] = 0x04; bcb->CDB[1] = 0x04;
bcb->CDB[7] = (BYTE)addr; bcb->CDB[7] = (BYTE)addr;
bcb->CDB[6] = (BYTE)(addr/0x0100); bcb->CDB[6] = (BYTE)(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);
result = ENE_SendScsiCmd(us, FDIR_WRITE, buf, 0); result = ENE_SendScsiCmd(us, FDIR_WRITE, buf, 0);
if (result != USB_STOR_XFER_GOOD) if (result != USB_STOR_XFER_GOOD)
...@@ -387,8 +386,8 @@ int Ssfdc_D_WriteSectForCopy(struct us_data *us, BYTE *buf, BYTE *redundant) ...@@ -387,8 +386,8 @@ int Ssfdc_D_WriteSectForCopy(struct us_data *us, BYTE *buf, BYTE *redundant)
return USB_STOR_TRANSPORT_GOOD; return USB_STOR_TRANSPORT_GOOD;
} }
// 6250 CMD 5 /* 6250 CMD 5 */
//----- Ssfdc_D_EraseBlock() ------------------------------------------- /* ----- Ssfdc_D_EraseBlock() ------------------------------------------- */
int Ssfdc_D_EraseBlock(struct us_data *us) 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;
...@@ -396,14 +395,13 @@ int Ssfdc_D_EraseBlock(struct us_data *us) ...@@ -396,14 +395,13 @@ int Ssfdc_D_EraseBlock(struct us_data *us)
WORD addr; WORD 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) {
{
printk("Load SM RW Code Fail !!\n"); printk("Load SM RW Code Fail !!\n");
return USB_STOR_TRANSPORT_ERROR; return USB_STOR_TRANSPORT_ERROR;
} }
addr=(WORD)Media.Zone*Ssfdc.MaxBlocks+Media.PhyBlock; addr = (WORD)Media.Zone*Ssfdc.MaxBlocks + Media.PhyBlock;
addr=addr*(WORD)Ssfdc.MaxSectors; addr = addr*(WORD)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);
...@@ -412,8 +410,8 @@ int Ssfdc_D_EraseBlock(struct us_data *us) ...@@ -412,8 +410,8 @@ int Ssfdc_D_EraseBlock(struct us_data *us)
bcb->CDB[0] = 0xF2; bcb->CDB[0] = 0xF2;
bcb->CDB[1] = 0x06; bcb->CDB[1] = 0x06;
bcb->CDB[7] = (BYTE)addr; bcb->CDB[7] = (BYTE)addr;
bcb->CDB[6] = (BYTE)(addr/0x0100); bcb->CDB[6] = (BYTE)(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);
if (result != USB_STOR_XFER_GOOD) if (result != USB_STOR_XFER_GOOD)
...@@ -422,8 +420,8 @@ int Ssfdc_D_EraseBlock(struct us_data *us) ...@@ -422,8 +420,8 @@ int Ssfdc_D_EraseBlock(struct us_data *us)
return USB_STOR_TRANSPORT_GOOD; return USB_STOR_TRANSPORT_GOOD;
} }
// 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, BYTE *redundant)
{ {
struct bulk_cb_wrap *bcb = (struct bulk_cb_wrap *) us->iobuf; struct bulk_cb_wrap *bcb = (struct bulk_cb_wrap *) us->iobuf;
...@@ -432,14 +430,13 @@ int Ssfdc_D_ReadRedtData(struct us_data *us, BYTE *redundant) ...@@ -432,14 +430,13 @@ int Ssfdc_D_ReadRedtData(struct us_data *us, BYTE *redundant)
BYTE *buf; BYTE *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) {
{
printk("Load SM RW Code Fail !!\n"); printk("Load SM RW Code Fail !!\n");
return USB_STOR_TRANSPORT_ERROR; return USB_STOR_TRANSPORT_ERROR;
} }
addr = (WORD)Media.Zone*Ssfdc.MaxBlocks+Media.PhyBlock; addr = (WORD)Media.Zone*Ssfdc.MaxBlocks + Media.PhyBlock;
addr = addr*(WORD)Ssfdc.MaxSectors+Media.Sector; addr = addr*(WORD)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);
...@@ -448,8 +445,8 @@ int Ssfdc_D_ReadRedtData(struct us_data *us, BYTE *redundant) ...@@ -448,8 +445,8 @@ int Ssfdc_D_ReadRedtData(struct us_data *us, BYTE *redundant)
bcb->CDB[0] = 0xF1; bcb->CDB[0] = 0xF1;
bcb->CDB[1] = 0x03; bcb->CDB[1] = 0x03;
bcb->CDB[4] = (BYTE)addr; bcb->CDB[4] = (BYTE)addr;
bcb->CDB[3] = (BYTE)(addr/0x0100); bcb->CDB[3] = (BYTE)(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;
...@@ -463,8 +460,8 @@ int Ssfdc_D_ReadRedtData(struct us_data *us, BYTE *redundant) ...@@ -463,8 +460,8 @@ int Ssfdc_D_ReadRedtData(struct us_data *us, BYTE *redundant)
return USB_STOR_TRANSPORT_GOOD; return USB_STOR_TRANSPORT_GOOD;
} }
// 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, BYTE *redundant)
{ {
struct bulk_cb_wrap *bcb = (struct bulk_cb_wrap *) us->iobuf; struct bulk_cb_wrap *bcb = (struct bulk_cb_wrap *) us->iobuf;
...@@ -472,14 +469,13 @@ int Ssfdc_D_WriteRedtData(struct us_data *us, BYTE *redundant) ...@@ -472,14 +469,13 @@ int Ssfdc_D_WriteRedtData(struct us_data *us, BYTE *redundant)
WORD addr; WORD 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) {
{
printk("Load SM RW Code Fail !!\n"); printk("Load SM RW Code Fail !!\n");
return USB_STOR_TRANSPORT_ERROR; return USB_STOR_TRANSPORT_ERROR;
} }
addr = (WORD)Media.Zone*Ssfdc.MaxBlocks+Media.PhyBlock; addr = (WORD)Media.Zone*Ssfdc.MaxBlocks + Media.PhyBlock;
addr = addr*(WORD)Ssfdc.MaxSectors+Media.Sector; addr = addr*(WORD)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);
...@@ -488,10 +484,10 @@ int Ssfdc_D_WriteRedtData(struct us_data *us, BYTE *redundant) ...@@ -488,10 +484,10 @@ int Ssfdc_D_WriteRedtData(struct us_data *us, BYTE *redundant)
bcb->CDB[0] = 0xF2; bcb->CDB[0] = 0xF2;
bcb->CDB[1] = 0x05; bcb->CDB[1] = 0x05;
bcb->CDB[7] = (BYTE)addr; bcb->CDB[7] = (BYTE)addr;
bcb->CDB[6] = (BYTE)(addr/0x0100); bcb->CDB[6] = (BYTE)(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);
result = ENE_SendScsiCmd(us, FDIR_READ, NULL, 0); result = ENE_SendScsiCmd(us, FDIR_READ, NULL, 0);
if (result != USB_STOR_XFER_GOOD) if (result != USB_STOR_XFER_GOOD)
...@@ -500,16 +496,17 @@ int Ssfdc_D_WriteRedtData(struct us_data *us, BYTE *redundant) ...@@ -500,16 +496,17 @@ int Ssfdc_D_WriteRedtData(struct us_data *us, BYTE *redundant)
return USB_STOR_TRANSPORT_GOOD; return USB_STOR_TRANSPORT_GOOD;
} }
//----- Ssfdc_D_CheckStatus() ------------------------------------------ /* ----- Ssfdc_D_CheckStatus() ------------------------------------------ */
int Ssfdc_D_CheckStatus(void) int Ssfdc_D_CheckStatus(void)
{ {
return(SMSUCCESS); return SMSUCCESS;
} }
//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(BYTE dcode)
{ {
switch (_Check_D_DevCode(dcode)) { switch (_Check_D_DevCode(dcode)) {
...@@ -611,54 +608,55 @@ int Set_D_SsfdcModel(BYTE dcode) ...@@ -611,54 +608,55 @@ int Set_D_SsfdcModel(BYTE dcode)
break; break;
default: default:
Ssfdc.Model = NOSSFDC; Ssfdc.Model = NOSSFDC;
return(ERROR); return ERROR;
} }
return(SMSUCCESS); return SMSUCCESS;
} }
//----- _Check_D_DevCode() --------------------------------------------- /* ----- _Check_D_DevCode() --------------------------------------------- */
BYTE _Check_D_DevCode(BYTE dcode) BYTE _Check_D_DevCode(BYTE dcode)
{ {
switch(dcode){ switch (dcode) {
case 0x6E: case 0x6E:
case 0xE8: case 0xE8:
case 0xEC: return(SSFDC1MB); // 8Mbit (1M) NAND case 0xEC: return SSFDC1MB; /* 8Mbit (1M) NAND */
case 0x64: case 0x64:
case 0xEA: return(SSFDC2MB); // 16Mbit (2M) NAND case 0xEA: return SSFDC2MB; /* 16Mbit (2M) NAND */
case 0x6B: case 0x6B:
case 0xE3: case 0xE3:
case 0xE5: return(SSFDC4MB); // 32Mbit (4M) NAND case 0xE5: return SSFDC4MB; /* 32Mbit (4M) NAND */
case 0xE6: return(SSFDC8MB); // 64Mbit (8M) NAND case 0xE6: return SSFDC8MB; /* 64Mbit (8M) NAND */
case 0x73: return(SSFDC16MB); // 128Mbit (16M)NAND case 0x73: return SSFDC16MB; /* 128Mbit (16M)NAND */
case 0x75: return(SSFDC32MB); // 256Mbit (32M)NAND case 0x75: return SSFDC32MB; /* 256Mbit (32M)NAND */
case 0x76: return(SSFDC64MB); // 512Mbit (64M)NAND case 0x76: return SSFDC64MB; /* 512Mbit (64M)NAND */
case 0x79: return(SSFDC128MB); // 1Gbit(128M)NAND case 0x79: return SSFDC128MB; /* 1Gbit(128M)NAND */
case 0x71: return(SSFDC256MB); case 0x71: return SSFDC256MB;
case 0xDC: return(SSFDC512MB); case 0xDC: return SSFDC512MB;
case 0xD3: return(SSFDC1GB); case 0xD3: return SSFDC1GB;
case 0xD5: return(SSFDC2GB); case 0xD5: return SSFDC2GB;
default: return(NOSSFDC); default: return NOSSFDC;
} }
} }
//SmartMedia ECC Control Subroutine /* SmartMedia ECC Control Subroutine
//----- Check_D_ReadError() ---------------------------------------------- * ----- Check_D_ReadError() ----------------------------------------------
*/
int Check_D_ReadError(BYTE *redundant) int Check_D_ReadError(BYTE *redundant)
{ {
return SMSUCCESS; return SMSUCCESS;
} }
//----- Check_D_Correct() ---------------------------------------------- /* ----- Check_D_Correct() ---------------------------------------------- */
int Check_D_Correct(BYTE *buf,BYTE *redundant) int Check_D_Correct(BYTE *buf, BYTE *redundant)
{ {
return SMSUCCESS; return SMSUCCESS;
} }
//----- Check_D_CISdata() ---------------------------------------------- /* ----- Check_D_CISdata() ---------------------------------------------- */
int Check_D_CISdata(BYTE *buf, BYTE *redundant) int Check_D_CISdata(BYTE *buf, BYTE *redundant)
{ {
BYTE cis[] = {0x01, 0x03, 0xD9, 0x01, 0xFF, 0x18, 0x02, BYTE cis[] = {0x01, 0x03, 0xD9, 0x01, 0xFF, 0x18, 0x02,
...@@ -685,10 +683,10 @@ int Check_D_CISdata(BYTE *buf, BYTE *redundant) ...@@ -685,10 +683,10 @@ int Check_D_CISdata(BYTE *buf, BYTE *redundant)
return ERROR; return ERROR;
} }
//----- Set_D_RightECC() ---------------------------------------------- /* ----- Set_D_RightECC() ---------------------------------------------- */
void Set_D_RightECC(BYTE *redundant) void Set_D_RightECC(BYTE *redundant)
{ {
// Driver ECC Check /* Driver ECC Check */
return; return;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment