Android Deep explore HAL with driver development

Source: Internet
Author: User

Fifth Chapter

The Development Board is the premise of the embedded development, we use the Samsung company to produce thes3c6410Development Board。 s3c6410The Development Board is a low-power, cost-effective processor that also2.5Gand the3GCommunication services provide optimized hardware performance as well as powerful accelerators. Including motion video processing, audio processing and so on. Next, install the Serial debugging tool:minicom.check whether the current system supportsUSBturn the serial port, installminicom,Configurationminicom,Testminicom.Burn Write after configuration is completeAndroidSystem. Use a serial line orUSBThe serial cable connects the development Board withPCStartminicom.EnterEbootStatus, EraseNandflash. AndroidBurn-Write step requirementsFAT32partition format, insert card reader and connectPC. ToSDCard WriteMmc.binand theZimage-sd.bin.before burning the preparation work, began to start fromSDCard Burning WriteAndroid, calibrate the screen. Configure the Wired network. This chapter describes how took6410-ainstallation on the Development BoardAndroid.

Sixth chapter

The first driver counts the number of words. In addition to introducing a lot of theoretical knowledge of Android porting and Linux Driver Development, this book allows you to enter Another world of Linux.

There is no essential difference between Linux and Linux APIs . Knowledge uses APIs in different ways. The steps of writing a Linux driver first establish the Linux driver skeleton, register and unregister the device files, specify the information related to the driver, specify the callback function, and write the business logic. Write makefile files, compile linux drivers, install and uninstall Linux drivers.

The first driver counts the number of words installedLinuxDrive, ViewWord_countwhether the installation was successful, uninstallLinuxDrive, viewing byLinuxThe log information for the drive output. Document standards, open source agreements,GPLProtocolLGPLAgreement,BSDAgreement,Apache license2.0Agreement,mitagreement. Specifies that the callback functionword_count.cAdd two functions:Word_count_readand theCount_count_write.word_countDirectory JoinLinuxThe kernel source tree step is to create a newKconfigfiles, modifyingMakefilefile, modify the top-level directoryKconfigfile, modify the top-level directoryMakefilefiles, compilingLinuxDrive. Statistic word number driver YesLinuxthe first step in driving development.

Seventh Chapter

   led Flash for me: Control the LEDs to the linux led led drive. Although linux linux i/o memory for interaction, i/o memory is the mapping of the host's hardware to a host's memory through various interfaces.

    write led before you drive. usb Connect the development Board, turn on the switch, Successfully started the compile and install driver of the execution script file. Create led drive device files first use cdev_init cdev Span style= "font-family: the song Body;" > Specifies that the device number is specified directly in the code and is assigned dynamically. Use cdev_add class_create macro create struct class device_create

    Set register and initialize led drive, Control led before you know how to set a register, Span style= "FONT-FAMILY:CALIBRI;" >arm There are many registers, by setting the values of different registers, you can set pin status, open or disable the pull-up circuit and control led led Span style= "FONT-FAMILY:CALIBRI;" >led i/o Span style= "font-family: the song Body;" > Command control.

Test led driver, write a generic program for test I/O control commands, use the ndk test led driver, use java test LED driver. Porting Linux drivers is also important when modifying code, as much as possible without modifying the Linux -driven interface. The first Linux driver to deal with hardware .

Eighth Chapter

A hardware device on the buzzer Development Board. You can control the sound emitted by the buzzer by writing a specific value to the register. Down will introduce the use of buzzer principle, and realize the driver of the buzzer. PWM the use of the drive differs from LED The use of the drive, which consists of multiple files, which is most Linux the standard way to drive implementation.

Compiled PWM driver, with multiple files composed of drivers. Although the two drivers implement different functions, but the two drivers of the source code is the same,thelinux driver module dependency, code reuse is divided into static and dynamic two kinds. Static reuse a piece of code can be compiled to eventually generate an executable file or library. This section describes a way to share code: module dependencies are also known as export symbols. Forcibly uninstall the Linux driver, if you write a linux driver is logically correct, then you can load and unload normally. If an exception occurs in an unexpected environment, it cannot be uninstalled properly. is divided into initialization function crashes, initialization function does not return normally. The Unload function is blocked and successfully returned when the Unload function is called to complete smoothly. Otherwise, there will be a blockage.

The buzzer driver is a simple hardware that comes with the Development Board, and it beeps when it is opened. The basic principle is to open and stop the buzzer by means of a pulse control. PWM can be switched on and off via the I/o command. The test driver writes the I/O command to the program IOCTL.

The PWM driver is similar to the LED driver, and can be simpler. A simpler PWM driver is used to divide the Linux driver into multiple implementation files . Also learned more driver code, the control of the Development Board has a further understanding.

Android Deep explore HAL with driver development

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.