Re: Parallel port interrupt revisited
- From: rafaelaroca <rafaelaroca@xxxxxxxxx>
- Date: Tue, 5 Feb 2008 06:02:45 -0800 (PST)
Hi, thanks. I tried that, and it worked.
I got my test driver compiled and in the release directory of the
target as you can see in the dir command output:
------------
Welcome to the Windows CE Telnet Service on WindowsCE
Pocket CMD v 6.00
\> cd Release
\Release> dir parallel*
Directory of \Release
02/05/08 04:53a 12800 parallel.dll
02/05/08 04:53a 16496 parallel.map
02/05/08 04:53a 207872 parallel.pdb
02/05/08 04:53a 3914 parallel.rel
02/05/08 05:42a 3584 parallelTest.dll
02/05/08 05:42a 6568 parallelTest.map
02/05/08 05:42a 577536 paralleltest.pdb
02/05/08 05:42a 1304 parallelTest.rel
Found 8 file(s). Total size 830074 bytes.
1 Dir(s) 5417906176 bytes free
\Release>
------------
Using the Visual Studio's Remote Process Viewer, i can see that
parallel.dll is running, but parallelTest.dll not.
parallel.dll was added when i checked it in the catalog items, but it
has no useful functions.
parallelTest is my project, a DLL which is just like this:
BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
WritePortUchar((unsigned char *) (0x378), 0);
}
By the way, i added parallelTest.dll to both platform.bin and
platform.reg
So, please:
1 - Is there a way to load a DLL when the system is already up and
running?
2 - How can i configure wince to automatically load parallelTest.dll?
3 - I'm using my own WritePortUchar because when i try to #include
<ceddk.h> to use WRITE_PORT_UCHAR, i get a compiler error because the
header is not found
thanks again for the patience
Rafael
On Feb 4, 12:17 pm, "Bruce Eitman [eMVP]"
<beitman.nos...@xxxxxxxxxxxxxxxxxxxxxx> wrote:
That is becuase it is bad practice to modify the code in Public. Instead,
you should clone the code and place it in a folder that you are controlling,
like your BSP. Once you do that, your error should be found during compile.
--
Bruce Eitman (eMVP)
Senior Engineer
beitman AT applieddata DOT net
Applied Data Systems
www.applieddata.net
An ISO 9001:2000 Registered Company
Microsoft WEP Gold-level Member
"rafaelaroca" <rafaelar...@xxxxxxxxx> wrote in message
news:61875c7a-5367-4c03-88d7-7dd3a6ce08e1@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Ok, thanks. Bear with me please, i have already tried that without
success.
Well, i tried to go to the Catalog Items -> CEBASE and turned on the
item "Parallel l Port Support".
Then i went to solution explorer -> drivers, OAK -> parallel
Just to check, i added a text without comments to generate a compiler
error. When i asked to build the solution, i got no errors, and the
compiler output does not even try to compile the parallel port driver.
I searched for this a lot, and i did not find any explanation or
documentation on how to add a new module....
how could i do this?
thanks
Rafael
On Feb 4, 5:51 am, "Luca Calligaris"
<anonym...@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
Are you using an exe as the 'container' for your IST...? In CE 6.0 user
mode
code is not expected to call API's like InterruptInitialize, etc. You
should
write a driver, not a console application
Another couple of things, anyway:
-you do not need to write your own I/O access functions, ceddk provides
READ_PORT_UCHAR, etc.
-*First* create the event to signal the IST, then call
InterruptInitialize
to bind the event with the SysIntr, not the reverse
-It is better if you first set up all your interrupt stuff, then enable
the
interrupt
-why you don't use the CE parallel port driver...?
--
Luca Calligariswww.eurotech.it
"rafaelaroca" <rafaelar...@xxxxxxxxx> ha scritto nel
messaggionews:26b9996b-3ef5-4178-8626-f61767ff88ce@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hi,
i am trying to implement a parallel port IST on WinCE Embedded 6.0. I
adapted and compiled a code from this thread from this newsgroup:
http://groups.google.com/group/microsoft.public.windowsce.platbuilder...
Well, my code is like this:
// Subproject5.cpp : Defines the entry point for the console
application.
//
#include "stdafx.h"
#include <Pkfuncs.h>
#include "nkintr.h"
#define IOBASE 0x300 // default LPT base address
#define PORTA IOBASE
#define PORTB IOBASE+1
#define PORTC IOBASE+2
#define CONTROL IOBASE+3
#define INTE 0x80
#define PORT_A_OUTPUT 0x03
#define PORT_B_OUTPUT 0xC0
#define PORT_C_OUTPUT 0x30
// Parallel interrupt event handle
HANDLE hIntPar;
// IST Thread handle
HANDLE hThreadIST;
void WritePortUchar (PUCHAR port, UCHAR value)
{
__asm
{
mov dx, word ptr port
mov al, value
out dx, al
}
}
void PAR_IST(void)
{
int result;
for(;;)
{
// Wait for the interrupt event
result = WaitForSingleObject(hIntPar, INFINITE);
if (result != WAIT_OBJECT_0)
{
_tprintf(_T("ERROR: ThreadProc - WaitForSingleObject\n"));
}
else
{
_tprintf(_T("Interrupt Received from PRN Port\n"));
}
InterruptDone(SYSINTR_FIRMWARE + 7);
}
}
int _tmain(int argc, TCHAR *argv[], TCHAR *envp[])
{
DWORD dwThrdID;
_tprintf(_T("Starting...\n"));
OEMInterruptEnable(SYSINTR_FIRMWARE + 7, NULL, NULL);
if (InterruptInitialize(SYSINTR_FIRMWARE + 7, hIntPar, NULL,
NULL)) // Initialize IRQ 7 and map it to the hIntPar event
_tprintf(_T("Interrupt Initialized\n"));
else
_tprintf(_T("ERROR: Interrupt NOT initialized at first attempt\n"));
InterruptDisable(SYSINTR_FIRMWARE + 7); // Try if this works
if (InterruptInitialize (SYSINTR_FIRMWARE + 7, hIntPar, NULL, NULL))
_tprintf(_T("Interrupt Initialized at 2nd attempt\n"));
else {
_tprintf(_T("ERROR: Interrupt NOT initialized!\n"));
//CloseHandle(hIntPar); // kill the event handle
//TerminateThread(hThreadIST, 0); // kill the IST
//CloseHandle(hThreadIST);
return FALSE;
}
hIntPar = CreateEvent(NULL, FALSE, FALSE, TEXT("IntParEvent")); //
This Event is going to wakeup the IST when an interrupt occures
if (hIntPar == NULL)
{
_tprintf(_T("ERROR: CreateEvent\n"));
return FALSE;
}
hThreadIST = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE) PAR_IST,
NULL, CREATE_SUSPENDED, (LPDWORD) &dwThrdID); // create the IST
if (hThreadIST == NULL)
{
_tprintf(_T("ERROR: CreateThread\n"));
CloseHandle(hIntPar); // kill the event handle
return FALSE;
}
CeSetThreadPriority(hThreadIST, 240); // Set thread priority
ResumeThread(hThreadIST);// Start the IST
WritePortUchar((unsigned char *) (CONTROL), (INTE |
PORT_C_OUTPUT));
// Write 0 to data and status registers
// WRITE_PORT_UCHAR((unsigned char *) (LPTBase+1), 0);
// WRITE_PORT_UCHAR((unsigned char *) (LPTBase+2), 0x10); // Enable
IRQ on ACK (bit 4 of status register)
while (getchar() != 'Q');
return 0;
return 0;
}
After running it on a x86 target, i get the error:
\> Subproject5.exe
Starting again and over agin...
ERROR: Interrupt NOT initialized at first attempt
ERROR: Interrupt NOT initialized!
In intr\init.c i also have:
OALIntrStaticTranslate(SYSINTR_FIRMWARE + 7, 7);
which already came pre-included.
any hints?
any kind of help would be really great
thanks
Rafael
.
- Follow-Ups:
- Re: Parallel port interrupt revisited
- From: Bruce Eitman [eMVP]
- Re: Parallel port interrupt revisited
- References:
- Parallel port interrupt revisited
- From: rafaelaroca
- Re: Parallel port interrupt revisited
- From: Luca Calligaris
- Re: Parallel port interrupt revisited
- From: rafaelaroca
- Re: Parallel port interrupt revisited
- From: Bruce Eitman [eMVP]
- Parallel port interrupt revisited
- Prev by Date: Re: Setting or changing environment vaiables in the BSP Wizard CE5
- Next by Date: Re: Parallel port interrupt revisited
- Previous by thread: Re: Parallel port interrupt revisited
- Next by thread: Re: Parallel port interrupt revisited
- Index(es):
Relevant Pages
|