Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!rochester!pt.cs.cmu.edu!vi.ri.cmu.edu!rwb From: rwb@vi.ri.cmu.edu (Bob Berger) Newsgroups: comp.sys.next Subject: DSP help needed Keywords: off chip memory Message-ID: <5262@pt.cs.cmu.edu> Date: 20 Jun 89 20:18:27 GMT Organization: Carnegie-Mellon University, CS/RI Lines: 76 I need to write some dsp routines that process arrays of data. I wrote a simple test program which reads an array from the host interface into DSP memory, then writes the array back to the host with each element shifted. The program works when I put the array into the DSP's on chip memory, but fails when I try to use the off chip memory at $2000. When it fails, all of the elements returned are copies of the last element written to the memory, as if the memory were not enabled or something. What am I doing wrong? Here's my code: ; array56k.asm DSP bootstrap program that reads an array, ; right shifts each element, and sends the array back to the host org p:0 reset jmp >rcv_cnt dup $40-2 ; output must be a contiguous segment nop endm org p:$40 ; starting address rcv_cnt jclr #0,x:$FFE9,rcv_cnt ; wait for data from host move x:$FFEB,R0 ; RO = count move #$2000,R1 ; R1 = array address in external memory do R0,end_rcv rcv_dat jclr #0,x:$FFE9,rcv_dat ; wait for data from host move x:$FFEB,A1 ; get word from host move A1,x:(R1)+ ; put it in external memory end_rcv move #$2000,R1 ; R1 = array address in external memory do R0,end_xmt move x:(R1)+,A1 ; get word from memory LSR A ; right-shift one place xmt_dat jclr #1,x:$FFE9,xmt_dat ; wait for host ready move A1,x:$FFEB ; send shifted word to host end_xmt jmp rcv_cnt end $40 #include int count = 5; int data[] = {2,4,6,8,10}; main() { int i; DSPBootFile("array56k"); DSPPutTX(count); DSPPutTXArray(data,count); DSPGetRXArray(data,count); for (i = 0; i < count; i++) printf("%d ",data[i]); printf("\n"); DSPClose(); } --