📄 idt723v70840_test.c.bak
字号:
/* idt72v90823.c - IDT 72V90823 driver source *//*modification history--------------------*/#include "idt72v90823.h"#define TSICTL idt90823TsiCtl;void tsiInit(){ volatile char wait; unsigned long int *POINT; POINT = (unsigned long int *) (CS_TSI70840+OR0); *POINT = 0x0000; POINT = (unsigned long int *) (CS_TSI70840+OR1); *POINT = 0x0000; POINT = (unsigned long int *) (CS_TSI70840+OR2); *POINT = 0x0000; POINT = (unsigned long int *) (CS_TSI70840+OR3); *POINT = 0x0000; POINT = (unsigned long int *) (CS_TSI70840+OR4); *POINT = 0x0000; POINT = (unsigned long int *) (CS_TSI70840+OR5); *POINT = 0x0000; POINT = (unsigned long int *) (CS_TSI70840+OR6); *POINT = 0x0000; POINT = (unsigned long int *) (CS_TSI70840+OR6); *POINT = 0x0000; /* disable ODE and out of reset*/ /* diaable ODE and out of reset, ODE is connected to PC6. We should operate registers of parallel port C */ rstTSI(0xFF); /* block program initialize connect memory */ POINT = (unsigned long int *) (CS_TSI70840+CR); *POINT = 0x0200; /* BPM set */ *POINT = 0x0010; /* BPE,BPD=0x0 are seted simultaneously */ /* polling the BPE bit in the CR to indicate block program is completed */ wait = 1; while (wait) { bpeState = ((volatile unsigned short)*POINT) & 0x0010; } rstTSI(0x2); /* pull the ODE UP */ }void tsiChannelConnect( unsigned short srcStream, /* 5bits */ unsigned short srcSlot, /* 7bits */ unsigned short dstStream, unsigned short dstSlot){ unsigned long int *POINT; POINT = (unsigned long int *)(CS_TSI70840+CONNECT_MEM+(dstStream<<7)+dstSlot); if (((srcStream < TSISTREAM)&& (srcSlot < TSISLOT)) && ((dstStream >= TSISTREAM) && (dstSlot >= TSISLOT))) { *POINT = (CONMEM_OE | ((srcStream<<7)&0x0f80) | (srcSlot&0x007f)); } else { logMsg ("TSI slot or stream not exit\n",0,0,0,0,0,0); } }void tsiChannelDisconnect( unsigned short dstStream, unsigned short dstSlot){ unsigned long int *POINT; POINT = (unsigned long int *)(CS_TSI70840+CONNECT_MEM+(dstStream<<7)+dstSlot); if (((dstStream < TSISTREAM)&& (dstSlot < TSISLOT))) { *POINT &= ~(CONMEM_OE | (0x0f80) | (0x007f)); } else { logMsg("TSI slot or stream not exist\n",0,0,0,0,0,0); } }void tsiCrossCreate( unsigned short firstStream, unsigned short firstSlot, unsigned short secondStream, unsigned short secondSlot){ tsiChannelDisconnect(firstStream,firstSlot); tsiChannelDisconnect(secondStream,secondSlot); tsiChannelConnect(firstStream,firstSlot,secondStream,secondSlot); tsiChannelConnect(secondStream,secondSlot,firstStream,firstSlot); }void tsiCrossDestroy( unsigned short firstStream, unsigned short firstSlot, unsigned short secondStream, unsigned short secondSlot){ tsiChannelDisconnect(firstStream,firstSlot); tsiChannelDisconnect(secondStream,secondSlot);}void dumpCross(){ IDT72V90823REG * pTsiReg; int i,j,first; volatile unsigned short conMemTemp; unsigned short srcStream; unsigned short srcSlot; first = 1; pTsiReg = idt90823TsiCtl.tsiReg; pTsiReg->cr = 0; for(i = 0 ;i < TSISTREAM ; i++) { pTsiReg->cr = i<<8; for (j = 0 ; j < TSISLOT ; j++) { conMemTemp = pTsiReg->tsiMem[j]; if (conMemTemp & 0x0008) { if(first == 1) { printf("\nIN(STREAM , SLOT )-->OUT(STREAM ,SLOT )\n"); first = 0; } srcStream = ((conMemTemp & 0x8000)>>15) | ((conMemTemp & 0x0007)<<1); srcSlot = (conMemTemp & 0x7F00)>>8; printf("IN( %d, %d)-->OUT( %d, %d)\n",srcStream,srcSlot,i,j); } } } printf("\n TimeSlot Dump OK\n");}/**************************************************************************** **** For test **** ****************************************************************************/void testCon(){ int i; for(i = 0;i<128;i++) { tsiChannelConnect(11,0,11,i); taskDelay(1); }} void testDiscon(){ int i; for(i = 0;i<128;i++) { tsiChannelDisconnect(11,i); taskDelay(1); }}void testCon1(m,n){ int i; for(i = 0;i<n;i++) { tsiChannelConnect(11,0,11,m*32 + i); taskDelay(1); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -