[Iot smart gateway-10] Build a stream-driven model on the. net mf Platform

Source: Internet
Author: User

Whether it is a driver development in Linux or a driver development on the Windows CE platform, you must be familiar with the streaming driver model. In this architecture, all hardware devices are regarded as files. The interaction with devices is actually reading and writing files, that is, data flow. This development driver is not only simple and practical, but also allows users to access hardware with consistent interfaces, greatly reducing the learning cost. However. net micro framework platform, but does not provide such a driver development interface, if you want to operate hardware at the application layer, you must do a dedicated interface library (InterOP), if there are n devices, the corresponding driver interface library file must also be N, if an applicationProgramTo communicate with N devices, you must reference n databases. In addition, if the library interface is changed, the upper and lower layersCodeIt must be re-compiled before it can be used.

It is based on some of the advantages of the stream driver and the complexity of InterOP driver interface development, so I have built a streaming driver architecture on the. NET micro framework system. It is particularly worth mentioning that, on the basis of the stream-Driven Architecture, users can use C ++ to develop stream-driven systems in the mdk ide environment (see relatedArticle. Net micro framework dynamically calls C/C ++ underlying code).

The C # interface code of the streaming driver application layer is as follows:

 Public   Sealed   Class  Generalstream {publicgeneralstream ();  Public  Event  Generalstreameventhandlernotice;  Public   Int  Close ();  Public   Int  Iocontrol (intcode );  Public   Int Iocontrol (intcode, Int  Parameter );  Public   Int Iocontrol (intcode, Byte [] Inbuffer, intincount, Byte [] Outbuffer, Int  Outcount );  Public   Int  Open (stringname );  Public   Int Open ( String Name, Int  Config );  Public   Int Open ( String Name,String  Config );  Public   Int Read ( Byte [] Buffer, Int  Offset, intcount );  Public   Int Write ( Byte [] Buffer, Int  Offset, intcount );} 

The above interfaces are actually very similar to the stream interfaces on the wince platform, but they are quite distinctive. They also provide an Event Notification interface, this provides more flexible support for various hardware driver development. With this stream interface, it generally provides proprietary hardware underlying functions for the upper-layer C # language, so you do not need to write interface-related code, directly write the relevant C/C ++ code, and then compile the link.

Currently, we have implemented drivers for 10 devices and functional modules based on the streaming driver interface. The following is a brief introduction and will be detailed in subsequent articles.

Serial number

Name

Description

Remarks

000

Userdriver

User streaming driver development interface

C ++ development under MDK

001

Watchdog

Dog driver

 

002

Ultrasonic

Ultrasonic module driver

Ranging

003

Dht11

Temperature and humidity module driver

 

004

Gpio

Gpio special function driver

For example, you can configure the Vulnerability

005

Counter

High-speed counters

 

006

Adis16227

Adis16227 module driver

Based on special SPI Interfaces

007

Max7219

Max71219 chip driver

Led and lattice Control

008

Pcd8544

Norkia5110 display module driver

 

009

Lcd1602

Lcd1602 module driver

 

When developing drivers for the adis16227, norkia5110, and lcd1602 modules, I deeply felt that it is very important to leave a C ++ driver development interface for users because of this type of driver, upper-layer applications do not have ready-made interfaces. Second, they cannot directly use C #. Therefore, they must be transplanted at the underlying layer. If no ready-made user interfaces are available, they must rely on the vendor, this greatly limits the initiative and flexibility of user development, as well as the control of products and projects.

I will introduce this part in detail in the user stream driver development interface (userdriver) article.

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

Mf Introduction: http://blog.csdn.net/yefanqiu/article/details/5711770

Mf data: http://www.sky-walker.com.cn/News.asp? Id = 25

Related Article

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.