ftp.nice.ch/peanuts/GeneralData/Usenet/news/1989/CSN-89.tar.gz#/comp-sys-next/1989/Jul/YADSPQ

This is YADSPQ in view mode; [Up]


Date: Sun 05-Jul-1989 07:40:32 From: Unknown Subject: YADSPQ (Yet Another DSP Question) I have been struggling with the DSP for the past week or so, and thought I should tap into the net knowledge before I pull out the rest of my hair. Below is the assembly code that <should> return the 256 sine entries in the internal Y memory ROM. I used the initialization posted by Eric Thayer to configure the DSP (although I don't use external memory, I still need to enable the ROM data). The rest of the code just marches through the sine table and sends the entries to the host. What actually comes out is the first 128 entries in the table, some garbage, and then part of the table started over from the first. And to top it all off, it takes about 4 or 5 seconds to send this to the host. JEEZ I might as well use my calculator! What gives? Would some kind soul please shine the light on me. :-) ------------------------------ DSP Assembly code ----------------------- reset equ $0000 ; Address of reset vector start equ $40 ; Start of program mem data equ $100 ; Start of ROM sine table in Y mem org p:reset jmp >init dup $40-2 nop endm org p:start init movec #6,omr ; Data rom enabled, mode 2 bset #0,x:m_pbc ; Host port movep #>$0001F7,x:m_pcc ; Both serial ports (SC0 not available) bset #3,x:m_pcddr ; pc3 is an output with value bclr #3,x:m_pcd ; zero to enable the external ram movep #>$004000,x:m_cra ; Set up for external clock on DSP port movep #>$002300,x:m_crb ; Read L/~R on IF1 movep #>$000000,x:m_bcr ; No wait states on the external sram movep #>$00B400,x:m_ipr ; Intr levels: SSI=2, SCI=1, HOST=0 move #data,R2 ; Point R2 to the ROM sine table nop ; Allow R2 time to update move y:(R2)+,A0 ; Load first sine table value do #256,end_out ; Send 256 sine values to host xmt_dat jclr #1,x:$FFE9,xmt_dat ; Wait for host move A0,x:$FFEB ; Send sample to host move y:(R2)+,A0 ; Update A0 with next sine value end_out end $40 ------------------ Program to read the sine table ---------------- #include <dsp/dsp.h> #include <stdio.h> main() { int count; int output[256]; DSPBootFile("sine.dsp"); // Load the dsp image file DSPGetRXArray(output,256); // Get the 256 sine values from DSP for (count=0; count<256; count++) // Print the values printf("0x%X\n",output[count]); } >From: eht@f.word.cs.cmu.edu (Eric Thayer)
Date: Sun 05-Jul-1989 11:12:35 From: Unknown Subject: Re: YADSPQ (Yet Another DSP Question) DSPBootFile() opens the dsp in a mode such that if the MSB of the data in the HTX is high, the DSP driver interprets this as an error code. Hence the garbled data for half of the cycle. I sent NeXT a bug report about this one and they sent me a work around. I'll post their work around when when I get into work. And as you've noticed, the I/O throughput of the standard calls is not so good. There are better ways to do I/O (dsprecord uses them for instance), but so far I have not been able to see any example code for it. DSP coding on the NeXT requires perseverance. Also ping ask_next about these things so corporate NeXT is made aware of the issues they have to address.

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Marcel Waldvogel and Netfuture.ch.