mirror of
https://github.com/Zeal-Operating-System/ZealOS.git
synced 2024-12-24 22:50:28 +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
|
@ -1,47 +1,43 @@
|
|||
|
||||
#define INT_LAST_VALID_ENTRY 1 << 2
|
||||
#define INT_IOC 1 << 3
|
||||
#define INT_FIFO_ERR 1 << 4
|
||||
#define BDL_BUF_SIZE 2044
|
||||
#define PCM_BUF_SIZE 2048
|
||||
#define MAX_BDLS 32
|
||||
#define PCM_IN 0
|
||||
#define PCM_OUT 1
|
||||
#define MIC_IN 2
|
||||
#define INT_LAST_VALID_ENTRY 1 << 2
|
||||
#define INT_IOC 1 << 3
|
||||
#define INT_FIFO_ERR 1 << 4
|
||||
|
||||
#define BDL_BUF_SIZE 2044
|
||||
#define MAX_BDLS 32
|
||||
|
||||
#define PCM_BUF_SIZE 2048
|
||||
#define PCM_IN 0
|
||||
#define PCM_OUT 1
|
||||
#define MIC_IN 2
|
||||
|
||||
// Native Audio Mixer registers (all U16)
|
||||
#define RESET 0x00 // Reset Register
|
||||
#define MASTER_VOL 0x02 // Set Master Output Volume
|
||||
#define MIC_VOL 0x0E // Set Microphone Volume
|
||||
#define PCM_VOL 0x18 // Set Output Volume of PCM patterns
|
||||
#define REC_SLC 0x1A // Select Input Device
|
||||
#define REC_GAIN 0x1C // Set Input Gain
|
||||
#define MIC_GAIN 0x1E // Set Gain of Microphone
|
||||
#define EXT_ID 0x28 // Supported extended functions
|
||||
#define EXT_CTRL 0x2A // Enabling extended functions
|
||||
#define EXT_FRONT_RATE 0x2C // Sample rate of front speaker
|
||||
#define RESET 0x00 // Reset Register
|
||||
#define MASTER_VOL 0x02 // Set Master Output Volume
|
||||
#define MIC_VOL 0x0E // Set Microphone Volume
|
||||
#define PCM_VOL 0x18 // Set Output Volume of PCM patterns
|
||||
#define REC_SLC 0x1A // Select Input Device
|
||||
#define REC_GAIN 0x1C // Set Input Gain
|
||||
#define MIC_GAIN 0x1E // Set Gain of Microphone
|
||||
#define EXT_ID 0x28 // Supported extended functions
|
||||
#define EXT_CTRL 0x2A // Enabling extended functions
|
||||
#define EXT_FRONT_RATE 0x2C // Sample rate of front speaker
|
||||
|
||||
// Native Audio Bus Master registers
|
||||
#define PCM_INPUT_REG_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 MIC_INPUT_REG_BOX\
|
||||
0x20 // NABM register box for Microphone (sizeof NABM register box)
|
||||
#define GLOBAL_CTL 0x2C // Global Control Register (U32)
|
||||
#define GLOBAL_STS 0x30 // Global Status Register (U32)
|
||||
#define PCM_INPUT_REG_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 MIC_INPUT_REG_BOX 0x20 // NABM register box for Microphone (sizeof NABM register box)
|
||||
#define GLOBAL_CTL 0x2C // Global Control Register (U32)
|
||||
#define GLOBAL_STS 0x30 // Global Status Register (U32)
|
||||
|
||||
// NABM register box registers
|
||||
#define BUFFER_DSC_ADDR 0x00 // Physical Address of Buffer Descriptor List (U32)
|
||||
#define CUR_ENTRY_VAL\
|
||||
0x04 // Number of Actual Processed Buffer Descriptor Entry (U8)
|
||||
#define LAST_VALID_ENTRY 0x05 // Number of all Descriptor Entries (U8)
|
||||
#define TRANSFER_STS 0x06 // Status of Transferring Data (U16)
|
||||
#define CUR_IDX_PROC_SAMPLES\
|
||||
0x08 // Number of Transferred Samples in Actual Processed Entry (U16)
|
||||
#define PRCSD_ENTRY 0x0A // Number of Actual Processed Buffer Entry (U8)
|
||||
#define BUFFER_CNT\
|
||||
0x0B // Most Important Register for controlling Transfers (U8)
|
||||
#define BUFFER_DSC_ADDR 0x00 // Physical Address of Buffer Descriptor List (U32)
|
||||
#define CUR_ENTRY_VAL 0x04 // Number of Actual Processed Buffer Descriptor Entry (U8)
|
||||
#define LAST_VALID_ENTRY 0x05 // Number of all Descriptor Entries (U8)
|
||||
#define TRANSFER_STS 0x06 // Status of Transferring Data (U16)
|
||||
#define CUR_IDX_PROC_SAMPLES 0x08 // Number of Transferred Samples in Actual Processed Entry (U16)
|
||||
#define PRCSD_ENTRY 0x0A // Number of Actual Processed Buffer Entry (U8)
|
||||
#define BUFFER_CNT 0x0B // Most Important Register for controlling Transfers (U8)
|
||||
|
||||
class CAC97BufferDescriptorListEntry
|
||||
{
|
||||
|
@ -73,7 +69,7 @@ CAC97 ac97;
|
|||
|
||||
class CAudioStream
|
||||
{
|
||||
CFifoI64 * data;
|
||||
CFifoI64 *data;
|
||||
};
|
||||
|
||||
class CAudio
|
||||
|
@ -82,13 +78,13 @@ class CAudio
|
|||
I64 output_frames[AUDIO_MAX_STREAMS];
|
||||
};
|
||||
|
||||
CAudio Audio;
|
||||
CAudio audio;
|
||||
|
||||
U0 AudioInit()
|
||||
{
|
||||
I64 i = 0;
|
||||
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;
|
||||
|
@ -96,7 +92,7 @@ AudioInit;
|
|||
I64 AudioAvailableOutputStreamGet()
|
||||
{
|
||||
I64 stream = 0;
|
||||
while (FifoI64Count(Audio.output[stream].data))
|
||||
while (FifoI64Count(audio.output[stream].data))
|
||||
stream++;
|
||||
if (stream > AUDIO_MAX_STREAMS - 1)
|
||||
return -1;
|
||||
|
@ -110,7 +106,7 @@ I64 AudioSFXPlay(U32 *data, I64 length)
|
|||
if (stream < 0)
|
||||
return stream;
|
||||
for (i = 0; i < length; i++)
|
||||
FifoI64Ins(Audio.output[stream].data, data[i]);
|
||||
FifoI64Ins(audio.output[stream].data, data[i]);
|
||||
return stream;
|
||||
}
|
||||
|
||||
|
@ -133,10 +129,10 @@ U0 AC97OutputMix(U32 *buf, I64 length = NULL)
|
|||
|
||||
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);
|
||||
Audio.output_frames[j]++;
|
||||
FifoI64Remove(audio.output[j].data, &sample);
|
||||
audio.output_frames[j]++;
|
||||
acc_streams++;
|
||||
acc_sample_L += sample.u16[0];
|
||||
acc_sample_R += sample.u16[1];
|
||||
|
@ -241,4 +237,4 @@ U0 AC97Task()
|
|||
}
|
||||
|
||||
AC97Init;
|
||||
Spawn(&AC97Task,, "AC97 Task", 1);
|
||||
Spawn(&AC97Task,, "AC97 Task", 1);
|
Loading…
Reference in a new issue