Wiselib
wiselib.stable/external_interface/tinyos/tinyos_wiselib_glue.h
Go to the documentation of this file.
00001 /***************************************************************************
00002  ** This file is part of the generic algorithm library Wiselib.           **
00003  ** Copyright (C) 2008,2009 by the Wisebed (www.wisebed.eu) project.      **
00004  **                                                                       **
00005  ** The Wiselib is free software: you can redistribute it and/or modify   **
00006  ** it under the terms of the GNU Lesser General Public License as        **
00007  ** published by the Free Software Foundation, either version 3 of the    **
00008  ** License, or (at your option) any later version.                       **
00009  **                                                                       **
00010  ** The Wiselib is distributed in the hope that it will be useful,        **
00011  ** but WITHOUT ANY WARRANTY; without even the implied warranty of        **
00012  ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         **
00013  ** GNU Lesser General Public License for more details.                   **
00014  **                                                                       **
00015  ** You should have received a copy of the GNU Lesser General Public      **
00016  ** License along with the Wiselib.                                       **
00017  ** If not, see <http://www.gnu.org/licenses/>.                           **
00018  ***************************************************************************/
00019 #ifndef TINYOS_WISELIB_GLUE_H
00020 #define TINYOS_WISELIB_GLUE_H
00021 
00022 #include <stdint.h>
00023 
00024 // --------------------------------------------------------------------------
00025 // --------------------------------------------------------------------------
00026 // --- Wiselib Glue Code to be called by TinyOs-NCs (e.g., for callbacks)
00027 // --------------------------------------------------------------------------
00028 // --------------------------------------------------------------------------
00029 
00030 // --------------------------------------------------------------------------
00031 // ----- Radio
00032 // --------------------------------------------------------------------------
00033 void tinyos_external_receive( uint16_t from, uint8_t len, uint8_t *data, uint8_t lqi );
00034 
00035 // --------------------------------------------------------------------------
00036 // ----- Timer
00037 // --------------------------------------------------------------------------
00038 void tinyos_timer_fired( int idx );
00039 
00040 // --------------------------------------------------------------------------
00041 // ----- Uart
00042 // --------------------------------------------------------------------------
00043 #ifndef WISELIB_BUILD_ONLY_STABLE
00044 void tinyos_glue_uart_rcv_byte(uint8_t data);
00045 #endif
00046 
00047 
00048 // --------------------------------------------------------------------------
00049 // --------------------------------------------------------------------------
00050 // --- Functions provided by TinyOs-NCs to be called by Wiselib Glue Code
00051 // --- (each of these functions is declared as "@C() @spontaneous()")
00052 // --------------------------------------------------------------------------
00053 // --------------------------------------------------------------------------
00054 
00055 // --------------------------------------------------------------------------
00056 // ----- Debug
00057 // --------------------------------------------------------------------------
00058 void tinyos_glue_debug(char *msg);
00059 
00060 // --------------------------------------------------------------------------
00061 // ----- Timer
00062 // --------------------------------------------------------------------------
00063 int tinyos_get_free_timer();
00064 void tinyos_register_timer( int idx, uint32_t millis );
00065 
00066 // --------------------------------------------------------------------------
00067 // ----- Radio
00068 // --------------------------------------------------------------------------
00069 enum TinyOsRadioErrorCodes
00070 {
00071    TINYOS_RADIO_SUCCESS = 0,
00072    TINYOS_RADIO_BUSY = 1,
00073    TINYOS_RADIO_PACKET_TOO_LARGE = 2,
00074    TINYOS_RADIO_ERR_UNSPEC = 3
00075 };
00076 
00077 void tinyos_init_radio_module();
00078 uint16_t tinyos_get_nodeid();
00079 int tinyos_send_message( uint16_t id, uint8_t len, const uint8_t *data );
00080 
00081 // --------------------------------------------------------------------------
00082 // ----- Clock
00083 // --------------------------------------------------------------------------
00084 uint32_t tinyos_get_time();
00085 
00086 // --------------------------------------------------------------------------
00087 // ----- Uart
00088 // --------------------------------------------------------------------------
00089 #ifndef WISELIB_BUILD_ONLY_STABLE
00090 int tinyos_glue_uart_write( uint8_t len, uint8_t *buf );
00091 #endif
00092 
00093 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines