/****************************************************************************************
*****************************************************************************************
Technická univerzita v Kosiciach
Fakulta elektrotechniky a informatiky
Katedra elektroniky a multimedialnych telekomunikacii

Tema diplomovej prace:    Implementacia zakladnych algoritmov cislicoveho spracovania
                          signalov pomocou procesorov Analog Devices ADSP218x a ADSP219x

Veduci diplomovej prace:  doc. Ing. Milos Drutarovsky, CSc.

*****************************************************************************************
Nazov suboru:             219x_int_tab.asm

Datum modifikacie:        29-04-2003

Autor:                    Peter Popadic

Verzia:                   1.00 pre ADSP2191, VisualDSP++ verzie 3

Opis:
Tabulky vektorov preruseni.
Zmenene obsluhy preruseni od IVint4 (SPORT0), zistuje sa ci prerusenie vzniklo v strede
DMA buffra alebo na konci buffra. Ak vzniklo na konci buffra, t.j. mame prijaty cely
ramec a skace sa na obsluhu prerusenia. 

*****************************************************************************************/

/* Example Interrupt table implementation */

#include <signal.h>
#include <def2191.h>

#ifdef __INCLUDE_DISPATCHER
/*
** When this macro is define the normal library dispatcher code is placed
** in the interrupt vector to avoid a jump and reduce code-size. Only works
** if the dispatcher code fits in the interrupt vector space. Cannot be
** used otherwise.
*/
#  include "lib_int_determiner.h"
#else
.extern  ___lib_int_determiner;
#endif

.extern  ___lib_int_table;
.extern  _____system_start;
.EXTERN Process_AD1885_Audio_Samples;
.EXTERN RX_Status;
.EXTERN _rx_buf;


.section/code IVreset;
.global __reset;
__reset:
    NOP;                     // this is a dummy used for setint 1; for sw debug.
    JUMP  _____system_start;
    NOP; NOP;

.section/code IVpwrdwn;
.global pwrdwn;
pwrdwn:
    MODIFY(I4+=-32);         // Move stack pointer past protected words.
#ifndef __INCLUDE_DISPATCHER
    JUMP ___lib_int_determiner(DB);
#endif
      DM(I4+= -1)=AR;        // Save scratch register
      AR=SIG_PWRDWN*__SIGA_SIZE;
#ifdef __INCLUDE_DISPATCHER
    LIB_INT_DETERMINER_CODE
#endif



.section/code    IVstackint;
.global stackint;
stackint:
    MODIFY(I4+=-32);         // Move stack pointer past protected words.
#ifndef __INCLUDE_DISPATCHER
    JUMP ___lib_int_determiner(DB);
#endif
      DM(I4+= -1)=AR;        // Save scratch register
      AR=SIG_STACKINT*__SIGA_SIZE;
#ifdef __INCLUDE_DISPATCHER
    LIB_INT_DETERMINER_CODE
#endif


.section/code    IVkernel;
.global singlestep;
singlestep:
    MODIFY(I4+=-32);         // Move stack pointer past protected words.
#ifndef __INCLUDE_DISPATCHER
    JUMP ___lib_int_determiner(DB);
#endif
      DM(I4+= -1)=AR;        // Save scratch register
      AR=SIG_KERNEL*__SIGA_SIZE;
#ifdef __INCLUDE_DISPATCHER
    LIB_INT_DETERMINER_CODE
#endif

/*** pp ***
.section/code      IVint4;
.global      int4;
int4:
    MODIFY(I4+=-32);         // Move stack pointer past protected words.
#ifndef __INCLUDE_DISPATCHER
    JUMP ___lib_int_determiner(DB);
#endif
      DM(I4+= -1)=AR;        // Save scratch register
      AR=SIG_INT4*__SIGA_SIZE;
#ifdef __INCLUDE_DISPATCHER
    LIB_INT_DETERMINER_CODE
#endif
*** pp ***/

/*** pp ***/
.section/code      IVint4;
.global      int4;
int4:
    ENA SR;                            // povolenie sekundarnych registrov
    ay1 = IOPG;
    IOPG = SPORT0_Controller_Page;

    ax0 = LENGTH(_rx_buf);              // zistuje ci prerusenie vzniklo v strede DMA buffra
    ay0 = IO(SP0DR_CNT);               // alebo na konci buffra
    ar = ax0 - ay0;
    if eq jump Roll_Over;

    ay0 = 0x8000;
    ax0 = dm(RX_Status);               // zistuje status bit (15) z RX_Status
    ar =ax0 AND ay0;
    if eq jump Process_AD1885_Audio_Samples; // skace na obsluhu prerusenia

/* ...house keeping prior to RTI */
Roll_Over:
    ar=3;                              // vicisti RX prerusenie
    io(SP0DR_IRQ)=ar;
    IOPG = ay1;
    DIS SR;                            // zakaz sekundarnych registrov
    RTI;

/*** pp ***/

.section/code    IVint5;
.global int5;
int5:
    MODIFY(I4+=-32);         // Move stack pointer past protected words.
#ifndef __INCLUDE_DISPATCHER
    JUMP ___lib_int_determiner(DB);
#endif
      DM(I4+= -1)=AR;        // Save scratch register
      AR=SIG_INT5*__SIGA_SIZE;
#ifdef __INCLUDE_DISPATCHER
    LIB_INT_DETERMINER_CODE
#endif


.section/code    IVint6;
.global int6;
int6:
    MODIFY(I4+=-32);         // Move stack pointer past protected words.
#ifndef __INCLUDE_DISPATCHER
    JUMP ___lib_int_determiner(DB);
#endif
      DM(I4+= -1)=AR;        // Save scratch register
      AR=SIG_INT6*__SIGA_SIZE;
#ifdef __INCLUDE_DISPATCHER
    LIB_INT_DETERMINER_CODE
#endif

.section/code    IVint7;
.global int7;
int7:
    MODIFY(I4+=-32);         // Move stack pointer past protected words.
#ifndef __INCLUDE_DISPATCHER
    JUMP ___lib_int_determiner(DB);
#endif
      DM(I4+= -1)=AR;        // Save scratch register
      AR=SIG_INT7*__SIGA_SIZE;
#ifdef __INCLUDE_DISPATCHER
    LIB_INT_DETERMINER_CODE
#endif


.section/code    IVint8;
.global int8;
int8:
    MODIFY(I4+=-32);         // Move stack pointer past protected words.
#ifndef __INCLUDE_DISPATCHER
    JUMP ___lib_int_determiner(DB);
#endif
      DM(I4+= -1)=AR;        // Save scratch register
      AR=SIG_INT8*__SIGA_SIZE;
#ifdef __INCLUDE_DISPATCHER
    LIB_INT_DETERMINER_CODE
#endif


.section/code    IVint9;
.global int9;
int9:
    MODIFY(I4+=-32);         // Move stack pointer past protected words.
#ifndef __INCLUDE_DISPATCHER
    JUMP ___lib_int_determiner(DB);
#endif
      DM(I4+= -1)=AR;        // Save scratch register
      AR=SIG_INT9*__SIGA_SIZE;
#ifdef __INCLUDE_DISPATCHER
    LIB_INT_DETERMINER_CODE
#endif


.section/code    IVint10;
.global int10;
int10:
    MODIFY(I4+=-32);         // Move stack pointer past protected words.
#ifndef __INCLUDE_DISPATCHER
    JUMP ___lib_int_determiner(DB);
#endif
      DM(I4+= -1)=AR;        // Save scratch register
      AR=SIG_INT10*__SIGA_SIZE;
#ifdef __INCLUDE_DISPATCHER
    LIB_INT_DETERMINER_CODE
#endif


.section/code    IVint11;
.global int11;
int11:
    MODIFY(I4+=-32);         // Move stack pointer past protected words.
#ifndef __INCLUDE_DISPATCHER
    JUMP ___lib_int_determiner(DB);
#endif
      DM(I4+= -1)=AR;        // Save scratch register
      AR=SIG_INT11*__SIGA_SIZE;
#ifdef __INCLUDE_DISPATCHER
    LIB_INT_DETERMINER_CODE
#endif


.section/code    IVint12;
.global int12;
int12:
    MODIFY(I4+=-32);         // Move stack pointer past protected words.
#ifndef __INCLUDE_DISPATCHER
    JUMP ___lib_int_determiner(DB);
#endif
      DM(I4+= -1)=AR;        // Save scratch register
      AR=SIG_INT12*__SIGA_SIZE;
#ifdef __INCLUDE_DISPATCHER
    LIB_INT_DETERMINER_CODE
#endif


.section/code    IVint13;
.global int13;
int13:
    MODIFY(I4+=-32);         // Move stack pointer past protected words.
#ifndef __INCLUDE_DISPATCHER
    JUMP ___lib_int_determiner(DB);
#endif
      DM(I4+= -1)=AR;        // Save scratch register
      AR=SIG_INT13*__SIGA_SIZE;
#ifdef __INCLUDE_DISPATCHER
    LIB_INT_DETERMINER_CODE
#endif


.section/code    IVint14;
.global int14;
int14:
    MODIFY(I4+=-32);         // Move stack pointer past protected words.
#ifndef __INCLUDE_DISPATCHER
    JUMP ___lib_int_determiner(DB);
#endif
      DM(I4+= -1)=AR;        // Save scratch register
      AR=SIG_INT14*__SIGA_SIZE;
#ifdef __INCLUDE_DISPATCHER
    LIB_INT_DETERMINER_CODE
#endif


.section/code    IVint15;
.global int15;
int15:
    MODIFY(I4+=-32);         // Move stack pointer past protected words.
#ifndef __INCLUDE_DISPATCHER
    JUMP ___lib_int_determiner(DB);
#endif
      DM(I4+= -1)=AR;        // Save scratch register
      AR=SIG_INT15*__SIGA_SIZE;
#ifdef __INCLUDE_DISPATCHER
    LIB_INT_DETERMINER_CODE
#endif

// end of file