beautypg.com

Sundance SMT326v2 User Manual

Page 15

background image

Release

Page 15 of 24

SMT326 DSP PC/ISA System User Guide

Document Name:

SMT326 Ugv2.doc

Original Date: 08/11/97

Product Name:

SMT326

Revision Date: 08/26/99

Author:

Graeme Parker – Fabio Ancona

while(((temp=(*i2c_s1)&0x01))==0) {
for(i=0;i!=175;i++);
}

/*
Enable I2C mux to point to Codec 0
Set LED=5
*/

fpga+=32; /* point to control register */
*fpga=0x85;

/* Initialise Codec via I2C */

for(channel=0;channel!=8;channel++) {

*fpga=0x85+(channel<<4);
/* printf("ch %d\n",channel);*/
for(delay=0;delay!=175;delay++);

i2c_send_address(0x20,0);
i2c_write(1);
i2c_write(0x00);
i2c_stop();

i2c_send_address(0x20,0);
i2c_write(2);
i2c_write(0x00);
i2c_stop();

i2c_send_address(0x20,0);
i2c_write(3);
i2c_write( 00);
i2c_stop();

i2c_send_address(0x20,0);
i2c_write(4);
i2c_write( 00);
i2c_stop();

ctrl_byte=9;

i2c_send_address(0x20,0);
i2c_write(5);
i2c_write(ctrl_byte);
i2c_stop();

i2c_send_address(0x20,0);
i2c_write(0x80);

i2c_restart(0x21,0);

temp=*i2c_sn; /* discard 1st byte */
temp=i2c_read(1);
for(delay=0;delay!=175;delay++);

i2c_stop();