00001 /*--------------------------------------------------------------------------- 00002 * Copyright (C) 2003 Dallas Semiconductor Corporation, All Rights Reserved. 00003 * 00004 * Permission is hereby granted, free of charge, to any person obtaining a 00005 * copy of this software and associated documentation files (the "Software"), 00006 * to deal in the Software without restriction, including without limitation 00007 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 00008 * and/or sell copies of the Software, and to permit persons to whom the 00009 * Software is furnished to do so, subject to the following conditions: 00010 * 00011 * The above copyright notice and this permission notice shall be included 00012 * in all copies or substantial portions of the Software. 00013 * 00014 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 00015 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 00016 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 00017 * IN NO EVENT SHALL DALLAS SEMICONDUCTOR BE LIABLE FOR ANY CLAIM, DAMAGES 00018 * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 00019 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 00020 * OTHER DEALINGS IN THE SOFTWARE. 00021 * 00022 * Except as contained in this notice, the name of Dallas Semiconductor 00023 * shall not be used except as stated in the Dallas Semiconductor 00024 * Branding Policy. 00025 * --------------------------------------------------------------------------- 00026 * 00027 * This file contains function definitions for the built-in ROM functions 00028 * of the Dallas Semiconductor 400 processor. This file is intended for use 00029 * with the Keil MicroVision (uVision) C compiler. 00030 * 00031 * --------------------------------------------------------------------------- 00032 */ 00033 #ifndef __rom400_task_ 00034 #define __rom400_task_ 00035 00057 #define ROM400_TASK_VERSION 8 00058 00060 #define ROM400_SCHED_VERSION ROM400_TASK_VERSION 00061 00065 #define RELOAD_14_746 0xfb33 00066 00070 #define RELOAD_18_432 0xfa00 00071 00075 #define RELOAD_29_491 0xfd99 00076 00080 #define RELOAD_36_864 0xfd00 00081 00085 #define RELOAD_58_982 0xfecc 00086 00090 #define RELOAD_73_728 0xfe80 00091 00092 00096 #define MIN_PRIORITY 1 00097 00100 #define NORM_PRIORITY 128 00101 00104 #define MAX_PRIORITY 255 00105 00108 #define FLAG_SLEEPING 1 00109 00111 #define FLAG_IO_WAIT 2 00112 00114 #define FLAG_DHCP_WAIT 4 00115 00118 #define ROM_SAVESIZE 384 00119 00123 struct TIME 00124 { 00126 unsigned char msb; 00128 unsigned long millis; 00129 }; 00130 00134 struct TCB 00135 { 00136 unsigned char Priority; 00137 unsigned char ID; 00138 void* Next; 00139 unsigned char Flags; 00140 struct TIME WakeupTime; 00141 unsigned int StateSize; 00142 void* StatePtr; 00143 }; 00144 00156 //--------------------------------------------------------------------------- 00157 void task_genesis(unsigned int savesize); 00158 00174 //--------------------------------------------------------------------------- 00175 unsigned char task_getcurrent(void); 00176 00196 //--------------------------------------------------------------------------- 00197 unsigned char task_getpriority(unsigned char task_id); 00198 00220 //--------------------------------------------------------------------------- 00221 unsigned char task_setpriority(unsigned char task_id, unsigned char priority); 00222 00248 //--------------------------------------------------------------------------- 00249 unsigned int task_fork(unsigned char priority, unsigned int savesize); 00250 00268 //--------------------------------------------------------------------------- 00269 unsigned char task_kill(unsigned char task_id); 00270 00290 //--------------------------------------------------------------------------- 00291 unsigned char task_suspend(unsigned char task_id, unsigned char event_mask); 00292 00317 //--------------------------------------------------------------------------- 00318 #define task_wait(task_id,event_mask,millis) task_synch_wait(((long)(millis))>>16,(millis), (task_id) | ((event_mask) << 8)) 00319 00345 //--------------------------------------------------------------------------- 00346 unsigned char task_synch_wait(unsigned int millis_h, unsigned int millis_l, unsigned int task_event); 00347 00366 //--------------------------------------------------------------------------- 00367 unsigned char task_signal(unsigned char task_id, unsigned char event_mask); 00368 00392 //--------------------------------------------------------------------------- 00393 void task_gettimemillis(struct TIME* t); 00394 00411 //--------------------------------------------------------------------------- 00412 unsigned char task_getthreadid(); 00413 00437 //--------------------------------------------------------------------------- 00438 unsigned char task_threadresume(unsigned char thread, unsigned char task); 00439 00463 //--------------------------------------------------------------------------- 00464 unsigned char task_threadiosleep(unsigned char infinite, unsigned long timeout); 00465 00493 //--------------------------------------------------------------------------- 00494 unsigned char task_threadiosleepnc(unsigned char infinite, unsigned long timeout); 00495 00496 00515 //--------------------------------------------------------------------------- 00516 void task_threadsave(void); 00517 00535 //--------------------------------------------------------------------------- 00536 void task_threadrestore(void); 00537 00562 //--------------------------------------------------------------------------- 00563 #define task_sleep(task,timeout) task_synch_sleep(((long)(timeout))>>16,(timeout),(task)); 00564 00565 //unsigned char task_sleep(unsigned char task, unsigned long timeout); 00566 00591 //--------------------------------------------------------------------------- 00592 unsigned char task_synch_sleep(unsigned int timeout_h, unsigned int timeout_l, unsigned char task); 00593 00612 //--------------------------------------------------------------------------- 00613 unsigned char task_gettaskid(); 00614 00628 //--------------------------------------------------------------------------- 00629 void task_entercritsection(void); 00630 00644 //--------------------------------------------------------------------------- 00645 void task_leavecritsection(void); 00646 00663 //--------------------------------------------------------------------------- 00664 unsigned int task_gettickreload(void); 00665 00698 //--------------------------------------------------------------------------- 00699 void task_settickreload(unsigned int reload); 00700 00701 00710 //--------------------------------------------------------------------------- 00711 unsigned int task_version(void); 00712 00713 #endif
| Copyright 2004 Dallas Semiconductor, Inc.. | Documentation generated by Doxygen. |