none
Where and How to see retail messages used in XXX_Init and XXX_Deinit functions of driver???? RRS feed

  • Question

  • Hello friends,

     I am working on basic drivers and upto so far I have only used XXX_Init and XXX_Deinit functions in my basic driver. I have mapped these two functions in my code as TST_Init and TST_Deinit. In both functions, I am retailmsgs as shown below:-

    DWORD TST_Init(
      LPCTSTR regPath,
      DWORD dwBusContext
    )
    {
    	HKEY	hkey;
    	DWORD	result;
    	RETAILMSG(TRUE,(TEXT("TST_Init(): START\r\n")));
    
    	/*hkey	=	OpenDeviceKey((LPCTSTR)regPath);
    
    	if(!hkey)
    	{
    		RETAILMSG(TRUE,(TEXT("TEST_Init(): Failed to open registery\r\n")));
    	}
    	else
    	{
    		result = RegQueryValueEx(hkey,)
    
    	}*/
    	
    	RETAILMSG(TRUE,(TEXT("TST_Init(): END\r\n")));
    
    	return TRUE;
    
    }
    
    BOOL TST_Deinit(
      DWORD hDeviceContext 
    )
    {
    	RETAILMSG(TRUE,(TEXT("TST_Deinit(): START\r\n")));
    
    	
    	
    	RETAILMSG(TRUE,(TEXT("TST_Deinit(): END\r\n")));
    	return TRUE;
    }
    I have build the image in release build mode with KITL and profiling enable. I am downloading the image via Ethernet and using registry remote tools to see the entry of my driver.. The folder name is visible under Drivers. Now, the thing is that I want to see the retailmsgs that I am using in the driver. Since Init function is called by Device Manager after loading the driver, it should display the retail msgs. But the thing, where can I see these message.............???



    Thursday, March 13, 2014 3:40 AM

Answers

  • Dear Partap,

    Please modify the entry of .bib file as

    Test1.dll						$(_FLATRELEASEDIR)\Test1.dll			NK  SHK

    With your previous entry, the driver should be loaded programatically, but with this entry it will be loaded by Kernel on startup...

    Friday, March 14, 2014 12:27 PM

All replies

  • If Your driver is loaded by the device manager at the boot time.

    And you have the corresponding settings in the reg file done correctly.

    The Init debug log shall be printed during bootup time and shall be displayed at the PB console output window as you are using the KITL and Eth to download.

    Similarly Deinit when your driver is removed from the kernel due to failure or shutdown or similar conditions.

    In case if would manually load the driver messages shall be printed on loading and unloading the driver.

    --- Misbah


    Senior Design Engineer T.E.S Electroni Solutions (Bangalore-India) www.tes-dst.com email-misbah.khan@tes-dst.com

    Thursday, March 13, 2014 5:23 AM
  • Hello Misbah Khan,

    i have checked it many times, the PB Debug  and PB Log did not display any info related to my driver wit name TST_Detiver..... but still it shows the entry in remote tool i.e. registry editor...... it is under release build with KITL and profiling enable

    Where I am lacking I am unable to find it...


    Thursday, March 13, 2014 6:40 AM
  • Instead of RETAILMSG just use NKDbgPrintfW directly. 

    Ian Bakshan, Sr. Software Engineer at Jungo Connectivity LTD
    WinDriver – Driver Development Tool
    DriverCore – PC USB Drivers

    Thursday, March 13, 2014 11:24 AM
  • Check your serial output, if it is not displayed in the pb console log then it wil be in the serial output. Do you have a kitl connection after the image is downloaded? iow are you still connected?

    What configurating are u using? in a Shipbuild configuration RETAILMSG() and DEBUGMSG() are not shown....

    http://msdn.microsoft.com/en-us/library/dd229277.aspx


    -- Good luck, Erwin Zwart--- Check out my blog: http://GuruCE.com/blog https://twitter.com/GuruCE_Embedded GuruCE Microsoft Embedded Partner http://GuruCE.com Consultancy, training and development services.

    Thursday, March 13, 2014 11:31 AM

  • RETAILMSG calls to NKDbgPrintfW.... So, it not mandatory. We can either use RETAILMSG or NKDbgPrintfW.

    its also not shown in Serial Debug console and PB Console. As, I already shared that I have build the images in Release mode with KITL and Profiling enabling.....

    These are my PB Console messages

    (Corecon) Download complete.
       6298 PID:0 TID:2 -OEMInit
       6311 PID:400002 TID:410002 SetOpp: choosing AM335X_REV_ES2_1 
       6311 PID:400002 TID:410002 SetOpp to 3 
       6318 PID:400002 TID:590002 OALIoCtlHalInitRTC: Initializing RTC
       6318 PID:400002 TID:590002 RTC_SetTime() = 2006.01.01 12:00:00.000
       6446 PID:400002 TID:a80006 ECC TYPE is BCH 8 bit
       6446 PID:400002 TID:a80006 8Bit NAND device
      10396 PID:400002 TID:a80006 CM3: input file [\windows\firmware.bin] is 9932 bytes long
      10397 PID:400002 TID:a80006 CM3: firmware file read ok!
      10656 PID:400002 TID:a80006 UCD_INIT: g_Dc.pUsb0Regs->MODE_R = 0x80 
      10660 PID:400002 TID:a80006 CAM3xxOTG::Init DEVCTL 80
      10764 PID:400002 TID:a80006 UsbPowerModule: 2 DEVCTL = 0x00000081
      10942 PID:400002 TID:24e000a Exception 'Data Abort' (0x4): Thread-Id=024e000a(pth=9e421000), Proc-Id=00400002(pprc=8265f700) 'NK.EXE', VM-active=00400002(pprc=8265f700) 'NK.EXE'
      10942 PID:400002 TID:24e000a PC=ef352d60(k.ceddk.dll+0x00002d60) RA=ef353058(k.ceddk.dll+0x00003058) SP=a57bfdc0, BVA=00000008
      10943 PID:400002 TID:24e000a Exception 'Prefetch Abort' (0x3): Thread-Id=024e000a(pth=9e421000), Proc-Id=00400002(pprc=8265f700) 'NK.EXE', VM-active=00400002(pprc=8265f700) 'NK.EXE'
      10944 PID:400002 TID:24e000a PC=00000000(???+0x00000000) RA=ef472dc8(k.ole32.dll+0x00002dc8) SP=a57bfa44, BVA=00000000
      10945 PID:400002 TID:24e000a Exception 'Prefetch Abort' (0x3): Thread-Id=024e000a(pth=9e421000), Proc-Id=00400002(pprc=8265f700) 'NK.EXE', VM-active=00400002(pprc=8265f700) 'NK.EXE'
      10945 PID:400002 TID:24e000a PC=00000000(???+0x00000000) RA=eff93670(k.coredll.dll+0x00043670) SP=a57bf400, BVA=00000000
      11024 PID:400002 TID:1ef001a Exception 'Prefetch Abort' (0x3): Thread-Id=01ef001a(pth=9e415304), Proc-Id=00400002(pprc=8265f700) 'NK.EXE', VM-active=00400002(pprc=8265f700) 'NK.EXE'
      11024 PID:400002 TID:1ef001a PC=00000000(???+0x00000000) RA=8004d668(kernel.dll+0x0001e668) SP=a570fb2c, BVA=00000000
      11024 PID:400002 TID:2f4000a Exception 'Data Abort' (0x4): Thread-Id=02f4000a(pth=9e426648), Proc-Id=00400002(pprc=8265f700) 'NK.EXE', VM-active=00400002(pprc=8265f700) 'NK.EXE'
      11025 PID:400002 TID:2f4000a PC=ef95129c(vmini.dll+0x0000129c) RA=ef951230(vmini.dll+0x00001230) SP=a591fe44, BVA=a555dee0
      11026 PID:400002 TID:1cb001a Exception 'Prefetch Abort' (0x3): Thread-Id=01cb001a(pth=9e414b80), Proc-Id=00400002(pprc=8265f700) 'NK.EXE', VM-active=00400002(pprc=8265f700) 'NK.EXE'
      11026 PID:400002 TID:1cb001a PC=00000000(???+0x00000000) RA=8004d668(kernel.dll+0x0001e668) SP=a56ffbe8, BVA=00000000

    and my Serial debug console is as:-

    IsValidMBR: MBR sector = 0x480 (valid MBR)
    OpenPartition: Partition Exists=0x1 for part 0x20.
    BP_SetDataPointer at 0x260a9f8
    BP_SetDataPointer at 0x0
    WriteData: Start = 0x0, Length = 0x260a9f8.
    NK image written
    Launch Windows CE image by jumping to 0x8000b420...

    Windows CE Kernel for ARM (Thumb Enabled)
    CPU CP15 Control Register = 0xc5387f
    CPU CP15 Auxiliary Control Register = 0x42
    +OALTimerInit(1, 24000, 200)
    --- High Performance Frequecy is 24 MHz---
    DeviceId................. AM335X-
    pArgs->flags............. 0x29
    pArgs->devLoc.IfcType.... 0
    pArgs->devLoc.LogicalLoc. 0x4A100000
    pArgs->devLoc.PhysicalLoc 0x0
    pArgs->devLoc.Pin........ 0
    pArgs->ip4address........ 1
    pDevice->Name............  s
    pDevice->ifcType......... 0
    pDevice->id.............. 0x4A100000
    pDevice->resource........ 0
    pDevice->type............ 2
    pDevice->pDriver......... 0x8261F000
    g_kitlLock = 0x8265BD90
    +OEMKitlInit(0x8265cf00)
    +Cpsw3gInit(0x4A100000, 0x00000001, 0x8261f528) v0.3
    link up on port 1, speed 100, full duplex
    KITL: *** Device Name AM335X-2873 ***
    WARN: KITL can't obtain IRQ for KITL device
    WARN: KITL will run in polling mode
    VBridge:: built on [Mar 12 2014] time [09:36:12]
    VBridgeInit()...TX = [16384] bytes -- Rx = [16384] bytes
    Tx buffer [0x82653D60] to [0x82657D60].
    Rx buffer [0x82657D80] to [0x8265BD80].
    VBridge:: NK add MAC: [1C-BA-8C-A5-B-39]
    -OEMKitlInit(rc = 1)
    Connecting to Desktop
    KITL: Connected host  IP: 192.168.1.16  Port: 57703
    KITL connected with Desktop
    OEMKitlEnableClocks: 1

    The entry is shown in remote registery editor........ but the retailmsg is not showing in the console

    it is a stream driver and it should be loaded by Device manager after loading the device manager by kernel ..... 

    Thursday, March 13, 2014 12:43 PM
  • First, you should probably be more, way more, interested in the Data Aborts and Prefetch Aborts.

    Second, take a look at http://geekswithblogs.net/BruceEitman/archive/2008/08/08/platform-builder-my-stream-interface-driver-does-not-load.aspx


    Bruce Eitman (eMVP) Senior Engineer Bruce.Eitman AT Eurotech DOT com My BLOG http://geekswithblogs.net/bruceeitman Eurotech Inc. www.Eurotech.com

    Thursday, March 13, 2014 1:01 PM
    Moderator
  • hello Sir(Bruce Eitman),

     For device driver development, I am taking reference from http://geekswithblogs.net/BruceEitman/archive/2008/06/09/windows-ce-a-stream-interface-shell.aspx

    I had made changes in .bib, .reg, .def accordingly as mentioned in link....

    And i have also seen the link what you have given to me.. all things are right what is mentioned in 1,2,3 and 4th steps..

    I am going to share my code and mentioned below:- 

    My driver directory name is as- 

    Test1

    And Test1.def entries are as- 

    LIBRARY Test1 EXPORTS TST_Init TST_Deinit

    TST_Open
    TST_Close
    TST_Read

    Test1.cpp as -

    // Test1.cpp : Defines the entry point for the DLL application. // #include "stdafx.h" BOOL APIENTRY DllMain( HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved ) { return TRUE; } DWORD TST_Init( LPCTSTR regPath, DWORD dwBusContext ) { HKEY hkey; DWORD result; RETAILMSG(TRUE,(TEXT("TST_Init(): START\r\n"))); DEBUGMSG(TRUE,(TEXT("TST_Init(): START\r\n"))); /*hkey = OpenDeviceKey((LPCTSTR)regPath); if(!hkey) { RETAILMSG(TRUE,(TEXT("TEST_Init(): Failed to open registery\r\n"))); } else { result = RegQueryValueEx(hkey,) }*/ RETAILMSG(TRUE,(TEXT("TST_Init(): END\r\n"))); DEBUGMSG(TRUE,(TEXT("TST_Init(): END\r\n"))); return TRUE; } BOOL TST_Deinit( DWORD hDeviceContext ) { RETAILMSG(TRUE,(TEXT("TST_Deinit(): START\r\n"))); DEBUGMSG(TRUE,(TEXT("TST_Deinit(): START\r\n"))); RETAILMSG(TRUE,(TEXT("TST_Deinit(): END\r\n"))); DEBUGMSG(TRUE,(TEXT("TST_Deinit(): START\r\n"))); return TRUE; }

    DWORD TST_Open(
      DWORD hDeviceContext,
      DWORD AccessCode,
      DWORD ShareMode 
    )
    {

     return hDeviceContext;

    }

    BOOL XXX_Close(
      DWORD hOpenContext 
    )
    {
    return TRUE;

    }
    DWORD XXX_Read(DWORD hOpenContext, LPVOID pBuffer, DWORD Count)
    {
        return 0;
    }


    platform.bib entries as -

    MODULES
    ;Name                   Path                                      Memory Type
    ;--------------------   ----------------------------------------  -----------
    Test1.dll						$(_FLATRELEASEDIR)\Test1.dll					NK
    
    ; CEDDK and k.ceddl are included by common.bib already, so we check which version
    ; to include
    #if (defined IMGNODFLTDDK)
    ceddk.dll               $(_FLATRELEASEDIR)\ceddk.dll              NK SHMQ
    #endif ; IMGNODFLTDDK
    ; CNC what is the dependent driver on this?
    i2cproxy.dll            $(_FLATRELEASEDIR)\i2cproxy.dll           NK SHK


    and platform.reg entries are as -

    [HKEY_LOCAL_MACHINE\Drivers\BuiltIn\Test1]
    	"Dll"="Test1.dll"
    	"Order"=dword:4
    	"Prefix"="TST"

    building steps what i have done are as -

    Project properties-> Configuration properties-> Build Options-> Enbale KITL = YES, Enable Profiling = YES

    Build Type- Release

    Download the image with KITL method and my driver entry is visible in registery editor remote tool

    Acc. to me all things are fine but may be mising some where that's why problem is not solved?????



    Friday, March 14, 2014 3:14 AM
  • Hello Friends,

    This is the basic problem what I am facing now. You guys are professional and should help me to move forward... If the problem will be solved then others who are going to start device driver or will start device driver, will also get benefit of this topic.....

    Thanks & Regards

    Vijay Partap Singh Salathia

    Friday, March 14, 2014 8:53 AM
  • keep in mind that we would like to help but all on a voluntary base!

    Checkout the stream interface device driver wizard at:

    https://cedriverwiz.codeplex.com/

    This will generate a stream interface driver skeleton for you.


    -- Good luck, Erwin Zwart--- Check out my blog: http://GuruCE.com/blog https://twitter.com/GuruCE_Embedded GuruCE Microsoft Embedded Partner http://GuruCE.com Consultancy, training and development services.

    Friday, March 14, 2014 12:15 PM
  • Dear Partap,

    Please modify the entry of .bib file as

    Test1.dll						$(_FLATRELEASEDIR)\Test1.dll			NK  SHK

    With your previous entry, the driver should be loaded programatically, but with this entry it will be loaded by Kernel on startup...

    Friday, March 14, 2014 12:27 PM
  • Good that you are asking question using one user name (Pratap) and replying using the other (Salathia)

    ...



    Senior Design Engineer T.E.S Electroni Solutions (Bangalore-India) www.tes-dst.com email-misbah.khan@tes-dst.com

    Monday, March 17, 2014 5:00 AM
  • Mr. Misbah Khan,

    Who has wasted time GOD knows better then, about this. The main motive for me to open two accounts that if some one unable to give answer and by chance I got the solution so I can give the answer by using another account so that in future other can solve his/her problem if he.she facing the same kind of problem. We are not here to waste time. we are here to solve the problem..

    Tuesday, March 18, 2014 3:06 AM
  • It is good if you are solving problems for others.

    If you use one of your account and ask a question and every community members give their valuable time to answer yours.

    Then suddenly one fine day with your other account, and you reply this :

    Dear Partap,

    Please modify the entry of .bib file as

    Test1.dll						$(_FLATRELEASEDIR)\Test1.dll			NK  SHK

    With your previous entry, the driver should be loaded programatically, but with this entry it will be loaded by Kernel on startup...

    Tell me how this will help others. 


    Senior Design Engineer T.E.S Electroni Solutions (Bangalore-India) www.tes-dst.com email-misbah.khan@tes-dst.com

    Tuesday, March 18, 2014 4:58 AM
  • Yes, Mr. Misbah, I fully agree with your words. SO, i have decided that I will use 

    http://social.msdn.microsoft.com/profile/salathia/

    account for my queries and if I am able to solve then I will  reply from the 

    http://social.msdn.microsoft.com/Profile/partap 

    account... Right now I am at start level and also i have to increse my points......I will also try to participate on others queries so that i can learn more.... and

    I should be thankful to you for your valuable suggestion......

    Tuesday, March 18, 2014 5:04 AM
  • It is up to you, how many accounts you create.

    Just avoid confusion for the shake of gaining points or something.

    Not a wise strategy you know.

     


    Senior Design Engineer T.E.S Electroni Solutions (Bangalore-India) www.tes-dst.com email-misbah.khan@tes-dst.com

    Tuesday, March 18, 2014 5:15 AM
  • Mr. Misbah, my intense was not to hurt your ego. and by mistake it was then i am really very very sorry for this. So, please be happy.. :) 
    Tuesday, March 18, 2014 5:40 AM
  • Please remove such kind of personal writings from here and post only technical things related to WEC/WinCE. 


    Senior Design Engineer T.E.S Electroni Solutions (Bangalore-India) www.tes-dst.com email-misbah.khan@tes-dst.com

    Tuesday, March 18, 2014 8:34 AM
  • I fully agree with Misbah.  Further, you are the only person that I am aware of that uses two accounts to earn more points.

    I, for one, will avoid assisting you while you continue this practice.


    Bruce Eitman (eMVP) Senior Engineer Bruce.Eitman AT Eurotech DOT com My BLOG http://geekswithblogs.net/bruceeitman Eurotech Inc. www.Eurotech.com

    Tuesday, March 18, 2014 12:17 PM
    Moderator
  • Okay friends,

    I do not have any problem to follow your advice because when some one give good advice we should follow them.. But the thing is that it was just a silly mistake that I did not add SHK... No, problem in future I will use only one account that is Partap.... Thanks for good advice....

    Wednesday, March 19, 2014 2:46 AM
  • Try my Driver Wizard:

    https://CEDriverWiz.codeplex.com

    It generates a custom driver (lost of options) as well as apps to test its loading etc.

    All full of RETAILMSGs that work.

    Cheers


    DJaus Snr SW Dev (Embedded Systems and .NET)

    Wednesday, March 19, 2014 7:38 AM