共2条
1/1 1 跳转至页
DM642,DSP DM642 DSP摄像机系统
问
为了避免那些无聊的技术骗子,我把原先的内容删除了。
史修栋
上海润图智能系统有限公司
021-62947943
David@SmartSystem.com.cn
答 1: EagleEye的波形对比图:系统中最关键的信号:DSP到SDRAM的同步时钟的波形图,在信号完整性处理前后的对比如下:
http://www.21icsearch.com/buzi/upimage/upfile/20051152354330.jpg
史修栋
上海润图智能系统有限公司
David@SmartSystem.com.cn
答 2: EagleEye拍摄的图片(局部):EagleEye按照300万像素拍摄的图片(局部):http://www.21icsearch.com/buzi/upimage/upfile/20051191710470.jpg
史修栋
上海润图智能系统有限公司
David@SmartSystem.com.cn
答 3: EagleEye的电路板(图片)EagleEye的电路板:
http://www.21icsearch.com/buzi/upimage/upfile/20051192243530.jpg
史修栋
上海润图智能系统有限公司
David@SmartSystem.com.cn
答 4: 欢迎在这里讨论DSP技术问题欢迎在这里讨论DSP技术问题,有问必答。
史修栋
上海润图智能系统有限公司
David@SmartSystem.com.cn 答 5: 有一点没说图像输出格式是什么 答 6: 请教不知道楼主的系统网络传输是采用什么方式压缩呢,是mpeg4还是H.263?
还有USB1.1配在这上面是不是有些慢了?整个系统卖价多少?
系统做的蛮好,不过不知道楼主的市场定位是哪里 答 7: 不再销售EagleEye由于EagleEye已经成为成熟的产品,不再作为硬件平台零售了。
对这个平台有真正诚意的大客户,请直接打我公司的电话联系。
史修栋 总经理
上海润图智能系统有限公司
021-62947943
答 8: 峰值运算能力:48MIPS( 答 9: 排版工具你所采用的PCB布线工具是什么?好象是POWERPCB吧 答 10: 峰值运算能力:4800MIPS。谢谢americ的指正。
内部主频600MHz,8级指令流水线。所以是4800MIPS,即48亿次运算每秒。
史修栋
答 11: PCB布线工具史修栋
你所采用的PCB布线工具是什么?好象是POWERPCB吧
从图片来看,主要是手工布线是吗?你做仿真了没?
你的SDRAM同步时钟是怎样处理的?是零延时时钟分配芯片吧! 答 12: 关于布线工具的回答
回答你的问题,如下:
1、问:你所采用的PCB布线工具是什么?好象是POWERPCB吧
答:对。
2、问:从图片来看,主要是手工布线是吗?你做仿真了没?
答:全部手工布线。几乎所有信号都做过仔细的仿真分析。这是保证系统稳定的关键技术之一。我的一个帖子“EagleEye的波形对比图:”中有图片对比。
我个人观点:做PCB layout,最重要的是高频信号完整性处理,而不是布线如何漂亮。大家可以在PCB专栏中看到很多PCB layout贴图,我真想告诉他们:“如果真想让人欣赏你的作品,请贴出信号波形来!这才能看出你的功底。”
3、你的SDRAM同步时钟是怎样处理的?是零延时时钟分配芯片吧!
答:这个问题恕我不能回答你,这是关键技术之一。我的产品要卖钱的。
史修栋
上海润图智能系统有限公司
David@SmartSystem.com.cn
答 13: 关于布线工具的问题史修栋
谢谢你的回答,SDRAM同步时钟的处理我也做过,不方便回答的也没关系,能否告诉我你用POWERPCB布板,原理图是用什么画的?是Orcad吗? 答 14: 具体技术问题,欢迎电话联系
更具体的技术问题,欢迎电话联系。
不论任何朋友,我都欢迎。
021-62803271
013701696609
史修栋
上海润图智能系统有限公司
David@SmartSystem.com.cn 答 15: 哇,推销啊 答 16: 帮你顶请问你买的DM642,32MByte SDRAM,USB芯片价格是多少啊 答 17: DSP常用外围芯片价格:
以下的价格,是市场零售价:
DM642:600MHz RMB400元左右;
SDARM: 4M x 32-bit RMB80;
USB: USB1.1 RMB12。
注意:我只卖EagleEye系统,不卖芯片。
021-62803271
013701696609
MSN: shixiudong@hotmail.com
史修栋
上海润图智能系统有限公司
David@SmartSystem.com.cn
答 18: DM642 EMAC 部分,接上LWIP ,运行良好
#include "Emac.h"
#include "eth.h"
//---------Raw Data Buffers----------
//
// This program uses internal memory, so buffer size is
// just 1518 In order to make sure buffers are cache
// aligned, if each were in cacheable external memory
// the size should be at least 1536 so as to fill enitre
// cache line.
#define PKT_MAX 32
#pragma DATA_SECTION(packet_header, ".ExtDat1");
EMAC_Pkt packet_header[PKT_MAX];
#pragma DATA_SECTION(packet_buffer, ".ExtDat1");
Uint8 packet_buffer[PKT_MAX][1536];
EMAC_Config g_emacConfig;
PKTQ FreeQueue; // Free packets for RX or Tx
PKTQ RxQueue; // Received packets
// Declare some local status variables
Handle hEMAC = 0; // Handle to our EMAC instance
volatile uint LinkStatus = 0; // Current link status
Uint8 SrcMacID[ETH_ALEN] = {0x00,0x20,0x45,0x20,0x33,0x68};
Uint32 EmacRxNumtest=0;
#pragma CODE_SECTION(EmacInitial, ".PROGRAM");
int EmacInitial()
{
Uint32 i;
g_emacConfig.ModeFlags = EMAC_CONFIG_MODEFLG_CHPRIORITY;
g_emacConfig.MdioModeFlags = MDIO_MODEFLG_AUTONEG;
g_emacConfig.TxChannels = 1;
memcpy(g_emacConfig.MacAddr,SrcMacID,6);
g_emacConfig.RxMaxPktPool = 8;
g_emacConfig.pfcbGetPacket = &GetPacket;
g_emacConfig.pfcbFreePacket = &FreePacket;
g_emacConfig.pfcbRxPacket = &RxPacket;
g_emacConfig.pfcbStatus = &StatusUpdate;
g_emacConfig.pfcbStatistics = &StatisticsUpdate;
InterruptInit();
EMACControlModuleInit();
MDIOInit();
EMACModuleInit();
// Initialize our buffer pool
memset( &FreeQueue, 0, sizeof(PKTQ) );
memset( &RxQueue, 0, sizeof(PKTQ) );
// Init the buffer headers. Note that the
// buffer pointer and buffer length are fixed
for( i=0; i<PKT_MAX; i++ )
{
memset( &packet_header[i], 0, sizeof(EMAC_Pkt) );
packet_header[i].pDataBuffer = packet_buffer[i];
packet_header[i].BufferLen = 1518;
pqPush( &FreeQueue, &packet_header[i] );
}
// Open EMAC instance
if(EMAC_open( 1, (Handle)0x12345678, &g_emacConfig, &hEMAC ))
{
return -1;
}
// Set the receive filter
// 只接收发给本机的网络包
if(EMAC_setReceiveFilter( hEMAC, EMAC_RXFILTER_BROADCAST))
{
return -1;
}
return 1;
}
#pragma CODE_SECTION(EMACControlModuleInit, ".PROGRAM");
void EMACControlModuleInit()
{
Uint32 i;
Uint32 tmpVal;
// Globally disable EMAC/MDIO interrupts in wrapper and
// put both EMAC and MDIO modules into reset
EMAC_RSET( EWCTL, EMAC_FMKS( EWCTL, INTEN, DISABLE ) |
EMAC_FMKS( EWCTL, EMACRST, YES ) |
EMAC_FMKS( EWCTL, MDIORST, YES ) );
// Wait ablout 100 cycles
for( i=0; i<5; i++ )
{
tmpVal = EMAC_RGET( EWCTL );
}
// Leave EMAC/MDIO interrupts disabled and take both
// EMAC and MDIO modules out of reset
EMAC_RSET( EWCTL, EMAC_FMKS( EWCTL, INTEN, DISABLE ) |
EMAC_FMKS( EWCTL, EMACRST, NO ) |
EMAC_FMKS( EWCTL, MDIORST, NO ) );
// Wait ablout 100 cycles
for( i=0; i<5; i++ )
{
tmpVal = EMAC_RGET( EWCTL );
}
// Set EMAC Priority to "2" ,allocation regs "3"
EMAC_RSET( EWTRCTRL, 0x23 );
// Set Interrupt Timer Count (CPUclk/4)
EMAC_RSET( EWINTTCNT, 1500 );
// Enable global interrupt in wrapper
EMAC_FSETS( EWCTL, INTEN, ENABLE );
return;
}
#pragma CODE_SECTION(MDIOInit, ".PROGRAM");
void MDIOInit()
{
#define PCLK 5
MDIO_RSET( CONTROL, MDIO_FMKS( CONTROL, ENABLE, YES ) |
MDIO_FMK( CONTROL, CLKDIV, PCLK ) |
MDIO_FMKS( CONTROL, PREAMBLE, DISABLED));
return;
}
#pragma CODE_SECTION(EMACModuleInit, ".PROGRAM");
void EMACModuleInit()
{
volatile Uint32 *pRegAddr;
Uint32 i;
Uint32 tmpVal = 0;
//Disable transmit,receive and clear MACCCONTROL
EMAC_FSETS( TXCONTROL, TXEN, DISABLE );
EMAC_FSETS( RXCONTROL, RXEN, DISABLE );
EMAC_RSET( MACCONTROL, 0 );
// MUST manually init TXnHDPs to NULL
pRegAddr = EMAC_ADDR( TX0HDP );
for( i=0; i<8; i++ )
{
*pRegAddr++ = 0;
}
// MUST manually init RXnHDPs to NULL
pRegAddr = EMAC_ADDR( RX0HDP );
for( i=0; i<8; i++ )
{
*pRegAddr++ = 0;
}
// 初始化统计寄存器
pRegAddr = EMAC_ADDR( RXGOODFRAMES );
for( i=0; i<36; i++ )
{
*pRegAddr++ = 0;
}
//初始化MAC地址 00 01 02 03 04 05
//每个通道都初始化
pRegAddr = EMAC_ADDR( MACADDRL0 );
for( i=0; i<8; i++ )
{
*pRegAddr++ = g_emacConfig.MacAddr[5];
}
EMAC_RSET( MACADDRM, g_emacConfig.MacAddr[4] );
for( i=3; i>0; i--)
{
tmpVal = ( tmpVal<<8 ) | g_emacConfig.MacAddr[i];
}
EMAC_RSET( MACADDRH, tmpVal );
// Buffer offset always be zero
EMAC_RSET( RXBUFFEROFFSET, 0 );
// Clear Unicast receive on channel 0-7
EMAC_RSET( RXUNICASTCLEAR, 0xFF );
// Reset receive MBP enable register
EMAC_RSET( RXMBPENABLE, 0 );
// Enable transmit channel and receive channel interrupts
EMAC_RSET( TXINTMASKCLEAR, 0xFF );
EMAC_RSET( TXINTMASKSET , 1<<0 );
EMAC_RSET( RXINTMASKCLEAR, 0xFF );
EMAC_RSET( RXINTMASKSET , 1<<0 );
// Enable transmit
EMAC_FSETS( TXCONTROL, TXEN, ENABLE );
// Enable receive
EMAC_FSETS( RXCONTROL, RXEN, ENABLE );
//Enable global interrupt in control module
EMAC_FSETS( EWCTL, INTEN, ENABLE );
return;
}
#pragma CODE_SECTION(InterruptInit, ".PROGRAM");
void InterruptInit()
{
IRQ_globalDisable();
IRQ_setVecs(vectors);
IRQ_map(IRQ_EVT_MACINT, 6);
IRQ_resetAll();
IRQ_nmiEnable();
IRQ_enable(IRQ_EVT_MACINT); //使能EMAC中断
IRQ_globalEnable();
return;
}
/*
*----------GetPacket - Get empty packet for RX-------------
*
* This function is called from the EMAC module to get an
* empty packet buffer. It returns a packet buffer to the
* EMAC or returns NULL if there are no buffers available.
*/
#pragma CODE_SECTION(GetPacket, ".PROGRAM");
EMAC_Pkt *GetPacket( Handle hApplication )
{
EMAC_Pkt *pPkt;
// Verify if handle came back OK. It is not used in this example
if( (Uint32)hApplication != 0x12345678 )
{
return(0);
}
// Pop a packet off our local free queue
pPkt = pqPop(&FreeQueue);
if( pPkt )
{
// Tell the EMAC what offset to use by setting the DataOffset field
// in the packet.
pPkt->DataOffset = 0;
}
return( pPkt );
}
/*
* FreePacket - Free packet that originated from TX or GetPacket().
*
* This function is called from the EMAC module to free a
* packet buffer after a TX operation (or RX in the case of
* a RX shutdown).
*
*/
#pragma CODE_SECTION(FreePacket, ".PROGRAM");
void FreePacket( Handle hApplication, EMAC_Pkt *pPKT )
{
// Verify if handle came back OK. It is not used in this example
if( (Uint32)hApplication != 0x12345678 )
{
return;
}
pqPush( &FreeQueue, pPKT );
}
/*
* RxPacket - Reveived packet from the Network.
*
* This function is called by the EMAC to indicate a receive.
* It just pushes the packet our receive queue.
*
* This function returns a free packet to replace the RX packet on
* the EMAC queue. If there are no free packets available, it
* returns NULL.
*/
#pragma CODE_SECTION(RxPacket, ".PROGRAM");
EMAC_Pkt *RxPacket( Handle hApplication, EMAC_Pkt *pPKT )
{
// Verify if handle came back OK. It is not used in this example
if( (Uint32)hApplication != 0x12345678 )
{
return(0);
}
net_handle((pPKT->pDataBuffer+pPKT->DataOffset),pPKT->ValidLen);
pqPush( &FreeQueue, pPKT );
return( GetPacket(hApplication) );
}
#pragma CODE_SECTION(Emac_Send, ".PROGRAM");
int Emac_Send(struct sk_buff *skb)
{
int i;
if(skb->pPkt==0)
{
return -1;
}
skb->pPkt->Flags = EMAC_PKT_FLAGS_SOP | EMAC_PKT_FLAGS_EOP ;
skb->pPkt->ValidLen = skb->len;
skb->pPkt->DataOffset = 0;
skb->pPkt->PktChannel = 0;
skb->pPkt->PktLength = skb->len;
skb->pPkt->PktFrags = 1;
// Must mask DSP mapped EMAC ISR when calling EMAC functions
IRQ_disable( IRQ_EVT_MACINT );
i = EMAC_sendPacket( hEMAC, skb->pPkt );
IRQ_enable( IRQ_EVT_MACINT );
if(i!=0)
{
return -1;
}
return 0;
}
int Emac_Get_Addr(unsigned char *addr)
{
memcpy(addr, SrcMacID, ETH_ALEN);
return 0;
}
char *LinkStr[] = { "No Link",
"10Mb/s Half Duplex",
"10Mb/s Full Duplex",
"100Mb/s Half Duplex",
"100Mb/s Full Duplex" };
// StatusUpdate - The EMAC or MDIO status has changed
#pragma CODE_SECTION(StatusUpdate, ".PROGRAM");
void StatusUpdate( Handle hApplication )
{
uint retval;
EMAC_Status status;
/* Verify if handle came back OK. It is not used in this example */
if( (Uint32)hApplication != 0x12345678 )
{
return;
}
/*
* The status update function is called for several reasons, including
* LINK change events and EMAC errors. Get the current status and print
* it out. Don't start sending packets until there is a good link.
*
* NOTE: Call back into the EMAC is used without any reentrancy concerns.
* This because we are a callback function currently that was called
* from EMAC. Thus the reentrancy protection is still active!
*/
retval = EMAC_getStatus( hEMAC, &status );
LinkStatus = status.MdioLinkStatus;
}
// StatisticsUpdate - The EMAC statistics are in danger of overflow
#pragma CODE_SECTION(StatisticsUpdate, ".PROGRAM");
void StatisticsUpdate( Handle hApplication )
{
/* Verify if handle came back OK. It is not used in this example */
if( (Uint32)hApplication != 0x12345678 )
{
return;
}
/*
* Here call the EMAC_getStatistics() function and pass them to whoever
* needing statistics information. This example doesn't have anything to
* do with it so nothing is called here.
*/
}
// Pop a desc buffer off a queue
#pragma CODE_SECTION(pqPop, ".PROGRAM");
EMAC_Pkt *pqPop( PKTQ *pq )
{
EMAC_Pkt *pPktHdr;
IRQ_disable( IRQ_EVT_MACINT );
pPktHdr = pq->pHead;
if( pPktHdr )
{
pq->pHead = pPktHdr->pNext;
pq->Count--;
}
pPktHdr->pPrev = pPktHdr->pNext = 0;
IRQ_enable( IRQ_EVT_MACINT );
return( pPktHdr );
}
// Push a desc buffer onto a queue
#pragma CODE_SECTION(pqPush, ".PROGRAM");
void pqPush( PKTQ *pq, EMAC_Pkt *pPktHdr )
{
IRQ_disable( IRQ_EVT_MACINT );
pPktHdr->pNext = 0;
if( !pq->pHead )
{
// Queue is empty - Initialize it with this one packet
pq->pHead = pPktHdr;
pq->pTail = pPktHdr;
}
else
{
// Queue is not empty - Push onto END
pq->pTail->pNext = pPktHdr;
pq->pTail = pPktHdr;
}
pq->Count++;
IRQ_enable( IRQ_EVT_MACINT );
return;
}
答 19: 关于VIDEO PORT 的时钟问题我想用DM642加上SAA7105做视频输出,DM642的VIDEO PORT的时钟输入VCLK1频率该怎么定,是不是由不同的D/A转换芯片(ENCODER)来决定,直接接到SAA7105的时钟输出引脚PIXCLKO行吗,VIDEO PORT的时钟输出引脚VCLK2由VCLK1产生吗?同频率吗?还有时钟输出VCLK2是不是直接接到SAA7105(ENCODER)的时钟输入PIXCLKI,作为ENCODER的时钟基准?谢谢
史修栋
上海润图智能系统有限公司
021-62947943
David@SmartSystem.com.cn
答 1: EagleEye的波形对比图:系统中最关键的信号:DSP到SDRAM的同步时钟的波形图,在信号完整性处理前后的对比如下:
http://www.21icsearch.com/buzi/upimage/upfile/20051152354330.jpg
史修栋
上海润图智能系统有限公司
David@SmartSystem.com.cn
答 2: EagleEye拍摄的图片(局部):EagleEye按照300万像素拍摄的图片(局部):http://www.21icsearch.com/buzi/upimage/upfile/20051191710470.jpg
史修栋
上海润图智能系统有限公司
David@SmartSystem.com.cn
答 3: EagleEye的电路板(图片)EagleEye的电路板:
http://www.21icsearch.com/buzi/upimage/upfile/20051192243530.jpg
史修栋
上海润图智能系统有限公司
David@SmartSystem.com.cn
答 4: 欢迎在这里讨论DSP技术问题欢迎在这里讨论DSP技术问题,有问必答。
史修栋
上海润图智能系统有限公司
David@SmartSystem.com.cn 答 5: 有一点没说图像输出格式是什么 答 6: 请教不知道楼主的系统网络传输是采用什么方式压缩呢,是mpeg4还是H.263?
还有USB1.1配在这上面是不是有些慢了?整个系统卖价多少?
系统做的蛮好,不过不知道楼主的市场定位是哪里 答 7: 不再销售EagleEye由于EagleEye已经成为成熟的产品,不再作为硬件平台零售了。
对这个平台有真正诚意的大客户,请直接打我公司的电话联系。
史修栋 总经理
上海润图智能系统有限公司
021-62947943
答 8: 峰值运算能力:48MIPS( 答 9: 排版工具你所采用的PCB布线工具是什么?好象是POWERPCB吧 答 10: 峰值运算能力:4800MIPS。谢谢americ的指正。
内部主频600MHz,8级指令流水线。所以是4800MIPS,即48亿次运算每秒。
史修栋
答 11: PCB布线工具史修栋
你所采用的PCB布线工具是什么?好象是POWERPCB吧
从图片来看,主要是手工布线是吗?你做仿真了没?
你的SDRAM同步时钟是怎样处理的?是零延时时钟分配芯片吧! 答 12: 关于布线工具的回答
回答你的问题,如下:
1、问:你所采用的PCB布线工具是什么?好象是POWERPCB吧
答:对。
2、问:从图片来看,主要是手工布线是吗?你做仿真了没?
答:全部手工布线。几乎所有信号都做过仔细的仿真分析。这是保证系统稳定的关键技术之一。我的一个帖子“EagleEye的波形对比图:”中有图片对比。
我个人观点:做PCB layout,最重要的是高频信号完整性处理,而不是布线如何漂亮。大家可以在PCB专栏中看到很多PCB layout贴图,我真想告诉他们:“如果真想让人欣赏你的作品,请贴出信号波形来!这才能看出你的功底。”
3、你的SDRAM同步时钟是怎样处理的?是零延时时钟分配芯片吧!
答:这个问题恕我不能回答你,这是关键技术之一。我的产品要卖钱的。
史修栋
上海润图智能系统有限公司
David@SmartSystem.com.cn
答 13: 关于布线工具的问题史修栋
谢谢你的回答,SDRAM同步时钟的处理我也做过,不方便回答的也没关系,能否告诉我你用POWERPCB布板,原理图是用什么画的?是Orcad吗? 答 14: 具体技术问题,欢迎电话联系
更具体的技术问题,欢迎电话联系。
不论任何朋友,我都欢迎。
021-62803271
013701696609
史修栋
上海润图智能系统有限公司
David@SmartSystem.com.cn 答 15: 哇,推销啊 答 16: 帮你顶请问你买的DM642,32MByte SDRAM,USB芯片价格是多少啊 答 17: DSP常用外围芯片价格:
以下的价格,是市场零售价:
DM642:600MHz RMB400元左右;
SDARM: 4M x 32-bit RMB80;
USB: USB1.1 RMB12。
注意:我只卖EagleEye系统,不卖芯片。
021-62803271
013701696609
MSN: shixiudong@hotmail.com
史修栋
上海润图智能系统有限公司
David@SmartSystem.com.cn
答 18: DM642 EMAC 部分,接上LWIP ,运行良好
#include "Emac.h"
#include "eth.h"
//---------Raw Data Buffers----------
//
// This program uses internal memory, so buffer size is
// just 1518 In order to make sure buffers are cache
// aligned, if each were in cacheable external memory
// the size should be at least 1536 so as to fill enitre
// cache line.
#define PKT_MAX 32
#pragma DATA_SECTION(packet_header, ".ExtDat1");
EMAC_Pkt packet_header[PKT_MAX];
#pragma DATA_SECTION(packet_buffer, ".ExtDat1");
Uint8 packet_buffer[PKT_MAX][1536];
EMAC_Config g_emacConfig;
PKTQ FreeQueue; // Free packets for RX or Tx
PKTQ RxQueue; // Received packets
// Declare some local status variables
Handle hEMAC = 0; // Handle to our EMAC instance
volatile uint LinkStatus = 0; // Current link status
Uint8 SrcMacID[ETH_ALEN] = {0x00,0x20,0x45,0x20,0x33,0x68};
Uint32 EmacRxNumtest=0;
#pragma CODE_SECTION(EmacInitial, ".PROGRAM");
int EmacInitial()
{
Uint32 i;
g_emacConfig.ModeFlags = EMAC_CONFIG_MODEFLG_CHPRIORITY;
g_emacConfig.MdioModeFlags = MDIO_MODEFLG_AUTONEG;
g_emacConfig.TxChannels = 1;
memcpy(g_emacConfig.MacAddr,SrcMacID,6);
g_emacConfig.RxMaxPktPool = 8;
g_emacConfig.pfcbGetPacket = &GetPacket;
g_emacConfig.pfcbFreePacket = &FreePacket;
g_emacConfig.pfcbRxPacket = &RxPacket;
g_emacConfig.pfcbStatus = &StatusUpdate;
g_emacConfig.pfcbStatistics = &StatisticsUpdate;
InterruptInit();
EMACControlModuleInit();
MDIOInit();
EMACModuleInit();
// Initialize our buffer pool
memset( &FreeQueue, 0, sizeof(PKTQ) );
memset( &RxQueue, 0, sizeof(PKTQ) );
// Init the buffer headers. Note that the
// buffer pointer and buffer length are fixed
for( i=0; i<PKT_MAX; i++ )
{
memset( &packet_header[i], 0, sizeof(EMAC_Pkt) );
packet_header[i].pDataBuffer = packet_buffer[i];
packet_header[i].BufferLen = 1518;
pqPush( &FreeQueue, &packet_header[i] );
}
// Open EMAC instance
if(EMAC_open( 1, (Handle)0x12345678, &g_emacConfig, &hEMAC ))
{
return -1;
}
// Set the receive filter
// 只接收发给本机的网络包
if(EMAC_setReceiveFilter( hEMAC, EMAC_RXFILTER_BROADCAST))
{
return -1;
}
return 1;
}
#pragma CODE_SECTION(EMACControlModuleInit, ".PROGRAM");
void EMACControlModuleInit()
{
Uint32 i;
Uint32 tmpVal;
// Globally disable EMAC/MDIO interrupts in wrapper and
// put both EMAC and MDIO modules into reset
EMAC_RSET( EWCTL, EMAC_FMKS( EWCTL, INTEN, DISABLE ) |
EMAC_FMKS( EWCTL, EMACRST, YES ) |
EMAC_FMKS( EWCTL, MDIORST, YES ) );
// Wait ablout 100 cycles
for( i=0; i<5; i++ )
{
tmpVal = EMAC_RGET( EWCTL );
}
// Leave EMAC/MDIO interrupts disabled and take both
// EMAC and MDIO modules out of reset
EMAC_RSET( EWCTL, EMAC_FMKS( EWCTL, INTEN, DISABLE ) |
EMAC_FMKS( EWCTL, EMACRST, NO ) |
EMAC_FMKS( EWCTL, MDIORST, NO ) );
// Wait ablout 100 cycles
for( i=0; i<5; i++ )
{
tmpVal = EMAC_RGET( EWCTL );
}
// Set EMAC Priority to "2" ,allocation regs "3"
EMAC_RSET( EWTRCTRL, 0x23 );
// Set Interrupt Timer Count (CPUclk/4)
EMAC_RSET( EWINTTCNT, 1500 );
// Enable global interrupt in wrapper
EMAC_FSETS( EWCTL, INTEN, ENABLE );
return;
}
#pragma CODE_SECTION(MDIOInit, ".PROGRAM");
void MDIOInit()
{
#define PCLK 5
MDIO_RSET( CONTROL, MDIO_FMKS( CONTROL, ENABLE, YES ) |
MDIO_FMK( CONTROL, CLKDIV, PCLK ) |
MDIO_FMKS( CONTROL, PREAMBLE, DISABLED));
return;
}
#pragma CODE_SECTION(EMACModuleInit, ".PROGRAM");
void EMACModuleInit()
{
volatile Uint32 *pRegAddr;
Uint32 i;
Uint32 tmpVal = 0;
//Disable transmit,receive and clear MACCCONTROL
EMAC_FSETS( TXCONTROL, TXEN, DISABLE );
EMAC_FSETS( RXCONTROL, RXEN, DISABLE );
EMAC_RSET( MACCONTROL, 0 );
// MUST manually init TXnHDPs to NULL
pRegAddr = EMAC_ADDR( TX0HDP );
for( i=0; i<8; i++ )
{
*pRegAddr++ = 0;
}
// MUST manually init RXnHDPs to NULL
pRegAddr = EMAC_ADDR( RX0HDP );
for( i=0; i<8; i++ )
{
*pRegAddr++ = 0;
}
// 初始化统计寄存器
pRegAddr = EMAC_ADDR( RXGOODFRAMES );
for( i=0; i<36; i++ )
{
*pRegAddr++ = 0;
}
//初始化MAC地址 00 01 02 03 04 05
//每个通道都初始化
pRegAddr = EMAC_ADDR( MACADDRL0 );
for( i=0; i<8; i++ )
{
*pRegAddr++ = g_emacConfig.MacAddr[5];
}
EMAC_RSET( MACADDRM, g_emacConfig.MacAddr[4] );
for( i=3; i>0; i--)
{
tmpVal = ( tmpVal<<8 ) | g_emacConfig.MacAddr[i];
}
EMAC_RSET( MACADDRH, tmpVal );
// Buffer offset always be zero
EMAC_RSET( RXBUFFEROFFSET, 0 );
// Clear Unicast receive on channel 0-7
EMAC_RSET( RXUNICASTCLEAR, 0xFF );
// Reset receive MBP enable register
EMAC_RSET( RXMBPENABLE, 0 );
// Enable transmit channel and receive channel interrupts
EMAC_RSET( TXINTMASKCLEAR, 0xFF );
EMAC_RSET( TXINTMASKSET , 1<<0 );
EMAC_RSET( RXINTMASKCLEAR, 0xFF );
EMAC_RSET( RXINTMASKSET , 1<<0 );
// Enable transmit
EMAC_FSETS( TXCONTROL, TXEN, ENABLE );
// Enable receive
EMAC_FSETS( RXCONTROL, RXEN, ENABLE );
//Enable global interrupt in control module
EMAC_FSETS( EWCTL, INTEN, ENABLE );
return;
}
#pragma CODE_SECTION(InterruptInit, ".PROGRAM");
void InterruptInit()
{
IRQ_globalDisable();
IRQ_setVecs(vectors);
IRQ_map(IRQ_EVT_MACINT, 6);
IRQ_resetAll();
IRQ_nmiEnable();
IRQ_enable(IRQ_EVT_MACINT); //使能EMAC中断
IRQ_globalEnable();
return;
}
/*
*----------GetPacket - Get empty packet for RX-------------
*
* This function is called from the EMAC module to get an
* empty packet buffer. It returns a packet buffer to the
* EMAC or returns NULL if there are no buffers available.
*/
#pragma CODE_SECTION(GetPacket, ".PROGRAM");
EMAC_Pkt *GetPacket( Handle hApplication )
{
EMAC_Pkt *pPkt;
// Verify if handle came back OK. It is not used in this example
if( (Uint32)hApplication != 0x12345678 )
{
return(0);
}
// Pop a packet off our local free queue
pPkt = pqPop(&FreeQueue);
if( pPkt )
{
// Tell the EMAC what offset to use by setting the DataOffset field
// in the packet.
pPkt->DataOffset = 0;
}
return( pPkt );
}
/*
* FreePacket - Free packet that originated from TX or GetPacket().
*
* This function is called from the EMAC module to free a
* packet buffer after a TX operation (or RX in the case of
* a RX shutdown).
*
*/
#pragma CODE_SECTION(FreePacket, ".PROGRAM");
void FreePacket( Handle hApplication, EMAC_Pkt *pPKT )
{
// Verify if handle came back OK. It is not used in this example
if( (Uint32)hApplication != 0x12345678 )
{
return;
}
pqPush( &FreeQueue, pPKT );
}
/*
* RxPacket - Reveived packet from the Network.
*
* This function is called by the EMAC to indicate a receive.
* It just pushes the packet our receive queue.
*
* This function returns a free packet to replace the RX packet on
* the EMAC queue. If there are no free packets available, it
* returns NULL.
*/
#pragma CODE_SECTION(RxPacket, ".PROGRAM");
EMAC_Pkt *RxPacket( Handle hApplication, EMAC_Pkt *pPKT )
{
// Verify if handle came back OK. It is not used in this example
if( (Uint32)hApplication != 0x12345678 )
{
return(0);
}
net_handle((pPKT->pDataBuffer+pPKT->DataOffset),pPKT->ValidLen);
pqPush( &FreeQueue, pPKT );
return( GetPacket(hApplication) );
}
#pragma CODE_SECTION(Emac_Send, ".PROGRAM");
int Emac_Send(struct sk_buff *skb)
{
int i;
if(skb->pPkt==0)
{
return -1;
}
skb->pPkt->Flags = EMAC_PKT_FLAGS_SOP | EMAC_PKT_FLAGS_EOP ;
skb->pPkt->ValidLen = skb->len;
skb->pPkt->DataOffset = 0;
skb->pPkt->PktChannel = 0;
skb->pPkt->PktLength = skb->len;
skb->pPkt->PktFrags = 1;
// Must mask DSP mapped EMAC ISR when calling EMAC functions
IRQ_disable( IRQ_EVT_MACINT );
i = EMAC_sendPacket( hEMAC, skb->pPkt );
IRQ_enable( IRQ_EVT_MACINT );
if(i!=0)
{
return -1;
}
return 0;
}
int Emac_Get_Addr(unsigned char *addr)
{
memcpy(addr, SrcMacID, ETH_ALEN);
return 0;
}
char *LinkStr[] = { "No Link",
"10Mb/s Half Duplex",
"10Mb/s Full Duplex",
"100Mb/s Half Duplex",
"100Mb/s Full Duplex" };
// StatusUpdate - The EMAC or MDIO status has changed
#pragma CODE_SECTION(StatusUpdate, ".PROGRAM");
void StatusUpdate( Handle hApplication )
{
uint retval;
EMAC_Status status;
/* Verify if handle came back OK. It is not used in this example */
if( (Uint32)hApplication != 0x12345678 )
{
return;
}
/*
* The status update function is called for several reasons, including
* LINK change events and EMAC errors. Get the current status and print
* it out. Don't start sending packets until there is a good link.
*
* NOTE: Call back into the EMAC is used without any reentrancy concerns.
* This because we are a callback function currently that was called
* from EMAC. Thus the reentrancy protection is still active!
*/
retval = EMAC_getStatus( hEMAC, &status );
LinkStatus = status.MdioLinkStatus;
}
// StatisticsUpdate - The EMAC statistics are in danger of overflow
#pragma CODE_SECTION(StatisticsUpdate, ".PROGRAM");
void StatisticsUpdate( Handle hApplication )
{
/* Verify if handle came back OK. It is not used in this example */
if( (Uint32)hApplication != 0x12345678 )
{
return;
}
/*
* Here call the EMAC_getStatistics() function and pass them to whoever
* needing statistics information. This example doesn't have anything to
* do with it so nothing is called here.
*/
}
// Pop a desc buffer off a queue
#pragma CODE_SECTION(pqPop, ".PROGRAM");
EMAC_Pkt *pqPop( PKTQ *pq )
{
EMAC_Pkt *pPktHdr;
IRQ_disable( IRQ_EVT_MACINT );
pPktHdr = pq->pHead;
if( pPktHdr )
{
pq->pHead = pPktHdr->pNext;
pq->Count--;
}
pPktHdr->pPrev = pPktHdr->pNext = 0;
IRQ_enable( IRQ_EVT_MACINT );
return( pPktHdr );
}
// Push a desc buffer onto a queue
#pragma CODE_SECTION(pqPush, ".PROGRAM");
void pqPush( PKTQ *pq, EMAC_Pkt *pPktHdr )
{
IRQ_disable( IRQ_EVT_MACINT );
pPktHdr->pNext = 0;
if( !pq->pHead )
{
// Queue is empty - Initialize it with this one packet
pq->pHead = pPktHdr;
pq->pTail = pPktHdr;
}
else
{
// Queue is not empty - Push onto END
pq->pTail->pNext = pPktHdr;
pq->pTail = pPktHdr;
}
pq->Count++;
IRQ_enable( IRQ_EVT_MACINT );
return;
}
答 19: 关于VIDEO PORT 的时钟问题我想用DM642加上SAA7105做视频输出,DM642的VIDEO PORT的时钟输入VCLK1频率该怎么定,是不是由不同的D/A转换芯片(ENCODER)来决定,直接接到SAA7105的时钟输出引脚PIXCLKO行吗,VIDEO PORT的时钟输出引脚VCLK2由VCLK1产生吗?同频率吗?还有时钟输出VCLK2是不是直接接到SAA7105(ENCODER)的时钟输入PIXCLKI,作为ENCODER的时钟基准?谢谢
共2条
1/1 1 跳转至页
回复
有奖活动 | |
---|---|
【有奖活动】分享技术经验,兑换京东卡 | |
话不多说,快进群! | |
请大声喊出:我要开发板! | |
【有奖活动】EEPW网站征稿正在进行时,欢迎踊跃投稿啦 | |
奖!发布技术笔记,技术评测贴换取您心仪的礼品 | |
打赏了!打赏了!打赏了! |
打赏帖 | |
---|---|
vscode+cmake搭建雅特力AT32L021开发环境被打赏30分 | |
【换取逻辑分析仪】自制底板并驱动ArduinoNanoRP2040ConnectLCD扩展板被打赏47分 | |
【分享评测,赢取加热台】RISC-V GCC 内嵌汇编使用被打赏38分 | |
【换取逻辑分析仪】-基于ADI单片机MAX78000的简易MP3音乐播放器被打赏48分 | |
我想要一部加热台+树莓派PICO驱动AHT10被打赏38分 | |
【换取逻辑分析仪】-硬件SPI驱动OLED屏幕被打赏36分 | |
换逻辑分析仪+上下拉与多路选择器被打赏29分 | |
Let'sdo第3期任务合集被打赏50分 | |
换逻辑分析仪+Verilog三态门被打赏27分 | |
换逻辑分析仪+Verilog多输出门被打赏24分 |