/******************************************************************* ACB_RTL.C ACB Developer's Toolkit 1995 (C) Sealevel Systems Inc. 1995 History: JGY 7-23-95 Created module *******************************************************************/ #include #include #include "acb_rtl.h" /******************************************************************* ACBCheckRxAvailable : C API This routine will return the number of Rx frames that are available Passes: Nothing Returns: Number of Rx frames available *******************************************************************/ WORD ACBCheckRxAvailable(VOID) { WORD wReturn; _asm{ mov ah, ACB_GETBUFFERCOUNT int ACB_SOFTWARE_INT mov wReturn, bx } return((HIBYTE(wReturn) - LOBYTE(wReturn))); } /******************************************************************* ACBCheckTxAvailable : C API This routine will return the number of free Tx buffers that are available Passes: Nothing Returns: Number of free Tx frames available *******************************************************************/ WORD ACBCheckTxAvailable(VOID) { WORD wReturn; _asm{ mov ah, ACB_GETBUFFERCOUNT int ACB_SOFTWARE_INT mov wReturn, ax } return((HIBYTE(wReturn) - LOBYTE(wReturn))); } /******************************************************************* ACBGetBufferInfo : C API This routine will return the length for the Tx and Rx frame buffers. Passes: Nothing Returns: DWORD - LOWORD = Tx Buffer Status HIWORD = Rx Buffer Status *******************************************************************/ DWORD ACBGetBufferInfo ( VOID) { WORD wValue1, wValue2; _asm{ mov ah, ACB_GETBUFFERINFO int ACB_SOFTWARE_INT mov wValue1, ax ; Tx Buffer length mov wValue2, bx ; Rx Buffer length } return(MAKELONG(wValue1, wValue2)); } /******************************************************************* ACBSetNodeAddress : C API This routine will set the address of the SDLC / HDLC node. All received frames must have this address, or a boradcast address of 0x00. Passes: Address (BYTE) Returns: WORD - Zero if success One if fail *******************************************************************/ WORD ACBSetNodeAddress ( BYTE bAddress) { WORD wReturn; _asm{ mov ah, ACB_SETNODEADDRESS mov al, bAddress int ACB_SOFTWARE_INT mov wReturn, ax ; Tx Buffer length } return(wReturn); } /******************************************************************* ACBGetBufferCount : C API This routine will return the statics for the Tx and Rx frame buffers. Passes: Nothing Returns: DWORD - LOWORD = Tx Buffer Status LOBYTE = Tx Buffers Free HIBYTE = Total Number of Tx Buffers HIWORD = Rx Buffer Status LOBYTE = Rx Buffers Free HIBYTE = Total Number of Rx Buffers *******************************************************************/ DWORD ACBGetBufferCount ( VOID) { WORD wValue1, wValue2; _asm{ mov ah, ACB_GETBUFFERCOUNT int ACB_SOFTWARE_INT mov wValue1, ax mov wValue2, bx } return(MAKELONG(wValue1, wValue2)); } /******************************************************************* ACBResetBuffers : C API This rountine will reset the seleceted Frame buffer Passes: bBufferSelect RESET_RX_BUFFER, RESET_TX_BUFFER These values may be ORed together to reset both buffers. Returns: WORD - Zero if success *******************************************************************/ WORD ACBResetBuffers ( BYTE bBufferSelect) { WORD wReturn; _asm{ mov ah, ACB_RESETBUFFERS mov al, bBufferSelect int ACB_SOFTWARE_INT mov wReturn, ax } return(wReturn); } /******************************************************************* ACBVerify : C API This routine will verify the presence of the ACB driver. This routine should be called to verify the driver is resident before additional calls are made to the driver. Passes: Nothing Returns: WORD 0 if driver is resident, 1 if error *******************************************************************/ WORD ACBVerify ( VOID) { WORD wSeg, wOff; LPBYTE fpString; /* Do not modify this string it is used to ID the driver when it is memory resident */ BYTE bTestString[] = "Sealevel03\0"; BYTE i; for( i = 0xc0; i < 0xff; i++) {_asm{ mov ah, i mov al, 0 int 2fh cmp al, 0ffh jnz ACBV1 mov ax, es mov wSeg, ax mov wOff, di } fpString = MAKELP(wSeg,wOff); for(wOff = 0; wOff < 11; wOff++) {if(bTestString[wOff] != * (fpString + wOff)) wOff = 0xff; } if(wOff == 11) return(ACB_DRIVER_INSTALLED); ACBV1: ; } return(ACB_DRVIER_NOT_INSTALLED); } /******************************************************************* ACBPutFrame : C API This routine will place a frame in the Tx frame buffer queue. Passes: fpBuffer - LPBYTE, FAR pointer to buffer wLength - WORD, Buffer Length Returns: WORD 0 if success, 1 if error *******************************************************************/ WORD ACBPutFrame (LPBYTE fpBuffer, WORD wLength) { WORD wReturn; _asm{ mov ah, ACB_PUTFRAME les di, fpBuffer mov cx, wLength int ACB_SOFTWARE_INT mov wReturn, ax } return(wReturn); } /******************************************************************* ACBGetFrame : This routine will get the next available Rx frame from the Rx frame buffer queue. Passes: fpBuffer - LPBYTE, FAR pointer to buffer wLength - WORD, Maximum length of buffer Returns: DWORD - LOBYTE Actual length of buffer HIBYTE Error code *******************************************************************/ DWORD ACBGetFrame (LPBYTE fpBuffer, WORD wLength) { DWORD dwReturn; _asm{ mov ah, ACB_GETFRAME les di, fpBuffer mov cx, wLength int ACB_SOFTWARE_INT mov word ptr dwReturn, ax mov word ptr dwReturn+2, bx } return(dwReturn); } /******************************************************************* ACBStartDriver : C API This routine will start the receive portion of the driver. Passes: Nothing Returns: Nothing *******************************************************************/ WORD ACBStartDriver ( VOID) { WORD wReturn; _asm{ mov ah, ACB_STARTDRIVER int ACB_SOFTWARE_INT mov wReturn, ax } return(wReturn); } /******************************************************************* ACBStopDriver : C API This routine will stop the receive portion of the driver. Passes: Nothing Returns: Nothing *******************************************************************/ WORD ACBStopDriver ( VOID) { WORD wReturn; _asm{ mov ah, ACB_STOPDRIVER int ACB_SOFTWARE_INT mov wReturn, ax } return(wReturn); } /******************************************************************* End of file *******************************************************************/