1 / 24

NesC Programming Language

NesC Programming Language. Himali Saxena. Topics. Configurations and Wiring Configuration implementation Basic Rules for declaration/definition Auto Wiring initialization ‘C’ and ‘P’ implementation The ‘as’ keyword and other namespace tricks Pass Through Wiring Combine Functions

shania
Download Presentation

NesC Programming Language

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. NesC Programming Language Himali Saxena

  2. Topics • Configurations and Wiring • Configuration implementation • Basic Rules for declaration/definition • Auto Wiring initialization • ‘C’ and ‘P’ implementation • The ‘as’ keyword and other namespace tricks • Pass Through Wiring • Combine Functions • Parameterized Wiring

  3. Configurations and Wiring • Configuration : A Component whose implementation is component wiring • Compose module into larger abstractions • Wiring : Connecting two components such that one module to be able to call another

  4. Configuration Implementation • implementation { component-list , connection-list} • The component–list lists the components thar are used to build this configuration • The connection-list specifies how these components are wired to each other and to the configuration’s specification

  5. An Example

  6. Basic Rules for Declaring • Use component keyword to tell the names of the component it is wiring • Any number of components names can follow components, order doesn’t matter • Can have multiple component statements • Three operators : -- >, < -- and = • Direct wiring ( -- > or < --) always goes to a user to a provider. • = operator exports interfaces

  7. Example

  8. Contd…

  9. An Example (= operator)

  10. Auto Wiring Initialization

  11. C and P Implementation • C implementation : Externally usable abstraction • P implementation : an internal implementation

  12. The ‘as’ Keyword and other namespace tricks • The as keyword allows to rename an interface in a signature • The as keyword can also be used within configurations

  13. Pass Through Wiring • Pass through wiring is when a configuration wires two interfaces in its signature together. It must wire a uses to a provides, and it does so with = operator.

  14. Multiple Wiring, Fan-in, and Fan-out

  15. Combine Function • NesC provides mechanism of combine functions to specify return value • A fan-ot always involves calling N functions with identical signatures, the caller’s return value is the result of applying the combine function to the return values of all of the callees • When NesC compiles application, it autogenerates a fan-out function which applies the combine function

  16. An Example

  17. Parameterized Wiring

  18. Contd…

  19. Another way of defining parameter

  20. Defaults • A default handler is an implementation of a function that’s used if no implementation is wired in. If a component wires to the interface, then the implementation is used. Otherwise, the (or signal) goes to the default handler.

  21. References • http://www.tinyos.net/tinyos-2.x/doc/pdf/tinyos-programming.pdf • David Gay , Philip Levis , Robert von Behren , Matt Welsh , Eric Brewer , David Culler, The nesC language: A holistic approach to networked embedded systems, Proceedings of the ACM SIGPLAN 2003 conference on Programming language design and implementation, June 09-11, 2003, San Diego, California, USA • David Gay, Philip Levis, David Culler, Eric Brewer, “nesC 1.1 Language Reference Manual” May 2003

More Related