Once I knew what the key words were, I see there is a LogConfig section in the AMCC5933 sample. Just for clarification, the OS parses both the hardware and the LogConfig section and provides a combined structure with the resources found by both methods? Anyway, I see how to parse it now.
I have another question. The old driver only has two functions that are ever called, a write port and read port. The function that handles this is:
`NTSTATUS IsaDrvDeviceControl(IN PDEVICE_OBJECT DeviceObject,IN PIRP pIrp)
{
PIO_STACK_LOCATION irpSp;
NTSTATUS ntStatus = STATUS_SUCCESS;
ULONG inBufLength; /* Input buffer length */
ULONG outBufLength; /* Output buffer length */
PUCHAR CharBuffer;
PUSHORT ShortBuffer;
PULONG LongBuffer;
PVOID ioBuffer;
USHORT Offset;
UCHAR Value;
DeviceObject;
irpSp = IoGetCurrentIrpStackLocation( pIrp );
inBufLength = irpSp->Parameters.DeviceIoControl.InputBufferLength;
outBufLength = irpSp->Parameters.DeviceIoControl.OutputBufferLength;
ioBuffer = pIrp->AssociatedIrp.SystemBuffer;
CharBuffer = (PUCHAR) ioBuffer;
ShortBuffer = (PUSHORT) ioBuffer;
LongBuffer = (PULONG) ioBuffer;
switch(irpSp->Parameters.DeviceIoControl.IoControlCode)
{
case IOCTL_READ_PORT_UCHAR:
if ((inBufLength >= 2) && (outBufLength >= 1))
{
DbgPrintEx(DPFLTR_IHVDRIVER_ID,DPFLTR_TRACE_LEVEL,"MTIsaDrv: IOCTL_READ_PORT_UCHAR 0x%X\n",ShortBuffer[0]);
(UCHAR)Value = READ_PORT_UCHAR((PUCHAR)ShortBuffer[0]);
DbgPrintEx(DPFLTR_IHVDRIVER_ID,DPFLTR_TRACE_LEVEL,"MTIsaDrv: Value Read %X\n",Value);
CharBuffer[0] = Value;
}
else
{
DbgPrintEx(DPFLTR_IHVDRIVER_ID,DPFLTR_TRACE_LEVEL,"MTIsaDrv: IOCTL_READ_PORT_UCHAR Error inBufLength=%u, outBufLength=%u\n",inBufLength,outBufLength);
ntStatus = STATUS_BUFFER_TOO_SMALL;
}
pIrp->IoStatus.Information = 1; /* Output Buffer Size */
ntStatus = STATUS_SUCCESS;
break;
case IOCTL_WRITE_PORT_UCHAR:
if (inBufLength >= 3)
{
DbgPrintEx(DPFLTR_IHVDRIVER_ID,DPFLTR_TRACE_LEVEL,"MTIsaDrv: IOCTL_WRITE_PORT_UCHAR(0x%X,0x%X)\n",ShortBuffer[0], CharBuffer[2]);
WRITE_PORT_UCHAR((PUCHAR)ShortBuffer[0], CharBuffer[2]);
}
else
{
DbgPrintEx(DPFLTR_IHVDRIVER_ID,DPFLTR_TRACE_LEVEL,"MTIsaDrv: IOCTL_WRITE_PORT_UCHAR STATUS_BUFFER_TOO_SMALL inBufLength=%u\n",inBufLength);
ntStatus = STATUS_BUFFER_TOO_SMALL;
}
pIrp->IoStatus.Information = 0; /* Output Buffer Size */
ntStatus = STATUS_SUCCESS;
break;
default:
DbgPrintEx(DPFLTR_IHVDRIVER_ID,DPFLTR_TRACE_LEVEL,"MTIsaDrv: Unsupported IOCTL Call code=0x%X\n",irpSp->Parameters.DeviceIoControl.IoControlCode);
ntStatus = STATUS_UNSUCCESSFUL;
pIrp->IoStatus.Information = 0;
break;
}
pIrp->IoStatus.Status = ntStatus;
IoCompleteRequest( pIrp, IO_NO_INCREMENT );
return ntStatus;
}
`
pIrp on input has the port to use, and data to write for a write function as well as the buffer to return data. It looks like this should be done in the EvtIoDeviceControl function. The buffer sizes are included in the arguments, but I’m unclear where the port number, data, and return buffer are.
The device context you get from
‘devExt = DeviceGetContext(WdfIoQueueGetDevice(Queue));’
can include a handle to the request, but I haven’t found anything using this handle. Some of the samples have port I/O, but none of those do the I/O in direct response to calls from an application.