00001 /*############################################################################## 00002 00003 nIP - nano IP stack 00004 00005 File : os_core.h 00006 00007 Description : Internet Stack Operating System functions 00008 00009 Copyright notice: 00010 00011 Copyright (C) 2005 - 00012 Andreas Dittrich, dittrich@informatik.hu-berlin.de 00013 Jon Kowal, kowal@informatik.hu-berlin.de 00014 00015 This program is free software; you can redistribute it and/or 00016 modify it under the terms of the GNU General Public License 00017 as published by the Free Software Foundation; either version 2 00018 of the License, or (at your option) any later version. 00019 00020 This program is distributed in the hope that it will be useful, 00021 but WITHOUT ANY WARRANTY; without even the implied warranty of 00022 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00023 GNU General Public License for more details. 00024 00025 You should have received a copy of the GNU General Public License 00026 along with this program; if not, write to the Free Software 00027 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00028 00029 ##############################################################################*/ 00030 00031 #ifndef _NIP_OS_CORE_H 00032 #define _NIP_OS_CORE_H 00033 00034 #include <string.h> 00035 #include "nip_types.h" 00036 #include "avr/interrupt.h" 00037 00038 typedef uint32_t nip_time_t; 00039 00040 extern uint32_t clock; 00041 extern uint32_t tickcount; 00042 00043 00044 /** get time of day 00045 * 00046 * @return the value of time in seconds since 0 hours, 0 minutes, 0 seconds, 00047 * January 1st, 1970, Coordinated Universal Time, without including leap seconds. 00048 */ 00049 // nip_time_t nip_time( void ); 00050 #define nip_time() clock 00051 00052 /** get system tickcount 00053 * @return seconds since system start. Use this value for timeout measurement as 00054 * it will always be increased linearly. */ 00055 #define nip_tickcount() tickcount 00056 00057 /** compare memory areas */ 00058 #define nip_memcmp(s1, s2, n) memcmp(s1, s2, n) 00059 00060 /** copy memory area */ 00061 void nip_memcpy( void* dest, void* src, uint16_t size); 00062 //#define nip_memcpy(dest, src, n) memcpy(dest, src, n) 00063 #define nip_memmove(dest, src, n) memmove(dest, src, n) 00064 00065 /** fill memory with constant byte */ 00066 // void nip_memset( void* ptr, uint8_t c, uint16_t size ); 00067 #define nip_memset(start, b, n) memset(start, b, n) 00068 00069 /** disable global interrupts */ 00070 #define nip_int_off() cli() 00071 00072 /** enable global interrupts */ 00073 #define nip_int_on() sei() 00074 00075 00076 #endif /* _NIP_OS_CORE_H */