If you know vhdl,
1. then you have to make your component with registers accessible via avalon bus
2. import it e.g. with SPOPC Builder "Interface to user logic"
3 .you can access these registers with the standard function
IOWR and IORD from your C code, you don`t have to build a driver or library.
I´ve made a small sample clock and c program in the following thread
http://www.niosforum.com/forum/index.php?a...=st&f=17&t=1503 (
http://www.niosforum.com/forum/index.php?act=st&f=17&t=1503)
or you can follow the pwm sample from altera.