Ответ: Сорри, поясняющий кусок кода немного запортился
(«Телесистемы»: Конференция «Микроконтроллеры и их применение»)

миниатюрный аудио-видеорекордер mAVR

Отправлено dimka2 22 сентября 2004 г. 12:15
В ответ на: трабл с RTL8019 - хелп если кто их юзал!!! отправлено dimka2 22 сентября 2004 г. 11:08

// we don't want to be interrupted by NIC owerflow
clrbit(EIMSK, RTL_SIGNAL_BIT);

// Get the current page pointer. It points to the page where the NIC
// will start saving the next incoming packet.

nic_write(NIC_CR,NIC_CR_STA|NIC_CR_RD2|NIC_CR_PS0);
__mpu_clocks_delay(WAIT5);
curr=nic_read(NIC_PG1_CURR);
nic_write(NIC_CR,NIC_CR_STA|NIC_CR_RD2);

// Get the pointer to the last page we read from. The following page is the one
// where we start reading. If it's equal to the current page pointer, then there's
// nothing to read. In this case we return a null pointer.

bnry=nic_read(NIC_PG0_BNRY)+1;
if (bnry>=NIC_STOP_PAGE) bnry=NIC_FIRST_RX_PAGE;
if (bnry==curr) {
setbit(EIMSK,RTL_SIGNAL_BIT); // enable interrupt 5
return 0; // nothing to receive
}

// read the NIC specific packet header (fcs?)

nic_write(NIC_PG0_RBCR0,sizeof(nic_pkt_header));
nic_write(NIC_PG0_RBCR1,0);
nic_write(NIC_PG0_RSAR0,0);
nic_write(NIC_PG0_RSAR1,bnry);
buf=(unsigned char *)&hdr;
nic_write(NIC_CR,NIC_CR_STA|NIC_CR_RD0);
__mpu_clocks_delay(WAIT5);
for (i=0;i

Составить ответ  |||  Конференция  |||  Архив

Ответы



Перейти к списку ответов  |||  Конференция  |||  Архив  |||  Главная страница  |||  Содержание  |||  Без кадра

E-mail: info@telesys.ru