REVISION
Definition in file ENCODER_putData.c.
#include "../SYSTEM/sys_hardware.h"
#include "../SYSTEM/sys_main.h"
#include "../MESSAGE/message.h"
#include "../codec/codec.h"
#include "../coder/coder.h"
#include "encoder.h"
Include dependency graph for ENCODER_putData.c:

Go to the source code of this file.
Functions | |
| unsigned short | ENCODER_putData (int *pD, unsigned short reqLen) |
| Function puts encoder output data into media. | |
| void | ENCODER_cache (void) |
| Function serves as the encoder cache task handle. | |
| BOOL | ENCODER_cacheInit (void) |
| Function initialized the encoder cache interface. | |
|
|
Function serves as the encoder cache task handle. This task writes the media. Definition at line 133 of file ENCODER_putData.c. References Audio, FAT_fwrite(), st_AUDIO::file, st_CODER::flag, and NAND_readSec(). 00134 {
00135 USHORT buf[256];
00136
00137 if(!(Coder.flag&F_CODER_USE_CACHE))
00138 {
00139 // Cache is requested to shut down, this should be the only
00140 // reason coming here when cache is not used.
00141 Coder.flag |= F_CODER_ENCODER_SETIDLE;
00142 if( Coder.flag & F_CODER_ENCODER_IDLE) SEM_post(SEM_cacheIdle);
00143 else SEM_post(SEM_media);
00144 return;
00145 }
00146
00147 if(!(F_CODER_CACHESHUTDOWN & Coder.flag))
00148 {
00149 // If not in flushing mode, only write when cached enough data.
00150 if(cachedSecNum < MAX_CACHED_SECNUM) return;
00151 }
00152
00153 while(cachedSecNum)
00154 {
00155 NAND_readSec(rdCacheSec, buf, FALSE);
00156 FAT_fwrite(&Audio.file, buf, 256);
00157 rdCacheSec = SYS_nextCacheSec(rdCacheSec);
00158 cachedSecNum--;
00159 }
00160
00161 if( F_CODER_CACHESHUTDOWN & Coder.flag )
00162 {
00163 Coder.flag |= F_CODER_ENCODER_SETIDLE;
00164 if( Coder.flag & F_CODER_ENCODER_IDLE) SEM_post(SEM_cacheIdle);
00165 else
00166 {
00167 SEM_post(SEM_media);
00168 return;
00169 }
00170 }
00171 HDD_setPowerMode(HDD_POWEROFF, 0);
00172 }
|
Here is the call graph for this function:

|
||||||||||||
|
Function puts encoder output data into media. A NAND cache is managed here if HDD is present.
Definition at line 59 of file ENCODER_putData.c. References Audio, Encoder, FAT_fwrite(), FAT_totalSpace(), st_AUDIO::file, st_ENCODER::flag, st_CODER::flag, st_AUDIO::fptr, st_AUDIO::freeSpace, st_AUDIO::kbCount, st_SYSPARAM::memSync, NAND_writeSec(), SMEMBAR_UPDT, SSTATE_END, and st_AUDIO::wordCount. Referenced by ENCODER__mp3media(), and ENCODER__wavmedia(). 00060 {
00061 unsigned short secNum;
00062
00063 if(Coder.flag & F_CODER_USE_CACHE)
00064 {
00065 secNum = reqLen>>8;
00066 while(secNum--)
00067 {
00068 if(cachedSecNum == SYS_cacheSecNum())
00069 {
00070 // Can't catch up.
00071 return 0;
00072 }
00073 NAND_writeSec(wrCacheSec, (USHORT*)pD, FALSE);
00074 pD += 256;
00075 wrCacheSec = SYS_nextCacheSec(wrCacheSec);
00076 cachedSecNum++;
00077 }
00078
00079 if(cachedSecNum > MAX_CACHED_SECNUM)
00080 {
00081 if(0==SEM_count(SEM_cache)) SEM_post(SEM_cache);
00082 }
00083 }
00084 else
00085 {
00086 FAT_fwrite(&Audio.file, (unsigned short *)pD, reqLen);
00087 }
00088
00089 if(Coder.flag & F_CODER_ENCODER_SETIDLE)
00090 {
00091 if(0==SEM_count(SEM_cache)) SEM_post(SEM_cache);
00092 }
00093
00094 if(!(Encoder.flag&ENC_DISKFULL_POSTED))
00095 {
00096 Audio.fptr += reqLen;
00097 Audio.wordCount += reqLen;
00098 while(Audio.wordCount > 512)
00099 {
00100 Audio.wordCount -= 512;
00101 Audio.freeSpace -= 1;
00102 Audio.kbCount += 1;
00103 }
00104
00105 if(Audio.kbCount >= 1024)
00106 {
00107 USHORT percent;
00108 ULONG totalsp = FAT_totalSpace(SYS_isHDDpresent()?DISK_C:DISK_D)/16;
00109
00110 Audio.kbCount = 0;
00111 percent = ((Audio.freeSpace/16)*100)/totalsp;
00112 percent |= ((((Audio.freeSpace+sysParam.memSync)/16)*100)/totalsp)<<8;
00113 mMSG_send(sysMsgQ, SYS_MSG_ID, SMEMBAR_UPDT, percent, SYS_FOREVER);
00114 }
00115
00116 if( (Audio.freeSpace < DISK_RESERVED_SPACE)||
00117 (Audio.fptr > 0x7F800000) )
00118 {
00119 mMSG_send(uiParentMsgQ, SYS_MSG_ID, SSTATE_END, DONTCARE, SYS_FOREVER);
00120 Encoder.flag |= ENC_DISKFULL_POSTED;
00121 }
00122 }
00123
00124 return reqLen;
00125 }
|
Here is the call graph for this function:

1.3.9.1