📄 linkboot_tx.c
字号:
//*********************************************************
//
// linkboot_tx.c : Link port boot code
//
// PROVIDED BY:
// ------------
// BittWare Research Systems, Inc.
// 33 North Main Street
// Concord, NH 03301
// Ph: 603-226-0404
// Fax: 603-226-6667
// WWW: www.bittware.com
// E-mail: support@bittware.com
//
// Copyright 2001, BittWare, Inc.
//
// The user is hereby granted a non-exclusive license to use and or
// modify this software provided that it runs on BittWare hardware.
// Usage of this software on non-BittWare hardware without the express
// written permission of BittWare is strictly prohibited.
//
//
// Ver. Dates Author Changes
// ---- -------- ------ -----------------------------
// 1.0 04/11/02 rpc Create
//
//*********************************************************
#include "sysreg.h"
#include "signal.h"
#include "stdio.h"
#define N 256 // Number of words to transfer
void isr_DMA7(int); // Proto for isr
int dm source[N]; // Source buffer
volatile int tx_intr = 0;
typedef struct
{
int *DI; // index
int DX; // count and stride in x direction
int DY; // count and stride in y direction
int DP; // DMA control word
}TCB;
TCB TCB_temp; // Temp structure for programming TCBs
__builtin_quad q; // Temp quad for programming TCBs
// ISR for DMAC7 (link 3 tx)
void isr_DMA7(int sig)
{
tx_intr++;
}
void main(void)
{
int i; // loop var
__builtin_sysreg_write(__SYSCON, 0x003a5000); // 64-bit external bus for memory (MBUB)
TCB_temp.DI = source; // index points to source buffer
TCB_temp.DX = 4 | (N << 16); // modify is 4 for quad-word transfers, count is N and must be shifted to upper half
TCB_temp.DY = 0; // only a 1 dimension DMA
TCB_temp.DP = 0x47000000; // control word set for quad-word transfers to internal memory with interrupt enabled
// setup LP3 to TX at CCLK/8
__builtin_sysreg_write(__LCTL3, 0x040);
q = __builtin_compose_128((long long) TCB_temp.DI | (long long)TCB_temp.DX << 32,
(long long)(TCB_temp.DY | (long long)TCB_temp.DP << 32));
__builtin_sysreg_write4(__DC7, q); // program the TCBs
while(tx_intr == 0) // Endless loop
{
i=i-i;
}
}
//
// End of file: linkboot_tx.c
//
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -