|
iwrite_usb(MCNTRL,0);
#asm
NOP
NOP
NOP
NOP
NOP ;Задержка 10 тактов
NOP
NOP
NOP
NOP
NOP
#endasm ;
iwrite_usb(CCONF,0x88); /* set clock freq and disable output */
/*give a soft reset, then set ints to push pull, active hi or lo*/
iwrite_usb(MCNTRL,SRST);
longnum=0xC140; /* c140-for 16 MH, 3050-for 4MH 0,5 sec*/
deq: if(longnum--)goto deq;
/* iwrite_usb(MCNTRL,0xC4);VREG_ST+INTR_TYPE);*/
/*set default address, enable EP0 only **************************/
iwrite_usb(FAR,AD_EN+0);
iwrite_usb(EPC0, 0x00);
/*set up interrupt masks ****************************************/
iwrite_usb(NAKMSK,NAK_O0+NAK_O1+NAK_I1); /*NAK evnts*/
iwrite_usb(TXMSK,TXFIFO0+TXFIFO1+TXFIFO2+TXFIFO3); /*TX events*/
iwrite_usb(RXMSK,RXFIFO0+RXFIFO1+RXFIFO2); /*RX events*/
iwrite_usb(ALTMSK,NORMAL_ALTMSK); /*ALT evnts*/
iwrite_usb(MAMSK,INTR_E+RX_EV+NAK+TX_EV+ALT);
/*enable the receiver and go operational ************************/
iwrite_usb(TXC0,FLUSH); /* flush TX0 and disable */
iwrite_usb(RXC0,RX_EN); /*enable the receiver */
/* iwrite_usb(WKUP,ENUC+ENUSB);*/
iwrite_usb(NFSR,OPR_ST); /*go operational */
iwrite_usb(MCNTRL,VREG_ST+INTR_TYPE+NAT); /*set NODE ATTACH */
}
E-mail: info@telesys.ru