www.pudn.com > OS.rar > S200TTS1BIN_Access_byFAT.c, change:2006-01-12,size:1480b
#include "system_head.h"
#include "component_head.h"
#ifdef C_SND_S200TTS_SUPPORT
//-----------------------------------------------------------------
extern LPTR TTS1BIN_Curr_Addr;
extern LPTR TTS1BIN_Dest_Addr;
extern unsigned int TTS1BIN_Dest_Offset;
extern unsigned int Frame_Length;
int fs_Handle_S200TTS1=-1; //when =-1,it say,have't open SP_WORD.200,not need close
//begin address at _TTS1BIN_Curr_DS:_TTS1BIN_Curr_Addr
void S200TTS1BIN_Access_Init(void)
{
fs_Handle_S200TTS1 = open (GLPSTR("a:\\SP_WORD.200"), O_RDWR );
}
//move Frame_Length words from [TTS1BIN_Curr_DS:TTS1BIN_Curr_Addr] to [TTS1BIN_Dest_DS:TTS1BIN_Dest_Addr]
//then add Frame_Length to Dest pointer,Curr need not add,because, next time it is cal again
void S200TTS1BIN_Access_GetData(void)
{
UINT32 Dest_Addr;
lseek( fs_Handle_S200TTS1, TTS1BIN_Curr_Addr, 0);
Dest_Addr = (UINT32)( (TTS1BIN_Dest_Addr < 1) + TTS1BIN_Dest_Offset );
read( fs_Handle_S200TTS1, Dest_Addr, Frame_Length);
Dest_Addr += Frame_Length;
TTS1BIN_Dest_Offset = Dest_Addr & 0x0001;
TTS1BIN_Dest_Addr = Dest_Addr >> 1;
}
void S200TTS1BIN_Access_End(void)
{
if(fs_Handle_S200TTS1 != -1)
{
//SpFSclose(fs_Handle_S200TTS1); //guili 2005.10.22
close(fs_Handle_S200TTS1); //guili 2005.10.22
}
fs_Handle_S200TTS1 = -1; //let user know, this time SP_WORD.200 have closed
}
//-----------------------------------------------------------------
#endif //C_SND_S200_SUPPORT