凌阳MP3 spSPCA755yuanma
源代码在线查看: storage.c
/*++
Copyright (c) 2001 Sunplus Technology Co., Ltd.
Module Name:
storage.c
Abstract:
Module related to general storage media
Environment:
Keil C51 Compiler
Revision History:
08/28/2001 Chi-Yeh Tsai created
--*/
// WWW3, whole file
//=============================================================================
//Header file
//=============================================================================
// WWW1 start
#include "general.h"
#include "storage.h"
#include "main.h"
#include "setmode.h"
#include "cardlink.h"
#if ((USBMSDC_OPTION == 1) || (USBMSDC_OPTION == 2))
#include "scsistr.h"
#endif
// WWW1 end
//=============================================================================
//Symbol
//=============================================================================
//-----------------------------------------------------------------------------
//Constant
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
//Variable
//-----------------------------------------------------------------------------
//=============================================================================
//Program
//=============================================================================
//-----------------------------------------------------------------------------
//STORAGE_Initialize
//-----------------------------------------------------------------------------
UCHAR STORAGE_Initialize(UCHAR doDOSInitial) USING_0
/*++
Routine Description:
general routine to initialize storage media
Arguments:
none
Return Value:
none
--*/
{
UCHAR sts = TRUE;
// DbgPrint("STORAGE INITIAL :: G_ucStorageType=%bx\n",G_ucStorageType);
if (G_ucStorageType == 0xff) //first time initialization
{
// DbgPrint(" Initial Storage Detect #1 .... \n");
sts = STORAGE_Detect();
// DbgPrint(" Initial Storage Detect #2 .... \n");
}
// switch (G_ucStorageType)
// {
//#if (CARD_OPTION == 1)
// default:
if (sts)
{
// DbgPrint("Chamber sts before Card Initial=%bx\n",sts);
sts = M_Card_Initialize(doDOSInitial);
// DbgPrint("Chamber sts after Card Initial=%bx\n",sts);
}
// break;
//#endif
// }
return sts;
}
//-----------------------------------------------------------------------------
//STORAGE_Detect
//-----------------------------------------------------------------------------
UCHAR STORAGE_Detect(void) USING_0
/*++
Routine Description:
detect which storage media exists
Arguments:
none
Return Value:
none
--*/
{
UCHAR status = FALSE;
G_ucStorageType = K_MEDIA_None;
#if ( CARD_OPTION )
//DbgPrint(" Storage Detect #1 .... \n");
status = M_Card_Detect();
//DbgPrint(" Storage Detect #2 .... \n");
if ( status == FALSE )
{
// WWWW start
G_Card_Type = K_MEDIA_BUILT_IN; // WWW2
//DbgPrint(" Storage Detect #3 .... \n");
status = M_Card_Detect();
//DbgPrint(" Storage Detect #4 .... \n");
if ( status == FALSE )
G_ucStorageType = K_MEDIA_None;
else
G_ucStorageType = G_Card_Type;
// WWWW end
}
else
G_ucStorageType = G_Card_Type;
#endif
return status;
}
//-----------------------------------------------------------------------------
//STORAGE_Format
//-----------------------------------------------------------------------------
//patch3.2@ada@0401 For Date & Time Update
//patch3.2@ada@0401 For Multi-Frame Play Back
UCHAR STORAGE_Format(UCHAR eraseCard) USING_0
/*++
Routine Description:
format media currently selected
Arguments:
none
Return Value:
none
--*/
{
UCHAR sts = TRUE;
/* switch (G_ucStorageType)
{
#if (SDRAM_OPTION == 1)
case K_MEDIA_None:
SDRAM_Format();
break;
#endif
default:
#if (CARD_OPTION == 1)
*/
//ada@0401 For Multi-Frame Play Back
//Clear the area where saving the start-cluster parameter of each image file
// USR_ResetDramFdbParameterArea();
sts = DOS_Format(eraseCard);
/*
#endif
break;
}
*/
return sts;
}