summaryrefslogtreecommitdiffstats
path: root/private/ntos/ndis/htdsu
diff options
context:
space:
mode:
authorAdam <you@example.com>2020-05-17 05:51:50 +0200
committerAdam <you@example.com>2020-05-17 05:51:50 +0200
commite611b132f9b8abe35b362e5870b74bce94a1e58e (patch)
treea5781d2ec0e085eeca33cf350cf878f2efea6fe5 /private/ntos/ndis/htdsu
downloadNT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar
NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.gz
NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.bz2
NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.lz
NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.xz
NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.zst
NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.zip
Diffstat (limited to 'private/ntos/ndis/htdsu')
-rw-r--r--private/ntos/ndis/htdsu/card.c722
-rw-r--r--private/ntos/ndis/htdsu/card.h521
-rw-r--r--private/ntos/ndis/htdsu/debug.c112
-rw-r--r--private/ntos/ndis/htdsu/debug.h137
-rw-r--r--private/ntos/ndis/htdsu/htdsu.c1395
-rw-r--r--private/ntos/ndis/htdsu/htdsu.h931
-rw-r--r--private/ntos/ndis/htdsu/htdsu.rc9
-rw-r--r--private/ntos/ndis/htdsu/interrup.c656
-rw-r--r--private/ntos/ndis/htdsu/keywords.h77
-rw-r--r--private/ntos/ndis/htdsu/link.c587
-rw-r--r--private/ntos/ndis/htdsu/makefile7
-rw-r--r--private/ntos/ndis/htdsu/oemsetnt.inf1241
-rw-r--r--private/ntos/ndis/htdsu/receive.c199
-rw-r--r--private/ntos/ndis/htdsu/request.c661
-rw-r--r--private/ntos/ndis/htdsu/send.c502
-rw-r--r--private/ntos/ndis/htdsu/sources53
-rw-r--r--private/ntos/ndis/htdsu/tapi.c5001
-rw-r--r--private/ntos/ndis/htdsu/version.h62
18 files changed, 12873 insertions, 0 deletions
diff --git a/private/ntos/ndis/htdsu/card.c b/private/ntos/ndis/htdsu/card.c
new file mode 100644
index 000000000..eb62fba71
--- /dev/null
+++ b/private/ntos/ndis/htdsu/card.c
@@ -0,0 +1,722 @@
+/***************************************************************************\
+|* Copyright (c) 1994 Microsoft Corporation *|
+|* Developed for Microsoft by TriplePoint, Inc. Beaverton, Oregon *|
+|* *|
+|* This file is part of the HT Communications DSU41 WAN Miniport Driver. *|
+\***************************************************************************/
+#include "version.h"
+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+Module Name:
+
+ card.c
+
+Abstract:
+
+ This module implements the low-level hardware control functions used by
+ the NDIS Minport driver on the HT DSU41 controller. You will need to
+ replace this module with the control functions required to support your
+ hardware.
+ CardIdentify()
+ CardDoCommand()
+ CardInitialize()
+ CardLineConfig()
+ CardLineDisconnect()
+ CardLineDisconnect()
+ CardPrepareTransmit()
+ CardGetReceiveInfo()
+ CardDialNumber()
+
+ This driver conforms to the NDIS 3.0 Miniport interface.
+
+Author:
+
+ Larry Hattery - TriplePoint, Inc. (larryh@tpi.com) Jun-94
+
+Environment:
+
+ Windows NT 3.5 kernel mode Miniport driver or equivalent.
+
+Revision History:
+
+---------------------------------------------------------------------------*/
+
+#define __FILEID__ 2 // Unique file ID for error logging
+
+#include "htdsu.h"
+
+
+NDIS_STATUS
+CardIdentify(
+ IN PHTDSU_ADAPTER Adapter
+ )
+
+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+Functional Description:
+
+ This routine will attempt to verify that the controller is located in
+ memory where the driver has been configured to expect it.
+
+Parameters:
+
+ Adapter _ A pointer ot our adapter information structure.
+
+Return Values:
+
+ NDIS_STATUS_SUCCESS
+ NDIS_STATUS_ADAPTER_NOT_FOUND
+
+---------------------------------------------------------------------------*/
+
+{
+ DBG_FUNC("CardIdentify")
+
+ NDIS_STATUS Status;
+
+ /*
+ // These values are read from the adapter to make sure this driver will
+ // work with the firmware on the adapter.
+ */
+ USHORT CoProcessorId;
+ USHORT CoProcessorVersion;
+ USHORT DsuId;
+ USHORT DsuVersion;
+
+ DBG_ENTER(Adapter);
+
+ /*
+ // Read the configuration values from the card.
+ */
+ CoProcessorId = READ_REGISTER_USHORT(&Adapter->AdapterRam->CoProcessorId);
+ CoProcessorVersion = READ_REGISTER_USHORT(&Adapter->AdapterRam->CoProcessorVersion);
+ DsuId = READ_REGISTER_USHORT(&Adapter->AdapterRam->DsuId);
+ DsuVersion = READ_REGISTER_USHORT(&Adapter->AdapterRam->DsuVersion);
+
+ /*
+ // Make sure these values are what we expect.
+ */
+ if ((CoProcessorId == HTDSU_COPROCESSOR_ID) &&
+ (CoProcessorVersion >= HTDSU_COPROCESSOR_VERSION) &&
+ ((DsuId & 0x00FF) == HTDSU_DSU_ID) &&
+ (DsuVersion >= HTDSU_DSU_VERSION))
+ {
+ /*
+ // Record the number of lines on this adapter.
+ */
+ Adapter->NumLineDevs = HTDSU_NUM_LINKS;
+ if ((DsuId & 0xFF00) == 0)
+ {
+ --Adapter->NumLineDevs;
+ }
+ DBG_NOTICE(Adapter,("NumLineDevs=%d\n",Adapter->NumLineDevs));
+
+ Status = NDIS_STATUS_SUCCESS;
+ }
+ else
+ {
+ DBG_ERROR(Adapter,("Adapter not found or invalid firmware:\n"
+ "CoProcessorId = %Xh\n"
+ "CoProcessorVersion = %Xh\n"
+ "DsuId = %Xh\n"
+ "DsuVersion = %Xh\n",
+ CoProcessorId,
+ CoProcessorVersion,
+ DsuId,
+ DsuVersion
+ ));
+
+ Status = NDIS_STATUS_ADAPTER_NOT_FOUND;
+ /*
+ // Log error message and return.
+ */
+ NdisWriteErrorLogEntry(
+ Adapter->MiniportAdapterHandle,
+ NDIS_ERROR_CODE_ADAPTER_NOT_FOUND,
+ 7,
+ CoProcessorId,
+ CoProcessorVersion,
+ DsuId,
+ DsuVersion,
+ Status,
+ __FILEID__,
+ __LINE__
+ );
+ }
+
+ DBG_LEAVE(Adapter);
+
+ return (Status);
+}
+
+
+NDIS_STATUS
+CardDoCommand(
+ IN PHTDSU_ADAPTER Adapter,
+ IN USHORT CardLine, /* HTDSU_CMD_LINE1 or HTDSU_CMD_LINE2 */
+ IN USHORT CommandValue
+ )
+
+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+Functional Description:
+
+ This routine routine will execute a command on the card after making
+ sure the previous command has completed properly.
+
+Parameters:
+
+ Adapter _ A pointer ot our adapter information structure.
+
+ CardLine _ Specifies which line to use for the transmit (HTDSU_LINEx_ID).
+
+ CommandValue _ HTDSU_CMD_??? command to be executed.
+
+Return Values:
+
+ NDIS_STATUS_SUCCESS
+ NDIS_STATUS_HARD_ERRORS
+
+---------------------------------------------------------------------------*/
+{
+ DBG_FUNC("CardDoCommand")
+
+ ULONG TimeOut = 0;
+
+ DBG_ENTER(Adapter);
+ DBG_FILTER(Adapter, DBG_PARAMS_ON,("Line=%d, Command=%04X, LineStatus=%Xh\n",
+ CardLine, CommandValue,
+ READ_REGISTER_USHORT(&Adapter->AdapterRam->StatusLine1)
+ ));
+
+ /*
+ // Wait for command register to go idle - but don't wait too long.
+ // If we timeout here, there's gotta be something wrong with the adapter.
+ */
+ while ((READ_REGISTER_USHORT(&Adapter->AdapterRam->Command) !=
+ HTDSU_CMD_NOP) ||
+ (READ_REGISTER_USHORT(&Adapter->AdapterRam->CoProcessorId) !=
+ HTDSU_COPROCESSOR_ID))
+ {
+ if (TimeOut++ > HTDSU_SELFTEST_TIMEOUT)
+ {
+ DBG_ERROR(Adapter,("Timeout waiting for %04X command to clear\n",
+ READ_REGISTER_USHORT(&Adapter->AdapterRam->Command)));
+ /*
+ // Ask for reset, and disable interrupts until we get it.
+ */
+ Adapter->NeedReset = TRUE;
+ Adapter->InterruptEnableFlag = HTDSU_INTR_DISABLE;
+ CardDisableInterrupt(Adapter);
+
+ return (NDIS_STATUS_HARD_ERRORS);
+ }
+ NdisStallExecution(_100_MICROSECONDS);
+ }
+ DBG_NOTICE(Adapter,("Timeout=%d waiting to submit %04X\n",
+ TimeOut, CommandValue));
+
+ /*
+ // Before starting a reset command, we clear the the co-processor ID
+ // which then gets set to the proper value when the reset is complete.
+ */
+ if (CommandValue == HTDSU_CMD_RESET)
+ {
+ WRITE_REGISTER_USHORT(&Adapter->AdapterRam->CoProcessorId, 0);
+ }
+
+ /*
+ // Send the command to the adapter.
+ */
+ WRITE_REGISTER_USHORT(
+ &Adapter->AdapterRam->Command,
+ (USHORT) (CommandValue + CardLine)
+ );
+
+ DBG_LEAVE(Adapter);
+
+ return (NDIS_STATUS_SUCCESS);
+}
+
+
+NDIS_STATUS
+CardInitialize(
+ IN PHTDSU_ADAPTER Adapter,
+ IN BOOLEAN PerformSelfTest
+ )
+
+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+Functional Description:
+
+ This routine will attempt to initialize the controller, but will not
+ enable transmits or receives.
+
+Parameters:
+
+ Adapter _ A pointer ot our adapter information structure.
+
+ PerformSelfTest _ TRUE if caller wants to run selftest diagnostics.
+ This normally takes about 4 seconds to complete, so you
+ wouldn't want to do it every time you start up.
+
+Return Values:
+
+ NDIS_STATUS_HARD_ERRORS
+ NDIS_STATUS_SUCCESS
+
+---------------------------------------------------------------------------*/
+
+{
+ DBG_FUNC("CardInitialize")
+
+ NDIS_STATUS Status;
+
+ USHORT SelfTestStatus;
+
+ UINT TimeOut;
+
+ DBG_ENTER(Adapter);
+
+ /*
+ // First we make sure the adapter is where we think it is.
+ */
+ Status = CardIdentify(Adapter);
+ if (Status != NDIS_STATUS_SUCCESS)
+ {
+ return (Status);
+ }
+
+ /*
+ // Reset the hardware to make sure we're in a known state.
+ */
+ Status = CardDoCommand(Adapter, 0, HTDSU_CMD_RESET);
+
+ if (PerformSelfTest)
+ {
+ /*
+ // Wait for the reset to complete before starting the self-test.
+ // Then issue the self-test command to see if the adapter firmware
+ // is happy with the situation.
+ */
+ Status = CardDoCommand(Adapter, 0, HTDSU_CMD_SELFTEST);
+ if (Status != NDIS_STATUS_SUCCESS)
+ {
+ DBG_ERROR(Adapter,("Failed HTDSU_CMD_RESET\n"));
+ /*
+ // Log error message and return.
+ */
+ NdisWriteErrorLogEntry(
+ Adapter->MiniportAdapterHandle,
+ NDIS_ERROR_CODE_HARDWARE_FAILURE,
+ 3,
+ Status,
+ __FILEID__,
+ __LINE__
+ );
+ return (Status);
+ }
+
+ /*
+ // Wait for the self test to complete, but don't wait forever.
+ */
+ TimeOut = 0;
+ while (Status == NDIS_STATUS_SUCCESS &&
+ READ_REGISTER_USHORT(&Adapter->AdapterRam->Command) !=
+ HTDSU_CMD_NOP)
+ {
+ if (TimeOut++ > HTDSU_SELFTEST_TIMEOUT)
+ {
+ DBG_ERROR(Adapter,("Timeout waiting for SELFTEST to complete\n"));
+ Status = NDIS_STATUS_HARD_ERRORS;
+ }
+ else
+ {
+ NdisStallExecution(_100_MICROSECONDS);
+ }
+ }
+ if (Status != NDIS_STATUS_SUCCESS)
+ {
+ DBG_ERROR(Adapter,("Failed HTDSU_CMD_SELFTEST\n"));
+ /*
+ // Log error message and return.
+ */
+ NdisWriteErrorLogEntry(
+ Adapter->MiniportAdapterHandle,
+ NDIS_ERROR_CODE_HARDWARE_FAILURE,
+ 3,
+ Status,
+ __FILEID__,
+ __LINE__
+ );
+ return (Status);
+ }
+
+ /*
+ // Verify that self test was successful.
+ */
+ SelfTestStatus = READ_REGISTER_USHORT(&Adapter->AdapterRam->SelfTestStatus);
+ if (SelfTestStatus != 0 && SelfTestStatus != HTDSU_SELFTEST_OK)
+ {
+ DBG_ERROR(Adapter,("Failed HTDSU_CMD_SELFTEST (Status=%X)\n",
+ SelfTestStatus));
+ /*
+ // Log error message and return.
+ */
+ NdisWriteErrorLogEntry(
+ Adapter->MiniportAdapterHandle,
+ NDIS_ERROR_CODE_HARDWARE_FAILURE,
+ 3,
+ SelfTestStatus,
+ __FILEID__,
+ __LINE__
+ );
+ return (NDIS_STATUS_HARD_ERRORS);
+ }
+ }
+
+ DBG_LEAVE(Adapter);
+
+ return (NDIS_STATUS_SUCCESS);
+}
+
+
+VOID
+CardLineConfig(
+ IN PHTDSU_ADAPTER Adapter,
+ IN USHORT CardLine /* HTDSU_CMD_LINE1 or HTDSU_CMD_LINE2 */
+ )
+
+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+Functional Description:
+
+ This routine will ready the controller to send and receive packets.
+
+Parameters:
+
+ Adapter _ A pointer ot our adapter information structure.
+
+ CardLine _ Specifies which line to use for the transmit (HTDSU_LINEx_ID).
+
+Return Values:
+
+ None
+
+---------------------------------------------------------------------------*/
+
+{
+ DBG_FUNC("CardLineConfig")
+
+ USHORT ClockCommand;
+ USHORT LineCommand;
+
+ DBG_ENTER(Adapter);
+
+ ASSERT((CardLine==HTDSU_CMD_LINE1) || (CardLine==HTDSU_CMD_LINE2));
+
+ /*
+ // Configure the line for HDLC framing and for leased or dialup mode.
+ */
+ if (Adapter->LineType == HTDSU_LINEMODE_LEASED)
+ {
+ ClockCommand = HTDSU_CMD_INTERNAL_TX_CLOCK;
+ LineCommand = HTDSU_CMD_LEASED_LINE;
+ }
+ else
+ {
+ ClockCommand = HTDSU_CMD_DDS_TX_CLOCK;
+ LineCommand = HTDSU_CMD_DIALUP_LINE;
+ }
+
+ CardDoCommand(Adapter, CardLine, ClockCommand);
+ CardDoCommand(Adapter, CardLine, HTDSU_CMD_HDLC_PROTOCOL);
+ CardDoCommand(Adapter, CardLine, LineCommand);
+ CardDoCommand(Adapter, CardLine, Adapter->LineRate);
+
+ /*
+ // Clear any pending interrupts.
+ */
+ CardDoCommand(Adapter, 0, HTDSU_CMD_CLEAR_INTERRUPT);
+ CardClearInterrupt(Adapter);
+
+ DBG_LEAVE(Adapter);
+}
+
+
+VOID
+CardLineDisconnect(
+ IN PHTDSU_ADAPTER Adapter,
+ IN USHORT CardLine /* HTDSU_CMD_LINE1 or HTDSU_CMD_LINE2 */
+ )
+
+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+Functional Description:
+
+ This routine will disconnect any call currently on the line.
+
+Parameters:
+
+ Adapter _ A pointer ot our adapter information structure.
+
+ CardLine _ Specifies which line to use for the transmit (HTDSU_LINEx_ID).
+
+Return Values:
+
+ None
+
+---------------------------------------------------------------------------*/
+
+{
+ DBG_FUNC("CardLineDisconnect")
+
+ DBG_ENTER(Adapter);
+
+ ASSERT((CardLine==HTDSU_CMD_LINE1) || (CardLine==HTDSU_CMD_LINE2));
+
+ /*
+ // Disconnect the line and reconfigure the line for next time.
+ */
+ CardDoCommand(Adapter, CardLine, HTDSU_CMD_DISCONNECT);
+ CardLineConfig(Adapter, CardLine);
+
+ DBG_LEAVE(Adapter);
+}
+
+
+VOID
+CardPrepareTransmit(
+ IN PHTDSU_ADAPTER Adapter,
+ IN USHORT CardLine, /* HTDSU_CMD_LINE1 or HTDSU_CMD_LINE2 */
+ IN USHORT BytesToSend
+ )
+
+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+Functional Description:
+
+ This routine will write the packet header information into the
+ transmit buffer. This assumes that the controller has notified the
+ driver that the transmit buffer is empty.
+
+Parameters:
+
+ Adapter _ A pointer ot our adapter information structure.
+
+ CardLine _ Specifies which line to use for the transmit (HTDSU_LINEx_ID).
+
+ BytesToSend _ Number of bytes to transmit.
+
+Return Values:
+
+ None
+
+---------------------------------------------------------------------------*/
+
+{
+ DBG_FUNC("CardPrepareTransmit")
+
+ DBG_ENTER(Adapter);
+
+ ASSERT((CardLine==HTDSU_CMD_LINE1) || (CardLine==HTDSU_CMD_LINE2));
+ ASSERT(READ_REGISTER_USHORT(&Adapter->AdapterRam->TxDataEmpty));
+ ASSERT(BytesToSend > 0);
+
+ /*
+ // Tell the adapter how many bytes are to be sent, and which line to use.
+ */
+ WRITE_REGISTER_USHORT(
+ &Adapter->AdapterRam->TxBuffer.Address,
+ (USHORT) (CardLine - HTDSU_CMD_LINE1)
+ );
+ WRITE_REGISTER_USHORT(
+ &Adapter->AdapterRam->TxBuffer.Length,
+ BytesToSend
+ );
+
+ /*
+ // Mark the end of packet and end of packet list.
+ */
+ WRITE_REGISTER_USHORT(
+ &Adapter->AdapterRam->TxBuffer.Data[(BytesToSend+1)/sizeof(USHORT)],
+ HTDSU_DATA_TERMINATOR
+ );
+ WRITE_REGISTER_USHORT(
+ &Adapter->AdapterRam->TxBuffer.Data[(BytesToSend+3)/sizeof(USHORT)],
+ HTDSU_DATA_TERMINATOR
+ );
+
+ DBG_LEAVE(Adapter);
+}
+
+
+VOID
+CardGetReceiveInfo(
+ IN PHTDSU_ADAPTER Adapter,
+ OUT PUSHORT CardLine, /* HTDSU_CMD_LINE1 or HTDSU_CMD_LINE2 */
+ OUT PUSHORT BytesReceived,
+ OUT PUSHORT RxErrors
+ )
+
+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+Functional Description:
+
+ This routine will retrieve the packet header information from the
+ receive buffer. This assumes that the controller has notified the
+ driver that a packet has been received.
+
+Parameters:
+
+ Adapter _ A pointer ot our adapter information structure.
+
+ CardLine _ Specifies which line the packet was received on (HTDSU_LINEx_ID).
+
+ BytesReceived _ Number of bytes received.
+
+ RxErrors _ Receive error flags non-zero if packet has errors.
+
+Return Values:
+
+ None
+
+---------------------------------------------------------------------------*/
+{
+ DBG_FUNC("CardGetReceiveInfo")
+
+ USHORT Length;
+
+ DBG_ENTER(Adapter);
+
+ /*
+ // This should be true if we're here, but there are race conditions
+ // on hangup where I've seen this condition hit.
+ */
+ if (READ_REGISTER_USHORT(&Adapter->AdapterRam->RxDataAvailable) == 0)
+ {
+ *RxErrors = 0;
+ *BytesReceived = 0;
+ *CardLine = HTDSU_CMD_LINE1; // Don't return a bad line #
+ }
+ else
+ {
+ /*
+ // The length field tells us how many bytes are in the packet, and
+ // the most significant bit tells us whether the packet has a CRC error.
+ */
+ Length = READ_REGISTER_USHORT(&Adapter->AdapterRam->RxBuffer.Length);
+ *BytesReceived = Length & ~HTDSU_CRC_ERROR;
+ *RxErrors = Length & HTDSU_CRC_ERROR;
+
+ /*
+ // The least significant nibble of the address tells us what line the
+ // packet was received on -- at least it better...
+ */
+ *CardLine = (READ_REGISTER_USHORT(
+ &Adapter->AdapterRam->RxBuffer.Address) &
+ 0x000F) + HTDSU_CMD_LINE1;
+
+ if ((*CardLine != HTDSU_CMD_LINE1) && (*CardLine != HTDSU_CMD_LINE2))
+ {
+ *RxErrors |= HTDSU_RX_ERROR;
+ *CardLine = HTDSU_CMD_LINE1; // Don't return a bad line #
+ }
+ else if (*BytesReceived > HTDSU_MAX_PACKET_SIZE)
+ {
+ *RxErrors |= HTDSU_RX_ERROR;
+ }
+ }
+
+ DBG_LEAVE(Adapter);
+}
+
+
+VOID
+CardDialNumber(
+ IN PHTDSU_ADAPTER Adapter,
+ IN USHORT CardLine, /* HTDSU_CMD_LINE1 or HTDSU_CMD_LINE2 */
+ IN PUCHAR DialString,
+ IN ULONG DialStringLength
+ )
+
+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+Functional Description:
+
+ Place a dial string on the adapter and start the dialing sequence.
+
+Parameters:
+
+ Adapter _ A pointer ot our adapter information structure.
+
+ CardLine _ Specifies which line to use for the transmit (HTDSU_LINEx_ID).
+
+ DialString _ A pointer to an ASCII null-terminated string of digits.
+
+ DialStringLength _ Number of bytes in dial string.
+
+Return Values:
+
+ None
+
+---------------------------------------------------------------------------*/
+
+{
+ DBG_FUNC("CardDialNumber")
+
+ UINT Index;
+ UINT NumDigits;
+
+ PUSHORT DialRam;
+
+ DBG_ENTER(Adapter);
+
+ ASSERT(READ_REGISTER_USHORT(&Adapter->AdapterRam->TxDataEmpty));
+ ASSERT(READ_REGISTER_USHORT(&Adapter->AdapterRam->Command) == HTDSU_CMD_NOP);
+
+ /*
+ // Copy the digits to be dialed onto the adapter.
+ // The adapter interprets phone numbers as high byte is valid digit,
+ // low byte is ignored, the last digit gets bit 15 set.
+ */
+ DialRam = (PUSHORT) &Adapter->AdapterRam->TxBuffer;
+
+ for (NumDigits = Index = 0; Index < DialStringLength && *DialString; Index++)
+ {
+ if ((*DialString >= '0') && (*DialString <= '9'))
+ {
+ WRITE_REGISTER_USHORT(
+ DialRam,
+ (USHORT) ((*DialString - '0') << 8)
+ );
+ DialRam++;
+
+ /*
+ // Make sure dial string is within the limit of the adapter.
+ */
+ if (++NumDigits >= HTDSU_MAX_DIALING_DIGITS)
+ {
+ break;
+ }
+ }
+ DialString++;
+ }
+
+ /*
+ // Set the MSB in the last digit.
+ */
+ DialRam--;
+ WRITE_REGISTER_USHORT(
+ DialRam,
+ (USHORT) (READ_REGISTER_USHORT(DialRam) | 0x8000)
+ );
+
+ /*
+ // Initiate the dial sequence.
+ */
+ CardDoCommand(Adapter, CardLine, HTDSU_CMD_DIAL);
+
+ DBG_LEAVE(Adapter);
+}
+
diff --git a/private/ntos/ndis/htdsu/card.h b/private/ntos/ndis/htdsu/card.h
new file mode 100644
index 000000000..fe618d439
--- /dev/null
+++ b/private/ntos/ndis/htdsu/card.h
@@ -0,0 +1,521 @@
+/***************************************************************************\
+|* Copyright (c) 1994 Microsoft Corporation *|
+|* Developed for Microsoft by TriplePoint, Inc. Beaverton, Oregon *|
+|* *|
+|* This file is part of the HT Communications DSU41 WAN Miniport Driver. *|
+\***************************************************************************/
+
+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+Module Name:
+
+ card.h
+
+Abstract:
+
+ This module defines the hardware specific structures and values used to
+ control the HT DSU41. You will need to replace this module with the
+ control functions required to support your hardware.
+
+ This driver conforms to the NDIS 3.0 miniport interface.
+
+Author:
+
+ Larry Hattery - TriplePoint, Inc. (larryh@tpi.com) Jun-94
+
+Environment:
+
+ Include this file at the top of each module in the Miniport driver.
+
+Revision History:
+
+---------------------------------------------------------------------------*/
+
+#ifndef _CARD_H
+#define _CARD_H
+
+/*
+// Maximum number of outstanding transmits allowed. Actually, the driver
+// must queue all transmits internally if they can't be placed on the adapter.
+*/
+#define HTDSU_MAX_TRANSMITS 1
+
+/*
+// Maximum packet size allowed by the adapter -- must be restricted to
+// 1500 bytes at this point, and must also allow for frames at least 32
+// bytes longer.
+*/
+#define HTDSU_MAX_PACKET_SIZE 1532
+#define HTDSU_MAX_FRAME_SIZE (HTDSU_MAX_PACKET_SIZE - 32)
+
+/*
+// WAN packets don't have a MAC header.
+*/
+#define HTDSU_MAC_HEADER_SIZE 0
+
+/*
+// The WAN miniport driver must indicate the entire packet when it is received.
+*/
+#define HTDSU_MAX_LOOKAHEAD (HTDSU_MAX_PACKET_SIZE - HTDSU_MAC_HEADER_SIZE)
+
+/*
+// Media link speed in bits per second.
+*/
+#define HTDSU_LINK_SPEED 57600 // bits per second
+
+/*
+// The maximum number of digits allowed to be in a dialing sequence.
+*/
+#define HTDSU_MAX_DIALING_DIGITS 32
+
+/*
+// These time out values depend on the card firmware and media contraints.
+// We should see a dial tone within 5 seconds,
+// We should then see an answer within at most 30 seconds.
+// When a call arrives, it should be accepted within 5 seconds.
+// And after it is answer, we should get a connect within 2 seconds.
+*/
+#define HTDSU_NO_DIALTONE_TIMEOUT 5000 // 5 seconds
+#define HTDSU_NO_ANSWER_TIMEOUT 40000 // 40 seconds
+#define HTDSU_NO_ACCEPT_TIMEOUT 5000 // 5 seconds
+#define HTDSU_NO_CONNECT_TIMEOUT 2000 // 2 seconds
+#define HTDSU_NO_CLOSECALL_TIMEOUT 2000 // 2 seconds
+
+/*
+// Turn on structure packing to make sure these data structures stay
+// aligned with the hardware.
+*/
+#include <pshpack1.h>
+
+/*
+// Both the transmit and receive buffers have this same format on the card.
+*/
+typedef struct _HTDSU_BUFFER
+{
+ /*
+ // The least significant nibble of the Address field specifies
+ // which line the data is associated with (0 = line 1, 1 = line 2).
+ // The most significant nibbles are used for sequencing information
+ // if line multiplexing is used (NOT SUPPORTED BY THIS DRIVER).
+ */
+# define HTDSU_LINE1_ID 0
+# define HTDSU_LINE2_ID 1
+ USHORT Address;
+
+ /*
+ // The length of the Data field in bytes.
+ // MSB of length field will be set if the HDLC framing detects a
+ // CRC error on any received packet.
+ */
+# define HTDSU_RX_ERROR 0x1000
+# define HTDSU_CRC_ERROR 0x8000
+ USHORT Length;
+
+ /*
+ // The Data field holds the data to be transmitted, or the data just
+ // received on the line. The data must be terminated with a 0x1616.
+ // Note that the data will be padded to an even byte count by the
+ // DSU firmware on incoming frames, and the driver will pad the outgoing
+ // frames so that the terminator is word aligned. Only 'Length' bytes
+ // will actually be transmitted on the line however.
+ */
+# define HTDSU_DATA_SIZE (2016 - (2 * sizeof(USHORT)))
+# define HTDSU_DATA_TERMINATOR 0x1616
+# define HTDSU_DATA_ODDBYTE_MASK 0xFF00
+ USHORT Data[HTDSU_DATA_SIZE/sizeof(USHORT)];
+
+} HTDSU_BUFFER, *PHTDSU_BUFFER;
+
+/*
+// This structure can be overlaid onto the DSU41 adapter memory for
+// easy access to the hardware registers and data buffers.
+// THIS ONLY WORKS IF THE COMPILER SUPPORTS STRUCTURE PACKING ON 16 BIT BOUNDRY.
+*/
+typedef struct _HTDSU_REGISTERS
+{
+ /* 0x000 - 0x7DF
+ // The transmit buffer will hold a single packet.
+ */
+ HTDSU_BUFFER TxBuffer;
+
+ /* 0x7E0 - 0xFBF
+ // The receive buffer may hold more than one packet at a time.
+ */
+ HTDSU_BUFFER RxBuffer;
+
+ /* 0xFC0 - 0xFD5
+ // Reserved hardware registers.
+ */
+ USHORT Reserved1[0x0B];
+
+ /* 0xFD6
+ // This register will be set to 1 by the interrupt handler to tell
+ // the hardware to clear the current interrupt from the adapter.
+ */
+ USHORT InterruptClear;
+
+ /* 0xFD8, 0xFDA
+ // When using transparent mode on line 1 or 2, these registers tell the
+ // adapter how many bytes are interrupt the CPU.
+ // (NOT SUPPORTED BY THIS DRIVER).
+ */
+ USHORT Rx2Length;
+ USHORT Rx1Length;
+
+ /* 0xFDC
+ // This register will be set to 1 when the adapter receives a frame
+ // from the remote unit. The driver must reset this register to zero
+ // after it has copied the frame from the adapter's RxBuffer.
+ */
+ USHORT RxDataAvailable;
+
+ /* 0xFDE
+ // This register will be set to 1 when the adapter copies the frame
+ // from the TxBuffer to its internal buffer. The driver must reset
+ // this register to zero after it fills the TxBuffer and places the
+ // termination flag at the end.
+ */
+ USHORT TxDataEmpty;
+
+ /* 0xFE0
+ // The drivers uses this register to tell the adapter to perform various
+ // actions. The adapter will reset this register to zero when the
+ // command completes.
+ */
+# define HTDSU_CMD_NOP 0x0000
+# define HTDSU_CMD_ANSWER 0x0100
+# define HTDSU_CMD_DIAL 0x0200
+# define HTDSU_CMD_DISCONNECT 0x0300
+# define HTDSU_CMD_SELFTEST 0x0400
+# define HTDSU_CMD_CLEAR_ERRORS 0x0500
+# define HTDSU_CMD_LOCAL_LOOPBACK 0x0600
+# define HTDSU_CMD_LINE_LOOPBACK 0x0700
+# define HTDSU_CMD_REMOTE_LOOPBACK 0x0800
+# define HTDSU_CMD_REMOTETP_LOOPBACK 0x0900
+# define HTDSU_CMD_STOP_LOOPBACK 0x0A00
+# define HTDSU_CMD_LEASED_LINE 0x0B00
+# define HTDSU_CMD_DIALUP_LINE 0x0C00
+# define HTDSU_CMD_RX_BIT_SLIP 0x0D00
+# define HTDSU_CMD_DDS_TX_CLOCK 0x0E00
+# define HTDSU_CMD_INTERNAL_TX_CLOCK 0x0E10
+# define HTDSU_CMD_CLEAR_INTERRUPT 0x0F00
+# define HTDSU_CMD_FORCE_ERROR 0x1000
+# define HTDSU_CMD_RESET 0x1100
+# define HTDSU_CMD_HT_PROTOCOL 0x1200
+# define HTDSU_CMD_NO_PROTOCOL 0x1210
+# define HTDSU_CMD_HDLC_PROTOCOL 0x1220
+# define HTDSU_CMD_TX_RATE_MAX 0x1400
+# define HTDSU_CMD_TX_RATE_57600 0x1410
+# define HTDSU_CMD_TX_RATE_38400 0x1420
+# define HTDSU_CMD_TX_RATE_19200 0x1430
+# define HTDSU_CMD_TX_RATE_9600 0x1440
+# define HTDSU_CMD_LINE1 0x0001
+# define HTDSU_CMD_LINE2 0x0002
+ USHORT Command;
+
+ /* 0xFE2, 0xFE4
+ // The InterruptEnable register provides control over which adapter events
+ // will signal an interrupt to the CPU. The InterruptStatus register is
+ // used by the driver to determine the cause of an interrupt.
+ */
+# define HTDSU_INTR_DISABLE 0x0000
+# define HTDSU_INTR_RX_FULL2 0x0001
+# define HTDSU_INTR_RX_FULL1 0x0002
+# define HTDSU_INTR_RX_PACKET2 0x0004
+# define HTDSU_INTR_RX_PACKET1 0x0008
+# define HTDSU_INTR_NO_SIGNAL2 0x0010
+# define HTDSU_INTR_NO_SIGNAL1 0x0020
+# define HTDSU_INTR_DISCONNECTED2 0x0040
+# define HTDSU_INTR_DISCONNECTED1 0x0080
+# define HTDSU_INTR_CONNECTED2 0x0100
+# define HTDSU_INTR_CONNECTED1 0x0200
+# define HTDSU_INTR_RINGING2 0x0400
+# define HTDSU_INTR_RINGING1 0x0800
+# define HTDSU_INTR_TX_PACKET2 0x1000
+# define HTDSU_INTR_TX_PACKET1 0x2000
+# define HTDSU_INTR_TX_EMPTY2 0x4000
+# define HTDSU_INTR_TX_EMPTY1 0x8000
+# define HTDSU_INTR_ALL_LINE1 (HTDSU_INTR_RX_FULL1 | \
+ HTDSU_INTR_RX_PACKET1 | \
+ HTDSU_INTR_TX_PACKET1 | \
+ HTDSU_INTR_NO_SIGNAL1 | \
+ HTDSU_INTR_DISCONNECTED1 | \
+ HTDSU_INTR_CONNECTED1 | \
+ HTDSU_INTR_RINGING1)
+# define HTDSU_INTR_ALL_LINE2 (HTDSU_INTR_RX_FULL2 | \
+ HTDSU_INTR_RX_PACKET2 | \
+ HTDSU_INTR_TX_PACKET2 | \
+ HTDSU_INTR_NO_SIGNAL2 | \
+ HTDSU_INTR_DISCONNECTED2 | \
+ HTDSU_INTR_CONNECTED2 | \
+ HTDSU_INTR_RINGING2)
+ USHORT InterruptEnable;
+ USHORT InterruptStatus;
+
+ /* 0xFE6, 0xFE8
+ // The StatusLine registers are used by the driver to determine the
+ // current state of the associated phone line.
+ */
+# define HTDSU_STATUS_LOCAL_LOOPBACK 0x0001
+# define HTDSU_STATUS_CO_LOOPBACK 0x0002
+# define HTDSU_STATUS_REMOTE_LOOPBACK 0x0008
+# define HTDSU_STATUS_LINE_LOOPBACK 0x0010
+# define HTDSU_STATUS_OUT_OF_FRAME 0x0020
+# define HTDSU_STATUS_OUT_OF_SERVICE 0x0040
+# define HTDSU_STATUS_NO_SIGNAL 0x0080
+# define HTDSU_STATUS_NO_CURRENT 0x0100
+# define HTDSU_STATUS_NO_DIAL_TONE 0x0200
+# define HTDSU_STATUS_ON_LINE 0x0400
+# define HTDSU_STATUS_NO_ANSWER 0x0800
+# define HTDSU_STATUS_CARRIER_DETECT 0x1000
+# define HTDSU_STATUS_RINGING 0x2000
+# define HTDSU_STATUS_REMOTE_RESPONSE 0x4000
+ USHORT StatusLine1;
+ USHORT StatusLine2;
+
+ /* 0xFEA, 0xFEC
+ // The error counter registers are used when running the command:
+ // HTDSU_CMD_REMOTETP_LOOPBACK. The counters are incremented if a
+ // test pattern error is detected, and they are reset when the test
+ // is terminated.
+ */
+#define HTDSU_ERROR_COPROCESSOR 0x0800
+#define HTDSU_ERROR_DSU2 0x1000
+#define HTDSU_ERROR_DSU1 0x2000
+#define HTDSU_ERROR_LOW_BYTE 0x4000
+#define HTDSU_ERROR_HIGH_BYTE 0x8000
+ USHORT ErrorsLine1;
+ USHORT ErrorsLine2;
+
+ /* 0xFEE
+ // The adapter firmware sets test SelfTestStatus register if it detects
+ // an error during the HTDSU_CMD_SELFTEST command. Otherwise this register
+ // is reset to zero.
+ */
+#define HTDSU_SELFTEST_OK (HTDSU_ERROR_HIGH_BYTE | \
+ HTDSU_ERROR_LOW_BYTE | \
+ HTDSU_ERROR_COPROCESSOR)
+#define HTDSU_SELFTEST_TIMEOUT 40000 // 4 seconds.
+ USHORT SelfTestStatus;
+
+ /* 0xFF0
+ // Reserved hardware register.
+ */
+ USHORT Reserved2;
+
+ /* 0xFF2
+ // DSU serial number.
+ */
+ USHORT SerialNumber;
+
+ /* 0xFF4
+ // Co-processor firmware checksum.
+ */
+ USHORT CoProcessorCheckSum;
+
+ /* 0xFF6
+ // DSU firmware checksum.
+ */
+ USHORT DsuCheckSum;
+
+ /* 0xFF8
+ // Co-processor firmware version.
+ */
+# define HTDSU_COPROCESSOR_VERSION 0x0340
+ USHORT CoProcessorVersion;
+
+ /* 0xFFA
+ // DSU firmware version.
+ */
+# define HTDSU_DSU_VERSION 0x0013
+ USHORT DsuVersion;
+
+ /* 0xFFC
+ // DSU hardware ID.
+ */
+# define HTDSU_DSU_ID 0x0050
+ USHORT DsuId;
+
+ /* 0xFFE
+ // Co-processor ID.
+ */
+# define HTDSU_COPROCESSOR_ID 0x0060
+ USHORT CoProcessorId;
+
+} HTDSU_REGISTERS, * PHTDSU_REGISTERS;
+
+
+/*
+// Turn off structure packing.
+*/
+#include <poppack.h>
+
+/*
+// The adapter memory structure must be sized the same as the hardware!
+*/
+#define HTDSU_MEMORY_SIZE sizeof(HTDSU_REGISTERS)
+
+/*
+// Enable the currently accepted interrupts on the adapter.
+*/
+#define CardEnableInterrupt(Adapter) \
+ {WRITE_REGISTER_USHORT(&Adapter->AdapterRam->InterruptEnable, \
+ Adapter->InterruptEnableFlag);}
+
+/*
+// Disable all interrupts on the adapter.
+*/
+#define CardDisableInterrupt(Adapter) \
+ {WRITE_REGISTER_USHORT(&Adapter->AdapterRam->InterruptEnable, \
+ HTDSU_INTR_DISABLE);}
+
+/*
+// Clear all the current interrupts on the adapter.
+*/
+#define CardClearInterrupt(Adapter) \
+ {WRITE_REGISTER_USHORT(&Adapter->AdapterRam->InterruptClear, 1);}
+
+/*
+// Return TRUE if all interrupts are disabled on the adapter.
+*/
+#define CardAreInterruptsDisabled(Adapter) \
+ (READ_REGISTER_USHORT(&Adapter->AdapterRam->InterruptEnable) == \
+ HTDSU_INTR_DISABLE)
+
+/*
+// Return the current interrupt status from the adapter.
+*/
+#define CardGetInterrupt(Adapter) \
+ (READ_REGISTER_USHORT(&Adapter->AdapterRam->InterruptStatus))
+
+/*
+// Start sending the current packet out.
+*/
+#define CardStartTransmit(Adapter) \
+ {WRITE_REGISTER_USHORT(&Adapter->AdapterRam->TxDataEmpty, 0);}
+
+/*
+// Return non-zero if transmit buffer is empty
+*/
+#define CardTransmitEmpty(Adapter) \
+ (READ_REGISTER_USHORT(&Adapter->AdapterRam->TxDataEmpty))
+
+/*
+// Tell the adapter we're done with the packet just received.
+*/
+#define CardReceiveAvailable(Adapter) \
+ (READ_REGISTER_USHORT(&Adapter->AdapterRam->RxDataAvailable))
+
+/*
+// Tell the adapter we're done with the packet just received.
+*/
+#define CardReceiveComplete(Adapter) \
+ {WRITE_REGISTER_USHORT(&Adapter->AdapterRam->RxDataAvailable, 0);}
+
+/*
+// Tell the adapter to pick up the line.
+*/
+#define CardLineAnswer(Adapter, CardLine) \
+ CardDoCommand(Adapter, CardLine, HTDSU_CMD_ANSWER)
+
+/*
+// Return non-zero if remote unit has responded to ring from this line.
+*/
+#define CardStatusRingBack(Adapter, CardLine) \
+ ((CardLine == HTDSU_CMD_LINE1) ? \
+ (READ_REGISTER_USHORT(&Adapter->AdapterRam->StatusLine1) & \
+ HTDSU_STATUS_REMOTE_RESPONSE) : \
+ (READ_REGISTER_USHORT(&Adapter->AdapterRam->StatusLine2) & \
+ HTDSU_STATUS_REMOTE_RESPONSE) \
+ )
+
+/*
+// Return non-zero if this phone line is ringing.
+*/
+#define CardStatusRinging(Adapter, CardLine) \
+ ((CardLine == HTDSU_CMD_LINE1) ? \
+ (READ_REGISTER_USHORT(&Adapter->AdapterRam->StatusLine1) & \
+ HTDSU_STATUS_RINGING) : \
+ (READ_REGISTER_USHORT(&Adapter->AdapterRam->StatusLine2) & \
+ HTDSU_STATUS_RINGING) \
+ )
+
+/*
+// Return non-zero if this line has detected a carrier signal.
+*/
+#define CardStatusCarrierDetect(Adapter, CardLine) \
+ ((CardLine == HTDSU_CMD_LINE1) ? \
+ (READ_REGISTER_USHORT(&Adapter->AdapterRam->StatusLine1) & \
+ HTDSU_STATUS_CARRIER_DETECT) : \
+ (READ_REGISTER_USHORT(&Adapter->AdapterRam->StatusLine2) & \
+ HTDSU_STATUS_CARRIER_DETECT) \
+ )
+
+/*
+// Return non-zero if the number we dialed on this line did not answer.
+*/
+#define CardStatusNoAnswer(Adapter, CardLine) \
+ ((CardLine == HTDSU_CMD_LINE1) ? \
+ (READ_REGISTER_USHORT(&Adapter->AdapterRam->StatusLine1) & \
+ HTDSU_STATUS_NO_ANSWER) : \
+ (READ_REGISTER_USHORT(&Adapter->AdapterRam->StatusLine2) & \
+ HTDSU_STATUS_NO_ANSWER) \
+ )
+
+/*
+// Return non-zero if the selected line is ready to use.
+*/
+#define CardStatusOnLine(Adapter, CardLine) \
+ ((CardLine == HTDSU_CMD_LINE1) ? \
+ (READ_REGISTER_USHORT(&Adapter->AdapterRam->StatusLine1) & \
+ HTDSU_STATUS_ON_LINE) : \
+ (READ_REGISTER_USHORT(&Adapter->AdapterRam->StatusLine2) & \
+ HTDSU_STATUS_ON_LINE) \
+ )
+
+/*
+// Return non-zero if no dial tone is present on this line.
+*/
+#define CardStatusNoDialTone(Adapter, CardLine) \
+ ((CardLine == HTDSU_CMD_LINE1) ? \
+ (READ_REGISTER_USHORT(&Adapter->AdapterRam->StatusLine1) & \
+ HTDSU_STATUS_NO_DIAL_TONE) : \
+ (READ_REGISTER_USHORT(&Adapter->AdapterRam->StatusLine2) & \
+ HTDSU_STATUS_NO_DIAL_TONE) \
+ )
+
+/*
+// Return non-zero if this line has no sealing current.
+*/
+#define CardStatusNoCurrent(Adapter, CardLine) \
+ ((CardLine == HTDSU_CMD_LINE1) ? \
+ (READ_REGISTER_USHORT(&Adapter->AdapterRam->StatusLine1) & \
+ HTDSU_STATUS_NO_CURRENT) : \
+ (READ_REGISTER_USHORT(&Adapter->AdapterRam->StatusLine2) & \
+ HTDSU_STATUS_NO_CURRENT) \
+ )
+
+/*
+// Return non-zero if this line has no signal present.
+*/
+#define CardStatusNoSignal(Adapter, CardLine) \
+ ((CardLine == HTDSU_CMD_LINE1) ? \
+ (READ_REGISTER_USHORT(&Adapter->AdapterRam->StatusLine1) & \
+ HTDSU_STATUS_NO_SIGNAL) : \
+ (READ_REGISTER_USHORT(&Adapter->AdapterRam->StatusLine2) & \
+ HTDSU_STATUS_NO_SIGNAL) \
+ )
+
+/*
+// Return non-zero if this line has been placed out of service by the switch.
+*/
+#define CardStatusOutOfService(Adapter, CardLine) \
+ ((CardLine == HTDSU_CMD_LINE1) ? \
+ (READ_REGISTER_USHORT(&Adapter->AdapterRam->StatusLine1) & \
+ HTDSU_STATUS_OUT_OF_SERVICE) : \
+ (READ_REGISTER_USHORT(&Adapter->AdapterRam->StatusLine2) & \
+ HTDSU_STATUS_OUT_OF_SERVICE) \
+ )
+
+#endif // _CARD_H
+
diff --git a/private/ntos/ndis/htdsu/debug.c b/private/ntos/ndis/htdsu/debug.c
new file mode 100644
index 000000000..846e51737
--- /dev/null
+++ b/private/ntos/ndis/htdsu/debug.c
@@ -0,0 +1,112 @@
+/***************************************************************************\
+|* Copyright (c) 1994 Microsoft Corporation *|
+|* Developed for Microsoft by TriplePoint, Inc. Beaverton, Oregon *|
+|* *|
+|* This file is part of the HT Communications DSU41 WAN Miniport Driver. *|
+\***************************************************************************/
+#include "version.h"
+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+Module Name:
+
+ debug.c
+
+Abstract:
+
+ This module contains code to support driver debugging.
+
+Author:
+
+ Larry Hattery - TriplePoint, Inc. (larryh@tpi.com) Jun-94
+
+Environment:
+
+ Development only.
+
+Revision History:
+
+---------------------------------------------------------------------------*/
+
+#include <ndis.h>
+
+#if DBG
+
+
+VOID
+DbgPrintData(
+ IN PUCHAR Data,
+ IN UINT NumBytes,
+ IN ULONG Offset
+ )
+
+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+Routine Description:
+
+ Dumps data to the debug display formated in hex and ascii for easy viewing.
+ Used for debug output only. It is not compiled into the retail version.
+
+Arguments:
+
+ Data Buffer of data to be displayed
+
+ NumBytes Number of bytes to display
+
+ Offset Beginning offset to be displayed before each line
+
+Return Value:
+
+ None
+
+---------------------------------------------------------------------------*/
+
+{
+ UINT i,j;
+
+ for (i = 0; i < NumBytes; i += 16)
+ {
+ DbgPrint("%04lx: ", i + Offset);
+
+ /*
+ // Output the hex bytes
+ */
+ for (j = i; j < (i+16); j++)
+ {
+ if (j < NumBytes)
+ {
+ DbgPrint("%02x ",(UINT)((UCHAR)*(Data+j)));
+ }
+ else
+ {
+ DbgPrint(" ");
+ }
+ }
+
+ DbgPrint(" ");
+
+ /*
+ // Output the ASCII bytes
+ */
+ for (j = i; j < (i+16); j++)
+ {
+ if (j < NumBytes)
+ {
+ char c = *(Data+j);
+
+ if (c < ' ' || c > 'Z')
+ {
+ c = '.';
+ }
+ DbgPrint("%c", (UINT)c);
+ }
+ else
+ {
+ DbgPrint(" ");
+ }
+ }
+ DbgPrint("\n");
+ }
+}
+
+#endif
+
diff --git a/private/ntos/ndis/htdsu/debug.h b/private/ntos/ndis/htdsu/debug.h
new file mode 100644
index 000000000..5f3c6c581
--- /dev/null
+++ b/private/ntos/ndis/htdsu/debug.h
@@ -0,0 +1,137 @@
+/***************************************************************************\
+|* Copyright (c) 1994 Microsoft Corporation *|
+|* Developed for Microsoft by TriplePoint, Inc. Beaverton, Oregon *|
+|* *|
+|* This file is part of the HT Communications DSU41 WAN Miniport Driver. *|
+\***************************************************************************/
+
+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+Module Name:
+
+ debug.h
+
+Abstract:
+
+ This file contains generic debug macros for driver development.
+ If (DBG == 0) no code is generated; Otherwise macros will expand.
+
+Author:
+
+ Larry Hattery - TriplePoint, Inc. (larryh@tpi.com) Jun-94
+
+Environment:
+
+ Development Only.
+
+ debug.c must be linked into the driver code to support output.
+
+Revision History:
+
+---------------------------------------------------------------------------*/
+
+#ifndef _DEBUG_H
+#define _DEBUG_H
+
+/*
+// DEBUG FLAG DEFINITIONS
+*/
+
+#define DBG_ERROR_ON 0x0001L /* Display DBG_ERROR messages */
+#define DBG_WARNING_ON 0x0002L /* Display DBG_WARNING messages */
+#define DBG_NOTICE_ON 0x0004L /* Display DBG_NOTICE messages */
+#define DBG_TRACE_ON 0x0008L /* Display ENTER/TRACE/LEAVE messages */
+#define DBG_REQUEST_ON 0x0010L /* Enable set/query request display */
+#define DBG_PARAMS_ON 0x0020L /* Enable function parameter display */
+#define DBG_HEADERS_ON 0x0040L /* Enable Tx/Rx MAC header display */
+#define DBG_PACKETS_ON 0x0080L /* Enable Tx/Rx packet display */
+#define DBG_FILTER1_ON 0x0100L /* Display DBG_FILTER 1 messages */
+#define DBG_FILTER2_ON 0x0200L /* Display DBG_FILTER 2 messages */
+#define DBG_FILTER3_ON 0x0400L /* Display DBG_FILTER 3 messages */
+#define DBG_FILTER4_ON 0x0800L /* Display DBG_FILTER 4 messages */
+#define DBG_BREAK_ON 0x1000L /* Enable breakpoints */
+#define DBG_TAPICALL_ON 0x4000L /* Enable TAPI call state messages */
+#define DBG_HWTEST_ON 0x8000L /* Enable hardware self-test */
+
+extern VOID
+DbgPrintData(
+ IN PUCHAR Data,
+ IN UINT NumBytes,
+ IN ULONG Offset
+ );
+
+extern VOID NTAPI DbgBreakPoint(VOID);
+
+#if defined(DBG) && (DBG != 0)
+
+/*
+// A - is a pointer to the adapter structure
+// S - is a parenthesised printf string
+// e.g. DBG_PRINT(Adap,("ERR=%d",err));
+// F - is a function name
+// e.g. DBG_FUNC("FunctionName")
+// C - is a C conditional
+// e.g. ASSERT(a <= b)
+*/
+
+# define BREAKPOINT DbgBreakPoint()
+
+# define STATIC
+
+# define DBG_FUNC(F) static const char __FUNC__[] = F;
+
+# define DBG_BREAK(A) {if ((A)->DbgFlags & DBG_BREAK_ON) BREAKPOINT;}
+
+// WARNING DBG_PRINT(A,S) (A) can be NULL!!!
+# define DBG_PRINT(A,S) {DbgPrint("%s---%s @ %s:%d\n",(A)?(A)->DbgID:"?",__FUNC__,__FILE__,__LINE__);DbgPrint S;}
+
+# define DBG_ENTER(A) {if ((A)->DbgFlags & DBG_TRACE_ON) \
+ {DbgPrint("%s>>>%s\n",(A)->DbgID,__FUNC__);}}
+
+# define DBG_TRACE(A) {if ((A)->DbgFlags & DBG_TRACE_ON) \
+ {DbgPrint("%s---%s:%d\n",(A)->DbgID,__FUNC__,__LINE__);}}
+
+# define DBG_LEAVE(A) {if ((A)->DbgFlags & DBG_TRACE_ON) \
+ {DbgPrint("%s<<<%s\n",(A)->DbgID,__FUNC__);}}
+
+# define DBG_ERROR(A,S) {if ((A)->DbgFlags & DBG_ERROR_ON) \
+ {DbgPrint("%s---%s: ERROR: ",(A)->DbgID,__FUNC__);DbgPrint S;}}
+
+# define DBG_WARNING(A,S) {if ((A)->DbgFlags & DBG_WARNING_ON) \
+ {DbgPrint("%s---%s: WARNING: ",(A)->DbgID,__FUNC__);DbgPrint S;}}
+
+# define DBG_NOTICE(A,S) {if ((A)->DbgFlags & DBG_NOTICE_ON) \
+ {DbgPrint("%s---%s: NOTICE: ",(A)->DbgID,__FUNC__);DbgPrint S;}}
+
+# define DBG_FILTER(A,M,S){if ((A)->DbgFlags & (M)) \
+ {DbgPrint("%s---%s: ",(A)->DbgID,__FUNC__);DbgPrint S;}}
+
+# define DBG_DISPLAY(S) {DbgPrint("?---%s: ",__FUNC__); DbgPrint S;}
+
+#ifdef ASSERT
+#undef ASSERT
+#endif
+#define ASSERT(C) if (!(C)) { \
+ DbgPrint("!---%s: ASSERT(%s) FAILED!\n%s #%d\n", \
+ __FUNC__, #C, __FILE__, __LINE__); \
+ BREAKPOINT; \
+ }
+#else
+
+# define BREAKPOINT
+# define STATIC static
+# define DBG_FUNC(F)
+# define DBG_BREAK
+# define DBG_PRINT(A,S)
+# define DBG_ENTER(A)
+# define DBG_TRACE(A)
+# define DBG_LEAVE(A)
+# define DBG_ERROR(A,S)
+# define DBG_WARNING(A,S)
+# define DBG_NOTICE(A,S)
+# define DBG_FILTER(A,M,S)
+# define DBG_DISPLAY(S)
+
+#endif
+
+#endif
diff --git a/private/ntos/ndis/htdsu/htdsu.c b/private/ntos/ndis/htdsu/htdsu.c
new file mode 100644
index 000000000..a1a48258d
--- /dev/null
+++ b/private/ntos/ndis/htdsu/htdsu.c
@@ -0,0 +1,1395 @@
+/***************************************************************************\
+|* Copyright (c) 1994 Microsoft Corporation *|
+|* Developed for Microsoft by TriplePoint, Inc. Beaverton, Oregon *|
+|* *|
+|* This file is part of the HT Communications DSU41 WAN Miniport Driver. *|
+\***************************************************************************/
+#include "version.h"
+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+Module Name:
+
+ htdsu.c
+
+Abstract:
+
+ This module contains the DriverEntry() routine, which is the first
+ routine called when the driver is loaded into memory. The Miniport
+ initialization and termination routines are also implemented here:
+ MiniportInitialize()
+ MiniportHalt()
+
+ This driver conforms to the NDIS 3.0 Miniport interface.
+
+Author:
+
+ Larry Hattery - TriplePoint, Inc. (larryh@tpi.com) Jun-94
+
+Environment:
+
+ Windows NT 3.5 kernel mode Miniport driver or equivalent.
+
+Revision History:
+
+---------------------------------------------------------------------------*/
+
+#define __FILEID__ 1 // Unique file ID for error logging
+
+#include "htdsu.h"
+
+/*
+// This is defined here to avoid including all of ntddk.h which cannot
+// normally be included by a miniport driver.
+*/
+extern
+NTSYSAPI
+NTSTATUS
+NTAPI
+RtlUnicodeStringToAnsiString(
+ PANSI_STRING out,
+ PUNICODE_STRING in,
+ BOOLEAN allocate
+ );
+
+/*
+// Receives the context value representing the Miniport wrapper
+// as returned from NdisMInitializeWrapper.
+*/
+static NDIS_HANDLE
+NdisWrapperHandle = NULL;
+
+/*
+// This constant is used for places where NdisAllocateMemory needs to be
+// called and the HighestAcceptableAddress does not matter.
+*/
+static NDIS_PHYSICAL_ADDRESS
+HighestAcceptableAddress = NDIS_PHYSICAL_ADDRESS_CONST(-1,-1);
+
+/*
+// This is used to assign a unique instance number to each adapter.
+*/
+static UCHAR
+HtDsuAdapterCount = 0;
+
+/*
+// Tell the compiler which routines can be unloaded after initialization.
+*/
+NTSTATUS
+DriverEntry(
+ IN PDRIVER_OBJECT DriverObject,
+ IN PUNICODE_STRING RegistryPath
+ );
+#pragma NDIS_INIT_FUNCTION(DriverEntry)
+
+/*
+// Tell the compiler which routines can be paged out.
+// These can never be called from interrupt or DPC level!
+*/
+NDIS_STATUS
+HtDsuInitialize(
+ OUT PNDIS_STATUS OpenErrorStatus,
+ OUT PUINT SelectedMediumIndex,
+ IN PNDIS_MEDIUM MediumArray,
+ IN UINT MediumArraySize,
+ IN NDIS_HANDLE MiniportAdapterHandle,
+ IN NDIS_HANDLE WrapperConfigurationContext
+ );
+#pragma NDIS_PAGABLE_FUNCTION(HtDsuInitialize)
+
+NDIS_STATUS
+HtDsuRegisterAdapter(
+ IN PHTDSU_ADAPTER Adapter,
+ IN PSTRING AddressList
+ );
+#pragma NDIS_PAGABLE_FUNCTION(HtDsuRegisterAdapter)
+
+VOID
+HtDsuHalt(
+ IN PHTDSU_ADAPTER Adapter
+ );
+#pragma NDIS_PAGABLE_FUNCTION(HtDsuHalt)
+
+
+NTSTATUS
+DriverEntry(
+ IN PDRIVER_OBJECT DriverObject,
+ IN PUNICODE_STRING RegistryPath
+ )
+
+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+Functional Description:
+
+ The DriverEntry routine is the main entry point for the driver.
+ It is responsible for the initializing the Miniport wrapper and
+ registering the driver with the Miniport wrapper.
+
+Parameters:
+
+ DriverObject _ Pointer to driver object created by the system.
+
+ RegistryPath _ Pointer to registery path name used to read registry
+ parameters.
+
+Return Values:
+
+ STATUS_SUCCESS
+ STATUS_UNSUCCESSFUL
+
+---------------------------------------------------------------------------*/
+
+{
+ DBG_FUNC("HtDsuDriverEntry")
+
+ /*
+ // Receives the status of the NdisMWanRegisterMiniport operation.
+ */
+ NDIS_STATUS Status;
+
+ /*
+ // Characteristics table passed to NdisMWanRegisterMiniport.
+ */
+ NDIS_WAN_MINIPORT_CHARACTERISTICS HtDsuChar;
+
+#if DBG
+ DbgPrint("?>>>%s: Build Date:"__DATE__" Time:"__TIME__"\n",__FUNC__);
+#endif
+
+ /*
+ // Initialize the Miniport wrapper - THIS MUST BE THE FIRST NDIS CALL.
+ */
+ NdisMInitializeWrapper(
+ &NdisWrapperHandle,
+ DriverObject,
+ RegistryPath,
+ NULL
+ );
+
+ /*
+ // Initialize the characteristics table, exporting the Miniport's entry
+ // points to the Miniport wrapper.
+ */
+ HtDsuChar.MajorNdisVersion = NDIS_MAJOR_VERSION;
+ HtDsuChar.MinorNdisVersion = NDIS_MINOR_VERSION;
+ HtDsuChar.Reserved = NDIS_USE_WAN_WRAPPER;
+
+ HtDsuChar.CheckForHangHandler = HtDsuCheckForHang;
+ HtDsuChar.DisableInterruptHandler = HtDsuDisableInterrupt;
+ HtDsuChar.EnableInterruptHandler = HtDsuEnableInterrupt;
+ HtDsuChar.HaltHandler = HtDsuHalt;
+ HtDsuChar.HandleInterruptHandler = HtDsuHandleInterrupt;
+ HtDsuChar.InitializeHandler = HtDsuInitialize;
+ HtDsuChar.ISRHandler = HtDsuISR;
+ HtDsuChar.QueryInformationHandler = HtDsuQueryInformation;
+ HtDsuChar.ReconfigureHandler = NULL; // Hardware not reconfigurable
+ HtDsuChar.ResetHandler = HtDsuReset;
+ HtDsuChar.WanSendHandler = HtDsuWanSend;
+ HtDsuChar.SetInformationHandler = HtDsuSetInformation;
+ HtDsuChar.TransferDataHandler = NULL; // Not used by WAN drivers
+
+ /*
+ // Register the driver with the Miniport wrapper.
+ */
+ Status = NdisMRegisterMiniport(
+ NdisWrapperHandle,
+ (PNDIS_MINIPORT_CHARACTERISTICS) &HtDsuChar,
+ sizeof(HtDsuChar)
+ );
+
+ /*
+ // The driver will not load if this call fails.
+ // The system will log the error for us.
+ */
+ if (Status != NDIS_STATUS_SUCCESS)
+ {
+ DBG_DISPLAY(("ERROR: NdisMRegisterMiniport Status=%Xh\n",Status));
+ return STATUS_UNSUCCESSFUL;
+ }
+
+ return STATUS_SUCCESS;
+}
+
+
+
+NDIS_STATUS
+HtDsuInitialize(
+ OUT PNDIS_STATUS OpenErrorStatus,
+ OUT PUINT SelectedMediumIndex,
+ IN PNDIS_MEDIUM MediumArray,
+ IN UINT MediumArraySize,
+ IN NDIS_HANDLE MiniportAdapterHandle,
+ IN NDIS_HANDLE WrapperConfigurationContext
+ )
+
+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+Functional Description:
+
+ The MiniportInitialize request is called to have the Miniport driver
+ initialize the adapter.
+
+ No other request will be outstanding on the Miniport when this routine
+ is called. No other request will be submitted to the Miniport until
+ the operation is completed.
+
+ The wrapper will supply an array containing a list of the media types
+ that it supports. The Miniport driver reads this array and returns
+ the index of the media type that the wrapper should treat her as.
+ If the Miniport driver is impersonating a media type that is different
+ from the true media type, this must be done completely transparently to
+ the wrapper.
+
+ If the Miniport driver cannot find a media type supported by both it
+ and the wrapper, it returns NDIS_STATUS_UNSUPPORTED_MEDIA.
+
+ The status value NDIS_STATUS_OPEN_ERROR has a special meaning. It
+ indicates that the OpenErrorStatus parameter has returned a valid status
+ which the wrapper can examine to obtain more information about the error.
+
+ This routine is called with interrupts enabled, and a call to MiniportISR
+ will occur if the adapter generates any interrupts. During this routine
+ MiniportDisableInterrupt and MiniportEnableInterrupt will not be called,
+ so it is the responsibility of the Miniport driver to acknowledge and
+ clear any interrupts generated.
+
+Parameters:
+
+ OpenErrorStatus _ Returns more information about the reason for the
+ failure. Currently, the only values defined match those
+ specified as Open Error Codes in Appendix B of the IBM
+ Local Area Network Technical Reference.
+
+ SelectedMediumIndex _ Returns the index in MediumArray of the medium type
+ that the Miniport driver wishes to be viewed as.
+ Note that even though the NDIS interface may complete
+ this request asynchronously, it must return this
+ index on completion of this function.
+
+ MediumArray _ An array of medium types which the wrapper supports.
+
+ MediumArraySize _ The number of elements in MediumArray.
+
+ MiniportAdapterHandle _ A handle identifying the Miniport. The Miniport
+ driver must supply this handle in future requests
+ that refer to the Miniport.
+
+ WrapperConfigurationContext _ The handle used for calls to NdisOpenConfiguration,
+ and the routines in section 4 of this document.
+
+Return Values:
+
+ NDIS_STATUS_ADAPTER_NOT_FOUND
+ NDIS_STATUS_FAILURE
+ NDIS_STATUS_NOT_ACCEPTED
+ NDIS_STATUS_OPEN_ERROR
+ NDIS_STATUS_RESOURCES
+ NDIS_STATUS_SUCCESS
+ NDIS_STATUS_UNSUPPORTED_MEDIA
+
+---------------------------------------------------------------------------*/
+
+{
+ DBG_FUNC("HtDsuInitialize")
+
+ /*
+ // Holds the status result returned from an NDIS function call.
+ */
+ NDIS_STATUS Status;
+
+ /*
+ // Pointer to our newly allocated adapter.
+ */
+ PHTDSU_ADAPTER Adapter;
+
+ /*
+ // The handle for reading from the registry.
+ */
+ NDIS_HANDLE ConfigHandle;
+
+ /*
+ // The value read from the registry.
+ */
+ PNDIS_CONFIGURATION_PARAMETER ReturnedValue;
+
+ UINT index;
+
+ /*
+ // Define all the parameters that will be read.
+ */
+ NDIS_STRING RamBaseString = HTDSU_PARAM_RAMBASE_STRING;
+ ULONG RamBaseAddress = 0;
+
+ NDIS_STRING InterruptString = HTDSU_PARAM_INTERRUPT_STRING;
+ CCHAR InterruptNumber = 0;
+
+ NDIS_STRING LineTypeString = HTDSU_PARAM_LINETYPE_STRING;
+ CCHAR LineType = 0;
+
+ NDIS_STRING LineRateString = HTDSU_PARAM_LINERATE_STRING;
+ USHORT LineRate = 0;
+
+ NDIS_STRING MediaTypeString = HTDSU_PARAM_MEDIATYPE_STRING;
+ ANSI_STRING MediaType;
+
+ NDIS_STRING DeviceNameString = HTDSU_PARAM_DEVICENAME_STRING;
+ ANSI_STRING DeviceName;
+
+ NDIS_STRING AddressListString = HTDSU_PARAM_ADDRLIST_STRING;
+ ANSI_STRING AddressList;
+
+#if DBG
+ NDIS_STRING DbgFlagsString = HTDSU_PARAM_DBGFLAGS_STRING;
+ ULONG DbgFlags = 0;
+#endif
+
+ /*
+ // Search the MediumArray for the WAN media type.
+ */
+ for (index = 0; index < MediumArraySize; index++)
+ {
+ if (MediumArray[index] == NdisMediumWan)
+ {
+ break;
+ }
+ }
+
+ /*
+ // Return if no supported medium is found.
+ */
+ if (index >= MediumArraySize)
+ {
+ DBG_DISPLAY(("ERROR: No medium found (array=%X,size=%d)\n",
+ MediumArray, MediumArraySize));
+ /*
+ // Log error message and exit.
+ */
+ NdisWriteErrorLogEntry(
+ MiniportAdapterHandle,
+ NDIS_ERROR_CODE_UNSUPPORTED_CONFIGURATION,
+ 3,
+ index,
+ __FILEID__,
+ __LINE__
+ );
+ return NDIS_STATUS_UNSUPPORTED_MEDIA;
+ }
+
+ /*
+ // Save the selected medium type.
+ */
+ *SelectedMediumIndex = index;
+
+ /*
+ // Open the configuration registry so we can get our config values.
+ */
+ NdisOpenConfiguration(
+ &Status,
+ &ConfigHandle,
+ WrapperConfigurationContext
+ );
+
+ if (Status != NDIS_STATUS_SUCCESS)
+ {
+ DBG_DISPLAY(("ERROR: NdisOpenConfiguration failed (Status=%X)\n",Status));
+ /*
+ // Log error message and exit.
+ */
+ NdisWriteErrorLogEntry(
+ MiniportAdapterHandle,
+ NDIS_ERROR_CODE_UNSUPPORTED_CONFIGURATION,
+ 3,
+ Status,
+ __FILEID__,
+ __LINE__
+ );
+ return NDIS_STATUS_FAILURE;
+ }
+
+ /********************************************************************
+ // Get InterruptNumber for this adapter.
+ */
+ NdisReadConfiguration(
+ &Status,
+ &ReturnedValue,
+ ConfigHandle,
+ &InterruptString,
+ NdisParameterInteger
+ );
+
+ if (Status == NDIS_STATUS_SUCCESS)
+ {
+ InterruptNumber = (CCHAR)(ReturnedValue->ParameterData.IntegerData);
+ }
+ else
+ {
+ DBG_DISPLAY(("ERROR: NdisReadConfiguration(InterruptNumber) failed (Status=%X)\n",Status));
+ /*
+ // Log error message and exit.
+ */
+ NdisWriteErrorLogEntry(
+ MiniportAdapterHandle,
+ NDIS_ERROR_CODE_MISSING_CONFIGURATION_PARAMETER,
+ 3,
+ Status,
+ __FILEID__,
+ __LINE__
+ );
+ NdisCloseConfiguration(ConfigHandle);
+ return NDIS_STATUS_FAILURE;
+ }
+
+ /*
+ // Make sure the interrupt IRQ is valid.
+ */
+ if ((InterruptNumber != HTDSU_PARAM_IRQ03) &&
+ (InterruptNumber != HTDSU_PARAM_IRQ04) &&
+ (InterruptNumber != HTDSU_PARAM_IRQ10) &&
+ (InterruptNumber != HTDSU_PARAM_IRQ11) &&
+ (InterruptNumber != HTDSU_PARAM_IRQ12) &&
+ (InterruptNumber != HTDSU_PARAM_IRQ15))
+ {
+ DBG_DISPLAY(("ERROR: Invalid InterruptNumber=%d)\n",InterruptNumber));
+ /*
+ // Log error message and exit.
+ */
+ NdisWriteErrorLogEntry(
+ MiniportAdapterHandle,
+ NDIS_ERROR_CODE_UNSUPPORTED_CONFIGURATION,
+ 3,
+ InterruptNumber,
+ __FILEID__,
+ __LINE__
+ );
+ NdisCloseConfiguration(ConfigHandle);
+ return NDIS_STATUS_FAILURE;
+ }
+
+ /********************************************************************
+ // Get RambaseAddress for this adapter.
+ */
+ NdisReadConfiguration(
+ &Status,
+ &ReturnedValue,
+ ConfigHandle,
+ &RamBaseString,
+ NdisParameterHexInteger
+ );
+
+ if (Status == NDIS_STATUS_SUCCESS)
+ {
+ RamBaseAddress = (ULONG)(ReturnedValue->ParameterData.IntegerData);
+ }
+ else
+ {
+ DBG_DISPLAY(("ERROR: NdisReadConfiguration(RamBaseAddress) failed (Status=%X)\n",Status));
+ /*
+ // Log error message and exit.
+ */
+ NdisWriteErrorLogEntry(
+ MiniportAdapterHandle,
+ NDIS_ERROR_CODE_MISSING_CONFIGURATION_PARAMETER,
+ 3,
+ Status,
+ __FILEID__,
+ __LINE__
+ );
+ NdisCloseConfiguration(ConfigHandle);
+ return NDIS_STATUS_FAILURE;
+ }
+
+ /*
+ // Make sure the RambaseAddress is valid.
+ */
+ if ((RamBaseAddress != HTDSU_PARAM_RAMBASE1) &&
+ (RamBaseAddress != HTDSU_PARAM_RAMBASE2) &&
+ (RamBaseAddress != HTDSU_PARAM_RAMBASE3) &&
+ (RamBaseAddress != HTDSU_PARAM_RAMBASE4))
+ {
+ DBG_DISPLAY(("ERROR: Invalid RamBaseAddress=%Xh\n",RamBaseAddress));
+ /*
+ // Log error message and exit.
+ */
+ NdisWriteErrorLogEntry(
+ MiniportAdapterHandle,
+ NDIS_ERROR_CODE_UNSUPPORTED_CONFIGURATION,
+ 3,
+ RamBaseAddress,
+ __FILEID__,
+ __LINE__
+ );
+ NdisCloseConfiguration(ConfigHandle);
+ return NDIS_STATUS_FAILURE;
+ }
+
+ /********************************************************************
+ // Get MediaType for this adapter.
+ // The MediaType and DeviceName values are used to construct the
+ // ProviderInfo strings required by HtTapiGetDevCaps.
+ */
+ NdisReadConfiguration(
+ &Status,
+ &ReturnedValue,
+ ConfigHandle,
+ &MediaTypeString,
+ NdisParameterString
+ );
+
+ if (Status == NDIS_STATUS_SUCCESS)
+ {
+ RtlUnicodeStringToAnsiString(
+ &MediaType,
+ &(ReturnedValue->ParameterData.StringData),
+ TRUE
+ );
+ }
+ else
+ {
+ DBG_DISPLAY(("ERROR: NdisReadConfiguration(MediaType) failed (Status=%X)\n",Status));
+ /*
+ // Log error message and exit.
+ */
+ NdisWriteErrorLogEntry(
+ MiniportAdapterHandle,
+ NDIS_ERROR_CODE_MISSING_CONFIGURATION_PARAMETER,
+ 3,
+ Status,
+ __FILEID__,
+ __LINE__
+ );
+ NdisCloseConfiguration(ConfigHandle);
+ return NDIS_STATUS_FAILURE;
+ }
+
+ /********************************************************************
+ // Get DeviceName for this adapter.
+ // The MediaType and DeviceName values are used to construct the
+ // ProviderInfo strings required by HtTapiGetDevCaps.
+ */
+ NdisReadConfiguration(
+ &Status,
+ &ReturnedValue,
+ ConfigHandle,
+ &DeviceNameString,
+ NdisParameterString
+ );
+
+ if (Status == NDIS_STATUS_SUCCESS)
+ {
+ RtlUnicodeStringToAnsiString(
+ &DeviceName,
+ &(ReturnedValue->ParameterData.StringData),
+ TRUE
+ );
+ }
+ else
+ {
+ DBG_DISPLAY(("ERROR: NdisReadConfiguration(DeviceName) failed (Status=%X)\n",Status));
+ /*
+ // Log error message and exit.
+ */
+ NdisWriteErrorLogEntry(
+ MiniportAdapterHandle,
+ NDIS_ERROR_CODE_MISSING_CONFIGURATION_PARAMETER,
+ 3,
+ Status,
+ __FILEID__,
+ __LINE__
+ );
+ NdisCloseConfiguration(ConfigHandle);
+ return NDIS_STATUS_FAILURE;
+ }
+
+ /********************************************************************
+ // Get AddressList for this adapter.
+ */
+ NdisReadConfiguration(
+ &Status,
+ &ReturnedValue,
+ ConfigHandle,
+ &AddressListString,
+ NdisParameterString
+ );
+
+ if (Status == NDIS_STATUS_SUCCESS)
+ {
+ RtlUnicodeStringToAnsiString(
+ &AddressList,
+ &(ReturnedValue->ParameterData.StringData),
+ TRUE
+ );
+ }
+ else
+ {
+ DBG_DISPLAY(("ERROR: NdisReadConfiguration(AddressList) failed (Status=%X)\n",Status));
+ /*
+ // Log error message and exit.
+ */
+ NdisWriteErrorLogEntry(
+ MiniportAdapterHandle,
+ NDIS_ERROR_CODE_MISSING_CONFIGURATION_PARAMETER,
+ 3,
+ Status,
+ __FILEID__,
+ __LINE__
+ );
+ NdisCloseConfiguration(ConfigHandle);
+ return NDIS_STATUS_FAILURE;
+ }
+
+#ifdef USE_LEASED_LINE
+ /********************************************************************
+ // Get LineType for this adapter.
+ */
+ NdisReadConfiguration(
+ &Status,
+ &ReturnedValue,
+ ConfigHandle,
+ &LineTypeString,
+ NdisParameterInteger
+ );
+
+ if (Status == NDIS_STATUS_SUCCESS)
+ {
+ LineType = (CCHAR)(ReturnedValue->ParameterData.IntegerData);
+ }
+ else
+ {
+ DBG_DISPLAY(("ERROR: NdisReadConfiguration(LineType) failed (Status=%X)\n",Status));
+ LineType = HTDSU_LINEMODE_DIALUP;
+ }
+
+ /*
+ // Make sure the LineType is valid.
+ */
+ if ((LineType != HTDSU_LINEMODE_LEASED) &&
+ (LineType != HTDSU_LINEMODE_DIALUP))
+ {
+ DBG_DISPLAY(("ERROR: Invalid LineType=%d\n",LineType));
+ /*
+ // Log error message and exit.
+ */
+ NdisWriteErrorLogEntry(
+ MiniportAdapterHandle,
+ NDIS_ERROR_CODE_UNSUPPORTED_CONFIGURATION,
+ 3,
+ LineType,
+ __FILEID__,
+ __LINE__
+ );
+ NdisCloseConfiguration(ConfigHandle);
+ return NDIS_STATUS_FAILURE;
+ }
+#else
+ LineType = HTDSU_LINEMODE_DIALUP;
+#endif // USE_LEASED_LINE
+
+ /********************************************************************
+ // Get LineRate for this adapter.
+ */
+ NdisReadConfiguration(
+ &Status,
+ &ReturnedValue,
+ ConfigHandle,
+ &LineRateString,
+ NdisParameterInteger
+ );
+
+ if (Status == NDIS_STATUS_SUCCESS)
+ {
+ LineRate = (USHORT)(ReturnedValue->ParameterData.IntegerData);
+ }
+ else
+ {
+ DBG_DISPLAY(("ERROR: NdisReadConfiguration(LineRate) failed (Status=%X)\n",Status));
+ LineRate = 1;
+ }
+
+ /*
+ // Make sure the LineRate is valid.
+ */
+ LineRate = HTDSU_CMD_TX_RATE_MAX + (LineRate << 4);
+ if ((LineRate != HTDSU_CMD_TX_RATE_MAX) &&
+ (LineRate != HTDSU_CMD_TX_RATE_57600) &&
+ (LineRate != HTDSU_CMD_TX_RATE_38400) &&
+ (LineRate != HTDSU_CMD_TX_RATE_19200) &&
+ (LineRate != HTDSU_CMD_TX_RATE_9600))
+ {
+ DBG_DISPLAY(("ERROR: Invalid LineRate=%d\n",LineRate));
+ /*
+ // Log error message and exit.
+ */
+ NdisWriteErrorLogEntry(
+ MiniportAdapterHandle,
+ NDIS_ERROR_CODE_UNSUPPORTED_CONFIGURATION,
+ 3,
+ LineRate,
+ __FILEID__,
+ __LINE__
+ );
+ NdisCloseConfiguration(ConfigHandle);
+ return NDIS_STATUS_FAILURE;
+ }
+
+#if DBG
+ /********************************************************************
+ // Get DbgFlags for this adapter.
+ */
+ NdisReadConfiguration(
+ &Status,
+ &ReturnedValue,
+ ConfigHandle,
+ &DbgFlagsString,
+ NdisParameterHexInteger
+ );
+
+ if (Status == NDIS_STATUS_SUCCESS)
+ {
+ DbgFlags = (ULONG)(ReturnedValue->ParameterData.IntegerData);
+ }
+ else
+ {
+ DbgFlags = 0;
+ }
+#endif
+
+ /*
+ // Close the configuration registry - we're done with it.
+ */
+ NdisCloseConfiguration(ConfigHandle);
+
+ /*
+ // Allocate memory for the adapter information structure.
+ */
+ Status = NdisAllocateMemory(
+ (PVOID *)&Adapter,
+ sizeof(*Adapter),
+ 0,
+ HighestAcceptableAddress
+ );
+
+ if (Status != NDIS_STATUS_SUCCESS)
+ {
+ DBG_DISPLAY(("ERROR: NdisAllocateMemory(Size=%d) failed (Status=%X)\n",
+ sizeof(*Adapter), Status));
+ /*
+ // Log error message and exit.
+ */
+ NdisWriteErrorLogEntry(
+ MiniportAdapterHandle,
+ NDIS_ERROR_CODE_OUT_OF_RESOURCES,
+ 3,
+ Status,
+ __FILEID__,
+ __LINE__
+ );
+ return NDIS_STATUS_FAILURE;
+ }
+
+ /*
+ // Init the adapter structure values to NULL.
+ */
+ NdisZeroMemory (Adapter, sizeof(*Adapter));
+
+ /*
+ // Assign a unique ID to this adapter instance.
+ */
+ Adapter->InstanceNumber = ++HtDsuAdapterCount;
+
+ /*
+ // We use the adapter id number in debug messages to help when debugging
+ // with multiple adapters.
+ */
+#if DBG
+ Adapter->DbgID[0] = (0x0F & HtDsuAdapterCount) + '0';
+ Adapter->DbgID[1] = 0;
+ Adapter->DbgFlags = DbgFlags;
+#endif
+
+ DBG_DISPLAY(("HTDSU41(Adap=%08Xh,Ram=%05lXh,RamSiz=%04Xh,BufSiz=%04Xh,IRQ=%d)\n",
+ Adapter, RamBaseAddress, HTDSU_MEMORY_SIZE,
+ sizeof(HTDSU_BUFFER), InterruptNumber));
+
+ /*
+ // Make sure the adapter memory structure is sized properly.
+ */
+ ASSERT(sizeof(HTDSU_BUFFER) == 2016);
+ ASSERT(HTDSU_MEMORY_SIZE == 4096);
+
+ /*
+ // Save the config parameters in the adapter structure.
+ */
+ Adapter->MiniportAdapterHandle = MiniportAdapterHandle;
+ Adapter->InterruptNumber = InterruptNumber;
+ Adapter->LineType = LineType;
+ Adapter->LineRate = LineRate;
+ Adapter->MemorySize = HTDSU_MEMORY_SIZE;
+ NdisSetPhysicalAddressLow(Adapter->PhysicalAddress, RamBaseAddress);
+ NdisSetPhysicalAddressHigh(Adapter->PhysicalAddress, 0);
+
+ /*
+ // Construct the "MediaType\0DeviceName" string for use by TAPI.
+ */
+ strcpy(Adapter->ProviderInfo, MediaType.Buffer);
+ strcpy(Adapter->ProviderInfo + MediaType.Length + 1, DeviceName.Buffer);
+ DBG_NOTICE(Adapter, ("Media=%s Device=%s\n",
+ Adapter->ProviderInfo,
+ &Adapter->ProviderInfo[MediaType.Length + 1]
+ ));
+ Adapter->ProviderInfoSize = MediaType.Length + 1 + DeviceName.Length + 1;
+
+ /*
+ // Now it's time to initialize the hardware resources.
+ */
+ Status = HtDsuRegisterAdapter(Adapter, &AddressList);
+
+ if (Status != NDIS_STATUS_SUCCESS)
+ {
+ HtDsuHalt(Adapter);
+ }
+
+ DBG_DISPLAY(("RETURN: Status=%Xh\n",Status));
+
+ return Status;
+}
+
+
+NDIS_STATUS
+HtDsuRegisterAdapter(
+ IN PHTDSU_ADAPTER Adapter,
+ IN PSTRING AddressList
+ )
+
+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+Functional Description:
+
+ This function is called when a new adapter is being registered. It
+ initializes the adapter information structure, allocate any resources
+ needed by the adapter/driver, registers with the wrapper, and initializes
+ the physical adapter.
+
+Parameters:
+
+ Adapter _ A pointer ot our adapter information structure.
+
+ AddressList _ This is a list of MULTI_SZ strings which are to be assigned
+ to each link for use by TAPI HtTapiGetAddressCaps.
+
+Return Values:
+
+ NDIS_STATUS_ADAPTER_NOT_FOUND
+ NDIS_STATUS_FAILURE
+ NDIS_STATUS_NOT_ACCEPTED
+ NDIS_STATUS_OPEN_ERROR
+ NDIS_STATUS_RESOURCES
+ NDIS_STATUS_SUCCESS
+ NDIS_STATUS_UNSUPPORTED_MEDIA
+
+---------------------------------------------------------------------------*/
+
+{
+ DBG_FUNC("HtDsuRegisterAdapter")
+
+ /*
+ // Holds the status result returned from an NDIS function call.
+ */
+ NDIS_STATUS Status;
+
+ DBG_ENTER(Adapter);
+
+ /*
+ // Initialize the WAN information structure to match the capabilities of
+ // the adapter.
+ */
+ Adapter->WanInfo.MaxFrameSize = HTDSU_MAX_FRAME_SIZE;
+ Adapter->WanInfo.MaxTransmit = HTDSU_MAX_TRANSMITS;
+
+ /*
+ // Since we copy the packets to/from adapter RAM, no padding information is
+ // needed in the WAN packets we get. We can just use adapter RAM as needed.
+ */
+ Adapter->WanInfo.HeaderPadding = 0;
+ Adapter->WanInfo.TailPadding = 0;
+
+ /*
+ // This value indicates how many point to point connections are allowed
+ // per WAN link. Currently, the WAN wrapper only supports 1 line per link.
+ */
+ Adapter->WanInfo.Endpoints = 1;
+
+ /*
+ // Transmits and received are copied to/from adapter RAM so cached memory
+ // can be used for packet allocation and we don't really care if it's
+ // physically contiguous or not, as long as it's virtually contiguous.
+ */
+ Adapter->WanInfo.MemoryFlags = 0;
+ Adapter->WanInfo.HighestAcceptableAddress = HighestAcceptableAddress;
+
+ /*
+ // We only support point to point framing, and we don't need to see the
+ // address or control fields. The TAPI_PROVIDER bit is set to indicate
+ // that we can accept the TAPI OID requests.
+ */
+ Adapter->WanInfo.FramingBits = PPP_FRAMING |
+ PPP_COMPRESS_ADDRESS_CONTROL |
+ PPP_COMPRESS_PROTOCOL_FIELD |
+ TAPI_PROVIDER;
+ /*
+ // This value is ignored by this driver, but its default behavior is such
+ // that all these control bytes would appear to be handled transparently.
+ */
+ Adapter->WanInfo.DesiredACCM = 0;
+
+ /*
+ // Inform the wrapper of the physical attributes of this adapter.
+ // This must be called before any NdisMRegister functions!
+ // This call also associates the MiniportAdapterHandle with this Adapter.
+ */
+ NdisMSetAttributes(
+ Adapter->MiniportAdapterHandle,
+ (NDIS_HANDLE)Adapter,
+ FALSE, // Not a BusMaster
+ NdisInterfaceIsa
+ );
+
+ /*
+ // Map the adapter's physical location into the system address space.
+ */
+ Status = NdisMMapIoSpace(
+ &Adapter->VirtualAddress,
+ Adapter->MiniportAdapterHandle,
+ Adapter->PhysicalAddress,
+ Adapter->MemorySize
+ );
+ DBG_NOTICE(Adapter, ("NdisMMapIoSpace(\n"
+ "VirtualAddress =%Xh\n"
+ "MiniportAdapterHandle=%Xh\n"
+ "PhysicalAddress =%X:%Xh\n"
+ "MemorySize =%Xh\n",
+ Adapter->VirtualAddress,
+ Adapter->MiniportAdapterHandle,
+ Adapter->PhysicalAddress,
+ Adapter->MemorySize
+ ));
+
+ if (Status != NDIS_STATUS_SUCCESS)
+ {
+ DBG_ERROR(Adapter,("NdisMMapIoSpace failed (status=%Xh)\n",Status));
+ /*
+ // Log error message and exit.
+ */
+ NdisWriteErrorLogEntry(
+ Adapter->MiniportAdapterHandle,
+ NDIS_ERROR_CODE_OUT_OF_RESOURCES,
+ 3,
+ Status,
+ __FILEID__,
+ __LINE__
+ );
+ goto EarlyOut;
+ }
+
+ Adapter->AdapterRam = (PHTDSU_REGISTERS) Adapter->VirtualAddress;
+
+ /*
+ // This is how we protect the driver from being re-entered when
+ // it's not safe to do so. Such as on a timer thread. Normally,
+ // the wrapper provides protection from re-entrancy, so SpinLocks
+ // are not needed. However, if your adapter requires asynchronous
+ // timer support routines, you will have to provide your own
+ // synchronization.
+ */
+ NdisAllocateSpinLock(&Adapter->Lock);
+
+ /*
+ // Set both the transmit busy and transmit idle lists to empty.
+ */
+ InitializeListHead(&Adapter->TransmitIdleList);
+ InitializeListHead(&Adapter->TransmitBusyList);
+
+ /*
+ // Initialize the interrupt - it can be disabled, but cannot be shared.
+ */
+ Status = NdisMRegisterInterrupt(
+ &Adapter->Interrupt,
+ Adapter->MiniportAdapterHandle,
+ Adapter->InterruptNumber,
+ Adapter->InterruptNumber,
+ FALSE, /* We don't need a call to the ISR */
+ FALSE, /* Interrupt is not sharable */
+ NdisInterruptLatched
+ );
+
+ if (Status != NDIS_STATUS_SUCCESS)
+ {
+ DBG_ERROR(Adapter,("NdisMRegisterInterrupt failed (status=%Xh)\n",Status));
+ /*
+ // Log error message and exit.
+ */
+ NdisWriteErrorLogEntry(
+ Adapter->MiniportAdapterHandle,
+ NDIS_ERROR_CODE_INTERRUPT_CONNECT,
+ 3,
+ Status,
+ __FILEID__,
+ __LINE__
+ );
+ goto EarlyOut;
+ }
+
+ /*
+ // Try to initialize the adapter hardware.
+ */
+#if DBG
+ Status = CardInitialize(Adapter,
+ (BOOLEAN) ((Adapter->DbgFlags & DBG_HWTEST_ON) ?
+ TRUE : FALSE));
+#else
+ Status = CardInitialize(Adapter, FALSE);
+#endif
+
+ if (Status != NDIS_STATUS_SUCCESS)
+ {
+ DBG_ERROR(Adapter,("CardInitialize failed (status=%Xh)\n",Status));
+ /*
+ // Error message was already logged.
+ */
+ goto EarlyOut;
+ }
+
+ /*
+ // Initialize the adapter link structures.
+ */
+ LinkInitialize(Adapter, AddressList);
+
+#ifdef USE_LEASED_LINE
+ if (Adapter->LineType == HTDSU_LINEMODE_LEASED)
+ {
+ /*
+ // Go ahead and allocate the lines and indicate them as up so we can
+ // work with leased line mode.
+ */
+ PHTDSU_LINK Link;
+
+ if (CardStatusOnLine(Adapter, HTDSU_CMD_LINE1))
+ {
+ Link = LinkAllocate(Adapter, NULL, HTDSU_LINE1_ID);
+ LinkLineUp(Link);
+ }
+ if ((Adapter->NumLineDevs == HTDSU_NUM_LINKS) &&
+ CardStatusOnLine(Adapter, HTDSU_CMD_LINE2))
+ {
+ Link = LinkAllocate(Adapter, NULL, HTDSU_LINE2_ID);
+ LinkLineUp(Link);
+ }
+ }
+#endif // USE_LEASED_LINE
+
+EarlyOut:
+
+ DBG_LEAVE(Adapter);
+
+ return Status;
+}
+
+
+VOID
+HtDsuHalt(
+ IN PHTDSU_ADAPTER Adapter
+ )
+
+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+Functional Description:
+
+ The MiniportHalt request is used to halt the adapter such that it is
+ no longer functioning. The Miniport driver should stop the adapter
+ and deregister all of its resources before returning from this routine.
+
+ It is not necessary for the Miniport to complete all outstanding
+ requests and no other requests will be submitted to the Miniport
+ until the operation is completed.
+
+ Interrupts are enabled during the call to this routine.
+
+Parameters:
+
+ MiniportAdapterContext _ The adapter handle passed to NdisMSetAttributes
+ during MiniportInitialize.
+
+Return Values:
+
+ None.
+
+---------------------------------------------------------------------------*/
+
+{
+ DBG_FUNC("HtDsuHalt")
+
+ /*
+ // We use this message to make sure TAPI is cleaned up.
+ */
+ NDIS_TAPI_PROVIDER_SHUTDOWN TapiShutDown;
+
+ DBG_ENTER(Adapter);
+
+ /*
+ // Make sure all the lines are hungup and indicated.
+ // This should already be the case, but let's be sure.
+ */
+ TapiShutDown.ulRequestID = OID_TAPI_PROVIDER_SHUTDOWN;
+ HtTapiProviderShutdown(Adapter, &TapiShutDown);
+
+ /*
+ // Disconnect the interrupt line.
+ */
+ if (*(PULONG)&(Adapter->Interrupt))
+ {
+ NdisMDeregisterInterrupt(&Adapter->Interrupt);
+ }
+
+ /*
+ // Unmap the adapter memory from the system.
+ */
+ if (Adapter->VirtualAddress != NULL)
+ {
+ NdisMUnmapIoSpace(
+ Adapter->MiniportAdapterHandle,
+ Adapter->VirtualAddress,
+ Adapter->MemorySize
+ );
+ }
+
+ /*
+ // Free the lock we aquired at startup.
+ */
+ if (*(PULONG)&(Adapter->Lock))
+ {
+ // FIXME - the latest version of NDIS does not define NdisFreeSpinLock
+ // NdisFreeSpinLock(&Adapter->Lock);
+ }
+
+ DBG_LEAVE(Adapter);
+
+ /*
+ // Free adapter instance.
+ */
+ --HtDsuAdapterCount;
+ NdisFreeMemory(Adapter, sizeof(*Adapter), 0);
+}
+
+#ifdef RECONFIGURE_SUPPORTED
+
+
+NDIS_STATUS
+HtDsuReconfigure(
+ OUT PNDIS_STATUS OpenErrorStatus,
+ IN PHTDSU_ADAPTER Adapter,
+ IN NDIS_HANDLE WrapperConfigurationContext
+ )
+
+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+Functional Description:
+
+ This routine is called to have the Miniport reconfigure the adapter
+ to the new parameters available via the NDIS configuration routines.
+ Used to support plug and play adapters and software configurable
+ adapters, which may have the parameters changed during runtime. If
+ the Miniport driver does not support dynamic reconfiguration, then
+ the entry for W_RECONFIGURE_HANDLER in the NDIS_WIDGET_CHARACTERISTICS
+ should be NULL.
+
+ No other request will be outstanding on the Miniport when this routine
+ is called. No other request will be submitted to the Miniport until
+ the operation is completed.
+
+ The status value NDIS_STATUS_OPEN_ERROR has a special meaning. It
+ indicates that the OpenErrorStatus parameter has returned a valid
+ status which the wrapper can examine to obtain more information about
+ the error.
+
+ This routine is called with interrupts enabled, and a call to MiniportISR
+ will occur if the adapter generates any interrupts. As long as this
+ routine is executing MiniportDisableInterrupt and MiniportEnableInterrupt
+ will not be called, so it is the responsibility of the Miniport driver
+ to acknowledge and clear any interrupts generated.
+
+Parameters:
+
+ OpenErrorStatus _ Returns more information about the reason for the
+ failure. Currently, the only values defined match
+ those specified as Open Error Codes in Appendix B
+ of the IBM Local Area Network Technical Reference.
+
+ MiniportAdapterContext _ The adapter handle passed to NdisMSetAttributes
+ during MiniportInitialize.
+
+ WrapperConfigurationContext _ The handle to use for calls to
+ NdisOpenConfiguration, and the routines
+ in section 4 of this document.
+
+Return Values:
+
+ NDIS_STATUS_FAILURE
+ NDIS_STATUS_NOT_ACCEPTED
+ NDIS_STATUS_SUCCESS
+
+---------------------------------------------------------------------------*/
+
+{
+ return (NDIS_STATUS_NOT_ACCEPTED);
+}
+
+#endif // RECONFIGURE_SUPPORTED
+
+
+NDIS_STATUS
+HtDsuReset(
+ OUT PBOOLEAN AddressingReset,
+ IN PHTDSU_ADAPTER Adapter
+ )
+
+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+Functional Description:
+
+ The MiniportReset request instructs the Miniport driver to issue a
+ hardware reset to the network adapter. The Miniport driver also
+ resets its software state.
+
+ The MiniportReset request may also reset the parameters of the adapter.
+ If a hardware reset of the adapter resets the current station address
+ to a value other than what it is currently configured to, the Miniport
+ driver automatically restores the current station address following the
+ reset. Any multicast or functional addressing masks reset by the
+ hardware do not have to be reprogrammed by the Miniport.
+ NOTE: This is change from the NDIS 3.0 driver specification. If the
+ multicast or functional addressing information, the packet filter, the
+ lookahead size, and so on, needs to be restored, the Miniport indicates
+ this with setting the flag AddressingReset to TRUE.
+
+ It is not necessary for the Miniport to complete all outstanding requests
+ and no other requests will be submitted to the Miniport until the
+ operation is completed. Also, the Miniport does not have to signal
+ the beginning and ending of the reset with NdisMIndicateStatus.
+ NOTE: These are different than the NDIS 3.0 driver specification.
+
+ The Miniport driver must complete the original request, if the orginal
+ call to MiniportReset return NDIS_STATUS_PENDING, by calling
+ NdisMResetComplete.
+
+ If the underlying hardware does not provide a reset function under
+ software control, then this request completes abnormally with
+ NDIS_STATUS_NOT_RESETTABLE. If the underlying hardware attempts a
+ reset and finds recoverable errors, the request completes successfully
+ with NDIS_STATUS_SOFT_ERRORS. If the underlying hardware resets and,
+ in the process, finds nonrecoverable errors, the request completes
+ successfully with the status NDIS_STATUS_HARD_ERRORS. If the
+ underlying hardware reset is accomplished without any errors,
+ the request completes successfully with the status NDIS_STATUS_SUCCESS.
+
+ Interrupts are in any state during this call.
+
+Parameters:
+
+ MiniportAdapterContext _ The adapter handle passed to NdisMSetAttributes
+ during MiniportInitialize.
+
+ AddressingReset _ The Miniport indicates if the wrapper needs to call
+ MiniportSetInformation to restore the addressing
+ information to the current values by setting this
+ value to TRUE.
+
+Return Values:
+
+ NDIS_STATUS_HARD_ERRORS
+ NDIS_STATUS_NOT_ACCEPTED
+ NDIS_STATUS_NOT_RESETTABLE
+ NDIS_STATUS_PENDING
+ NDIS_STATUS_SOFT_ERRORS
+ NDIS_STATUS_SUCCESS
+
+---------------------------------------------------------------------------*/
+
+{
+ DBG_FUNC("HtDsuReset")
+
+ /*
+ // Holds the status result returned from an NDIS function call.
+ */
+ NDIS_STATUS Status;
+
+ DBG_ENTER(Adapter);
+ DBG_BREAK(Adapter);
+
+ if (Adapter->NeedReset)
+ {
+ NdisAcquireSpinLock(&Adapter->Lock);
+
+ /*
+ // Make sure TAPI is aware of the state change so it can do the
+ // right things.
+ */
+ HtTapiResetHandler(Adapter);
+
+ /*
+ // Attempt to issue a software reset on the adapter.
+ // It will only fail if the hardware is hung forever.
+ */
+ Adapter->NeedReset = FALSE;
+ Status = CardInitialize(Adapter, FALSE);
+
+ /*
+ // If anything gose wrong here, it's very likely an unrecoverable
+ // hardware failure. So we'll just shut this thing down for good.
+ */
+ if (Status != NDIS_STATUS_SUCCESS)
+ {
+ DBG_ERROR(Adapter,("RESET Failed\n"));
+ Status = NDIS_STATUS_HARD_ERRORS;
+ }
+ else
+ {
+ /*
+ // If there were lines open, we must reset them back to
+ // LINECALLSTATE_IDLE, and configure them for use.
+ */
+ if (Adapter->NumOpens)
+ {
+ if (Adapter->NumOpens == 1)
+ {
+ CardLineConfig(Adapter, HTDSU_CMD_LINE1);
+ HtTapiCallStateHandler(Adapter,
+ GET_LINK_FROM_LINKINDEX(Adapter, 0),
+ LINECALLSTATE_IDLE,
+ 0);
+ Adapter->InterruptEnableFlag |= HTDSU_INTR_ALL_LINE1;
+ }
+ if (Adapter->NumOpens == 2)
+ {
+ CardLineConfig(Adapter, HTDSU_CMD_LINE2);
+ HtTapiCallStateHandler(Adapter,
+ GET_LINK_FROM_LINKINDEX(Adapter, 1),
+ LINECALLSTATE_IDLE,
+ 0);
+ Adapter->InterruptEnableFlag |= HTDSU_INTR_ALL_LINE2;
+ }
+ CardEnableInterrupt(Adapter);
+ }
+
+ DBG_WARNING(Adapter,("RESET Complete\n"));
+ *AddressingReset = TRUE;
+ }
+
+ NdisReleaseSpinLock(&Adapter->Lock);
+ }
+ else
+ {
+ DBG_WARNING(Adapter, ("RESET Not Needed\n"));
+ }
+
+ DBG_LEAVE(Adapter);
+
+ return (Status);
+}
diff --git a/private/ntos/ndis/htdsu/htdsu.h b/private/ntos/ndis/htdsu/htdsu.h
new file mode 100644
index 000000000..d0fa6f175
--- /dev/null
+++ b/private/ntos/ndis/htdsu/htdsu.h
@@ -0,0 +1,931 @@
+/***************************************************************************\
+|* Copyright (c) 1994 Microsoft Corporation *|
+|* Developed for Microsoft by TriplePoint, Inc. Beaverton, Oregon *|
+|* *|
+|* This file is part of the HT Communications DSU41 WAN Miniport Driver. *|
+\***************************************************************************/
+
+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+Module Name:
+
+ htdsu.h
+
+Abstract:
+
+ This module defines the software structures and values used to support
+ the NDIS Minport driver on the HT DSU41 controller. It's a good place
+ to look when your trying to figure out how the driver structures are
+ related to each other.
+
+ This driver conforms to the NDIS 3.0 Miniport interface.
+
+Author:
+
+ Larry Hattery - TriplePoint, Inc. (larryh@tpi.com) Jun-94
+
+Environment:
+
+ Include this file at the top of each module in the Miniport driver.
+
+Revision History:
+
+---------------------------------------------------------------------------*/
+
+#ifndef _HTDSU_H
+#define _HTDSU_H
+
+/*
+// NDIS_MINIPORT_DRIVER must be defined before the NDIS include files.
+// Normally, it is defined on the command line by setting the C_DEFINES
+// variable in the sources build file.
+*/
+#include <ndis.h>
+#include <ndiswan.h>
+#include <pshpack1.h> // Force packing on variable length structures
+# include <ndistapi.h>
+#include <poppack.h>
+#include <string.h>
+
+/*
+// Include everything here so the driver modules can just include this
+// file and get all they need.
+*/
+#include "debug.h"
+#include "card.h"
+#include "keywords.h"
+
+/*
+// This constant is the maximum NdisStallExecution time allowed to be used
+// in an NDIS driver. If you need longer delays, you must wrap the call
+// in a loop.
+*/
+#define _100_MICROSECONDS 100
+
+/*
+// The link speeds we support.
+*/
+#define _64KBPS 64000
+#define _56KBPS 57600
+
+/*
+// How many logical links does this driver support. Actually, this driver
+// defines logical links to be 1:1 with physical links. You are free to
+// model them however is appropriate for your adapter.
+*/
+#define HTDSU_NUM_LINKS 2
+
+/*
+// In this driver, there is only one TAPI line device per link structure.
+*/
+#define HTDSU_TAPI_NUM_LINES HTDSU_NUM_LINKS
+
+/*
+// There is only one TAPI address ID per line device (zero based).
+*/
+#define HTDSU_TAPI_NUM_ADDRESSES 1
+#define HTDSU_TAPI_ADDRESSID 0
+
+/*
+// There is only one TAPI call per address/line instance.
+*/
+#define HTDSU_TAPI_NUM_CALLS 1
+
+/*
+// This version number is used by the NDIS_TAPI_NEGOTIATE_EXT_VERSION request.
+// It is not used by this driver or the current NDISTAPI release.
+*/
+#define HTDSU_TAPI_EXT_VERSION 0x00010000
+
+/*
+// The line mode can be leased or dial-up. In leased mode we can present the
+// WAN wrapper with a LINE_UP indication so it can use the connection without
+// the TAPI interface. In dialup mode, we need to present a TAPI service
+// provider interface so RAS or something else can select the phone number.
+// Currently, this driver only supports a single line adapter, but it has
+// been written to allow the addition of a second line if the adapter becomes
+// available.
+*/
+typedef enum _HTDSU_LINE_MODE
+{
+ HTDSU_LINEMODE_DIALUP,
+ HTDSU_LINEMODE_LEASED
+
+} HTDSU_LINE_MODE;
+
+/*
+// This structure contains all the link information maintained by the
+// Miniport driver. It encompasses both the TAPI and WAN connections.
+*/
+typedef struct _HTDSU_LINK
+{
+ /* 000
+ // Pointer back to the Adapter data structure so we can get at it
+ // when passed a pointer to this structure in NdisMWanSend().
+ */
+ struct _HTDSU_ADAPTER *Adapter;
+
+ /* 004
+ // This is used to select which card channel the link is associated with.
+ */
+ USHORT CardLine;
+
+ /* 006
+ // This is a zero based index used to assign TAPI device ID to the
+ // link based on TAPI DeviceIdBase assigned to this driver.
+ */
+ USHORT LinkIndex;
+
+ /* 008
+ // Remember what mode the line was set to.
+ */
+ HTDSU_LINE_MODE LineMode;
+
+ /* 00C
+ // The WAN wrapper supplied handle to be used on Miniport calls
+ // such as NdisMWanIndicateReceive().
+ */
+ NDIS_HANDLE NdisLinkContext;
+
+ /* 010
+ // The Connection wrapper supplied handle for use when indicating
+ // TAPI LINE_EVENT's.
+ */
+ HTAPI_LINE htLine;
+
+ /* 014
+ // The Connection wrapper supplied handle for use when indicating
+ // TAPI LINECALLSTATE events.
+ */
+ HTAPI_CALL htCall;
+
+ /* 018
+ // The current TAPI LINEDEVSTATE of the associated with the link.
+ */
+ ULONG DevState; // Current state
+ ULONG DevStatesCaps; // Events currently supported
+ ULONG DevStatesMask; // Events currently enabled
+
+ /* 024
+ // The current TAPI LINEADDRESSSTATE of the associated with the link.
+ */
+ ULONG AddressState; // Current state
+ ULONG AddressStatesCaps; // Events currently supported
+ ULONG AddressStatesMask; // Events currently enabled
+
+ /* 030
+ // The current TAPI LINECALLSTATE of the associated with the link.
+ */
+ ULONG CallState; // Current state
+ ULONG CallStatesCaps; // Events currently supported
+ ULONG CallStatesMask; // Events currently enabled
+
+ /* 03C
+ // The current TAPI media mode(s) supported by the card.
+ */
+ ULONG MediaMode; // Current state
+ ULONG MediaModesCaps; // Events currently supported
+ ULONG MediaModesMask; // Events currently enabled
+
+ /* 048
+ // TAPI line address is assigned during installation and saved in the
+ // registry. It is read from the registry and saved here at init time.
+ */
+ CHAR LineAddress[0x14];
+
+ /* 05C
+ // The speed provided by the link in bits per second. This value is
+ // passed up by the Miniport during the LINE_UP indication.
+ */
+ ULONG LinkSpeed;
+
+ /* 060
+ // The quality of service provided by the link. This value is passed
+ // up by the Miniport during the LINE_UP indication.
+ */
+ NDIS_WAN_QUALITY Quality;
+
+ /* 064
+ // The number of rings detected in the current ring sequence.
+ */
+ USHORT RingCount;
+
+ /* 066
+ // The number of packets that should be sent before pausing to wait
+ // for an acknowledgement. This value is passed up by the Miniport
+ // during the LINE_UP indication.
+ */
+ USHORT SendWindow;
+
+ /* 068
+ // The number of packets currently queued for transmission on this link.
+ */
+ ULONG NumTxQueued;
+
+ /* 06C
+ // Set TRUE if link is being closed.
+ */
+ BOOLEAN Closing;
+
+ /* 06D
+ // Set TRUE if call is being closed.
+ */
+ BOOLEAN CallClosing;
+
+ /* 070
+ // The current settings associated with this link as passed in via
+ // the OID_WAN_SET_LINK_INFO request.
+ */
+ NDIS_WAN_SET_LINK_INFO WanLinkInfo;
+
+ /*
+ // This timer is used to keep track of the call state when a call is
+ // coming in or going out.
+ */
+ NDIS_MINIPORT_TIMER CallTimer;
+
+} HTDSU_LINK, *PHTDSU_LINK;
+
+/*
+// Use this macro to determine if a link structure pointer is really valid.
+*/
+#define IS_VALID_LINK(Adapter, Link) \
+ (Link && Link->Adapter == Adapter)
+
+/*
+// Use this macro to get a pointer to a link structure from a CardLine ID.
+*/
+#define GET_LINK_FROM_CARDLINE(Adapter, CardLine) \
+ &(Adapter->WanLinkArray[CardLine-HTDSU_CMD_LINE1])
+
+/*
+// Use this macro to get a pointer to a link structure from a LinkIndex.
+*/
+#define GET_LINK_FROM_LINKINDEX(Adapter, LinkIndex) \
+ &(Adapter->WanLinkArray[LinkIndex])
+
+/*
+// Use this macro to get a pointer to a link structure from a TAPI DeviceID.
+*/
+#define GET_LINK_FROM_DEVICEID(Adapter, ulDeviceID) \
+ &(Adapter->WanLinkArray[ulDeviceID - Adapter->DeviceIdBase]); \
+ ASSERT(ulDeviceID >= Adapter->DeviceIdBase); \
+ ASSERT(ulDeviceID < Adapter->DeviceIdBase+Adapter->NumLineDevs)
+
+#define GET_DEVICEID_FROM_LINK(Adapter, Link) \
+ (Link->LinkIndex + Adapter->DeviceIdBase)
+
+/*
+// Use this macro to get a pointer to a link structure from a TAPI line handle.
+*/
+#define GET_LINK_FROM_HDLINE(Adapter, hdLine) \
+ (PHTDSU_LINK) \
+ (((PHTDSU_LINK) (hdLine) == &(Adapter->WanLinkArray[0])) ? (hdLine) : \
+ ((PHTDSU_LINK) (hdLine) == &(Adapter->WanLinkArray[1])) ? (hdLine) : 0)
+
+/*
+// Use this macro to get a pointer to a link structure from a TAPI call handle.
+*/
+#define GET_LINK_FROM_HDCALL(Adapter, hdCall) \
+ (PHTDSU_LINK) \
+ (((PHTDSU_LINK) (hdCall) == &(Adapter->WanLinkArray[0])) ? (hdCall) : \
+ ((PHTDSU_LINK) (hdCall) == &(Adapter->WanLinkArray[1])) ? (hdCall) : 0)
+
+/*
+// This structure contains all the information about a single adapter
+// instance this Miniport driver is controlling.
+*/
+typedef struct _HTDSU_ADAPTER
+{
+#if DBG
+ /* 000
+ // Debug flags control how much debug is displayed in the checked version.
+ */
+ ULONG DbgFlags;
+ UCHAR DbgID[4];
+#endif
+
+ /* 008
+ // This is the handle given by the wrapper for calling ndis
+ // functions.
+ */
+ NDIS_HANDLE MiniportAdapterHandle;
+
+ /* 00C
+ // Spinlock to protect fields in this structure..
+ */
+ NDIS_SPIN_LOCK Lock;
+
+ /* 014
+ // Lets us know when a transmit is in progress.
+ */
+ BOOLEAN TransmitInProgress;
+
+ /* 018
+ // Packets waiting to be sent when the controller is available.
+ */
+ LIST_ENTRY TransmitIdleList;
+
+ /* 020
+ // Packets currently submitted to the controller waiting for completion.
+ */
+ LIST_ENTRY TransmitBusyList;
+
+ /* 028
+ // Physical address where adapter memory is jumpered to.
+ */
+ NDIS_PHYSICAL_ADDRESS PhysicalAddress;
+
+ /* 030
+ // System address where the adapter memory is mapped to.
+ */
+ PVOID VirtualAddress;
+
+ /* 034
+ // Overlay the adapter memory structure on the virtual address
+ // where we've mapped it into system I/O (memory) space.
+ */
+ PHTDSU_REGISTERS AdapterRam;
+
+ /* 038
+ // How much memory is on the adapter.
+ */
+ USHORT MemorySize;
+
+ /* 03A
+ // Currently enabled interrupts
+ */
+ USHORT InterruptEnableFlag;
+
+ /* 03C
+ // Currently pending interrupts
+ */
+ USHORT InterruptStatusFlag;
+
+ /* 03E
+ // Interrupt number this adapter is using.
+ */
+ CHAR InterruptNumber;
+
+ /* 03F
+ // A unique instance number to be used to generate a unique
+ // WAN permanent address (not really permanent, but it's unique).
+ */
+ CHAR InstanceNumber;
+
+ /* 040
+ // Set TRUE if something goes terribly wrong with the hardware.
+ */
+ BOOLEAN NeedReset;
+
+ /* 041
+ // Set TRUE when the DPC is entered, and reset to FALSE when it leaves.
+ */
+ BOOLEAN InTheDpcHandler;
+
+ /* 042
+ // Specifies whether line is to be treated as a leased WAN line
+ // or a dialup TAPI line.
+ */
+ USHORT LineType;
+
+ /* 044
+ // The DSU41 has only one line, DSU42 has two.
+ */
+ UINT NumLineDevs;
+
+ /* 048
+ // The ulDeviceIDBase field passed in the PROVIDER_INIT request informs a miniport of the zero-based
+ // starting index that the Connection Wrapper will use when referring to a single adapter’s line devices by
+ // index. For example, if a ulDeviceIDBase of two is specified and the adapter supports three line devices,
+ // then the Connection Wrapper will use the identifiers two, three, and four to refer to the adapter’s three
+ // devices.
+ */
+ ULONG DeviceIdBase;
+
+ /* 04C
+ // The number of line open calls currently on this adapter.
+ */
+ UINT NumOpens;
+
+ /* 050
+ // NDIS interrupt control structure.
+ */
+ NDIS_MINIPORT_INTERRUPT Interrupt;
+
+ /*
+ // Specifies whether what speed the line is to be configured to.
+ */
+ USHORT LineRate;
+
+ /*
+ // WAN info structure.
+ */
+ NDIS_WAN_INFO WanInfo;
+
+ /*
+ // This holds the TAPI ProviderInfo string returned from HtTapiGetDevCaps
+ // This is two null terminated strings packed end to end.
+ */
+ CHAR ProviderInfo[48]; // This size is the max allowed by RAS
+ USHORT ProviderInfoSize; // Size in bytes of both strings.
+
+ /*
+ // WAN/TAPI link managment object for each connection we support.
+ */
+ HTDSU_LINK WanLinkArray[HTDSU_NUM_LINKS];
+
+ /*
+ // This contains the name of our TAPI configuration DLL which is read
+ // from the registry during initialization. The name of the DLL and
+ // its path will be saved in the registry during installation.
+ */
+ CHAR ConfigDLLName[128];
+
+} HTDSU_ADAPTER, * PHTDSU_ADAPTER;
+
+
+/***************************************************************************
+// These routines are defined in htdsu.c
+*/
+NTSTATUS
+DriverEntry(
+ IN PDRIVER_OBJECT DriverObject,
+ IN PUNICODE_STRING RegistryPath
+ );
+
+NDIS_STATUS
+HtDsuInitialize(
+ OUT PNDIS_STATUS OpenErrorStatus,
+ OUT PUINT SelectedMediumIndex,
+ IN PNDIS_MEDIUM MediumArray,
+ IN UINT MediumArraySize,
+ IN NDIS_HANDLE MiniportAdapterHandle,
+ IN NDIS_HANDLE WrapperConfigurationContext
+ );
+
+NDIS_STATUS
+HtDsuRegisterAdapter(
+ IN PHTDSU_ADAPTER Adapter,
+ IN PSTRING AddressList
+ );
+
+VOID
+HtDsuHalt(
+ IN PHTDSU_ADAPTER Adapter
+ );
+
+NDIS_STATUS
+HtDsuReconfigure(
+ OUT PNDIS_STATUS OpenErrorStatus,
+ IN PHTDSU_ADAPTER Adapter,
+ IN NDIS_HANDLE WrapperConfigurationContext
+ );
+
+NDIS_STATUS
+HtDsuReset(
+ OUT PBOOLEAN AddressingReset,
+ IN PHTDSU_ADAPTER Adapter
+ );
+
+/***************************************************************************
+// These routines are defined in interrup.c
+*/
+extern BOOLEAN
+HtDsuCheckForHang(
+ IN PHTDSU_ADAPTER Adapter
+ );
+
+extern VOID
+HtDsuDisableInterrupt(
+ IN PHTDSU_ADAPTER Adapter
+ );
+
+extern VOID
+HtDsuEnableInterrupt(
+ IN PHTDSU_ADAPTER Adapter
+ );
+
+extern VOID
+HtDsuISR(
+ OUT PBOOLEAN InterruptRecognized,
+ OUT PBOOLEAN QueueMiniportHandleInterrupt,
+ IN PHTDSU_ADAPTER Adapter
+ );
+
+VOID
+HtDsuHandleInterrupt(
+ IN PHTDSU_ADAPTER Adapter
+ );
+
+VOID
+HtDsuPollAdapter(
+ IN PVOID SystemSpecific1,
+ IN PHTDSU_ADAPTER Adapter,
+ IN PVOID SystemSpecific2,
+ IN PVOID SystemSpecific3
+ );
+
+/***************************************************************************
+// These routines are defined in receive.c
+*/
+VOID
+HtDsuReceivePacket(
+ IN PHTDSU_ADAPTER Adapter
+ );
+
+/***************************************************************************
+// These routines are defined in request.c
+*/
+NDIS_STATUS
+HtDsuQueryInformation(
+ IN PHTDSU_ADAPTER Adapter,
+ IN NDIS_OID Oid,
+ IN PVOID InformationBuffer,
+ IN ULONG InformationBufferLength,
+ OUT PULONG BytesWritten,
+ OUT PULONG BytesNeeded
+ );
+
+NDIS_STATUS
+HtDsuSetInformation(
+ IN PHTDSU_ADAPTER Adapter,
+ IN NDIS_OID Oid,
+ IN PVOID InformationBuffer,
+ IN ULONG InformationBufferLength,
+ OUT PULONG BytesRead,
+ OUT PULONG BytesNeeded
+ );
+
+/***************************************************************************
+// These routines are defined in send.c
+*/
+NDIS_STATUS
+HtDsuWanSend(
+ IN NDIS_HANDLE MacBindingHandle,
+ IN PHTDSU_LINK Link,
+ IN PNDIS_WAN_PACKET Packet
+ );
+
+VOID
+HtDsuTransmitComplete(
+ IN PHTDSU_ADAPTER Adapter
+ );
+
+/***************************************************************************
+// These routines are defined in card.c
+*/
+NDIS_STATUS
+CardIdentify(
+ IN PHTDSU_ADAPTER Adapter
+ );
+
+NDIS_STATUS
+CardDoCommand(
+ IN PHTDSU_ADAPTER Adapter,
+ IN USHORT CardLine,
+ IN USHORT CommandValue
+ );
+
+NDIS_STATUS
+CardInitialize(
+ IN PHTDSU_ADAPTER Adapter,
+ IN BOOLEAN PerformSelfTest
+ );
+
+VOID
+CardLineConfig(
+ IN PHTDSU_ADAPTER Adapter,
+ IN USHORT CardLine
+ );
+
+VOID
+CardLineDisconnect(
+ IN PHTDSU_ADAPTER Adapter,
+ IN USHORT CardLine
+ );
+
+VOID
+CardPrepareTransmit(
+ IN PHTDSU_ADAPTER Adapter,
+ IN USHORT CardLine,
+ IN USHORT Length
+ );
+
+VOID
+CardGetReceiveInfo(
+ IN PHTDSU_ADAPTER Adapter,
+ OUT PUSHORT CardLine,
+ OUT PUSHORT BytesReceived,
+ OUT PUSHORT Status
+ );
+
+VOID
+CardDialNumber(
+ IN PHTDSU_ADAPTER Adapter,
+ IN USHORT CardLine,
+ IN PUCHAR DialString,
+ IN ULONG DialStringLength
+ );
+
+/***************************************************************************
+// These routines are defined in link.c
+*/
+VOID
+LinkInitialize(
+ IN PHTDSU_ADAPTER Adapter,
+ IN PSTRING AddressList
+ );
+
+PHTDSU_LINK
+LinkAllocate(
+ IN PHTDSU_ADAPTER Adapter,
+ IN HTAPI_LINE htLine,
+ IN USHORT LinkIndex
+ );
+
+VOID
+LinkRelease(
+ IN PHTDSU_LINK Link
+ );
+
+VOID
+LinkLineUp(
+ IN PHTDSU_LINK Link
+ );
+
+VOID
+LinkLineDown(
+ IN PHTDSU_LINK Link
+ );
+
+VOID
+LinkLineError(
+ IN PHTDSU_LINK Link,
+ IN ULONG Errors
+ );
+
+/***************************************************************************
+// These routines are defined in tapi.c
+*/
+NDIS_STATUS
+HtTapiQueryInformation(
+ IN PHTDSU_ADAPTER Adapter,
+ IN NDIS_OID Oid,
+ IN PVOID InformationBuffer,
+ IN ULONG InformationBufferLength,
+ OUT PULONG BytesWritten,
+ OUT PULONG BytesNeeded
+ );
+
+NDIS_STATUS
+HtTapiSetInformation(
+ IN PHTDSU_ADAPTER Adapter,
+ IN NDIS_OID Oid,
+ IN PVOID InformationBuffer,
+ IN ULONG InformationBufferLength,
+ OUT PULONG BytesRead,
+ OUT PULONG BytesNeeded
+ );
+
+NDIS_STATUS
+HtTapiConfigDialog(
+ IN PHTDSU_ADAPTER Adapter,
+ IN PNDIS_TAPI_CONFIG_DIALOG Request
+ );
+
+NDIS_STATUS
+HtTapiDevSpecific(
+ IN PHTDSU_ADAPTER Adapter,
+ IN PNDIS_TAPI_DEV_SPECIFIC Request
+ );
+
+NDIS_STATUS
+HtTapiGetAddressCaps(
+ IN PHTDSU_ADAPTER Adapter,
+ IN PNDIS_TAPI_GET_ADDRESS_CAPS Request
+ );
+
+NDIS_STATUS
+HtTapiGetAddressID(
+ IN PHTDSU_ADAPTER Adapter,
+ IN PNDIS_TAPI_GET_ADDRESS_ID Request
+ );
+
+NDIS_STATUS
+HtTapiGetAddressStatus(
+ IN PHTDSU_ADAPTER Adapter,
+ IN PNDIS_TAPI_GET_ADDRESS_STATUS Request
+ );
+
+NDIS_STATUS
+HtTapiGetCallAddressID(
+ IN PHTDSU_ADAPTER Adapter,
+ IN PNDIS_TAPI_GET_CALL_ADDRESS_ID Request
+ );
+
+NDIS_STATUS
+HtTapiGetCallInfo(
+ IN PHTDSU_ADAPTER Adapter,
+ IN PNDIS_TAPI_GET_CALL_INFO Request
+ );
+
+NDIS_STATUS
+HtTapiGetCallStatus(
+ IN PHTDSU_ADAPTER Adapter,
+ IN PNDIS_TAPI_GET_CALL_STATUS Request
+ );
+
+NDIS_STATUS
+HtTapiGetDevCaps(
+ IN PHTDSU_ADAPTER Adapter,
+ IN PNDIS_TAPI_GET_DEV_CAPS Request
+ );
+
+NDIS_STATUS
+HtTapiGetDevConfig(
+ IN PHTDSU_ADAPTER Adapter,
+ IN PNDIS_TAPI_GET_DEV_CONFIG Request
+ );
+
+NDIS_STATUS
+HtTapiGetExtensionID(
+ IN PHTDSU_ADAPTER Adapter,
+ IN PNDIS_TAPI_GET_EXTENSION_ID Request
+ );
+
+NDIS_STATUS
+HtTapiGetID(
+ IN PHTDSU_ADAPTER Adapter,
+ IN PNDIS_TAPI_GET_ID Request
+ );
+
+NDIS_STATUS
+HtTapiGetLineDevStatus(
+ IN PHTDSU_ADAPTER Adapter,
+ IN PNDIS_TAPI_GET_LINE_DEV_STATUS Request
+ );
+
+NDIS_STATUS
+HtTapiMakeCall(
+ IN PHTDSU_ADAPTER Adapter,
+ IN PNDIS_TAPI_MAKE_CALL Request
+ );
+
+NDIS_STATUS
+HtTapiNegotiateExtVersion(
+ IN PHTDSU_ADAPTER Adapter,
+ IN PNDIS_TAPI_NEGOTIATE_EXT_VERSION Request
+ );
+
+NDIS_STATUS
+HtTapiOpen(
+ IN PHTDSU_ADAPTER Adapter,
+ IN PNDIS_TAPI_OPEN Request
+ );
+
+NDIS_STATUS
+HtTapiProviderInitialize(
+ IN PHTDSU_ADAPTER Adapter,
+ IN PNDIS_TAPI_PROVIDER_INITIALIZE Request
+ );
+
+NDIS_STATUS
+HtTapiAccept(
+ IN PHTDSU_ADAPTER Adapter,
+ IN PNDIS_TAPI_ACCEPT Request
+ );
+
+NDIS_STATUS
+HtTapiAnswer(
+ IN PHTDSU_ADAPTER Adapter,
+ IN PNDIS_TAPI_ANSWER Request
+ );
+
+NDIS_STATUS
+HtTapiClose(
+ IN PHTDSU_ADAPTER Adapter,
+ IN PNDIS_TAPI_CLOSE Request
+ );
+
+NDIS_STATUS
+HtTapiCloseCall(
+ IN PHTDSU_ADAPTER Adapter,
+ IN PNDIS_TAPI_CLOSE_CALL Request
+ );
+
+NDIS_STATUS
+HtTapiConditionalMediaDetection(
+ IN PHTDSU_ADAPTER Adapter,
+ IN PNDIS_TAPI_CONDITIONAL_MEDIA_DETECTION Request
+ );
+
+NDIS_STATUS
+HtTapiDial(
+ IN PHTDSU_ADAPTER Adapter,
+ IN PNDIS_TAPI_DIAL Request
+ );
+
+NDIS_STATUS
+HtTapiDrop(
+ IN PHTDSU_ADAPTER Adapter,
+ IN PNDIS_TAPI_DROP Request
+ );
+
+NDIS_STATUS
+HtTapiProviderShutdown(
+ IN PHTDSU_ADAPTER Adapter,
+ IN PNDIS_TAPI_PROVIDER_SHUTDOWN Request
+ );
+
+NDIS_STATUS
+HtTapiSecureCall(
+ IN PHTDSU_ADAPTER Adapter,
+ IN PNDIS_TAPI_SECURE_CALL Request
+ );
+
+NDIS_STATUS
+HtTapiSelectExtVersion(
+ IN PHTDSU_ADAPTER Adapter,
+ IN PNDIS_TAPI_SELECT_EXT_VERSION Request
+ );
+
+NDIS_STATUS
+HtTapiSendUserUserInfo(
+ IN PHTDSU_ADAPTER Adapter,
+ IN PNDIS_TAPI_SEND_USER_USER_INFO Request
+ );
+
+NDIS_STATUS
+HtTapiSetAppSpecific(
+ IN PHTDSU_ADAPTER Adapter,
+ IN PNDIS_TAPI_SET_APP_SPECIFIC Request
+ );
+
+NDIS_STATUS
+HtTapiSetCallParams(
+ IN PHTDSU_ADAPTER Adapter,
+ IN PNDIS_TAPI_SET_CALL_PARAMS Request
+ );
+
+NDIS_STATUS
+HtTapiSetDefaultMediaDetection(
+ IN PHTDSU_ADAPTER Adapter,
+ IN PNDIS_TAPI_SET_DEFAULT_MEDIA_DETECTION Request
+ );
+
+NDIS_STATUS
+HtTapiSetDevConfig(
+ IN PHTDSU_ADAPTER Adapter,
+ IN PNDIS_TAPI_SET_DEV_CONFIG Request
+ );
+
+NDIS_STATUS
+HtTapiSetMediaMode(
+ IN PHTDSU_ADAPTER Adapter,
+ IN PNDIS_TAPI_SET_MEDIA_MODE Request
+ );
+
+NDIS_STATUS
+HtTapiSetStatusMessages(
+ IN PHTDSU_ADAPTER Adapter,
+ IN PNDIS_TAPI_SET_STATUS_MESSAGES Request
+ );
+
+VOID
+HtTapiAddressStateHandler(
+ IN PHTDSU_ADAPTER Adapter,
+ IN PHTDSU_LINK Link,
+ IN ULONG AddressState
+ );
+
+VOID
+HtTapiCallStateHandler(
+ IN PHTDSU_ADAPTER Adapter,
+ IN PHTDSU_LINK Link,
+ IN ULONG CallState,
+ IN ULONG StateParam
+ );
+
+VOID
+HtTapiLineDevStateHandler(
+ IN PHTDSU_ADAPTER Adapter,
+ IN PHTDSU_LINK Link,
+ IN ULONG LineDevState
+ );
+
+VOID
+HtTapiResetHandler(
+ IN PHTDSU_ADAPTER Adapter
+ );
+
+VOID
+HtTapiCallTimerHandler(
+ IN PVOID SystemSpecific1,
+ IN PHTDSU_LINK Link,
+ IN PVOID SystemSpecific2,
+ IN PVOID SystemSpecific3
+ );
+
+#endif // _HTDSU_H
+
diff --git a/private/ntos/ndis/htdsu/htdsu.rc b/private/ntos/ndis/htdsu/htdsu.rc
new file mode 100644
index 000000000..c18ad93fc
--- /dev/null
+++ b/private/ntos/ndis/htdsu/htdsu.rc
@@ -0,0 +1,9 @@
+#include <winver.h>
+#include <ntverp.h>
+
+#define VER_FILETYPE VFT_DRV
+#define VER_FILESUBTYPE VFT2_DRV_NETWORK
+
+#include "version.h"
+#include <common.ver>
+
diff --git a/private/ntos/ndis/htdsu/interrup.c b/private/ntos/ndis/htdsu/interrup.c
new file mode 100644
index 000000000..fad79ce79
--- /dev/null
+++ b/private/ntos/ndis/htdsu/interrup.c
@@ -0,0 +1,656 @@
+/***************************************************************************\
+|* Copyright (c) 1994 Microsoft Corporation *|
+|* Developed for Microsoft by TriplePoint, Inc. Beaverton, Oregon *|
+|* *|
+|* This file is part of the HT Communications DSU41 WAN Miniport Driver. *|
+\***************************************************************************/
+#include "version.h"
+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+Module Name:
+
+ interrup.c
+
+Abstract:
+
+ This module contains the Miniport interrupt processing routines:
+ MiniportCheckForHang()
+ MiniportDisableInterrupt()
+ MiniportEnableInterrupt()
+ MiniportISR()
+ MiniportHandleInterrupt()
+
+ This driver conforms to the NDIS 3.0 Miniport interface.
+
+Author:
+
+ Larry Hattery - TriplePoint, Inc. (larryh@tpi.com) Jun-94
+
+Environment:
+
+ Windows NT 3.5 kernel mode Miniport driver or equivalent.
+
+Revision History:
+
+---------------------------------------------------------------------------*/
+
+#define __FILEID__ 3 // Unique file ID for error logging
+
+#include "htdsu.h"
+
+
+BOOLEAN
+HtDsuCheckForHang(
+ IN PHTDSU_ADAPTER Adapter
+ )
+
+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+Functional Description:
+
+ The MiniportCheckForHang request is used by the wrapper to periodically
+ have the miniport check if the adapter appears hung.
+
+ The Miniport driver should do nothing more than check the internal state
+ and return if the adapter is hung. The wrapper will then attempt to
+ recover the adapter by calling MiniportReset.
+
+ This routine will be called once every two seconds.
+
+ Interrupts will be in any state when called.
+
+Parameters:
+
+ MiniportAdapterContext _ The handle returned from MiniportInitialize.
+
+Return Values:
+
+ TRUE if the driver believes that the underlying hardware is hung,
+ FALSE otherwise.
+
+---------------------------------------------------------------------------*/
+
+{
+ return (Adapter->NeedReset);
+}
+
+
+VOID
+HtDsuDisableInterrupt(
+ IN PHTDSU_ADAPTER Adapter
+ )
+
+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+Functional Description:
+
+ The MiniportDisableInterrupt request is used to disable the adapter
+ from generating any interrupts. Typically this is done by writing a
+ mask which disables the adapter from generating hardware interrupts.
+
+ If the underlying hardware does not support enabling and disabling
+ interrupts, the Miniport driver will have to register a MiniportISR
+ with the wrapper, and the Miniport driver will have to acknowledge
+ and save the interrupt information from within the interrupt service
+ routine.
+
+ This routine may be called any time interrupts are enabled. If the
+ underlying hardware is required to be in a certain state for this
+ routine to execute correctly, the Miniport driver must encapsulate
+ all portions of the driver which violate the state and which may be
+ called when interrupts are enabled, with a function and call the
+ function through the NdisMSynchronizeWithInterrupt service.
+
+ Interrupts will be in any state when called.
+
+Parameters:
+
+ MiniportAdapterContext _ The adapter handle passed to NdisMSetAttributes
+ during MiniportInitialize.
+
+Return Values:
+
+ None.
+
+---------------------------------------------------------------------------*/
+
+{
+ DBG_FUNC("HtDsuDisableInterrupt")
+
+ /*
+ // Save the current interrupt status on the card.
+ */
+ USHORT InterruptStatus = CardGetInterrupt(Adapter);
+
+// DBG_ENTER(Adapter);
+
+ /*
+ // Disable the interrupt at the card after saving the current state
+ // of the InterruptStatus register -- which will be reset by the clear
+ // interrupt command.
+ */
+ Adapter->InterruptStatusFlag |= InterruptStatus;
+ CardClearInterrupt(Adapter);
+ CardDisableInterrupt(Adapter);
+
+ DBG_NOTICE(Adapter, ("IntrStatus=%Xh LineStatus=%Xh\n",
+ InterruptStatus,
+ READ_REGISTER_USHORT(&Adapter->AdapterRam->StatusLine1)
+ ));
+
+// DBG_LEAVE(Adapter);
+}
+
+
+VOID
+HtDsuEnableInterrupt(
+ IN PHTDSU_ADAPTER Adapter
+ )
+
+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+Functional Description:
+
+ The MiniportEnableInterrupt request is used to enable the adapter for
+ generating any interrupts. Typically this is done by writing a mask
+ which will reenable adapter interrupts.
+
+ If the underlying hardware does not support enabling and disabling
+ interrupts, the Miniport driver will have to register a MiniportISR
+ with the wrapper, and the Miniport driver will have to acknowledge
+ and save the interrupt information from within the interrupt service
+ routine.
+
+ Interrupts will be in any state when called.
+
+Parameters:
+
+ MiniportAdapterContext _ The adapter handle passed to NdisMSetAttributes
+ during MiniportInitialize.
+
+Return Values:
+
+ None.
+
+---------------------------------------------------------------------------*/
+
+{
+ DBG_FUNC("HtDsuEnableInterrupt")
+
+ /*
+ // Save the current interrupt status on the card.
+ */
+ USHORT InterruptStatus = CardGetInterrupt(Adapter);
+
+// DBG_ENTER(Adapter);
+
+ CardEnableInterrupt(Adapter);
+
+ DBG_NOTICE(Adapter, ("IntrStatus=%Xh LineStatus=%Xh\n",
+ InterruptStatus,
+ READ_REGISTER_USHORT(&Adapter->AdapterRam->StatusLine1)
+ ));
+
+// DBG_LEAVE(Adapter);
+}
+
+
+
+VOID
+HtDsuISR(
+ OUT PBOOLEAN InterruptRecognized,
+ OUT PBOOLEAN QueueMiniportHandleInterrupt,
+ IN PHTDSU_ADAPTER Adapter
+ )
+
+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+Functional Description:
+
+ The MiniportISR request is called if the adapter generates an
+ interrupt when there is an outstanding call to MiniportInitialize
+ or to MiniportReconfigure, if the Miniport driver supports sharing
+ its interrupt line with another adapter, or if the Miniport driver
+ specifies that the routine must be called for every interrupt (See
+ NdisMRegisterInterrupt's RequestIsr and SharedInterrupt parameters).
+
+ This routine runs immediately after an interrupt, at very high priority,
+ and is subject to all the limitations of the interrupt service routine
+ in the NDIS 3.0 specification. The driver should do as little work as
+ possible in this routine. It should return TRUE in the parameter
+ InterruptRecognized if it recognizes the interrupt as belonging to its
+ adapter, or FALSE otherwise. It should return TRUE in the parameter
+ QueueMiniportHandleInterrupt if it needs a call to MiniportHandleInterrupt
+ at a lower priority to complete the handling of the interrupt, or FALSE
+ otherwise.
+
+ Note that a Dpc will not be queued if the Miniport is currently executing
+ in any of the following routines: MiniportHalt, MiniportInitialize,
+ MiniportReconfigure.
+
+Parameters:
+
+ InterruptRecognized _ If the Miniport is sharing an interrupt line, it
+ should set this parameter to TRUE if the Miniport
+ driver recognizes that the interrupt came from the
+ adapter it is supporting.
+
+ QueueMiniportHandleInterrupt _ If the Miniport driver is sharing an
+ interrupt line, it sets this parameter to
+ TRUE if the driver needs to have
+ MiniportHandleInterrupt called.
+
+ MiniportAdapterContext _ The adapter handle passed to NdisMSetAttributes
+ during MiniportInitialize.
+
+Return Values:
+
+ None.
+
+---------------------------------------------------------------------------*/
+
+{
+ DBG_FUNC("HtDsuISR")
+
+ /*
+ // Save the current interrupt status on the card.
+ */
+ USHORT InterruptStatus;
+
+ DBG_ENTER(Adapter);
+
+ /*
+ // This routine should never be called after initialization since we
+ // support the Enable/Disable Interrupt routines.
+ */
+ if (InterruptStatus = CardGetInterrupt(Adapter))
+ {
+ /*
+ // The adapter prevents the failure case where additional status
+ // bits could be set between the time we read the InterruptStatus
+ // and it is reset by the clear interrupt command...
+ */
+ CardClearInterrupt(Adapter);
+ Adapter->InterruptStatusFlag |= InterruptStatus;
+
+ /*
+ // The card generated an interrupt, we need to service it only if we are
+ // interested in it. In either case it must be dismissed from the card.
+ */
+ *InterruptRecognized = TRUE;
+ *QueueMiniportHandleInterrupt = TRUE;
+ }
+ else
+ {
+ /*
+ // It's not our interrupt, so we don't need to service anything.
+ */
+ *InterruptRecognized = FALSE;
+ }
+
+ DBG_NOTICE(Adapter, ("IntrStatus=%Xh LineStatus=%Xh\n",
+ InterruptStatus,
+ READ_REGISTER_USHORT(&Adapter->AdapterRam->StatusLine1)
+ ));
+
+ DBG_LEAVE(Adapter);
+}
+
+
+VOID
+HtDsuHandleInterrupt(
+ IN PHTDSU_ADAPTER Adapter
+ )
+
+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+Functional Description:
+
+ The MiniportHandleInterrupt routine is called from within a wrapper
+ deferred processing routine, and is used to process the reason an
+ interrupt was generated. The Miniport driver should handle all
+ outstanding interrupts and start any new operations.
+
+ Interrupts will be disabled during the call to this routine.
+
+Parameters:
+
+ MiniportAdapterContext _ The adapter handle passed to NdisMSetAttributes
+ during MiniportInitialize.
+
+Return Values:
+
+ None.
+
+---------------------------------------------------------------------------*/
+
+{
+ DBG_FUNC("HtDsuHandleInterrupt")
+
+ /*
+ // A pointer to our link information structure.
+ */
+ PHTDSU_LINK Link;
+
+ UINT TimeOut;
+
+ NdisAcquireSpinLock(&Adapter->Lock);
+ Adapter->InTheDpcHandler = TRUE;
+
+ DBG_ENTER(Adapter);
+
+ /*
+ // Loop thru here until all the interrupts are handled.
+ // This should not be allowed to take more than a few mili-seconds.
+ // If it does, the checked kernel will trap, and you'll have to
+ // find a way to leave the DPC early and handle the rest during
+ // the next pass.
+ */
+ while (Adapter->InterruptStatusFlag)
+ {
+ /********************************************************************
+ // Do we have a packet waiting in the adapter?
+ */
+ if (Adapter->InterruptStatusFlag & (HTDSU_INTR_RX_PACKET1 |
+ HTDSU_INTR_RX_PACKET2))
+ {
+ DBG_NOTICE(Adapter,("HTDSU_INTR_RX_PACKET\n"));
+
+ Adapter->InterruptStatusFlag &= ~(HTDSU_INTR_RX_PACKET1 |
+ HTDSU_INTR_RX_PACKET2);
+ HtDsuReceivePacket(Adapter);
+ }
+
+ /********************************************************************
+ // Has the packet been transmitted?
+ // Actually, this just means that the DSU firmware has moved the
+ // packet from our buffer area to its own buffer to be transmitted.
+ // It won't have actually completed until HTDSU_INTR_TX_EMPTY.
+ */
+ if (Adapter->InterruptStatusFlag & (HTDSU_INTR_TX_PACKET1 |
+ HTDSU_INTR_TX_PACKET2))
+ {
+ DBG_NOTICE(Adapter,("HTDSU_INTR_TX_PACKET\n"));
+
+ Adapter->InterruptStatusFlag &= ~(HTDSU_INTR_TX_PACKET1 |
+ HTDSU_INTR_TX_PACKET2);
+ HtDsuTransmitComplete(Adapter);
+ }
+
+ /********************************************************************
+ // Does somebody want to chat?
+ */
+ if (Adapter->InterruptStatusFlag & HTDSU_INTR_RINGING1)
+ {
+ DBG_NOTICE(Adapter,("HTDSU_INTR_RINGING1\n"));
+
+ Adapter->InterruptStatusFlag &= ~HTDSU_INTR_RINGING1;
+
+ /*
+ // CAVEAT: Normally you don't want to stall execution in your
+ // DPC because locks are held and no other threads will run.
+ // However, I have seen some hardware/firmware anomallies
+ // on the answering side where we get here before the signal
+ // is established, so I double check here by waiting up to 100MS.
+ */
+ TimeOut = 0;
+ while (!CardStatusRinging(Adapter, HTDSU_CMD_LINE1) ||
+ CardStatusNoSignal(Adapter, HTDSU_CMD_LINE1))
+ {
+ if (TimeOut++ > 1000)
+ {
+ DBG_ERROR(Adapter,("Timeout waiting for SIGNAL on line 1\n"));
+ break;
+ }
+ else
+ {
+ NdisStallExecution(_100_MICROSECONDS);
+ }
+ }
+
+ if (TimeOut != 0)
+ {
+ DBG_WARNING(Adapter, ("Ring1 signal delay=%d*100us\n", TimeOut));
+ }
+
+ /*
+ // Make sure the ring is still asserted or it may
+ // just be noise from the cable being unplugged.
+ */
+ if (CardStatusRinging(Adapter, HTDSU_CMD_LINE1))
+ {
+ Link = GET_LINK_FROM_CARDLINE(Adapter, HTDSU_CMD_LINE1);
+ HtTapiLineDevStateHandler(Adapter, Link, LINEDEVSTATE_RINGING);
+ }
+ else
+ {
+ DBG_WARNING(Adapter, ("Ring1 lost - status=%Xh\n",
+ READ_REGISTER_USHORT(&Adapter->AdapterRam->StatusLine1)));
+ }
+ }
+ if (Adapter->InterruptStatusFlag & HTDSU_INTR_RINGING2)
+ {
+ DBG_NOTICE(Adapter,("HTDSU_INTR_RINGING2\n"));
+
+ Adapter->InterruptStatusFlag &= ~HTDSU_INTR_RINGING2;
+
+ TimeOut = 0;
+ while (!CardStatusRinging(Adapter, HTDSU_CMD_LINE2) ||
+ CardStatusNoSignal(Adapter, HTDSU_CMD_LINE2))
+ {
+ if (TimeOut++ > 100)
+ {
+ DBG_ERROR(Adapter,("Timeout waiting for SIGNAL on line 2\n"));
+ break;
+ }
+ else
+ {
+ NdisStallExecution(_100_MICROSECONDS);
+ }
+ }
+
+ if (TimeOut != 0)
+ {
+ DBG_WARNING(Adapter, ("Ring2 signal delay=%d*100us\n", TimeOut));
+ }
+
+ if (CardStatusRinging(Adapter, HTDSU_CMD_LINE2))
+ {
+ Link = GET_LINK_FROM_CARDLINE(Adapter, HTDSU_CMD_LINE2);
+ HtTapiLineDevStateHandler(Adapter, Link, LINEDEVSTATE_RINGING);
+ }
+ else
+ {
+ DBG_WARNING(Adapter, ("Ring2 lost - status=%Xh\n",
+ READ_REGISTER_USHORT(&Adapter->AdapterRam->StatusLine2)));
+ }
+ }
+
+ /********************************************************************
+ // Do we have a connection being established?
+ */
+ if (Adapter->InterruptStatusFlag & HTDSU_INTR_CONNECTED1)
+ {
+
+ DBG_NOTICE(Adapter,("HTDSU_INTR_CONNECTED1\n"));
+
+ Adapter->InterruptStatusFlag &= ~HTDSU_INTR_CONNECTED1;
+
+ /*
+ // CAVEAT: Normally you don't want to stall execution in your
+ // DPC because locks are held and no other threads will run.
+ // However, I have seen some hardware/firmware anomallies
+ // on the calling side where we get here before the carrier
+ // is established, so I double check here by waiting up to 100MS.
+ */
+ TimeOut = 0;
+ while (!CardStatusCarrierDetect(Adapter, HTDSU_CMD_LINE1) ||
+ !CardStatusOnLine(Adapter, HTDSU_CMD_LINE1))
+ {
+ if (TimeOut++ > 1000)
+ {
+ DBG_ERROR(Adapter,("Timeout waiting for CARRIER/LINE 1\n"));
+ break;
+ }
+ else
+ {
+ NdisStallExecution(_100_MICROSECONDS);
+ }
+ }
+
+ if (TimeOut != 0)
+ {
+ DBG_WARNING(Adapter, ("Connect1 carrier delay=%d*100us\n", TimeOut));
+ }
+
+ /*
+ // Make sure the connection is accompanied by a carrier and
+ // an online status, Otherwise, it's probably just cable bounce.
+ */
+ if (CardStatusCarrierDetect(Adapter, HTDSU_CMD_LINE1) &&
+ CardStatusOnLine(Adapter, HTDSU_CMD_LINE1))
+ {
+ Link = GET_LINK_FROM_CARDLINE(Adapter, HTDSU_CMD_LINE1);
+ HtTapiLineDevStateHandler(Adapter, Link, LINEDEVSTATE_CONNECTED);
+ }
+ else
+ {
+ DBG_WARNING(Adapter, ("Connect1 but not ready - status=%X\n",
+ READ_REGISTER_USHORT(&Adapter->AdapterRam->StatusLine1)));
+ }
+ }
+ if (Adapter->InterruptStatusFlag & HTDSU_INTR_CONNECTED2)
+ {
+ DBG_NOTICE(Adapter,("HTDSU_INTR_CONNECTED2\n"));
+
+ Adapter->InterruptStatusFlag &= ~HTDSU_INTR_CONNECTED2;
+
+ TimeOut = 0;
+ while (!CardStatusCarrierDetect(Adapter, HTDSU_CMD_LINE2) ||
+ !CardStatusOnLine(Adapter, HTDSU_CMD_LINE2))
+ {
+ if (TimeOut++ > 1000)
+ {
+ DBG_ERROR(Adapter,("Timeout waiting for CARRIER/LINE 2\n"));
+ break;
+ }
+ else
+ {
+ NdisStallExecution(_100_MICROSECONDS);
+ }
+ }
+
+ if (TimeOut != 0)
+ {
+ DBG_WARNING(Adapter, ("Connect2 carrier delay=%d*100us\n", TimeOut));
+ }
+
+ if (CardStatusCarrierDetect(Adapter, HTDSU_CMD_LINE2) &&
+ CardStatusOnLine(Adapter, HTDSU_CMD_LINE2))
+ {
+ Link = GET_LINK_FROM_CARDLINE(Adapter, HTDSU_CMD_LINE2);
+ HtTapiLineDevStateHandler(Adapter, Link, LINEDEVSTATE_CONNECTED);
+ }
+ else
+ {
+ DBG_WARNING(Adapter, ("Connect2 but not ready - status=%X\n",
+ READ_REGISTER_USHORT(&Adapter->AdapterRam->StatusLine2)));
+ }
+ }
+
+ /********************************************************************
+ // Did the other guy hung up on us? -- how rude...
+ */
+ if (Adapter->InterruptStatusFlag & HTDSU_INTR_DISCONNECTED1)
+ {
+ DBG_NOTICE(Adapter,("HTDSU_INTR_DISCONNECTED1\n"));
+
+ Adapter->InterruptStatusFlag &= ~HTDSU_INTR_DISCONNECTED1;
+
+ Link = GET_LINK_FROM_CARDLINE(Adapter, HTDSU_CMD_LINE1);
+ HtTapiLineDevStateHandler(Adapter, Link, LINEDEVSTATE_DISCONNECTED);
+ }
+ if (Adapter->InterruptStatusFlag & HTDSU_INTR_DISCONNECTED2)
+ {
+ DBG_NOTICE(Adapter,("HTDSU_INTR_DISCONNECTED2\n"));
+
+ Adapter->InterruptStatusFlag &= ~HTDSU_INTR_DISCONNECTED2;
+
+ Link = GET_LINK_FROM_CARDLINE(Adapter, HTDSU_CMD_LINE2);
+ HtTapiLineDevStateHandler(Adapter, Link, LINEDEVSTATE_DISCONNECTED);
+ }
+
+ /********************************************************************
+ // Has the transmitter gone idle? Ask me if I care...
+ */
+ if (Adapter->InterruptStatusFlag & (HTDSU_INTR_TX_EMPTY1 |
+ HTDSU_INTR_TX_EMPTY2))
+ {
+ DBG_NOTICE(Adapter,("HTDSU_INTR_TX_EMPTY\n"));
+
+ Adapter->InterruptStatusFlag &= ~(HTDSU_INTR_TX_EMPTY1 |
+ HTDSU_INTR_TX_EMPTY2);
+ }
+
+ /********************************************************************
+ // Maybe somebody unplugged the phone line?
+ */
+ if (Adapter->InterruptStatusFlag & HTDSU_INTR_NO_SIGNAL1)
+ {
+ DBG_NOTICE(Adapter,("HTDSU_INTR_NO_SIGNAL1\n"));
+
+ Adapter->InterruptStatusFlag &= ~HTDSU_INTR_NO_SIGNAL1;
+
+ Link = GET_LINK_FROM_CARDLINE(Adapter, HTDSU_CMD_LINE1);
+ HtTapiLineDevStateHandler(Adapter, Link, LINEDEVSTATE_OUTOFSERVICE);
+ }
+ if (Adapter->InterruptStatusFlag & HTDSU_INTR_NO_SIGNAL2)
+ {
+ DBG_NOTICE(Adapter,("HTDSU_INTR_NO_SIGNAL2\n"));
+
+ Adapter->InterruptStatusFlag &= ~HTDSU_INTR_NO_SIGNAL2;
+
+ Link = GET_LINK_FROM_CARDLINE(Adapter, HTDSU_CMD_LINE2);
+ HtTapiLineDevStateHandler(Adapter, Link, LINEDEVSTATE_OUTOFSERVICE);
+ }
+
+ /********************************************************************
+ // What about a receive buffer overrun? -- This better never happen!
+ // However, if it does, we'll shut this sucker off til it's reset.
+ */
+ if (Adapter->InterruptStatusFlag & HTDSU_INTR_RX_FULL1)
+ {
+ DBG_ERROR(Adapter,("HTDSU_INTR_RX_FULL1\n"));
+
+ Adapter->InterruptStatusFlag &= ~HTDSU_INTR_RX_FULL1;
+
+ /*
+ // Ask for reset, and disable interrupts until we get it.
+ */
+ Adapter->NeedReset = TRUE;
+ Adapter->InterruptEnableFlag = HTDSU_INTR_DISABLE;
+
+ Link = GET_LINK_FROM_CARDLINE(Adapter, HTDSU_CMD_LINE1);
+ LinkLineError(Link, WAN_ERROR_BUFFEROVERRUN);
+ HtTapiLineDevStateHandler(Adapter, Link, LINEDEVSTATE_DISCONNECTED);
+ }
+ if (Adapter->InterruptStatusFlag & HTDSU_INTR_RX_FULL2)
+ {
+ DBG_ERROR(Adapter,("HTDSU_INTR_RX_FULL2\n"));
+
+ Adapter->InterruptStatusFlag &= ~HTDSU_INTR_RX_FULL2;
+
+ Adapter->NeedReset = TRUE;
+ Adapter->InterruptEnableFlag = HTDSU_INTR_DISABLE;
+
+ Link = GET_LINK_FROM_CARDLINE(Adapter, HTDSU_CMD_LINE2);
+ LinkLineError(Link, WAN_ERROR_BUFFEROVERRUN);
+ HtTapiLineDevStateHandler(Adapter, Link, LINEDEVSTATE_DISCONNECTED);
+ }
+ }
+ DBG_LEAVE(Adapter);
+
+ Adapter->InTheDpcHandler = FALSE;
+ NdisReleaseSpinLock(&Adapter->Lock);
+}
+
diff --git a/private/ntos/ndis/htdsu/keywords.h b/private/ntos/ndis/htdsu/keywords.h
new file mode 100644
index 000000000..bb25cc7bd
--- /dev/null
+++ b/private/ntos/ndis/htdsu/keywords.h
@@ -0,0 +1,77 @@
+/***************************************************************************\
+|* Copyright (c) 1994 Microsoft Corporation *|
+|* Developed for Microsoft by TriplePoint, Inc. Beaverton, Oregon *|
+|* *|
+|* This file is part of the HT Communications DSU41 WAN Miniport Driver. *|
+\***************************************************************************/
+
+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+Module Name:
+
+ keywords.h
+
+Abstract:
+
+ This file contains the driver keyword parameters used in the registry.
+
+Author:
+
+ Larry Hattery - TriplePoint, Inc. (larryh@tpi.com) Jun-94
+
+Environment:
+
+ Include this file in the module parsing the driver configuration
+ parameters.
+
+Revision History:
+
+---------------------------------------------------------------------------*/
+
+#ifndef _KEYWORD_H
+#define _KEYWORD_H
+
+/*
+// The following parameter values are written to the configuration
+// registry during installation and setup, and they are validated
+// by the driver when the adapter is initialized.
+*/
+#define HTDSU_PARAM_IRQ03 03
+#define HTDSU_PARAM_IRQ04 04
+#define HTDSU_PARAM_IRQ10 10
+#define HTDSU_PARAM_IRQ11 11
+#define HTDSU_PARAM_IRQ12 12
+#define HTDSU_PARAM_IRQ15 15
+
+#define HTDSU_PARAM_RAMBASE1 (0x000D0000)
+#define HTDSU_PARAM_RAMBASE2 (0x000E0000)
+#define HTDSU_PARAM_RAMBASE3 (0x000DF000)
+#define HTDSU_PARAM_RAMBASE4 (0x000CF000)
+
+#define HTDSU_PARAM_INTERRUPT_STRING NDIS_STRING_CONST("InterruptNumber")
+#define HTDSU_PARAM_RAMBASE_STRING NDIS_STRING_CONST("RamBaseAddress")
+#define HTDSU_PARAM_MEDIATYPE_STRING NDIS_STRING_CONST("MediaType")
+#define HTDSU_PARAM_ADDRLIST_STRING NDIS_STRING_CONST("AddressList")
+#define HTDSU_PARAM_DEVICENAME_STRING NDIS_STRING_CONST("DeviceName")
+#define HTDSU_PARAM_LINETYPE_STRING NDIS_STRING_CONST("LineType")
+#define HTDSU_PARAM_LINERATE_STRING NDIS_STRING_CONST("LineRate")
+
+#if DBG
+#define HTDSU_PARAM_DBGFLAGS_STRING NDIS_STRING_CONST("DebugFlags")
+#endif
+
+/*
+// Returned from an OID_GEN_VENDOR_ID HtDsuQueryInformation request.
+// The vendor's assigned ethernet vendor code should be used if possible.
+*/
+#define HTDSU_VENDOR_ID "HTC"
+
+/*
+// Returned from an OID_GEN_VENDOR_DESCRIPTION HtDsuQueryInformation request.
+// This is an arbitrary string which may be used by upper layers to present
+// a user friendly description of the adapter.
+*/
+#define HTDSU_VENDOR_DESCRPTION "HT Communications 56kbps Digital Modem"
+
+#endif
+
diff --git a/private/ntos/ndis/htdsu/link.c b/private/ntos/ndis/htdsu/link.c
new file mode 100644
index 000000000..1983c07dd
--- /dev/null
+++ b/private/ntos/ndis/htdsu/link.c
@@ -0,0 +1,587 @@
+/***************************************************************************\
+|* Copyright (c) 1994 Microsoft Corporation *|
+|* Developed for Microsoft by TriplePoint, Inc. Beaverton, Oregon *|
+|* *|
+|* This file is part of the HT Communications DSU41 WAN Miniport Driver. *|
+\***************************************************************************/
+#include "version.h"
+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+Module Name:
+
+ link.c
+
+Abstract:
+
+ This module contains the WAN Miniport link management routines. All
+ information about the state of the link is stored in the Link structure.
+ LinkInitialize()
+ LinkAllocate()
+ LinkRelease()
+ LinkLineUp()
+ LinkLineDown()
+ LinkLineError()
+
+ This driver conforms to the NDIS 3.0 Miniport interface.
+
+Author:
+
+ Larry Hattery - TriplePoint, Inc. (larryh@tpi.com) Jun-94
+
+Environment:
+
+ Windows NT 3.5 kernel mode Miniport driver or equivalent.
+
+Revision History:
+
+---------------------------------------------------------------------------*/
+
+#define __FILEID__ 4 // Unique file ID for error logging
+
+#include "htdsu.h"
+
+
+VOID
+LinkInitialize(
+ IN PHTDSU_ADAPTER Adapter,
+ IN PSTRING AddressList
+ )
+
+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+Functional Description:
+
+ This routine initializes the Link structures within the Adapter
+ structure. We use the link structure to hold all the information about
+ a connection, whether the connection is made via TAPI calls or is a
+ leased line WAN connection.
+
+Parameters:
+
+ Adapter _ A pointer ot our adapter information structure.
+
+ AddressList _ This is a list of MULTI_SZ strings which are to be assigned
+ to each link for use by TAPI HtTapiGetAddressCaps.
+
+Return Values:
+
+ None.
+
+---------------------------------------------------------------------------*/
+
+{
+ DBG_FUNC("LinkInitialize")
+
+ /*
+ // A pointer to our link information structure for the selected line device.
+ */
+ PHTDSU_LINK Link;
+
+ /*
+ // Index into the link array.
+ */
+ USHORT LinkIndex;
+
+ /*
+ // A pointer to the RAS/TAPI line address assigned to each link.
+ */
+ PUCHAR LineAddress = AddressList->Buffer;
+
+ DBG_ENTER(Adapter);
+
+ ASSERT(Adapter->NumLineDevs <= HTDSU_NUM_LINKS);
+
+ /*
+ // Go through and initialize each link.
+ */
+ for (LinkIndex = 0; LinkIndex < HTDSU_NUM_LINKS; ++LinkIndex)
+ {
+ Link = GET_LINK_FROM_LINKINDEX(Adapter, LinkIndex);
+
+ /*
+ // Initially, the link is not allocated to anyone and these fields
+ // must be reset.
+ // We can assume the entire Adapter structure is zeroed to begin with.
+ */
+ ASSERT(Link->Adapter == (PHTDSU_ADAPTER)0);
+ ASSERT(Link->htLine == (HTAPI_LINE)0);
+ ASSERT(Link->htCall == (HTAPI_CALL)0);
+ ASSERT(Link->NdisLinkContext == NULL);
+
+ /*
+ // Setup the static features of the link.
+ */
+ Link->CardLine = LinkIndex + HTDSU_CMD_LINE1;
+ Link->LinkIndex = LinkIndex;
+ Link->LinkSpeed = _56KBPS;
+ Link->LineMode = HTDSU_LINEMODE_DIALUP;
+ Link->MediaModesCaps = LINEMEDIAMODE_DIGITALDATA;
+ Link->Quality = NdisWanErrorControl;
+
+ /*
+ // If we run off the end of the address list, we just point at the
+ // null terminator for the other addresses. This might happen if
+ // some of the lines were not configured for use with RAS/TAPI.
+ */
+ strcpy(Link->LineAddress, LineAddress);
+ LineAddress += strlen(LineAddress) + 1;
+ if ((LineAddress - AddressList->Buffer) >= AddressList->Length)
+ {
+ --LineAddress;
+ }
+
+ DBG_NOTICE(Adapter,("LineAddress=<%s>\n",Link->LineAddress));
+
+ /*
+ // Initialize the TAPI event capabilities supported by the link.
+ */
+ Link->DevStatesCaps = LINEDEVSTATE_RINGING |
+ LINEDEVSTATE_CONNECTED |
+ LINEDEVSTATE_DISCONNECTED |
+ LINEDEVSTATE_OUTOFSERVICE |
+ LINEDEVSTATE_OPEN |
+ LINEDEVSTATE_CLOSE;
+ Link->AddressStatesCaps = 0;
+ Link->CallStatesCaps = LINECALLSTATE_IDLE |
+ LINECALLSTATE_OFFERING |
+ LINECALLSTATE_ACCEPTED |
+ LINECALLSTATE_DIALING |
+ LINECALLSTATE_BUSY |
+ LINECALLSTATE_CONNECTED |
+ LINECALLSTATE_PROCEEDING |
+ LINECALLSTATE_DISCONNECTED;
+ /*
+ // We use this timer to keep track of incoming and outgoing call
+ // status, and to provide timeouts for certain call states.
+ */
+ NdisMInitializeTimer(
+ &Link->CallTimer,
+ Adapter->MiniportAdapterHandle,
+ HtTapiCallTimerHandler,
+ Link
+ );
+ }
+ DBG_LEAVE(Adapter);
+}
+
+
+PHTDSU_LINK
+LinkAllocate(
+ IN PHTDSU_ADAPTER Adapter,
+ IN HTAPI_LINE htLine,
+ IN USHORT LinkIndex
+ )
+
+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+Functional Description:
+
+ This routine allocates a specific Link structure and passes back a
+ pointer which can be used by the driver to access the link.
+
+Parameters:
+
+ Adapter _ A pointer ot our adapter information structure.
+
+ Connection _ The TAPI connection handle to be associated with the link.
+
+ LinkIndex _ The specific link structure being allocated.
+
+Return Values:
+
+ A pointer to allocated link information structure, NULL if not allocated.
+
+---------------------------------------------------------------------------*/
+
+{
+ DBG_FUNC("LinkAllocate")
+
+ /*
+ // A pointer to our link information structure for the selected line device.
+ */
+ PHTDSU_LINK Link;
+
+ DBG_ENTER(Adapter);
+
+ Link = GET_LINK_FROM_LINKINDEX(Adapter, LinkIndex);
+
+ if (Link->Adapter == (PHTDSU_ADAPTER) 0)
+ {
+ /*
+ // We use the Adapter field to flag whether the link has been allocated.
+ // The htLine field is used to associate this link with the TAPI
+ // connection wrapper. Reset all the state information for this link.
+ */
+ Link->Adapter = Adapter;
+ Link->htLine = htLine;
+ Link->RingCount = 0;
+ Link->DevState = 0;
+ Link->DevStatesMask = 0; // Default to indicate no line events
+ Link->AddressState = 0;
+ Link->AddressStatesMask = 0; // Default to indicate no address events
+ Link->CallState = 0;
+ Link->CallStatesMask = Link->CallStatesCaps;
+ Link->MediaMode = Link->MediaModesCaps;
+ Link->MediaModesMask = 0;
+ Link->Closing = FALSE;
+ Link->CallClosing = FALSE;
+
+ /*
+ // Initialize the default link information structure. It may be
+ // changed later by MiniportSetInformation.
+ */
+ Link->WanLinkInfo.NdisLinkHandle = Link;
+ Link->WanLinkInfo.MaxSendFrameSize = Adapter->WanInfo.MaxFrameSize;
+ Link->WanLinkInfo.MaxRecvFrameSize = Adapter->WanInfo.MaxFrameSize;
+ Link->WanLinkInfo.SendFramingBits = Adapter->WanInfo.FramingBits;
+ Link->WanLinkInfo.RecvFramingBits = Adapter->WanInfo.FramingBits;
+ Link->WanLinkInfo.SendACCM = Adapter->WanInfo.DesiredACCM;
+ Link->WanLinkInfo.RecvACCM = Adapter->WanInfo.DesiredACCM;
+ }
+ else
+ {
+ /*
+ // The requested link has already been allocated.
+ */
+ Link = NULL;
+ }
+
+ DBG_LEAVE(Adapter);
+
+ return (Link);
+}
+
+
+VOID
+LinkRelease(
+ IN PHTDSU_LINK Link
+ )
+
+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+Functional Description:
+
+ This routine releases a specific Link structure and makes it available
+ for future allocation. It is assumed that the caller has closed any
+ associated connection and notified TAPI and WAN with a LINE_DOWN.
+
+Parameters:
+
+ Link _ A pointer to the link information structure to be released.
+
+Return Values:
+
+ None.
+
+---------------------------------------------------------------------------*/
+
+{
+ DBG_FUNC("LinkRelease")
+ DBG_ENTER(Link->Adapter);
+
+ Link->Adapter = (PHTDSU_ADAPTER)0;
+ Link->htLine = (HTAPI_LINE)0;
+ Link->htCall = (HTAPI_CALL)0;
+ Link->NdisLinkContext = NULL;
+}
+
+
+VOID
+LinkLineUp(
+ IN PHTDSU_LINK Link
+ )
+
+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+Functional Description:
+
+ This routine marks a link as connected and sends a LINE_UP indication to
+ the WAN wrapper.
+
+ A line up indication is generated when a new link becomes active. Prior
+ to this the MAC will accept frames and may let them succeed or fail, but
+ it is unlikely that they will actually be received by any remote. During
+ this state protocols are encouraged to reduce their timers and retry
+ counts so as to quickly fail any outgoing connection attempts.
+
+ NOTE: This indication must be sent to the WAN wrapper prior to returning
+ from the OID_TAPI_ANSWER request, and prior to indicating the
+ LINECALLSTATE_CONNECTED to the connection wrapper. Otherwise, the
+ connection wrapper client might attempt to send data to the WAN wrapper
+ before it is aware of the line.
+
+ The status code for the line up indication is NDIS_STATUS_WAN_LINE_UP.
+ The format of the StatusBuffer for this code is:
+
+ typedef struct _NDIS_MAC_LINE_UP
+ {
+ IN ULONG LinkSpeed;
+ IN NDIS_WAN_QUALITY Quality;
+ IN USHORT SendWindow;
+ IN NDIS_HANDLE ConnectionWrapperID;
+ IN NDIS_HANDLE NdisLinkHandle;
+ OUT NDIS_HANDLE NdisLinkContext;
+
+ } NDIS_MAC_LINE_UP, *PNDIS_MAC_LINE_UP;
+
+ LinkSpeed _ The speed of the link, in 100 bps units.
+
+ Quality _ The quality of the new line.
+
+ SendWindow _ The recommended send window, i.e., the number of packets
+ that should be given to the adapter before pausing to wait
+ for an acknowledgement. Some devices achieve higher
+ throughput if they have several packets to send at once;
+ others are especially unreliable. A value of 0 indicates
+ no recommendation.
+
+ ConnectionWrapperID _ The MAC supplied handle by which this line will be
+ known to the connection wrapper clients. This must
+ be a unique handle across all drivers using the
+ connection wrapper, so typically htCall should be
+ used to gaurantee it is unique. This must be the
+ same value returned from the OID_TAPI_GETID request
+ for the “ndis” device class. Refer to the
+ Connection Wrapper Interface Specification for
+ further details. If not using the connection
+ wrapper, the value is 0.
+
+ NdisLinkHandle _ The MAC supplied handle passed down in future Miniport
+ calls (such as MiniportSend) for this link. Typically,
+ the MAC will provide a pointer to its control block for
+ that link. The value must be unique, for the first
+ LINE_UP for that link. Subsequent LINE_UPs may be
+ called if line characteristics change. When subsequent
+ LINE_UP calls are made, the MiniportLinkHandle must be
+ filled with the value returned on the first LINE_UP call.
+
+ NdisLinkContext _ The WAN wrapper supplied handle to be used in future
+ Miniport calls (such as MiniportReceive) to the wrapper.
+ The WAN wrapper will provide a unique handle for every
+ unique LINE_UP. The MiniportLinkHandle must be 0 if
+ this is the first LINE_UP. It must contain the value
+ returned on the first LINE_UP for subsequent LINE_UP
+ calls.
+
+Parameters:
+
+ Link _ A pointer to our link information structure, on which this LINE_UP
+ indication is being made.
+
+Return Values:
+
+ None.
+
+---------------------------------------------------------------------------*/
+
+{
+ DBG_FUNC("LinkLineUp")
+
+ NDIS_MAC_LINE_UP LineUpInfo;
+
+ DBG_ENTER(Link->Adapter);
+
+ /*
+ // Initialize the LINE_UP event packet.
+ */
+ LineUpInfo.LinkSpeed = Link->LinkSpeed / 100;
+ LineUpInfo.Quality = Link->Quality;
+ LineUpInfo.SendWindow = Link->SendWindow;
+ LineUpInfo.ConnectionWrapperID = (NDIS_HANDLE) Link->htCall;
+ LineUpInfo.NdisLinkHandle = Link;
+ LineUpInfo.NdisLinkContext = Link->NdisLinkContext;
+
+ /*
+ // Indicate the event to the WAN wrapper.
+ */
+ NdisMIndicateStatus(Link->Adapter->MiniportAdapterHandle,
+ NDIS_STATUS_WAN_LINE_UP,
+ &LineUpInfo,
+ sizeof(LineUpInfo)
+ );
+
+ /*
+ // Save the WAN wrapper link context for use when indicating received
+ // packets and errors.
+ */
+ Link->NdisLinkContext = LineUpInfo.NdisLinkContext;
+
+ DBG_NOTICE(Link->Adapter,
+ ("MAC_LINE_UP: LinkHandle=%Xh NdisHandle=%Xh WrapperID=%Xh\n",
+ LineUpInfo.NdisLinkHandle,
+ LineUpInfo.NdisLinkContext,
+ LineUpInfo.ConnectionWrapperID
+ ));
+
+ DBG_LEAVE(Link->Adapter);
+}
+
+
+VOID
+LinkLineDown(
+ IN PHTDSU_LINK Link
+ )
+
+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+Functional Description:
+
+ This routine marks a link as disconnected and sends a LINE_DOWN
+ indication to the WAN wrapper.
+
+ A line down indication is generated when a link goes down. Protocols
+ should again reduce their timers and retry counts until the next line
+ up indication.
+
+ The status code for the line down indication is NDIS_STATUS_WAN_LINE_DOWN.
+ The format of the StatusBuffer for this code is:
+
+ typedef struct _NDIS_MAC_LINE_DOWN
+ {
+ IN NDIS_HANDLE NdisLinkContext;
+
+ } NDIS_MAC_LINE_DOWN, *PNDIS_MAC_LINE_DOWN;
+
+ MiniportLinkContext _ Value returned in NDIS_WAN_LINE_UP.
+
+Parameters:
+
+ Link _ A pointer to our link information structure, on which this LINE_DOWN
+ indication is being made.
+
+Return Values:
+
+ None.
+
+---------------------------------------------------------------------------*/
+
+{
+ DBG_FUNC("LinkLineDown")
+
+ NDIS_MAC_LINE_DOWN LineDownInfo;
+
+ DBG_ENTER(Link->Adapter);
+
+ /*
+ // We can't allow indications to NULL...
+ */
+ if (Link->NdisLinkContext)
+ {
+ DBG_NOTICE(Link->Adapter,
+ ("MAC_LINE_DOWN: NdisHandle=%Xh\n",
+ Link->NdisLinkContext
+ ));
+
+ /*
+ // Setup the LINE_DOWN event packet and indicate the event to the
+ // WAN wrapper.
+ */
+ LineDownInfo.NdisLinkContext = Link->NdisLinkContext;
+
+ NdisMIndicateStatus(Link->Adapter->MiniportAdapterHandle,
+ NDIS_STATUS_WAN_LINE_DOWN,
+ &LineDownInfo,
+ sizeof(LineDownInfo)
+ );
+ /*
+ // The line is down, so there's no more context for receives.
+ */
+ Link->NdisLinkContext = NULL;
+ Link->CallClosing = FALSE;
+ }
+
+ DBG_LEAVE(Link->Adapter);
+}
+
+
+VOID
+LinkLineError(
+ IN PHTDSU_LINK Link,
+ IN ULONG Errors
+ )
+
+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+Functional Description:
+
+ This routine is used to indicate to the WAN wrapper that a partial
+ packet was received from the remote end. The NDIS_STATUS_WAN_FRAGMENT
+ indication is used to notify WAN wrapper.
+
+ A fragment indication indicates that a partial packet was received from
+ the remote. The protocol is encouraged to send frames to the remote that
+ will notify it of this situation, rather than waiting for a timeout to
+ occur.
+
+ The status code for the fragment indication is NDIS_STATUS_WAN_FRAGMENT.
+ The format of the StatusBuffer for this code is:
+
+ typedef struct _NDIS_MAC_FRAGMENT
+ {
+ IN NDIS_HANDLE NdisLinkContext;
+ IN ULONG Errors;
+
+ } NDIS_MAC_FRAGMENT, *PNDIS_MAC_FRAGMENT;
+
+ NdisLinkContext _ Value returned in NDIS_WAN_LINE_UP.
+
+ Errors _ A bit field set to one or more bits indicating the reason the
+ fragment was received. If no direct mapping from the WAN medium
+ error to one of the six errors listed below exists, choose the
+ most apropriate error:
+
+ WAN_ERROR_CRC
+ WAN_ERROR_FRAMING
+ WAN_ERROR_HARDWAREOVERRUN
+ WAN_ERROR_BUFFEROVERRUN
+ WAN_ERROR_TIMEOUT
+ WAN_ERROR_ALIGNMENT
+
+ NOTE: The WAN wrapper keeps track of dropped packets by counting the
+ number of fragment indications on the link.
+
+Parameters:
+
+ Link _ A pointer to our link information structure, on which this error
+ was encountered.
+
+Return Values:
+
+ None.
+
+---------------------------------------------------------------------------*/
+
+{
+ DBG_FUNC("LinkLineError")
+
+ NDIS_MAC_FRAGMENT FragmentInfo;
+
+ /*
+ // We can't allow indications to NULL...
+ */
+ if (Link->NdisLinkContext)
+ {
+ DBG_ENTER(Link->Adapter);
+
+ DBG_NOTICE(Link->Adapter,
+ ("MAC_LINE_ERROR: NdisHandle=%Xh Errors=%Xh\n",
+ Link->NdisLinkContext,
+ Errors
+ ));
+
+ /*
+ // Setup the FRAGMENT event packet and indicate it to the WAN wrapper.
+ */
+ FragmentInfo.NdisLinkContext = Link->NdisLinkContext;
+ FragmentInfo.Errors = Errors;
+
+ NdisMIndicateStatus(Link->Adapter->MiniportAdapterHandle,
+ NDIS_STATUS_WAN_FRAGMENT,
+ &FragmentInfo,
+ sizeof(FragmentInfo)
+ );
+
+ DBG_LEAVE(Link->Adapter);
+ }
+}
+
diff --git a/private/ntos/ndis/htdsu/makefile b/private/ntos/ndis/htdsu/makefile
new file mode 100644
index 000000000..58189757d
--- /dev/null
+++ b/private/ntos/ndis/htdsu/makefile
@@ -0,0 +1,7 @@
+#
+# DO NOT EDIT THIS FILE!!! Edit .\sources. if you want to add a new source
+# file to this component. This file merely indirects to the real make file
+# that is shared by all the driver components of the Windows NT DDK
+#
+
+!INCLUDE $(NTMAKEENV)\makefile.def
diff --git a/private/ntos/ndis/htdsu/oemsetnt.inf b/private/ntos/ndis/htdsu/oemsetnt.inf
new file mode 100644
index 000000000..6b3a7882e
--- /dev/null
+++ b/private/ntos/ndis/htdsu/oemsetnt.inf
@@ -0,0 +1,1241 @@
+;***********************************************************************
+; HT Communications DSU41/42 56kbps Digital Modem WindowsNT Setup File.
+;***********************************************************************
+[Identification]
+ OptionType = NetAdapter
+
+;***********************************************************************
+;
+;***********************************************************************
+[PlatformsSupported]
+ ISA
+ EISA
+ "Jazz-Internal Bus"
+
+;***********************************************************************
+;
+;***********************************************************************
+[Options]
+ HTDSU41
+; HTDSU42 FIXME - The HTDSU42 does not yet support HDLC framing
+
+;***********************************************************************
+;
+;***********************************************************************
+[FileConstants]
+ InfName = "OEMHTDSU.INF"
+ UtilityInf = "UTILITY.INF"
+ ParamInf = "NCPARAM.INF"
+ subroutineinf = "SUBROUTN.INF"
+ SoftwareType = "driver"
+ Exit_Code = 0
+ NetEventDLL = "%SystemRoot%\System32\netevent.dll"
+ IoLogMsgDLL = "%SystemRoot%\System32\IoLogMsg.dll"
+ Manufacturer = "HT Communications"
+ ProductMajorVersion = "3"
+ ProductMinorVersion = "1"
+ ProductVersion = $(ProductMajorVersion)"."$(ProductMinorVersion)
+ ProductSoftwareName = "HTDSU41"
+ ProductSoftwareImagePath = "\SystemRoot\System32\drivers\HTDSU41.sys"
+ NetRuleSoftwareType = "HTDSU41Sys HTDSU41Driver"
+ NetRuleSoftwareUse = $(SoftwareType)
+ NetRuleSoftwareBindForm = """HTDSU41Sys"" yes no container"
+ NetRuleSoftwareClass = {"HTDSU41Driver basic"}
+ NetRuleSoftwareBindable = {"HTDSU41Driver HTDSU41Adapter non exclusive 100"}
+ ProductHardwareName = "HTDSU41"
+ NetRuleHardwareBindForm = " yes yes container"
+ NetRuleHardwareHTDSU41Type = "HTDSU41 HTDSU41Adapter"
+ NetRuleHardwareHTDSU41Class = {"HTDSU41Adapter basic"}
+ BindableHTDSU41Txt = {"HTDSU41Driver HTDSU41Adapter non exclusive 100"}
+ DeviceMap = "HARDWARE\DEVICEMAP"
+ TapiDevices = "TAPI DEVICES"
+ TapiDeviceKey = $(ProductHardwareName)
+ TapiMediaType = "Sw56_"
+ ProductKeyName = $(!NTN_SoftwareBase)"\"$(Manufacturer)"\"+
+ $(ProductSoftwareName)"\CurrentVersion"
+ ParamKeyName = $(!NTN_ServiceBase)"\"$(ProductHardwareName)+
+ "\Parameters"
+
+; FIXME - default to dialup line mode = 0 -- leased line = 1
+; In dialup mode we need to write the parameters so RAS/TAPI will bind to us
+; In leased mode we need to write the parameters so NDIS/WAN will bind to us
+; Right now this file only supports dialup mode - leased line changes are needed
+ LineType = 0
+
+; FIXME - Set to zero before release
+ DebugFlags = 0
+
+ RAM_Addr_List = {851968, 917504, 913408, 847872}
+ IRQ_List = {15, 12, 11, 10, 4, 3}
+
+; Default here is 1=57.6kbps 0=max 2=38.4k 3=19.2k 4=9.6k
+ Rate_Strings = {"Max kbps", "57.6 kbps", "38.4 kbps", "19.2 kpbs", "9.6 kbps"}
+ Line_Rates = {0, 1, 2, 3, 4}
+ LineRate = 0
+
+;***********************************************************************
+;
+;***********************************************************************
+[GeneralConstants]
+ from = ""
+ to = ""
+ ExitCodeOk = 0
+ ExitCodeCancel = 1
+ ExitCodeFatal = 2
+ KeyNull = ""
+ MAXIMUM_ALLOWED = 33554432
+ RegistryErrorIndex = NO_ERROR
+ KeyProduct = ""
+ KeyParameters = ""
+ TRUE = 1
+ FALSE = 0
+ NoTitle = 0
+ ExitState = "Active"
+ OldVersionExisted = $(FALSE)
+ DriverPath = $(!STF_NTPATH)\drivers
+
+;***********************************************************************
+;
+;***********************************************************************
+[Date]
+ Now = {} ? $(!LIBHANDLE) GetSystemDate
+
+;***********************************************************************
+;
+;***********************************************************************
+[Identify]
+ Read-Syms Identification
+ Set Status = STATUS_SUCCESSFUL
+ Set Identifier = $(OptionType)
+ Set Media = #("Source Media Descriptions", 1, 1)
+ Return $(Status) $(Identifier) $(Media)
+
+;***********************************************************************
+;
+;***********************************************************************
+[ReturnOptions]
+ Set Status = STATUS_FAILED
+ Set OptionList = {}
+ Set OptionTextList = {}
+ Set LanguageList = ^(LanguagesSupported, 1)
+
+ IfContains(i) $($0) in $(LanguageList)
+ IfStr(i) $($1) == ""
+ GoTo SetOptions
+ EndIf
+ Set PlatformList = ^(PlatformsSupported, 1)
+ IfContains(i) $($1) in $(PlatformList)
+ GoTo SetOptions
+ Else
+ Set Status = STATUS_NOTSUPPORTED
+ GoTo ExitReturnOptions
+ EndIf
+ Else
+ Set Status = STATUS_NOLANGUAGE
+ GoTo ExitReturnOptions
+ EndIf
+
+SetOptions = +
+ Set OptionList = ^(Options, 1)
+ Set OptionTextList = ^(OptionsText$($0), 1)
+ Set Status = STATUS_SUCCESSFUL
+
+ExitReturnOptions = +
+ Return $(Status) $(OptionList) $(OptionTextList)
+
+;***********************************************************************
+;
+;***********************************************************************
+[InstallOption]
+ Set Status = STATUS_FAILED
+ Set Option = $($1)
+ Set SrcDir = $($2)
+ Set RasDir = $($2)
+ Set AddCopy = $($3)
+ Set DoCopy = $($4)
+ Set DoConfig = $($5)
+ Set LanguageList = ^(LanguagesSupported, 1)
+
+ IfContains(i) $($0) NOT-IN $(LanguageList)
+ Return STATUS_NOLANGUAGE
+ EndIf
+ ;
+ ; FIXME - make sure this flag is disabled before shipping
+ ;
+ Set OldDebugControl = $(!DebugOutputControl)
+; Set !DebugOutputControl = 1
+
+ Set-Subst LF = "\n"
+
+ Read-Syms GeneralConstants
+ Read-Syms FileConstants
+ Read-Syms DialogConstants$(!STF_LANGUAGE)
+
+ IfStr(i) $(!NTN_Origination) == "NCPA"
+ Set Continue = $(OK)
+ EndIf
+
+ Read-Syms FileConstants$(!STF_LANGUAGE)
+ Detect Date
+ Set-Title $(FunctionTitle)$(Option)
+
+ Set to = Begin
+ Set from = Begin
+ Set CommonStatus = STATUS_SUCCESSFUL
+
+ EndWait
+
+;***********************************************************************
+;
+;***********************************************************************
+Begin = +
+ Set ActivateDetection = FALSE
+ IfStr(i) $(!NTN_InstallMode) == deinstall
+ Set StartLabel = RemoveAdapter
+ Else-IfStr(i) $(!NTN_InstallMode) == Update
+ Set StartLabel = UpgradeSoftware
+ Else-IfStr(i) $(!NTN_InstallMode) == bind
+ Set StartLabel = BindingAdapter
+ Else-IfStr(i) $(!NTN_InstallMode) == configure
+ Set StartLabel = ConfigureAdapter
+ Set ActivateDetection = TRUE
+ Set CommonStatus = STATUS_REBOOT
+ IfStr(i) $(ProductKeyName) == $(!NTN_RegBase)
+ Debug-Output $(InfName)": Cannot configure the EtherWORKS 3 driver software."
+ Shell $(UtilityInf),RegistryErrorString,CANNOT_CONFIGURE_SOFTWARE
+ IfInt $($ShellCode) != $(!SHELL_CODE_OK)
+ Debug-Output $(InfName)": ShellCode error: cannot get an error string."
+ GoTo ShellCodeError
+ EndIf
+ Set Error = $($R0)
+ Set from = end
+ Set to = end
+ GoTo NonFatalInfo
+ EndIf
+ Else
+ Set StartLabel = InstallAdapter
+ Set ActivateDetection = TRUE
+ Set OEM_ABANDON_OPTIONS = {}
+ Set OEM_ABANDON_SOFTWARE = FALSE
+ Set OEM_ABANDON_ON = TRUE
+ EndIf
+
+ Debug-Output $(InfName)": =================================================="
+ Debug-Output $(InfName)": STF_CWDIR is: "$(!STF_CWDIR)
+ Debug-Output $(InfName)": STF_LANGUAGE is: "$(!STF_LANGUAGE)
+ Debug-Output $(InfName)": Option is: "$(Option)
+ Debug-Output $(InfName)": !STF_NCDETECT is: "$(!STF_NCDETECT)
+ Debug-Output $(InfName)": !STF_NCOPTION is: "$(!STF_NCOPTION)
+ Debug-Output $(InfName)": !STF_NCDETCARD is: "$(!STF_NCDETCARD)
+ Debug-Output $(InfName)": !STF_NCDETINFO is: "$(!STF_NCDETINFO)
+ Debug-Output $(InfName)": =================================================="
+
+ Set DetectedCard = FALSE
+ IfStr(i) $(ActivateDetection) != TRUE
+ GoTo $(StartLabel)
+ EndIf
+
+ Debug-Output $(InfName)": Calling Param_SetDefaults"
+ Shell $(ParamInf) Param_SetDefaults {}
+
+ Shell $(ParamInf) HexListFromDecList $(RAM_Addr_List)
+ Set RAM_Hex_List = $($R0)
+
+ IfStr(i) $(!STF_NCDETECT) == YES
+ IfStr(i) $(!STF_NCOPTION) == $(Option)
+ Set DetectedCard = TRUE
+ Debug-Output $(InfName)": Setting DetectedCard to TRUE"
+ EndIf
+ EndIf
+
+ Shell "" DebugConfiguration "After parameter querying"
+ Set from = FatalError
+ Set to = FatalError
+ GoTo $(StartLabel)
+
+;***********************************************************************
+;
+;***********************************************************************
+InstallAdapter = +
+ OpenRegKey $(!REG_H_LOCAL) "" $(ProductKeyName) $(MAXIMUM_ALLOWED) KeyProduct
+ IfStr $(KeyProduct) != $(KeyNull)
+ CloseRegKey $(KeyProduct)
+ IfStr(i) !(NTN_RegBase) == $(ProductKeyName)
+ Shell $(UtilityInf), VerExistedDlg, $(ProductSoftwareTitle),+
+ $(ProductVersion)
+ IfInt $($ShellCode) != $(!SHELL_CODE_OK)
+ Debug-Output $(InfName)": ShellCode error: cannot get an error string."
+ GoTo ShellCodeError
+ EndIf
+ GoTo end
+ Else
+ Shell $(UtilityInf), CardExistedDlg
+ IfInt $($ShellCode) != $(!SHELL_CODE_OK)
+ Debug-Output $(InfName)": ShellCode error: cannot get an error string."
+ GoTo ShellCodeError
+ EndIf
+ IfStr(i) $($R1) != "OK"
+ Set CommonStatus = STATUS_USERCANCEL
+ GoTo end
+ EndIf
+ Set OldVersionExisted = $(TRUE)
+ EndIf
+ EndIf
+
+ Set CurrParamSettings = {}
+ IfStr(i) $(DetectedCard) != TRUE
+ GoTo AdapterSetup
+ EndIf
+
+ StartWait
+ Shell $(ParamInf) Param_QueryCard $(!STF_NCDETCARD)
+ EndWait
+
+ IfStr(i) $($R0) != STATUS_SUCCESSFUL
+ GoTo AdapterSetup
+ EndIf
+
+ Set DetectedParams = $($R1)
+ Debug-Output $(InfName)": Calling Param_SetDefaults to merge detected params"
+ Shell $(ParamInf) Param_SetDefaults $(DetectedParams)
+ GoTo AdapterSetup
+
+;***********************************************************************
+;
+;***********************************************************************
+ConfigureAdapter = +
+ IfStr $(KeyProduct) == $(KeyNull)
+ OpenRegKey $(!REG_H_LOCAL) "" $(!NTN_RegBase) $(MAXIMUM_ALLOWED) KeyProduct
+ IfStr $(KeyProduct) == $(KeyNull)
+ Set RegistryErrorIndex = CANNOT_FIND_COMPONENT_SERVICE
+ Debug-Output $(InfName)": Cannot find component product key"
+ GoTo FatalRegistry
+ EndIf
+ EndIf
+
+ Debug-Output $(InfName)": Shelling to FindService"
+ Shell $(UtilityInf) FindService, $(KeyProduct)
+ IfInt $($ShellCode) != $(!SHELL_CODE_OK)
+ Debug-Output $(InfName)": FindService shell failure"
+ GoTo ShellCodeError
+ EndIf
+ IfStr(i) $($R0) != NO_ERROR
+ Debug-Output $(InfName)": FindService Shell error: "$($R0)
+ GoTo FatalRegistry
+ EndIf
+
+ Set KeyParameters = $($R2)
+ CloseRegKey $($R1)
+ IfStr $(KeyParameters) == $(KeyNull)
+ Set RegistryErrorIndex = CANNOT_FIND_COMPONENT_SERVICE
+ Debug-Output $(InfName)": Cannot find component service"
+ GoTo FatalRegistry
+ EndIf
+
+ Set OldVersionExisted = $(TRUE)
+ Set ValueName = ""
+ Set ValueData = ""
+ Set ValueStr = ""
+ Set ValueList = {}
+ EnumRegValue $(KeyParameters) ValueList
+ ForListDo $(ValueList)
+ Set ValueItem = $($)
+ Set ValueName = *($(ValueItem),1)
+ Set ValueData = *($(ValueItem),4)
+ Debug-Output $(InfName)": "$(ValueName)"="$(ValueData)
+ IfStr(i) $(ValueName) == "AddressList"
+ Set TapiAddressList = $(ValueData)
+ Else-IfStr(i) $(ValueName) == "RamBaseAddress"
+ Set RamBaseAddress = $(ValueData)
+ Else-IfStr(i) $(ValueName) == "InterruptNumber"
+ Set InterruptNumber = $(ValueData)
+ Else-IfStr(i) $(ValueName) == "LineType"
+ Set LineType = $(ValueData)
+ Else-IfStr(i) $(ValueName) == "LineRate"
+ Set LineRate = $(ValueData)
+ Else-IfStr(i) $(ValueName) == "BusNumber"
+ Set BusNumber = $(ValueData)
+ Else-IfStr(i) $(ValueName) == "BusType"
+ Set BusType = $(ValueData)
+ EndIf
+ EndForListDo
+ Shell $(ParamInf) Param_SaveValues
+ Set CurrParamSettings = $($R0)
+
+;***********************************************************************
+;
+;***********************************************************************
+AdapterSetup = +
+ Shell "" DebugConfiguration "before displaying dialog"
+ Set from = AdapterOptions
+ Set InterruptNumber = *($(IRQ_List), ~($(IRQ_List),$(InterruptNumber)))
+ Set RAM_Hex_Value = *($(RAM_Hex_List), ~($(RAM_Addr_List),$(RamBaseAddress)))
+ Set RateString = *($(Rate_Strings), ~($(Line_Rates),$(LineRate)))
+ Shell $(ParamInf) Param_ParameterConfidence
+ IfStr(i) $($R0) != STATUS_SUCCESSFUL
+ Debug-Output $(InfName)": parameter confidence too low to bypass configuration"
+ GoTo AdapterOptions
+ EndIf
+ IfStr(i) $(DetectedCard) == TRUE
+ IfStr(i) $(!STF_INSTALL_MODE) != CUSTOM
+ GoTo AdapterVerify
+ EndIf
+ EndIf
+
+;***********************************************************************
+;
+;***********************************************************************
+AdapterOptions = +
+ Read-Syms FileDependentDlg$(!STF_LANGUAGE)
+ UI Start "InputDlg"
+ IfStr(i) $(DLGEVENT) == "CONTINUE"
+ Set InterruptNumber = $(Combo1Out)
+ Set RAM_Hex_Value = $(Combo2Out)
+ Set RamBaseAddress = *($(RAM_Addr_List), ~($(RAM_Hex_List),$(RAM_Hex_Value)))
+ Set RateString = $(Combo3Out)
+ Set LineRate = *($(Line_Rates), ~($(Rate_Strings),$(RateString)))
+ ui pop 1
+ Else-IfStr(i) $(DLGEVENT) == "BACK"
+ Set CommonStatus = STATUS_USERCANCEL
+ Debug-Output $(InfName)": Action: exit. Bye."
+ ui pop 1
+ GoTo end
+ Else
+ Debug-Output $(InfName)": Action: unknown. Bye."
+ ui pop 1
+ GoTo end
+ EndIf
+ IfStr(i) $(!STF_NCDETINFO) == {}
+ Shell $(UtilityInf),GetBusTypeDialog,$(ProductHardware$(Option)Description) $(BusType) $(BusNumber)
+ ifInt $($ShellCode) != $(!SHELL_CODE_OK)
+ Debug-Output $(InfName)": ShellCode error."
+ GoTo ShellCodeError
+ EndIf
+ Set BusType = $($R1)
+ Set BusNumber = $($R2)
+ Else
+ Set BusType = *($(!STF_NCDETINFO),5)
+ Set BusNumber = *($(!STF_NCDETINFO),6)
+ EndIf
+
+;***********************************************************************
+;
+;***********************************************************************
+AdapterVerify = +
+ Shell "" DebugConfiguration "after running dialog"
+ IfStr(i) $(DetectedCard) != TRUE
+ Shell $(ParamInf) Param_SaveValues
+ Set NewParamSettings = $($R0)
+ IfStr(i) $(CurrParamSettings) == {}
+ Set DiffParamSettings = $(NewParamSettings)
+ Else
+ Shell $(ParamInf) Param_DiffValues $(CurrParamSettings)
+ Set DiffParamSettings = $($R0)
+ EndIf
+ Debug-Output $(InfName)": Calling Param_VerifyResources"
+ Shell $(ParamInf) Param_VerifyResources $(DiffParamSettings)
+ IfStr(i) $($R0) == STATUS_SUCCESSFUL
+ Debug-Output $(InfName)": Param_VerifyResources succeeded"
+ GoTo SkipOptions
+ EndIf
+ Else
+ Set CardVerifyIndex = $(!STF_NCDETCARD)
+ Debug-Output $(InfName)": Calling Param_VerifyCard"
+ Shell $(ParamInf) Param_VerifyCard $(!STF_NCDETCARD)
+ IfStr(i) $($R0) == STATUS_SUCCESSFUL
+ Debug-Output $(InfName)": Param_VerifyCard succeeded"
+ GoTo SkipOptions
+ EndIf
+ EndIf
+
+ Set from = AdapterOptions
+ Set to = SkipOptions
+ Shell $(UtilityInf),RegistryErrorString,VERIFY_WARNING
+ IfInt $($ShellCode) != $(!SHELL_CODE_OK)
+ Debug-Output $(InfName)": ShellCode error: cannot get an error string."
+ GoTo ShellCodeError
+ EndIf
+ Set Error = $($R0)
+ GoTo WarningMsg
+
+;***********************************************************************
+;
+;***********************************************************************
+SkipOptions =+
+ IfInt $(OldVersionExisted) == $(TRUE)
+ IfStr(i) $(!NTN_InstallMode) == configure
+ GoTo WriteParameters
+ EndIf
+ EndIf
+ StartWait
+ IfInt $(OldVersionExisted) == $(FALSE)
+ IfStr(i) $(!NTN_InstallMode) == "install"
+ IfStr(i) $(DoCopy) == "YES"
+ Shell $(UtilityInf), DoAskSource, $(!STF_CWDDIR), $(SrcDir) YES
+ IfInt $($ShellCode) != $(!SHELL_CODE_OK)
+ GoTo ShellCodeError
+ Else-IfStr(i) $($R0) == STATUS_FAILED
+ Shell $(UtilityInf) RegistryErrorString "ASK_SOURCE_FAIL"
+ IfInt $($ShellCode) != $(!SHELL_CODE_OK)
+ GoTo ShellCodeError
+ EndIf
+ Set Error = $($R0)
+ GoTo FatalError
+ Else-IfStr(i) $($R0) == STATUS_USERCANCEL
+ GoTo SuccessfulOption
+ EndIf
+ Set SrcDir = $($R1)
+ EndIf
+
+ Install "Install-Option"
+ IfStr(i) $(STF_INSTALL_OUTCOME) != STF_SUCCESS
+ Shell $(UtilityInf) RegistryErrorString "UNABLE_COPY_FILE"
+ IfInt $($ShellCode) != $(!SHELL_CODE_OK)
+ GoTo ShellCodeError
+ EndIf
+ Set Error = $($R0)
+ GoTo FatalError
+ EndIf
+ EndIf
+
+ Shell $(UtilityInf), AddSoftwareComponent, $(Manufacturer), +
+ $(ProductSoftwareName), +
+ $(ProductSoftwareName), +
+ $(ProductSoftwareTitle), $(STF_CONTEXTINFNAME), +
+ $(ProductSoftwareImagePath), "kernelautostart", "NDIS", {}, "",+
+ $(NetEventDLL)
+ Set OEM_ABANDON_SOFTWARE = TRUE
+ IfInt $($ShellCode) != $(!SHELL_CODE_OK)
+ Debug-Output $(InfName)": ShellCode error"
+ GoTo ShellCodeError
+ EndIf
+ Set RegistryErrorIndex = $($R0)
+ Set KeyProduct = $($R1)
+ Set SoftNetRulesKey = $($R2)
+ CloseRegKey $($R3)
+ CloseRegKey $($R4)
+ CloseRegKey $($R5)
+
+ IfStr(i) $(RegistryErrorIndex) != NO_ERROR
+ EndWait
+ Debug-Output $(InfName)": Registry error: add software components"
+ CloseRegKey $(KeyProduct)
+ CloseRegKey $(SoftNetRulesKey)
+ GoTo FatalRegistry
+ EndIf
+
+ Set NewValueList = {{SoftwareType,$(NoTitle),$(!REG_VT_SZ),$(SoftwareType)},+
+ {MajorVersion,$(NoTitle),$(!REG_VT_DWORD),$(ProductMajorVersion)},+
+ {MinorVersion,$(NoTitle),$(!REG_VT_DWORD),$(ProductMinorVersion)},+
+ {Title,$(NoTitle),$(!REG_VT_SZ),$(ProductSoftwareTitle)},+
+ {Description,$(NoTitle),$(!REG_VT_SZ),$(ProductSoftwareDescription)},+
+ {ServiceName,$(NoTitle),$(!REG_VT_SZ),$(ProductSoftwareName)},+
+ {InstallDate,$(NoTitle),$(!REG_VT_DWORD),*($(Now),1)}}
+ Shell $(UtilityInf), AddValueList, $(KeyProduct), $(NewValueList)
+ IfInt $($ShellCode) != $(!SHELL_CODE_OK)
+ Debug-Output $(InfName)": ShellCode error."
+ GoTo ShellCodeError
+ EndIf
+ Set RegistryErrorIndex = $($R0)
+ IfStr(i) $(RegistryErrorIndex) != NO_ERROR
+ EndWait
+ Debug-Output $(InfName)": Registry error: add value list."
+ CloseRegKey $(KeyProduct)
+ CloseRegKey $(SoftNetRulesKey)
+ GoTo FatalRegistry
+ EndIf
+
+ Set NewValueList = {{type,$(NoTitle),$(!REG_VT_SZ),$(NetRuleSoftwareType)},+
+ {use,$(NoTitle),$(!REG_VT_SZ),$(NetRuleSoftwareUse)}, +
+ {bindform,$(NoTitle),$(!REG_VT_SZ),$(NetRuleSoftwareBindForm)}, +
+ {class,$(NoTitle),$(!REG_VT_MULTI_SZ),$(NetRuleSoftwareClass)}, +
+ {bindable,$(NoTitle),$(!REG_VT_MULTI_SZ),$(Bindable$(Option)Txt)}, +
+ {InfOption,$(NoTitle),$(!REG_VT_SZ),$(Option)}}
+ Shell $(UtilityInf), AddValueList, $(SoftNetRulesKey), $(NewValueList)
+ IfInt $($ShellCode) != $(!SHELL_CODE_OK)
+ Debug-Output $(InfName)": ShellCode error."
+ GoTo ShellCodeError
+ EndIf
+ Set RegistryErrorIndex = $($R0)
+ CloseRegKey $(KeyProduct)
+ CloseRegKey $(SoftNetRulesKey)
+ IfStr(i) $(RegistryErrorIndex) != NO_ERROR
+ EndWait
+ Debug-Output $(InfName)": Resgitry error: add value list."
+ GoTo FatalRegistry
+ EndIf
+ EndIf
+
+ Shell $(UtilityInf), AddHardwareComponent, $(ProductHardwareName),$(STF_CONTEXTINFNAME),$(ProductKeyName)
+ IfInt $($R4) != -1
+ Set OEM_ABANDON_OPTIONS = >($(OEM_ABANDON_OPTIONS), $(!NTN_SoftwareBase)"\Microsoft\Windows NT\CurrentVersion\NetworkCards\"$($R4))
+ EndIf
+ IfInt $($ShellCode) != $(!SHELL_CODE_OK)
+ Debug-Output $(InfName)": Cannot add hardware component"
+ GoTo ShellCodeError
+ EndIf
+ Set RegistryErrorIndex = $($R0)
+ IfStr(i) $(RegistryErrorIndex) != NO_ERROR
+ EndWait
+ Debug-Output $(InfName)": Registry error: add hardware component"
+ CloseRegKey $($R1)
+ CloseRegKey $($R2)
+ CloseRegKey $($R3)
+ GoTo FatalRegistry
+ EndIf
+
+ Set KeyParameters = $($R3)
+ Set KeyAdapterRules = $($R2)
+ Set AdapterNumber = $($R4)
+ Set NewValueList = {{Manufacturer,$(NoTitle),$(!REG_VT_SZ),$(Manufacturer)},+
+ {Title,$(NoTitle),$(!REG_VT_SZ),"["$($R4)"] "$(ProductHardware$(Option)Title)},+
+ {Description,$(NoTitle),$(!REG_VT_SZ),$(ProductHardware$(Option)Description)},+
+ {ProductName,$(NoTitle),$(!REG_VT_SZ),$(ProductHardwareName)},+
+ {ServiceName,$(NoTitle),$(!REG_VT_SZ),$($R5)},+
+ {InstallDate,$(NoTitle),$(!REG_VT_DWORD),*($(Now),1)}}
+ Shell $(UtilityInf), AddValueList, $($R1), $(NewValueList)
+ IfInt $($ShellCode) != $(!SHELL_CODE_OK)
+ Debug-Output $(InfName)": ShellCode error"
+ GoTo ShellCodeError
+ EndIf
+ CloseRegKey $($R1)
+
+;;; You need one address entry in the list for each channel on your device.
+;;; FIXME - at this point RAS requires there to be one logical line per address
+;;; FIXME - so the address (channel) number is ignored and the line number is used
+ Set TapiAddressList = {$(AdapterNumber)"-1-0"}
+ IfStr(i) $(Option) == HTDSU42
+ Set TapiAddressList = >($(TapiAddressList),$(AdapterNumber)"-2-0")
+ EndIf
+
+ Set TempProdName = """"$(ProductHardwareName)$(AdapterNumber)""""
+ Set TempBindForm = $(TempProdName)$(NetRuleHardwareBindForm)
+ Set NewValueList = {{type,$(NoTitle),$(!REG_VT_SZ),$(NetRuleHardware$(Option)Type)},+
+ {bindform,$(NoTitle),$(!REG_VT_SZ),$(TempBindForm)}, +
+ {class,$(NoTitle),$(!REG_VT_MULTI_SZ),$(NetRuleHardware$(Option)Class)}, +
+ {InfOption,$(NoTitle),$(!REG_VT_SZ),$(Option)}}
+ Shell $(UtilityInf), AddValueList, $(KeyAdapterRules), $(NewValueList)
+ IfInt $($ShellCode) != $(!SHELL_CODE_OK)
+ Debug-Output $(InfName)": ShellCode error."
+ GoTo ShellCodeError
+ EndIf
+ Set RegistryErrorIndex = $($R0)
+ IfStr(i) $(RegistryErrorIndex) != NO_ERROR
+ EndWait
+ Debug-Output $(InfName)": Resgitry error: add value list."
+ CloseRegKey $(KeyParameters)
+ CloseRegKey $(KeyAdapterRules)
+ GoTo FatalRegistry
+ EndIf
+ CloseRegKey $(KeyAdapterRules)
+
+ GoTo WriteParameters
+
+;***********************************************************************
+;
+;***********************************************************************
+WriteParameters = +
+ Set NewValueList = {+
+ {AddressList,$(NoTitle),$(!REG_VT_MULTI_SZ),$(TapiAddressList)},+
+ {BusNumber,$(NoTitle),$(!REG_VT_DWORD),$(BusNumber)},+
+ {BusType,$(NoTitle),$(!REG_VT_DWORD),$(BusType)},+
+ {DeviceName,$(NoTitle),$(!REG_VT_SZ),$(ProductHardwareName)},+
+ {InterruptNumber,$(NoTitle),$(!REG_VT_DWORD),$(InterruptNumber)},+
+ {LineType,$(NoTitle),$(!REG_VT_DWORD),$(LineType)},+
+ {LineRate,$(NoTitle),$(!REG_VT_DWORD),$(LineRate)},+
+ {MediaType,$(NoTitle),$(!REG_VT_SZ),$(TapiMediaType)},+
+ {RamBaseAddress,$(NoTitle),$(!REG_VT_DWORD),$(RamBaseAddress)}+
+ }
+;;; {DebugFlags,$(NoTitle),$(!REG_VT_DWORD),$(DebugFlags)},+
+ Shell $(UtilityInf), AddValueList, $(KeyParameters), $(NewValueList)
+ CloseRegKey $(KeyParameters)
+ IfInt $($ShellCode) != $(!SHELL_CODE_OK)
+ Debug-Output $(InfName)": ShellCode error."
+ GoTo ShellCodeError
+ EndIf
+ Set RegistryErrorIndex = $($R0)
+ IfStr(i) $(RegistryErrorIndex) != NO_ERROR
+ Debug-Output $(InfName)": Registry error: Add value list"
+ GoTo FatalRegistry
+ EndIf
+ ;
+ ; Create the HARDWARE\DEVICEMAP\TAPI DEVICES\HTDSU41 key
+ ;
+ OpenRegKey $(!REG_H_LOCAL) "" "HARDWARE\DEVICEMAP" $(MAXIMUM_ALLOWED) BaseKey
+ shell "" HtCreateRegKey $(BaseKey) "TAPI DEVICES\HTDSU41"
+ IfStr(i) $($R0) != NO_ERROR
+ Debug-Output $(InfName)": Error creating registry key!"
+ GoTo FatalRegistry
+ EndIf
+ Set TapiDeviceKey = $($R1)
+ Set NewValueList = {+
+ {Address,$(NoTitle),$(!REG_VT_MULTI_SZ),$(TapiAddressList)},+
+ {"Media Type",$(NoTitle),$(!REG_VT_SZ),$(TapiMediaType)}}
+ Shell $(UtilityInf), AddValueList, $(TapiDeviceKey), $(NewValueList)
+ IfInt $($ShellCode) != $(!SHELL_CODE_OK)
+ Debug-Output $(InfName)": ShellCode error."
+ GoTo ShellCodeError
+ EndIf
+ Set RegistryErrorIndex = $($R0)
+ IfStr(i) $(RegistryErrorIndex) != NO_ERROR
+ Debug-Output $(InfName)": Registry error: Add value list"
+ GoTo FatalRegistry
+ EndIf
+ CloseRegKey $(TapiDeviceKey)
+ CloseRegKey $(BaseKey)
+ ;
+ ; if RAS is not installed, then shell ras setup INF file to install RAS
+ ; else invoke RAS to allow user to configure RAS for Switch56.
+ ;
+ Read-Syms InvokeRasDlg$(!STF_LANGUAGE)
+ Shell "oemnsvra.inf" CheckRasInstalled
+ IfInt $($ShellCode) != $(!SHELL_CODE_OK)
+ Debug-Output $(InfName)": Error Shelling the RAS INF file oemnsvra.inf"
+ Shell "subroutn.inf" SetupMessage, $(!STF_LANGUAGE), +
+ "STATUS", $(InvokeRasError)
+ IfInt $($ShellCode) != $(!SHELL_CODE_OK)
+ GoTo ShellCodeError
+ EndIf
+ GoTo SuccessfulOption
+ EndIf
+ Set RasInstalled = $($R0)
+ Debug-Output $(InfName)": Is RAS Installed? "$(RasInstalled)
+ ;
+ ; display a message to the user that RAS setup will now be invoked
+ ;
+ IfStr(i) $(RasInstalled) == FALSE
+ Shell "subroutn.inf" SetupMessage, $(!STF_LANGUAGE), "STATUS", +
+ $(InvokeRasSetupMsg)
+ IfInt $($ShellCode) != $(!SHELL_CODE_OK)
+ GoTo SuccessfulOption
+ EndIf
+ Else
+ Shell "subroutn.inf" SetupMessage, $(!STF_LANGUAGE), "STATUS", +
+ $(InvokeRasConfigMsg)
+ IfInt $($ShellCode) != $(!SHELL_CODE_OK)
+ GoTo SuccessfulOption
+ EndIf
+ EndIf
+ ;
+ ; If this is a reconfiguration, skip the automatic call to RAS setup.
+ ;
+ IfInt $(OldVersionExisted) == $(TRUE)
+ IfStr(i) $(!NTN_InstallMode) == configure
+ GoTo SuccessfulOption
+ EndIf
+ EndIf
+ ;
+ ; Set the flags based on whether this is an IDW installation
+ ;
+ IfStr(i) $(!STF_IDW) == TRUE
+ Set AddCopy = NO
+ Set DoCopy = NO
+ Set DoConfig = NO
+ Else
+ Set AddCopy = YES
+ Set DoCopy = YES
+ Set DoConfig = YES
+ EndIf
+ ;
+ ; change the global install mode flag to configure if RAS is already installed
+ ;
+ Set SaveNTN_InstallMode = $(!NTN_InstallMode)
+ IfStr(i) $(RasInstalled) == TRUE
+ Set !NTN_InstallMode = configure
+ Else
+ Set !NTN_InstallMode = install
+ EndIf
+ ;
+ ; Override the default drive\directory selection so user can choose..
+ ;
+ Set SaveSTF_SRCDIR_OVERRIDE = $(!STF_SRCDIR_OVERRIDE)
+ Set !STF_SRCDIR_OVERRIDE = ""
+ Set RasDir = "A:\"$(!STF_PLATFORM)
+ ;
+ ; now invoke RAS setup to do the right thing
+ ;
+ Debug-Output $(InfName)": Shelling to RAS:"
+ Shell "oemnsvra.inf" InstallOption $(!STF_LANGUAGE) "RAS" $(RasDir) $(AddCopy) $(DoCopy) $(DoConfig)
+ Debug-Output $(InfName)": Back from RAS: ShellCode="$($ShellCode)
+ ;
+ ; Restore the global install flags.
+ ;
+ Set !NTN_InstallMode = $(SaveNTN_InstallMode)
+ Set !STF_SRCDIR_OVERRIDE = $(SaveSTF_SRCDIR_OVERRIDE)
+ ;
+ ; Check for RAS errors.
+ ;
+ IfInt $($ShellCode) != $(!SHELL_CODE_OK)
+ Debug-Output $(InfName)": Error Shelling the RAS INF file oemnsvra.inf"
+ Shell "subroutn.inf" SetupMessage, $(!STF_LANGUAGE), "STATUS", +
+ $(InvokeRasError)
+ IfInt $($ShellCode) != $(!SHELL_CODE_OK)
+ Debug-Output $(InfName)": Cannot run SetupMessage: ShellCode="$($ShellCode)
+ GoTo ShellCodeError
+ EndIf
+ GoTo SuccessfulOption
+ EndIf
+ ;
+ ; If RAS reports no change, warn the user that the driver may not
+ ; be configured properly.
+ ;
+ IfStr(i) $($R0) == STATUS_NO_EFFECT
+ Shell "subroutn.inf" SetupMessage, $(!STF_LANGUAGE), "STATUS", +
+ $(InvokeRasAgainMsg)
+ IfInt $($ShellCode) != $(!SHELL_CODE_OK)
+ GoTo SuccessfulOption
+ EndIf
+ EndIf
+
+ Set CommonStatus = $($R0)
+
+ GoTo SuccessfulOption
+
+;***********************************************************************
+;
+;***********************************************************************
+BindingAdapter =+
+ Set Error = "Binding: Sorry, not yet implemented."
+ GoTo FatalError
+
+;***********************************************************************
+;
+;***********************************************************************
+RemoveAdapter = +
+ IfStr(i) $(ProductKeyName) == $(!NTN_RegBase)
+ Shell $(UtilityInf), RemoveSoftwareComponent, $(Manufacturer), +
+ $(ProductSoftwareName)
+ IfInt $($ShellCode) != $(!SHELL_CODE_OK)
+ Debug-Output $(InfName)": ShellCode error"
+ GoTo ShellCodeError
+ EndIf
+ Set RegistryErrorIndex = $($R0)
+ IfStr(i) $(RegistryErrorIndex) != NO_ERROR
+ GoTo FatalRegistry
+ EndIf
+ Else
+ Shell $(UtilityInf), RemoveHardwareComponent, $(Manufacturer), +
+ $(ProductSoftwareName), $(!NTN_RegBase)
+ IfInt $($ShellCode) != $(!SHELL_CODE_OK)
+ Debug-Output $(InfName)": ShellCode error"
+ GoTo ShellCodeError
+ EndIf
+ Set RegistryErrorIndex = $($R0)
+ IfStr(i) $(RegistryErrorIndex) != NO_ERROR
+ GoTo FatalRegistry
+ EndIf
+ EndIf
+ GoTo end
+
+;***********************************************************************
+;
+;***********************************************************************
+UpgradeSoftware = +
+ IfStr(i) $(ProductKeyName) == $(!NTN_RegBase)
+ OpenRegKey $(!REG_H_LOCAL) "" $(ProductKeyName) $(MAXIMUM_ALLOWED) KeyProduct
+ IfStr $(KeyProduct) != $(KeyNull)
+ GetRegValue $(KeyProduct),"MajorVersion", VersionInfo
+ Set Version = *($(VersionInfo), 4)
+ Shell $(UtilityInf), GetInfFileNameFromRegistry, $(KeyProduct)
+ IfInt $($ShellCode) != $(!SHELL_CODE_OK)
+ Debug-Output $(InfName)": ShellCode error"
+ GoTo ShellCodeError
+ EndIf
+ Set !UG_Filename = $($R0)
+ IfStr(i) $(!UG_Filename) != ""
+ install "Install-Update"
+ IfStr(i) $(STF_INSTALL_OUTCOME) != STF_SUCCESS
+ GoTo FatalError
+ EndIf
+ EndIf
+ SetRegValue $(KeyProduct) {MajorVersion,$(NoTitle),$(!REG_VT_SZ),$(ProductMajorVersion)}
+ SetRegValue $(KeyProduct) {MinorVersion,$(NoTitle),$(!REG_VT_SZ),$(ProductMinorVersion)}
+ IfInt $(Version) != $(ProductVersion)
+ EndIf
+ CloseRegKey $(KeyProduct)
+ Else
+ GoTo FatalRegistry
+ EndIf
+ Else
+ OpenRegKey $(!REG_H_LOCAL) "" $(!NTN_RegBase) +
+ $(MAXIMUM_ALLOWED) NetworkCardKey
+ IfStr(i) $(NetworkCardKey) != $(KeyNull)
+ GetRegValue $(NetworkCardKey),"ServiceName", ServiceNameInfo
+ Set ServiceName = *($(ServiceNameInfo), 4)
+ OpenRegKey $(NetworkCardKey) "" "NetRules" +
+ $(MAXIMUM_ALLOWED) NetRuleKey
+ IfStr(i) $(NetRuleKey) != $(KeyNull)
+ Else
+ GoTo FatalRegistry
+ EndIf
+ CloseRegKey $(NetRules)
+ CloseRegKey $(NetworkCardKey)
+ Else
+ GoTo FatalRegistry
+ EndIf
+ OpenRegKey $(!REG_H_LOCAL) "" +
+ $(!NTN_ServiceBase)"\"$(ServiceName) +
+ $(MAXIMUM_ALLOWED) ServiceKey
+ IfStr(i) $(ServiceKey) != $(KeyNull)
+ CloseRegKey $(ServiceKey)
+ Else
+ GoTo FatalRegistry
+ EndIf
+ EndIf
+ GoTo end
+
+;***********************************************************************
+;
+;***********************************************************************
+SuccessfulOption = +
+ GoTo end
+
+;***********************************************************************
+;
+;***********************************************************************
+Abandon = +
+ ForListDo $(OEM_ABANDON_OPTIONS)
+ Shell $(UtilityInf), RemoveHardwareComponent, $(Manufacturer), +
+ $(ProductSoftwareName), $($)
+ IfInt $($ShellCode) != $(!SHELL_CODE_OK)
+ Debug-Output $(InfName)": ShellCode error"
+ GoTo ShellCodeError
+ EndIf
+ Set RegistryErrorIndex = $($R0)
+ IfStr(i) $(RegistryErrorIndex) != NO_ERROR
+ GoTo FatalRegistry
+ EndIf
+ EndForListDo
+ IfStr(i) $(OEM_ABANDON_SOFTWARE) == TRUE
+ Shell $(UtilityInf), RemoveSoftwareComponent, $(Manufacturer), +
+ $(ProductSoftwareName), FALSE
+ IfInt $($ShellCode) != $(!SHELL_CODE_OK)
+ Debug-Output $(InfName)": ShellCode error"
+ GoTo ShellCodeError
+ EndIf
+ Set RegistryErrorIndex = $($R0)
+ IfStr(i) $(RegistryErrorIndex) != NO_ERROR
+ GoTo FatalRegistry
+ EndIf
+ EndIf
+ GoTo end
+
+;***********************************************************************
+;
+;***********************************************************************
+WarningMsg = +
+ Shell $(subroutineinf) SetupMessage, $(!STF_LANGUAGE), "WARNING", $(Error)
+ IfInt $($ShellCode) != $(!SHELL_CODE_OK)
+ GoTo ShellCodeError
+ EndIf
+ IfStr(i) $($R1) == "OK"
+ GoTo $(to)
+ Else-IfStr(i) $($R1) == "CANCEL"
+ GoTo $(from)
+ EndIf
+ GoTo end
+
+;***********************************************************************
+;
+;***********************************************************************
+NonFatalInfo = +
+ Set Severity = STATUS
+ Set CommonStatus = STATUS_USERCANCEL
+ IfStr(i) $(Error) == ""
+ Set Severity = NONFATAL
+ Shell $(UtilityInf) RegistryErrorString "SETUP_FAIL"
+ IfInt $($ShellCode) != $(!SHELL_CODE_OK)
+ GoTo ShellCodeError
+ EndIf
+ Set Error = $($R0)
+ EndIf
+ Shell $(subroutineinf) SetupMessage, $(!STF_LANGUAGE), $(Severity), $(Error)
+ IfInt $($ShellCode) != $(!SHELL_CODE_OK)
+ GoTo ShellCodeError
+ EndIf
+ IfStr(i) $($R1) == "OK"
+ GoTo $(from)
+ EndIf
+ GoTo end
+
+;***********************************************************************
+;
+;***********************************************************************
+FatalRegistry = +
+ Shell $(UtilityInf) RegistryErrorString $(RegistryErrorIndex)
+ IfInt $($ShellCode) != $(!SHELL_CODE_OK)
+ GoTo ShellCodeError
+ EndIf
+ Set Error = $($R0)
+ GoTo FatalError
+
+;***********************************************************************
+;
+;***********************************************************************
+FatalDetect = +
+ Shell $(UtilityInf),RegistryErrorString,CANNOT_DETECT
+ IfInt $($ShellCode) != $(!SHELL_CODE_OK)
+ Debug-Output $(InfName)": ShellCode error: cannot get an error string."
+ GoTo ShellCodeError
+ EndIf
+ Set Error = $($R0)
+ GoTo FatalError
+
+;***********************************************************************
+;
+;***********************************************************************
+FatalError = +
+ IfStr(i) $(Error) == ""
+ Shell $(UtilityInf) RegistryErrorString "SETUP_FAIL"
+ IfInt $($ShellCode) != $(!SHELL_CODE_OK)
+ GoTo ShellCodeError
+ EndIf
+ Set Error = $($R0)
+ EndIf
+ Shell $(subroutineinf) SetupMessage, $(!STF_LANGUAGE), "FATAL", $(Error)
+ IfInt $($ShellCode) != $(!SHELL_CODE_OK)
+ GoTo ShellCodeError
+ EndIf
+ GoTo SetFailed
+
+;***********************************************************************
+;
+;***********************************************************************
+ShellCodeError = +
+ Set DlgType = "MessageBox"
+ Set STF_MB_TITLE = $(ShellCodeErrorTitle)
+ Set STF_MB_TEXT = $(ShellCodeErrorText)
+ Set STF_MB_TYPE = 1
+ Set STF_MB_ICON = 3
+ Set STF_MB_DEF = 1
+ UI Start "Error Message"
+ GoTo SetFailed
+
+;***********************************************************************
+;
+;***********************************************************************
+SetFailed = +
+ Set CommonStatus = STATUS_FAILED
+ IfStr(i) $(OEM_ABANDON_ON) == TRUE
+ Set OEM_ABANDON_ON = FALSE
+ GoTo Abandon
+ EndIf
+ GoTo end
+
+;***********************************************************************
+;
+;***********************************************************************
+end = +
+ Set !DebugOutputControl = $(OldDebugControl)
+ Return $(CommonStatus)
+
+;***********************************************************************
+;
+;***********************************************************************
+[HtCreateRegKey]
+ Debug-Output $(InfName)": Entering [HtCreateRegKey]"
+ Set ECR_Result = NO_ERROR
+ Set ECR_BaseKeyHandle = $($0)
+ Set ECR_NewPath = $($1)
+ Set KeyNull = ""
+ Set MAXIMUM_ALLOWED = 33554432
+
+ Debug-Output $(InfName)": HtCreateRegKey - ECR_BaseKeyHandle = "$(ECR_BaseKeyHandle)
+ Debug-Output $(InfName)": ECR_NewPath = "$(ECR_NewPath)
+ Debug-Output $(InfName)": MAXIMUM_ALLOWED = "$(MAXIMUM_ALLOWED)
+ Debug-Output $(InfName)": KeyNull = "$(KeyNull)
+
+ OpenRegKey $(ECR_BaseKeyHandle) "" $(ECR_NewPath) $(MAXIMUM_ALLOWED) +
+ ECR_BaseKey
+ Debug-Output $(InfName)": ECR_BaseKey = "$(ECR_BaseKey)
+ Debug-Output $(InfName)": OpenRegKey returned "$($R0)
+ IfStr $(ECR_BaseKey) == $(KeyNull)
+ Debug-Output $(InfName)": ECR_BaseKey == KeyNull"
+ Else
+ Debug-Output $(InfName)": ECR_BaseKey != KeyNull"
+ Set ECR_KeyHandle = $(ECR_BaseKey)
+ GoTo ECR_Return
+ EndIf
+
+ Set ECR_TmpPath = ""
+ Split-String $(ECR_NewPath) "\" ECR_PList
+ Debug-Output $(InfName)": ECR_PList = "$(ECR_PList)
+ ForListDo $(ECR_PList)
+ IfStr(i) $($) != "\"
+ IfInt $(#) == 1
+ Set ECR_TmpPath = $($)
+ Else
+ Set ECR_TmpPath = $(ECR_TmpPath)"\"$($)
+ EndIf
+ Debug-Output $(InfName)": Determining if "$(ECR_TmpPath)" exists"
+ OpenRegKey $(ECR_BaseKeyHandle) "" $(ECR_TmpPath) $(MAXIMUM_ALLOWED) ECR_BaseKey
+ IfStr $(ECR_BaseKey) == $(KeyNull)
+ Debug-Output $(InfName)": Creating "$(ECR_TmpPath)
+ CreateRegKey $(ECR_BaseKeyHandle) {$(ECR_TmpPath),0,GenericClass} "" $(MAXIMUM_ALLOWED) "" ECR_KeyHandle
+ IfStr(i) $(ECR_KeyHandle) == $(KeyNull)
+ Set ECR_Result = $($R0)
+ GoTo ECR_Return
+ EndIf
+ EndIf
+ EndIf
+ EndForListDo
+ECR_Return = +
+ Return $(ECR_Result) $(ECR_KeyHandle)
+
+;***********************************************************************
+;
+;***********************************************************************
+[DebugConfiguration]
+ Debug-Output $(!p:InfName)": **CONFIGURATION STATE: "$($0)
+ Debug-Output $(!p:InfName)": InterruptNumber is "$(!p:InterruptNumber)
+ Debug-Output $(!p:InfName)": RamBaseAddress is "$(!p:RamBaseAddress)
+ Debug-Output $(!p:InfName)": LineType is "$(!p:LineType)
+ Debug-Output $(!p:InfName)": LineRate is "$(!p:LineRate)
+ Return
+
+;***********************************************************************
+;
+;***********************************************************************
+[Install-Option]
+ Set STF_VITAL = ""
+ IfStr(i) $(AddCopy) == "YES"
+ AddSectionFilesToCopyList Files-$(Option) $(SrcDir) $(!STF_WINDOWSSYSPATH)\drivers
+ EndIf
+ IfStr(i) $(DoCopy) == "YES"
+ Set !STF_NCPA_FLUSH_COPYLIST = TRUE
+ CopyFilesInCopyList
+ EndIf
+ Exit
+
+;***********************************************************************
+;
+;***********************************************************************
+[Install-Update]
+ Set STF_VITAL = ""
+ Set STF_OVERWRITE = "VERIFYSOURCEOLDER"
+ AddSectionFilesToCopyList Files-$(Option) $(SrcDir) $(!STF_WINDOWSSYSPATH)\drivers
+ AddSectionFilesToCopyList Files-Inf $(SrcDir) $(!STF_WINDOWSSYSPATH)
+ Set !STF_NCPA_FLUSH_COPYLIST = TRUE
+ CopyFilesInCopyList
+ Exit
+
+;***********************************************************************
+;
+;***********************************************************************
+[Source Media Descriptions]
+ 1 = "Windows NT Setup Disk #1" , TAGFILE = HTDSU41.SYS
+
+;***********************************************************************
+;
+;***********************************************************************
+[ProductType]
+ STF_PRODUCT = Winnt
+ STF_PLATFORM = I386
+
+;***********************************************************************
+;
+;***********************************************************************
+[Files-Inf]
+ 1, oemsetup.inf, SIZE=1000, RENAME=$(!UG_Filename)
+
+;***********************************************************************
+;
+;***********************************************************************
+[Files-HTDSU41]
+ 1, HTDSU41.SYS, SIZE=65536
+
+;***********************************************************************
+;
+;***********************************************************************
+[LanguagesSupported]
+ ENG
+
+;***********************************************************************
+;
+;***********************************************************************
+[OptionsTextENG]
+ HTDSU41 = "HT Communications DSU41"
+; HTDSU42 = "HT Communications DSU42"
+
+;***********************************************************************
+;
+;***********************************************************************
+[FileConstantsENG]
+ ProCaption = "Windows NT Setup"
+ ProCancel = "Cancel"
+ ProCancelMsg = "Windows NT Networking is not correctly installed. "+
+ "Are you sure you want to cancel copying files?"
+ ProCancelCap = "Network Setup Message"
+ ProText1 = "Copying:"
+ ProText2 = "To:"
+
+ FunctionTitleHTDSU41 = "HT Communications DSU41 Card Setup"
+ ProductSoftwareDescription = "HT Communications DSU41 Driver"
+ ProductHardwareHTDSU41Description = "HT Communications DSU41"
+ ProductSoftwareTitle = "HT Communications DSU41 Driver"
+ ProductHardwareHTDSU41Title = "HT Communications DSU41 Adapter"
+
+ ShellCodeErrorTitle = "Error: "$(FunctionTitle)$(Option))
+ ShellCodeErrorText = "Shell Code Error."
+
+;***********************************************************************
+;
+;***********************************************************************
+[DialogConstantsENG]
+ Help = "&Help"
+ Exit = "Cancel"
+ OK = "OK"
+ HelpContext = ""
+ Continue = "Continue"
+ Cancel = "Cancel"
+
+;***********************************************************************
+;
+;***********************************************************************
+[FileDependentDlgENG]
+ DlgType = "MultiCombo"
+ DlgTemplate = "WD"
+ Caption = $(FunctionTitle)$(Option)
+
+ Combo1Label = "&IRQ Level:"
+ Combo1List = $(IRQ_List)
+ Combo1Out = $(InterruptNumber)
+
+ Combo2Label = "&RAM Base Address:"
+ Combo2List = $(RAM_Hex_List)
+ Combo2Out = $(RAM_Hex_Value)
+
+ Combo3Label = "&Transmit Rate:"
+ Combo3List = $(Rate_Strings)
+ Combo3Out = $(RateString)
+
+ ComboListItemsIn = {Combo1List, Combo2List, Combo3List}
+ ComboListItemsOut = {Combo1Out, Combo2Out, Combo3Out}
+ EditTextIn = ""
+ EditTextLim = ""
+ CBOptionsGreyed = {}
+ NotifyFields = {NO, NO, NO}
+; HelpContext = $(!IDH_DB_OEMNAD1_INS)
+
+;***********************************************************************
+;
+;***********************************************************************
+[InvokeRasDlgENG]
+ InvokeRasSetupMsg = "HT Communications DSU41 setup is complete. "+
+ "Remote Access Services (RAS) must now be installed. "+
+ "Please configure the HTDSU41Sw56 ports in RAS "+
+ "setup to enable you to use RAS over the HTDSU41."
+ InvokeRasConfigMsg = "HT Communications DSU41 setup is complete. "+
+ "Remote Access Services (RAS) setup must now be invoked. "+
+ "Please configure the HTDSU41Sw56 ports in RAS "+
+ "setup to enable you to use RAS over the HTDSU41."
+ InvokeRasAgainMsg = "HT Communications DSU41 setup is NOT complete! "+
+ "Remote Access Services (RAS) is not configured to use a "+
+ "HTDSU41Sw56 port. You must configure at least one HTDSU41Sw56 "+
+ "port in RAS setup now, or you will have reconfigure the adapter "+
+ "before running RAS configuration again later."
+ InvokeRasError = "HT Communications DSU41 setup encountered an error "+
+ "while invoking the RAS setup INF file (OEMNSVRA.INF). "+
+ "Please make sure that the file is present in the "+
+ "System32 directory and is the proper file."
+
diff --git a/private/ntos/ndis/htdsu/receive.c b/private/ntos/ndis/htdsu/receive.c
new file mode 100644
index 000000000..08ddb1ab9
--- /dev/null
+++ b/private/ntos/ndis/htdsu/receive.c
@@ -0,0 +1,199 @@
+/***************************************************************************\
+|* Copyright (c) 1994 Microsoft Corporation *|
+|* Developed for Microsoft by TriplePoint, Inc. Beaverton, Oregon *|
+|* *|
+|* This file is part of the HT Communications DSU41 WAN Miniport Driver. *|
+\***************************************************************************/
+#include "version.h"
+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+Module Name:
+
+ receive.c
+
+Abstract:
+
+ This module contains the Miniport packet receive routines.
+
+ This driver conforms to the NDIS 3.0 Miniport interface.
+
+Author:
+
+ Larry Hattery - TriplePoint, Inc. (larryh@tpi.com) Jun-94
+
+Environment:
+
+ Windows NT 3.5 kernel mode Miniport driver or equivalent.
+
+Revision History:
+
+---------------------------------------------------------------------------*/
+
+#define __FILEID__ 6 // Unique file ID for error logging
+
+#include "htdsu.h"
+
+
+VOID
+HtDsuReceivePacket(
+ IN PHTDSU_ADAPTER Adapter
+ )
+
+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+Routine Description:
+
+ This routine is called from HtDsuHandleInterrupt to handle a
+ packet receive interrupt. We enter here with interrupts enabled
+ on the adapter and the processor, but the Adapter->Lock is held.
+
+ We examine the adapter memory beginning where the adapter would have
+ stored the next packet.
+ As we find each good packet it is passed up to the protocol stack.
+ This code assumes that the receive buffer holds a single packet.
+
+ NOTE: The Adapter->Lock must be held before calling this routine.
+
+Arguments:
+
+ Adapter _ A pointer ot our adapter information structure.
+
+Return Value:
+
+ None.
+
+---------------------------------------------------------------------------*/
+
+{
+ DBG_FUNC("HtDsuReceivePacket")
+
+ NDIS_STATUS Status;
+
+ /*
+ // A pointer to our link information structure for the selected line device.
+ */
+ PHTDSU_LINK Link;
+
+ /*
+ // Holds the card line number on which the packet is received.
+ */
+ USHORT CardLine;
+
+ /*
+ // How many bytes were received in this packet.
+ */
+ USHORT BytesReceived;
+
+ /*
+ // Non-zero if there were any errors detected in the packet.
+ */
+ USHORT RxErrors;
+
+ DBG_ENTER(Adapter);
+
+ /*
+ // If the packet is good, we pass it up to the protocol stack.
+ // We just drop bad packets with no indication sent.
+ */
+ CardGetReceiveInfo(Adapter, &CardLine, &BytesReceived, &RxErrors);
+
+ /*
+ // Don't send any bad packets to the wrapper, just indicate the error.
+ */
+ if (RxErrors)
+ {
+ DBG_WARNING(Adapter, ("RxError=%Xh on line %d\n",RxErrors, CardLine));
+
+ Link = GET_LINK_FROM_CARDLINE(Adapter, CardLine);
+
+ if (RxErrors & HTDSU_CRC_ERROR)
+ {
+ LinkLineError(Link, WAN_ERROR_CRC);
+ }
+ else
+ {
+ LinkLineError(Link, WAN_ERROR_FRAMING);
+ }
+ }
+ else if (BytesReceived)
+ {
+#if DBG
+ if (Adapter->DbgFlags & (DBG_PACKETS_ON | DBG_HEADERS_ON))
+ {
+ DbgPrint("Rx:%03X:",BytesReceived);
+ if (Adapter->DbgFlags & DBG_PACKETS_ON)
+ DbgPrintData((PUCHAR)&(Adapter->AdapterRam->RxBuffer), BytesReceived+8, 0);
+ else
+ DbgPrintData((PUCHAR)&(Adapter->AdapterRam->RxBuffer), 0x10, 0);
+ }
+#endif
+ /*
+ // Is there someone up there who cares?
+ */
+ Link = GET_LINK_FROM_CARDLINE(Adapter, CardLine);
+
+ if (Link->NdisLinkContext == NULL)
+ {
+ DBG_WARNING(Adapter, ("Packet recvd on disconnected line #%d",CardLine));
+ }
+ else
+ {
+ /*
+ // We have to copy the data to a system buffer so it can be
+ // accessed one byte at a time by the protocols.
+ // The adapter memory only supports word wide access.
+ */
+ {
+ // FIXME - can I use this much stack space?
+ USHORT TempBuf[HTDSU_MAX_PACKET_SIZE / sizeof(USHORT) + 1];
+
+ READ_REGISTER_BUFFER_USHORT(
+ &Adapter->AdapterRam->RxBuffer.Data[0],
+ &TempBuf[0],
+ (UINT)((BytesReceived + 1) / sizeof(USHORT))
+ );
+
+ /*
+ // Spec sez we have to release the spinlock before calling
+ // up to indiciate the packet.
+ */
+ NdisReleaseSpinLock(&Adapter->Lock);
+
+ NdisMWanIndicateReceive(
+ &Status,
+ Adapter->MiniportAdapterHandle,
+ Link->NdisLinkContext,
+ (PUCHAR) TempBuf,
+ BytesReceived
+ );
+ }
+
+ /*
+ // Indicate receive complete if we had any that were accepted.
+ */
+ if (Status == NDIS_STATUS_SUCCESS)
+ {
+ NdisMWanIndicateReceiveComplete(
+ Adapter->MiniportAdapterHandle,
+ Link->NdisLinkContext
+ );
+ }
+ else
+ {
+ DBG_WARNING(Adapter,("NdisMWanIndicateReceive returned error 0x%X\n",
+ Status));
+ }
+
+ NdisAcquireSpinLock(&Adapter->Lock);
+ }
+ }
+
+ /*
+ // Tell the adapter we have processed this packet so it can re-use the
+ // buffer.
+ */
+ CardReceiveComplete(Adapter);
+
+ DBG_LEAVE(Adapter);
+}
+
diff --git a/private/ntos/ndis/htdsu/request.c b/private/ntos/ndis/htdsu/request.c
new file mode 100644
index 000000000..7f9dd80c1
--- /dev/null
+++ b/private/ntos/ndis/htdsu/request.c
@@ -0,0 +1,661 @@
+/***************************************************************************\
+|* Copyright (c) 1994 Microsoft Corporation *|
+|* Developed for Microsoft by TriplePoint, Inc. Beaverton, Oregon *|
+|* *|
+|* This file is part of the HT Communications DSU41 WAN Miniport Driver. *|
+\***************************************************************************/
+#include "version.h"
+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+Module Name:
+
+ request.c
+
+Abstract:
+
+ This module implements the NDIS request routines for the Miniport driver.
+ MiniportQueryInformation()
+ MiniportSetInformation()
+
+ This driver conforms to the NDIS 3.0 Miniport interface.
+
+Author:
+
+ Larry Hattery - TriplePoint, Inc. (larryh@tpi.com) Jun-94
+
+Environment:
+
+ Windows NT 3.5 kernel mode Miniport driver or equivalent.
+
+Revision History:
+
+---------------------------------------------------------------------------*/
+
+#define __FILEID__ 5 // Unique file ID for error logging
+
+#include "htdsu.h"
+
+/*
+// The following is a list of all the possible NDIS QuereyInformation requests
+// that might be directed to the miniport.
+// Comment out any that are not supported by this driver.
+*/
+static const NDIS_OID SupportedOidArray[] =
+{
+ OID_GEN_HARDWARE_STATUS,
+ OID_GEN_MEDIA_SUPPORTED,
+ OID_GEN_MEDIA_IN_USE,
+ OID_GEN_MAXIMUM_LOOKAHEAD,
+ OID_GEN_MAXIMUM_FRAME_SIZE,
+ OID_GEN_MAXIMUM_TOTAL_SIZE,
+ OID_GEN_MAC_OPTIONS,
+ OID_GEN_LINK_SPEED,
+ OID_GEN_TRANSMIT_BUFFER_SPACE,
+ OID_GEN_RECEIVE_BUFFER_SPACE,
+ OID_GEN_TRANSMIT_BLOCK_SIZE,
+ OID_GEN_RECEIVE_BLOCK_SIZE,
+ OID_GEN_VENDOR_ID,
+ OID_GEN_VENDOR_DESCRIPTION,
+ OID_GEN_DRIVER_VERSION,
+ OID_GEN_CURRENT_LOOKAHEAD,
+
+ OID_WAN_MEDIUM_SUBTYPE,
+ OID_WAN_GET_INFO,
+ OID_WAN_PERMANENT_ADDRESS,
+ OID_WAN_CURRENT_ADDRESS,
+ OID_WAN_GET_LINK_INFO,
+ OID_WAN_SET_LINK_INFO,
+#ifdef FUTURE_OIDS
+ OID_WAN_QUALITY_OF_SERVICE,
+ OID_WAN_PROTOCOL_TYPE,
+ OID_WAN_HEADER_FORMAT,
+ OID_WAN_LINE_COUNT,
+ OID_WAN_GET_BRIDGE_INFO,
+ OID_WAN_SET_BRIDGE_INFO,
+ OID_WAN_GET_COMP_INFO,
+ OID_WAN_SET_COMP_INFO,
+#endif // FUTURE_OIDS
+ 0
+};
+
+#if DBG
+
+/*
+// Make sure the following list is in the same order as the list above!
+*/
+static char *SupportedOidNames[] =
+{
+ "OID_GEN_HARDWARE_STATUS",
+ "OID_GEN_MEDIA_SUPPORTED",
+ "OID_GEN_MEDIA_IN_USE",
+ "OID_GEN_MAXIMUM_LOOKAHEAD",
+ "OID_GEN_MAXIMUM_FRAME_SIZE",
+ "OID_GEN_MAXIMUM_TOTAL_SIZE",
+ "OID_GEN_MAC_OPTIONS",
+ "OID_GEN_LINK_SPEED",
+ "OID_GEN_TRANSMIT_BUFFER_SPACE",
+ "OID_GEN_RECEIVE_BUFFER_SPACE",
+ "OID_GEN_TRANSMIT_BLOCK_SIZE",
+ "OID_GEN_RECEIVE_BLOCK_SIZE",
+ "OID_GEN_VENDOR_ID",
+ "OID_GEN_VENDOR_DESCRIPTION",
+ "OID_GEN_DRIVER_VERSION",
+ "OID_GEN_CURRENT_LOOKAHEAD",
+
+ "OID_WAN_MEDIUM_SUBTYPE",
+ "OID_WAN_GET_INFO",
+ "OID_WAN_PERMANENT_ADDRESS",
+ "OID_WAN_CURRENT_ADDRESS",
+ "OID_WAN_GET_LINK_INFO",
+ "OID_WAN_SET_LINK_INFO",
+#ifdef FUTURE_OIDS
+ "OID_WAN_QUALITY_OF_SERVICE",
+ "OID_WAN_PROTOCOL_TYPE",
+ "OID_WAN_HEADER_FORMAT",
+ "OID_WAN_LINE_COUNT",
+ "OID_WAN_GET_BRIDGE_INFO",
+ "OID_WAN_SET_BRIDGE_INFO",
+ "OID_WAN_GET_COMP_INFO",
+ "OID_WAN_SET_COMP_INFO",
+#endif // FUTURE_OIDS
+ "OID_UNKNOWN"
+};
+
+#define NUM_OID_ENTRIES (sizeof(SupportedOidArray) / sizeof(SupportedOidArray[0]))
+
+/*
+// This debug routine will lookup the printable name for the selected OID.
+*/
+char *
+HtGetOidString(NDIS_OID Oid)
+{
+ UINT i;
+
+ for (i = 0; i < NUM_OID_ENTRIES-1; i++)
+ {
+ if (SupportedOidArray[i] == Oid)
+ {
+ break;
+ }
+ }
+ return(SupportedOidNames[i]);
+}
+
+#endif // DBG
+
+/*
+// Returned from an OID_WAN_PERMANENT_ADDRESS HtDsuQueryInformation request.
+// The WAN wrapper wants the miniport to return a unique address for this
+// adapter. This is used as an ethernet address presented to the protocols.
+// The least significant bit of the first byte must not be a 1, or it could
+// be interpreted as an ethernet multicast address. If the vendor has an
+// assigned ethernet vendor code (the first 3 bytes), they should be used
+// to assure that the address does not conflict with another vendor's address.
+// The last digit is replaced during the call with the adapter instance number.
+*/
+static UCHAR HtDsuWanAddress[6] = {'H','t','D','s','u','0'};
+
+/*
+// Returned from an OID_GEN_VENDOR_ID HtDsuQueryInformation request.
+// Again, the vendor's assigned ethernet vendor code should be used if possible.
+*/
+static UCHAR HtDsuVendorID[4] = HTDSU_VENDOR_ID;
+
+/*
+// Returned from an OID_GEN_VENDOR_DESCRIPTION HtDsuQueryInformation request.
+// This is an arbitrary string which may be used by upper layers to present
+// a user friendly description of the adapter.
+*/
+static UCHAR HtDsuVendorDescription[] = HTDSU_VENDOR_DESCRPTION;
+
+
+NDIS_STATUS
+HtDsuQueryInformation(
+ IN PHTDSU_ADAPTER Adapter,
+ IN NDIS_OID Oid,
+ IN PVOID InformationBuffer,
+ IN ULONG InformationBufferLength,
+ OUT PULONG BytesWritten,
+ OUT PULONG BytesNeeded
+ )
+
+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+Functional Description:
+
+ The MiniportQueryInformation request allows the inspection of the
+ Miniport driver's capabilities and current status.
+
+ If the Miniport does not complete the call immediately (by returning
+ NDIS_STATUS_PENDING), it must call NdisMQueryInformationComplete to
+ complete the call. The Miniport controls the buffers pointed to by
+ InformationBuffer, BytesWritten, and BytesNeeded until the request
+ completes.
+
+ No other requests will be submitted to the Miniport driver until
+ this request has been completed.
+
+ Note that the wrapper will intercept all queries of the following OIDs:
+ OID_GEN_CURRENT_PACKET_FILTER,
+ OID_GEN_PROTOCOL_OPTIONS,
+ OID_802_5_CURRENT_FUNCTIONAL,
+ OID_802_3_MULTICAST_LIST,
+ OID_FDDI_LONG_MULTICAST_LIST,
+ OID_FDDI_SHORT_MULTICAST_LIST.
+
+ Interrupts are in any state during this call.
+
+Parameters:
+
+ MiniportAdapterContext _ The adapter handle passed to NdisMSetAttributes
+ during MiniportInitialize.
+
+ Oid _ The OID. (See section 7.4 of the NDIS 3.0 specification for a
+ complete description of OIDs.)
+
+ InformationBuffer _ The buffer that will receive the information.
+ (See section 7.4 of the NDIS 3.0 specification
+ for a description of the length required for each
+ OID.)
+
+ InformationBufferLength _ The length in bytes of InformationBuffer.
+
+ BytesWritten _ Returns the number of bytes written into
+ InformationBuffer.
+
+ BytesNeeded _ This parameter returns the number of additional bytes
+ needed to satisfy the OID.
+
+Return Values:
+
+ NDIS_STATUS_INVALID_DATA
+ NDIS_STATUS_INVALID_LENGTH
+ NDIS_STATUS_INVALID_OID
+ NDIS_STATUS_NOT_ACCEPTED
+ NDIS_STATUS_NOT_SUPPORTED
+ NDIS_STATUS_PENDING
+ NDIS_STATUS_RESOURCES
+ NDIS_STATUS_SUCCESS
+
+---------------------------------------------------------------------------*/
+
+{
+ DBG_FUNC("HtDsuQueryInformation")
+
+ /*
+ // Holds the status result returned by this function.
+ */
+ NDIS_STATUS Status = NDIS_STATUS_NOT_SUPPORTED;
+
+ /*
+ // Pointer to driver data to be copied back to caller's InformationBuffer
+ */
+ PVOID SourceBuffer;
+
+ /*
+ // Number of bytes to be copied from driver.
+ */
+ ULONG SourceBufferLength;
+
+ /*
+ // Most return values are long integers, so this is used to hold the
+ // return value of a constant or computed result.
+ */
+ ULONG GenericUlong = 0;
+
+ /*
+ // Like above, only short.
+ */
+ USHORT GenericUshort;
+
+ /*
+ // If this is a TAPI OID, pass it on over.
+ */
+ if ((Oid & 0xFFFFFF00L) == (OID_TAPI_ACCEPT & 0xFFFFFF00L))
+ {
+ Status = HtTapiQueryInformation(Adapter,
+ Oid,
+ InformationBuffer,
+ InformationBufferLength,
+ BytesWritten,
+ BytesNeeded
+ );
+ return (Status);
+ }
+
+ DBG_ENTER(Adapter);
+ DBG_FILTER(Adapter,DBG_REQUEST_ON,
+ ("(OID=%s=%08x)\n\t\tInfoLength=%d InfoBuffer=%Xh\n",
+ HtGetOidString(Oid),Oid,
+ InformationBufferLength,
+ InformationBuffer
+ ));
+
+ /*
+ // Initialize these once, since this is the majority of cases.
+ */
+ SourceBuffer = &GenericUlong;
+ SourceBufferLength = sizeof(ULONG);
+
+ /*
+ // Determine which OID is being requested and do the right thing.
+ // Refer to section 7.4 of the NDIS 3.0 specification for a complete
+ // description of OIDs and their return values.
+ */
+ switch (Oid)
+ {
+ case OID_GEN_HARDWARE_STATUS:
+ GenericUlong = Adapter->NeedReset ?
+ NdisHardwareStatusNotReady :
+ NdisHardwareStatusReady;
+ break;
+
+ case OID_GEN_MEDIA_SUPPORTED:
+ GenericUlong = NdisMediumWan;
+ break;
+
+ case OID_GEN_MEDIA_IN_USE:
+ GenericUlong = NdisMediumWan;
+ break;
+
+ case OID_GEN_MAXIMUM_LOOKAHEAD:
+ GenericUlong = HTDSU_MAX_LOOKAHEAD;
+ break;
+
+ case OID_GEN_MAXIMUM_FRAME_SIZE:
+ GenericUlong = HTDSU_MAX_FRAME_SIZE;
+ break;
+
+ case OID_GEN_LINK_SPEED:
+ GenericUlong = HTDSU_LINK_SPEED;
+ break;
+
+ case OID_GEN_TRANSMIT_BUFFER_SPACE:
+ GenericUlong = HTDSU_MAX_PACKET_SIZE;
+ break;
+
+ case OID_GEN_RECEIVE_BUFFER_SPACE:
+ GenericUlong = HTDSU_MAX_PACKET_SIZE;
+ break;
+
+ case OID_GEN_TRANSMIT_BLOCK_SIZE:
+ GenericUlong = HTDSU_MAX_PACKET_SIZE;
+ break;
+
+ case OID_GEN_RECEIVE_BLOCK_SIZE:
+ GenericUlong = HTDSU_MAX_PACKET_SIZE;
+ break;
+
+ case OID_GEN_VENDOR_ID:
+ SourceBuffer = HtDsuVendorID;
+ SourceBufferLength = sizeof(HtDsuVendorID);
+ break;
+
+ case OID_GEN_VENDOR_DESCRIPTION:
+ SourceBuffer = HtDsuVendorDescription;
+ SourceBufferLength = strlen(HtDsuVendorDescription) + 1;
+ break;
+
+ case OID_GEN_CURRENT_LOOKAHEAD:
+ GenericUlong = HTDSU_MAX_LOOKAHEAD;
+ break;
+
+ case OID_GEN_MAC_OPTIONS:
+ GenericUlong = NDIS_MAC_OPTION_RECEIVE_SERIALIZED |
+ NDIS_MAC_OPTION_NO_LOOPBACK |
+ NDIS_MAC_OPTION_TRANSFERS_NOT_PEND;
+ break;
+
+ case OID_GEN_DRIVER_VERSION:
+ GenericUshort = (NDIS_MAJOR_VERSION << 8) + NDIS_MINOR_VERSION;
+ SourceBuffer = &GenericUshort;
+ SourceBufferLength = sizeof(USHORT);
+ break;
+
+ case OID_GEN_MAXIMUM_TOTAL_SIZE:
+ GenericUlong = HTDSU_MAX_PACKET_SIZE;
+ break;
+
+ case OID_WAN_MEDIUM_SUBTYPE:
+ GenericUlong = NdisWanMediumSW56K;
+ break;
+
+ case OID_WAN_GET_INFO:
+ SourceBuffer = &Adapter->WanInfo;
+ SourceBufferLength = sizeof(NDIS_WAN_INFO);
+ break;
+
+ case OID_WAN_PERMANENT_ADDRESS:
+ case OID_WAN_CURRENT_ADDRESS:
+ HtDsuWanAddress[5] = Adapter->InstanceNumber + '0';
+ SourceBuffer = HtDsuWanAddress;
+ SourceBufferLength = sizeof(HtDsuWanAddress);
+ break;
+
+ case OID_WAN_GET_LINK_INFO:
+ {
+ /*
+ // The first field in the info buffer is a MiniportLinkContext
+ // which is really a pointer to an entry in our link information.
+ // If this aint so, bail out...
+ */
+ PHTDSU_LINK Link = (PHTDSU_LINK)
+ (((PNDIS_WAN_SET_LINK_INFO)InformationBuffer)->NdisLinkHandle);
+
+ if (!IS_VALID_LINK(Adapter, Link))
+ {
+ SourceBufferLength = 0;
+ Status = NDIS_STATUS_INVALID_DATA;
+ break;
+ }
+
+ DBG_NOTICE(Adapter,("Returning:\n"
+ "NdisLinkHandle = %08lX\n"
+ "MaxSendFrameSize = %08lX\n"
+ "MaxRecvFrameSize = %08lX\n"
+ "SendFramingBits = %08lX\n"
+ "RecvFramingBits = %08lX\n"
+ "SendACCM = %08lX\n"
+ "RecvACCM = %08lX\n",
+ Link->WanLinkInfo.NdisLinkHandle ,
+ Link->WanLinkInfo.MaxSendFrameSize ,
+ Link->WanLinkInfo.MaxRecvFrameSize ,
+ Link->WanLinkInfo.SendFramingBits ,
+ Link->WanLinkInfo.RecvFramingBits ,
+ Link->WanLinkInfo.SendACCM ,
+ Link->WanLinkInfo.RecvACCM ));
+
+ SourceBuffer = &(Link->WanLinkInfo);
+ SourceBufferLength = sizeof(NDIS_WAN_GET_LINK_INFO);
+ }
+ break;
+
+ default:
+ /*
+ // Unknown OID
+ */
+ Status = NDIS_STATUS_INVALID_OID;
+ SourceBufferLength = 0;
+ break;
+ }
+
+ /*
+ // Now we copy the data into the caller's buffer if there's enough room,
+ // otherwise, we report the error and tell em how much we need.
+ */
+ if (SourceBufferLength > InformationBufferLength)
+ {
+ *BytesNeeded = SourceBufferLength;
+ Status = NDIS_STATUS_INVALID_LENGTH;
+ }
+ else if (SourceBufferLength)
+ {
+ NdisMoveMemory(InformationBuffer,
+ SourceBuffer,
+ SourceBufferLength
+ );
+ *BytesNeeded = *BytesWritten = SourceBufferLength;
+ Status = NDIS_STATUS_SUCCESS;
+ }
+ else
+ {
+ *BytesNeeded = *BytesWritten = 0;
+ }
+ DBG_FILTER(Adapter,DBG_REQUEST_ON,
+ ("RETURN: Status=%Xh Needed=%d Written=%d\n",
+ Status, *BytesNeeded, *BytesWritten));
+ DBG_LEAVE(Adapter);
+
+ return (Status);
+}
+
+
+NDIS_STATUS
+HtDsuSetInformation(
+ IN PHTDSU_ADAPTER Adapter,
+ IN NDIS_OID Oid,
+ IN PVOID InformationBuffer,
+ IN ULONG InformationBufferLength,
+ OUT PULONG BytesRead,
+ OUT PULONG BytesNeeded
+ )
+
+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+Functional Description:
+
+ The MiniportSetInformation request allows for control of the Miniport
+ by changing information maintained by the Miniport driver.
+
+ Any of the settable NDIS Global Oids may be used. (see section 7.4 of
+ the NDIS 3.0 specification for a complete description of the NDIS Oids.)
+
+ If the Miniport does not complete the call immediately (by returning
+ NDIS_STATUS_PENDING), it must call NdisMSetInformationComplete to
+ complete the call. The Miniport controls the buffers pointed to by
+ InformationBuffer, BytesRead, and BytesNeeded until the request completes.
+
+ Interrupts are in any state during the call, and no other requests will
+ be submitted to the Miniport until this request is completed.
+
+Parameters:
+
+ MiniportAdapterContext _ The adapter handle passed to NdisMSetAttributes
+ during MiniportInitialize.
+
+ Oid _ The OID. (See section 7.4 of the NDIS 3.0 specification for
+ a complete description of OIDs.)
+
+ InformationBuffer _ The buffer that will receive the information.
+ (See section 7.4 of the NDIS 3.0 specification for
+ a description of the length required for each OID.)
+
+ InformationBufferLength _ The length in bytes of InformationBuffer.
+
+ BytesRead_ Returns the number of bytes read from InformationBuffer.
+
+ BytesNeeded _ This parameter returns the number of additional bytes
+ expected to satisfy the OID.
+
+Return Values:
+
+ NDIS_STATUS_INVALID_DATA
+ NDIS_STATUS_INVALID_LENGTH
+ NDIS_STATUS_INVALID_OID
+ NDIS_STATUS_NOT_ACCEPTED
+ NDIS_STATUS_NOT_SUPPORTED
+ NDIS_STATUS_PENDING
+ NDIS_STATUS_RESOURCES
+ NDIS_STATUS_SUCCESS
+
+---------------------------------------------------------------------------*/
+
+{
+ DBG_FUNC("HtDsuSetInformation")
+
+ /*
+ // Holds the status result returned by this function.
+ */
+ NDIS_STATUS Status;
+
+ /*
+ // If this is a TAPI OID, pass it on over.
+ */
+ if ((Oid & 0xFFFFFF00L) == (OID_TAPI_ACCEPT & 0xFFFFFF00L))
+ {
+ Status = HtTapiSetInformation(Adapter,
+ Oid,
+ InformationBuffer,
+ InformationBufferLength,
+ BytesRead,
+ BytesNeeded
+ );
+ return (Status);
+ }
+
+ DBG_ENTER(Adapter);
+ DBG_FILTER(Adapter,DBG_REQUEST_ON,
+ ("(OID=%s=%08x)\n\t\tInfoLength=%d InfoBuffer=%Xh\n",
+ HtGetOidString(Oid),Oid,
+ InformationBufferLength,
+ InformationBuffer
+ ));
+
+ /*
+ // Assume no extra bytes are needed.
+ */
+ ASSERT(BytesRead && BytesNeeded);
+ *BytesRead = 0;
+ *BytesNeeded = 0;
+
+ /*
+ // Determine which OID is being requested and do the right thing.
+ */
+ switch (Oid)
+ {
+ case OID_GEN_CURRENT_LOOKAHEAD:
+ /*
+ // WAN drivers always indicate the entire packet regardless of the
+ // lookahead size. So this request should be politely ignored.
+ */
+ DBG_NOTICE(Adapter,("OID_GEN_CURRENT_LOOKAHEAD: set=%d expected=%d\n",
+ *(PULONG) InformationBuffer, HTDSU_MAX_LOOKAHEAD));
+ ASSERT(InformationBufferLength == sizeof(ULONG));
+ *BytesNeeded = *BytesRead = sizeof(ULONG);
+ Status = NDIS_STATUS_SUCCESS;
+ break;
+
+ case OID_WAN_SET_LINK_INFO:
+
+ if (InformationBufferLength == sizeof(NDIS_WAN_SET_LINK_INFO))
+ {
+ /*
+ // The first field in the info buffer is a MiniportLinkContext
+ // which is really a pointer to an entry in our WanLinkArray.
+ // If this aint so, bail out...
+ */
+ PHTDSU_LINK Link = (PHTDSU_LINK)
+ (((PNDIS_WAN_SET_LINK_INFO)InformationBuffer)->NdisLinkHandle);
+
+ if (Link == NULL)
+ {
+ Status = NDIS_STATUS_INVALID_DATA;
+ break;
+ }
+
+ ASSERT(Link->WanLinkInfo.NdisLinkHandle == Link);
+ ASSERT(Link->WanLinkInfo.MaxSendFrameSize <= Adapter->WanInfo.MaxFrameSize);
+ ASSERT(Link->WanLinkInfo.MaxRecvFrameSize <= Adapter->WanInfo.MaxFrameSize);
+ ASSERT(!(Link->WanLinkInfo.SendFramingBits & ~Adapter->WanInfo.FramingBits));
+ ASSERT(!(Link->WanLinkInfo.RecvFramingBits & ~Adapter->WanInfo.FramingBits));
+
+ /*
+ // Copy the data into our WanLinkInfo sturcture.
+ */
+ NdisMoveMemory(&(Link->WanLinkInfo),
+ InformationBuffer,
+ InformationBufferLength
+ );
+ *BytesRead = sizeof(NDIS_WAN_SET_LINK_INFO);
+ Status = NDIS_STATUS_SUCCESS;
+
+ DBG_NOTICE(Adapter,("\n setting expected\n"
+ "NdisLinkHandle = %08lX=?=%08lX\n"
+ "MaxSendFrameSize = %08lX=?=%08lX\n"
+ "MaxRecvFrameSize = %08lX=?=%08lX\n"
+ "SendFramingBits = %08lX=?=%08lX\n"
+ "RecvFramingBits = %08lX=?=%08lX\n"
+ "SendACCM = %08lX=?=%08lX\n"
+ "RecvACCM = %08lX=?=%08lX\n",
+ Link->WanLinkInfo.NdisLinkHandle , Link,
+ Link->WanLinkInfo.MaxSendFrameSize , Adapter->WanInfo.MaxFrameSize,
+ Link->WanLinkInfo.MaxRecvFrameSize , Adapter->WanInfo.MaxFrameSize,
+ Link->WanLinkInfo.SendFramingBits , Adapter->WanInfo.FramingBits,
+ Link->WanLinkInfo.RecvFramingBits , Adapter->WanInfo.FramingBits,
+ Link->WanLinkInfo.SendACCM , Adapter->WanInfo.DesiredACCM,
+ Link->WanLinkInfo.RecvACCM , Adapter->WanInfo.DesiredACCM));
+ }
+ else
+ {
+ DBG_WARNING(Adapter, ("OID_WAN_SET_LINK_INFO: Invalid size:%d expected:%d\n",
+ InformationBufferLength, sizeof(NDIS_WAN_SET_LINK_INFO)));
+ Status = NDIS_STATUS_INVALID_LENGTH;
+ }
+ *BytesNeeded = sizeof(NDIS_WAN_SET_LINK_INFO);
+ break;
+
+ default:
+ /*
+ // Unknown OID
+ */
+ Status = NDIS_STATUS_INVALID_OID;
+ break;
+ }
+ DBG_FILTER(Adapter,DBG_REQUEST_ON,
+ ("RETURN: Status=%Xh Needed=%d Read=%d\n",
+ Status, *BytesNeeded, *BytesRead));
+ DBG_LEAVE(Adapter);
+
+ return (Status);
+}
+
diff --git a/private/ntos/ndis/htdsu/send.c b/private/ntos/ndis/htdsu/send.c
new file mode 100644
index 000000000..575983bf0
--- /dev/null
+++ b/private/ntos/ndis/htdsu/send.c
@@ -0,0 +1,502 @@
+/***************************************************************************\
+|* Copyright (c) 1994 Microsoft Corporation *|
+|* Developed for Microsoft by TriplePoint, Inc. Beaverton, Oregon *|
+|* *|
+|* This file is part of the HT Communications DSU41 WAN Miniport Driver. *|
+\***************************************************************************/
+#include "version.h"
+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+Module Name:
+
+ send.c
+
+Abstract:
+
+ This module contains the Miniport packet send routines.
+
+ This driver conforms to the NDIS 3.0 Miniport interface.
+
+Author:
+
+ Larry Hattery - TriplePoint, Inc. (larryh@tpi.com) Jun-94
+
+Environment:
+
+ Windows NT 3.5 kernel mode Miniport driver or equivalent.
+
+Revision History:
+
+---------------------------------------------------------------------------*/
+
+#define __FILEID__ 7 // Unique file ID for error logging
+
+#include "htdsu.h"
+
+
+STATIC
+BOOLEAN
+QueueForTransmit(
+ IN PHTDSU_ADAPTER Adapter,
+ IN PNDIS_WAN_PACKET Packet
+ );
+
+STATIC
+VOID
+HtDsuTransmitFrame(
+ IN PHTDSU_ADAPTER Adapter
+ );
+
+
+NDIS_STATUS
+HtDsuWanSend(
+ IN NDIS_HANDLE MacBindingHandle,
+ IN PHTDSU_LINK Link,
+ IN PNDIS_WAN_PACKET Packet
+ )
+
+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+Functional Description:
+
+ The Ndis(M)WanSend instructs a WAN driver to transmit a packet through the
+ adapter onto the medium.
+
+ Ownership of both the packet descriptor and the packet data is transferred
+ to the WAN driver until the request is completed, either synchronously or
+ asynchronously. If the WAN driver returns a status other than
+ NDIS_STATUS_PENDING, then the request is complete, and ownership of the
+ packet immediately reverts to the protocol. If the WAN driver returns
+ NDIS_STATUS_PENDING, then the WAN driver must later indicate completion
+ of the request by calling Ndis(M)WanSendComplete.
+
+ The WAN driver should NOT return a status of NDIS_STATUS_RESOURCES to
+ indicate that there are not enough resources available to process the
+ transmit. Instead, the miniport should queue the send for a later time
+ or lower the MaxTransmits value.
+
+ The WAN miniport can NOT call NdisMSendResourcesAvailable.
+
+ The packet passed in Ndis(M)WanSend will contain simple HDLC PPP framing
+ if PPP framing is set. For SLIP or RAS framing, the packet contains only
+ the data portion with no framing whatsoever.
+
+ A WAN driver must NOT provide software loopback or promiscuous mode
+ loopback. Both of these are fully provided for in the WAN wrapper.
+
+ NOTE: The MacReservedx section as well as the WanPacketQueue section of
+ the NDIS_WAN_PACKET is fully available for use by the WAN driver.
+
+ Interrupts are in any state during this routine.
+
+Parameters:
+
+ MacBindingHandle _ The handle to be passed to NdisMWanSendComplete().
+
+ NdisLinkHandle _ The Miniport link handle passed to NDIS_LINE_UP
+
+ WanPacket _ A pointer to the NDIS_WAN_PACKET strucutre. The structure
+ contains a pointer to a contiguous buffer with guaranteed
+ padding at the beginning and end. The driver may manipulate
+ the buffer in any way.
+
+ typedef struct _NDIS_WAN_PACKET
+ {
+ LIST_ENTRY WanPacketQueue;
+ PUCHAR CurrentBuffer;
+ ULONG CurrentLength;
+ PUCHAR StartBuffer;
+ PUCHAR EndBuffer;
+ PVOID ProtocolReserved1;
+ PVOID ProtocolReserved2;
+ PVOID ProtocolReserved3;
+ PVOID ProtocolReserved4;
+ PVOID MacReserved1; // Link
+ PVOID MacReserved2; // MacBindingHandle
+ PVOID MacReserved3;
+ PVOID MacReserved4;
+
+ } NDIS_WAN_PACKET, *PNDIS_WAN_PACKET;
+
+ The available header padding is simply CurrentBuffer-StartBuffer.
+ The available tail padding is EndBuffer-(CurrentBuffer+CurrentLength).
+
+Return Values:
+
+ NDIS_STATUS_INVALID_DATA
+ NDIS_STATUS_INVALID_LENGTH
+ NDIS_STATUS_INVALID_OID
+ NDIS_STATUS_NOT_ACCEPTED
+ NDIS_STATUS_NOT_SUPPORTED
+ NDIS_STATUS_PENDING
+ NDIS_STATUS_SUCCESS
+ NDIS_STATUS_FAILURE
+
+---------------------------------------------------------------------------*/
+
+{
+ DBG_FUNC("HtDsuWanSend")
+
+ /*
+ // The link is associated with the adapter with a back pointer.
+ */
+ PHTDSU_ADAPTER Adapter = Link->Adapter;
+
+ /*
+ // Tells us how many bytes are to be transmitted.
+ */
+ UINT BytesToSend = Packet->CurrentLength;
+
+ /*
+ // Holds the status that should be returned to the caller.
+ */
+ NDIS_STATUS StatusToReturn;
+
+ DBG_ENTER(Adapter);
+
+ /*
+ // We grab the spin lock on entry so we don't accidently stomp on
+ // some data structure being twiddled with by the DPC or another
+ // client thread.
+ */
+ NdisAcquireSpinLock(&Adapter->Lock);
+
+ /*
+ // Make sure the packet size is something we can deal with.
+ */
+ if ((BytesToSend == 0) || (BytesToSend > HTDSU_MAX_PACKET_SIZE))
+ {
+ DBG_ERROR(Adapter,("Bad packet size = %d\n",BytesToSend));
+ StatusToReturn = NDIS_STATUS_FAILURE;
+ }
+ /*
+ // Return if line is not connected.
+ */
+ else if (!CardStatusOnLine(Adapter, Link->CardLine))
+ {
+ DBG_ERROR(Adapter, ("Line Disconnected\n"));
+ StatusToReturn = NDIS_STATUS_FAILURE;
+ }
+ /*
+ // Return if line has been closed.
+ */
+ else if (Link->Closing || Link->CallClosing)
+ {
+ DBG_ERROR(Adapter, ("Link Closed\n"));
+ StatusToReturn = NDIS_STATUS_FAILURE;
+ }
+ else
+ {
+ /*
+ // We have to accept the frame if possible, I just want to know
+ // if somebody has lied to us...
+ */
+ if (BytesToSend > Link->WanLinkInfo.MaxSendFrameSize)
+ {
+ DBG_WARNING(Adapter,("Packet size=%d > %d\n",
+ BytesToSend, Link->WanLinkInfo.MaxSendFrameSize));
+ }
+
+ /*
+ // We'll need to use these when the transmit completes.
+ */
+ Packet->MacReserved1 = (PVOID) Link;
+ Packet->MacReserved2 = (PVOID) MacBindingHandle;
+
+ /*
+ // Place the packet in the transmit list.
+ */
+ ++Link->NumTxQueued;
+ if (QueueForTransmit(Adapter, Packet))
+ {
+ /*
+ // The queue was empty so we've gotta kick start it.
+ // Once it's going, it runs off the DPC.
+ */
+ HtDsuTransmitFrame(Adapter);
+ }
+ StatusToReturn = NDIS_STATUS_PENDING;
+ }
+
+ NdisReleaseSpinLock(&Adapter->Lock);
+
+ DBG_LEAVE(Adapter);
+
+ return StatusToReturn;
+}
+
+
+STATIC
+BOOLEAN
+QueueForTransmit(
+ IN PHTDSU_ADAPTER Adapter,
+ IN PNDIS_WAN_PACKET Packet
+ )
+
+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+Routine Description:
+
+ This routine places the packet on the transmit queue. If the queue was
+ empty to begin with TRUE is returned so the caller can kick start the
+ transmiter.
+
+ NOTE: The Adapter->Lock must be held before calling this routine.
+
+Arguments:
+
+ Adapter _ A pointer ot our adapter information structure.
+
+ Packet _ The packet that is to be transmitted.
+
+Return Value:
+
+ TRUE if this is the only entry in the list; FALSE otherwise.
+
+---------------------------------------------------------------------------*/
+
+{
+ DBG_FUNC("QueueForTransmit")
+
+ /*
+ // Note if the list is empty to begin with.
+ */
+ BOOLEAN ListWasEmpty;
+
+ DBG_ENTER(Adapter);
+ DBG_FILTER(Adapter, DBG_PARAMS_ON, ("(Packet=0x%08x)\n", Packet));
+
+ /*
+ // Place the packet on the transmit queue.
+ */
+ ListWasEmpty = IsListEmpty(&Adapter->TransmitIdleList);
+ InsertTailList(&Adapter->TransmitIdleList, &Packet->WanPacketQueue);
+
+ DBG_LEAVE(Adapter);
+
+ return (ListWasEmpty);
+}
+
+
+STATIC
+VOID
+HtDsuTransmitFrame(
+ IN PHTDSU_ADAPTER Adapter
+ )
+
+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+Routine Description:
+
+ This routine removes an entry from the TransmitIdleList and places the
+ packet on the adapter and starts transmision. The packet is then placed
+ on the TransmitBusyList to await a transmit complete interrupt.
+
+ NOTE: The Adapter->Lock must be held before calling this routine.
+
+Arguments:
+
+ Adapter _ A pointer ot our adapter information structure.
+
+Return Value:
+
+ None.
+
+---------------------------------------------------------------------------*/
+
+{
+ DBG_FUNC("HtDsuTransmitFrame")
+
+ /*
+ // A pointer to our link information structure for the selected line device.
+ */
+ PHTDSU_LINK Link;
+
+ /*
+ // Holds the packet being transmitted.
+ */
+ PNDIS_WAN_PACKET Packet;
+
+ /*
+ // Tells us how many bytes are to be transmitted.
+ */
+ USHORT BytesToSend;
+
+ DBG_ENTER(Adapter);
+
+ /*
+ // This might be called when no packets are queued!
+ */
+ if (!IsListEmpty(&Adapter->TransmitIdleList) &&
+ !(Adapter->TransmitInProgress))
+ {
+ Adapter->TransmitInProgress = TRUE;
+
+ /*
+ // The TransmitIdleList contains a list of packets waiting to be
+ // transmitted.
+ */
+ Packet = (PNDIS_WAN_PACKET)RemoveHeadList(&Adapter->TransmitIdleList);
+ DBG_FILTER(Adapter,DBG_PARAMS_ON,("(Packet=0x%08x)\n",Packet));
+
+ Link = (PHTDSU_LINK) Packet->MacReserved1;
+
+ BytesToSend = (USHORT) Packet->CurrentLength;
+
+ /*
+ // Move the packet data into our mapped memory buffer on the card.
+ */
+ WRITE_REGISTER_BUFFER_USHORT(
+ &Adapter->AdapterRam->TxBuffer.Data[0],
+ (PUSHORT) &Packet->CurrentBuffer[0],
+ (UINT)((BytesToSend + 1) / sizeof(USHORT))
+ );
+
+ /*
+ // Set the address, length, and closing flag.
+ */
+ CardPrepareTransmit(Adapter, Link->CardLine, BytesToSend);
+
+#if DBG
+ if (Adapter->DbgFlags & (DBG_PACKETS_ON | DBG_HEADERS_ON))
+ {
+ DbgPrint("Tx:%03X:", BytesToSend);
+ if (Adapter->DbgFlags & DBG_PACKETS_ON)
+ DbgPrintData((PUCHAR)&(Adapter->AdapterRam->TxBuffer), BytesToSend+8, 0);
+ else
+ DbgPrintData((PUCHAR)&(Adapter->AdapterRam->TxBuffer), 0x10, 0);
+ }
+#endif
+ /*
+ // Insert packet into busy queue while the adapter is sending it out.
+ */
+ InsertTailList(&Adapter->TransmitBusyList, &Packet->WanPacketQueue);
+
+ /*
+ // Tell the adapter to send the packet out.
+ */
+ CardStartTransmit(Adapter);
+ }
+
+ DBG_LEAVE(Adapter);
+}
+
+
+VOID
+HtDsuTransmitComplete(
+ IN PHTDSU_ADAPTER Adapter
+ )
+
+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+Routine Description:
+
+ This routine is called by HtDsuHandleInterrupt() to handle a transmit
+ complete interrupt. We enter here with interrupts disabled at the adapter,
+ but the Adapter->Lock is held. We walk the TransmitBusyList to find all
+ the transmits that have completed.
+
+ NOTE: The Adapter->Lock must be held before calling this routine.
+
+Arguments:
+
+ Adapter _ A pointer ot our adapter information structure.
+
+Return Value:
+
+ None.
+
+---------------------------------------------------------------------------*/
+
+{
+ DBG_FUNC("HtDsuTransmitComplete")
+
+ /*
+ // A pointer to our link information structure for the selected line device.
+ */
+ PHTDSU_LINK Link;
+
+ /*
+ // Holds the packet that's just been transmitted.
+ */
+ PNDIS_WAN_PACKET Packet;
+
+ DBG_ENTER(Adapter);
+
+ /*
+ // Since we're here, the must be a packet on the busy list,
+ // and the adapter better be done with it.
+ */
+ ASSERT(CardTransmitEmpty(Adapter));
+ if (!IsListEmpty(&Adapter->TransmitBusyList) &&
+ CardTransmitEmpty(Adapter))
+ {
+ ASSERT(Adapter->TransmitInProgress);
+
+ /*
+ // Remove the transmit from the transmit list
+ */
+ Packet = (PNDIS_WAN_PACKET)RemoveHeadList(&Adapter->TransmitBusyList);
+
+ Link = (PHTDSU_LINK) Packet->MacReserved1;
+
+ /*
+ // Indicate send complete to the wrapper, and we can't hold the
+ // spin lock when we relinquish control or we may dead-lock.
+ */
+ DBG_TRACE(Adapter);
+ NdisReleaseSpinLock(&Adapter->Lock);
+
+ NdisMWanSendComplete(
+ Link->Adapter->MiniportAdapterHandle,
+ Packet,
+ NDIS_STATUS_SUCCESS
+ );
+
+ NdisAcquireSpinLock(&Adapter->Lock);
+
+ /*
+ // If this is the last transmit queued on this link, and it has
+ // been closed, close the link and notify the protocol that the
+ // link has been closed.
+ */
+ if (--Link->NumTxQueued == 0)
+ {
+ if (Link->CallClosing)
+ {
+ HtTapiCallStateHandler(Adapter, Link, LINECALLSTATE_IDLE, 0);
+ }
+ else if (Link->Closing)
+ {
+ HtTapiLineDevStateHandler(Adapter, Link, LINEDEVSTATE_CLOSE);
+ LinkRelease(Link);
+ }
+
+ /*
+ // Indicate close complete to the wrapper.
+ // Again, let go of the spin lock!
+ */
+ NdisReleaseSpinLock(&Adapter->Lock);
+ NdisMSetInformationComplete(
+ Adapter->MiniportAdapterHandle,
+ NDIS_STATUS_SUCCESS
+ );
+ NdisAcquireSpinLock(&Adapter->Lock);
+ }
+
+ DBG_TRACE(Adapter);
+
+ /*
+ // We're all done with the controller now.
+ */
+ Adapter->TransmitInProgress = FALSE;
+ }
+
+ /*
+ // Call HtDsuTransmitFrame() to start any other pending transmits.
+ */
+ HtDsuTransmitFrame(Adapter);
+
+ DBG_LEAVE(Adapter);
+}
+
diff --git a/private/ntos/ndis/htdsu/sources b/private/ntos/ndis/htdsu/sources
new file mode 100644
index 000000000..d25544860
--- /dev/null
+++ b/private/ntos/ndis/htdsu/sources
@@ -0,0 +1,53 @@
+!IF 0
+
+Copyright (c) 1989 Microsoft Corporation
+
+Module Name:
+
+ sources.
+
+Abstract:
+
+ This file specifies the target component being built and the list of
+ sources files needed to build that component. Also specifies optional
+ compiler switches and libraries that are unique for the component being
+ built.
+
+
+NOTE: Commented description of this file is in \nt\bak\bin\sources.tpl
+
+!ENDIF
+
+MAJORCOMP=ntos
+MINORCOMP=ndis
+
+TARGETNAME=htdsu41
+TARGETPATH=$(BASEDIR)\public\sdk\lib
+TARGETTYPE=DRIVER
+
+TARGETLIBS=$(BASEDIR)\public\sdk\lib\*\ndis.lib $(BASEDIR)\public\sdk\lib\*\libc.lib
+
+INCLUDES=..\..\inc
+
+C_DEFINES=/DNDIS_MINIPORT_DRIVER
+
+SOURCES= htdsu.c \
+ card.c \
+ interrup.c \
+ link.c \
+ request.c \
+ receive.c \
+ send.c \
+ tapi.c \
+ debug.c \
+ htdsu.rc
+
+
+MSC_WARNING_LEVEL=/W3 /WX
+
+RELATIVE_DEPTH=..\..
+
+#
+# Sources file for DDK
+#
+
diff --git a/private/ntos/ndis/htdsu/tapi.c b/private/ntos/ndis/htdsu/tapi.c
new file mode 100644
index 000000000..f1622edda
--- /dev/null
+++ b/private/ntos/ndis/htdsu/tapi.c
@@ -0,0 +1,5001 @@
+/***************************************************************************\
+|* Copyright (c) 1994 Microsoft Corporation *|
+|* Developed for Microsoft by TriplePoint, Inc. Beaverton, Oregon *|
+|* *|
+|* This file is part of the HT Communications DSU41 WAN Miniport Driver. *|
+\***************************************************************************/
+#include "version.h"
+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+Module Name:
+
+ tapi.c
+
+Abstract:
+
+ This module contains all the Miniport TAPI OID processing routines. It
+ is called by the MiniportSetInformation and MiniportQueryInformation
+ routines to handle the TAPI OIDs.
+
+ This driver conforms to the NDIS 3.0 Miniport interface and provides
+ extensions to support Telephonic Services.
+
+Author:
+
+ Larry Hattery - TriplePoint, Inc. (larryh@tpi.com) Jun-94
+
+Environment:
+
+ Windows NT 3.5 kernel mode Miniport driver or equivalent.
+
+Revision History:
+
+---------------------------------------------------------------------------*/
+
+#define __FILEID__ 8 // Unique file ID for error logging
+
+#include "htdsu.h"
+
+# define TAPI_DEVICECLASS_NAME "tapi/line"
+# define TAPI_DEVICECLASS_ID 1
+# define NDIS_DEVICECLASS_NAME "ndis"
+# define NDIS_DEVICECLASS_ID 2
+
+/*
+// The following is a list of all the possible TAPI OIDs.
+*/
+const NDIS_OID TapiSupportedArray[] =
+{
+/*
+// REQUIRED TAPI SPECIFIC OIDS
+*/
+ OID_TAPI_ANSWER,
+ OID_TAPI_CLOSE,
+ OID_TAPI_CLOSE_CALL,
+ OID_TAPI_CONDITIONAL_MEDIA_DETECTION,
+ OID_TAPI_DROP,
+ OID_TAPI_GET_ADDRESS_CAPS,
+ OID_TAPI_GET_ADDRESS_ID,
+ OID_TAPI_GET_ADDRESS_STATUS,
+ OID_TAPI_GET_CALL_ADDRESS_ID,
+ OID_TAPI_GET_CALL_INFO,
+ OID_TAPI_GET_CALL_STATUS,
+ OID_TAPI_GET_DEV_CAPS,
+ OID_TAPI_GET_DEV_CONFIG,
+ OID_TAPI_GET_EXTENSION_ID,
+ OID_TAPI_GET_ID,
+ OID_TAPI_GET_LINE_DEV_STATUS,
+ OID_TAPI_MAKE_CALL,
+ OID_TAPI_OPEN,
+ OID_TAPI_PROVIDER_INITIALIZE,
+ OID_TAPI_PROVIDER_SHUTDOWN,
+ OID_TAPI_SET_APP_SPECIFIC,
+ OID_TAPI_SET_CALL_PARAMS,
+ OID_TAPI_SET_DEFAULT_MEDIA_DETECTION,
+ OID_TAPI_SET_DEV_CONFIG,
+ OID_TAPI_SET_MEDIA_MODE,
+ OID_TAPI_SET_STATUS_MESSAGES,
+/*
+// OPTIONAL TAPI SPECIFIC OIDS
+*/
+ OID_TAPI_ACCEPT,
+ OID_TAPI_CONFIG_DIALOG,
+ OID_TAPI_DEV_SPECIFIC,
+ OID_TAPI_DIAL,
+ OID_TAPI_NEGOTIATE_EXT_VERSION,
+ OID_TAPI_SECURE_CALL,
+ OID_TAPI_SELECT_EXT_VERSION,
+ OID_TAPI_SEND_USER_USER_INFO,
+};
+
+#if DBG
+
+/*
+// Make sure the following list is in the same order as the list above!
+*/
+char *TapiSupportedNames[] =
+{
+/*
+// REQUIRED TAPI SPECIFIC OIDS
+*/
+ "OID_TAPI_ANSWER",
+ "OID_TAPI_CLOSE",
+ "OID_TAPI_CLOSE_CALL",
+ "OID_TAPI_CONDITIONAL_MEDIA_DETECTION",
+ "OID_TAPI_DROP",
+ "OID_TAPI_GET_ADDRESS_CAPS",
+ "OID_TAPI_GET_ADDRESS_ID",
+ "OID_TAPI_GET_ADDRESS_STATUS",
+ "OID_TAPI_GET_CALL_ADDRESS_ID",
+ "OID_TAPI_GET_CALL_INFO",
+ "OID_TAPI_GET_CALL_STATUS",
+ "OID_TAPI_GET_DEV_CAPS",
+ "OID_TAPI_GET_DEV_CONFIG",
+ "OID_TAPI_GET_EXTENSION_ID",
+ "OID_TAPI_GET_ID",
+ "OID_TAPI_GET_LINE_DEV_STATUS",
+ "OID_TAPI_MAKE_CALL",
+ "OID_TAPI_OPEN",
+ "OID_TAPI_PROVIDER_INITIALIZE",
+ "OID_TAPI_PROVIDER_SHUTDOWN",
+ "OID_TAPI_SET_APP_SPECIFIC",
+ "OID_TAPI_SET_CALL_PARAMS",
+ "OID_TAPI_SET_DEFAULT_MEDIA_DETECTION",
+ "OID_TAPI_SET_DEV_CONFIG",
+ "OID_TAPI_SET_MEDIA_MODE",
+ "OID_TAPI_SET_STATUS_MESSAGES",
+/*
+// OPTIONAL TAPI SPECIFIC OIDS
+*/
+ "OID_TAPI_ACCEPT",
+ "OID_TAPI_CONFIG_DIALOG",
+ "OID_TAPI_DEV_SPECIFIC",
+ "OID_TAPI_DIAL",
+ "OID_TAPI_NEGOTIATE_EXT_VERSION",
+ "OID_TAPI_SECURE_CALL",
+ "OID_TAPI_SELECT_EXT_VERSION",
+ "OID_TAPI_SEND_USER_USER_INFO",
+
+ "OID_TAPI_UNKNOWN"
+};
+
+#define NUM_OID_ENTRIES (sizeof(TapiSupportedArray) / sizeof(TapiSupportedArray[0]))
+
+/*
+// This debug routine will lookup the printable name for the selected OID.
+*/
+char *
+HtTapiGetOidString(NDIS_OID Oid)
+{
+ UINT i;
+
+ for (i = 0; i < NUM_OID_ENTRIES-1; i++)
+ {
+ if (TapiSupportedArray[i] == Oid)
+ {
+ break;
+ }
+ }
+ return(TapiSupportedNames[i]);
+}
+
+#endif // DBG
+
+
+NDIS_STATUS
+HtTapiQueryInformation(
+ IN PHTDSU_ADAPTER Adapter,
+ IN NDIS_OID Oid,
+ IN PVOID InformationBuffer,
+ IN ULONG InformationBufferLength,
+ OUT PULONG BytesWritten,
+ OUT PULONG BytesNeeded
+ )
+
+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+Functional Description:
+
+ The HtTapiQueryInformation request allows for inspection of the TAPI
+ portion of the driver's capabilities and current line status.
+
+ If the Miniport does not complete the call immediately (by returning
+ NDIS_STATUS_PENDING), it must call NdisMQueryInformationComplete to
+ complete the call. The Miniport controls the buffers pointed to by
+ InformationBuffer, BytesWritten, and BytesNeeded until the request
+ completes.
+
+ No other requests will be submitted to the Miniport driver until
+ this request has been completed.
+
+ Interrupts are in any state during this call.
+
+Parameters:
+
+ MiniportAdapterContext _ The adapter handle passed to NdisMSetAttributes
+ during MiniportInitialize.
+
+ Oid _ The OID. (See section 2.2.1 of the Extensions to NDIS 3.0 Miniports
+ to support Telephonic Services specification for a complete
+ description of the OIDs.)
+
+ InformationBuffer _ The buffer that will receive the information.
+
+ InformationBufferLength _ The length in bytes of InformationBuffer.
+
+ BytesWritten _ Returns the number of bytes written into
+ InformationBuffer.
+
+ BytesNeeded _ This parameter returns the number of additional bytes
+ needed to satisfy the OID.
+
+Return Values:
+
+ NDIS_STATUS_INVALID_DATA
+ NDIS_STATUS_INVALID_LENGTH
+ NDIS_STATUS_INVALID_OID
+ NDIS_STATUS_NOT_ACCEPTED
+ NDIS_STATUS_NOT_SUPPORTED
+ NDIS_STATUS_PENDING
+ NDIS_STATUS_RESOURCES
+ NDIS_STATUS_SUCCESS
+
+---------------------------------------------------------------------------*/
+
+{
+ DBG_FUNC("HtTapiQueryInformation")
+
+ /*
+ // Assume the worst, and initialize to handle failure.
+ */
+ NDIS_STATUS Status = NDIS_STATUS_INVALID_LENGTH;
+ ULONG NumBytesNeeded = 0;
+ ULONG NumBytesWritten = 0;
+
+ DBG_ENTER(Adapter);
+ DBG_FILTER(Adapter,DBG_REQUEST_ON,
+ ("(OID=%s=%08x)\n\t\tInfoLength=%d InfoBuffer=%Xh\n",
+ HtTapiGetOidString(Oid),Oid,
+ InformationBufferLength,
+ InformationBuffer
+ ));
+
+ /*
+ // Determine which OID is being requested and do the right thing.
+ // The switch code will just call the approriate service function
+ // to do the real work, so there's not much to worry about here.
+ */
+ switch (Oid)
+ {
+ case OID_TAPI_CONFIG_DIALOG: // OPTIONAL
+ if(InformationBufferLength < sizeof(NDIS_TAPI_CONFIG_DIALOG))
+ {
+ NumBytesNeeded = sizeof(NDIS_TAPI_CONFIG_DIALOG);
+ break;
+ }
+ NumBytesWritten = NumBytesNeeded = InformationBufferLength;
+ Status = HtTapiConfigDialog(Adapter,
+ (PNDIS_TAPI_CONFIG_DIALOG) InformationBuffer);
+ break;
+
+ case OID_TAPI_DEV_SPECIFIC: // OPTIONAL
+ if(InformationBufferLength < sizeof(NDIS_TAPI_DEV_SPECIFIC))
+ {
+ NumBytesNeeded = sizeof(NDIS_TAPI_DEV_SPECIFIC);
+ break;
+ }
+ NumBytesWritten = NumBytesNeeded = InformationBufferLength;
+ Status = HtTapiDevSpecific(Adapter,
+ (PNDIS_TAPI_DEV_SPECIFIC) InformationBuffer);
+ break;
+
+ case OID_TAPI_GET_ADDRESS_CAPS:
+ if(InformationBufferLength < sizeof(NDIS_TAPI_GET_ADDRESS_CAPS))
+ {
+ NumBytesNeeded = sizeof(NDIS_TAPI_GET_ADDRESS_CAPS);
+ break;
+ }
+ NumBytesWritten = NumBytesNeeded = InformationBufferLength;
+ Status = HtTapiGetAddressCaps(Adapter,
+ (PNDIS_TAPI_GET_ADDRESS_CAPS) InformationBuffer);
+ break;
+
+ case OID_TAPI_GET_ADDRESS_ID:
+ if(InformationBufferLength < sizeof(NDIS_TAPI_GET_ADDRESS_ID))
+ {
+ NumBytesNeeded = sizeof(NDIS_TAPI_GET_ADDRESS_ID);
+ break;
+ }
+ NumBytesWritten = NumBytesNeeded = InformationBufferLength;
+ Status = HtTapiGetAddressID(Adapter,
+ (PNDIS_TAPI_GET_ADDRESS_ID) InformationBuffer);
+ break;
+
+ case OID_TAPI_GET_ADDRESS_STATUS:
+ if(InformationBufferLength < sizeof(NDIS_TAPI_GET_ADDRESS_STATUS))
+ {
+ NumBytesNeeded = sizeof(NDIS_TAPI_GET_ADDRESS_STATUS);
+ break;
+ }
+ NumBytesWritten = NumBytesNeeded = InformationBufferLength;
+ Status = HtTapiGetAddressStatus(Adapter,
+ (PNDIS_TAPI_GET_ADDRESS_STATUS) InformationBuffer);
+ break;
+
+ case OID_TAPI_GET_CALL_ADDRESS_ID:
+ if(InformationBufferLength < sizeof(NDIS_TAPI_GET_CALL_ADDRESS_ID))
+ {
+ NumBytesNeeded = sizeof(NDIS_TAPI_GET_CALL_ADDRESS_ID);
+ break;
+ }
+ NumBytesWritten = NumBytesNeeded = InformationBufferLength;
+ Status = HtTapiGetCallAddressID(Adapter,
+ (PNDIS_TAPI_GET_CALL_ADDRESS_ID) InformationBuffer);
+ break;
+
+ case OID_TAPI_GET_CALL_INFO:
+ if(InformationBufferLength < sizeof(NDIS_TAPI_GET_CALL_INFO))
+ {
+ NumBytesNeeded = sizeof(NDIS_TAPI_GET_CALL_INFO);
+ break;
+ }
+ NumBytesWritten = NumBytesNeeded = InformationBufferLength;
+ Status = HtTapiGetCallInfo(Adapter,
+ (PNDIS_TAPI_GET_CALL_INFO) InformationBuffer);
+ break;
+
+ case OID_TAPI_GET_CALL_STATUS:
+ if(InformationBufferLength < sizeof(NDIS_TAPI_GET_CALL_STATUS))
+ {
+ NumBytesNeeded = sizeof(NDIS_TAPI_GET_CALL_STATUS);
+ break;
+ }
+ NumBytesWritten = NumBytesNeeded = InformationBufferLength;
+ Status = HtTapiGetCallStatus(Adapter,
+ (PNDIS_TAPI_GET_CALL_STATUS) InformationBuffer);
+ break;
+
+ case OID_TAPI_GET_DEV_CAPS:
+ if(InformationBufferLength < sizeof(NDIS_TAPI_GET_DEV_CAPS))
+ {
+ NumBytesNeeded = sizeof(NDIS_TAPI_GET_DEV_CAPS);
+ break;
+ }
+ NumBytesWritten = NumBytesNeeded = InformationBufferLength;
+ Status = HtTapiGetDevCaps(Adapter,
+ (PNDIS_TAPI_GET_DEV_CAPS) InformationBuffer);
+ break;
+
+ case OID_TAPI_GET_DEV_CONFIG:
+ if(InformationBufferLength < sizeof(NDIS_TAPI_GET_DEV_CONFIG))
+ {
+ NumBytesNeeded = sizeof(NDIS_TAPI_GET_DEV_CONFIG);
+ break;
+ }
+ NumBytesWritten = NumBytesNeeded = InformationBufferLength;
+ Status = HtTapiGetDevConfig(Adapter,
+ (PNDIS_TAPI_GET_DEV_CONFIG) InformationBuffer);
+ break;
+
+ case OID_TAPI_GET_EXTENSION_ID:
+ if(InformationBufferLength < sizeof(NDIS_TAPI_GET_EXTENSION_ID))
+ {
+ NumBytesNeeded = sizeof(NDIS_TAPI_GET_EXTENSION_ID);
+ break;
+ }
+ NumBytesWritten = NumBytesNeeded = InformationBufferLength;
+ Status = HtTapiGetExtensionID(Adapter,
+ (PNDIS_TAPI_GET_EXTENSION_ID) InformationBuffer);
+ break;
+
+ case OID_TAPI_GET_ID:
+ if(InformationBufferLength < sizeof(NDIS_TAPI_GET_ID))
+ {
+ NumBytesNeeded = sizeof(NDIS_TAPI_GET_ID);
+ break;
+ }
+ NumBytesWritten = NumBytesNeeded = InformationBufferLength;
+ Status = HtTapiGetID(Adapter,
+ (PNDIS_TAPI_GET_ID) InformationBuffer);
+ break;
+
+ case OID_TAPI_GET_LINE_DEV_STATUS:
+ if(InformationBufferLength < sizeof(NDIS_TAPI_GET_LINE_DEV_STATUS))
+ {
+ NumBytesNeeded = sizeof(NDIS_TAPI_GET_LINE_DEV_STATUS);
+ break;
+ }
+ NumBytesWritten = NumBytesNeeded = InformationBufferLength;
+ Status = HtTapiGetLineDevStatus(Adapter,
+ (PNDIS_TAPI_GET_LINE_DEV_STATUS) InformationBuffer);
+ break;
+
+ case OID_TAPI_MAKE_CALL:
+ if(InformationBufferLength < sizeof(NDIS_TAPI_MAKE_CALL))
+ {
+ NumBytesNeeded = sizeof(NDIS_TAPI_MAKE_CALL);
+ break;
+ }
+ NumBytesWritten = NumBytesNeeded = InformationBufferLength;
+ Status = HtTapiMakeCall(Adapter,
+ (PNDIS_TAPI_MAKE_CALL) InformationBuffer);
+ break;
+
+ case OID_TAPI_NEGOTIATE_EXT_VERSION:// OPTIONAL
+ if(InformationBufferLength < sizeof(NDIS_TAPI_NEGOTIATE_EXT_VERSION))
+ {
+ NumBytesNeeded = sizeof(NDIS_TAPI_NEGOTIATE_EXT_VERSION);
+ break;
+ }
+ NumBytesWritten = NumBytesNeeded = InformationBufferLength;
+ Status = HtTapiNegotiateExtVersion(Adapter,
+ (PNDIS_TAPI_NEGOTIATE_EXT_VERSION) InformationBuffer);
+ break;
+
+ case OID_TAPI_OPEN:
+ if(InformationBufferLength < sizeof(NDIS_TAPI_OPEN))
+ {
+ NumBytesNeeded = sizeof(NDIS_TAPI_OPEN);
+ break;
+ }
+ NumBytesWritten = NumBytesNeeded = InformationBufferLength;
+ Status = HtTapiOpen(Adapter,
+ (PNDIS_TAPI_OPEN) InformationBuffer);
+ break;
+
+ case OID_TAPI_PROVIDER_INITIALIZE:
+ if(InformationBufferLength < sizeof(OID_TAPI_PROVIDER_INITIALIZE))
+ {
+ NumBytesNeeded = sizeof(OID_TAPI_PROVIDER_INITIALIZE);
+ break;
+ }
+ NumBytesWritten = NumBytesNeeded = InformationBufferLength;
+ Status = HtTapiProviderInitialize(Adapter,
+ (PNDIS_TAPI_PROVIDER_INITIALIZE) InformationBuffer);
+ break;
+
+ default:
+ /*
+ // Unknown OID
+ */
+ Status = NDIS_STATUS_INVALID_OID;
+ break;
+ }
+
+ /*
+ // Fill in the size fields before we leave as indicated by the
+ // status we are returning.
+ */
+ if (Status == NDIS_STATUS_INVALID_LENGTH)
+ {
+ *BytesNeeded = NumBytesNeeded;
+ *BytesWritten = 0;
+ }
+ else
+ {
+ *BytesNeeded = *BytesWritten = NumBytesWritten;
+ }
+ DBG_FILTER(Adapter,DBG_REQUEST_ON,
+ ("RETURN: Status=%Xh Needed=%d Written=%d\n",
+ Status, *BytesNeeded, *BytesWritten));
+
+ DBG_LEAVE(Adapter);
+
+ return (Status);
+}
+
+
+NDIS_STATUS
+HtTapiSetInformation(
+ IN PHTDSU_ADAPTER Adapter,
+ IN NDIS_OID Oid,
+ IN PVOID InformationBuffer,
+ IN ULONG InformationBufferLength,
+ OUT PULONG BytesRead,
+ OUT PULONG BytesNeeded
+ )
+
+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+Functional Description:
+
+ The HtTapiQueryInformation request allows for control of the TAPI
+ portion of the driver's settings and current line status.
+
+ If the Miniport does not complete the call immediately (by returning
+ NDIS_STATUS_PENDING), it must call NdisMSetInformationComplete to
+ complete the call. The Miniport controls the buffers pointed to by
+ InformationBuffer, BytesRead, and BytesNeeded until the request completes.
+
+ Interrupts are in any state during the call, and no other requests will
+ be submitted to the Miniport until this request is completed.
+
+Parameters:
+
+ MiniportAdapterContext _ The adapter handle passed to NdisMSetAttributes
+ during MiniportInitialize.
+
+ Oid _ The OID. (See section 2.2.2 of the Extensions to NDIS 3.0 Miniports
+ to support Telephonic Services specification for a complete
+ description of the OIDs.)
+
+ InformationBuffer _ The buffer that will receive the information.
+
+ InformationBufferLength _ The length in bytes of InformationBuffer.
+
+ BytesRead_ Returns the number of bytes read from InformationBuffer.
+
+ BytesNeeded _ This parameter returns the number of additional bytes
+ expected to satisfy the OID.
+
+Return Values:
+
+ NDIS_STATUS_INVALID_DATA
+ NDIS_STATUS_INVALID_LENGTH
+ NDIS_STATUS_INVALID_OID
+ NDIS_STATUS_NOT_ACCEPTED
+ NDIS_STATUS_NOT_SUPPORTED
+ NDIS_STATUS_PENDING
+ NDIS_STATUS_RESOURCES
+ NDIS_STATUS_SUCCESS
+
+---------------------------------------------------------------------------*/
+
+{
+ DBG_FUNC("HtTapiSetInformation")
+
+ /*
+ // Assume the worst, and initialize to handle failure.
+ */
+ NDIS_STATUS Status = NDIS_STATUS_INVALID_LENGTH;
+ ULONG NumBytesNeeded = 0;
+ ULONG NumBytesRead = 0;
+
+ DBG_ENTER(Adapter);
+ DBG_FILTER(Adapter,DBG_REQUEST_ON,
+ ("(OID=%s=%08x)\n\t\tInfoLength=%d InfoBuffer=%Xh\n",
+ HtTapiGetOidString(Oid),Oid,
+ InformationBufferLength,
+ InformationBuffer
+ ));
+
+ /*
+ // Determine which OID is being requested and do the right thing.
+ // The switch code will just call the approriate service function
+ // to do the real work, so there's not much to worry about here either.
+ */
+ switch (Oid)
+ {
+ case OID_TAPI_ACCEPT: // OPTIONAL
+ if (InformationBufferLength < sizeof(NDIS_TAPI_ACCEPT))
+ {
+ NumBytesNeeded = sizeof(NDIS_TAPI_ACCEPT);
+ break;
+ }
+ NumBytesRead = NumBytesNeeded = InformationBufferLength;
+ Status = HtTapiAccept(Adapter,
+ (PNDIS_TAPI_ACCEPT) InformationBuffer);
+ break;
+
+ case OID_TAPI_ANSWER:
+ if (InformationBufferLength < sizeof(NDIS_TAPI_ANSWER))
+ {
+ NumBytesNeeded = sizeof(NDIS_TAPI_ANSWER);
+ break;
+ }
+ NumBytesRead = NumBytesNeeded = InformationBufferLength;
+ Status = HtTapiAnswer(Adapter,
+ (PNDIS_TAPI_ANSWER) InformationBuffer);
+ break;
+
+ case OID_TAPI_CLOSE:
+ if (InformationBufferLength < sizeof(NDIS_TAPI_CLOSE))
+ {
+ NumBytesNeeded = sizeof(NDIS_TAPI_CLOSE);
+ break;
+ }
+ NumBytesRead = NumBytesNeeded = InformationBufferLength;
+ Status = HtTapiClose(Adapter,
+ (PNDIS_TAPI_CLOSE) InformationBuffer);
+ break;
+
+ case OID_TAPI_CLOSE_CALL:
+ if (InformationBufferLength < sizeof(NDIS_TAPI_CLOSE_CALL))
+ {
+ NumBytesNeeded = sizeof(NDIS_TAPI_CLOSE_CALL);
+ break;
+ }
+ NumBytesRead = NumBytesNeeded = InformationBufferLength;
+ Status = HtTapiCloseCall(Adapter,
+ (PNDIS_TAPI_CLOSE_CALL) InformationBuffer);
+ break;
+
+ case OID_TAPI_CONDITIONAL_MEDIA_DETECTION:
+ if (InformationBufferLength < sizeof(NDIS_TAPI_CONDITIONAL_MEDIA_DETECTION))
+ {
+ NumBytesNeeded = sizeof(NDIS_TAPI_CONDITIONAL_MEDIA_DETECTION);
+ break;
+ }
+ NumBytesRead = NumBytesNeeded = InformationBufferLength;
+ Status = HtTapiConditionalMediaDetection(Adapter,
+ (PNDIS_TAPI_CONDITIONAL_MEDIA_DETECTION) InformationBuffer);
+ break;
+
+ case OID_TAPI_DIAL: // OPTIONAL
+ if (InformationBufferLength < sizeof(NDIS_TAPI_DIAL))
+ {
+ NumBytesNeeded = sizeof(NDIS_TAPI_DIAL);
+ break;
+ }
+ NumBytesRead = NumBytesNeeded = InformationBufferLength;
+ Status = HtTapiDial(Adapter,
+ (PNDIS_TAPI_DIAL) InformationBuffer);
+ break;
+
+ case OID_TAPI_DROP:
+ if (InformationBufferLength < sizeof(NDIS_TAPI_DROP))
+ {
+ NumBytesNeeded = sizeof(NDIS_TAPI_DROP);
+ break;
+ }
+ NumBytesRead = NumBytesNeeded = InformationBufferLength;
+ Status = HtTapiDrop(Adapter,
+ (PNDIS_TAPI_DROP) InformationBuffer);
+ break;
+
+ case OID_TAPI_PROVIDER_SHUTDOWN:
+ if (InformationBufferLength < sizeof(NDIS_TAPI_PROVIDER_SHUTDOWN))
+ {
+ NumBytesNeeded = sizeof(NDIS_TAPI_PROVIDER_SHUTDOWN);
+ break;
+ }
+ NumBytesRead = NumBytesNeeded = InformationBufferLength;
+ Status = HtTapiProviderShutdown(Adapter,
+ (PNDIS_TAPI_PROVIDER_SHUTDOWN) InformationBuffer);
+ break;
+
+ case OID_TAPI_SECURE_CALL: // OPTIONAL
+ if (InformationBufferLength < sizeof(NDIS_TAPI_SECURE_CALL))
+ {
+ NumBytesNeeded = sizeof(NDIS_TAPI_SECURE_CALL);
+ break;
+ }
+ NumBytesRead = NumBytesNeeded = InformationBufferLength;
+ Status = HtTapiSecureCall(Adapter,
+ (PNDIS_TAPI_SECURE_CALL) InformationBuffer);
+ break;
+
+ case OID_TAPI_SELECT_EXT_VERSION: // OPTIONAL
+ if (InformationBufferLength < sizeof(NDIS_TAPI_SELECT_EXT_VERSION))
+ {
+ NumBytesNeeded = sizeof(NDIS_TAPI_SELECT_EXT_VERSION);
+ break;
+ }
+ NumBytesRead = NumBytesNeeded = InformationBufferLength;
+ Status = HtTapiSelectExtVersion(Adapter,
+ (PNDIS_TAPI_SELECT_EXT_VERSION) InformationBuffer);
+ break;
+
+ case OID_TAPI_SEND_USER_USER_INFO: // OPTIONAL
+ if (InformationBufferLength < sizeof(NDIS_TAPI_SEND_USER_USER_INFO))
+ {
+ NumBytesNeeded = sizeof(NDIS_TAPI_SEND_USER_USER_INFO);
+ break;
+ }
+ NumBytesRead = NumBytesNeeded = InformationBufferLength;
+ Status = HtTapiSendUserUserInfo(Adapter,
+ (PNDIS_TAPI_SEND_USER_USER_INFO) InformationBuffer);
+ break;
+
+ case OID_TAPI_SET_APP_SPECIFIC:
+ if (InformationBufferLength < sizeof(NDIS_TAPI_SET_APP_SPECIFIC))
+ {
+ NumBytesNeeded = sizeof(NDIS_TAPI_SET_APP_SPECIFIC);
+ break;
+ }
+ NumBytesRead = NumBytesNeeded = InformationBufferLength;
+ Status = HtTapiSetAppSpecific(Adapter,
+ (PNDIS_TAPI_SET_APP_SPECIFIC) InformationBuffer);
+ break;
+
+ case OID_TAPI_SET_CALL_PARAMS:
+ if (InformationBufferLength < sizeof(NDIS_TAPI_SET_CALL_PARAMS))
+ {
+ NumBytesNeeded = sizeof(NDIS_TAPI_SET_CALL_PARAMS);
+ break;
+ }
+ NumBytesRead = NumBytesNeeded = InformationBufferLength;
+ Status = HtTapiSetCallParams(Adapter,
+ (PNDIS_TAPI_SET_CALL_PARAMS) InformationBuffer);
+ break;
+
+ case OID_TAPI_SET_DEFAULT_MEDIA_DETECTION:
+ if (InformationBufferLength < sizeof(NDIS_TAPI_SET_DEFAULT_MEDIA_DETECTION))
+ {
+ NumBytesNeeded = sizeof(NDIS_TAPI_SET_DEFAULT_MEDIA_DETECTION);
+ break;
+ }
+ NumBytesRead = NumBytesNeeded = InformationBufferLength;
+ Status = HtTapiSetDefaultMediaDetection(Adapter,
+ (PNDIS_TAPI_SET_DEFAULT_MEDIA_DETECTION) InformationBuffer);
+ break;
+
+ case OID_TAPI_SET_DEV_CONFIG:
+ if (InformationBufferLength < sizeof(NDIS_TAPI_SET_DEV_CONFIG))
+ {
+ NumBytesNeeded = sizeof(NDIS_TAPI_SET_DEV_CONFIG);
+ break;
+ }
+ NumBytesRead = NumBytesNeeded = InformationBufferLength;
+ Status = HtTapiSetDevConfig(Adapter,
+ (PNDIS_TAPI_SET_DEV_CONFIG) InformationBuffer);
+ break;
+
+ case OID_TAPI_SET_MEDIA_MODE:
+ if (InformationBufferLength < sizeof(NDIS_TAPI_SET_MEDIA_MODE))
+ {
+ NumBytesNeeded = sizeof(NDIS_TAPI_SET_MEDIA_MODE);
+ break;
+ }
+ NumBytesRead = NumBytesNeeded = InformationBufferLength;
+ Status = HtTapiSetMediaMode(Adapter,
+ (PNDIS_TAPI_SET_MEDIA_MODE) InformationBuffer);
+ break;
+
+ case OID_TAPI_SET_STATUS_MESSAGES:
+ if (InformationBufferLength < sizeof(NDIS_TAPI_SET_STATUS_MESSAGES))
+ {
+ NumBytesNeeded = sizeof(NDIS_TAPI_SET_STATUS_MESSAGES);
+ break;
+ }
+ NumBytesRead = NumBytesNeeded = InformationBufferLength;
+ Status = HtTapiSetStatusMessages(Adapter,
+ (PNDIS_TAPI_SET_STATUS_MESSAGES) InformationBuffer);
+ break;
+
+ default:
+ Status = NDIS_STATUS_INVALID_OID;
+ break;
+ }
+
+ /*
+ // Fill in the size fields before we leave as indicated by the
+ // status we are returning.
+ */
+ if (Status == NDIS_STATUS_INVALID_LENGTH)
+ {
+ *BytesNeeded = NumBytesNeeded;
+ *BytesRead = 0;
+ }
+ else
+ {
+ *BytesNeeded = *BytesRead = NumBytesRead;
+ }
+ DBG_FILTER(Adapter,DBG_REQUEST_ON,
+ ("RETURN: Status=%Xh Needed=%d Read=%d\n",
+ Status, *BytesNeeded, *BytesRead));
+
+ DBG_LEAVE(Adapter);
+
+ return (Status);
+}
+
+
+NDIS_STATUS
+HtTapiGetID(
+ IN PHTDSU_ADAPTER Adapter,
+ IN PNDIS_TAPI_GET_ID Request
+ )
+
+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+Functional Description:
+
+ This request returns a device ID for the specified device class
+ associated with the selected line, address or call.
+
+Parameters:
+
+ Adapter _ A pointer ot our adapter information structure.
+
+ Request _ A pointer to the NDIS_TAPI request structure for this call.
+
+ typedef struct _NDIS_TAPI_GET_ID
+ {
+ IN ULONG ulRequestID;
+ IN HDRV_LINE hdLine;
+ IN ULONG ulAddressID;
+ IN HDRV_CALL hdCall;
+ IN ULONG ulSelect;
+ IN ULONG ulDeviceClassSize;
+ IN ULONG ulDeviceClassOffset;
+ OUT VAR_STRING DeviceID;
+
+ } NDIS_TAPI_GET_ID, *PNDIS_TAPI_GET_ID;
+
+ typedef struct _VAR_STRING
+ {
+ ULONG ulTotalSize;
+ ULONG ulNeededSize;
+ ULONG ulUsedSize;
+
+ ULONG ulStringFormat;
+ ULONG ulStringSize;
+ ULONG ulStringOffset;
+
+ } VAR_STRING, *PVAR_STRING;
+
+Return Values:
+
+ NDIS_STATUS_SUCCESS
+ NDIS_STATUS_FAILURE
+ NDIS_STATUS_TAPI_INVALDEVICECLASS
+ NDIS_STATUS_TAPI_INVALLINEHANDLE
+ NDIS_STATUS_TAPI_INVALADDRESSID
+ NDIS_STATUS_TAPI_INVALCALLHANDLE
+ NDIS_STATUS_TAPI_OPERATIONUNAVAIL
+
+---------------------------------------------------------------------------*/
+
+{
+ DBG_FUNC("HtTapiGetID")
+
+ /*
+ // A pointer to our link information structure for the selected line device.
+ */
+ PHTDSU_LINK Link;
+
+ /*
+ // Remember which device class is being requested.
+ */
+ UINT DeviceClass;
+
+ /*
+ // A pointer to the requested device ID, and its size in bytes.
+ */
+ PUCHAR IDPtr;
+ UINT IDLength;
+ ULONG DeviceID;
+
+ DBG_ENTER(Adapter);
+ DBG_FILTER(Adapter, DBG_PARAMS_ON,
+ ("hdLine=%Xh\n"
+ "ulAddressID=%d\n"
+ "hdCall=%Xh\n"
+ "ulSelect=%Xh\n"
+ "ulDeviceClassSize=%d\n"
+ "ulDeviceClassOffset=%Xh\n",
+ Request->hdLine,
+ Request->ulAddressID,
+ Request->hdCall,
+ Request->ulSelect,
+ Request->ulDeviceClassSize,
+ Request->ulDeviceClassOffset
+ ));
+ /*
+ // Make sure this is a tapi/line or ndis request.
+ */
+ if (_strnicmp((PCHAR) Request + Request->ulDeviceClassOffset,
+ NDIS_DEVICECLASS_NAME, Request->ulDeviceClassSize) == 0)
+ {
+ DeviceClass = NDIS_DEVICECLASS_ID;
+ }
+ else if (_strnicmp((PCHAR) Request + Request->ulDeviceClassOffset,
+ TAPI_DEVICECLASS_NAME, Request->ulDeviceClassSize) == 0)
+ {
+ DeviceClass = TAPI_DEVICECLASS_ID;
+ }
+ else
+ {
+ DBG_WARNING(Adapter, ("Returning NDIS_STATUS_TAPI_INVALDEVICECLASS\n"));
+ return (NDIS_STATUS_TAPI_INVALDEVICECLASS);
+ }
+
+ /*
+ // Find the link structure associated with the request/deviceclass.
+ */
+ if (Request->ulSelect == LINECALLSELECT_LINE)
+ {
+ Link = GET_LINK_FROM_HDLINE(Adapter, Request->hdLine);
+ if (Link == NULL)
+ {
+ DBG_WARNING(Adapter, ("Returning NDIS_STATUS_TAPI_INVALLINEHANDLE\n"));
+ return (NDIS_STATUS_TAPI_INVALLINEHANDLE);
+ }
+ if (DeviceClass == TAPI_DEVICECLASS_ID)
+ {
+ /*
+ // TAPI just wants the ulDeviceID for this line.
+ */
+ DeviceID = (ULONG) GET_DEVICEID_FROM_LINK(Adapter, Link);
+ IDLength = sizeof(DeviceID);
+ IDPtr = (PUCHAR) &DeviceID;
+ }
+ else // UNSUPPORTED DEVICE CLASS
+ {
+ DBG_WARNING(Adapter, ("Returning NDIS_STATUS_TAPI_INVALDEVICECLASS\n"));
+ return (NDIS_STATUS_TAPI_INVALDEVICECLASS);
+ }
+ }
+ else if (Request->ulSelect == LINECALLSELECT_ADDRESS)
+ {
+ Link = GET_LINK_FROM_HDLINE(Adapter, Request->hdLine);
+ if (Link == NULL)
+ {
+ DBG_WARNING(Adapter, ("Returning NDIS_STATUS_TAPI_INVALLINEHANDLE\n"));
+ return (NDIS_STATUS_TAPI_INVALLINEHANDLE);
+ }
+
+ if (Request->ulAddressID >= HTDSU_TAPI_NUM_ADDRESSES)
+ {
+ DBG_WARNING(Adapter, ("Returning NDIS_STATUS_TAPI_INVALADDRESSID\n"));
+ return (NDIS_STATUS_TAPI_INVALADDRESSID);
+ }
+
+ /*
+ // Currently, there is no defined return value for this case...
+ // This is just a place holder for future extensions.
+ */
+ DBG_WARNING(Adapter, ("Returning NDIS_STATUS_TAPI_INVALDEVICECLASS\n"));
+ return (NDIS_STATUS_TAPI_INVALDEVICECLASS);
+ }
+ else if (Request->ulSelect == LINECALLSELECT_CALL)
+ {
+ Link = GET_LINK_FROM_HDCALL(Adapter, Request->hdCall);
+ if (Link == NULL)
+ {
+ DBG_WARNING(Adapter, ("Returning NDIS_STATUS_TAPI_INVALCALLHANDLE\n"));
+ return (NDIS_STATUS_TAPI_INVALCALLHANDLE);
+ }
+ if (DeviceClass == NDIS_DEVICECLASS_ID)
+ {
+ /*
+ // This must match ConnectionWrapperID used in LINE_UP event!
+ */
+ DeviceID = (ULONG) Link->htCall;
+ IDLength = sizeof(DeviceID);
+ IDPtr = (PUCHAR) &DeviceID;
+ }
+ else // UNSUPPORTED DEVICE CLASS
+ {
+ DBG_WARNING(Adapter, ("Returning NDIS_STATUS_TAPI_INVALDEVICECLASS\n"));
+ return (NDIS_STATUS_TAPI_INVALDEVICECLASS);
+ }
+ }
+ else
+ {
+ DBG_WARNING(Adapter, ("Returning NDIS_STATUS_FAILURE\n"));
+ return (NDIS_STATUS_FAILURE);
+ }
+
+ DBG_NOTICE(Adapter, ("GETID-%d=%Xh\n",Request->ulSelect,DeviceID));
+
+ /*
+ // Now we need to adjust the variable field to place the device ID.
+ */
+ Request->DeviceID.ulNeededSize = sizeof(VAR_STRING) + IDLength;
+ if (Request->DeviceID.ulTotalSize >= Request->DeviceID.ulNeededSize)
+ {
+ Request->DeviceID.ulUsedSize = Request->DeviceID.ulNeededSize;
+ Request->DeviceID.ulStringFormat = STRINGFORMAT_BINARY;
+ Request->DeviceID.ulStringSize = IDLength;
+ Request->DeviceID.ulStringOffset = sizeof(VAR_STRING);
+
+ /*
+ // Now we return the requested ID value.
+ */
+ NdisMoveMemory(
+ (PCHAR) &Request->DeviceID + sizeof(VAR_STRING),
+ IDPtr,
+ IDLength
+ );
+ }
+
+ DBG_LEAVE(Adapter);
+
+ return (NDIS_STATUS_SUCCESS);
+}
+
+
+NDIS_STATUS
+HtTapiGetDevConfig(
+ IN PHTDSU_ADAPTER Adapter,
+ IN PNDIS_TAPI_GET_DEV_CONFIG Request
+ )
+
+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+Functional Description:
+
+ This request returns a data structure object, the contents of which are
+ specific to the line (miniport) and device class, giving the current
+ configuration of a device associated one-to-one with the line device.
+
+Parameters:
+
+ Adapter _ A pointer ot our adapter information structure.
+
+ Request _ A pointer to the NDIS_TAPI request structure for this call.
+
+ typedef struct _NDIS_TAPI_GET_DEV_CONFIG
+ {
+ IN ULONG ulRequestID;
+ IN ULONG ulDeviceID;
+ IN ULONG ulDeviceClassSize;
+ IN ULONG ulDeviceClassOffset;
+ OUT VAR_STRING DeviceConfig;
+
+ } NDIS_TAPI_GET_DEV_CONFIG, *PNDIS_TAPI_GET_DEV_CONFIG;
+
+ typedef struct _VAR_STRING
+ {
+ ULONG ulTotalSize;
+ ULONG ulNeededSize;
+ ULONG ulUsedSize;
+
+ ULONG ulStringFormat;
+ ULONG ulStringSize;
+ ULONG ulStringOffset;
+
+ } VAR_STRING, *PVAR_STRING;
+
+Return Values:
+
+ NDIS_STATUS_SUCCESS
+ NDIS_STATUS_TAPI_INVALDEVICECLASS
+ NDIS_STATUS_TAPI_NODRIVER
+
+---------------------------------------------------------------------------*/
+
+{
+ DBG_FUNC("HtTapiGetDevConfig")
+
+ /*
+ // A pointer to our link information structure for the selected line device.
+ */
+ PHTDSU_LINK Link;
+
+ /*
+ // Remember which device class is being requested.
+ */
+ UINT DeviceClass;
+
+ DBG_ENTER(Adapter);
+ DBG_FILTER(Adapter, DBG_PARAMS_ON,
+ ("ulDeviceID=%d\n"
+ "ulDeviceClassSize=%d\n"
+ "ulDeviceClassOffset=%Xh\n",
+ Request->ulDeviceID,
+ Request->ulDeviceClassSize,
+ Request->ulDeviceClassOffset
+ ));
+ /*
+ // Make sure this is a tapi/line or ndis request.
+ */
+ if (_strnicmp((PCHAR) Request + Request->ulDeviceClassOffset,
+ NDIS_DEVICECLASS_NAME, Request->ulDeviceClassSize) == 0)
+ {
+ DeviceClass = NDIS_DEVICECLASS_ID;
+ }
+ else if (_strnicmp((PCHAR) Request + Request->ulDeviceClassOffset,
+ TAPI_DEVICECLASS_NAME, Request->ulDeviceClassSize) == 0)
+ {
+ DeviceClass = TAPI_DEVICECLASS_ID;
+ }
+ else
+ {
+ DBG_WARNING(Adapter, ("Returning NDIS_STATUS_TAPI_INVALDEVICECLASS\n"));
+ return (NDIS_STATUS_TAPI_INVALDEVICECLASS);
+ }
+
+ /*
+ // This request must be associated with a line device.
+ */
+ Link = GET_LINK_FROM_DEVICEID(Adapter, Request->ulDeviceID);
+ if (Link == NULL)
+ {
+ DBG_WARNING(Adapter, ("Returning NDIS_STATUS_TAPI_NODRIVER\n"));
+ return (NDIS_STATUS_TAPI_NODRIVER);
+ }
+
+ /*
+ // Now we need to adjust the variable field to place the requested device
+ // configuration.
+ */
+# define SIZEOF_DEVCONFIG sizeof(ULONG)
+ Request->DeviceConfig.ulNeededSize = sizeof(VAR_STRING) + SIZEOF_DEVCONFIG;
+ if (Request->DeviceConfig.ulTotalSize >= Request->DeviceConfig.ulNeededSize)
+ {
+ Request->DeviceConfig.ulUsedSize = Request->DeviceConfig.ulNeededSize;
+ Request->DeviceConfig.ulStringFormat = STRINGFORMAT_BINARY;
+ Request->DeviceConfig.ulStringSize = SIZEOF_DEVCONFIG;
+ Request->DeviceConfig.ulStringOffset = sizeof(VAR_STRING);
+
+ /*
+ // There are currently no return values defined for this case.
+ // This is just a place holder for future extensions.
+ */
+ *((ULONG *) ((PCHAR) &Request->DeviceConfig + sizeof(VAR_STRING))) =
+ 0xDEADBEEF;
+ }
+
+ DBG_LEAVE(Adapter);
+
+ return (NDIS_STATUS_SUCCESS);
+}
+
+
+NDIS_STATUS
+HtTapiSetDevConfig(
+ IN PHTDSU_ADAPTER Adapter,
+ IN PNDIS_TAPI_SET_DEV_CONFIG Request
+ )
+
+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+Functional Description:
+
+ This request restores the configuration of a device associated one-to-one
+ with the line device from an “” data structure previously obtained using
+ OID_TAPI_GET_DEV_CONFIG. The contents of this data structure are specific
+ to the line (miniport) and device class.
+
+Parameters:
+
+ Adapter _ A pointer ot our adapter information structure.
+
+ Request _ A pointer to the NDIS_TAPI request structure for this call.
+
+ typedef struct _NDIS_TAPI_SET_DEV_CONFIG
+ {
+ IN ULONG ulRequestID;
+ IN ULONG ulDeviceID;
+ IN ULONG ulDeviceClassSize;
+ IN ULONG ulDeviceClassOffset;
+ IN ULONG ulDeviceConfigSize;
+ IN UCHAR DeviceConfig[1];
+
+ } NDIS_TAPI_SET_DEV_CONFIG, *PNDIS_TAPI_SET_DEV_CONFIG;
+
+Return Values:
+
+ NDIS_STATUS_SUCCESS
+ NDIS_STATUS_TAPI_INVALDEVICECLASS
+ NDIS_STATUS_TAPI_INVALPARAM
+ NDIS_STATUS_TAPI_NODRIVER
+
+---------------------------------------------------------------------------*/
+
+{
+ DBG_FUNC("HtTapiSetDevConfig")
+
+ /*
+ // A pointer to our link information structure for the selected line device.
+ */
+ PHTDSU_LINK Link;
+
+ /*
+ // Remember which device class is being requested.
+ */
+ UINT DeviceClass;
+
+ DBG_ENTER(Adapter);
+ DBG_FILTER(Adapter, DBG_PARAMS_ON,
+ ("ulDeviceID=%d\n"
+ "ulDeviceClassSize=%d\n"
+ "ulDeviceClassOffset=%d\n"
+ "ulDeviceConfigSize=%d\n",
+ Request->ulDeviceID,
+ Request->ulDeviceClassSize,
+ Request->ulDeviceClassOffset,
+ Request->ulDeviceConfigSize
+ ));
+ /*
+ // Make sure this is a tapi/line or ndis request.
+ */
+ if (_strnicmp((PCHAR) Request + Request->ulDeviceClassOffset,
+ NDIS_DEVICECLASS_NAME, Request->ulDeviceClassSize) == 0)
+ {
+ DeviceClass = NDIS_DEVICECLASS_ID;
+ }
+ else if (_strnicmp((PCHAR) Request + Request->ulDeviceClassOffset,
+ TAPI_DEVICECLASS_NAME, Request->ulDeviceClassSize) == 0)
+ {
+ DeviceClass = TAPI_DEVICECLASS_ID;
+ }
+ else
+ {
+ DBG_WARNING(Adapter, ("Returning NDIS_STATUS_TAPI_INVALDEVICECLASS\n"));
+ return (NDIS_STATUS_TAPI_INVALDEVICECLASS);
+ }
+
+ /*
+ // This request must be associated with a line device.
+ */
+ Link = GET_LINK_FROM_DEVICEID(Adapter, Request->ulDeviceID);
+ if (Link == NULL)
+ {
+ DBG_WARNING(Adapter, ("Returning NDIS_STATUS_TAPI_NODRIVER\n"));
+ return (NDIS_STATUS_TAPI_NODRIVER);
+ }
+
+ /*
+ // Make sure this configuration is the proper size.
+ */
+ if (Request->ulDeviceConfigSize != SIZEOF_DEVCONFIG)
+ {
+ DBG_WARNING(Adapter, ("Returning NDIS_STATUS_TAPI_INVALPARAM\n"));
+ return (NDIS_STATUS_TAPI_INVALPARAM);
+ }
+
+ /*
+ // Retore the configuration information returned by HtTapiGetDevConfig.
+ //
+ // There are currently no configuration values defined this case.
+ // This is just a place holder for future extensions.
+ */
+ if (*((ULONG *) ((PCHAR) Request->DeviceConfig)) != 0xDEADBEEF)
+ {
+ DBG_WARNING(Adapter, ("Returning NDIS_STATUS_TAPI_INVALPARAM\n"));
+ return (NDIS_STATUS_TAPI_INVALPARAM);
+ }
+
+ DBG_LEAVE(Adapter);
+
+ return (NDIS_STATUS_SUCCESS);
+}
+
+
+NDIS_STATUS
+HtTapiConfigDialog(
+ IN PHTDSU_ADAPTER Adapter,
+ IN PNDIS_TAPI_CONFIG_DIALOG Request
+ )
+
+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+Functional Description:
+
+ This request retrieves the name of a user-mode dynamic link library that
+ can be loaded and called to configure the specified device. The
+ configuration DLL shall export the following function by name:
+
+ LONG WINAPI
+ ConfigDialog(
+ IN HWND hwndOwner,
+ IN ULONG ulDeviceID,
+ IN LPCSTR lpszDeviceClass
+ );
+
+Parameters:
+
+ Adapter _ A pointer ot our adapter information structure.
+
+ Request _ A pointer to the NDIS_TAPI request structure for this call.
+
+ typedef struct _NDIS_TAPI_CONFIG_DIALOG
+ {
+ IN ULONG ulRequestID;
+ IN ULONG ulDeviceID;
+ IN ULONG ulDeviceClassSize;
+ IN ULONG ulDeviceClassOffset;
+ IN ULONG ulLibraryNameTotalSize;
+ OUT ULONG ulLibraryNameNeededSize;
+ OUT CHAR szLibraryName[1];
+
+ } NDIS_TAPI_CONFIG_DIALOG, *PNDIS_TAPI_CONFIG_DIALOG;
+
+Return Values:
+
+ NDIS_STATUS_SUCCESS
+ NDIS_STATUS_TAPI_INVALDEVICECLASS
+ NDIS_STATUS_STRUCTURETOOSMALL
+ NDIS_STATUS_TAPI_NODRIVER
+
+---------------------------------------------------------------------------*/
+
+{
+ DBG_FUNC("HtTapiConfigDialog")
+
+ /*
+ // A pointer to our link information structure for the selected line device.
+ */
+ PHTDSU_LINK Link;
+
+ /*
+ // Remember which device class is being requested.
+ */
+ UINT DeviceClass;
+
+ DBG_ENTER(Adapter);
+ DBG_FILTER(Adapter, DBG_PARAMS_ON,
+ ("ulDeviceID=%d\n"
+ "ulDeviceClassSize=%d\n"
+ "ulDeviceClassOffset=%Xh\n"
+ "ulLibraryNameTotalSize=%d\n",
+ Request->ulDeviceID,
+ Request->ulDeviceClassSize,
+ Request->ulDeviceClassOffset,
+ Request->ulLibraryNameTotalSize
+ ));
+ /*
+ // Make sure this is a tapi/line or ndis request.
+ */
+ if (_strnicmp((PCHAR) Request + Request->ulDeviceClassOffset,
+ NDIS_DEVICECLASS_NAME, Request->ulDeviceClassSize) == 0)
+ {
+ DeviceClass = NDIS_DEVICECLASS_ID;
+ }
+ else if (_strnicmp((PCHAR) Request + Request->ulDeviceClassOffset,
+ TAPI_DEVICECLASS_NAME, Request->ulDeviceClassSize) == 0)
+ {
+ DeviceClass = TAPI_DEVICECLASS_ID;
+ }
+ else
+ {
+ DBG_WARNING(Adapter, ("Returning NDIS_STATUS_TAPI_INVALDEVICECLASS\n"));
+ return (NDIS_STATUS_TAPI_INVALDEVICECLASS);
+ }
+
+ /*
+ // This request must be associated with a line device.
+ */
+ Link = GET_LINK_FROM_DEVICEID(Adapter, Request->ulDeviceID);
+ if (Link == NULL)
+ {
+ DBG_WARNING(Adapter, ("Returning NDIS_STATUS_TAPI_NODRIVER\n"));
+ return (NDIS_STATUS_TAPI_NODRIVER);
+ }
+
+ /*
+ // Copy the name of our configuration DLL which we read from the registry
+ // during startup, and which was placed there during installation.
+ //
+ // This driver does not provide a configuration DLL.
+ // This is just a place holder for future extensions.
+ */
+ Request->ulLibraryNameNeededSize = strlen(Adapter->ConfigDLLName) + 1;
+ if (Request->ulLibraryNameTotalSize < Request->ulLibraryNameNeededSize)
+ {
+ DBG_WARNING(Adapter, ("Returning NDIS_STATUS_TAPI_STRUCTURETOOSMALL\n"));
+ return (NDIS_STATUS_TAPI_STRUCTURETOOSMALL);
+ }
+ NdisMoveMemory(
+ Request->szLibraryName,
+ Adapter->ConfigDLLName,
+ Request->ulLibraryNameNeededSize
+ );
+
+ DBG_LEAVE(Adapter);
+
+ return (NDIS_STATUS_SUCCESS);
+}
+
+
+NDIS_STATUS
+HtTapiDevSpecific(
+ IN PHTDSU_ADAPTER Adapter,
+ IN PNDIS_TAPI_DEV_SPECIFIC Request
+ )
+
+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+Functional Description:
+
+ This request is used as a general extension mechanism to enable miniports
+ to provide access to features not described in other operations. The meaning
+ of the extensions are device-specific, and taking advantage of these
+ extensions requires the application to be fully aware of them.
+
+Parameters:
+
+ Adapter _ A pointer ot our adapter information structure.
+
+ Request _ A pointer to the NDIS_TAPI request structure for this call.
+
+ typedef struct _NDIS_TAPI_DEV_SPECIFIC
+ {
+ IN ULONG ulRequestID;
+ IN HDRV_LINE hdLine;
+ IN ULONG ulAddressID;
+ IN HDRV_CALL hdCall;
+ IN OUT ULONG ulParamsSize;
+ IN OUT UCHAR Params[1];
+
+ } NDIS_TAPI_DEV_SPECIFIC, *PNDIS_TAPI_DEV_SPECIFIC;
+
+Return Values:
+
+ NDIS_STATUS_SUCCESS
+ NDIS_STATUS_FAILURE
+ NDIS_STATUS_TAPI_OPERATIONUNAVAIL
+
+---------------------------------------------------------------------------*/
+
+{
+ DBG_FUNC("HtTapiDevSpecific")
+
+ DBG_ENTER(Adapter);
+ DBG_FILTER(Adapter, DBG_PARAMS_ON,
+ ("hdLine=%Xh\n"
+ "ulAddressID=%d\n"
+ "hdCall=%Xh\n"
+ "ulParamsSize=%d\n"
+ "Params=%Xh\n",
+ Request->hdLine,
+ Request->ulAddressID,
+ Request->hdCall,
+ Request->ulParamsSize,
+ Request->Params
+ ));
+ /*
+ // You can do what ever you want here, so long as the application
+ // agrees with you.
+ */
+
+ DBG_LEAVE(Adapter);
+
+ return (NDIS_STATUS_TAPI_OPERATIONUNAVAIL);
+}
+
+
+NDIS_STATUS
+HtTapiGetAddressID(
+ IN PHTDSU_ADAPTER Adapter,
+ IN PNDIS_TAPI_GET_ADDRESS_ID Request
+ )
+
+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+Functional Description:
+
+ This request returns the address ID associated with address in a different
+ format on the specified line.
+
+Parameters:
+
+ Adapter _ A pointer ot our adapter information structure.
+
+ Request _ A pointer to the NDIS_TAPI request structure for this call.
+
+ typedef struct _NDIS_TAPI_GET_ADDRESS_ID
+ {
+ IN ULONG ulRequestID;
+ IN HDRV_LINE hdLine;
+ OUT ULONG ulAddressID;
+ IN ULONG ulAddressMode;
+ IN ULONG ulAddressSize;
+ IN CHAR szAddress[1];
+
+ } NDIS_TAPI_GET_ADDRESS_ID, *PNDIS_TAPI_GET_ADDRESS_ID;
+
+Return Values:
+
+ NDIS_STATUS_SUCCESS
+ NDIS_STATUS_FAILURE
+ NDIS_STATUS_TAPI_INVALLINEHANDLE
+ NDIS_STATUS_TAPI_RESOURCEUNAVAIL
+
+---------------------------------------------------------------------------*/
+
+{
+ DBG_FUNC("HtTapiGetAddressID")
+
+ /*
+ // A pointer to our link information structure for the selected line device.
+ */
+ PHTDSU_LINK Link;
+
+ DBG_ENTER(Adapter);
+ DBG_FILTER(Adapter, DBG_PARAMS_ON,
+ ("hdLine=%Xh\n"
+ "ulAddressMode=%Xh\n"
+ "ulAddressSize=%d\n"
+ "szAddress=%Xh\n",
+ Request->hdLine,
+ Request->ulAddressMode,
+ Request->ulAddressSize,
+ Request->szAddress
+ ));
+ /*
+ // This request must be associated with a line device.
+ */
+ Link = GET_LINK_FROM_HDLINE(Adapter, Request->hdLine);
+ if (Link == NULL)
+ {
+ DBG_WARNING(Adapter, ("Returning NDIS_STATUS_TAPI_INVALLINEHANDLE\n"));
+ return (NDIS_STATUS_TAPI_INVALLINEHANDLE);
+ }
+
+ /*
+ // The spec sez it has to be this mode! Otherwise, we already know
+ // that the address ID is (0..N-1).
+ */
+ if (Request->ulAddressMode != LINEADDRESSMODE_DIALABLEADDR)
+ {
+ DBG_WARNING(Adapter, ("Returning NDIS_STATUS_FAILURE\n"));
+ return (NDIS_STATUS_FAILURE);
+ }
+
+ /*
+ // Make sure we have enough room set aside for this address string.
+ */
+ if (Request->ulAddressSize > sizeof(Link->LineAddress)-1)
+ {
+ DBG_WARNING(Adapter, ("Returning NDIS_STATUS_TAPI_RESOURCEUNAVAIL\n"));
+ return (NDIS_STATUS_TAPI_RESOURCEUNAVAIL);
+ }
+
+ /*
+ // You may need to search each link to find the associated Address.
+ // However, this adapter has only one address per link so it's an
+ // easy task.
+ */
+ Request->ulAddressID = HTDSU_TAPI_ADDRESSID;
+
+ DBG_LEAVE(Adapter);
+
+ return (NDIS_STATUS_SUCCESS);
+}
+
+
+NDIS_STATUS
+HtTapiGetAddressCaps(
+ PHTDSU_ADAPTER Adapter,
+ PNDIS_TAPI_GET_ADDRESS_CAPS Request
+ )
+
+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+Functional Description:
+
+ This request queries the specified address on the specified line device
+ to determine its telephony capabilities.
+
+Parameters:
+
+ Adapter _ A pointer ot our adapter information structure.
+
+ Request _ A pointer to the NDIS_TAPI request structure for this call.
+
+ typedef struct _NDIS_TAPI_GET_ADDRESS_CAPS
+ {
+ IN ULONG ulRequestID;
+ IN ULONG ulDeviceID;
+ IN ULONG ulAddressID;
+ IN ULONG ulExtVersion;
+ OUT LINE_ADDRESS_CAPS LineAddressCaps;
+
+ } NDIS_TAPI_GET_ADDRESS_CAPS, *PNDIS_TAPI_GET_ADDRESS_CAPS;
+
+ typedef struct _LINE_ADDRESS_CAPS
+ {
+ ULONG ulTotalSize;
+ ULONG ulNeededSize;
+ ULONG ulUsedSize;
+
+ ULONG ulLineDeviceID;
+
+ ULONG ulAddressSize;
+ ULONG ulAddressOffset;
+
+ ULONG ulDevSpecificSize;
+ ULONG ulDevSpecificOffset;
+
+ ULONG ulAddressSharing;
+ ULONG ulAddressStates;
+ ULONG ulCallInfoStates;
+ ULONG ulCallerIDFlags;
+ ULONG ulCalledIDFlags;
+ ULONG ulConnectedIDFlags;
+ ULONG ulRedirectionIDFlags;
+ ULONG ulRedirectingIDFlags;
+ ULONG ulCallStates;
+ ULONG ulDialToneModes;
+ ULONG ulBusyModes;
+ ULONG ulSpecialInfo;
+ ULONG ulDisconnectModes;
+
+ ULONG ulMaxNumActiveCalls;
+ ULONG ulMaxNumOnHoldCalls;
+ ULONG ulMaxNumOnHoldPendingCalls;
+ ULONG ulMaxNumConference;
+ ULONG ulMaxNumTransConf;
+
+ ULONG ulAddrCapFlags;
+ ULONG ulCallFeatures;
+ ULONG ulRemoveFromConfCaps;
+ ULONG ulRemoveFromConfState;
+ ULONG ulTransferModes;
+ ULONG ulParkModes;
+
+ ULONG ulForwardModes;
+ ULONG ulMaxForwardEntries;
+ ULONG ulMaxSpecificEntries;
+ ULONG ulMinFwdNumRings;
+ ULONG ulMaxFwdNumRings;
+
+ ULONG ulMaxCallCompletions;
+ ULONG ulCallCompletionConds;
+ ULONG ulCallCompletionModes;
+ ULONG ulNumCompletionMessages;
+ ULONG ulCompletionMsgTextEntrySize;
+ ULONG ulCompletionMsgTextSize;
+ ULONG ulCompletionMsgTextOffset;
+
+ } LINE_ADDRESS_CAPS, *PLINE_ADDRESS_CAPS;
+
+Return Values:
+
+ NDIS_STATUS_SUCCESS
+ NDIS_STATUS_TAPI_INVALADDRESSID
+ NDIS_STATUS_TAPI_INCOMPATIBLEEXTVERSION
+ NDIS_STATUS_TAPI_NODRIVER
+
+---------------------------------------------------------------------------*/
+
+{
+ DBG_FUNC("HtTapiGetAddressCaps")
+
+ /*
+ // A pointer to our link information structure for the selected line device.
+ */
+ PHTDSU_LINK Link;
+
+ /*
+ // Length of the address string assigned to this line device.
+ */
+ UINT AddressLength;
+
+ DBG_ENTER(Adapter);
+ DBG_FILTER(Adapter, DBG_PARAMS_ON,
+ ("ulDeviceID=%d\n"
+ "ulAddressID=%d\n"
+ "ulExtVersion=%Xh\n",
+ Request->ulDeviceID,
+ Request->ulAddressID,
+ Request->ulExtVersion
+ ));
+ /*
+ // Make sure the address is within range - we only support one per line.
+ */
+ if (Request->ulAddressID >= HTDSU_TAPI_NUM_ADDRESSES)
+ {
+ DBG_WARNING(Adapter, ("Returning NDIS_STATUS_TAPI_INVALADDRESSID\n"));
+ return (NDIS_STATUS_TAPI_INVALADDRESSID);
+ }
+
+ /*
+ // Make sure we are speaking the same language.
+ */
+#ifdef NDISTAPI_BUG_FIXED
+ if (Request->ulExtVersion != 0 &&
+ Request->ulExtVersion != HTDSU_TAPI_EXT_VERSION)
+ {
+ DBG_WARNING(Adapter, ("Returning NDIS_STATUS_TAPI_INCOMPATIBLEEXTVERSION\n"));
+ return (NDIS_STATUS_TAPI_INCOMPATIBLEEXTVERSION);
+ }
+#endif
+
+ /*
+ // This request must be associated with a line device.
+ */
+ Link = GET_LINK_FROM_DEVICEID(Adapter, Request->ulDeviceID);
+ if (Link == NULL)
+ {
+ DBG_WARNING(Adapter, ("Returning NDIS_STATUS_TAPI_NODRIVER\n"));
+ return (NDIS_STATUS_TAPI_NODRIVER);
+ }
+
+#ifndef NDISTAPI_BUG_FIXED
+ Request->LineAddressCaps.ulNeededSize =
+ Request->LineAddressCaps.ulUsedSize = sizeof(Request->LineAddressCaps);
+#endif
+
+ Request->LineAddressCaps.ulLineDeviceID = Request->ulDeviceID;
+
+ /*
+ // RASTAPI requires the "I L A" be placed in the Address field at the end
+ // of this structure. Where:
+ // I = The device intance assigned to this adapter in the registry
+ // \LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkCards\I
+ // L = The device line number associated with this line (1..NumLines)
+ // A = The address (channel) to be used on this line (0..NumAddresses-1)
+ */
+ AddressLength = strlen(Link->LineAddress) + 1;
+ Request->LineAddressCaps.ulNeededSize += AddressLength;
+ if (Request->LineAddressCaps.ulNeededSize <= Request->LineAddressCaps.ulTotalSize)
+ {
+ Request->LineAddressCaps.ulAddressSize = AddressLength;
+ Request->LineAddressCaps.ulAddressOffset = sizeof(Request->LineAddressCaps);
+ NdisMoveMemory((PUCHAR) &Request->LineAddressCaps +
+ Request->LineAddressCaps.ulAddressOffset,
+ Link->LineAddress,
+ AddressLength
+ );
+ Request->LineAddressCaps.ulUsedSize += AddressLength;
+ }
+
+ /*
+ // Return the various address capabilites for the adapter.
+ */
+ Request->LineAddressCaps.ulAddressSharing = LINEADDRESSSHARING_PRIVATE;
+ Request->LineAddressCaps.ulAddressStates = Link->AddressStatesCaps;
+ Request->LineAddressCaps.ulCallStates = Link->CallStatesCaps;
+ Request->LineAddressCaps.ulDialToneModes = LINEDIALTONEMODE_NORMAL;
+ Request->LineAddressCaps.ulSpecialInfo = LINESPECIALINFO_UNAVAIL;
+ Request->LineAddressCaps.ulDisconnectModes =
+ LINEDISCONNECTMODE_NORMAL |
+ LINEDISCONNECTMODE_UNKNOWN |
+ LINEDISCONNECTMODE_BUSY |
+ LINEDISCONNECTMODE_NOANSWER;
+ /*
+ // This device does not support conference calls, transfers, or holds.
+ */
+ Request->LineAddressCaps.ulMaxNumActiveCalls = 1;
+ Request->LineAddressCaps.ulMaxNumTransConf = 1;
+ Request->LineAddressCaps.ulAddrCapFlags =
+ Link->LineMode == HTDSU_LINEMODE_LEASED ? 0 : LINEADDRCAPFLAGS_DIALED;
+ Request->LineAddressCaps.ulCallFeatures =
+ LINECALLFEATURE_ACCEPT |
+ LINECALLFEATURE_ANSWER |
+ LINECALLFEATURE_COMPLETECALL |
+ LINECALLFEATURE_DIAL |
+ LINECALLFEATURE_DROP;
+
+ DBG_LEAVE(Adapter);
+
+ return (NDIS_STATUS_SUCCESS);
+}
+
+
+NDIS_STATUS
+HtTapiGetAddressStatus(
+ IN PHTDSU_ADAPTER Adapter,
+ IN PNDIS_TAPI_GET_ADDRESS_STATUS Request
+ )
+
+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+Functional Description:
+
+ This request queries the specified address for its current status.
+
+Parameters:
+
+ Adapter _ A pointer ot our adapter information structure.
+
+ Request _ A pointer to the NDIS_TAPI request structure for this call.
+
+ typedef struct _NDIS_TAPI_GET_ADDRESS_STATUS
+ {
+ IN ULONG ulRequestID;
+ IN HDRV_LINE hdLine;
+ IN ULONG ulAddressID;
+ OUT LINE_ADDRESS_STATUS LineAddressStatus;
+
+ } NDIS_TAPI_GET_ADDRESS_STATUS, *PNDIS_TAPI_GET_ADDRESS_STATUS;
+
+ typedef struct _LINE_ADDRESS_STATUS
+ {
+ ULONG ulTotalSize;
+ ULONG ulNeededSize;
+ ULONG ulUsedSize;
+
+ ULONG ulNumInUse;
+ ULONG ulNumActiveCalls;
+ ULONG ulNumOnHoldCalls;
+ ULONG ulNumOnHoldPendCalls;
+ ULONG ulAddressFeatures;
+
+ ULONG ulNumRingsNoAnswer;
+ ULONG ulForwardNumEntries;
+ ULONG ulForwardSize;
+ ULONG ulForwardOffset;
+
+ ULONG ulTerminalModesSize;
+ ULONG ulTerminalModesOffset;
+
+ ULONG ulDevSpecificSize;
+ ULONG ulDevSpecificOffset;
+
+ } LINE_ADDRESS_STATUS, *PLINE_ADDRESS_STATUS;
+
+Return Values:
+
+ NDIS_STATUS_SUCCESS
+ NDIS_STATUS_FAILURE
+ NDIS_STATUS_TAPI_INVALLINEHANDLE
+ NDIS_STATUS_TAPI_INVALADDRESSID
+
+---------------------------------------------------------------------------*/
+
+{
+ DBG_FUNC("HtTapiGetAddressStatus")
+
+ /*
+ // A pointer to our link information structure for the selected line device.
+ */
+ PHTDSU_LINK Link;
+
+ DBG_ENTER(Adapter);
+ DBG_FILTER(Adapter, DBG_PARAMS_ON,
+ ("hdLine=%Xh\n"
+ "ulAddressID=%d\n",
+ Request->hdLine,
+ Request->ulAddressID
+ ));
+ /*
+ // This request must be associated with a line device.
+ */
+ Link = GET_LINK_FROM_HDLINE(Adapter, Request->hdLine);
+ if (Link == NULL)
+ {
+ DBG_WARNING(Adapter, ("Returning NDIS_STATUS_TAPI_INVALLINEHANDLE\n"));
+ return (NDIS_STATUS_TAPI_INVALLINEHANDLE);
+ }
+
+ /*
+ // Make sure the address is within range - we only support one per line.
+ */
+ if (Request->ulAddressID >= HTDSU_TAPI_NUM_ADDRESSES)
+ {
+ DBG_WARNING(Adapter, ("Returning NDIS_STATUS_TAPI_INVALADDRESSID\n"));
+ return (NDIS_STATUS_TAPI_INVALADDRESSID);
+ }
+
+#ifndef NDISTAPI_BUG_FIXED
+ Request->LineAddressStatus.ulNeededSize =
+ Request->LineAddressStatus.ulUsedSize = sizeof(Request->LineAddressStatus);
+#endif
+
+ /*
+ // Return the current status information for the line.
+ */
+ Request->LineAddressStatus.ulNumInUse =
+ Link->CallState == LINECALLSTATE_IDLE ? 0 : 1;
+ Request->LineAddressStatus.ulNumActiveCalls =
+ Link->CallState == LINECALLSTATE_IDLE ? 0 : 1;
+ Request->LineAddressStatus.ulAddressFeatures =
+ Link->CallState == LINECALLSTATE_IDLE ?
+ LINEADDRFEATURE_MAKECALL : 0;
+ Request->LineAddressStatus.ulNumRingsNoAnswer = 999;
+
+ DBG_LEAVE(Adapter);
+
+ return (NDIS_STATUS_SUCCESS);
+}
+
+
+NDIS_STATUS
+HtTapiGetCallAddressID(
+ IN PHTDSU_ADAPTER Adapter,
+ IN PNDIS_TAPI_GET_CALL_ADDRESS_ID Request
+ )
+
+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+Functional Description:
+
+ This request retrieves the address ID for the indicated call.
+
+Parameters:
+
+ Adapter _ A pointer ot our adapter information structure.
+
+ Request _ A pointer to the NDIS_TAPI request structure for this call.
+
+ typedef struct _NDIS_TAPI_GET_CALL_ADDRESS_ID
+ {
+ IN ULONG ulRequestID;
+ IN HDRV_CALL hdCall;
+ OUT ULONG ulAddressID;
+
+ } NDIS_TAPI_GET_CALL_ADDRESS_ID, *PNDIS_TAPI_GET_CALL_ADDRESS_ID;
+
+Return Values:
+
+ NDIS_STATUS_SUCCESS
+ NDIS_STATUS_FAILURE
+ NDIS_STATUS_TAPI_INVALCALLHANDLE
+
+---------------------------------------------------------------------------*/
+
+{
+ DBG_FUNC("HtTapiGetCallAddressID")
+
+ /*
+ // A pointer to our link information structure for the selected line device.
+ */
+ PHTDSU_LINK Link;
+
+ DBG_ENTER(Adapter);
+ DBG_FILTER(Adapter, DBG_PARAMS_ON,
+ ("hdCall=%Xh\n",
+ Request->hdCall
+ ));
+ /*
+ // This request must be associated with a call.
+ */
+ Link = GET_LINK_FROM_HDCALL(Adapter, Request->hdCall);
+ if (Link == NULL)
+ {
+ DBG_WARNING(Adapter, ("Returning NDIS_STATUS_TAPI_INVALCALLHANDLE\n"));
+ return (NDIS_STATUS_TAPI_INVALCALLHANDLE);
+ }
+
+ /*
+ // Return the address ID associated with this call.
+ */
+ Request->ulAddressID = HTDSU_TAPI_ADDRESSID;
+
+ DBG_LEAVE(Adapter);
+
+ return (NDIS_STATUS_SUCCESS);
+}
+
+
+NDIS_STATUS
+HtTapiGetCallInfo(
+ IN PHTDSU_ADAPTER Adapter,
+ IN PNDIS_TAPI_GET_CALL_INFO Request
+ )
+
+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+Functional Description:
+
+ This request returns detailed information about the specified call.
+
+Parameters:
+
+ Adapter _ A pointer ot our adapter information structure.
+
+ Request _ A pointer to the NDIS_TAPI request structure for this call.
+
+ typedef struct _NDIS_TAPI_GET_CALL_INFO
+ {
+ IN ULONG ulRequestID;
+ IN HDRV_CALL hdCall;
+ OUT LINE_CALL_INFO LineCallInfo;
+
+ } NDIS_TAPI_GET_CALL_INFO, *PNDIS_TAPI_GET_CALL_INFO;
+
+ typedef struct _LINE_CALL_INFO
+ {
+ ULONG ulTotalSize;
+ ULONG ulNeededSize;
+ ULONG ulUsedSize;
+
+ ULONG hLine;
+ ULONG ulLineDeviceID;
+ ULONG ulAddressID;
+
+ ULONG ulBearerMode;
+ ULONG ulRate;
+ ULONG ulMediaMode;
+
+ ULONG ulAppSpecific;
+ ULONG ulCallID;
+ ULONG ulRelatedCallID;
+ ULONG ulCallParamFlags;
+ ULONG ulCallStates;
+
+ ULONG ulMonitorDigitModes;
+ ULONG ulMonitorMediaModes;
+ LINE_DIAL_PARAMS DialParams;
+
+ ULONG ulOrigin;
+ ULONG ulReason;
+ ULONG ulCompletionID;
+ ULONG ulNumOwners;
+ ULONG ulNumMonitors;
+
+ ULONG ulCountryCode;
+ ULONG ulTrunk;
+
+ ULONG ulCallerIDFlags;
+ ULONG ulCallerIDSize;
+ ULONG ulCallerIDOffset;
+ ULONG ulCallerIDNameSize;
+ ULONG ulCallerIDNameOffset;
+
+ ULONG ulCalledIDFlags;
+ ULONG ulCalledIDSize;
+ ULONG ulCalledIDOffset;
+ ULONG ulCalledIDNameSize;
+ ULONG ulCalledIDNameOffset;
+
+ ULONG ulConnectedIDFlags;
+ ULONG ulConnectedIDSize;
+ ULONG ulConnectedIDOffset;
+ ULONG ulConnectedIDNameSize;
+ ULONG ulConnectedIDNameOffset;
+
+ ULONG ulRedirectionIDFlags;
+ ULONG ulRedirectionIDSize;
+ ULONG ulRedirectionIDOffset;
+ ULONG ulRedirectionIDNameSize;
+ ULONG ulRedirectionIDNameOffset;
+
+ ULONG ulRedirectingIDFlags;
+ ULONG ulRedirectingIDSize;
+ ULONG ulRedirectingIDOffset;
+ ULONG ulRedirectingIDNameSize;
+ ULONG ulRedirectingIDNameOffset;
+
+ ULONG ulAppNameSize;
+ ULONG ulAppNameOffset;
+
+ ULONG ulDisplayableAddressSize;
+ ULONG ulDisplayableAddressOffset;
+
+ ULONG ulCalledPartySize;
+ ULONG ulCalledPartyOffset;
+
+ ULONG ulCommentSize;
+ ULONG ulCommentOffset;
+
+ ULONG ulDisplaySize;
+ ULONG ulDisplayOffset;
+
+ ULONG ulUserUserInfoSize;
+ ULONG ulUserUserInfoOffset;
+
+ ULONG ulHighLevelCompSize;
+ ULONG ulHighLevelCompOffset;
+
+ ULONG ulLowLevelCompSize;
+ ULONG ulLowLevelCompOffset;
+
+ ULONG ulChargingInfoSize;
+ ULONG ulChargingInfoOffset;
+
+ ULONG ulTerminalModesSize;
+ ULONG ulTerminalModesOffset;
+
+ ULONG ulDevSpecificSize;
+ ULONG ulDevSpecificOffset;
+
+ } LINE_CALL_INFO, *PLINE_CALL_INFO;
+
+ typedef struct _LINE_DIAL_PARAMS
+ {
+ ULONG ulDialPause;
+ ULONG ulDialSpeed;
+ ULONG ulDigitDuration;
+ ULONG ulWaitForDialtone;
+
+ } LINE_DIAL_PARAMS, *PLINE_DIAL_PARAMS;
+
+Return Values:
+
+ NDIS_STATUS_SUCCESS
+ NDIS_STATUS_FAILURE
+ NDIS_STATUS_TAPI_INVALCALLHANDLE
+
+---------------------------------------------------------------------------*/
+
+{
+ DBG_FUNC("HtTapiGetCallInfo")
+
+ /*
+ // A pointer to our link information structure for the selected line device.
+ */
+ PHTDSU_LINK Link;
+
+ DBG_ENTER(Adapter);
+ DBG_FILTER(Adapter, DBG_PARAMS_ON,
+ ("hdCall=%Xh\n",
+ Request->hdCall
+ ));
+ /*
+ // This request must be associated with a call.
+ */
+ Link = GET_LINK_FROM_HDCALL(Adapter, Request->hdCall);
+ if (Link == NULL)
+ {
+ DBG_WARNING(Adapter, ("Returning NDIS_STATUS_TAPI_INVALCALLHANDLE\n"));
+ return (NDIS_STATUS_TAPI_INVALCALLHANDLE);
+ }
+
+#ifndef NDISTAPI_BUG_FIXED
+ Request->LineCallInfo.ulNeededSize =
+ Request->LineCallInfo.ulUsedSize = sizeof(Request->LineCallInfo);
+#endif
+
+ /*
+ // We don't expect user user info.
+ */
+ ASSERT(Request->LineCallInfo.ulUserUserInfoSize == 0);
+
+ /*
+ // The link has all the call information we need to return.
+ */
+ Request->LineCallInfo.hLine = (ULONG) Link;
+ Request->LineCallInfo.ulLineDeviceID = GET_DEVICEID_FROM_LINK(Adapter, Link);
+ Request->LineCallInfo.ulAddressID = HTDSU_TAPI_ADDRESSID;
+
+ Request->LineCallInfo.ulBearerMode = LINEBEARERMODE_DATA;
+ Request->LineCallInfo.ulRate = Link->LinkSpeed;
+ Request->LineCallInfo.ulMediaMode = Link->MediaModesMask;
+
+ Request->LineCallInfo.ulCallParamFlags = LINECALLPARAMFLAGS_IDLE;
+ Request->LineCallInfo.ulCallStates = Link->CallStatesMask;
+
+ DBG_LEAVE(Adapter);
+
+ return (NDIS_STATUS_SUCCESS);
+}
+
+
+NDIS_STATUS
+HtTapiGetCallStatus(
+ IN PHTDSU_ADAPTER Adapter,
+ IN PNDIS_TAPI_GET_CALL_STATUS Request
+ )
+
+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+Functional Description:
+
+ This request returns detailed information about the specified call.
+
+Parameters:
+
+ Adapter _ A pointer ot our adapter information structure.
+
+ Request _ A pointer to the NDIS_TAPI request structure for this call.
+
+ typedef struct _NDIS_TAPI_GET_CALL_STATUS
+ {
+ IN ULONG ulRequestID;
+ IN HDRV_CALL hdCall;
+ OUT LINE_CALL_STATUS LineCallStatus;
+
+ } NDIS_TAPI_GET_CALL_STATUS, *PNDIS_TAPI_GET_CALL_STATUS;
+
+ typedef struct _LINE_CALL_STATUS
+ {
+ ULONG ulTotalSize;
+ ULONG ulNeededSize;
+ ULONG ulUsedSize;
+
+ ULONG ulCallState;
+ ULONG ulCallStateMode;
+ ULONG ulCallPrivilege;
+ ULONG ulCallFeatures;
+
+ ULONG ulDevSpecificSize;
+ ULONG ulDevSpecificOffset;
+
+ } LINE_CALL_STATUS, *PLINE_CALL_STATUS;
+
+Return Values:
+
+ NDIS_STATUS_SUCCESS
+ NDIS_STATUS_FAILURE
+ NDIS_STATUS_TAPI_INVALCALLHANDLE
+
+---------------------------------------------------------------------------*/
+
+{
+ DBG_FUNC("HtTapiGetCallStatus")
+
+ /*
+ // Holds the status result returned this function.
+ */
+ NDIS_STATUS Status;
+
+ /*
+ // A pointer to our link information structure for the selected line device.
+ */
+ PHTDSU_LINK Link;
+
+ DBG_ENTER(Adapter);
+ DBG_FILTER(Adapter, DBG_PARAMS_ON,
+ ("hdCall=%Xh\n",
+ Request->hdCall
+ ));
+ /*
+ // This request must be associated with a call.
+ */
+ Link = GET_LINK_FROM_HDCALL(Adapter, Request->hdCall);
+ if (Link == NULL)
+ {
+ DBG_WARNING(Adapter, ("Returning NDIS_STATUS_TAPI_INVALCALLHANDLE\n"));
+ return (NDIS_STATUS_TAPI_INVALCALLHANDLE);
+ }
+
+#ifndef NDISTAPI_BUG_FIXED
+ Request->LineCallStatus.ulNeededSize =
+ Request->LineCallStatus.ulUsedSize = sizeof(Request->LineCallStatus);
+#endif
+
+ /*
+ // The link has all the call information.
+ */
+ Request->LineCallStatus.ulCallPrivilege = LINECALLPRIVILEGE_OWNER;
+ Request->LineCallStatus.ulCallState = Link->CallState;
+
+ /*
+ // Tag CallStateMode with appropriate value for the current CallState.
+ */
+ if (Link->CallState == LINECALLSTATE_DIALTONE)
+ {
+ Request->LineCallStatus.ulCallStateMode = LINEDIALTONEMODE_NORMAL;
+ }
+ else if (Link->CallState == LINECALLSTATE_BUSY)
+ {
+ Request->LineCallStatus.ulCallStateMode = LINEBUSYMODE_STATION;
+ }
+ else if (Link->CallState == LINECALLSTATE_DISCONNECTED)
+ {
+ /*
+ // We need to query/save the line status to find out what happened.
+ */
+ if (CardStatusNoAnswer(Adapter, Link->CardLine))
+ {
+ Request->LineCallStatus.ulCallStateMode = LINEDISCONNECTMODE_NOANSWER;
+ }
+ else if (CardStatusNoDialTone(Adapter, Link->CardLine))
+ {
+ Request->LineCallStatus.ulCallStateMode = LINEDISCONNECTMODE_BUSY;
+ }
+ else
+ {
+ Request->LineCallStatus.ulCallStateMode = LINEDISCONNECTMODE_UNKNOWN;
+ }
+ }
+
+ DBG_LEAVE(Adapter);
+
+ return (NDIS_STATUS_SUCCESS);
+}
+
+
+NDIS_STATUS
+HtTapiGetDevCaps(
+ PHTDSU_ADAPTER Adapter,
+ PNDIS_TAPI_GET_DEV_CAPS Request
+ )
+
+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+Functional Description:
+
+ This request queries a specified line device to determine its telephony
+ capabilities. The returned information is valid for all addresses on the
+ line device.
+
+Parameters:
+
+ Adapter _ A pointer ot our adapter information structure.
+
+ Request _ A pointer to the NDIS_TAPI request structure for this call.
+
+ typedef struct _NDIS_TAPI_GET_DEV_CAPS
+ {
+ IN ULONG ulRequestID;
+ IN ULONG ulDeviceID;
+ IN ULONG ulExtVersion;
+ OUT LINE_DEV_CAPS LineDevCaps;
+
+ } NDIS_TAPI_GET_DEV_CAPS, *PNDIS_TAPI_GET_DEV_CAPS;
+
+ typedef struct _LINE_DEV_CAPS
+ {
+ ULONG ulTotalSize;
+ ULONG ulNeededSize;
+ ULONG ulUsedSize;
+
+ ULONG ulProviderInfoSize;
+ ULONG ulProviderInfoOffset;
+
+ ULONG ulSwitchInfoSize;
+ ULONG ulSwitchInfoOffset;
+
+ ULONG ulPermanentLineID;
+ ULONG ulLineNameSize;
+ ULONG ulLineNameOffset;
+ ULONG ulStringFormat;
+
+ ULONG ulAddressModes;
+ ULONG ulNumAddresses;
+ ULONG ulBearerModes;
+ ULONG ulMaxRate;
+ ULONG ulMediaModes;
+
+ ULONG ulGenerateToneModes;
+ ULONG ulGenerateToneMaxNumFreq;
+ ULONG ulGenerateDigitModes;
+ ULONG ulMonitorToneMaxNumFreq;
+ ULONG ulMonitorToneMaxNumEntries;
+ ULONG ulMonitorDigitModes;
+ ULONG ulGatherDigitsMinTimeout;
+ ULONG ulGatherDigitsMaxTimeout;
+
+ ULONG ulMedCtlDigitMaxListSize;
+ ULONG ulMedCtlMediaMaxListSize;
+ ULONG ulMedCtlToneMaxListSize;
+ ULONG ulMedCtlCallStateMaxListSize;
+
+ ULONG ulDevCapFlags;
+ ULONG ulMaxNumActiveCalls;
+ ULONG ulAnswerMode;
+ ULONG ulRingModes;
+ ULONG ulLineStates;
+
+ ULONG ulUUIAcceptSize;
+ ULONG ulUUIAnswerSize;
+ ULONG ulUUIMakeCallSize;
+ ULONG ulUUIDropSize;
+ ULONG ulUUISendUserUserInfoSize;
+ ULONG ulUUICallInfoSize;
+
+ LINE_DIAL_PARAMS MinDialParams;
+ LINE_DIAL_PARAMS MaxDialParams;
+ LINE_DIAL_PARAMS DefaultDialParams;
+
+ ULONG ulNumTerminals;
+ ULONG ulTerminalCapsSize;
+ ULONG ulTerminalCapsOffset;
+ ULONG ulTerminalTextEntrySize;
+ ULONG ulTerminalTextSize;
+ ULONG ulTerminalTextOffset;
+
+ ULONG ulDevSpecificSize;
+ ULONG ulDevSpecificOffset;
+
+ } LINE_DEV_CAPS, *PLINE_DEV_CAPS;
+
+ typedef struct _LINE_DIAL_PARAMS
+ {
+ ULONG ulDialPause;
+ ULONG ulDialSpeed;
+ ULONG ulDigitDuration;
+ ULONG ulWaitForDialtone;
+
+ } LINE_DIAL_PARAMS, *PLINE_DIAL_PARAMS;
+
+Return Values:
+
+ NDIS_STATUS_SUCCESS
+ NDIS_STATUS_TAPI_NODRIVER
+
+---------------------------------------------------------------------------*/
+
+{
+ DBG_FUNC("HtTapiGetDevCaps")
+
+ /*
+ // A pointer to our link information structure for the selected line device.
+ */
+ PHTDSU_LINK Link;
+
+ DBG_ENTER(Adapter);
+ DBG_FILTER(Adapter, DBG_PARAMS_ON,
+ ("ulDeviceID=%d\n"
+ "ulExtVersion=%Xh\n"
+ "LineDevCaps=%Xh\n",
+ Request->ulDeviceID,
+ Request->ulExtVersion,
+ &Request->LineDevCaps
+ ));
+ /*
+ // This request must be associated with a line device.
+ */
+ Link = GET_LINK_FROM_DEVICEID(Adapter, Request->ulDeviceID);
+ if (Link == NULL)
+ {
+ DBG_WARNING(Adapter, ("Returning NDIS_STATUS_TAPI_NODRIVER\n"));
+ return (NDIS_STATUS_TAPI_NODRIVER);
+ }
+
+#ifndef NDISTAPI_BUG_FIXED
+ Request->LineDevCaps.ulNeededSize =
+ Request->LineDevCaps.ulUsedSize = sizeof(Request->LineDevCaps);
+#endif
+
+ /*
+ // The driver numbers lines sequentially from 1, so this will always
+ // be the same number.
+ */
+ Request->LineDevCaps.ulPermanentLineID = Link->CardLine;
+
+ /*
+ // RASTAPI requires the "MediaType\0DeviceName" be placed in the
+ // ProviderInfo field at the end of this structure.
+ */
+ Request->LineDevCaps.ulNeededSize += Adapter->ProviderInfoSize;
+ if (Request->LineDevCaps.ulNeededSize <= Request->LineDevCaps.ulTotalSize)
+ {
+ Request->LineDevCaps.ulProviderInfoSize = Adapter->ProviderInfoSize;
+ Request->LineDevCaps.ulProviderInfoOffset = sizeof(Request->LineDevCaps);
+ NdisMoveMemory((PUCHAR) &Request->LineDevCaps +
+ Request->LineDevCaps.ulProviderInfoOffset,
+ Adapter->ProviderInfo,
+ Adapter->ProviderInfoSize
+ );
+ Request->LineDevCaps.ulUsedSize += Adapter->ProviderInfoSize;
+ }
+ Request->LineDevCaps.ulStringFormat = STRINGFORMAT_ASCII;
+
+ /*
+ // This device is a switched 56kb line for digital data only.
+ */
+ Request->LineDevCaps.ulAddressModes = LINEADDRESSMODE_ADDRESSID |
+ LINEADDRESSMODE_DIALABLEADDR;
+ Request->LineDevCaps.ulNumAddresses = 1;
+ Request->LineDevCaps.ulBearerModes = LINEBEARERMODE_DATA;
+ Request->LineDevCaps.ulMaxRate = Link->LinkSpeed;
+ Request->LineDevCaps.ulMediaModes = Link->MediaModesCaps;
+
+ /*
+ // Each line on the DSU only supports a single call.
+ */
+ Request->LineDevCaps.ulDevCapFlags = LINEDEVCAPFLAGS_CLOSEDROP;
+ Request->LineDevCaps.ulMaxNumActiveCalls = 1;
+ Request->LineDevCaps.ulAnswerMode = LINEANSWERMODE_DROP;
+ Request->LineDevCaps.ulRingModes = 1;
+ Request->LineDevCaps.ulLineStates = Link->DevStatesCaps;
+
+ DBG_LEAVE(Adapter);
+
+ return (NDIS_STATUS_SUCCESS);
+}
+
+
+NDIS_STATUS
+HtTapiGetExtensionID(
+ IN PHTDSU_ADAPTER Adapter,
+ IN PNDIS_TAPI_GET_EXTENSION_ID Request
+ )
+
+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+Functional Description:
+
+ This request returns the extension ID that the miniport supports for the
+ indicated line device.
+
+Parameters:
+
+ Adapter _ A pointer ot our adapter information structure.
+
+ Request _ A pointer to the NDIS_TAPI request structure for this call.
+
+ typedef struct _NDIS_TAPI_GET_EXTENSION_ID
+ {
+ IN ULONG ulRequestID;
+ IN ULONG ulDeviceID;
+ OUT LINE_EXTENSION_ID LineExtensionID;
+
+ } NDIS_TAPI_GET_EXTENSION_ID, *PNDIS_TAPI_GET_EXTENSION_ID;
+
+ typedef struct _LINE_EXTENSION_ID
+ {
+ ULONG ulExtensionID0;
+ ULONG ulExtensionID1;
+ ULONG ulExtensionID2;
+ ULONG ulExtensionID3;
+
+ } LINE_EXTENSION_ID, *PLINE_EXTENSION_ID;
+
+Return Values:
+
+ NDIS_STATUS_SUCCESS
+ NDIS_STATUS_TAPI_NODRIVER
+
+---------------------------------------------------------------------------*/
+
+{
+ DBG_FUNC("HtTapiGetExtensionID")
+
+ /*
+ // A pointer to our link information structure for the selected line device.
+ */
+ PHTDSU_LINK Link;
+
+ DBG_ENTER(Adapter);
+ DBG_FILTER(Adapter, DBG_PARAMS_ON,
+ ("ulDeviceID=%d\n",
+ Request->ulDeviceID
+ ));
+ /*
+ // This request must be associated with a line device.
+ */
+ Link = GET_LINK_FROM_DEVICEID(Adapter, Request->ulDeviceID);
+ if (Link == NULL)
+ {
+ DBG_WARNING(Adapter, ("Returning NDIS_STATUS_TAPI_NODRIVER\n"));
+ return (NDIS_STATUS_TAPI_NODRIVER);
+ }
+
+ /*
+ // This driver does not support any extensions, so we return zeros.
+ */
+ Request->LineExtensionID.ulExtensionID0 = 0;
+ Request->LineExtensionID.ulExtensionID1 = 0;
+ Request->LineExtensionID.ulExtensionID2 = 0;
+ Request->LineExtensionID.ulExtensionID3 = 0;
+
+ DBG_LEAVE(Adapter);
+
+ return (NDIS_STATUS_SUCCESS);
+}
+
+
+NDIS_STATUS
+HtTapiGetLineDevStatus(
+ IN PHTDSU_ADAPTER Adapter,
+ IN PNDIS_TAPI_GET_LINE_DEV_STATUS Request
+ )
+
+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+Functional Description:
+
+ This request queries the specified open line device for its current status.
+ The information returned is global to all addresses on the line.
+
+Parameters:
+
+ Adapter _ A pointer ot our adapter information structure.
+
+ Request _ A pointer to the NDIS_TAPI request structure for this call.
+
+ typedef struct _NDIS_TAPI_GET_LINE_DEV_STATUS
+ {
+ IN ULONG ulRequestID;
+ IN HDRV_LINE hdLine;
+ OUT LINE_DEV_STATUS LineDevStatus;
+
+ } NDIS_TAPI_GET_LINE_DEV_STATUS, *PNDIS_TAPI_GET_LINE_DEV_STATUS;
+
+ typedef struct _LINE_DEV_STATUS
+ {
+ ULONG ulTotalSize;
+ ULONG ulNeededSize;
+ ULONG ulUsedSize;
+
+ ULONG ulNumOpens;
+ ULONG ulOpenMediaModes;
+ ULONG ulNumActiveCalls;
+ ULONG ulNumOnHoldCalls;
+ ULONG ulNumOnHoldPendCalls;
+ ULONG ulLineFeatures;
+ ULONG ulNumCallCompletions;
+ ULONG ulRingMode;
+ ULONG ulSignalLevel;
+ ULONG ulBatteryLevel;
+ ULONG ulRoamMode;
+
+ ULONG ulDevStatusFlags;
+
+ ULONG ulTerminalModesSize;
+ ULONG ulTerminalModesOffset;
+
+ ULONG ulDevSpecificSize;
+ ULONG ulDevSpecificOffset;
+
+ } LINE_DEV_STATUS, *PLINE_DEV_STATUS;
+
+Return Values:
+
+ NDIS_STATUS_SUCCESS
+ NDIS_STATUS_TAPI_INVALLINEHANDLE
+
+---------------------------------------------------------------------------*/
+
+{
+ DBG_FUNC("HtTapiGetLineDevStatus")
+
+ /*
+ // A pointer to our link information structure for the selected line device.
+ */
+ PHTDSU_LINK Link;
+
+ DBG_ENTER(Adapter);
+ DBG_FILTER(Adapter, DBG_PARAMS_ON,
+ ("hdLine=%Xh\n",
+ Request->hdLine
+ ));
+ /*
+ // This request must be associated with a line device.
+ */
+ Link = GET_LINK_FROM_HDLINE(Adapter, Request->hdLine);
+ if (Link == NULL)
+ {
+ DBG_WARNING(Adapter, ("Returning NDIS_STATUS_TAPI_INVALLINEHANDLE\n"));
+ return (NDIS_STATUS_TAPI_INVALLINEHANDLE);
+ }
+
+#ifndef NDISTAPI_BUG_FIXED
+ Request->LineDevStatus.ulNeededSize =
+ Request->LineDevStatus.ulUsedSize = sizeof(Request->LineDevStatus);
+#endif
+
+ /*
+ // Return the current line status information.
+ */
+ Request->LineDevStatus.ulNumActiveCalls;
+ Link->CallState == LINECALLSTATE_IDLE ? 0 : 1;
+ Request->LineDevStatus.ulLineFeatures;
+ Link->CallState == LINECALLSTATE_IDLE ?
+ LINEFEATURE_MAKECALL : 0;
+ Request->LineDevStatus.ulRingMode =
+ Link->DevState == LINEDEVSTATE_RINGING ? 1: 0;
+ Request->LineDevStatus.ulDevStatusFlags =
+ Link->DevState == LINEDEVSTATE_CONNECTED ?
+ LINEDEVSTATUSFLAGS_INSERVICE | LINEDEVSTATUSFLAGS_CONNECTED : 0;
+
+ DBG_LEAVE(Adapter);
+
+ return (NDIS_STATUS_SUCCESS);
+}
+
+
+NDIS_STATUS
+HtTapiMakeCall(
+ PHTDSU_ADAPTER Adapter,
+ PNDIS_TAPI_MAKE_CALL Request
+ )
+
+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+Functional Description:
+
+ This request places a call on the specified line to the specified
+ destination address. Optionally, call parameters can be specified if
+ anything but default call setup parameters are requested.
+
+Parameters:
+
+ Adapter _ A pointer ot our adapter information structure.
+
+ Request _ A pointer to the NDIS_TAPI request structure for this call.
+
+ typedef struct _NDIS_TAPI_MAKE_CALL
+ {
+ IN ULONG ulRequestID;
+ IN HDRV_LINE hdLine;
+ IN HTAPI_CALL htCall;
+ OUT HDRV_CALL hdCall;
+ IN ULONG ulDestAddressSize;
+ IN ULONG ulDestAddressOffset;
+ IN BOOLEAN bUseDefaultLineCallParams;
+ IN LINE_CALL_PARAMS LineCallParams;
+
+ } NDIS_TAPI_MAKE_CALL, *PNDIS_TAPI_MAKE_CALL;
+
+ typedef struct _LINE_CALL_PARAMS // Defaults:
+ {
+ ULONG ulTotalSize; // ---------
+
+ ULONG ulBearerMode; // voice
+ ULONG ulMinRate; // (3.1kHz)
+ ULONG ulMaxRate; // (3.1kHz)
+ ULONG ulMediaMode; // interactiveVoice
+
+ ULONG ulCallParamFlags; // 0
+ ULONG ulAddressMode; // addressID
+ ULONG ulAddressID; // (any available)
+
+ LINE_DIAL_PARAMS DialParams; // (0, 0, 0, 0)
+
+ ULONG ulOrigAddressSize; // 0
+ ULONG ulOrigAddressOffset;
+ ULONG ulDisplayableAddressSize;
+ ULONG ulDisplayableAddressOffset;
+
+ ULONG ulCalledPartySize; // 0
+ ULONG ulCalledPartyOffset;
+
+ ULONG ulCommentSize; // 0
+ ULONG ulCommentOffset;
+
+ ULONG ulUserUserInfoSize; // 0
+ ULONG ulUserUserInfoOffset;
+
+ ULONG ulHighLevelCompSize; // 0
+ ULONG ulHighLevelCompOffset;
+
+ ULONG ulLowLevelCompSize; // 0
+ ULONG ulLowLevelCompOffset;
+
+ ULONG ulDevSpecificSize; // 0
+ ULONG ulDevSpecificOffset;
+
+ } LINE_CALL_PARAMS, *PLINE_CALL_PARAMS;
+
+ typedef struct _LINE_DIAL_PARAMS
+ {
+ ULONG ulDialPause;
+ ULONG ulDialSpeed;
+ ULONG ulDigitDuration;
+ ULONG ulWaitForDialtone;
+
+ } LINE_DIAL_PARAMS, *PLINE_DIAL_PARAMS;
+
+Return Values:
+
+ NDIS_STATUS_TAPI_ADDRESSBLOCKED
+ NDIS_STATUS_TAPI_BEARERMODEUNAVAIL
+ NDIS_STATUS_TAPI_CALLUNAVAIL
+ NDIS_STATUS_TAPI_DIALBILLING
+ NDIS_STATUS_TAPI_DIALQUIET
+ NDIS_STATUS_TAPI_DIALDIALTONE
+ NDIS_STATUS_TAPI_DIALPROMPT
+ NDIS_STATUS_TAPI_INUSE
+ NDIS_STATUS_TAPI_INVALADDRESSMODE
+ NDIS_STATUS_TAPI_INVALBEARERMODE
+ NDIS_STATUS_TAPI_INVALMEDIAMODE
+ NDIS_STATUS_TAPI_INVALLINESTATE
+ NDIS_STATUS_TAPI_INVALRATE
+ NDIS_STATUS_TAPI_INVALLINEHANDLE
+ NDIS_STATUS_TAPI_INVALADDRESS
+ NDIS_STATUS_TAPI_INVALADDRESSID
+ NDIS_STATUS_TAPI_INVALCALLPARAMS
+ NDIS_STATUS_RESOURCES
+ NDIS_STATUS_TAPI_OPERATIONUNAVAIL
+ NDIS_STATUS_FAILURE
+ NDIS_STATUS_TAPI_RESOURCEUNAVAIL
+ NDIS_STATUS_TAPI_RATEUNAVAIL
+ NDIS_STATUS_TAPI_USERUSERINFOTOOBIG
+
+---------------------------------------------------------------------------*/
+
+{
+ DBG_FUNC("HtTapiMakeCall")
+
+ /*
+ // A pointer to our link information structure for the selected line device.
+ */
+ PHTDSU_LINK Link;
+
+ DBG_ENTER(Adapter);
+ DBG_FILTER(Adapter, DBG_PARAMS_ON,
+ ("hdLine=%Xh\n"
+ "htCall=%Xh\n"
+ "ulDestAddressSize=%d\n"
+ "ulDestAddressOffset=%Xh\n"
+ "bUseDefaultLineCallParams=%d\n"
+ "LineCallParams=%Xh\n",
+ Request->hdLine,
+ Request->htCall,
+ Request->ulDestAddressSize,
+ Request->ulDestAddressOffset,
+ Request->bUseDefaultLineCallParams,
+ Request->LineCallParams
+ ));
+ /*
+ // This request must be associated with a line device.
+ */
+ Link = GET_LINK_FROM_HDLINE(Adapter, Request->hdLine);
+ if (Link == NULL)
+ {
+ DBG_WARNING(Adapter, ("Returning NDIS_STATUS_TAPI_INVALLINEHANDLE\n"));
+ return (NDIS_STATUS_TAPI_INVALLINEHANDLE);
+ }
+
+ /*
+ // We should be idle when this call comes down, but if we're out of
+ // state for seom reason, don't let this go any further.
+ */
+ if (Link->CallState != LINECALLSTATE_IDLE)
+ {
+ DBG_WARNING(Adapter, ("Returning NDIS_STATUS_TAPI_INUSE\n"));
+ return (NDIS_STATUS_TAPI_INUSE);
+ }
+
+ /*
+ // Currently, the defaultCallParams feature is not used by RASTAPI.
+ // Normally, you would save the default params passed into
+ // OID_TAPI_SET_CALL_PARAM and apply them here.
+ */
+ ASSERT(Request->bUseDefaultLineCallParams == FALSE);
+
+ /*
+ // We don't expect user user info.
+ */
+ ASSERT(Request->LineCallParams.ulUserUserInfoSize == 0);
+
+ /*
+ // We gotta make sure the line is in the right state before attempt.
+ */
+ if (Link->LineMode != HTDSU_LINEMODE_DIALUP ||
+ CardStatusNoSignal(Adapter, Link->CardLine) ||
+ CardStatusOutOfService(Adapter, Link->CardLine) ||
+ CardStatusCarrierDetect(Adapter, Link->CardLine))
+ {
+ DBG_WARNING(Adapter, ("Returning NDIS_STATUS_TAPI_OPERATIONUNAVAIL\n"));
+ return (NDIS_STATUS_TAPI_OPERATIONUNAVAIL);
+ }
+
+ /*
+ // Remember the TAPI call connection handle.
+ */
+ Link->htCall = Request->htCall;
+
+ /*
+ // Since we only allow one call per line, we use the same handle.
+ */
+ Request->hdCall = (HDRV_CALL)Link;
+
+ /*
+ // Dial the number if it's available, otherwise it may come via
+ // OID_TAPI_DIAL. Be aware the the phone number format may be
+ // different for other applications. I'm assuming an ASCII digits
+ // string.
+ */
+ if (Request->ulDestAddressSize)
+ {
+ PUCHAR DialString = ((PUCHAR)Request) + Request->ulDestAddressOffset;
+
+ DBG_NOTICE(Adapter,("Dialing: '%s'\n",DialString));
+
+ HtTapiCallStateHandler(Adapter, Link,
+ LINECALLSTATE_DIALTONE, LINEDIALTONEMODE_NORMAL);
+ CardDialNumber(Adapter,
+ Link->CardLine,
+ DialString,
+ Request->ulDestAddressSize
+ );
+ /*
+ // We should see a HTDSU_NO_DIAL_TONE within 5 seconds if the
+ // call will not go through.
+ */
+ HtTapiCallStateHandler(Adapter, Link, LINECALLSTATE_DIALING, 0);
+ NdisMSetTimer(&Link->CallTimer, HTDSU_NO_DIALTONE_TIMEOUT);
+ }
+
+ DBG_LEAVE(Adapter);
+
+ return (NDIS_STATUS_SUCCESS);
+}
+
+
+NDIS_STATUS
+HtTapiNegotiateExtVersion(
+ IN PHTDSU_ADAPTER Adapter,
+ IN PNDIS_TAPI_NEGOTIATE_EXT_VERSION Request
+ )
+
+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+Functional Description:
+
+ This request returns the highest extension version number the service
+ provider is willing to operate under for this device given the range of
+ possible extension versions.
+
+Parameters:
+
+ Adapter _ A pointer ot our adapter information structure.
+
+ Request _ A pointer to the NDIS_TAPI request structure for this call.
+
+ typedef struct _NDIS_TAPI_NEGOTIATE_EXT_VERSION
+ {
+ IN ULONG ulRequestID;
+ IN ULONG ulDeviceID;
+ IN ULONG ulLowVersion;
+ IN ULONG ulHighVersion;
+ OUT ULONG ulExtVersion;
+ } NDIS_TAPI_NEGOTIATE_EXT_VERSION, *PNDIS_TAPI_NEGOTIATE_EXT_VERSION;
+
+Return Values:
+
+ NDIS_STATUS_SUCCESS
+ NDIS_STATUS_TAPI_INCOMPATIBLEEXTVERSION
+
+---------------------------------------------------------------------------*/
+
+{
+ DBG_FUNC("HtTapiNegotiateExtVersion")
+
+ DBG_ENTER(Adapter);
+ DBG_FILTER(Adapter, DBG_PARAMS_ON,
+ ("ulDeviceID=%d\n"
+ "ulLowVersion=%Xh\n"
+ "ulHighVersion=%Xh\n",
+ Request->ulDeviceID,
+ Request->ulLowVersion,
+ Request->ulHighVersion
+ ));
+ /*
+ // Make sure the miniport's version number is within the allowable
+ // range requested by the caller. We ignore the ulDeviceID because
+ // the version information applies to all devices on this adapter.
+ */
+ if (HTDSU_TAPI_EXT_VERSION < Request->ulLowVersion ||
+ HTDSU_TAPI_EXT_VERSION > Request->ulHighVersion)
+ {
+ DBG_WARNING(Adapter, ("NDIS_STATUS_TAPI_INCOMPATIBLEEXTVERSION\n"));
+ return (NDIS_STATUS_TAPI_INCOMPATIBLEEXTVERSION);
+ }
+
+ /*
+ // Looks like we're compatible, so tell the caller what we expect.
+ */
+ Request->ulExtVersion = HTDSU_TAPI_EXT_VERSION;
+
+ DBG_LEAVE(Adapter);
+
+ return (NDIS_STATUS_SUCCESS);
+}
+
+
+NDIS_STATUS
+HtTapiOpen(
+ PHTDSU_ADAPTER Adapter,
+ PNDIS_TAPI_OPEN Request
+ )
+
+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+Functional Description:
+
+ This function opens the line device whose device ID is given, returning
+ the miniport’s handle for the device. The miniport must retain the
+ Connection Wrapper's handle for the device for use in subsequent calls to
+ the LINE_EVENT callback procedure.
+
+Parameters:
+
+ Adapter _ A pointer ot our adapter information structure.
+
+ Request - A pointer to the NDIS_TAPI request structure for this call.
+
+ typedef struct _NDIS_TAPI_OPEN
+ {
+ IN ULONG ulRequestID;
+ IN ULONG ulDeviceID;
+ IN HTAPI_LINE htLine;
+ OUT HDRV_LINE hdLine;
+
+ } NDIS_TAPI_OPEN, *PNDIS_TAPI_OPEN;
+
+Return Values:
+
+ NDIS_STATUS_PENDING
+ NDIS_STATUS_TAPI_ALLOCATED
+ NDIS_STATUS_TAPI_NODRIVER
+
+---------------------------------------------------------------------------*/
+
+{
+ DBG_FUNC("HtTapiOpen")
+
+ /*
+ // A pointer to our link information structure for the selected line device.
+ */
+ PHTDSU_LINK Link;
+
+ DBG_ENTER(Adapter);
+ DBG_FILTER(Adapter, DBG_PARAMS_ON,
+ ("ulDeviceID=%d\n"
+ "htLine=%Xh\n",
+ Request->ulDeviceID,
+ Request->htLine
+ ));
+ /*
+ // This request must be associated with a line device.
+ */
+ Link = GET_LINK_FROM_DEVICEID(Adapter, Request->ulDeviceID);
+ if (Link == NULL)
+ {
+ DBG_WARNING(Adapter, ("Returning NDIS_STATUS_TAPI_NODRIVER\n"));
+ return (NDIS_STATUS_TAPI_NODRIVER);
+ }
+
+ /*
+ // Make sure the requested line device is not already in use.
+ */
+ Link = LinkAllocate(Adapter, Request->htLine,
+ (USHORT) (Link->CardLine-HTDSU_CMD_LINE1));
+ if (Link == NULL)
+ {
+ DBG_WARNING(Adapter, ("Returning NDIS_STATUS_TAPI_ALLOCATED\n"));
+ return (NDIS_STATUS_TAPI_ALLOCATED);
+ }
+
+ /*
+ // Tell the wrapper the line context and set the line/call state.
+ */
+ Request->hdLine = (HDRV_LINE)Link;
+ HtTapiLineDevStateHandler(Adapter, Link, LINEDEVSTATE_OPEN);
+
+ DBG_LEAVE(Adapter);
+
+ return (NDIS_STATUS_SUCCESS);
+}
+
+
+NDIS_STATUS
+HtTapiProviderInitialize(
+ PHTDSU_ADAPTER Adapter,
+ PNDIS_TAPI_PROVIDER_INITIALIZE Request
+ )
+
+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+Functional Description:
+
+ This request initializes the TAPI portion of the miniport.
+
+Parameters:
+
+ Adapter _ A pointer ot our adapter information structure.
+
+ Request _ A pointer to the NDIS_TAPI request structure for this call.
+
+ typedef struct _NDIS_TAPI_PROVIDER_INITIALIZE
+ {
+ IN ULONG ulRequestID;
+ IN ULONG ulDeviceIDBase;
+ OUT ULONG ulNumLineDevs;
+ OUT ULONG ulProviderID;
+
+ } NDIS_TAPI_PROVIDER_INITIALIZE, *PNDIS_TAPI_PROVIDER_INITIALIZE;
+
+Return Values:
+
+ NDIS_STATUS_SUCCESS
+ NDIS_STATUS_RESOURCES
+ NDIS_STATUS_FAILURE
+ NDIS_STATUS_TAPI_RESOURCEUNAVAIL
+
+---------------------------------------------------------------------------*/
+
+{
+ DBG_FUNC("HtTapiProviderInitialize")
+
+ DBG_ENTER(Adapter);
+ DBG_FILTER(Adapter, DBG_PARAMS_ON,
+ ("ulDeviceIDBase=%d\n",
+ Request->ulDeviceIDBase
+ ));
+ /*
+ // Save the device ID base value.
+ */
+ Adapter->DeviceIdBase = Request->ulDeviceIDBase;
+
+ /*
+ // Return the number of DSU lines. Assumes the miniport has initialized,
+ // self-tested, etc.
+ */
+ Request->ulNumLineDevs = Adapter->NumLineDevs;
+
+ /*
+ // Before completing the PROVIDER_INIT request, the miniport should fill
+ // in the ulNumLineDevs field of the request with the number of line
+ // devices supported by the adapter. The miniport should also set the
+ // ulProviderID field to a unique (per adapter) value. (There is no
+ // method currently in place to guarantee unique ulProviderID values,
+ // so we use the virtual address of our adapter structure.)
+ */
+ Request->ulProviderID = (ULONG)Adapter;
+
+ DBG_LEAVE(Adapter);
+
+ return (NDIS_STATUS_SUCCESS);
+}
+
+
+NDIS_STATUS
+HtTapiAccept(
+ IN PHTDSU_ADAPTER Adapter,
+ IN PNDIS_TAPI_ACCEPT Request
+ )
+
+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+Functional Description:
+
+ This request accepts the specified offered call. It may optionally send
+ the specified user-to-user information to the calling party.
+
+Parameters:
+
+ Adapter _ A pointer ot our adapter information structure.
+
+ Request _ A pointer to the NDIS_TAPI request structure for this call.
+
+ typedef struct _NDIS_TAPI_ACCEPT
+ {
+ IN ULONG ulRequestID;
+ IN HDRV_CALL hdCall;
+ IN ULONG ulUserUserInfoSize;
+ IN UCHAR UserUserInfo[1];
+
+ } NDIS_TAPI_ACCEPT, *PNDIS_TAPI_ACCEPT;
+
+Return Values:
+
+ NDIS_STATUS_SUCCESS
+ NDIS_STATUS_FAILURE
+ NDIS_STATUS_TAPI_INVALCALLHANDLE
+ NDIS_STATUS_TAPI_OPERATIONUNAVAIL
+
+---------------------------------------------------------------------------*/
+
+{
+ DBG_FUNC("HtTapiAccept")
+
+ /*
+ // A pointer to our link information structure for the selected line device.
+ */
+ PHTDSU_LINK Link;
+
+ DBG_ENTER(Adapter);
+ DBG_FILTER(Adapter, DBG_PARAMS_ON,
+ ("hdCall=%Xh\n"
+ "ulUserUserInfoSize=%d\n"
+ "UserUserInfo=%Xh\n",
+ Request->hdCall,
+ Request->ulUserUserInfoSize,
+ Request->UserUserInfo
+ ));
+ /*
+ // This request must be associated with a call.
+ */
+ Link = GET_LINK_FROM_HDCALL(Adapter, Request->hdCall);
+ if (Link == NULL)
+ {
+ DBG_WARNING(Adapter, ("Returning NDIS_STATUS_TAPI_INVALCALLHANDLE\n"));
+ return (NDIS_STATUS_TAPI_INVALCALLHANDLE);
+ }
+
+ /*
+ // We don't expect user user info.
+ */
+ ASSERT(Request->ulUserUserInfoSize == 0);
+
+ /*
+ // Note that the call has been accepted, we should see and answer soon.
+ */
+ HtTapiCallStateHandler(Adapter, Link, LINECALLSTATE_ACCEPTED, 0);
+
+ DBG_LEAVE(Adapter);
+
+ return (NDIS_STATUS_SUCCESS);
+}
+
+
+NDIS_STATUS
+HtTapiAnswer(
+ IN PHTDSU_ADAPTER Adapter,
+ IN PNDIS_TAPI_ANSWER Request
+ )
+
+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+Functional Description:
+
+ This request answers the specified offering call. It may optionally send
+ the specified user-to-user information to the calling party.
+
+Parameters:
+
+ Adapter _ A pointer ot our adapter information structure.
+
+ Request _ A pointer to the NDIS_TAPI request structure for this call.
+
+ typedef struct _NDIS_TAPI_ANSWER
+ {
+ IN ULONG ulRequestID;
+ IN HDRV_CALL hdCall;
+ IN ULONG ulUserUserInfoSize;
+ IN UCHAR UserUserInfo[1];
+
+ } NDIS_TAPI_ANSWER, *PNDIS_TAPI_ANSWER;
+
+Return Values:
+
+ NDIS_STATUS_SUCCESS
+ NDIS_STATUS_TAPI_INVALCALLHANDLE
+
+---------------------------------------------------------------------------*/
+
+{
+ DBG_FUNC("HtTapiAnswer")
+
+ /*
+ // A pointer to our link information structure for the selected line device.
+ */
+ PHTDSU_LINK Link;
+
+ DBG_ENTER(Adapter);
+ DBG_FILTER(Adapter, DBG_PARAMS_ON,
+ ("hdCall=%Xh\n"
+ "ulUserUserInfoSize=%d\n"
+ "UserUserInfo=%Xh\n",
+ Request->hdCall,
+ Request->ulUserUserInfoSize,
+ Request->UserUserInfo
+ ));
+ /*
+ // This request must be associated with a call.
+ */
+ Link = GET_LINK_FROM_HDCALL(Adapter, Request->hdCall);
+ if (Link == NULL)
+ {
+ DBG_WARNING(Adapter, ("Returning NDIS_STATUS_TAPI_INVALCALLHANDLE\n"));
+ return (NDIS_STATUS_TAPI_INVALCALLHANDLE);
+ }
+
+ /*
+ // We don't expect user user info.
+ */
+ ASSERT(Request->ulUserUserInfoSize == 0);
+
+ /*
+ // Tell the adapter to pick up the line, and wait for a connect interrupt.
+ */
+ CardLineAnswer(Adapter, Link->CardLine);
+ NdisMSetTimer(&Link->CallTimer, HTDSU_NO_CONNECT_TIMEOUT);
+
+ DBG_LEAVE(Adapter);
+
+ return (NDIS_STATUS_SUCCESS);
+}
+
+
+NDIS_STATUS
+HtTapiClose(
+ IN PHTDSU_ADAPTER Adapter,
+ IN PNDIS_TAPI_CLOSE Request
+ )
+
+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+Functional Description:
+
+ This request closes the specified open line device after completing or
+ aborting all outstanding calls and asynchronous requests on the device.
+
+Parameters:
+
+ Adapter _ A pointer ot our adapter information structure.
+
+ Request _ A pointer to the NDIS_TAPI request structure for this call.
+
+ typedef struct _NDIS_TAPI_CLOSE
+ {
+ IN ULONG ulRequestID;
+ IN HDRV_LINE hdLine;
+
+ } NDIS_TAPI_CLOSE, *PNDIS_TAPI_CLOSE;
+
+Return Values:
+
+ NDIS_STATUS_SUCCESS
+ NDIS_STATUS_PENDING
+ NDIS_STATUS_TAPI_INVALLINEHANDLE
+
+---------------------------------------------------------------------------*/
+
+{
+ DBG_FUNC("HtTapiClose")
+
+ /*
+ // A pointer to our link information structure for the selected line device.
+ */
+ PHTDSU_LINK Link;
+
+ /*
+ // The results of this call.
+ */
+ NDIS_STATUS Status;
+
+ DBG_ENTER(Adapter);
+ DBG_FILTER(Adapter, DBG_PARAMS_ON,
+ ("hdLine=%Xh\n",
+ Request->hdLine
+ ));
+ /*
+ // This request must be associated with a line device.
+ */
+ Link = GET_LINK_FROM_HDLINE(Adapter, Request->hdLine);
+ if (Link == NULL)
+ {
+ DBG_WARNING(Adapter, ("Returning NDIS_STATUS_TAPI_INVALLINEHANDLE\n"));
+ return (NDIS_STATUS_TAPI_INVALLINEHANDLE);
+ }
+
+ /*
+ // Mark the link as closing, so no more packets will be accepted,
+ // and when the last transmit is complete, the link will be closed.
+ */
+ if (Link->NumTxQueued)
+ {
+ Status = NDIS_STATUS_PENDING;
+ Link->Closing = TRUE;
+ }
+ else
+ {
+ HtTapiLineDevStateHandler(Adapter, Link, LINEDEVSTATE_CLOSE);
+ LinkRelease(Link);
+ Status = NDIS_STATUS_SUCCESS;
+ }
+
+ DBG_LEAVE(Adapter);
+
+ return (Status);
+}
+
+
+NDIS_STATUS
+HtTapiCloseCall(
+ IN PHTDSU_ADAPTER Adapter,
+ IN PNDIS_TAPI_CLOSE_CALL Request
+ )
+
+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+Functional Description:
+
+ This request deallocates the call after completing or aborting all
+ outstanding asynchronous requests on the call.
+
+Parameters:
+
+ Adapter _ A pointer ot our adapter information structure.
+
+ Request _ A pointer to the NDIS_TAPI request structure for this call.
+
+ typedef struct _NDIS_TAPI_CLOSE_CALL
+ {
+ IN ULONG ulRequestID;
+ IN HDRV_CALL hdCall;
+
+ } NDIS_TAPI_CLOSE_CALL, *PNDIS_TAPI_CLOSE_CALL;
+
+Return Values:
+
+ NDIS_STATUS_SUCCESS
+ NDIS_STATUS_TAPI_INVALCALLHANDLE
+
+---------------------------------------------------------------------------*/
+
+{
+ DBG_FUNC("HtTapiCloseCall")
+
+ /*
+ // A pointer to our link information structure for the selected line device.
+ */
+ PHTDSU_LINK Link;
+
+ /*
+ // The results of this call.
+ */
+ NDIS_STATUS Status;
+
+ DBG_ENTER(Adapter);
+ DBG_FILTER(Adapter, DBG_PARAMS_ON,
+ ("hdCall=%Xh\n",
+ Request->hdCall
+ ));
+ /*
+ // This request must be associated with a call.
+ */
+ Link = GET_LINK_FROM_HDCALL(Adapter, Request->hdCall);
+ if (Link == NULL)
+ {
+ DBG_WARNING(Adapter, ("Returning NDIS_STATUS_TAPI_INVALCALLHANDLE\n"));
+ return (NDIS_STATUS_TAPI_INVALCALLHANDLE);
+ }
+
+ /*
+ // Mark the link as closing, so no more packets will be accepted,
+ // and when the last transmit is complete, the link will be closed.
+ */
+ if (Link->NumTxQueued)
+ {
+ Link->CallClosing = TRUE;
+ Status = NDIS_STATUS_PENDING;
+ }
+ else
+ {
+ HtTapiCallStateHandler(Adapter, Link, LINECALLSTATE_IDLE, 0);
+ Status = NDIS_STATUS_SUCCESS;
+ }
+
+ DBG_LEAVE(Adapter);
+
+ return (Status);
+}
+
+
+NDIS_STATUS
+HtTapiConditionalMediaDetection(
+ IN PHTDSU_ADAPTER Adapter,
+ IN PNDIS_TAPI_CONDITIONAL_MEDIA_DETECTION Request
+ )
+
+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+Functional Description:
+
+ This request is invoked by the Connection Wrapper whenever a client
+ application uses LINEMAPPER as the dwDeviceID in the lineOpen function
+ to request that lines be scanned to find one that supports the desired
+ media mode(s) and call parameters. The Connection Wrapper scans based on
+ the union of the desired media modes and the other media modes currently
+ being monitored on the line, to give the miniport the opportunity to
+ indicate if it cannot simultaneously monitor for all of the requested
+ media modes. If the miniport can monitor for the indicated set of media
+ modes AND support the capabilities indicated in CallParams, it replies
+ with a “success” inidication. It leaves the active media monitoring modes
+ for the line unchanged.
+
+Parameters:
+
+ Adapter _ A pointer ot our adapter information structure.
+
+ Request _ A pointer to the NDIS_TAPI request structure for this call.
+
+ typedef struct _NDIS_TAPI_CONDITIONAL_MEDIA_DETECTION
+ {
+ IN ULONG ulRequestID;
+ IN HDRV_LINE hdLine;
+ IN ULONG ulMediaModes;
+ IN LINE_CALL_PARAMS LineCallParams;
+
+ } NDIS_TAPI_CONDITIONAL_MEDIA_DETECTION, *PNDIS_TAPI_CONDITIONAL_MEDIA_DETECTION;
+
+ typedef struct _LINE_CALL_PARAMS // Defaults:
+ {
+ ULONG ulTotalSize; // ---------
+
+ ULONG ulBearerMode; // voice
+ ULONG ulMinRate; // (3.1kHz)
+ ULONG ulMaxRate; // (3.1kHz)
+ ULONG ulMediaMode; // interactiveVoice
+
+ ULONG ulCallParamFlags; // 0
+ ULONG ulAddressMode; // addressID
+ ULONG ulAddressID; // (any available)
+
+ LINE_DIAL_PARAMS DialParams; // (0, 0, 0, 0)
+
+ ULONG ulOrigAddressSize; // 0
+ ULONG ulOrigAddressOffset;
+ ULONG ulDisplayableAddressSize;
+ ULONG ulDisplayableAddressOffset;
+
+ ULONG ulCalledPartySize; // 0
+ ULONG ulCalledPartyOffset;
+
+ ULONG ulCommentSize; // 0
+ ULONG ulCommentOffset;
+
+ ULONG ulUserUserInfoSize; // 0
+ ULONG ulUserUserInfoOffset;
+
+ ULONG ulHighLevelCompSize; // 0
+ ULONG ulHighLevelCompOffset;
+
+ ULONG ulLowLevelCompSize; // 0
+ ULONG ulLowLevelCompOffset;
+
+ ULONG ulDevSpecificSize; // 0
+ ULONG ulDevSpecificOffset;
+
+ } LINE_CALL_PARAMS, *PLINE_CALL_PARAMS;
+
+ typedef struct _LINE_DIAL_PARAMS
+ {
+ ULONG ulDialPause;
+ ULONG ulDialSpeed;
+ ULONG ulDigitDuration;
+ ULONG ulWaitForDialtone;
+
+ } LINE_DIAL_PARAMS, *PLINE_DIAL_PARAMS;
+
+Return Values:
+
+ NDIS_STATUS_SUCCESS
+ NDIS_STATUS_TAPI_INVALLINEHANDLE
+
+---------------------------------------------------------------------------*/
+
+{
+ DBG_FUNC("HtTapiConditionalMediaDetection")
+
+ /*
+ // A pointer to our link information structure for the selected line device.
+ */
+ PHTDSU_LINK Link;
+
+ DBG_ENTER(Adapter);
+ DBG_FILTER(Adapter, DBG_PARAMS_ON,
+ ("hdLine=%Xh\n"
+ "ulMediaModes=%Xh\n"
+ "LineCallParams=%Xh\n",
+ Request->hdLine,
+ Request->ulMediaModes,
+ &Request->LineCallParams
+ ));
+ /*
+ // This request must be associated with a line device.
+ */
+ Link = GET_LINK_FROM_HDLINE(Adapter, Request->hdLine);
+ if (Link == NULL)
+ {
+ DBG_WARNING(Adapter, ("Returning NDIS_STATUS_TAPI_INVALLINEHANDLE\n"));
+ return (NDIS_STATUS_TAPI_INVALLINEHANDLE);
+ }
+
+ /*
+ // We don't expect user user info.
+ */
+ ASSERT(Request->LineCallParams.ulUserUserInfoSize == 0);
+
+ /*
+ // I pretty much ignore all this since this adapter only supports
+ // digital data. If your adapter supports different medias or
+ // voice and data, you will need to save the necessary paramters.
+ */
+ Link->MediaModesMask = Request->ulMediaModes;
+
+ DBG_LEAVE(Adapter);
+
+ return (NDIS_STATUS_SUCCESS);
+}
+
+
+NDIS_STATUS
+HtTapiDial(
+ IN PHTDSU_ADAPTER Adapter,
+ IN PNDIS_TAPI_DIAL Request
+ )
+
+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+Functional Description:
+
+ This request dials the specified dialable number on the specified call.
+
+Parameters:
+
+ Adapter _ A pointer ot our adapter information structure.
+
+ Request _ A pointer to the NDIS_TAPI request structure for this call.
+
+ typedef struct _NDIS_TAPI_DIAL
+ {
+ IN ULONG ulRequestID;
+ IN HDRV_CALL hdCall;
+ IN ULONG ulDestAddressSize;
+ IN CHAR szDestAddress[1];
+
+ } NDIS_TAPI_DIAL, *PNDIS_TAPI_DIAL;
+
+Return Values:
+
+ NDIS_STATUS_TAPI_INVALCALLHANDLE
+ NDIS_STATUS_TAPI_OPERATIONUNAVAIL
+
+---------------------------------------------------------------------------*/
+
+{
+ DBG_FUNC("HtTapiDial")
+
+ /*
+ // A pointer to our link information structure for the selected line device.
+ */
+ PHTDSU_LINK Link;
+
+ DBG_ENTER(Adapter);
+ DBG_FILTER(Adapter, DBG_PARAMS_ON,
+ ("hdCall=%Xh\n"
+ "ulDestAddressSize=%d\n"
+ "szDestAddress=%Xh\n",
+ Request->hdCall,
+ Request->ulDestAddressSize,
+ Request->szDestAddress
+ ));
+ /*
+ // This request must be associated with a call.
+ */
+ Link = GET_LINK_FROM_HDCALL(Adapter, Request->hdCall);
+ if (Link == NULL)
+ {
+ DBG_WARNING(Adapter, ("Returning NDIS_STATUS_TAPI_INVALCALLHANDLE\n"));
+ return (NDIS_STATUS_TAPI_INVALCALLHANDLE);
+ }
+
+ /*
+ // RASTAPI only places calls through the MAKE_CALL interface.
+ */
+
+ DBG_LEAVE(Adapter);
+
+ return (NDIS_STATUS_TAPI_OPERATIONUNAVAIL);
+}
+
+
+NDIS_STATUS
+HtTapiDrop(
+ IN PHTDSU_ADAPTER Adapter,
+ IN PNDIS_TAPI_DROP Request
+ )
+
+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+Functional Description:
+
+ This request drops or disconnects the specified call. User-to-user
+ information can optionally be transmitted as part of the call disconnect.
+ This function can be called by the application at any time. When
+ OID_TAPI_DROP returns with success, the call should be idle.
+
+Parameters:
+
+ Adapter _ A pointer ot our adapter information structure.
+
+ Request _ A pointer to the NDIS_TAPI request structure for this call.
+
+ typedef struct _NDIS_TAPI_DROP
+ {
+ IN ULONG ulRequestID;
+ IN HDRV_CALL hdCall;
+ IN ULONG ulUserUserInfoSize;
+ IN UCHAR UserUserInfo[1];
+
+ } NDIS_TAPI_DROP, *PNDIS_TAPI_DROP;
+
+Return Values:
+
+ NDIS_STATUS_SUCCESS
+ NDIS_STATUS_TAPI_INVALCALLHANDLE
+
+---------------------------------------------------------------------------*/
+
+{
+ DBG_FUNC("HtTapiDrop")
+
+ /*
+ // A pointer to our link information structure for the selected line device.
+ */
+ PHTDSU_LINK Link;
+
+ DBG_ENTER(Adapter);
+ DBG_FILTER(Adapter, DBG_PARAMS_ON,
+ ("hdCall=%Xh\n"
+ "ulUserUserInfoSize=%d\n"
+ "UserUserInfo=%Xh\n",
+ Request->hdCall,
+ Request->ulUserUserInfoSize,
+ Request->UserUserInfo
+ ));
+ /*
+ // This request must be associated with a call.
+ */
+ Link = GET_LINK_FROM_HDCALL(Adapter, Request->hdCall);
+ if (Link == NULL)
+ {
+ DBG_WARNING(Adapter, ("Returning NDIS_STATUS_TAPI_INVALCALLHANDLE\n"));
+ return (NDIS_STATUS_TAPI_INVALCALLHANDLE);
+ }
+
+ /*
+ // We don't expect user user info.
+ */
+ ASSERT(Request->ulUserUserInfoSize == 0);
+
+ /*
+ // The user wants to disconnect, so make it happen cappen.
+ */
+ HtTapiCallStateHandler(Adapter, Link,
+ LINECALLSTATE_DISCONNECTED, LINEDISCONNECTMODE_NORMAL);
+
+ /*
+ // Under some conditions, we may not get a CLOSE_CALL, so the
+ // line would be left unusable if we don't timeout and force a
+ // close call condition.
+ */
+ NdisMSetTimer(&Link->CallTimer, HTDSU_NO_CLOSECALL_TIMEOUT);
+
+ DBG_LEAVE(Adapter);
+
+ return (NDIS_STATUS_SUCCESS);
+}
+
+
+NDIS_STATUS
+HtTapiProviderShutdown(
+ IN PHTDSU_ADAPTER Adapter,
+ IN PNDIS_TAPI_PROVIDER_SHUTDOWN Request
+ )
+
+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+Functional Description:
+
+ This request shuts down the miniport. The miniport should terminate any
+ activities it has in progress.
+
+Parameters:
+
+ Adapter _ A pointer ot our adapter information structure.
+
+ Request _ A pointer to the NDIS_TAPI request structure for this call.
+
+ typedef struct _NDIS_TAPI_PROVIDER_SHUTDOWN
+ {
+ IN ULONG ulRequestID;
+
+ } NDIS_TAPI_PROVIDER_SHUTDOWN, *PNDIS_TAPI_PROVIDER_SHUTDOWN;
+
+Return Values:
+
+ NDIS_STATUS_SUCCESS
+
+---------------------------------------------------------------------------*/
+
+{
+ DBG_FUNC("HtTapiProviderShutdown")
+
+ /*
+ // A pointer to our link information structure for the selected line device.
+ */
+ PHTDSU_LINK Link;
+
+ /*
+ // Used to interate over the links.
+ */
+ USHORT LinkIndex;
+
+ DBG_ENTER(Adapter);
+
+ /*
+ // Hangup all of the lines.
+ */
+ for (LinkIndex = 0; LinkIndex < Adapter->NumLineDevs; LinkIndex++)
+ {
+ Link = GET_LINK_FROM_LINKINDEX(Adapter, LinkIndex);
+
+ if (Link->Adapter)
+ {
+ /*
+ // Force the call to drop
+ */
+ if (Link->CallState != LINECALLSTATE_IDLE)
+ {
+ CardLineDisconnect(Adapter, Link->CardLine);
+ }
+
+ /*
+ // Indicate LINE_DOWN status and release the link structure.
+ */
+ LinkLineDown(Link);
+ LinkRelease(Link);
+ }
+ }
+ Adapter->NumOpens = 0;
+
+ DBG_LEAVE(Adapter);
+
+ return (NDIS_STATUS_SUCCESS);
+}
+
+
+NDIS_STATUS
+HtTapiSecureCall(
+ IN PHTDSU_ADAPTER Adapter,
+ IN PNDIS_TAPI_SECURE_CALL Request
+ )
+
+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+Functional Description:
+
+ This request secures the call from any interruptions or interference that
+ may affect the call’s media stream.
+
+Parameters:
+
+ Adapter _ A pointer ot our adapter information structure.
+
+ Request _ A pointer to the NDIS_TAPI request structure for this call.
+
+ typedef struct _NDIS_TAPI_SECURE_CALL
+ {
+ IN ULONG ulRequestID;
+ IN HDRV_CALL hdCall;
+
+ } NDIS_TAPI_SECURE_CALL, *PNDIS_TAPI_SECURE_CALL;
+
+Return Values:
+
+ NDIS_STATUS_TAPI_INVALCALLHANDLE
+ NDIS_STATUS_TAPI_OPERATIONUNAVAIL
+
+---------------------------------------------------------------------------*/
+
+{
+ DBG_FUNC("HtTapiSecureCall")
+
+ /*
+ // A pointer to our link information structure for the selected line device.
+ */
+ PHTDSU_LINK Link;
+
+ DBG_ENTER(Adapter);
+ DBG_FILTER(Adapter, DBG_PARAMS_ON,
+ ("hdCall=%Xh\n",
+ Request->hdCall
+ ));
+ /*
+ // This request must be associated with a call.
+ */
+ Link = GET_LINK_FROM_HDCALL(Adapter, Request->hdCall);
+ if (Link == NULL)
+ {
+ DBG_WARNING(Adapter, ("Returning NDIS_STATUS_TAPI_INVALCALLHANDLE\n"));
+ return (NDIS_STATUS_TAPI_INVALCALLHANDLE);
+ }
+
+ /*
+ // RASTAPI has no support for this feature yet.
+ */
+
+ DBG_LEAVE(Adapter);
+
+ return (NDIS_STATUS_TAPI_OPERATIONUNAVAIL);
+}
+
+
+NDIS_STATUS
+HtTapiSelectExtVersion(
+ IN PHTDSU_ADAPTER Adapter,
+ IN PNDIS_TAPI_SELECT_EXT_VERSION Request
+ )
+
+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+Functional Description:
+
+ This request selects the indicated extension version for the indicated
+ line device. Subsequent requests operate according to that extension
+ version.
+
+Parameters:
+
+ Adapter _ A pointer ot our adapter information structure.
+
+ Request _ A pointer to the NDIS_TAPI request structure for this call.
+
+ typedef struct _NDIS_TAPI_SELECT_EXT_VERSION
+ {
+ IN ULONG ulRequestID;
+ IN HDRV_LINE hdLine;
+ IN ULONG ulExtVersion;
+
+ } NDIS_TAPI_SELECT_EXT_VERSION, *PNDIS_TAPI_SELECT_EXT_VERSION;
+
+Return Values:
+
+ NDIS_STATUS_TAPI_INVALLINEHANDLE
+ NDIS_STATUS_TAPI_OPERATIONUNAVAIL
+
+---------------------------------------------------------------------------*/
+
+{
+ DBG_FUNC("HtTapiSelectExtVersion")
+
+ /*
+ // A pointer to our link information structure for the selected line device.
+ */
+ PHTDSU_LINK Link;
+
+ DBG_ENTER(Adapter);
+ DBG_FILTER(Adapter, DBG_PARAMS_ON,
+ ("hdLine=%Xh\n"
+ "ulExtVersion=%Xh\n",
+ Request->hdLine,
+ Request->ulExtVersion
+ ));
+ /*
+ // This request must be associated with a line device.
+ */
+ Link = GET_LINK_FROM_HDLINE(Adapter, Request->hdLine);
+ if (Link == NULL)
+ {
+ DBG_WARNING(Adapter, ("Returning NDIS_STATUS_TAPI_INVALLINEHANDLE\n"));
+ return (NDIS_STATUS_TAPI_INVALLINEHANDLE);
+ }
+
+ /*
+ // NDISTAPI does not support this feature yet.
+ */
+
+ DBG_LEAVE(Adapter);
+
+ return (NDIS_STATUS_TAPI_OPERATIONUNAVAIL);
+}
+
+
+NDIS_STATUS
+HtTapiSendUserUserInfo(
+ IN PHTDSU_ADAPTER Adapter,
+ IN PNDIS_TAPI_SEND_USER_USER_INFO Request
+ )
+
+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+Functional Description:
+
+ This request sends user-to-user information to the remote party on the
+ specified call.
+
+Parameters:
+
+ Adapter _ A pointer ot our adapter information structure.
+
+ Request _ A pointer to the NDIS_TAPI request structure for this call.
+
+ typedef struct _NDIS_TAPI_SEND_USER_USER_INFO
+ {
+ IN ULONG ulRequestID;
+ IN HDRV_CALL hdCall;
+ IN ULONG ulUserUserInfoSize;
+ IN UCHAR UserUserInfo[1];
+
+ } NDIS_TAPI_SEND_USER_USER_INFO, *PNDIS_TAPI_SEND_USER_USER_INFO;
+
+Return Values:
+
+ NDIS_STATUS_TAPI_INVALCALLHANDLE
+ NDIS_STATUS_TAPI_OPERATIONUNAVAIL
+
+---------------------------------------------------------------------------*/
+
+{
+ DBG_FUNC("HtTapiSendUserUserInfo")
+
+ /*
+ // A pointer to our link information structure for the selected line device.
+ */
+ PHTDSU_LINK Link;
+
+ DBG_ENTER(Adapter);
+ DBG_FILTER(Adapter, DBG_PARAMS_ON,
+ ("hdCall=%Xh\n"
+ "ulUserUserInfoSize=%d\n"
+ "UserUserInfo=%Xh\n",
+ Request->hdCall,
+ Request->ulUserUserInfoSize,
+ Request->UserUserInfo
+ ));
+ /*
+ // This request must be associated with a call.
+ */
+ Link = GET_LINK_FROM_HDCALL(Adapter, Request->hdCall);
+ if (Link == NULL)
+ {
+ DBG_WARNING(Adapter, ("Returning NDIS_STATUS_TAPI_INVALCALLHANDLE\n"));
+ return (NDIS_STATUS_TAPI_INVALCALLHANDLE);
+ }
+
+ /*
+ // We don't expect user user info.
+ */
+ ASSERT(Request->ulUserUserInfoSize == 0);
+
+ /*
+ // If your adapter has support for this feature, or uses it like
+ // ISDN, you need to find all occurances of ulUserUserInfoSize.
+ // It is included in a number of service provider calls.
+ */
+
+ DBG_LEAVE(Adapter);
+
+ return (NDIS_STATUS_TAPI_OPERATIONUNAVAIL);
+}
+
+
+NDIS_STATUS
+HtTapiSetAppSpecific(
+ IN PHTDSU_ADAPTER Adapter,
+ IN PNDIS_TAPI_SET_APP_SPECIFIC Request
+ )
+
+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+Functional Description:
+
+ This request sets the application-specific field of the specified call’s
+ LINECALLINFO structure.
+
+Parameters:
+
+ Adapter _ A pointer ot our adapter information structure.
+
+ Request _ A pointer to the NDIS_TAPI request structure for this call.
+
+ typedef struct _NDIS_TAPI_SET_APP_SPECIFIC
+ {
+ IN ULONG ulRequestID;
+ IN HDRV_CALL hdCall;
+ IN ULONG ulAppSpecific;
+
+ } NDIS_TAPI_SET_APP_SPECIFIC, *PNDIS_TAPI_SET_APP_SPECIFIC;
+
+Return Values:
+
+ NDIS_STATUS_SUCCESS
+ NDIS_STATUS_FAILURE
+ NDIS_STATUS_TAPI_INVALCALLHANDLE
+
+---------------------------------------------------------------------------*/
+
+{
+ DBG_FUNC("HtTapiSetAppSpecific")
+
+ /*
+ // A pointer to our link information structure for the selected line device.
+ */
+ PHTDSU_LINK Link;
+
+ DBG_ENTER(Adapter);
+ DBG_FILTER(Adapter, DBG_PARAMS_ON,
+ ("hdCall=%Xh\n"
+ "ulAppSpecific=%d\n",
+ Request->hdCall,
+ Request->ulAppSpecific
+ ));
+ /*
+ // This request must be associated with a call.
+ */
+ Link = GET_LINK_FROM_HDCALL(Adapter, Request->hdCall);
+ if (Link == NULL)
+ {
+ DBG_WARNING(Adapter, ("Returning NDIS_STATUS_TAPI_INVALCALLHANDLE\n"));
+ return (NDIS_STATUS_TAPI_INVALCALLHANDLE);
+ }
+
+ /*
+ // You can do what ever you want here, so long as the application
+ // agrees with you.
+ */
+
+ DBG_LEAVE(Adapter);
+
+ return (NDIS_STATUS_TAPI_OPERATIONUNAVAIL);
+}
+
+
+NDIS_STATUS
+HtTapiSetCallParams(
+ IN PHTDSU_ADAPTER Adapter,
+ IN PNDIS_TAPI_SET_CALL_PARAMS Request
+ )
+
+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+Functional Description:
+
+ This request sets certain call parameters for an existing call.
+
+Parameters:
+
+ Adapter _ A pointer ot our adapter information structure.
+
+ Request _ A pointer to the NDIS_TAPI request structure for this call.
+
+ typedef struct _NDIS_TAPI_SET_CALL_PARAMS
+ {
+ IN ULONG ulRequestID;
+ IN HDRV_CALL hdCall;
+ IN ULONG ulBearerMode;
+ IN ULONG ulMinRate;
+ IN ULONG ulMaxRate;
+ IN BOOLEAN bSetLineDialParams;
+ IN LINE_DIAL_PARAMS LineDialParams;
+
+ } NDIS_TAPI_SET_CALL_PARAMS, *PNDIS_TAPI_SET_CALL_PARAMS;
+
+ typedef struct _LINE_DIAL_PARAMS
+ {
+ ULONG ulDialPause;
+ ULONG ulDialSpeed;
+ ULONG ulDigitDuration;
+ ULONG ulWaitForDialtone;
+
+ } LINE_DIAL_PARAMS, *PLINE_DIAL_PARAMS;
+
+Return Values:
+
+ NDIS_STATUS_SUCCESS
+ NDIS_STATUS_FAILURE
+ NDIS_STATUS_TAPI_INVALCALLHANDLE
+
+---------------------------------------------------------------------------*/
+
+{
+ DBG_FUNC("HtTapiSetCallParams")
+
+ /*
+ // A pointer to our link information structure for the selected line device.
+ */
+ PHTDSU_LINK Link;
+
+ DBG_ENTER(Adapter);
+ DBG_FILTER(Adapter, DBG_PARAMS_ON,
+ ("hdCall=%Xh\n"
+ "ulBearerMode=%Xh\n",
+ "ulMinRate=%d\n",
+ "ulMaxRate=%d\n",
+ "bSetLineDialParams=%d\n",
+ "LineDialParams=%Xh\n",
+ Request->hdCall,
+ Request->ulBearerMode,
+ Request->ulMinRate,
+ Request->ulMaxRate,
+ Request->bSetLineDialParams,
+ Request->LineDialParams
+ ));
+ /*
+ // This request must be associated with a call.
+ */
+ Link = GET_LINK_FROM_HDCALL(Adapter, Request->hdCall);
+ if (Link == NULL)
+ {
+ DBG_WARNING(Adapter, ("Returning NDIS_STATUS_TAPI_INVALCALLHANDLE\n"));
+ return (NDIS_STATUS_TAPI_INVALCALLHANDLE);
+ }
+
+ /*
+ // RASTAPI only places calls through the MAKE_CALL interface.
+ // So there's nothing to do here for the time being.
+ */
+
+ DBG_LEAVE(Adapter);
+
+ return (NDIS_STATUS_SUCCESS);
+}
+
+
+NDIS_STATUS
+HtTapiSetDefaultMediaDetection(
+ IN PHTDSU_ADAPTER Adapter,
+ IN PNDIS_TAPI_SET_DEFAULT_MEDIA_DETECTION Request
+ )
+
+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+Functional Description:
+
+ This request informs the miniport of the new set of media modes to detect
+ for the indicated line (replacing any previous set).
+
+Parameters:
+
+ Adapter _ A pointer ot our adapter information structure.
+
+ Request _ A pointer to the NDIS_TAPI request structure for this call.
+
+ typedef struct _NDIS_TAPI_SET_DEFAULT_MEDIA_DETECTION
+ {
+ IN ULONG ulRequestID;
+ IN HDRV_LINE hdLine;
+ IN ULONG ulMediaModes;
+
+ } NDIS_TAPI_SET_DEFAULT_MEDIA_DETECTION, *PNDIS_TAPI_SET_DEFAULT_MEDIA_DETECTION;
+
+Return Values:
+
+ NDIS_STATUS_SUCCESS
+ NDIS_STATUS_TAPI_INVALLINEHANDLE
+
+---------------------------------------------------------------------------*/
+
+{
+ DBG_FUNC("HtTapiSetDefaultMediaDetection")
+
+ /*
+ // A pointer to our link information structure for the selected line device.
+ */
+ PHTDSU_LINK Link;
+
+ DBG_ENTER(Adapter);
+ DBG_FILTER(Adapter, DBG_PARAMS_ON,
+ ("hdLine=%Xh\n"
+ "ulMediaModes=%Xh\n",
+ Request->hdLine,
+ Request->ulMediaModes
+ ));
+ /*
+ // This request must be associated with a line device.
+ */
+ Link = GET_LINK_FROM_HDLINE(Adapter, Request->hdLine);
+ if (Link == NULL)
+ {
+ DBG_WARNING(Adapter, ("Returning NDIS_STATUS_TAPI_INVALLINEHANDLE\n"));
+ return (NDIS_STATUS_TAPI_INVALLINEHANDLE);
+ }
+
+ /*
+ // Set the media modes mask and make sure the adapter is ready to
+ // accept incoming calls. If you can detect different medias, you
+ // will need to notify the approriate interface for the media detected.
+ */
+ Link->MediaModesMask = Request->ulMediaModes;
+
+ DBG_LEAVE(Adapter);
+
+ return (NDIS_STATUS_SUCCESS);
+}
+
+
+NDIS_STATUS
+HtTapiSetMediaMode(
+ IN PHTDSU_ADAPTER Adapter,
+ IN PNDIS_TAPI_SET_MEDIA_MODE Request
+ )
+
+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+Functional Description:
+
+ This request changes a call’s media mode as stored in the call’s
+ LINE_CALL_INFO structure.
+
+Parameters:
+
+ Adapter _ A pointer ot our adapter information structure.
+
+ Request _ A pointer to the NDIS_TAPI request structure for this call.
+
+ typedef struct _NDIS_TAPI_SET_MEDIA_MODE
+ {
+ IN ULONG ulRequestID;
+ IN HDRV_CALL hdCall;
+ IN ULONG ulMediaMode;
+
+ } NDIS_TAPI_SET_MEDIA_MODE, *PNDIS_TAPI_SET_MEDIA_MODE;
+
+Return Values:
+
+ NDIS_STATUS_SUCCESS
+ NDIS_STATUS_FAILURE
+ NDIS_STATUS_TAPI_INVALCALLHANDLE
+
+---------------------------------------------------------------------------*/
+
+{
+ DBG_FUNC("HtTapiSetMediaMode")
+
+ /*
+ // A pointer to our link information structure for the selected line device.
+ */
+ PHTDSU_LINK Link;
+
+ DBG_ENTER(Adapter);
+ DBG_FILTER(Adapter, DBG_PARAMS_ON,
+ ("hdCall=%Xh\n"
+ "ulMediaMode=%Xh\n",
+ Request->hdCall,
+ Request->ulMediaMode
+ ));
+ /*
+ // This request must be associated with a call.
+ */
+ Link = GET_LINK_FROM_HDCALL(Adapter, Request->hdCall);
+ if (Link == NULL)
+ {
+ DBG_WARNING(Adapter, ("Returning NDIS_STATUS_TAPI_INVALCALLHANDLE\n"));
+ return (NDIS_STATUS_TAPI_INVALCALLHANDLE);
+ }
+
+ /*
+ // If you can detect different medias, you will need to setup to use
+ // the selected media here.
+ */
+ Link->MediaModesMask = Request->ulMediaMode;
+
+ DBG_LEAVE(Adapter);
+
+ return (NDIS_STATUS_SUCCESS);
+}
+
+
+NDIS_STATUS
+HtTapiSetStatusMessages(
+ IN PHTDSU_ADAPTER Adapter,
+ IN PNDIS_TAPI_SET_STATUS_MESSAGES Request
+ )
+
+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+Functional Description:
+
+ This request enables the Connection Wrapper to specify which notification
+ messages the miniport should generate for events related to status changes
+ for the specified line or any of its addresses. By default, address and
+ line status reporting is initially disabled for a line.
+
+Parameters:
+
+ Adapter _ A pointer ot our adapter information structure.
+
+ Request _ A pointer to the NDIS_TAPI request structure for this call.
+
+ typedef struct _NDIS_TAPI_SET_STATUS_MESSAGES
+ {
+ IN ULONG ulRequestID;
+ IN HDRV_LINE hdLine;
+ IN ULONG ulLineStates;
+ IN ULONG ulAddressStates;
+
+ } NDIS_TAPI_SET_STATUS_MESSAGES, *PNDIS_TAPI_SET_STATUS_MESSAGES;
+
+Return Values:
+
+ NDIS_STATUS_SUCCESS
+ NDIS_STATUS_TAPI_INVALLINEHANDLE
+ NDIS_STATUS_TAPI_INVALLINESTATE
+ NDIS_STATUS_TAPI_INVALADDRESSSTATE
+
+---------------------------------------------------------------------------*/
+
+{
+ DBG_FUNC("HtTapiSetStatusMessages")
+
+ /*
+ // A pointer to our link information structure for the selected line device.
+ */
+ PHTDSU_LINK Link;
+
+ DBG_ENTER(Adapter);
+ DBG_FILTER(Adapter, DBG_PARAMS_ON,
+ ("hdLine=%Xh\n"
+ "ulLineStates=%Xh\n"
+ "ulAddressStates=%Xh\n",
+ Request->hdLine,
+ Request->ulLineStates,
+ Request->ulAddressStates
+ ));
+ /*
+ // This request must be associated with a line device.
+ */
+ Link = GET_LINK_FROM_HDLINE(Adapter, Request->hdLine);
+ if (Link == NULL)
+ {
+ DBG_WARNING(Adapter, ("Returning NDIS_STATUS_TAPI_INVALLINEHANDLE\n"));
+ return (NDIS_STATUS_TAPI_INVALLINEHANDLE);
+ }
+
+ /*
+ // Make sure the line settings are all within the supported list.
+ */
+ if (Request->ulLineStates & ~Link->DevStatesCaps)
+ {
+ DBG_WARNING(Adapter, ("Returning NDIS_STATUS_TAPI_INVALLINESTATE\n"));
+ return (NDIS_STATUS_TAPI_INVALLINESTATE);
+ }
+
+ /*
+ // Make sure the address settings are all within the supported list.
+ */
+ if (Request->ulAddressStates & ~Link->AddressStatesCaps)
+ {
+ DBG_WARNING(Adapter, ("Returning NDIS_STATUS_TAPI_INVALADDRESSSTATE\n"));
+ return (NDIS_STATUS_TAPI_INVALADDRESSSTATE);
+ }
+
+ /*
+ // Save the new event notification masks so we will only indicate the
+ // appropriate events.
+ */
+ Link->DevStatesMask = Request->ulLineStates;
+ Link->AddressStatesMask = Request->ulAddressStates;
+
+ DBG_LEAVE(Adapter);
+
+ return (NDIS_STATUS_SUCCESS);
+}
+
+
+VOID
+HtTapiCallStateHandler(
+ IN PHTDSU_ADAPTER Adapter,
+ IN PHTDSU_LINK Link,
+ IN ULONG CallState,
+ IN ULONG StateParam
+ )
+
+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+Functional Description:
+
+ This routine will indicate the given LINECALLSTATE to the Connection
+ wrapper if the event has been enabled by the wrapper. Otherwise the state
+ information is saved, but no indication is made.
+
+Parameters:
+
+ Adapter _ A pointer ot our adapter information structure.
+
+ Link _ A pointer to our link information structure for the selected
+ line device.
+
+ CallState _ The LINECALLSTATE event to be posted to TAPI/WAN.
+
+ StateParam _ This value depends on the event being posted, and some
+ events will pass in zero if they don't use this parameter.
+
+Return Values:
+
+ None
+
+---------------------------------------------------------------------------*/
+
+{
+ DBG_FUNC("HtTapiCallStateHandler")
+
+ /*
+ // The event structure passed to the connection wrapper.
+ */
+ NDIS_TAPI_EVENT CallEvent;
+
+ /*
+ // Flag tells whether call time-out routine was cancelled.
+ */
+ BOOLEAN TimerCancelled;
+
+ DBG_ENTER(Adapter);
+ DBG_FILTER(Adapter, DBG_PARAMS_ON,
+ ("OldState=%Xh "
+ "NewState=%Xh\n",
+ Link->CallState,
+ CallState
+ ));
+ /*
+ // Cancel any call time-outs events associated with this link.
+ */
+ NdisMCancelTimer(&Link->CallTimer, &TimerCancelled);
+
+ /*
+ // Init the optional parameters. They will be set as needed below.
+ */
+ CallEvent.ulParam2 = StateParam;
+ CallEvent.ulParam3 = Link->MediaMode;
+
+ /*
+ // OUTGOING) The expected sequence of events for outgoing calls is:
+ // LINECALLSTATE_IDLE, LINECALLSTATE_DIALTONE, LINECALLSTATE_DIALING,
+ // LINECALLSTATE_PROCEEDING, (LINECALLSTATE_RINGBACK | LINECALLSTATE_BUSY),
+ // LINECALLSTATE_CONNECTED, LINECALLSTATE_DISCONNECTED, LINECALLSTATE_IDLE
+ //
+ // INCOMING) The expected sequence of events for incoming calls is:
+ // LINECALLSTATE_IDLE, LINECALLSTATE_OFFERING, LINECALLSTATE_ACCEPTED,
+ // LINECALLSTATE_CONNECTED, LINECALLSTATE_DISCONNECTED, LINECALLSTATE_IDLE
+ //
+ // Under certain failure conditions, these sequences may be violated.
+ // So I used ASSERTs to verify the normal state transitions which will
+ // cause a debug break point if an unusual transition is detected.
+ */
+ switch (CallState)
+ {
+ case LINECALLSTATE_IDLE:
+ DBG_FILTER(Adapter, DBG_TAPICALL_ON,
+ ("LINECALLSTATE_IDLE line=0x%x call=0x%x\n",
+ Link->CardLine, Link->htCall));
+ /*
+ // Make sure that an idle line is disconnected.
+ */
+ if (Link->CallState &&
+ Link->CallState != LINECALLSTATE_IDLE &&
+ Link->CallState != LINECALLSTATE_DISCONNECTED)
+ {
+ DBG_WARNING(Adapter, ("Disconnecting Line=%d\n",Link->CardLine));
+ HtTapiCallStateHandler(Adapter, Link,
+ LINECALLSTATE_DISCONNECTED, LINEDISCONNECTMODE_UNKNOWN);
+ }
+ Link->RingCount = 0;
+ break;
+
+ case LINECALLSTATE_DIALTONE:
+ DBG_FILTER(Adapter, DBG_TAPICALL_ON,
+ ("LINECALLSTATE_DIALTONE line=0x%x call=0x%x\n",
+ Link->CardLine, Link->htCall));
+ ASSERT(Link->CallState == LINECALLSTATE_IDLE);
+ break;
+
+ case LINECALLSTATE_DIALING:
+ DBG_FILTER(Adapter, DBG_TAPICALL_ON,
+ ("LINECALLSTATE_DIALING line=0x%x call=0x%x\n",
+ Link->CardLine, Link->htCall));
+ ASSERT(Link->CallState == LINECALLSTATE_DIALTONE);
+ break;
+
+ case LINECALLSTATE_PROCEEDING:
+ DBG_FILTER(Adapter, DBG_TAPICALL_ON,
+ ("LINECALLSTATE_PROCEEDING line=0x%x call=0x%x\n",
+ Link->CardLine, Link->htCall));
+ ASSERT(Link->CallState == LINECALLSTATE_DIALING);
+ LinkLineUp(Link);
+ break;
+
+ case LINECALLSTATE_RINGBACK:
+ DBG_FILTER(Adapter, DBG_TAPICALL_ON,
+ ("LINECALLSTATE_RINGBACK line=0x%x call=0x%x\n",
+ Link->CardLine, Link->htCall));
+ ASSERT(Link->CallState == LINECALLSTATE_PROCEEDING);
+ break;
+
+ case LINECALLSTATE_BUSY:
+ DBG_FILTER(Adapter, DBG_TAPICALL_ON,
+ ("LINECALLSTATE_BUSY line=0x%x call=0x%x\n",
+ Link->CardLine, Link->htCall));
+ ASSERT(Link->CallState == LINECALLSTATE_DIALING);
+ break;
+
+ case LINECALLSTATE_CONNECTED:
+ DBG_FILTER(Adapter, DBG_TAPICALL_ON,
+ ("LINECALLSTATE_CONNECTED line=0x%x call=0x%x\n",
+ Link->CardLine, Link->htCall));
+ ASSERT(Link->CallState == LINECALLSTATE_PROCEEDING ||
+ Link->CallState == LINECALLSTATE_ACCEPTED);
+ break;
+
+ case LINECALLSTATE_DISCONNECTED:
+ DBG_FILTER(Adapter, DBG_TAPICALL_ON,
+ ("LINECALLSTATE_DISCONNECTED line=0x%x call=0x%x\n",
+ Link->CardLine, Link->htCall));
+ CardLineDisconnect(Adapter, Link->CardLine);
+ LinkLineDown(Link);
+ break;
+
+ case LINECALLSTATE_OFFERING:
+ DBG_FILTER(Adapter, DBG_TAPICALL_ON,
+ ("LINECALLSTATE_OFFERING line=0x%x call=0x%x\n",
+ Link->CardLine, Link->htCall));
+ ASSERT(Link->CallState == LINECALLSTATE_IDLE);
+ LinkLineUp(Link);
+ NdisMSetTimer(&Link->CallTimer, HTDSU_NO_ACCEPT_TIMEOUT);
+ break;
+
+ case LINECALLSTATE_ACCEPTED:
+ DBG_FILTER(Adapter, DBG_TAPICALL_ON,
+ ("LINECALLSTATE_ACCEPTED line=0x%x call=0x%x\n",
+ Link->CardLine, Link->htCall));
+ ASSERT(Link->CallState == LINECALLSTATE_OFFERING);
+ break;
+ }
+ /*
+ // Change the current CallState and notify the connection wrapper if it
+ // wants to know about this event.
+ */
+ if (Link->CallState != CallState)
+ {
+ Link->CallState = CallState;
+ if (Link->CallStatesMask & CallState)
+ {
+ CallEvent.htLine = Link->htLine;
+ CallEvent.htCall = Link->htCall;
+ CallEvent.ulMsg = LINE_CALLSTATE;
+ CallEvent.ulParam1 = CallState;
+ NdisMIndicateStatus(
+ Adapter->MiniportAdapterHandle,
+ NDIS_STATUS_TAPI_INDICATION,
+ &CallEvent,
+ sizeof(CallEvent)
+ );
+ DBG_NOTICE(Adapter, ("LINE_CALLSTATE:\n"
+ "htLine=%Xh\n"
+ "htCall=%Xh\n",
+ Link->htLine,
+ Link->htCall
+ ));
+ }
+ else
+ {
+ DBG_NOTICE(Adapter, ("CallState Event=%Xh is not enabled\n", CallState));
+ }
+ }
+
+ DBG_LEAVE(Adapter);
+}
+
+
+VOID
+HtTapiAddressStateHandler(
+ IN PHTDSU_ADAPTER Adapter,
+ IN PHTDSU_LINK Link,
+ IN ULONG AddressState
+ )
+
+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+Functional Description:
+
+ This routine will indicate the given LINEADDRESSSTATE to the Connection
+ wrapper if the event has been enabled by the wrapper. Otherwise the state
+ information is saved, but no indication is made.
+
+Parameters:
+
+ Adapter _ A pointer ot our adapter information structure.
+
+ Link _ A pointer to our link information structure for the selected
+ line device.
+
+ AddressState _ The LINEADDRESSSTATE event to be posted to TAPI/WAN.
+
+Return Values:
+
+ None
+
+---------------------------------------------------------------------------*/
+
+{
+ DBG_FUNC("HtTapiAddressStateHandler")
+
+ /*
+ // The event structure passed to the connection wrapper.
+ */
+ NDIS_TAPI_EVENT Event;
+
+ DBG_ENTER(Adapter);
+
+ if (Link->AddressStatesMask & AddressState)
+ {
+ Event.htLine = Link->htLine;
+ Event.htCall = Link->htCall;
+ Event.ulMsg = LINE_CALLSTATE;
+ Event.ulParam1 = AddressState;
+ Event.ulParam2 = 0;
+ Event.ulParam3 = 0;
+
+ /*
+ // We really don't have much to do here with this adapter.
+ // And RASTAPI doesn't accept these events anyway...
+ */
+ switch (AddressState)
+ {
+ case LINEADDRESSSTATE_INUSEZERO:
+ break;
+
+ case LINEADDRESSSTATE_INUSEONE:
+ break;
+ }
+ NdisMIndicateStatus(
+ Adapter->MiniportAdapterHandle,
+ NDIS_STATUS_TAPI_INDICATION,
+ &Event,
+ sizeof(Event)
+ );
+ }
+ else
+ {
+ DBG_NOTICE(Adapter, ("AddressState Event=%Xh is not enabled\n", AddressState));
+ }
+
+ DBG_LEAVE(Adapter);
+}
+
+
+VOID
+HtTapiLineDevStateHandler(
+ IN PHTDSU_ADAPTER Adapter,
+ IN PHTDSU_LINK Link,
+ IN ULONG LineDevState
+ )
+
+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+Functional Description:
+
+ This routine will indicate the given LINEDEVSTATE to the Connection wrapper
+ if the event has been enabled by the wrapper. Otherwise the state
+ information is saved, but no indication is made.
+
+Parameters:
+
+ Adapter _ A pointer ot our adapter information structure.
+
+ Link _ A pointer to our link information structure for the selected
+ line device.
+
+ LineDevState _ The LINEDEVSTATE event to be posted to TAPI/WAN.
+
+Return Values:
+
+ None
+
+---------------------------------------------------------------------------*/
+
+{
+ DBG_FUNC("HtTapiLineDevStateHandler")
+
+ /*
+ // The event structure passed to the connection wrapper.
+ */
+ NDIS_TAPI_EVENT LineEvent;
+ NDIS_TAPI_EVENT CallEvent;
+
+ /*
+ // The line state change may cause a call state change as well.
+ */
+ ULONG NewCallState = 0;
+ ULONG StateParam = 0;
+
+ DBG_ENTER(Adapter);
+
+ LineEvent.ulParam2 = 0;
+ LineEvent.ulParam3 = 0;
+
+ /*
+ // Handle the line state transition as needed.
+ */
+ switch (LineDevState)
+ {
+ case LINEDEVSTATE_RINGING:
+ LineEvent.ulParam2 = 1; // only one RingMode
+ if ((LineEvent.ulParam3 = ++Link->RingCount) == 1)
+ {
+ NewCallState = LINECALLSTATE_OFFERING;
+ }
+ break;
+
+ case LINEDEVSTATE_CONNECTED:
+ NewCallState = LINECALLSTATE_CONNECTED;
+ break;
+
+ case LINEDEVSTATE_DISCONNECTED:
+ if (Link->CallState != LINECALLSTATE_IDLE &&
+ Link->CallState != LINECALLSTATE_DISCONNECTED)
+ {
+ NewCallState = LINECALLSTATE_DISCONNECTED;
+ StateParam = LINEDISCONNECTMODE_NORMAL;
+ }
+ break;
+
+ case LINEDEVSTATE_OUTOFSERVICE:
+ if (Link->CallState != LINECALLSTATE_IDLE &&
+ Link->CallState != LINECALLSTATE_DISCONNECTED)
+ {
+ NewCallState = LINECALLSTATE_DISCONNECTED;
+ StateParam = LINEDISCONNECTMODE_UNKNOWN;
+ }
+ break;
+
+ case LINEDEVSTATE_OPEN:
+ /*
+ // Make sure the line is configured for dialing when we open up.
+ // Then enable the interrupts we're interested in now.
+ */
+ if (Link->CardLine == HTDSU_CMD_LINE1)
+ {
+ Adapter->InterruptEnableFlag |= HTDSU_INTR_ALL_LINE1;
+ }
+ else
+ {
+ Adapter->InterruptEnableFlag |= HTDSU_INTR_ALL_LINE2;
+ }
+ ++Adapter->NumOpens;
+ CardLineConfig(Adapter, Link->CardLine);
+ CardEnableInterrupt(Adapter);
+ NewCallState = LINECALLSTATE_IDLE;
+ break;
+
+ case LINEDEVSTATE_CLOSE:
+ /*
+ // This must not be called until all transmits have been dequeued
+ // and ack'd. Otherwise the wrapper will hang waiting for transmit
+ // request to complete.
+ */
+ if (Link->CardLine == HTDSU_CMD_LINE1)
+ {
+ Adapter->InterruptEnableFlag &= ~HTDSU_INTR_ALL_LINE1;
+ }
+ else
+ {
+ Adapter->InterruptEnableFlag &= ~HTDSU_INTR_ALL_LINE2;
+ }
+ CardEnableInterrupt(Adapter);
+ --Adapter->NumOpens;
+ NewCallState = LINECALLSTATE_IDLE;
+ break;
+ }
+ Link->DevState = LineDevState;
+
+ /*
+ // If this is the first indication of an incoming call, we need to
+ // let TAPI know about it so we can get a htCall handle associated
+ // with it.
+ */
+ if (NewCallState == LINECALLSTATE_OFFERING)
+ {
+ CallEvent.htLine = Link->htLine;
+ CallEvent.htCall = (HTAPI_CALL)0;
+ CallEvent.ulMsg = LINE_NEWCALL;
+ CallEvent.ulParam1 = (ULONG) Link;
+ CallEvent.ulParam2 = 0;
+ CallEvent.ulParam3 = 0;
+
+ NdisMIndicateStatus(
+ Adapter->MiniportAdapterHandle,
+ NDIS_STATUS_TAPI_INDICATION,
+ &CallEvent,
+ sizeof(CallEvent)
+ );
+ Link->htCall = (HTAPI_CALL)CallEvent.ulParam2;
+ DBG_NOTICE(Adapter, ("NEW_CALL htCall=%Xh\n",Link->htCall));
+ }
+
+ /*
+ // Tell TAPI what's going on here, if she cares.
+ */
+ if (Link->DevStatesMask & LineDevState)
+ {
+ LineEvent.htLine = Link->htLine;
+ LineEvent.htCall = Link->htCall;
+ LineEvent.ulMsg = LINE_LINEDEVSTATE;
+ LineEvent.ulParam1 = LineDevState;
+
+ NdisMIndicateStatus(
+ Adapter->MiniportAdapterHandle,
+ NDIS_STATUS_TAPI_INDICATION,
+ &LineEvent,
+ sizeof(LineEvent)
+ );
+ }
+ else
+ {
+ DBG_NOTICE(Adapter, ("LineDevEvent %Xh is not enabled\n", LineDevState));
+ }
+
+ /*
+ // Tell TAPI what this event does to any call that may be in progress.
+ */
+ if (NewCallState)
+ {
+ HtTapiCallStateHandler(Adapter, Link, NewCallState, StateParam);
+ }
+
+ DBG_LEAVE(Adapter);
+}
+
+
+VOID
+HtTapiResetHandler(
+ IN PHTDSU_ADAPTER Adapter
+ )
+
+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+Functional Description:
+
+ This rouine is called by the MiniportReset routine after the hardware
+ has been reset due to some failure detection. We need to make sure the
+ line and call state information is conveyed properly to the connection
+ wrapper.
+
+Parameters:
+
+ Adapter _ A pointer ot our adapter information structure.
+
+Return Values:
+
+ None
+
+---------------------------------------------------------------------------*/
+
+{
+ DBG_FUNC("HtTapiResetHandler")
+
+ /*
+ // A pointer to our link information structure for the selected line device.
+ */
+ PHTDSU_LINK Link;
+
+ DBG_ENTER(Adapter);
+
+ /*
+ // Force disconnect on both lines.
+ */
+ Link = GET_LINK_FROM_CARDLINE(Adapter, HTDSU_CMD_LINE1);
+ HtTapiLineDevStateHandler(Adapter, Link, LINEDEVSTATE_DISCONNECTED);
+
+ if (Adapter->NumLineDevs == HTDSU_NUM_LINKS)
+ {
+ Link = GET_LINK_FROM_CARDLINE(Adapter, HTDSU_CMD_LINE2);
+ HtTapiLineDevStateHandler(Adapter, Link, LINEDEVSTATE_DISCONNECTED);
+ }
+
+ DBG_LEAVE(Adapter);
+}
+
+
+VOID
+HtTapiCallTimerHandler(
+ IN PVOID SystemSpecific1,
+ IN PHTDSU_LINK Link,
+ IN PVOID SystemSpecific2,
+ IN PVOID SystemSpecific3
+ )
+
+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+Functional Description:
+
+ This routine is called when the CallTimer timeout occurs. It will
+ handle the event according to the current CallState and make the
+ necessary indications and changes to the call state.
+
+Parameters:
+
+ Link _ A pointer to our link information structure on which a call event
+ is in progress.
+
+Return Values:
+
+ None
+
+---------------------------------------------------------------------------*/
+
+{
+ DBG_FUNC("HtTapiCallTimerHandler")
+
+ PHTDSU_ADAPTER Adapter = Link->Adapter;
+
+ DBG_ENTER(Adapter);
+
+ NdisAcquireSpinLock(&Adapter->Lock);
+
+ switch (Link->CallState)
+ {
+ case LINECALLSTATE_DIALING:
+ if (CardStatusNoDialTone(Adapter, Link->CardLine))
+ {
+ LinkLineError(Link, WAN_ERROR_TIMEOUT);
+ HtTapiCallStateHandler(Adapter, Link,
+ LINECALLSTATE_DISCONNECTED, LINEDISCONNECTMODE_BUSY);
+ }
+ else
+ {
+ /*
+ // We got a signal, so dialing must be proceeding
+ */
+ HtTapiCallStateHandler(Adapter, Link, LINECALLSTATE_PROCEEDING, 0);
+ NdisMSetTimer(&Link->CallTimer, HTDSU_NO_ANSWER_TIMEOUT);
+ }
+ break;
+
+ case LINECALLSTATE_PROCEEDING:
+ if (CardStatusNoAnswer(Adapter, Link->CardLine) ||
+ !CardStatusCarrierDetect(Adapter, Link->CardLine) ||
+ !CardStatusOnLine(Adapter, Link->CardLine))
+ {
+ /*
+ // We did not get answer, so hangup and abort the call.
+ */
+ LinkLineError(Link, WAN_ERROR_TIMEOUT);
+ HtTapiCallStateHandler(Adapter, Link,
+ LINECALLSTATE_DISCONNECTED, LINEDISCONNECTMODE_NOANSWER);
+ }
+ break;
+
+ case LINECALLSTATE_OFFERING:
+ /*
+ // We did not get an accept or answer, so hangup and abort the call.
+ */
+ LinkLineError(Link, WAN_ERROR_TIMEOUT);
+ HtTapiCallStateHandler(Adapter, Link,
+ LINECALLSTATE_DISCONNECTED, LINEDISCONNECTMODE_NOANSWER);
+ break;
+
+ case LINECALLSTATE_ACCEPTED:
+ /*
+ // We did not get connected after answer, so hangup and abort the call.
+ */
+ LinkLineError(Link, WAN_ERROR_TIMEOUT);
+ HtTapiCallStateHandler(Adapter, Link,
+ LINECALLSTATE_DISCONNECTED, LINEDISCONNECTMODE_NOANSWER);
+ break;
+
+ case LINECALLSTATE_DISCONNECTED:
+ /*
+ // We did not get CloseCall after DropCall, so force a close.
+ */
+ HtTapiCallStateHandler(Adapter, Link, LINECALLSTATE_IDLE, 0);
+ break;
+
+ default:
+ DBG_WARNING(Adapter, ("TIMEOUT in CallState=%Xh\n",Link->CallState));
+ break;
+ }
+
+ NdisReleaseSpinLock(&Adapter->Lock);
+
+ DBG_LEAVE(Adapter);
+}
+
diff --git a/private/ntos/ndis/htdsu/version.h b/private/ntos/ndis/htdsu/version.h
new file mode 100644
index 000000000..9a3367cff
--- /dev/null
+++ b/private/ntos/ndis/htdsu/version.h
@@ -0,0 +1,62 @@
+/***************************************************************************\
+|* Copyright (c) 1994 Microsoft Corporation *|
+|* Developed for Microsoft by TriplePoint, Inc. Beaverton, Oregon *|
+|* *|
+|* This file is part of the HT Communications DSU41 WAN Miniport Driver. *|
+\***************************************************************************/
+
+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+Module Name:
+
+ version.h
+
+Abstract:
+
+ This file contains version definitions for the Miniport driver file.
+
+Author:
+
+ Larry Hattery - TriplePoint, Inc. (larryh@tpi.com) Jun-94
+
+Environment:
+
+ Include this file at the top of each module in the driver to make sure
+ each module gets rebuilt when the version changes.
+
+Revision History:
+
+---------------------------------------------------------------------------*/
+
+#ifndef _VERSION_H
+#define _VERSION_H
+
+/*
+// Used to add version information to driver file header.
+*/
+#define VER_COMPANYNAME_STR "Microsoft Corporation"
+#define VER_FILEDESCRIPTION_STR "NDIS 3.0 WAN Miniport Driver for Windows NT"
+#define VER_FILEVERSION_STR "1.20"
+#define VER_INTERNALNAME_STR "htdsu41.sys"
+#define VER_LEGALCOPYRIGHT_STR "Copyright \251 1994 " VER_COMPANYNAME_STR
+#define VER_ORIGINALFILENAME_STR VER_INTERNALNAME_STR
+#undef VER_PRODUCTNAME_STR
+#define VER_PRODUCTNAME_STR "HT Communications 56 kbps Digital Modem"
+#undef VER_PRODUCTVERSION_STR
+#define VER_PRODUCTVERSION_STR "DSU41 Digital Modem PC Card"
+
+/*
+// Used to report driver version number.
+*/
+#define HTDSU_MAJOR_VERSION 0x01 // Make sure you change above too
+#define HTDSU_MINOR_VERSION 0x20
+
+/*
+// Used when registering MAC with NDIS wrapper.
+// i.e. What NDIS version do we expect.
+*/
+#define NDIS_MAJOR_VERSION 0x03
+#define NDIS_MINOR_VERSION 0x00
+
+#endif
+