260 likes | 405 Views
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
E N D
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 • Parameterized Wiring
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
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
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
C and P Implementation • C implementation : Externally usable abstraction • P implementation : an internal implementation
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
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.
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
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.
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