Could anyone send me an example of C function calling (with
parameters' passing, return value retrieving) on ADSP-218x processor? |
|
C function calling from assembler
Started by ●June 17, 2002
Reply by ●June 17, 20022002-06-17
At 05:35 PM 6/17/2002 +0300, Martins Pukitis wrote: >Could anyone send me an example of C function calling (with parameters' >passing, return value retrieving) on ADSP-218x processor? I have written more 218x code than anyone I know, and I have never called an assembly routine from C with this processor family. I strongly suggest that you avoid C with the 218x family. The architecture of the 218x is very hostile to C. Since you are asking this question now, I suspect that you are still at the beginning of your project. If so, STOP, and write the application in ADI assembly. |
Reply by ●June 17, 20022002-06-17
Using the ADSP-2185,6,9 and presuming you are wanting an example of an assemble call from C Called from a C routine in the following form: rx_chan.est = UPower(temp,TCONST,rx_chan.est); .MODULE upower; #include "stddef.h" ! ---- ! 12:ROUTINE -- ulong UPower(short x,ushort tconst,ulong pwr) ! AR AY1 STACK[0],STACK[1] ! ! Updates the power estimate of a signal given the next signal value. ! The power is computed as a 32-bit value. This is just a one pole IIR filter. ! ! Returns: ! ! New power estimate (1.31 unsigned) ! ! ---- .entry UPower_; UPower_: your code.... .ENDMOD; Hope this helps..... Perry Howell Lead Design Engineer Vega Signaling Products Telex Communications, Inc 8601 East Cornhusker Hiway Lincoln NE, 68507-9702 402-465-6621 402-467-4003(fax) Al Clark <> 06/17/2002 12:28 PM To: Martins Pukitis <>, cc: Fax to: Subject: Re: [adsp] C function calling from assembler At 05:35 PM 6/17/2002 +0300, Martins Pukitis wrote: >Could anyone send me an example of C function calling (with parameters' >passing, return value retrieving) on ADSP-218x processor? I have written more 218x code than anyone I know, and I have never called an assembly routine from C with this processor family. I strongly suggest that you avoid C with the 218x family. The architecture of the 218x is very hostile to C. Since you are asking this question now, I suspect that you are still at the beginning of your project. If so, STOP, and write the application in ADI assembly. _____________________________________ Note: If you do a simple "reply" with your email client, only the author of this message will receive your answer. You need to do a "reply all" if you want your answer to be distributed to the entire group. _____________________________________ About this discussion group: To Join: Send an email to To Post: Send an email to To Leave: Send an email to Archives: http://groups.yahoo.com/group/adsp Other Groups: http://www.dsprelated.com/groups.php3 ">http://docs.yahoo.com/info/terms/ |
|
Reply by ●June 18, 20022002-06-18
Hi All, Its a good practice to start with C calling asm functions and later move on to asm Lets say there is a function to calulate the median of 3 varibales x,y,z. In C we want to implement a function which will pass 3 variables and return the median value. what you have to do is. Implement the function as flows. int median3(int x, int y, int z); If you want to implement the median function in asm the function name in asm should be _median3: an underscore should be put and the three parameters x,y,z will be loaded in R0,R1,R2 registers correspondingly. and in the asm routine the return value in this case should be loade into R0 register. So the C function will get the return value from asm. Try doing this. _mdeian3: ur code R0 = result; end: --- wrote: > Using the ADSP-2185,6,9 and presuming you are > wanting an example of an > assemble call from C > > Called from a C routine in the following form: > rx_chan.est = UPower(temp,TCONST,rx_chan.est); > .MODULE upower; > > #include "stddef.h" > > ! > ---- > ! 12:ROUTINE -- ulong UPower(short x,ushort > tconst,ulong pwr) > ! AR > AY1 STACK[0],STACK[1] > ! > ! Updates the power estimate of a signal given > the next signal value. > ! The power is computed as a 32-bit value. > This is just a one pole > IIR filter. > ! > ! Returns: > ! > ! New power estimate (1.31 unsigned) > ! > ! > ---- > .entry UPower_; > UPower_: > your code.... > .ENDMOD; > > Hope this helps..... > Perry Howell > Lead Design Engineer > Vega Signaling Products > Telex Communications, Inc > 8601 East Cornhusker Hiway > Lincoln NE, 68507-9702 > 402-465-6621 > 402-467-4003(fax) > > > Al Clark <> > 06/17/2002 12:28 PM > To: Martins Pukitis <>, > > cc: > Fax to: > Subject: Re: [adsp] C function > calling from assembler > At 05:35 PM 6/17/2002 +0300, Martins Pukitis wrote: > >Could anyone send me an example of C function > calling (with parameters' > >passing, return value retrieving) on ADSP-218x > processor? > > > > > > I have written more 218x code than anyone I know, > and I have never called > an assembly routine from C with this processor > family. > I strongly suggest that you avoid C with the 218x > family. The architecture > > of the 218x is very hostile to C. Since you are > asking this question now, > I > suspect that you are still at the beginning of your > project. If so, STOP, > and write the application in ADI assembly. > > > _____________________________________ > Note: If you do a simple "reply" with your email > client, only the author > of this message will receive your answer. You need > to do a "reply all" if > you want your answer to be distributed to the entire > group. > > _____________________________________ > About this discussion group: > > To Join: Send an email to > To Post: Send an email to > > To Leave: Send an email to > Archives: http://groups.yahoo.com/group/adsp > > Other Groups: http://www.dsprelated.com/groups.php3 > ">http://docs.yahoo.com/info/terms/ > > > _____________________________________ > Note: If you do a simple "reply" with your email > client, only the author of this message will receive > your answer. You need to do a "reply all" if you > want your answer to be distributed to the entire > group. > > _____________________________________ > About this discussion group: > > To Join: Send an email to > To Post: Send an email to > > To Leave: Send an email to > Archives: http://groups.yahoo.com/group/adsp > > Other Groups: http://www.dsprelated.com/groups.php3 > ">http://docs.yahoo.com/info/terms/ ===== ciao, ..ju __________________________________________________ |