[an error occurred while processing this directive]
Ответ:
(«Телесистемы»: Конференция «Микроконтроллеры и их применение»)

миниатюрный аудио-видеорекордер mAVR

Отправлено Sot 28 сентября 2002 г. 19:37
В ответ на: Ответ: отправлено Владимир Н. 28 сентября 2002 г. 19:14

Нет конечно, один умелец буржуйский сделал, когда столкнулся с необходимостью писать в порты под nt4. Анотация ниже. Но ведь ты работаешь под win9x, тебе в этом нет необходимости. Кстати DOS программа этого загрузчика нормально работает? А задержка на запись мне нужна, т.к. сначала все пишу и только потом читаю, пусть медленней получается, но как-то спокойней. У меня давно сложилось правило, если возможно, всегда делать отложенное чтение со следующей верификацией.


Using the GIVEIO.SYS driver with Windows NT
-------------------------------------------

GIVEIO.SYS was authored by Dale Roberts. The source for this program can be found on many web sites under the archive file name of DIRECTIO.ZIP.

GIVEIO.SYS allows NT applications to access I/O ports directly. It should be used with some caution. You will be able to write high level source code to access your ComputerBoards hardware directly. You will not be able to perform interrupt driven I/O. In order to perform interrupt driven I/O, you will need to write an NT device driver. Call ComputerBoards to find out about availability of NT interrupt based I/O drivers using the high level Universal Library interface.

The first step to using GIVEIO.SYS is to load the driver. NT allows dynamic loading of device drivers. The program INSTDRV.EXE included with this package will perform the dynamic loading for you. INSTDRV runs from a command prompt window and takes two command line arguments. The first argument is the name of the driver, GIVEIO, and the second argument is the path the driver file, GIVEIO.SYS. The path of the driver file is dependent on where you place the files from this package. For example, if you place the contents of this package into a directory called C:\CBI_IO, your command line to load the GIVEIO driver would be as follows,

INSTDRV GIVEIO C:\CBI_IO\GIVEIO.SYS

You will need to run this each time you boot your machine, unless you direct NT to automatically load the driver at boot time through the DRIVERS icon in the Control Panel.

The second step to using the driver is to open it from your application. Opening the GIVEIO driver enables the I/O ports for use by your application. The following code fragment is from the TSTIO.C example file and shows how to open the driver in "C" code,

----------
HANDLE h;

h = CreateFile("\\\\.\\giveio", GENERIC_READ, 0, NULL,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if(h == INVALID_HANDLE_VALUE) {
printf("Couldn't access giveio device\n");
return -1;
}
CloseHandle(h);
/* I/O ports may be used now */
-----------

Once the GIVEIO device driver is properly installed in your system, you will be able to successfully run the TSTIO.EXE program included in this package.

It is also possible to use the GIVEIO driver from DOS DEBUG in a command prompt window. Dale Roberts' orginal documentation describes this as follows,

------------------------------------------------------------------
Quick Trick: Using DEBUG With Port I/O

Sometimes you just need to do a quick I/O operation to a port. In DOS, you could use the DEBUG program to accomplish this. In NT, once
you have the GIVEIO device driver up and running, you can once
again use DEBUG for port I/O. If you look at the source code for the
test application, you'll see that all it does is open and close the GIVEIO device driver. It uses the special cookie \\.\ before the driver name in order to access it. Without modifying DEBUG, you can have it open this device driver by simply typing debug \\.\giveio in an NT console window. You will get an error message complaining that the file \\.\giveio is not found, but it will give DEBUG I/O access anyway. Subsequent DOS applications that are run from this console window will also have I/O access.
------------------------------------------------------------------

The I/O port descriptions in the hardware manual provided with your ComputerBoards hardware should be used as a guide to developing your application.

Составить ответ  |||  Конференция  |||  Архив

Ответы



Перейти к списку ответов  |||  Конференция  |||  Архив  |||  Главная страница  |||  Содержание  |||  Без кадра

E-mail: info@telesys.ru