📄 filesys103.txt
字号:
--------------------------------
Use to passed in function with matchCond. When passed this value, the refCon
passed K_USR_OUR_TYPE means match all our dcf file, else pass K_USR_JPG_TYPE
means match only jpeg file, K_USR_AVI_TYPE means match only avi file,
K_USR_WAV_TYPE file means match only wave file.
K_USR_OUR_TYPE
--------------------------------
The file type is our DCF file type.
K_USR_JPG_TYPE
--------------------------------
The file type is our jpeg file type.
K_USR_AVI_TYPE
--------------------------------
The file type is our avi file type.
K_USR_WAV_TYPE
--------------------------------
The file type is our wave file type.
================================================================================
================================================================================
BYTE DOS_CheckDiskSpace(WORD *reqCluster)
--------------------------------------------------------------------------------
Brief Description = Checking free disk space
Arguments = -> reqCluster
Input number of free cluster requested.
To check whole disk space set *reqCluster = 0xFFFF, don't
care return value then calculate free disk space bytes
using (ULONG)(*reqCluster) * (ULONG)G_DOS_ClusterSize.
<- reqCluster
Output number of free cluster found.
Return Value = If number of free cluster found is smaller than requested
number of cluster, FALSE is return else TRUE.
Global Read = G_DOS_FileSystemType, G_DOS_FatAddr, G_DOS_FatEndAddr,
G_DOS_Stop_Initial, G_DOS_Initial_Status,
G_DOS_SDRAM_FAT1Addr, G_DOS_FreeFatTable
Global Set = G_DOS_SDRAM_NextIntRetAddr, G_File_SDRAM_Read,
G_File_AudioEnable
Limitation = Doesn't support FAT32.
UI Messages = None.
Detail Description = This function actually scan FAT table, when cluster size
is small for example 2K and requested free cluster number
is big, and the cpu is slow, this will take long time.
================================================================================
================================================================================
WORD DOS_GetDiskSpace(void)
--------------------------------------------------------------------------------
Brief Description = Quick disk space checking function.
Arguments = None.
Return Value = number of free cluster disk space. To convert it to bytes,
(ULONG)return value * (ULONG)G_DOS_ClusterSize.
Global Read = G_DOS_TotalFreeCluster
Global Set = None.
Limitation = None.
UI Messages = None.
Detail Description = This function just return the G_DOS_TotalFreeCluster.
When create, delete file our DOS module will update G_DOS_
TotalFreeCluster. So if you don't use our function to cre-
ate and delete file, you must either update G_DOS_Total-
FreeCluster yourself or use DOS_CheckDiskSpace to calcu-
late disk space.
================================================================================
================================================================================
BYTE DOS_Format(BYTE eraseCard)
--------------------------------------------------------------------------------
Brief Description = Format storage media as DOS file system.
Arguments = -> eraseCard
bit 0 ON means do physical format.
OFF means do logical format
bit 7 ON means create DCF directory. This speed up format
plus directory initialization process.
bit 6 ON means optimized format. Bigger cluster size will
be used, this speed up searching action, but disk
space don't efficiently used. For example, if
cluster size is 16K, the photo size is 33K, then
17K space wasted. But since total clusters is
smaller, so the FAT searching could be faster.
Return Value = FALSE:format action fail.
None zero value:format action succeed.
Global Read =
Global Set =
Limitation = Current Implementation could support up to 2G storage
media, but actually for smc card, only 4M to 128M have
been tested, for cf card, only 4M to 256M have been
tested.
UI Messages = K_File_UI_Start_FormatCard, K_File_UI_End_FormatCard
K_File_UI_End_FormatCard, K_File_UI_Periodical
Detail Description = According to capacity of storage media and media type of
storage, this function will automactically determine
whether using FAT12, FAT16. Current implemetation don't
support FAT32. If M_Card_Initialize return FALSE, majorly
because storage media never format or unrecognized format,
you may ask user whether to do disk format, and use this
function if user want to do. After calling DOS_Format and
it return non zero value, should call M_Card_Initialize
with return value from DOS_Format. NOTE: Since DOS_Format
will reset some DOS globals for current storage media. so
if you are implement 2 storage media solution, for example
nand and cf card, if current format card is cf and FALSE is
return, and you then want to use nand, should set
G_Card_Type to K_MEDIA_NANDF, then call M_Card_Initialize
before you could use nand.
================================================================================
================================================================================
BYTE File_SnapJpg(BYTE *name)
--------------------------------------------------------------------------------
Brief Description = Snap a still image to storage media as a jpeg file inside
DCF folder.
Arguments = -> name
a DCF convension file name. NOTE: name is a 12 bytes array
which consist of 8 byte name, 3 byte extension, 1 byte at
name[11] must be 0x20 which means this is a file name. For
your convenient, USR_SetJpgName is provided to create the
name.
Return Value = FALSE if something wrong happen for example disk is full.
Global Read = G_Image_QTableIndex, G_Image_HSubSample, G_Image_SensorWidth,
G_Image_SensorHeight, G_Image_HSubSample, G_Image_VSubSample,
G_SDRAM_ImageAddr
Global Set =
Limitation =
UI Messages = (K_File_UI_Error, K_DOS_DiskFullErr),
(K_File_UI_Start_Save_File, fileSize),
(K_File_UI_Periodical, K_Act_Go_SaveFile)
(K_File_UI_End_Save_File, TRUE if save properly, else FALSE)
Detail Description = File_SnapJpg call INITIO_SetQTable to set q table according
to G_Image_QTableIndex. File_JpgLoadHeader to put jpeg hea-
der at the G_SDRAM_ImageAddr, then call File_JpgStillImage
to put the image just after the jpeg header, then call
File_Make to save the jpeg file image at G_SDRAM_ImageAddr
into DCF folder.
================================================================================
================================================================================
BYTE File_RecordAvi(BYTE *name, BYTE bAudio)
--------------------------------------------------------------------------------
Brief Description = Record video image to storage media as avi file inside DCF
folder.
Arguments = -> name
a DCF convension file name. NOTE: name is a 12 bytes array
which consist of 8 byte name, 3 byte extension, 1 byte at
name[11] must be 0x20 which means this is a file name. For
your convenient, USR_SetAviName is provided to create the
name.
-> bAudio
If your solution have audio input and user want recording
the avi with audio, then should pass TRUE, else FALSE.
Return Value = FALSE if something wrong happen for example disk is full.
Global Read = G_Image_QTableIndex, G_Image_HSubSample, G_Image_SensorWidth,
G_Image_SensorHeight, G_Image_HSubSample, G_Image_VSubSample,
G_SDRAM_ImageAddr
Global Set = G_File_AviTotalSize
Limitation =
UI Messages = (K_File_UI_Periodical, K_Act_Go_RecordAvi),
(K_File_UI_Periodical, K_Act_Go_RecordAviAud)
Detail Description = File_RecordAvi call INITIO_SetQTable to set q table accor
-ding to G_Image_QTableIndex. File_SetImageMode to prepare
asic for video mode. If bAudio is TRUE, File_AudioSetMode
to prepare asic for audio. During recording process, it
check for disk full case, idx buffer full case and stop
automatically when these case happen. If want stop record-
ing process by user, you could set G_ucStopStream to 1.
================================================================================
================================================================================
BYTE File_RecordWave(BYTE *name, ULONG ramAddr, ULONG ramSize, WORD wFormatTag)
--------------------------------------------------------------------------------
Brief Description = Record sound as wave file inside DCF folder.
Arguments =
-> name
a DCF convension file name. NOTE: name is a 12 bytes array
which consist of 8 byte name, 3 byte extension, 1 byte at
name[11] must be 0x20 which means this is a file name. For
your convenient, USR_SetWaveName is provided to create the
name.
-> ramAddr
Point to a ram buffer address (in word unit) to hold re-
cording audio data.
-> ramSize
The byte size of audio ram buffer.
-> wFormatTag
Audio compression method selection. Current possible
values are K_FormatTag_NonCompress(0x01),
K_FormatTag_IMA(0x11). NOTE: Must check if asic have built
in IMA compression if select K_FormatTag_IMA. Also, if
have IMA compression, card module don't include non
compression code to reduce code size.
Return Value = FALSE if something wrong happen for example disk is full.
Global Read =
Global Set =
Limitation =
UI Messages = (K_File_UI_Periodical, K_Act_Go_RecordAudio),
(K_File_UI_Start_Save_File, fileSize)
(K_File_UI_Periodical, K_Act_Go_SaveFile)
(K_File_UI_End_Save_File, TRUE if save properly, else
FALSE)
Detail Description = This function call File_RecordAudioStream which record
audio data into ram buffer. File_RecordAudioStream check
for disk full case, ram buffer full case, user abort case
to stop audio recording. It then return audio size, audio
rate, number of audio channel, compression method, bits of
audio data, etc to this function to save the audio data as
wave file to storage media.
================================================================================
================================================================================
BYTE USR_Play1File(WORD fileIndex,BYTE wantAudio)
--------------------------------------------------------------------------------
Brief Description = Find a file at DCF folder that match the given file index
and play it. It will check what type of file found and
play accordingly.
Arguments = -> fileIndex
-> wantAudio
If your solution have audio out you should pass TRUE. By
this way if the found file have audio, the audio will be
played. If your solution don't have audio out or you
purposely don't want the audio be played, you could pass
FALSE.
Return Value = Return TRUE if requested file is found and played. FALSE
if not found or file format not accepted.
Global Read = G_USR_PlayIndex
Global Set =
Limitation =
UI Messages = (K_File_UI_Start_PlayDscFile, file index)
K_File_UI_End_PlayDscFile, K_File_UI_Error if error
(K_File_UI_Start_PlayAviFile, file index)
(K_File_UI_Periodical, K_Act_Go_PlayAvi)
(K_File_UI_PlayVideoStrm1Frame, frame index)
K_File_UI_End_PlayAviFile, K_File_UI_Error if error
(K_File_UI_Start_PlayWaveFile, file index)
(K_File_UI_Periodical, K_Act_Go_PlayAudio)
K_File_UI_End_PlayWaveFile, K_File_UI_Error if error
Detail Description = When playing jpeg file, File_PlayJpg parse jpeg file,
load the jpeg image into dram, then call File_PlayDscImage
to play the image. When playing avi file, File_PlayAvi
parse the avi file, then call File_PlayAviStream
per video frame to play the video frame at dram. When
playing wave file, File_PlayWave parsing the wave file,
then called File_PlayWaveStream to play all audio stream
at dram.
================================================================================
================================================================================
BYTE File_PlayJpg(BYTE *name, WORD startCluster, ULONG ramAddr)
--------------------------------------------------------------------------------
Brief Description = Play the jpeg file.
Arguments = -> name
a DCF convension file name. NOTE: name is a 12 bytes array
which consist of 8 byte name, 3 byte extension, 1 byte at
name[11] must be 0x20 which means this is a file name. For
your convenient, USR_SetJpgName is provided to create the
name.
-> startCluster
If parsing 0, then File_PlayJpg will serach the DCF folder
for matching name requested. If parsing the start cluster
of the requested file, File_PlayJpg will not search using
the name, the file data is assessed start from the input
start cluster. NOTE: If parsing nonzero to startCluster,
G_DOS_FileSize must be set to the size of file.
-> ramAddr
The ram address (in word unit) to hold the jepg image to
be played. In USR_Play1File, ramAddr is passed
G_SDRAM_ImageAddr.
Return Value = Return TRUE if requested file is found and played. FALSE
if not found or jpeg file not accepted.
Global Read =
Global Set =
Limitation =
UI Messages = (K_File_UI_Start_PlayDscFile, file index)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -