Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 112
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3368: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3370: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3371: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3372: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
OrbWorks Community Forum • View topic - pcmcia device driver

pcmcia device driver

Discuss PocketC for CE (including Desktop Edition)

Postby dartlin on Thu Apr 03, 2003 6:10 am

hi,guy thanks for replying my post.can someone help me with this problem?I am using winXP and embedded VC++3.0 with sdk pocketpc and pocketpc2002.Is this causing the problem?

-------------------Configuration: Proto - Win32 (WCE ARM) Release--------------------
Compiling...
StdAfx.cpp
C:\linwa\pcmcia\Pocket PC\Proto\stdafx.h(26) : fatal error C1083: Cannot open include file: 'sockserv.h': No such file or directory
Error executing clarm.exe.

Proto.dll - 1 error(s), 0 warning(s)


Code: Select all
// Proto.cpp : Defines the entry point for the DLL application.

#include "stdafx.h"
#include <stdlib.h>
#include "Proto.h"

DECLARE_CARDSERVICES_TABLE;
//CARD_CLIENT_HANDLE g_hClient;

CARD_CLIENT_HANDLE hCardClient;   
//CARD_SOCKET_HANDLE hSocket;
//CARD_WINDOW_HANDLE hCmdWindow;


//BYTE *g_pDigitalOutputWindow;
volatile unsigned char *g_pDigitalOutputWindow;
volatile unsigned char *g_pCommMemWindow;
volatile unsigned char *g_pAttrMemWindow;
volatile unsigned char *g_pIOWindow;
UINT MemGranularity=0;
int counter=0;
int mode=0;


BOOL APIENTRY DllMain( HANDLE DllInstance, DWORD Reason, LPVOID Reserved)
{
    switch(Reason) {
        case DLL_PROCESS_ATTACH:
         MessageBox(NULL, &L"DLL_PROCESS_ATTACH\r\n", &L"DLL Loaded", NULL);
           
           if ( InitCardServicesTable() )
            MessageBox(NULL, &L"Card services initialzed\r\n", &L"Card Services", NULL);
           else
            MessageBox(NULL, &L"Card services initialzation FAILED\r\n", &L"Card Services", NULL);
            break;

        case DLL_PROCESS_DETACH:
            MessageBox(NULL, &L"DLL_PROCESS_DETACH\r\n", &L"DLL Unloaded", NULL);
            break;
    }
    return TRUE;
}

STATUS NotificationEvent(CARD_EVENT CardEvent, CARD_SOCKET_HANDLE hSocket, PCARD_EVENT_PARMS pCardEventParms)
{
   CARD_WINDOW_HANDLE hCommWindow=NULL, hAttrWindow=NULL, hIOWindow=NULL;
   CARD_WINDOW_PARMS CardCommMemWinParms, CardAttrMemWinParms, CardIOWinParms;
   CARD_TUPLE_PARMS GetTupleParms;
   PCARD_TUPLE_PARMS pGetTupleParms = &GetTupleParms;
   CARD_DATA_PARMS GetTupleData;
   PCARD_DATA_PARMS pGetTupleData = &GetTupleData;
   CARD_CONFIG_INFO CardConfigInfo;
   PCARD_CONFIG_INFO PCardConfigInfo = &CardConfigInfo;
   UCHAR CFBuf[1024];
   PPARSED_CFTABLE PParsedCf = (PPARSED_CFTABLE)CFBuf;
   PPARSED_CONFIG PParsedConfig = (PPARSED_CONFIG)CFBuf;
   DWORD ErrorCode;
   wchar_t  buffer4[200], buffer1[2]=L"";
   UINT dataLen;
   UINT8 SPCTest1[200];
   UINT32 regaddress=0x300;
   int x=0;
   
   // Handle the event code
   switch(CardEvent)
   {
   case CE_CARD_INSERTION:
         MessageBox(NULL, &L"Card Detected : PCCProto200", &L"CARD INSERTED", MB_OK);   
         swprintf(buffer4, &L"Card %d:%d - PNP Id = %s", hSocket.uSocket, hSocket.uFunction, pCardEventParms->Parm1);
         MessageBox(NULL, buffer4, &L"Socket:Function & PNP ID", MB_OK);
         break;

   case CE_REGISTRATION_COMPLETE:
      //   MessageBox(NULL, &L"NotificationEvent: PCCProto200 Registered\r\n", &L"REGISTRATION COMPLETED", NULL);
         
              ///////////////////////////////////////////////////////////////////////////////
         ///            START REQUEST & MAPPING COMMON WINDOW                  ///
         ///////////////////////////////////////////////////////////////////////////////
         
         // Set up the common memory window
            CardCommMemWinParms.hSocket.uSocket = hSocket.uSocket;
            CardCommMemWinParms.hSocket.uFunction = hSocket.uFunction;

            // 16-bit common memory window
            CardCommMemWinParms.fAttributes = WIN_ATTR_16BIT | WIN_ATTR_ENABLED;

            // Set window size
            CardCommMemWinParms.uWindowSize = 0x4000;

            // 100 nsec access time
            CardCommMemWinParms.fAccessSpeed = WIN_SPEED_EXP_100NS;

         //Request the window from the host memory based on the attributes
            hCommWindow = CallCardServices(CardRequestWindow) ( (CARD_CLIENT_HANDLE)pCardEventParms->Parm1, &CardCommMemWinParms );
           
         if ( hCommWindow == NULL )
            {
                // Use GetLastError to check the error code
      //      MessageBox(NULL, &L"Request Common Window Failed\r\n", &L"Common Window", NULL);
            }

         if ( hCommWindow != NULL )
            {
                // Use GetLastError to check the error code
      //      MessageBox(NULL, &L"Request Common Window Success\r\n" , &L"Common Window", NULL);
            }

            // Map the common memory window(16KBytes) into system memory space at 16KB offset
            g_pCommMemWindow = (PUCHAR)CallCardServices(CardMapWindow) ( hCommWindow, 0x4000, 0x4000, &MemGranularity );
         ErrorCode = GetLastError();

      //   swprintf(buffer4, &L"MemGranularity: %d", MemGranularity);
      //   MessageBox(NULL, buffer4, &L"Debug Statement", MB_OK);
         
         
         switch(ErrorCode)
         {
            case CERR_SUCCESS:
            MessageBox(NULL, &L"Common Window Mapped ", &L"CARD_COMM_MAPPED ", MB_OK);   
            break;

            case CERR_BAD_WINDOW:

            MessageBox(NULL, &L"CERR_BAD_WINDOW ", &L"CERR_BAD_WINDOW ", MB_OK);   
            break;

            case CERR_BAD_HANDLE:
            MessageBox(NULL, &L"CERR_BAD_HANDLE ", &L"CERR_BAD_HANDLE ", MB_OK);   
            break;

            case CERR_BAD_SIZE:
            MessageBox(NULL, &L"CERR_BAD_SIZE ", &L"CERR_BAD_SIZE  ", MB_OK);   
            break;

            case CERR_OUT_OF_RESOURCE:
            MessageBox(NULL, &L"CERR_OUT_OF_RESOURCE  ", &L"CERR_OUT_OF_RESOURCE  ", MB_OK);   
            break;

            case CERR_IN_USE:
            MessageBox(NULL, &L"CERR_IN_USE  ", &L"CERR_IN_USE  ", MB_OK);   
            break;
         }
         

         if ( g_pCommMemWindow == NULL )
            {
                // Error, could not map window
      //      MessageBox(NULL, &L"CardMapWindow FAILED\r\n", &L"Common Window", NULL);
            }


         ///////////////////////////////////////////////////////////////////////////////
         ///            START REQUEST & MAPPING ATTRIBUTE WINDOW               ///
         ///////////////////////////////////////////////////////////////////////////////
         // Set up the attribute memory window
         CardAttrMemWinParms.hSocket.uSocket = hSocket.uSocket;
            CardAttrMemWinParms.hSocket.uFunction = hSocket.uFunction;

            // 8-bit attribute memory window
            CardAttrMemWinParms.fAttributes = 0x06 | WIN_ATTR_ENABLED;

            // Set window size
            CardAttrMemWinParms.uWindowSize = 0x2000;

            // 250 nsec access time
            CardAttrMemWinParms.fAccessSpeed = 0x01;

            //Request the window from the host memory based on the attributes
         hAttrWindow = CallCardServices(CardRequestWindow) ( (CARD_CLIENT_HANDLE)pCardEventParms->Parm1, &CardAttrMemWinParms );
           
         if ( hAttrWindow == NULL )
            {
                // Use GetLastError to check the error code
      //      MessageBox(NULL, &L"Request Attribute Window Failed\r\n", &L"Attribute Window", NULL);
            }

         if ( hAttrWindow != NULL )
            {
                // Use GetLastError to check the error code
      //      MessageBox(NULL, &L"Request Attribute Window Success\r\n" , &L"Attribute Window", NULL);
            }

            // Map the attribute memory window into system memory space at offset 0
           
         g_pAttrMemWindow = (PUCHAR)CallCardServices(CardMapWindow) ( hAttrWindow, 0, 0x2000, &MemGranularity );
      
         ErrorCode = GetLastError();

      //   swprintf(buffer4, &L"MemGranularity: %d", MemGranularity);
      //   MessageBox(NULL, buffer4, &L"Debug Statement", MB_OK);

      /*   *buffer4=NULL;

         //printing attribute memory for testing
         for (x=0;x<500;x+=2)
            {
            swprintf(buffer1, &L"%X ", g_pAttrMemWindow[i]);
            wcsncat(buffer4,buffer1,500);
      //      MessageBox(NULL, buffer1, &L"Debug Statement2", MB_OK);
            }

         MessageBox(NULL, buffer4, &L"Debug Statement2", MB_OK);*/
         
         switch(ErrorCode)
         {
            case CERR_SUCCESS:
            MessageBox(NULL, &L"Attribute Window Mapped ", &L"CARD_ATTR_MAPPED ", MB_OK);   
            break;

            case CERR_BAD_WINDOW:

            MessageBox(NULL, &L"CERR_BAD_WINDOW ", &L"CERR_BAD_WINDOW ", MB_OK);   
            break;

            case CERR_BAD_HANDLE:
            MessageBox(NULL, &L"CERR_BAD_HANDLE ", &L"CERR_BAD_HANDLE ", MB_OK);   
            break;

            case CERR_BAD_SIZE:
            MessageBox(NULL, &L"CERR_BAD_SIZE ", &L"CERR_BAD_SIZE  ", MB_OK);   
            break;

            case CERR_OUT_OF_RESOURCE:
            MessageBox(NULL, &L"CERR_OUT_OF_RESOURCE  ", &L"CERR_OUT_OF_RESOURCE  ", MB_OK);   
            break;

            case CERR_IN_USE:
            MessageBox(NULL, &L"CERR_IN_USE  ", &L"CERR_IN_USE  ", MB_OK);   
            break;
         }
         

         if ( g_pAttrMemWindow == NULL )
            {
                // Error, could not map window
      //      MessageBox(NULL, &L"CardMapWindow FAILED\r\n", &L"Attribute Window", NULL);
            }

         ///////////////////////////////////////////////////////////////////////////////
         ///            START REQUEST & MAPPING I/O WINDOW(FUNCTION 1)            ///
         ///////////////////////////////////////////////////////////////////////////////

         // Set up the IO memory window
            CardIOWinParms.hSocket.uSocket = hSocket.uSocket;
            CardIOWinParms.hSocket.uFunction = hSocket.uFunction;

            // 8-bit IO memory window
            CardIOWinParms.fAttributes = 0x06 | WIN_ATTR_ENABLED | WIN_ATTR_IO_SPACE;

            // Set window size
            CardIOWinParms.uWindowSize = 0x1F;

            // 1 usec access time
            CardIOWinParms.fAccessSpeed = WIN_SPEED_USE_WAIT;

            //Request the window from the host memory based on the attributes
         hIOWindow = CallCardServices(CardRequestWindow) ( (CARD_CLIENT_HANDLE)pCardEventParms->Parm1, &CardIOWinParms );
           
         if ( hIOWindow == NULL )
            {
      //      MessageBox(NULL, &L"Request I/O Window Failed\r\n", &L"I/O Window", NULL);
            }

         if ( hIOWindow != NULL )
            {
      //      MessageBox(NULL, &L"Request I/O Window Success\r\n" , &L"I/O Window", NULL);
            }

            // Map the IO memory window into system memory space
            g_pIOWindow = (PUCHAR)CallCardServices(CardMapWindow) ( hIOWindow, 0x300, 0x1F, &MemGranularity );
         ErrorCode = GetLastError();

      //   swprintf(buffer4, &L"MemGranularity: %d", MemGranularity);
      //   MessageBox(NULL, buffer4, &L"Debug Statement", MB_OK);


         switch(ErrorCode)
         {
            case CERR_SUCCESS:
      //      MessageBox(NULL, &L"I/O Window Mapped ", &L"CARD_IO_MAPPED ", MB_OK);   
            break;

            case CERR_BAD_WINDOW:

            MessageBox(NULL, &L"CERR_BAD_WINDOW ", &L"CERR_BAD_WINDOW ", MB_OK);   
            break;

            case CERR_BAD_HANDLE:
            MessageBox(NULL, &L"CERR_BAD_HANDLE ", &L"CERR_BAD_HANDLE ", MB_OK);   
            break;

            case CERR_BAD_SIZE:
            MessageBox(NULL, &L"CERR_BAD_SIZE ", &L"CERR_BAD_SIZE  ", MB_OK);   
            break;

            case CERR_OUT_OF_RESOURCE:
            MessageBox(NULL, &L"CERR_OUT_OF_RESOURCE  ", &L"CERR_OUT_OF_RESOURCE  ", MB_OK);   
            break;

            case CERR_IN_USE:
            MessageBox(NULL, &L"CERR_IN_USE  ", &L"CERR_IN_USE  ", MB_OK);   
            break;
         }
         

         if ( g_pIOWindow == NULL )
            {
                // Error, could not map window
      //      MessageBox(NULL, &L"CardMapIOWindow FAILED\r\n", &L"I/O Window", NULL);
            }



         ///////////////////////////////////////////////////////////////////////////////
         ///                     END OF MAPPING WINDOWS                     ///
         ///////////////////////////////////////////////////////////////////////////////
      
         
         ///////////////////////////////////////////////////////////////////////////////
         ///                     GETTING TUPLES INFORMATION                  ///
         ///////////////////////////////////////////////////////////////////////////////

         
         GetTupleParms.hSocket.uSocket = hSocket.uSocket;
         GetTupleParms.hSocket.uFunction = hSocket.uFunction;
         GetTupleParms.fAttributes=TUPLE_RETURN_LINKS;
         GetTupleParms.uDesiredTuple=0xFF;
         GetTupleParms.uReserved=0;

         ErrorCode=CallCardServices(CardGetFirstTuple) (pGetTupleParms);

      //   if (ErrorCode==CERR_SUCCESS)
      //      MessageBox(NULL, &L"GET_FIRST_TUPLE_SUCCESS ", &L"TUPLE_SUCCESS", MB_OK);
      //   else
      //      MessageBox(NULL, &L"GET_FIRST_TUPLE_FAILURE ", &L"TUPLE_FAILURE", MB_OK);
      
   /*      ErrorCode=CallCardServices(CardGetNextTuple) (pGetTupleParms);

         if (ErrorCode==CERR_SUCCESS)
            MessageBox(NULL, &L"GET_NEXT_TUPLE_SUCCESS ", &L"TUPLE_SUCCESS", MB_OK);
         else
            MessageBox(NULL, &L"GET_NEXT_TUPLE_FAILURE ", &L"TUPLE_FAILURE", MB_OK);*/


         GetTupleData.hSocket.uSocket=hSocket.uSocket;
         GetTupleData.hSocket.uFunction=hSocket.uFunction;
         GetTupleData.uTupleOffset=2;

         ErrorCode=CallCardServices(CardGetTupleData) (pGetTupleData);

         switch(ErrorCode)
         {
            case CERR_SUCCESS:
            MessageBox(NULL, &L"CERR_SUCCESS ", &L"CERR_SUCCESS ", MB_OK);   
            break;

            case CERR_BAD_ARG_LENGTH :
            MessageBox(NULL, &L"CERR_BAD_ARG_LEN ", &L"CERR_BAD_ARG_LEN ", MB_OK);   
            break;

            case CERR_BAD_ARGS:
            MessageBox(NULL, &L"CERR_BAD_ARG ", &L"CERR_BAD_ARG ", MB_OK);   
            break;

            case CERR_READ_FAILURE:
      //      MessageBox(NULL, &L"CERR_READ_FAIL ", &L"CERR_READ_FAIL ", MB_OK);   
            break;

            case CERR_OUT_OF_RESOURCE:
            MessageBox(NULL, &L"CERR_OUT_OF_RESOURCE  ", &L"CERR_OUT_OF_RESOURCE  ", MB_OK);   
            break;

            case CERR_NO_MORE_ITEMS:
            MessageBox(NULL, &L"CERR_NO_ITEM  ", &L"CERR_NO_ITEM ", MB_OK);   
            break;
         }

      //   swprintf(buffer4, &L"Specifies the type of tuple found : \r\n\nTUPLE CODE : %X",GetTupleParms.uTupleCode);
      //   MessageBox(NULL,buffer4,&L"TUPLE PARAMS ",MB_OK);

      //   swprintf(buffer4, &L"Specifies the link value of tuple found :\r\n\nTUPLE LINK : %X",GetTupleParms.uTupleLink);
      //   MessageBox(NULL,buffer4,&L"TUPLE PARAMS ",MB_OK);

      //   swprintf(buffer4, &L"TUPLE LEN : %X",GetTupleData.uDataLen);
      //   MessageBox(NULL,buffer4,&L"TUPLE DATA ",MB_OK);

         
         ///////////////////////////////////////////////////////////////////////////////
         ///                  END OF GETTING TUPLE INFORMATION               ///
         ///////////////////////////////////////////////////////////////////////////////
      
         
         ///////////////////////////////////////////////////////////////////////////////
         ///                  PARSING TUPLE INFORMATION                     ///
         ///////////////////////////////////////////////////////////////////////////////
      
         
         dataLen = sizeof(CFBuf)/sizeof(PARSED_CFTABLE);
         ErrorCode=CallCardServices(CardGetParsedTuple) (hSocket,CISTPL_CFTABLE_ENTRY,PParsedCf,&dataLen);

      //   if(ErrorCode==CERR_SUCCESS)
      //      MessageBox(NULL, &L"PARSE_CFTABLE_ENTRY_SUCCESS ", &L"PARSE_SUCCESS", MB_OK);
      //   else
      //      MessageBox(NULL, &L"PARSE_CFTABLE_ENTRY_FAILURE ", &L"PARSE_FAILURE", MB_OK);

         dataLen = sizeof(CFBuf)/sizeof(PARSED_CONFIG);
         ErrorCode=CallCardServices(CardGetParsedTuple) (hSocket,CISTPL_CONFIG,PParsedConfig,&dataLen);

      //   if(ErrorCode==CERR_SUCCESS)
      //      MessageBox(NULL, &L"PARSE_CONFIG_SUCCESS ", &L"PARSE_SUCCESS", MB_OK);
      //   else
      //      MessageBox(NULL, &L"PARSE_CONFIG_FAILURE ", &L"PARSE_FAILURE", MB_OK);


      /*   swprintf(buffer4, &L"ConfigBase : %X",PParsedConfig->ConfigBase);
         MessageBox(NULL,buffer4,&L"IOadd ",MB_OK);

         swprintf(buffer4, &L"RegMask : %X",PParsedConfig->RegMask);
         MessageBox(NULL,buffer4,&L"IOadd ",MB_OK);

         swprintf(buffer4, &L"LastConfigIndex : %X",PParsedConfig->LastConfigIndex);
         MessageBox(NULL,buffer4,&L"IOadd ",MB_OK);

         swprintf(buffer4, &L"ConfigIndex : %X",PParsedCf->ConfigIndex);
         MessageBox(NULL,buffer4,&L"IOadd ",MB_OK);*/
      
         
         ///////////////////////////////////////////////////////////////////////////////
         ///                  END OF PARSING TUPLE INFORMATION               ///
         ///////////////////////////////////////////////////////////////////////////////
      

         //Reset the card & wait for further instructions
      //   MessageBox(NULL, &L"Resetting card\r\n", &L"Message Box", NULL);
         ErrorCode=CallCardServices(CardResetFunction) ( (CARD_CLIENT_HANDLE)pCardEventParms->Parm1, hSocket );
         
         //Indicate Reset Success or Failure
      //   if (ErrorCode==CERR_SUCCESS)
      //      MessageBox(NULL, &L"Reset Successful ", &L"RESET_SUCCESS", MB_OK);
      //   else
      //      MessageBox(NULL, &L"Reset Fail ", &L"RESET_FAILURE", MB_OK);

         
         ///////////////////////////////////////////////////////////////////////////////
         ///                  CONFIGURATION OF THE PC CARD                  ///
         ///////////////////////////////////////////////////////////////////////////////
      

         //Setting the required info for manual configuration
         CardConfigInfo.hSocket.uSocket=hSocket.uSocket;
         CardConfigInfo.hSocket.uFunction=hSocket.uFunction;
         CardConfigInfo.fAttributes=CFG_ATTR_IRQ_STEERING;   //Enables IRQ steering in the socket controller.
         CardConfigInfo.fInterfaceType=CFG_IFACE_MEMORY_IO;   //Puts the socket controller in memory mode and I/O interface mode
         CardConfigInfo.uVcc=0x32;   //Vcc = 5.0V
         CardConfigInfo.uVpp1=0x32;   
         CardConfigInfo.uVpp2=0x32;
         CardConfigInfo.fRegisters=CFG_REGISTER_CONFIG | CFG_REGISTER_STATUS | CFG_REGISTER_PIN | CFG_REGISTER_COPY;
         CardConfigInfo.uConfigReg=0x7D;   //initialize to level mode interrupts
         CardConfigInfo.uStatusReg=FCR_FCSR_IO_IS_8;      //Used by the host to indicate 8-bit-only I/O.
         CardConfigInfo.uPinReg=0;
         CardConfigInfo.uCopyReg=0;
   
         //Requesting configuration for the pc card
         ErrorCode=CallCardServices(CardRequestConfiguration) ( (CARD_CLIENT_HANDLE)pCardEventParms->Parm1, PCardConfigInfo);
         
         //Checking the base i/o address and number of address lines
      //   swprintf(buffer4, &L"IO ENTRIES : %X",PParsedCf->NumIOEntries);
      //   MessageBox(NULL,buffer4,&L"Number of I/O Entries ",MB_OK);
         
      //   swprintf(buffer4, &L"IO BASE : %X",PParsedCf->IOBase[0]);
      //   MessageBox(NULL,buffer4,&L"I/O Base Address ",MB_OK);

      //   swprintf(buffer4, &L"ADDRESS LINES : %X",PParsedCf->NumIOAddrLines);
      //   MessageBox(NULL,buffer4,&L"Number of I/O Address Lines ",MB_OK);


         //Indicate if the manual configuration is successful
         switch(ErrorCode)
         {
            case CERR_SUCCESS:
      //      MessageBox(NULL, &L"Request Configuration Successful", &L"Card Configuration", MB_OK);
            break;

            case CERR_BAD_ARGS:
            MessageBox(NULL, &L"CERR_BAD_ARGS ", &L"CERR_BAD_ARGS ", MB_OK);   
            break;

            case CERR_BAD_HANDLE:
            MessageBox(NULL, &L"CERR_BAD_ARGS ", &L"CERR_BAD_ARGS ", MB_OK);   
            break;

            case CERR_BAD_SOCKET:
            MessageBox(NULL, &L"CERR_BAD_SOCKET ", &L"CERR_BAD_SOCKET ", MB_OK);   
            break;

            case CERR_BAD_VCC:
            MessageBox(NULL, &L"CERR_BAD_VCC ", &L"CERR_BAD_VCC  ", MB_OK);   
            break;

            case CERR_BAD_VPP:
            MessageBox(NULL, &L"CERR_BAD_VPP  ", &L"CERR_BAD_VPP  ", MB_OK);   
            break;

            case CERR_IN_USE:
            MessageBox(NULL, &L"CERR_IN_USE  ", &L"CERR_IN_USE  ", MB_OK);   
            break;

            case CERR_READ_FAILURE:
            MessageBox(NULL, &L"CERR_READ_FAILURE  ", &L"CERR_READ_FAILURE  ", MB_OK);   
            break;

            case CERR_WRITE_FAILURE:
            MessageBox(NULL, &L"CERR_WRITE_FAILURE  ", &L"CERR_WRITE_FAILURE  ", MB_OK);   
            break;
         }


      
         

         
         ///////////////////////////////////////////////////////////////////////////////
         ///                     END OF CONFIGURATION                     ///
         ///////////////////////////////////////////////////////////////////////////////
      
      
         //writing data to host data bus through i/o space
      //   MessageBox(NULL,&L"Preparing to write into I/O space",&L"IO SPACE",MB_OK);
         
      
      //   UINT test=0x00;
   
   
         //g_pIOWindow[3]=0x82;
         g_pIOWindow[0]=0x55;
      /*   for (long x=0;x<400000;x++)
         {
            for (long y=0;y<100;y++)
            {
            g_pIOWindow[3]=0x0F;
            if (y%20==0)
               g_pIOWindow[3]=0x0D;
            }
            for (y=0;y<50;y++)
               {
               g_pIOWindow[3]=0x0E;
            
               if (y= 
               
               g_pIOWindow[3]=0x0C;
               }
         }*/
         g_pIOWindow[3]=0x0A;


         
      //   MessageBox(NULL,&L"Preparing to write into I/O space(PB)",&L"IO SPACE",MB_OK);
         
      //   test=g_pIOWindow[1];

      //   swprintf(buffer4, &L"Read : %X",test);
      //   MessageBox(NULL,buffer4,&L"Read",MB_OK);

      
         //Reading configuration register at function 0 base address 0x300
         for(x=0;x<50;x++)
            {
            ErrorCode=CallCardServices(CardAccessConfigurationRegister) ( (CARD_CLIENT_HANDLE)pCardEventParms->Parm1, hSocket, CARD_FCR_READ, regaddress, &SPCTest1[x]);
            regaddress++;
            }

         //Indicate if call to read configuration register is successful
      //   if (ErrorCode==CERR_SUCCESS)
      //      MessageBox(NULL, &L"CARD_READ_CONFIG_SUCCESS ", &L"CERR_SUCCESS", MB_OK);
      //   else
      //      MessageBox(NULL, &L"CARD_READ_CONFIG_FAILURE ", &L"CERR_FAILURE", MB_OK);

      
         *buffer4=NULL;
         
         //Printing out the configuration register read
         for(x=0;x<50;x++)
            {
            swprintf(buffer1, &L"%X ",SPCTest1[x]);
            wcsncat(buffer4,buffer1,200);
            }
      //   MessageBox(NULL,buffer4,&L"Configuration Register (Read) 0x300",MB_OK);
         
         break;

   }
   return CERR_SUCCESS;
}


extern "C"
__declspec(dllexport)
DWORD SPC_Init(DWORD dwContext)
{

   CARD_REGISTER_PARMS CardParams;

   //MessageBox(NULL, &L"SPC_Init", &L"SPC_Init", MB_OK);


   CardParams.fEventMask = EVENT_MASK_CARD_DETECT;
   CardParams.uClientData = 0;
   CardParams.fAttributes = CLIENT_ATTR_IO_DRIVER | CLIENT_ATTR_NOTIFY_SHARED | CLIENT_ATTR_NOTIFY_EXCLUSIVE;

   //Register the client driver
   hCardClient = CallCardServices(CardRegisterClient)(NotificationEvent, &CardParams);

   //Check for registration status
   if (hCardClient == NULL)
   {
      MessageBox(NULL, &L"CardRegisterClient Failed", &L"CardRegisterClient Failed", MB_OK);   
   }

   
   return TRUE;
   
}

extern "C"
__declspec(dllexport)
BOOL SPC_Deinit(DWORD dwContext)
{
   DWORD ErrorCode;
   
   MessageBox(NULL, &L"PCCProto200 EJECTED", &L"CARD REMOVED", MB_OK);

   ErrorCode=CallCardServices(CardDeregisterClient)(hCardClient);

   
   switch(ErrorCode)
   {
   case CERR_SUCCESS:
         MessageBox(NULL, &L"PCCProto200 Deregistered ", &L"DEREGISTER COMPLETED ", MB_OK);   
         break;
   case CERR_BAD_HANDLE :
         MessageBox(NULL, &L"HANDLE INVALID ", &L"CERR_BAD_HANDLE ", MB_OK);   
         break;
   }

   MessageBox(NULL, &L"SPC_DeInit", &L"SPC_DeInit", MB_OK);

   return TRUE;
   
}

extern "C"
__declspec(dllexport)
DWORD SPC_Open(DWORD dwData,DWORD dwAccess,DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes,
            DWORD dwCreationDispostion, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile)
{
   return 1;
}

extern "C"
__declspec(dllexport)
BOOL SPC_Close(DWORD Handle)
{
   return TRUE; 
}

extern "C"
__declspec(dllexport)
BOOL SPC_IOControl(DWORD Handle,
    DWORD dwIoControlCode,
    PBYTE pInBuf,
    DWORD nInBufSize,
    PBYTE pOutBuf,
    DWORD nOutBufSize,
    PDWORD pBytesReturned
    )
{

   MessageBox(NULL, &L"SPC_IoControl", &L"SPC_IoControl", MB_OK);

   return TRUE;
   
}

extern "C"
__declspec(dllexport)
void
SPC_PowerDown(DWORD hDeviceContext)
{
   MessageBox(NULL, &L"SPC_PowerDown", &L"SPC_PowerDown", MB_OK);
}

extern "C"
__declspec(dllexport)
void  SPC_PowerUp(DWORD hDeviceContext)
{
   MessageBox(NULL, &L"SPC_PowerUp", &L"SPC_PowerUp", MB_OK);
}

extern "C"
__declspec(dllexport)
DWORD SPC_Read(DWORD Handle, LPVOID pBuffer, DWORD dwNumBytes)
{
   MessageBox(NULL, &L"SPC_Read", &L"SPC_Read", MB_OK);   
   return 0;

}

extern "C"
__declspec(dllexport)
BOOL SPC_Write(HANDLE hOpenContext, LPVOID pBuffer, DWORD dwNumBytes, LPDWORD lpNumberOfBytesWritten, LPOVERLAPPED lpOverlapped)
{
   UINT8 data = (UINT8)dwNumBytes;
//   wchar_t buffer[10];
   
/*   swprintf(buffer, &L"%X ",data);
   MessageBox(NULL, buffer, &L"SPC_write", MB_OK);*/

   if (data==0x01)            //one byte to intialize counter;
      counter=1;
   if (counter==1 && data==0x02)   //check for 2nd byte to determine application
   {
      mode=1;                     //set mode of operation
      counter=0;                  //reset counter
      data=0x00;                  //reset data
   }
   else if (counter==1 && data==0x03)
   {
      mode=2;
      counter=0;
      data=0xFF;      //reset the LEDs
   }

/*   swprintf(buffer, &L"%d ",counter);
   MessageBox(NULL, buffer, &L"SPC_write", MB_OK);
   swprintf(buffer, &L"%d ",mode);
   MessageBox(NULL, buffer, &L"SPC_write", MB_OK);*/

   if (mode==1)
      g_pIOWindow[3]= data;
   else if (mode==2)
      g_pIOWindow[0]= data;

   return 1;

}

extern "C"
__declspec(dllexport)
DWORD SPC_Seek(DWORD Handle, long lDistance, WORD dwMoveMethod)
{
   MessageBox(NULL, &L"SPC_Seek", &L"SPC_Seek", MB_OK);   
   return 0;

}



Code: Select all
//Proto.h
#define PWRDLL_EXPORTS
#ifdef PWRDLL_EXPORTS
#define PWRDLL_API __declspec(dllexport)
#else
#define PWRDLL_API __declspec(dllimport)
#endif

//DLL exports (required for stream interface drivers)
extern "C" {
PWRDLL_API BOOL SPC_Close(DWORD hOpenContext);
PWRDLL_API BOOL SPC_Deinit(DWORD hDeviceContext);
PWRDLL_API DWORD SPC_Init(DWORD dwContext);
PWRDLL_API BOOL SPC_IOControl(DWORD hOpenContext, DWORD dwCode, PBYTE pBufIn, DWORD dwLenIn, PBYTE pBufOut, DWORD dwLenOut, PDWORD pdwActualOut);
PWRDLL_API DWORD SPC_Open(DWORD hDeviceConext, DWORD dwAccessCode, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes,
                     DWORD dwCreationDispostion, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile);
PWRDLL_API void SPC_PowerDown(DWORD hDeviceContext);
PWRDLL_API void SPC_PowerUp(DWORD hDeviceContext);
PWRDLL_API DWORD SPC_Read(DWORD hOpenContext, LPVOID pBuffer, DWORD dwCount);
PWRDLL_API DWORD SPC_Seek(DWORD hOpenContext, long lAmount, WORD wType);
PWRDLL_API BOOL SPC_Write(HANDLE hOpenContext, LPVOID pBuffer, DWORD dwNumberOfBytes, LPDWORD lpNumberOfBytesWritten, LPOVERLAPPED lpOverlapped);
}




Code: Select all
// stdafx.h : include file for standard system include files,
//  or project specific include files that are used frequently, but
//      are changed infrequently
//

#if !defined(AFX_STDAFX_H__10696602_A85F_11D5_B945_00C04F87941D__INCLUDED_)
#define AFX_STDAFX_H__10696602_A85F_11D5_B945_00C04F87941D__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000


// Insert your headers here
#define WIN32_LEAN_AND_MEAN      // Exclude rarely-used stuff from Windows headers

#include <windows.h>


#include <types.h>
#include <memory.h>
#include <tchar.h>
#include <ceddk.h>

#include <cardserv.h>
#include <sockserv.h>
#include <tuple.h>

#include <pcmfuncs.h>
#include <winioctl.h>
// TODO: reference additional headers your program requires here

//{{AFX_INSERT_LOCATION}}
// Microsoft eMbedded Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_STDAFX_H__10696602_A85F_11D5_B945_00C04F87941D__INCLUDED_)



dartlin
 
Posts: 6
Joined: Wed Apr 02, 2003 2:28 am
Location: Singapore

Postby guy on Thu Apr 03, 2003 8:16 am

What is the actual problem that you are having?



Guy
[url]mailto:pcform@pcform.net[/url]
http://www.pcform.net
PocketC CE API interface: http://www.networkdynamics.net/PCForm.html#library
PCForm and CE API forum: http://www.networkdynamics.net/forum
Guy
[url]mailto:pcform@pcform.net[/url]
http://www.pcform.net
PocketC CE API interface: http://www.networkdynamics.net/PCForm.html#library
PCForm and CE API forum: http://www.networkdynamics.net/forum
guy
 
Posts: 879
Joined: Thu Dec 07, 2000 8:58 am
Location: United Kingdom

Postby dartlin on Fri Apr 04, 2003 1:06 am

this is the problem i am having.

-------------------Configuration: Proto - Win32 (WCE ARM) Release--------------------
Compiling...
StdAfx.cpp
C:\linwa\pcmcia\Pocket PC\Proto\stdafx.h(26) : fatal error C1083: Cannot open include file: 'sockserv.h': No such file or directory
Error executing clarm.exe.

Proto.dll - 1 error(s), 0 warning(s)
dartlin
 
Posts: 6
Joined: Wed Apr 02, 2003 2:28 am
Location: Singapore

Postby KOU on Fri Apr 04, 2003 2:27 am

Checkpoint:
Is there really a file called "sockserv.h"?
Is the file path setting correct?

Remember, this is not PocketPC board.
This is PocketC for Windows CE OS board.
http://www.orbworks.com

The DLL source you provided doesn't seem like it is plugin for PocketC.

KOU
KOU
 
Posts: 92
Joined: Mon Mar 18, 2002 8:04 pm
Location: USA

Postby dartlin on Fri Apr 04, 2003 3:35 am

<blockquote id="quote"><font size="1" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote"><i>Originally posted by KOU</i>
<br />Checkpoint:
Is there really a file called "sockserv.h"?
Is the file path setting correct?

Remember, this is not PocketPC board.
This is PocketC for Windows CE OS board.
http://www.orbworks.com

The DLL source you provided doesn't seem like it is plugin for PocketC.

i am using embedded visual c++ 3.0 and sdk pocketpc and pocketpc2002 to compile.

KOU
<hr height="1" noshade id="quote"></blockquote id="quote"></font id="quote">
dartlin
 
Posts: 6
Joined: Wed Apr 02, 2003 2:28 am
Location: Singapore

Postby guy on Fri Apr 04, 2003 9:40 am

cardserv.h only exists in the PocktPC2002 and BE300 SDKs, there is no sockserv.h in any of the SDKs.


Guy
[url]mailto:pcform@pcform.net[/url]
http://www.pcform.net
PocketC CE API interface: http://www.networkdynamics.net/PCForm.html#library
PCForm and CE API forum: http://www.networkdynamics.net/forum
Guy
[url]mailto:pcform@pcform.net[/url]
http://www.pcform.net
PocketC CE API interface: http://www.networkdynamics.net/PCForm.html#library
PCForm and CE API forum: http://www.networkdynamics.net/forum
guy
 
Posts: 879
Joined: Thu Dec 07, 2000 8:58 am
Location: United Kingdom

Postby dartlin on Mon Apr 07, 2003 1:41 am

-------------------Configuration: Proto - Win32 (WCE ARM) Release--------------------
Compiling...
StdAfx.cpp
C:\linwa\pcmcia\Pocket PC\Proto\stdafx.h(22) : fatal error C1083: Cannot open include file: 'ceddk.h': No such file or directory
Error executing clarm.exe.

Proto.dll - 1 error(s), 0 warning(s)

then what about this problem? is it that pocketpc sdk dont have and it exist in pocketpc2002??
dartlin
 
Posts: 6
Joined: Wed Apr 02, 2003 2:28 am
Location: Singapore

Postby KOU on Mon Apr 07, 2003 11:59 pm

Did you install device driver development kit?
It is different from SDK. (Software development kit)
I think it that included toolkits for developments for drivers.

I am not a specialist, so I might be wrong.

-------------------------------------------------

PocketC is different from Embedded Visual C++.
It is C-like Language that can compile on device.

This is board for PocketC.
You may not get answers you want.

KOU
KOU
 
Posts: 92
Joined: Mon Mar 18, 2002 8:04 pm
Location: USA


Return to PocketC for CE

Who is online

Users browsing this forum: No registered users and 1 guest