[Audio] Add read len

This commit is contained in:
zilmar 2017-09-23 07:45:18 +10:00
parent d7d7ae5144
commit c3d45357a6
3 changed files with 16 additions and 2 deletions

View File

@ -106,8 +106,15 @@ EXPORT void CALL AiLenChanged(void)
EXPORT uint32_t CALL AiReadLength(void)
{
WriteTrace(TraceAudioInterface, TraceDebug, "Called");
return 0;
WriteTrace(TraceAudioInterface, TraceDebug, "Start");
uint32_t len = 0;
if (g_SoundDriver != NULL)
{
*g_AudioInfo.AI_LEN_REG = g_SoundDriver->AI_ReadLength();
len = *g_AudioInfo.AI_LEN_REG;
}
WriteTrace(TraceAudioInterface, TraceDebug, "Done (len: 0x%X)", len);
return len;
}
EXPORT void CALL AiUpdate(int32_t Wait)

View File

@ -106,6 +106,12 @@ void SoundDriverBase::AI_Update(bool Wait)
m_AiUpdateEvent.IsTriggered(Wait ? SyncEvent::INFINITE_TIMEOUT : 0);
}
uint32_t SoundDriverBase::AI_ReadLength()
{
CGuard guard(m_CS);
return m_AI_DMAPrimaryBytes & ~0x3;
}
void SoundDriverBase::LoadAiBuffer(uint8_t *start, uint32_t length)
{
uint8_t nullBuff[MAX_SIZE];

View File

@ -28,6 +28,7 @@ public:
void AI_Startup();
void AI_Shutdown();
void AI_Update(bool Wait);
uint32_t AI_ReadLength();
virtual void SetFrequency(uint32_t Frequency);
virtual void StartAudio();