Audio Ports

Programming, for all ages and all languages.
abraker95
Member
Member
Posts: 36
Joined: Mon Feb 14, 2011 7:39 am

Audio Ports

Post by abraker95 »

I've been able to make the pc speaker beep, but how do I output and get input to/from the Audio ports (the red, green [and in some cases blue] ports where you plug in the headphones, speakers, and micrphones)?
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: Audio Ports

Post by Combuster »

Write a driver for your audio chipset.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
abraker95
Member
Member
Posts: 36
Joined: Mon Feb 14, 2011 7:39 am

Re: Audio Ports

Post by abraker95 »

are there any tutorials? How do you make a driver?
User avatar
Chandra
Member
Member
Posts: 487
Joined: Sat Jul 17, 2010 12:45 am

Re: Audio Ports

Post by Chandra »

abraker95 wrote:are there any tutorials?
Hardly any. Don't always rely on tutorials, do some research. Not an offence, just a suggestion.
Programming is not about using a language to solve a problem, it's about using logic to find a solution !
abraker95
Member
Member
Posts: 36
Joined: Mon Feb 14, 2011 7:39 am

Re: Audio Ports

Post by abraker95 »

I already did, and I did try to go to devices in control panel to find hardware port access, but nothing :cry:
User avatar
neon
Member
Member
Posts: 1567
Joined: Sun Feb 18, 2007 7:28 pm
Contact:

Re: Audio Ports

Post by neon »

If its a PCI card, you would need to obtain its information from the PCI config space and a datasheet for the hardware device. If its onboard, its probably in the motherboard chipset specifications.

If you cannot find the datasheet you are looking for, post your audio card and [we] might be able to find it. Do attempt to search for it first however.
OS Development Series | Wiki | os | ncc
char c[2]={"\x90\xC3"};int main(){void(*f)()=(void(__cdecl*)(void))(void*)&c;f();}
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: Audio Ports

Post by Combuster »

abraker95 wrote:Are there any tutorials?
Have you read Beginner Mistakes? You just made one.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
abraker95
Member
Member
Posts: 36
Joined: Mon Feb 14, 2011 7:39 am

Re: Audio Ports

Post by abraker95 »

Oh yea the motherboard config sheet... How did I miss that??? I'll check it out soon. :lol:
abraker95
Member
Member
Posts: 36
Joined: Mon Feb 14, 2011 7:39 am

Re: Audio Ports

Post by abraker95 »

I found nothing, just a documentation on pins on the motherboard(with not port address)... How does the computer know that for example the pc speaker is port 0x61?
Tosi
Member
Member
Posts: 255
Joined: Tue Jun 15, 2010 9:27 am
Location: Flyover State, United States
Contact:

Re: Audio Ports

Post by Tosi »

For something as old as the PC speaker, it's practically standard. For newer cards, it's probably stored somewhere in memory or by the BIOS but you have to know where to look for that at. Also port 0x61 is the keyboard controller, although the PC speaker is controlled through it.
User avatar
neon
Member
Member
Posts: 1567
Joined: Sun Feb 18, 2007 7:28 pm
Contact:

Re: Audio Ports

Post by neon »

Hello,

What document are you looking in? Whats the make/model? (Asking because onboard audio is in my chipsets spec. Are you sure you are looking at the right document?)
OS Development Series | Wiki | os | ncc
char c[2]={"\x90\xC3"};int main(){void(*f)()=(void(__cdecl*)(void))(void*)&c;f();}
User avatar
Brendan
Member
Member
Posts: 8561
Joined: Sat Jan 15, 2005 12:00 am
Location: At his keyboard!
Contact:

Re: Audio Ports

Post by Brendan »

neon wrote:Hello,
abraker95 wrote:I found nothing, just a documentation on pins on the motherboard(with not port address)... How does the computer know that for example the pc speaker is port 0x61?
What document are you looking in? Whats the make/model? (Asking because onboard audio is in my chipsets spec. Are you sure you are looking at the right document?)
Sounds like abraker95 is looking at the motherboard manual, not the chipset datasheet/s.

To find the right chipset datasheet/s, sometimes you need to download a collection of them from Intel (e.g. all the "desktop" ones that suit a specific type of CPU) and use the "vendor ID" and "device ID" from both the PCI host controller and the PCI to LPC bridge to determine which datasheet/s are the right datasheets.

If the chipset isn't made by Intel, then you might be out of luck - for other chipset manufacturers (SiS, VIA, etc) it can be very hard to get any information at all.


Cheers,

Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
abraker95
Member
Member
Posts: 36
Joined: Mon Feb 14, 2011 7:39 am

Re: Audio Ports

Post by abraker95 »

That's the only documentation I have, and the motherboard was made by a company called Gigabyte... So how does the computer know the port addresses when I look at them using device manager?
User avatar
Brynet-Inc
Member
Member
Posts: 2426
Joined: Tue Oct 17, 2006 9:29 pm
Libera.chat IRC: brynet
Location: Canada
Contact:

Re: Audio Ports

Post by Brynet-Inc »

abraker95 wrote:That's the only documentation I have, and the motherboard was made by a company called Gigabyte... So how does the computer know the port addresses when I look at them using device manager?
And what colour is your computer case? that's important information.
Image
Image
Twitter: @canadianbryan. Award by smcerm, I stole it. Original was larger.
User avatar
neon
Member
Member
Posts: 1567
Joined: Sun Feb 18, 2007 7:28 pm
Contact:

Re: Audio Ports

Post by neon »

Hello,

As a developer, you should know that the computer doesnt know anything.

You arent looking at the right spec - search Google for your chipsets datasheets. Do keep in mind that, as posted above, many manufacturers dont release these datasheets. If you cant find the spec, either post your chipset type here or dont worry about onboard audio support as there isnt any other way.

The OS "knows" how to communicate with the device because of the device driver thats installed-isnt anything special to it.
OS Development Series | Wiki | os | ncc
char c[2]={"\x90\xC3"};int main(){void(*f)()=(void(__cdecl*)(void))(void*)&c;f();}
Post Reply