B2, wince6.0 kernel Startup Process ---- oal Interpretation

Source: Internet
Author: User
[Port oal] kernel Startup Process of wince6.0:

OAL cannot call the kernel's kernelstart () function, so you need to implement a kernelstart () (nkldr. lib completes this for us and sets nkldr. lib link to oal), call nkldr. kernelstart () in Lib (). then the arminit () function executed has a very important task. It assigns the oeminitglobals () function pointer in oal to kdata, which is required by the kernel later. next, locate and jump to the kernel Kernel Based on kdata. DLL entry point nkstartup ().

Kernel. when the DLL starts to execute nkstartup (), it must first bridge with OAL. that is, the nkglobal Data Structure pointer of the kernel is handed over to oal, And the oemglobal Data Structure pointer of oal is obtained. how to implement it? The kernel finds a function oeminitglobals () in oal Based on kdata, assigns the oeminitglobals function pointer to kdata, and then uses the nkglobal pointer as a parameter to execute this function, this function returns the oemglobal pointer of OAL. (oal must implement oeminitglobals (),
Oemmain. Lib completes this for us and links oemmain. lib to oal ).

This kdata is the kernel data structure, which is easy to understand as shared memory, and can be accessed by both oal and kernel. I have nothing to say in the future. The kernel can access oal and call OEM functions happily. finally, kernelstart () is called. This function is in the kernel, and wince6.0 is up ......

[Compile oal]

Start compiling oal of wince6.0. Step 1: Compile OAL. Lib. Step 2: Compile oal.exe.

Invalid. NK. lib doesn't mean you don't need it. compile OAL. NK is widely used in Lib. lib. you don't want to change the call form of functions and variables in the full text? OK, link nkstub. Lib. In this way,
In the sources file under the oalexe directory, these four libraries are added.

Targetlibs = OAL. Lib oemmain. Lib nkldr. Lib nkstub. Lib ...... (Path omitted)

What is nkldr. lib and oemmain. Lib? Nkldr. Lib provides the implementation of kernelstart (), and oemmain. Lib provides the implementation of oeminitglobals (). Of course there are more, not listed.

[Custom oal]

What should I do without OAL. Lib? Do it ...... As mentioned above, the separation of oal and kernel makes the interface more obvious. What functions does the kernel need from OEMs? refer to oemglobal. complete the oemglobal struct in the H file. and in oemglobal. c. initialize the struct. this file is located in oemmain. lib. the following sections describe the most important interfaces based on my 2440:

[Init interface]

To provide oeminit (), oeminitdebugserial (),

Oeminit () function, create an init. C, and then implement this function.

Put oeminitdebugserial () in debug. C.

[Debug related interfaces]

Oemwritedebugstring

Oeminitdebugserial

Oemwritedebugbyte

Oemreaddebugbyte

Oemwritedebugled

PqoalOal_other.libProvides oemwritedebugstring ()

Create Debug. c Under oallib and implement the four functions: oeminitdebugserial, oemwritedebugbyte, oemreaddebugbyte, and oemwritedebugled.

[Cache related interfaces]

You need to provide oemcacherangeflush. Find the existing pqoal based on your architecture.Oal_cache_arm920t.lib

[Time related interfaces]

Required

Initclock

Oemgetrealtime

Oemsetrealtime

Oemsetalarmtime

Oemqueryperfcounter

Oemqueryperffreq

Oemgettickcount

Initclock, which has been abolished and has been moved to oempoweroff. therefore, an empty function can be implemented. When initializing oemglobal, assigning this pointer to the retuanfalse () function has the same effect. oemgetrealtime and oemsetrealtime are used to set the date function for reading RTC. oemsetalarmtime is the time when the RTC alarm is set.Oal_rtc_s3c2440a.lib

Oemqueryperfcounter, and oemqueryperffreq are queries with higher precision,

Oemgettickcount returns the current curmsec value, in milliseconds. the oal_time.lib has been implemented. in particular, this function is SC _gettickcount in wince5.0. you need to change the name. this is a difference between OAL.

[Scheduler interfaces]

Oemidle, oemnotifythreadexit, oemnotifyintroccurs, oemupdatereschedtime, a variable defathreadthreadquantum.

[Power related interfaces]

Oempoweroff. What should I do? This function will be executed when it is suspended.Oal_power_s3c2440a.libBsppoweroff will be called to complete the platform-related actions, and a file power. C will be created to implement this bsppoweroff.

[DRAM related interfaces]

Oemgetextensiondram, oemenumextensiondram, calcfspages, variable mainmemoryendaddress

This set of functions asks about the expansion of Ram. If the oemenumextensiondram function is provided, execute this function. Otherwise, execute oemgetextensiondram and calcfspages to calculate pages. This function is self-implemented by the kernel and is no longer needed, point to an empty function.

[Interrupt related interfaces]

Oeminterruptenable, oeminterruptdisable, oeminterruptdone,

Oeminiterruptmask, oeminterrupthandler

Basic work: pqoal is ready. Several Interfaces under pqoal are used to complete platform related work, including bspintrinit, bspintrrequestirq, bspintrenableirq, bspintrdisableirq, bspintrdoneirq, and bspintractiveirq. the last oeminterrupthandler is the system ISR, which converts the physical IRQ into a logical interrupt sysintr_xxx.

[Other]

Oemiocontrol. this function has been implemented in pqoal. if you want to add a new control command to OEMs, create an IOCTL. c. Define a Global Array g_oalioctltable, and fill in the array with the command words and the name of the function that the corresponding command executes. the execution function of the corresponding command must be implemented by yourself. when the driver or application uses the kerneliocontrol API, the function of the corresponding command is executed.

[Summary]

1. wince6.0 not only separates oal and kernel. kitl is also separated into kitl. DLL. therefore, oal cannot directly use kitl resources. first, set kitl. C and kitl-related code are stored in the kitl directory from OAL. then, you cannot call oalkitlstart () in oeminit.Kitlioctl (ioctl_kitl_startup, null, 0, null, 0, null );This sentence is used as an alternative.

2. The data structure definition that oal needs to use, and the external function declaration are in the header file nkexport. H. You can include this nkexport. h header file in OAL. h.

3. The oal_log library of pqoal has changed. If you use this library, note that it does not use the global variable g_oallogmask.

4. watchdog in the timer and timer_dvs directories. c file and nkexport. pfnoemrefreshwatchdog and dwoemwatchdogperiod are repeatedly defined in H. one solution is to remove watchdog. c. you can also skip this interface. by default, the empty API returnfalse () is passed ()

5. compile smflash. DLL error. FAL is required. lib is compiled into smflash. DLL. the source code of FAL is private \ winceos \ driver \ msflash \ SRC. this FAL. lib. it seems different from the previous one. from the error message, it seems that two more interfaces are provided. in FMD. the following two interfaces are added to CPP:

Lpvoid fmdhook_hookinterface (pfmdinterface pinterface)

{Return (lpvoid) pinterface ;}

Void fmdhook_unhookinterface (lpvoid pcontext, fmdinterface * pinterface ){}

Now, you have added the startup code startup. S. An OAL. lib to OAL.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.