From: sdhsdh Date: Tue, 23 Feb 2010 06:45:38 +0000 (+0000) Subject: sneak in eui-64 driver for epic. this is a tiny amount of code :) X-Git-Tag: rc_6_tinyos_2_1_1~4 X-Git-Url: https://oss.titaniummirror.com/gitweb/?p=tinyos-2.x.git;a=commitdiff_plain;h=b1b9366c5a59ead38e3c1a0e765a7eb93120df59 sneak in eui-64 driver for epic. this is a tiny amount of code :) --- diff --git a/tos/platforms/epic/.platform b/tos/platforms/epic/.platform index ff94acc0..49ae2055 100644 --- a/tos/platforms/epic/.platform +++ b/tos/platforms/epic/.platform @@ -11,6 +11,7 @@ push( @includes, qw( %T/platforms/epic %T/platforms/epic/chips/at45db + %T/platforms/epic/chips/ds2411 %T/platforms/telosa %T/platforms/telosa/chips/cc2420 %T/chips/cc2420 @@ -35,6 +36,7 @@ push( @includes, qw( %T/chips/msp430/usart %T/chips/msp430/sensors %T/chips/at45db + %T/chips/ds2401 %T/lib/timer %T/lib/serial %T/lib/adc diff --git a/tos/platforms/epic/MotePlatformC.nc b/tos/platforms/epic/MotePlatformC.nc index 5636b321..43ea3fbe 100644 --- a/tos/platforms/epic/MotePlatformC.nc +++ b/tos/platforms/epic/MotePlatformC.nc @@ -1,5 +1,6 @@ module MotePlatformC @safe() { provides interface Init; + uses interface Init as SubInit; } implementation { @@ -40,6 +41,8 @@ implementation { // directions using the TOSH_SET/CLR macros }//atomic - return SUCCESS; + return call SubInit.init(); } + + default command error_t SubInit.init() { return SUCCESS; } } diff --git a/tos/platforms/epic/chips/ds2411/CachedIeeeEui64C.nc b/tos/platforms/epic/chips/ds2411/CachedIeeeEui64C.nc new file mode 100644 index 00000000..0a61b1e8 --- /dev/null +++ b/tos/platforms/epic/chips/ds2411/CachedIeeeEui64C.nc @@ -0,0 +1,40 @@ +// $Id$ +/* + * Copyright (c) 2007, Vanderbilt University + * All rights reserved. + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose, without fee, and without written agreement is + * hereby granted, provided that the above copyright notice, the following + * two paragraphs and the author appear in all copies of this software. + * + * IN NO EVENT SHALL THE VANDERBILT UNIVERSITY BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT + * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE VANDERBILT + * UNIVERSITY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * THE VANDERBILT UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE VANDERBILT UNIVERSITY HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + * + * Author: Janos Sallai + */ + +/** + * Cache an EUI 64 at initialization time and return the cached value for + * subsequent queries. + */ +configuration CachedIeeeEui64C { + uses interface LocalIeeeEui64 as SubIeeeEui64; + provides interface LocalIeeeEui64; +} implementation { + components CachedIeeeEui64P, MotePlatformC; + + MotePlatformC.SubInit -> CachedIeeeEui64P.Init; + + SubIeeeEui64 = CachedIeeeEui64P; + LocalIeeeEui64 = CachedIeeeEui64P; + +} diff --git a/tos/platforms/epic/chips/ds2411/LocalIeeeEui64C.nc b/tos/platforms/epic/chips/ds2411/LocalIeeeEui64C.nc new file mode 100644 index 00000000..cfee46fd --- /dev/null +++ b/tos/platforms/epic/chips/ds2411/LocalIeeeEui64C.nc @@ -0,0 +1,45 @@ +// $Id$ +/* + * Copyright (c) 2007, Vanderbilt University + * All rights reserved. + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose, without fee, and without written agreement is + * hereby granted, provided that the above copyright notice, the following + * two paragraphs and the author appear in all copies of this software. + * + * IN NO EVENT SHALL THE VANDERBILT UNIVERSITY BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT + * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE VANDERBILT + * UNIVERSITY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * THE VANDERBILT UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE VANDERBILT UNIVERSITY HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + * + * Author: Janos Sallai + * Epic port by Stephen Dawson-Haggerty + */ + +configuration LocalIeeeEui64C { + provides interface LocalIeeeEui64; +} implementation { + components + OneWireMasterC as OneWireC, + HplDs2401C, + BusyWaitMicroC, + HplMsp430GeneralIOC, new Msp430GpioC(), + Ds2401ToIeeeEui64C, + CachedIeeeEui64C; + + Msp430GpioC.HplGeneralIO -> HplMsp430GeneralIOC.Port24; + OneWireC.Pin -> Msp430GpioC; + + OneWireC.BusyWaitMicro -> BusyWaitMicroC.BusyWait; + HplDs2401C.OneWire -> OneWireC; + Ds2401ToIeeeEui64C.Hpl -> HplDs2401C; + CachedIeeeEui64C.SubIeeeEui64 -> Ds2401ToIeeeEui64C; + LocalIeeeEui64 = CachedIeeeEui64C; +} diff --git a/tos/platforms/epic/chips/ds2411/PlatformIeeeEui64.h b/tos/platforms/epic/chips/ds2411/PlatformIeeeEui64.h new file mode 100644 index 00000000..54f98496 --- /dev/null +++ b/tos/platforms/epic/chips/ds2411/PlatformIeeeEui64.h @@ -0,0 +1,37 @@ +// $Id$ +/* + * Copyright (c) 2007, Vanderbilt University + * All rights reserved. + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose, without fee, and without written agreement is + * hereby granted, provided that the above copyright notice, the following + * two paragraphs and the author appear in all copies of this software. + * + * IN NO EVENT SHALL THE VANDERBILT UNIVERSITY BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT + * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE VANDERBILT + * UNIVERSITY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * THE VANDERBILT UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE VANDERBILT UNIVERSITY HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + * + * Author: Janos Sallai + * changes for Epic + */ + +#ifndef PLATFORMIEEEEUI64_H +#define PLATFORMIEEEEUI64_H + +enum { + IEEE_EUI64_COMPANY_ID_0 = 'U', + IEEE_EUI64_COMPANY_ID_1 = 'C', + IEEE_EUI64_COMPANY_ID_2 = 'B', + IEEE_EUI64_SERIAL_ID_0 = 'E', + IEEE_EUI64_SERIAL_ID_1 = 'P', +}; + +#endif // PLATFORMIEEEEUI64_H