⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 command.c

📁 image capture billing control system
💻 C
字号:
/*
Dword Pages_Check()		// return page_amount
{
	SmartMediaReadID();
	switch(SMI_DeviceCode)
	{
		case M16MB:
			return(0x8000);
//			return(16);
		case M32MB:
			return(0x10000);
//			return(32);
		default:
			return(0);
	}
}
*/
Word Count_Block()		// return page_amount
{
	SmartMediaReadID();
	switch(SMI_DeviceCode)
	{
		case M16MB:
			return(1024);
		case M32MB:
			return(2048);
		case M64MB:
			return(4096);
		case M128MB:
			return(8192);
		default:
			return(0);
	}
}

void Mem_Check()
{
/* Count MBytes
	Select_Mem1();
	Mem1_Mbytes = Mbytes_Check();
	if(Mem1_Mbytes==0) BIM_Exist=0;	else BIM_Exist=1;
	Mem1_Blocks = Mem1_Mbytes*64;
	Mem1_Pages = Mem1_Blocks*32;

	Select_Mem2();
	Mem2_Mbytes = Mbytes_Check();
	Mem2_Blocks = Mem2_Mbytes*64;
	Mem2_Pages = Mem2_Blocks*32;

	Select_SMC();
	SMC_Mbytes = Mbytes_Check();
	if(SMC_Mbytes==0) SMC_Exist=0;	else SMC_Exist=1;
	SMC_Blocks = SMC_Mbytes*64;
	SMC_Pages = SMC_Blocks*32;

	Total_Mem_Mbytes = Mem1_Mbytes + Mem2_Mbytes + SMC_Mbytes;
	Total_Mem_Blocks = Mem1_Blocks + Mem2_Blocks + SMC_Blocks;
	Total_Mem_Pages = Mem1_Pages + Mem2_Pages + SMC_Pages;
*/

/* Count Page
	Select_Mem1();
	Mem1_Pages = Pages_Check();
	if(Mem1_Pages==0) BIM_Exist=0;	else BIM_Exist=1;
	Mem1_Blocks = Mem1_Pages/32;
	Mem1_Mbytes = Mem1_Blocks/64;

	Select_Mem2();
	Mem2_Pages = Pages_Check();
	Mem2_Blocks = Mem2_Pages/32;
	Mem2_Mbytes = Mem2_Blocks/64;

	Select_SMC();
	SMC_Pages = Pages_Check();
	if(SMC_Pages==0) SMC_Exist=0;	else SMC_Exist=1;
	SMC_Blocks = SMC_Pages/32;
	SMC_Mbytes = SMC_Blocks/64;

	Total_Mem_Pages = Mem1_Pages + Mem2_Pages + SMC_Pages;
	Total_Mem_Blocks = Mem1_Blocks + Mem2_Blocks + SMC_Blocks;
	Total_Mem_Mbytes = Mem1_Mbytes + Mem2_Mbytes + SMC_Mbytes;
*/
// Count Block
	Select_Mem1();
	Mem1_Blocks = Count_Block();
	Mem1_Over64 = (Mem1_Blocks<BLOCKS_OF_64MB)? 0: 1;
	if(Mem1_Blocks==0)
	{
		BIM_Exist=0;
		Mem2_Blocks = 0;
	}
	else
	{
		BIM_Exist=1;

		Select_Mem2();
		Mem2_Blocks = Count_Block();
		Mem2_Over64 = (Mem2_Blocks<BLOCKS_OF_64MB)? 0: 1;
	}

	Select_SMC();
	SMC_Blocks = Count_Block();
	SMC_Over64 = (SMC_Blocks<BLOCKS_OF_64MB)? 0: 1;
	if(SMC_Blocks==0) SMC_Exist=0;	else SMC_Exist=1;

//	Total_Mem_Blocks = Mem1_Blocks + Mem2_Blocks + SMC_Blocks;
	BIM_Blocks = Mem1_Blocks + Mem2_Blocks;
}
/*
Bool Header_Check(Byte x, Byte y)
{
	if(x != 0xff) return(FALSE);
	if(y == 0xff) return(FALSE);
	y &= 0xe0;
	if(y == 0xe0) return(TRUE);
}
*/

void File_Reset()		// header check
{
//	Dword dwj;
//	Word wi;
//	Byte x, y;
	Byte file_num;

	if(File_Num == 0)
	{
		File_Pages = 0;
		File_Bytes = 0;
//		Bit_Rate = 0;
		return;
	}

	file_num = File_Num;
	if(BIM_Exist&SMC_Exist)
	{
		if(File_Num>(BIM_Files))
		{
			Mem_Select=SMC;
			file_num = File_Num-BIM_Files;
		}
		else
		{
			Mem_Select=BIM;
		}
	}
	else if(BIM_Exist&(~SMC_Exist))
	{
		Mem_Select=BIM;
	}
	else if((~BIM_Exist)&SMC_Exist)
	{
		Mem_Select=SMC;
	}
	else if((~BIM_Exist)&(~SMC_Exist))
	{
		return;
	}

	RD_Read(file_num);

	Play_Block = File_Start_Block;
	Play_Page = 0;
	Total_Played_Blocks = 0;

	if(Mem_Select==BIM)
	{
		Current_Flash_Mem_Blocks = BIM_Blocks;
	}
	else
	{
		Current_Flash_Mem_Blocks = SMC_Blocks;
	}

	if(Is_MP3) Yellow_Light(1, 1);
	return;
}
/*
Byte File_Quantity_Check()
{
	Byte i;

	for(i=0 ; i<32 ; i++)
	{
//		Start_and_Last_Block_Read(i);
		RD_Read(i+1);
		if( File_Start_Block==0xffff )
		{
			break;
		}
	}
	return(i);
}
*/
void Mem_Reset()
{
	Byte i;
//	Volume_Mute();

	Mem_Check();

	MP3_Files = 0;

	BIM_Files = 0;
	if(BIM_Exist)
	{
		Mem_Select=BIM;

		for(i=0 ; i<128 ; i++)
		{
			RD_Read(i+1);
			if( File_Start_Block==0xffff )
			{
				break;
			}
//			else Green_Light(1,1);
			if(Is_MP3) MP3_Files++;
		}
		BIM_Files = i;//File_Quantity_Check();
	}
//	else Green_Light(1,1);


	SMC_Files = 0;
	if(SMC_Exist)
	{
		Mem_Select=SMC;
		for(i=0 ; i<128 ; i++)
		{
			RD_Read(i+1);
			if( File_Start_Block==0xffff )
			{
				break;
			}
			if(Is_MP3) MP3_Files++;
		}
		SMC_Files = i;
	}

	Total_Files = BIM_Files + SMC_Files;

//	if(Total_Files==0) Red_Light(1,2);

	File_Num = (Total_Files==0)? 0: 1;
/*
	if(Total_Files==0)	// Memory(File) don't exist
	{
		File_Num=0;
	}
	else
	{
		File_Num = 1;
//		if(BIM_Files != 0) Mem_Select=BIM;
//		else Mem_Select=SMC;
//		RD_Read(0);
	}
*/
//	Status_Change(STATUS_STOP);
}

/*
void MP3_Reset()                                                  
{
	SectorBufferForMP3();
//	SectorBufferForUSB();
	MMU_Reset();
//	SectorBuffer51Mode();
}
*/
void Status_Change(Byte system_status)
{
	switch(system_status)
	{
		case STATUS_STOP:
			Volume_Mute();
			Mem_Reset();
			File_Reset();
			SystemStatus = STATUS_STOP;
			Start_Power_Off_Time();
			break;
		case STATUS_PLAY:
//			if(SystemStatus==STATUS_STOP) File_Reset();
			MP3_Mode();
			MMU_Reset();

			Play_Cnt=0;
			SystemStatus = STATUS_PLAY;
			Power_Off_Time=0;
			break;
		case STATUS_PAUSE:
			Volume_Mute();
			SystemStatus = STATUS_PAUSE;
			Start_Power_Off_Time();
			break;
		default: break;
	}
}

/*
void USB_Reset()
{
	MMU_Reset();
//	SectorBufferForUSB();
//	SectorBufferCardMode();
}
*/

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -