Hi, Details on using Super Fast ISRs are in 3 messages I posted to this group: - 4:59am, November 27, 2002 "RE: [motoroladsp] Measuring PW using Quad Timer Captures" - 10:09am, September 24, 2002: "RE: [motoroladsp] Doubt regarding context saving for SCI callback routine." - 6:43am, September 25, 2002: "RE: [motoroladsp] Timer Pins, more I/O" An example of how to use a Super Fast ISR is shown below. The "context saving code" is the saving (pushing) and restoring (popping) of the CPU registers to/from the stack. This should always be done in assembler. You can call a C function from your Super Fast ISR, but the C function must use the "#pragma interrupt" statement as shown below, so it will save and restore the CPU registers it uses. We use "#pragma interrupt" by itself, without any arguments, as shown by the following code example. This code is for a "Super Fast" ISR, which we use for Timer channels used for Frequency or Period measurement. Note that the assembler interface routine for the Super Fast ISR is automatically generated from a file containing macro definitions. We use "#pragma interrupt" without any arguments because the CodeWarrior on-line manual says that this will save and restore only the registers that are used by the ISR. This will work OK if you use "#pragma interrupt" for the ISR itself and also for all functions called by the ISR. Again, this is only for "Super Fast" interrupts. For all other ISRs we use the SDK Interrupt Dispatcher and "Normal" interrupts. If you are using the SDK Interrupt Dispatcher, you should only need to use "#pragma interrupt" for Super Fast interrupts. This is because the SDK Interrupt Dispatcher saves and restores either all registers (for a "Normal" interrupt) or most registers (for a "Fast" interrupt). You can see this in the SDK on-line documentation, start it as follows: Start Programs Motorola Embedded SDK 2.5 Help and Documentation In "Contents", go to: Motorola Embedded SDK Core Documentation SDK Programmer's Guide 7 Interrupts Section 7.2.1 explains the differences between the 3 types of ISRs. Section 7.2.6 describes the SDK Interrupt Dispatcher. Section 7.2.8.3 describes using "#pragma interrupt" with the SDK Interrupt Dispatcher. Also look at Section 7.5.1 "Using Pragma Interrupt". We use only the "Static Installation of ISR with Super Fast Context Save", which is described in Section 7.2.2.2.1 of the online SDK documentation. I hope this helps you, please let me know if you have any more questions. Regards, Art Johnson Senior Systems Analyst PMC Prime Mover Controls Inc. 3600 Gilmore Way Burnaby, B.C., Canada V5G 4R8 Phone: 604 433-4644 FAX: 604 433-5570 Email: http://www.pmc-controls.com =========== From the file "freqindef.dat": /**************************************************************************** * * Frequency Input Definition Structure data definitions * * The macro freqindeffun() is defined to either extract the enumeration name * for each structure (the first data on each line), or the data for the * DSPTMR_FP_IN_SCALE_T and DSPTMR_FP_IN_CFG_T structures as described below. * * * DSPTMR_FP_IN_SCALE_T structure: * SLWORD pulses_per_rev; Pulses per revolution (must be >=1) * SWORD level_select; Input level select data * WORD ch_units; Units (Hz or RPM) for freq. inputs * * * DSPTMR_FP_IN_CFG_T structure: * SWORD ad_idx; Index into the ANA_DATA array * SWORD ad_in_idx; Index into the ANA_INPUT_DATA array * WORD count_init_val; CTRL register init. value for counting pulses * WORD period_init_val; CTRL register init. value for period measurement * DSP_TIMER_T *p_dsp_timer; Pointer to the DSP chip Timer structure * DSPTMR_FP_DATA_T *p_dsp_fp_data; Pointer to the Frequency/period input data structure * * * NOTE - The pulses_per_rev value is a "signed engineering units" value, * where the upper 16 bits are the integer part, and the lower 16 * bits are the fractional part of the number. This gives a resolution * of 1/65536 of an engineering unit. * * NOTE - Set the ad_in_idx value to -1 if the input does not use the * ANA_INPUT_DATA array for scaling the input. * ****************************************************************************/ // TMRB0 = Engine RPM freqindeffun( TMRB0_FREQ_IN_ENUM, ( 1UL << 16 ), FP_IN_LEVEL_SENS_HIGH, FP_INP_UNITS_HZ, ENGINE_RPM, ENGINE_RPM_FILT_ENUM, DSPTMR_0_CTRL_FREQ_COUNT_IN_INIT_VAL, DSPTMR_0_CTRL_FREQ_PERIOD_IN_INIT_VAL, ArchIO.TimerB.Channel0, g_dsp_tmrb0_data, TimerB0_Interrupt ) =========== From the "io_func.c" file: // Automatically create the functions for the Timer Interrupt // Service Routines (ISRs) for the Frequency/Period inputs #undef freqindeffun #define freqindeffun(v1,v2,v3,v4,v5,v6,v7,v8,v9,v10,v11) \ void v11( void ) { \ asm (lea (sp)+ ); \ asm (move y0,x:(sp)+ ); \ asm (move r2,x:(sp)+ ); \ asm (move r3,x:(sp) ); \ asm (move # ## v9,r2 ); \ asm (move # ## v10,r3 ); \ asm (move x:(r2 + DSPTMR_SCR_OFFSET),y0 ); \ asm (jsr Freq_Period_Input_ISR ); \ asm (pop r3 ); \ asm (pop r2 ); \ asm (pop y0 ); \ asm (rti ); \ } #include "freqindef.dat" #undef freqindeffun /*******************************************************************************\ ******************************* * * Freq_Period_Input_ISR() Procedure - Global * * Purpose: Function that processes the data for the * Frequency/Period input Interrupt * Service Routine (ISR) * Setup: None * Call: void Freq_Period_Input_ISR( * WORD status, * DSP_TIMER_T *p_dsp_timer, * DSPTMR_FP_DATA_T *p_dsp_fp_data * ) * Return: None * ********************************************************************************\ ******************************/ #pragma interrupt void Freq_Period_Input_ISR( WORD status, // Status read from the DSP Timer DSP_TIMER_T *p_dsp_timer, // Pointer to the DSP Timer DSPTMR_FP_DATA_T *p_dsp_fp_data // Pointer to the input data structure ) { #pragma interrupt LWORD period_value; // Period value LWORD subtract_value; // Period subtract value . . (do the interrupt processing) . return; } -----Original Message----- From: Kohei Matsumaru [mailto:] Sent: Wednesday, February 12, 2003 6:50 AM To: Subject: [motoroladsp] How to use Super Fast ISR for nested interrupts Hi, I don't understand how to implement faster nestable interrupts routine using embedded SDK on DSP56F803. IRQA and IRQB are used for communication with host processor. Also, PWM interrputs are used. First, I used archInstallISR library for IRQA and IRQB. But the ISR library was too late to handle host. And I dicide to use archInstallSFastISR to resolve the problem of ISR overhead. I know Super Fast ISR does not save any context data and I should write context saving code to be able nested interrupts. But I don't understand how to write context saving code. Does any one has sample code or document to save context data? Thanks in advance, Kohei Matsumaru _____________________________________ 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: To Post: To Leave: Archives: http://www.yahoogroups.com/group/motoroladsp More Groups: http://www.dsprelated.com/groups.php3 ">http://docs.yahoo.com/info/terms/ | |||
|