/************************************************************************/ /* TALKTHRU.C Written by: Jerry Lenaz, 12/21/92 */ /* Revised by: Matt Begg, 1/5/93 */ /************************************************************************/ /* This is a talkthru program written entirely in C to be used */ /* with the ADSP-21020 EZ-LAB board. */ /* */ /* This talkthru program defines the port addressses for the */ /* particular input and output channel being used, sets up the */ /* IRQ3 interrrupt to call the talkthru routine, and sets up */ /* an idle wait loop to conserve power while waiting for the */ /* interrupt. */ /************************************************************************/ #include <21020.h> /* For the idle() command */ #include /* For the interrupt command */ #include /* For the segment function */ volatile int in_port1 segment(hip_reg0); /* Microphone Left */ volatile int in_port2 segment(hip_reg1); /* Microphone Right */ volatile int out_port1 segment(hip_reg2); /* Speaker Left */ volatile int out_port2 segment(hip_reg3); /* Speaker Right */ volatile int control_0 segment(hip_reg4); /* Control 0 */ void timer_isr (int interrupt_number); void process_input(int); void irq2_interrupt(int); void main(void) { timer_set(6250000, 6250000); interrupt(SIG_TMZ0, timer_isr); interrupt(SIG_IRQ3, process_input); interrupt(SIG_IRQ2, irq2_interrupt); timer_on(); while (1) { idle(); } } void process_input(int sig_number) { float i1 = in_port1; float i2 = in_port2; out_port1 = 2 * i1; out_port2 = 2 * i2; } void irq2_interrupt(int sig_number) { control_0 = 0x3F00; } void timer_isr(int interrupt_number) { set_flag(SET_FLAG1, TGL_FLAG); }