nesc programming language
DESCRIPTION
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 - PowerPoint PPT PresentationTRANSCRIPT
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 WiringConfiguration : A Component whose
implementation is component wiringCompose module into larger abstractions
Wiring : Connecting two components such that one module to be able to call another
Configuration Implementationimplementation { component-list ,
connection-list}The component–list lists the components thar
are used to build this configurationThe connection-list specifies how these
components are wired to each other and to the configuration’s specification
An Example
Basic Rules for DeclaringUse component keyword to tell the names of
the component it is wiring Any number of components names can follow
components, order doesn’t matterCan have multiple component statementsThree operators : -- >, < -- and =Direct wiring ( -- > or < --) always goes to a
user to a provider.= operator exports interfaces
Example
Contd…
An Example (= operator)
Auto Wiring Initialization
C and P ImplementationC implementation : Externally usable
abstractionP implementation : an internal
implementation
The ‘as’ Keyword and other namespace tricksThe as keyword allows to rename an
interface in a signatureThe as keyword can also be used within
configurations
Pass Through WiringPass 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.
Multiple Wiring, Fan-in, and Fan-out
Combine FunctionNesC provides mechanism of combine
functions to specify return valueA 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
An Example
Parameterized Wiring
Contd…
Another way of defining parameter
DefaultsA 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.
Referenceshttp://www.tinyos.net/tinyos-2.x/doc/pdf/
tinyos-programming.pdfDavid 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