mirror of
https://github.com/Zeal-Operating-System/ZealOS.git
synced 2024-12-25 23:10:32 +00:00
Reformat AC97 #define value tab-alignment.
This commit is contained in:
parent
dcdde184ea
commit
bff3a763ea
1 changed files with 42 additions and 46 deletions
|
@ -2,9 +2,11 @@
|
||||||
#define INT_LAST_VALID_ENTRY 1 << 2
|
#define INT_LAST_VALID_ENTRY 1 << 2
|
||||||
#define INT_IOC 1 << 3
|
#define INT_IOC 1 << 3
|
||||||
#define INT_FIFO_ERR 1 << 4
|
#define INT_FIFO_ERR 1 << 4
|
||||||
|
|
||||||
#define BDL_BUF_SIZE 2044
|
#define BDL_BUF_SIZE 2044
|
||||||
#define PCM_BUF_SIZE 2048
|
|
||||||
#define MAX_BDLS 32
|
#define MAX_BDLS 32
|
||||||
|
|
||||||
|
#define PCM_BUF_SIZE 2048
|
||||||
#define PCM_IN 0
|
#define PCM_IN 0
|
||||||
#define PCM_OUT 1
|
#define PCM_OUT 1
|
||||||
#define MIC_IN 2
|
#define MIC_IN 2
|
||||||
|
@ -22,26 +24,20 @@
|
||||||
#define EXT_FRONT_RATE 0x2C // Sample rate of front speaker
|
#define EXT_FRONT_RATE 0x2C // Sample rate of front speaker
|
||||||
|
|
||||||
// Native Audio Bus Master registers
|
// Native Audio Bus Master registers
|
||||||
#define PCM_INPUT_REG_BOX\
|
#define PCM_INPUT_REG_BOX 0x00 // NABM register box for PCM IN (sizeof NABM register box)
|
||||||
0x00 // NABM register box for PCM IN (sizeof NABM register box)
|
#define PCM_OUTPUT_REG_BOX 0x10 // NABM register box for PCM OUT (sizeof NABM register box)
|
||||||
#define PCM_OUTPUT_REG_BOX\
|
#define MIC_INPUT_REG_BOX 0x20 // NABM register box for Microphone (sizeof NABM register box)
|
||||||
0x10 // NABM register box for PCM OUT (sizeof NABM register box)
|
|
||||||
#define MIC_INPUT_REG_BOX\
|
|
||||||
0x20 // NABM register box for Microphone (sizeof NABM register box)
|
|
||||||
#define GLOBAL_CTL 0x2C // Global Control Register (U32)
|
#define GLOBAL_CTL 0x2C // Global Control Register (U32)
|
||||||
#define GLOBAL_STS 0x30 // Global Status Register (U32)
|
#define GLOBAL_STS 0x30 // Global Status Register (U32)
|
||||||
|
|
||||||
// NABM register box registers
|
// NABM register box registers
|
||||||
#define BUFFER_DSC_ADDR 0x00 // Physical Address of Buffer Descriptor List (U32)
|
#define BUFFER_DSC_ADDR 0x00 // Physical Address of Buffer Descriptor List (U32)
|
||||||
#define CUR_ENTRY_VAL\
|
#define CUR_ENTRY_VAL 0x04 // Number of Actual Processed Buffer Descriptor Entry (U8)
|
||||||
0x04 // Number of Actual Processed Buffer Descriptor Entry (U8)
|
|
||||||
#define LAST_VALID_ENTRY 0x05 // Number of all Descriptor Entries (U8)
|
#define LAST_VALID_ENTRY 0x05 // Number of all Descriptor Entries (U8)
|
||||||
#define TRANSFER_STS 0x06 // Status of Transferring Data (U16)
|
#define TRANSFER_STS 0x06 // Status of Transferring Data (U16)
|
||||||
#define CUR_IDX_PROC_SAMPLES\
|
#define CUR_IDX_PROC_SAMPLES 0x08 // Number of Transferred Samples in Actual Processed Entry (U16)
|
||||||
0x08 // Number of Transferred Samples in Actual Processed Entry (U16)
|
|
||||||
#define PRCSD_ENTRY 0x0A // Number of Actual Processed Buffer Entry (U8)
|
#define PRCSD_ENTRY 0x0A // Number of Actual Processed Buffer Entry (U8)
|
||||||
#define BUFFER_CNT\
|
#define BUFFER_CNT 0x0B // Most Important Register for controlling Transfers (U8)
|
||||||
0x0B // Most Important Register for controlling Transfers (U8)
|
|
||||||
|
|
||||||
class CAC97BufferDescriptorListEntry
|
class CAC97BufferDescriptorListEntry
|
||||||
{
|
{
|
||||||
|
@ -82,13 +78,13 @@ class CAudio
|
||||||
I64 output_frames[AUDIO_MAX_STREAMS];
|
I64 output_frames[AUDIO_MAX_STREAMS];
|
||||||
};
|
};
|
||||||
|
|
||||||
CAudio Audio;
|
CAudio audio;
|
||||||
|
|
||||||
U0 AudioInit()
|
U0 AudioInit()
|
||||||
{
|
{
|
||||||
I64 i = 0;
|
I64 i = 0;
|
||||||
for (i = 0; i < AUDIO_MAX_STREAMS; i++)
|
for (i = 0; i < AUDIO_MAX_STREAMS; i++)
|
||||||
Audio.output[i].data = FifoI64New(AUDIO_STREAM_FIFO_SIZE, sys_task);
|
audio.output[i].data = FifoI64New(AUDIO_STREAM_FIFO_SIZE, sys_task);
|
||||||
}
|
}
|
||||||
|
|
||||||
AudioInit;
|
AudioInit;
|
||||||
|
@ -96,7 +92,7 @@ AudioInit;
|
||||||
I64 AudioAvailableOutputStreamGet()
|
I64 AudioAvailableOutputStreamGet()
|
||||||
{
|
{
|
||||||
I64 stream = 0;
|
I64 stream = 0;
|
||||||
while (FifoI64Count(Audio.output[stream].data))
|
while (FifoI64Count(audio.output[stream].data))
|
||||||
stream++;
|
stream++;
|
||||||
if (stream > AUDIO_MAX_STREAMS - 1)
|
if (stream > AUDIO_MAX_STREAMS - 1)
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -110,7 +106,7 @@ I64 AudioSFXPlay(U32 *data, I64 length)
|
||||||
if (stream < 0)
|
if (stream < 0)
|
||||||
return stream;
|
return stream;
|
||||||
for (i = 0; i < length; i++)
|
for (i = 0; i < length; i++)
|
||||||
FifoI64Ins(Audio.output[stream].data, data[i]);
|
FifoI64Ins(audio.output[stream].data, data[i]);
|
||||||
return stream;
|
return stream;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -133,10 +129,10 @@ U0 AC97OutputMix(U32 *buf, I64 length = NULL)
|
||||||
|
|
||||||
for (j = 0; j < AUDIO_MAX_STREAMS; j++)
|
for (j = 0; j < AUDIO_MAX_STREAMS; j++)
|
||||||
{
|
{
|
||||||
if (FifoI64Count(Audio.output[j].data))
|
if (FifoI64Count(audio.output[j].data))
|
||||||
{
|
{
|
||||||
FifoI64Remove(Audio.output[j].data, &sample);
|
FifoI64Remove(audio.output[j].data, &sample);
|
||||||
Audio.output_frames[j]++;
|
audio.output_frames[j]++;
|
||||||
acc_streams++;
|
acc_streams++;
|
||||||
acc_sample_L += sample.u16[0];
|
acc_sample_L += sample.u16[0];
|
||||||
acc_sample_R += sample.u16[1];
|
acc_sample_R += sample.u16[1];
|
||||||
|
@ -241,4 +237,4 @@ U0 AC97Task()
|
||||||
}
|
}
|
||||||
|
|
||||||
AC97Init;
|
AC97Init;
|
||||||
Spawn(&AC97Task,, "AC97 Task", 1);
|
Spawn(&AC97Task,, "AC97 Task", 1);
|
Loading…
Reference in a new issue