#include "fx2.h"
#include "fx2regs.h"
#include "atapi.h"
unsigned char mymemcmpa(unsigned char idata * s1, unsigned char xdata * s2, unsigned char len) {
if (!len) return 0;
do{
if (*s1!=*s2) return 1;
s1++; s2++;
}while(--len);
return 0;
}
// Send prevCmd out using GPIF.
void sendprev(void) {
BYTE l=6;
const BYTE idata*s=prevCmd;
do{
while (!(GPIFTRIG&0x80)); // wait until bit set
BYTE cmd_lsb=*s++;
XGPIFSGLDATH =*s++;
XGPIFSGLDATLX=cmd_lsb;
}while (--l);
}
void softReset(void) {
((void(*)(void))(0))();
}
#define NOP __asm nop __endasm
void EZUSB_Delay(WORD ms) {
if (!ms) return;
do{
WORD us=1000;
do NOP; while (--us);
}while(--ms);
}
void EZUSB_Resume(void) {
USBCS|=1;
EZUSB_Delay(10); // wait 10 ms
USBCS&=~1;
}
void EZUSB_Susp(void) {
if (!(USBIRQ&0x08)) return; // Suspend interrupt request?
SUSPEND=0xFF; // chip sleeps here
USBIRQ=0x08; // Clear that interrupt
EZUSB_Resume();
}
| Vorgefundene Kodierung: ASCII (7 bit) | 2
|