台湾凌阳方案300万数码相机源代码

源代码在线查看: storage.c

软件大小: 25250 K
上传用户: myc
关键词: 300 凌阳 方案 数码相机
下载地址: 免注册下载 普通下载 VIP

相关代码

				/*++
				
				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"
				#include "cardusr.h"
				
				// WWW1 end
				
				//patch4.2@richie@ds0511 begin
				#if (DOSRAM_OPTION)
				#include "dramfunc.h"
				#endif
				//patch4.2@richie@ds0511 end
				
				//patch4.3@richie@md0603 begin
				#include "initio.h"
				#include "sdramhw.h"
				//patch4.3@richie@md0603 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;
				
				        if (G_ucStorageType == 0xff)    //first time initialization
				                sts = STORAGE_Detect();
				//		DELAY_1s();
				//		UI_Buzzer();//wendy@2004/8/26
				
				        switch (G_ucStorageType)
				        {
				#if (SDRAM_OPTION == 1)
				                case K_MEDIA_None:
				                        SDRAM_Initialize();
				                        break;
				#endif
				
				#if (CARD_OPTION == 1)
						default:
							if (sts)
				               {
				                         //Write date and time    //ada@0321
				                         USR_UpdateRtcTime();//wendy@2004/8/26
				/*                         L2_ReadRTC(&G_DATEINFO);
				                         G_DOS_CreateDate = ((USHORT)(G_DATEINFO.Year + 20) 				                         G_DOS_CreateTime = ((USHORT)(G_DATEINFO.Hour) 				*/
					//patch4.4@richie@dsi begin
					//restore G_DOS_SDRAM_FAT1Addr
					#if ( DOSRAM_OPTION == 1 )	
					if (G_Card_Type == K_MEDIA_DOSRAM)
					{
						if (G_ulDRAMSTORFAT1AddrTemp != 0xFFFFFFFF)
						{
							G_DOS_SDRAM_FAT1Addr = G_ulDRAMSTORFAT1AddrTemp;
						}
					}
					else
					{
						G_DOS_SDRAM_FAT1Addr = K_SDRAM_DOS_FAT1Addr;
					}
					#endif
					//patch4.4@richie@dsi end
				
				                		sts = M_Card_Initialize(doDOSInitial);
				               }
				                        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 ) 
						status = M_Card_Detect();
						if ( status == FALSE )
						{
							// WWWW start
							G_Card_Type = K_MEDIA_BUILT_IN; // WWW2
							status = M_Card_Detect();
							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 Date & Time Update
				                         USR_UpdateRtcTime();
				
				                         //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;
				}
				
				//-----------------------------------------------------------------------------
				//STORAGE_CaptureObject
				//-----------------------------------------------------------------------------
				UCHAR STORAGE_CaptureObject(USHORT objType) USING_0
				/*++
				
				Routine Description:
				
				        capture one object to storage media currently selected
				
				Arguments:
				
				        objType - type of object to capture, where 0 is JPEG file
				                                                   1 is WAV file
				                                                   2 is video only AVI file
				                                                   3 is audio/video AVI file
				
				Return Value:
				
				        none
				
				--*/
				{
					UCHAR sts = TRUE;
				
				        switch (G_ucStorageType)
				        {
				#if (SDRAM_OPTION == 1)
				                case K_MEDIA_None:
				                        SDRAM_CaptureObject(objType);
				                        break;
				#endif
				
				                default:
				#if (CARD_OPTION == 1)
							sts = Card_CaptureObject(objType);
				#endif
							
				                        break;
				                	
				        }
				        return sts;
				}
				
				//-----------------------------------------------------------------------------
				//STORAGE_DeleteObject
				//-----------------------------------------------------------------------------
				UCHAR STORAGE_DeleteObject(USHORT objIndex) USING_0
				/*++
				
				Routine Description:
				
				        delete one object to storage media currently selected
				
				Arguments:
				
				        objIndex - index of object to delete, where 0 is delete all
				                                                    the other is delete one selected
				
				Return Value:
				
				        none
				
				--*/
				{
					UCHAR	sts = TRUE;
					
				        switch (G_ucStorageType)
				        {
				#if (SDRAM_OPTION == 1)
				                case K_MEDIA_None:
				                        SDRAM_DeleteObject(objIndex);
				                        break;
				#endif
				
				                default:
				#if (CARD_OPTION == 1)
							sts = Card_DeleteObject(objIndex);
				#endif
				                        break;
				        }
				        return sts;
				}
				
				//-----------------------------------------------------------------------------
				//STORAGE_PlaybackObject
				//-----------------------------------------------------------------------------
				UCHAR STORAGE_PlaybackObject(USHORT objType, USHORT objIndex) USING_0
				/*++
				
				Routine Description:
				
				        playback one object from storage media currently selected
				
				Arguments:
				
				        objType - type of playback, where 0 is nine thumbnail playback
				                                          1 is four thumbnail playback
				                                          2 is one image playback
				                                          3 is image slide show playback
				                                          4 is video playback
				        objIndex - index of object to playback
				
				Return Value:
				
				        none
				
				--*/
				{
					UCHAR	sts = TRUE;
				
				        switch (G_ucStorageType)
				        {
				#if (SDRAM_OPTION == 1)
				                case K_MEDIA_None:
				                        SDRAM_PlaybackObject(objType, objIndex);
				                        break;
				#endif
				
				                default:
				#if (CARD_OPTION == 1)
				#if (PLAYBACK_OPTION)
				                        sts = Card_PlaybackObject(objType, objIndex);
					
				#endif                        
				#endif
				                        break;
				        }
				        
				        return sts;
				}
				
				//-----------------------------------------------------------------------------
				//STORAGE_UploadObject
				//-----------------------------------------------------------------------------
				UCHAR STORAGE_UploadObject(USHORT objType, USHORT objIndex) USING_0
				/*++
				
				Routine Description:
				
				        upload one object from storage media currently selected
				
				Arguments:
				
				        objType - type of object to capture, where 0 is to get object count
				                                                   1 is to get object FDBs
				                                                   2 is to upload one object
				        objIndex - index of object to upload
				
				Return Value:
				
				        none
				
				--*/
				{
					UCHAR	sts = TRUE;
					
				        switch (G_ucStorageType)
				        {
				#if (SDRAM_OPTION == 1)
				                case K_MEDIA_None:
				                        SDRAM_UploadObject(objType, objIndex);
				                        break;
				#endif
				                default:
				#if (CARD_OPTION == 1)
							sts = Card_UploadObject(objType, objIndex);
				#endif
				                        break;
				        }
				        
				        return sts;
				}
				
				//patch4.3@richie@md0603 begin
				#if (SINGLE_DIRECTORY == 0)
				//-----------------------------------------------------------------------------
				//STORAGE_GetDirData
				//-----------------------------------------------------------------------------
				UCHAR STORAGE_GetDirData(void) USING_0
				/*++
				
				Routine Description:
				
				        upload all dir data by index from storage media currently selected
				
				Return Value:
				
				        none
				
				--*/
				{
					UCHAR	sts = TRUE;
				
				        SDRAM_Dram2Usb(K_SDRAM_DcfDirBufAddr, G_USR_TotalDirectory * 14);	
				        
				        return sts;
				}
				#endif
				//patch4.3@richie@md0603 end
				
							

相关资源