Automatic installation of wireless network card in Windows CE environment

Publisher:创意火花Latest update time:2013-04-12 Source: 21ICKeywords:WindowsCE Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

  Windows CE is a compact, efficient, and scalable operating system designed for a variety of embedded systems and products., and specially designed a multi-threaded, multi-tasking and fully prioritized operating system environment for limited hardware resources.It has great application prospects in the field of wireless communications.

  This article focuses on the installation of wireless network cards in Windows CE environment, and proposes a solution to automatically install wireless network cards when the system is powered off and restarted; it also introduces the system customization, application development and system packaging of Windows CE. Since Windows CE and Windows are of the same origin and similar, it is easy to learn Windows CE, which shortens the development cycle of the application.

  1 Introduction to Windows CE

  Windows CE includes four basic modules, which provide the key features of the operating system: Kernel module, Object Store module, GWES (graphical user interface between users, applications and operating system) module and Communication module. Figure 1 shows the modular structure of Windows CE.

  The operating system customization tools include Windows CE Platform Builder (PB for short), and the application development tools include the embedded development toolkit Embedded Visual Tools, including Embedded Visual C++ (EVC for short) and Embedded Visual Basic (EVB for short).

  2 Development of Windows CE operating system for specific hardware platforms

  Automatic installation of wireless network card in Windows CE environment (Figure 1)

  After having a specific embedded hardware platform, you can develop a Windows CE system that meets specific functional needs. In short, it can be divided into three steps: customization of the operating system, development of specific functional application modules, and packaging of functional modules into

  operating system.

  2.1 Initial customization of the operating system

  Figure 2 shows the general process of customizing the Windows CE operating system in PB [3].

  First, select the basic configuration of the operating system, and select the corresponding microprocessor and platform support package BPS (Board Support Packet) for the specific platform. The BSP provided by PB is CEPC (WinCE hardware development platform based on PC). Developers can choose one or customize the BPS for a specific platform. Secondly, formulate the platform. At this stage, you can develop device drivers, appropriately cut and add components, and modify some configuration files if necessary. Then, encapsulate the required functional modules and compile to generate the OS image file. If the device is a customized target device, you need to develop OAL (OEM Adaptation Layer), BPS and BootLoader. Then, download the image file to the target device for debugging; if necessary, repeat configuration, encapsulation, download and debugging, if necessary, repeat configuration, encapsulation, download and debugging until the requirements are met and the platform is created.

  Finally, the corresponding SDK (Software Development Kit) is exported and added to the EVC after running, so that application development can be carried out on a specific hardware platform. The SDK contains program libraries, header files, sample program source code and library function usage documents, as well as programming guidance and API participation and device driver kit (DDK).

  2.2 Development of application modules for specific functions

  Developing application modules with specific functions means writing applications in EVC to meet the needs of system function expansion. The key tasks are as follows:

  (1) Select the corresponding microprocessor for the specific platform, such as WCE THUMB or WCE x86em.

  (2) Write applications. The methods of EVC and VC running on PCs are not much different. The main differences between the two are: the API of the former is a subset of the API of the latter, and some modifications or alternative functions need to be found for incompatible functions; the former is a Unicode environment, all characters are two bytes, while the latter is the ANSI American standard, each character is one byte, so data type conversion must be performed between the two when necessary; there are also some differences in user interface programming and memory management.

  (3) Compile and debug the program. When compiling, be sure to select a specific hardware platform. When debugging, you can use the Microsoft Activesync tool provided by the micro software package to establish a connection between the PC and the target machine, download the system image from the PC to the target machine for debugging; in addition, EVC has a simulator that can simulate most of the functions on the target platform on the PC.

  2.3 Functional modules are encapsulated into the system

  OEM developers usually package necessary applications and operating systems together and release them to users, so it is necessary to package the applications into the initially developed operating system. There are two main tasks to be done:

  (1) Copy the compiled executable file to the corresponding folder of the Windows CE system.

  (2) Modify the corresponding system configuration files in PB. The configuration files provided by PB include four file types: .bib, which describes the Windows CE files that need to be packaged into the image file; .dat, which describes the file system, directory, and file allocation table; .db, which describes the Windows CE object storage database; and .reg, which is the system registry. The most commonly used configuration files in the development process are: Platform.bib, Platform.reg, Platform.dat, and Config.bib. Platform.bib defines the files and modules required for packaging into the OS image file; Platform.reg defines the registry key values ​​loaded when the target platform is cold started; Platform.dat defines the system files, directories, and links loaded when the target platform is cold started; Config.bib defines the available physical addresses and performs some property settings.

  After completing the above two steps, recompile, download, and debug the operating system to finally obtain a fully functional system image.

  3 Development Example - Automatic Installation of Wireless Network Card in Windows CE Environment

  3.1 Project Introduction

  Automatic installation of wireless network card in Windows CE environment (Figure 2)[page]

  The project requires the implementation of an independent embedded wireless communication module to access the wireless LAN through the existing IEEE80211b wireless network card.The system is developed using Samsung's S3C2410 chip.Embedded system hardware platform needs to drive PCMCIA wireless network card in Windows CE environment.

  3.2 Problems and solutions for wireless network card installation

  Windows The CE operating system supports two types of device drivers: built-in device drivers and installable device drivers.

When the target machine is linked to a PC and has a display and a link disk, the installation steps for the installable device driver are as follows: establish a connection between the target machine and the PC, copy the .dll file of the device driver to the Windows directory of Windows CE; when the system detects the device, a corresponding dialog box will appear on the display, and you can enter the driver name using the keyboard.

  The project needs to install the driver for the existing wireless network card. Because the Windows CE system is based on RAM storage when running, and ROM is equivalent to a read-only hard disk, once the system is powered off or cold-started, the information in the RAM will be lost, especially some registry information, so the RAM must be continuously powered. However, since the hardware power supply of this system cannot guarantee continuous power supply, after the wireless network card driver is installed, the information is stored in the RAM. After the system is powered off or cold-started, the relevant information will be lost. Moreover, the target machine has no display screen and keyboard in actual use. Therefore, the wireless network card driver needs to be automatically reinstalled when the power is off and restarted.

  The solution is to read the network card driver xi825.dll and TCP/IP attribute configuration file config.txt from the system persistent storage SM card, and then install the driver for the wireless network card according to the configuration file device registry key value. If you need to update the TCP/IP attribute value according to the specific application environment, you can overwrite the old file in the SM card with the new configuration file, re-set the device attribute value after cold restart, and then install the network card driver.

  Use EVC to write an application to automatically install the wireless network card driver. Figure 3 shows the general flow of the application.

  First, copy the two files from the storage card folder of the SM card to the Windows directory of the Windows CE system; after the copy is successful, operate the registry according to the content of config.txt to set the TCP/IP property values ​​under the specific environment; after the system detects the wireless network card, the program automatically enters the network card driver name in the pop-up dialog box named "Unidentified PCCard Adapter" to complete the automatic installation of the wireless network card.

  3.3 Solutions to Several Specific Problems

  Next, we will discuss the solutions to several specific problems in this solution, including the operation of the registry, the realization of the automatic installation function, the overall control of the program flow, and the method of packaging the program into the operating system.

  3.3.1 Operations on the registry

  Windows CE has a series of API functions that can operate the registry, such as opening and closing the registry, reading or modifying key values, etc. In addition, the value type in the Windows CE registry is Unicode; while the configuration file config.txt is generated on the PC and is of the ANSI type. To set the registry value according to the value read from cogfing.txt, it is necessary to convert the data type, which can be achieved using the function MultiByteToWideChar() [4]. The key code is as follows:

  Automatic installation of wireless network card in Windows CE environment (Figure 3)  RegOpenKeyEx(HKEY_LOCAL_MACHINE, //root key TEXT("Commxi8251ParmsTcpIP"),
  //open subkey 0 under the root key
  , //reserved value, must be set to 0
  0, //this item is not supported, must be set to 0
  &hKey //the handle pointer of the final opened key
  );

  RegSetValueEx(hKey, //Handle for key operation

  TEXT("IpAddress"), //Name of the data item in the key
  0, //Reserved value, must be set to 0
  REG_GZ, //Type of the value in the data item
  (CONST BYE*)((LPCTSTR)regData), //Buffer for storing the data item value
  dwDataSize //Number of bytes of the value
  ); //Modify the value of the "IpAddress" data item, that is, change the IP value

  3.3.2 Implementation of automatic installation function

  Use the FindWindows() function to determine the appearance of the dialog window; use the keybd_event() function to simulate keyboard input. The key code is as follows:

  TCHAR g_szTitle[80]=TEXT("Unidentified PCCard Adapter"); //Specify the title of the dialog box
  HWND hWnd=..FindWindows(NULL,g_szTitle); //Judge whether the window with this title name has appeared, regardless of whether it is the foreground window
  if (hWnd! =NULL) //If the window has appeared
  {..SetForegroundWindows(hWnd); //Set this window as the foreground window
  keybd_event(0x58,0,0,0); //Press the x key
  keybd_event(0x58,0,KEYEVENTE_KEYUP,0); //Lift the x key
  //After completing the two actions of pressing and lifting the x key, the keyboard input character x is simulated.
  ............//Use the same method to input \'i825.dll\'
  keybd_event(0x0d,0,0,0);
  keybd_event(0x0d,0,KEYEVENTF_KEYUP,0); //Finally enter the confirmation key
  }

  After entering correctly, you can see the display light of the wireless network card start to flash, indicating that the network card has been installed successfully and is ready for wireless communication.

  3.3.3 Overall control of program flow

  In order to ensure the order of the program flow, an administrator who monitors and controls the entire program is also required. This monitoring function can be achieved by sending and receiving specific messages to the main control function, waiting for specific event objects, or using timer query methods. In view of the simplicity of the method and the small occupation of system resources, the timer query method is selected here, and the flag is set to distinguish different stages of work and perform corresponding operations. The key codes of the department are listed below:

  flag=0; //The initial flag is set to 0, that is, copy the required files first

  m_nTimer=SetTimer(1,2000,NULL); //Start the timer

  KillTimer(m_nTimer); //When the time is up, turn off the timer first, and make corresponding judgments and operations.

  3.3.4 Application packaging into the system

  The above article has described the general method of packaging an application into an operating system, which is divided into two steps: copying the application and modifying the system configuration file. In this project, the application monitor.exe is packaged and packaged into the operating system. Here we focus on the specific modifications of several configuration files in the system.

  (1) Add the following code to the Files section of the Platform.bib file

Automatic installation of wireless network card in Windows CE environment (Figure 4) 

 Among them, monitor.lnk is the link program (shortcut) of monitor.exe. The production method is very simple and can be written through an ASCII code editor. The format is: #20.exe.

  The code in this configuration file indicates that monitor.exe and monitor.lnk are loaded into a memory area named NK (NK is defined in the memory section of the config.bib file), and the file attribute is U (uncompressed file). This completes the "declaration" of encapsulating the application developed by the user and its linker into the operating system.

  (2) Add the following code to the Platform.dat file:

  Directory ("):-File("monitor.lnk",".lnk")

  Since Platform.bib has declared that these two files will be mapped to the directory after the operating system is started, this is the default directory. Therefore, the additional code indicates that monitor.exe will be automatically run when Windows CE is started.

  After completing the above work, compile the operating system and encapsulate the application into the Windows CE operating system. After the system starts, the application will run to complete the function of automatically installing the wireless network card.

Keywords:WindowsCE Reference address:Automatic installation of wireless network card in Windows CE environment

Previous article:Network communication design based on uCLinux and ARM7
Next article:Application example of touch screen on S3C2410

Recommended ReadingLatest update time:2024-11-16 14:38

How to use the timer of s3c2410
2410 has 5 timers in total, timer4 has no pin output, and the rest can be used as PWM. 0 and 1 share a prescaler 2, 3, 4 share a prescaler TCFG0 correspond to these two pre-dividers respectively. Don’t forget to add +1 to the division value, because the division value cannot be 0. TCFG1 corresponds to the fr
[Microcontroller]
Design of embedded video acquisition system based on S3C2410 (Part 1)
introduction   The embedded monitoring system composed of image acquisition and storage functions is an indispensable and important part of the security technology system. With the development of microelectronics technology and software technology, embedded technology has also made great progress. Therefore, the ima
[Analog Electronics]
Design of embedded video acquisition system based on S3C2410 (Part 1)
S3C2410 Extended SDRAM
Since S3C2410 is a 32-bit processor (an instruction can operate 32 bits of data at a time (the arithmetic unit can process 32 bits of data at a time); most general registers are 32-bit registers; the internal data channel of the processor is also 32 bits; the external data bus width of the processor is usually 32 bits,
[Microcontroller]
Research on embedded video monitoring system based on S3C2410
1 System Hardware Structure This system adopts modular structural design concept, and divides the equipment into main control module and various functional modules. There is a unified or specific interface form between the main control module and each functional module. Users can choose different functi
[Security Electronics]
Research on embedded video monitoring system based on S3C2410
About the problem of s3c2410 booting from NAND Flash --bootrom 4KB limit
I use S3C2410. See the attached start.s. I have been puzzled by the part about NAND flash startup. It is said that when booting from NAND FLASH, the first 4KB should be mapped to NGCS0, and the code in it copies the program stored in NAND to RAM. However, the program provided by the file seems to copy 128K code from NA
[Microcontroller]
About the problem of s3c2410 booting from NAND Flash --bootrom 4KB limit
u-boot startup process——Based on S3C2410
This article takes the popular Samsung S3C2410, openmoko platform and u-boot-1.3.2 (released in May 2008) as examples to introduce how to explore the u-boot startup process in the ZIX embedded development environment. Although u-boot has been widely used, due to its relative complexity, users are still reluctant to un
[Microcontroller]
Top 10 steps to port ucgui to s3c2410
1. Write drivers, mainly for LCD drivers and touch screen drivers: The LCD driver implements the dot drawing function LCD2410_SetPixel(x,y,c). For the LCD on the DM2410 experimental board, the upper left is the origin (0,0). The touch screen driver calculates the coordinates of the touch screen (x,y). For the touch sc
[Microcontroller]
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号