Added SHT11 driver for TMote.
[sos-2x.git] / modules / include / VM / dvm_types.h
blobc9011242fa9493ffc54cdd44973e7b5935d693f4
1 /**
2 * \file dvm_types.h
3 * \brief DVM data type
4 * \author Ram Kumar {ram@ee.ucla.edu}
5 */
7 #ifndef __DVM_TYPES_H__
8 #define __DVM_TYPES_H__
10 #include <VM/Dvm.h>
11 #include <VM/DvmConstants.h>
12 // Ram - For the rest of the data types look at Dvm.h !! :-)
15 //----------------------------------------------------------------------------
16 // TYPEDEFS
17 //----------------------------------------------------------------------------
18 #define NULL_CAPSULE (DVM_CAPSULE_NUM + 1)
19 #define DVM_STATE_SIZE sizeof(DvmState)
20 #define DVM_NUM_SCRIPT_BLOCKS 2
21 #define DVM_DEFAULT_MEM_ALLOC_SIZE (DVM_NUM_SCRIPT_BLOCKS*DVM_STATE_SIZE)
23 typedef struct {
24 DvmState *scripts[DVM_CAPSULE_NUM];
25 uint8_t script_block_owners[DVM_NUM_SCRIPT_BLOCKS];
26 DvmState *script_block_ptr;
27 } DVMResourceManager_state_t;
29 typedef struct
31 uint8_t usedVars[DVM_CAPSULE_NUM][(DVM_LOCK_COUNT + 7) / 8];
32 DvmQueue readyQueue;
33 uint8_t libraries;
34 uint8_t extlib_module[4];
35 DvmLock locks[DVM_LOCK_COUNT];
36 } DVMConcurrencyMngr_state_t;
38 typedef struct {
39 func_cb_ptr ext_execute[4];
40 DvmQueue runQueue;
41 DvmContext* runningContext;
42 DvmErrorMsg errorMsg;
43 uint8_t libraries;
44 struct {
45 uint8_t inErrorState : 1;
46 uint8_t errorFlipFlop : 1;
47 uint8_t taskRunning : 1;
48 uint8_t halted : 1;
49 } flags;
50 } DVMScheduler_state_t;
52 typedef struct {
53 DvmState* stateBlock[DVM_CAPSULE_NUM];
54 } DVMEventHandler_state_t;
56 typedef struct
58 uint8_t busy; // for GET_DATA
59 DvmContext *executing; // for GET_DATA
60 DvmQueue getDataWaitQueue; // for GET_DATA
61 DvmContext *nop_executing; // for NOP
62 uint16_t delay_cnt; // for NOP
63 DvmDataBuffer buffers[DVM_NUM_BUFS];
64 DvmStackVariable shared_vars[DVM_NUM_SHARED_VARS];
65 int32_t fl_post; //for posting a int32_t/float directly
66 } DVMBasiclib_state_t;
69 typedef struct _str_dvm_state {
70 func_cb_ptr execute_syncall;
71 DVMScheduler_state_t sched_st; // This should be the second field (because of fn. ptr. ptr.)
72 DVMResourceManager_state_t resmgr_st;
73 DVMEventHandler_state_t evhdlr_st;
74 DVMConcurrencyMngr_state_t conmgr_st;
75 DVMBasiclib_state_t basiclib_st;
76 } dvm_state_t;
79 #endif//__DVM_TYPES_H__