HPLMicC.nc
上传用户:joranyuan
上传日期:2022-06-23
资源大小:3306k
文件大小:2k
源码类别:

网络

开发平台:

Others

  1. // $Id: HPLMicC.nc,v 1.1.1.1 2005/04/22 04:26:45 acwarrie Exp $
  2. /* tab:4
  3.  * "Copyright (c) 2000-2003 The Regents of the University  of California.  
  4.  * All rights reserved.
  5.  *
  6.  * Permission to use, copy, modify, and distribute this software and its
  7.  * documentation for any purpose, without fee, and without written agreement is
  8.  * hereby granted, provided that the above copyright notice, the following
  9.  * two paragraphs and the author appear in all copies of this software.
  10.  * 
  11.  * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
  12.  * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
  13.  * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
  14.  * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  15.  * 
  16.  * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
  17.  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  18.  * AND FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
  19.  * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
  20.  * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS."
  21.  *
  22.  * Copyright (c) 2002-2003 Intel Corporation
  23.  * All rights reserved.
  24.  *
  25.  * This file is distributed under the terms in the attached INTEL-LICENSE     
  26.  * file. If you do not find these files, copies can be found by writing to
  27.  * Intel Research Berkeley, 2150 Shattuck Avenue, Suite 1300, Berkeley, CA, 
  28.  * 94704.  Attention:  Intel License Inquiry.
  29.  */
  30. /*
  31.  *
  32.  * Authors: Alec Woo
  33.  * Date last modified:  4/23/04
  34.  *
  35.  */
  36. module HPLMicC{
  37.   provides interface MicInterrupt;
  38. }
  39. implementation
  40. {
  41.   async command result_t MicInterrupt.enable(){
  42.     sbi(EIMSK, 7);
  43.     return SUCCESS;
  44.   }
  45.   async command result_t MicInterrupt.disable(){
  46.     cbi(EIMSK, 7);
  47.     return SUCCESS;
  48.   }
  49.   default async event result_t MicInterrupt.toneDetected() {
  50.     return SUCCESS;
  51.   }
  52. #ifndef PLATFORM_PC
  53.   // On Mica2, the actual hardware interrupt is INT7
  54.   // a macro mapping to PORTE pin 7.
  55.   TOSH_SIGNAL(SIG_INTERRUPT7){
  56.     call MicInterrupt.disable();
  57.     __nesc_enable_interrupt();
  58.     signal MicInterrupt.toneDetected();
  59.   }
  60. #endif
  61. }