tigersharc adsp-ts201s link port boot

Hi ,

I got the following  link for link port boot in C 

https://ez.analog.com/dsp/otherdsp/f/q-a/60348/link-boot.

But in this program , Master and slave are having exactly same code and transmitting LED blinking code  through link port 3

I need to send this code through link port 1

so I made some changes as below 

Processor_A.c:

#include <defts201.h>
#include <signal.h>
#include <sysreg.h>
#include <builtins.h>


#define COUNT 512
#define MODIFY 4
#define m_linkNo 1

typedef struct tcb_block
{
long DI;
long DX;
long DY;
long DP;

}tcb_block;

#pragma align _QUAD
int source[] = {
#include ".\Debug\Blink_LED.ldr"
};

int tx_done = 0;
volatile int tx_dma_result=0;

void link_transmit_isr(int dummy);

#pragma align _QUAD
tcb_block transmit_tcb;

union
{
unsigned long long dmablWord;
unsigned long vWord[2];
} dmastat;

void link_transmit_isr(int dummy)
{
dmastat.dmablWord = __builtin_sysreg_read2(__DSTAT);
tx_dma_result = (dmastat.vWord[0] >> (m_linkNo * 3 + 12)) & 0x7;

}

void main()
{
int i;
int dummy;

volatile __builtin_quad tcb_clr;
volatile __builtin_quad tcb_set;


//interrupt(SIGDMA4, link_transmit_isr);

__builtin_sysreg_write(__LTCTL0,0);
__builtin_sysreg_write(__LTCTL1,0);
__builtin_sysreg_write(__LTCTL2,0);
__builtin_sysreg_write(__LTCTL3,0);

__builtin_sysreg_write(__LRCTL0,0);
__builtin_sysreg_write(__LRCTL1,0);
__builtin_sysreg_write(__LRCTL2,0);
__builtin_sysreg_write(__LRCTL3,0);

dummy = __builtin_sysreg_read(__LTSTAT0);
dummy = __builtin_sysreg_read(__LRSTAT0);
dummy = __builtin_sysreg_read(__LTSTATC0);
dummy = __builtin_sysreg_read(__LRSTATC0);




// Open global interrupt enable
__builtin_sysreg_write(__SQCTLST, SQCTL_GIE);



tcb_clr = __builtin_compose_128((long long)TCB_DISABLE << 32, 0);
__builtin_sysreg_write4(__DC5, tcb_clr);


__builtin_sysreg_write(__LTCTL1,LTCTL_TEN | LTCTL_TCLKDIV4 );


for(i = 0; i < 100000; i++ ) // delay for receiver to get ready
{
asm("nop;;");
}

transmit_tcb.DI = (int)source;
transmit_tcb.DX = (COUNT << 16) | MODIFY;
transmit_tcb.DY = 0;
transmit_tcb.DP = TCB_INTMEM | TCB_QUAD | TCB_INT | TCB_DMAR;

tcb_set = __builtin_compose_128(((long long)transmit_tcb.DX << 32) | transmit_tcb.DI, ((long long)transmit_tcb.DP << 32) | transmit_tcb.DY);
__builtin_sysreg_write4(__DC5, tcb_set);

//__builtin_sysreg_write(__LTCTL0,LTCTL_TEN | LTCTL_TCLKDIV4 );

asm("nop;nop;nop;idle;;");
while(1)
{
asm("nop;;");
}

}

Processor_b.c  ;

#include <defts201.h>
#include <signal.h>
#include <sysreg.h>
#include <builtins.h>


#define COUNT 512
#define MODIFY 4
#define m_linkNo 1

typedef struct tcb_block
{
long DI;
long DX;
long DY;
long DP;

}tcb_block;

#pragma align _QUAD
int source[] = {
#include ".\Debug\Blink_LED.ldr"
};
int des[1000];
int tx_done = 0;
volatile int rx_dma_result=0;


void link_receive_isr(int dummy);

#pragma align _QUAD
tcb_block transmit_tcb;


union
{
unsigned long long dmablWord;
unsigned long vWord[2];
} dmastat;

void link_receive_isr(int dummy)
{
dmastat.dmablWord = __builtin_sysreg_read2(__DSTAT);
rx_dma_result = (dmastat.vWord[1] >> (m_linkNo * 3)) & 0x7;
}

void main()
{
int i;
int dummy;

volatile __builtin_quad tcb_clr;
volatile __builtin_quad tcb_set;

// interrupt(SIGDMA8, link_receive_isr);

__builtin_sysreg_write(__LTCTL0,0);
__builtin_sysreg_write(__LTCTL1,0);
__builtin_sysreg_write(__LTCTL2,0);
__builtin_sysreg_write(__LTCTL3,0);

__builtin_sysreg_write(__LRCTL0,0);
__builtin_sysreg_write(__LRCTL1,0);
__builtin_sysreg_write(__LRCTL2,0);
__builtin_sysreg_write(__LRCTL3,0);


// Open global interrupt enable
__builtin_sysreg_write(__SQCTLST, SQCTL_GIE);


dummy = __builtin_sysreg_read(__LTSTAT0);
dummy = __builtin_sysreg_read(__LRSTAT0);
dummy = __builtin_sysreg_read(__LTSTATC0);
dummy = __builtin_sysreg_read(__LRSTATC0);

tcb_clr = __builtin_compose_128((long long)TCB_DISABLE << 32, 0);
__builtin_sysreg_write4(__DC9, tcb_clr);



__builtin_sysreg_write(__LRCTL1,LRCTL_REN | LTCTL_TCLKDIV4 );


for(i = 0; i < 100000; i++ )
{
asm("nop;;");
}

//transmit_tcb.DI = (int)des;
transmit_tcb.DI = 0x0;
transmit_tcb.DX = (COUNT << 16) | MODIFY;
transmit_tcb.DY = 0;
transmit_tcb.DP = TCB_INTMEM | TCB_QUAD | TCB_INT | TCB_DMAR;

tcb_set = __builtin_compose_128(((long long)transmit_tcb.DX << 32) | transmit_tcb.DI, ((long long)transmit_tcb.DP << 32) | transmit_tcb.DY);
__builtin_sysreg_write4(__DC9, tcb_set);

//__builtin_sysreg_write(__LRCTL0,LRCTL_REN | LTCTL_TCLKDIV4 );



asm("nop;nop;nop;idle;;");
while(1)
{
asm("nop;;");
}

}

so this code not working 
I am able to send code in des[] array ... but  in this case (transmit_tcb.DI = 0x0 ) ...it LED corresponding to processorB is not blinking.

I am new to tigersharc. so can somebody send me the working code?

Parents Reply Children
  • 0
    •  Analog Employees 
    on Jan 9, 2020 12:37 PM in reply to Puneet

    Hello,

    Sorry for the delayed response.

    We would suggest you to look at the below VDSP installation path where you would find link port boot example. The MasterDSPB.asm file in this example has the provision to choose the required link port number for booting.
    Installation Path:\Program Files(x86)\Analog Devices\VisualDSP 5.1\TS\Examples\ADSP-TS201 EZ-KIT Lite\Link Boot

    Please make sure to verify the link port interface working between two boards before testing the boot.

    Regards,
    Lalitha.S