4 * "Copyright (c) 2000-2004 The Regents of the University of California.
7 * Permission to use, copy, modify, and distribute this software and
8 * its documentation for any purpose, without fee, and without written
9 * agreement is hereby granted, provided that the above copyright
10 * notice, the following two paragraphs and the author appear in all
11 * copies of this software.
13 * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY
14 * PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL
15 * DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS
16 * DOCUMENTATION, EVEN IF THE UNIVERSITY OF CALIFORNIA HAS BEEN
17 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
19 * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
20 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
21 * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
22 * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
23 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS."
27 * IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. By
28 * downloading, copying, installing or using the software you agree to
29 * this license. If you do not agree to this license, do not download,
30 * install, copy or use the software.
32 * Intel Open Source License
34 * Copyright (c) 2004 Intel Corporation
35 * All rights reserved.
36 * Redistribution and use in source and binary forms, with or without
37 * modification, are permitted provided that the following conditions are
40 * Redistributions of source code must retain the above copyright
41 * notice, this list of conditions and the following disclaimer.
42 * Redistributions in binary form must reproduce the above copyright
43 * notice, this list of conditions and the following disclaimer in the
44 * documentation and/or other materials provided with the distribution.
45 * Neither the name of the Intel Corporation nor the names of its
46 * contributors may be used to endorse or promote products derived from
47 * this software without specific prior written permission.
49 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
50 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
51 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
52 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE INTEL OR ITS
53 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
54 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
55 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
56 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
57 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
58 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
59 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
63 /* Authors: Rahul Balani
64 * History: April 2005 Ported to sos
65 * November 2005 Modifications for new design
69 * @author Rahul Balani
80 #include "DvmConstants.h"
82 typedef uint8_t DvmOpcode
;
83 typedef uint16_t DvmCapsuleLength
;
84 typedef uint32_t DvmCapsuleVersion
;
88 } __attribute__((packed
)) DvmQueue
;
92 } __attribute__((packed
)) DvmValueVariable
;
96 uint8_t entries
[DVM_BUF_LEN
];
97 } __attribute__((packed
)) DvmDataBuffer
;
106 DvmValueVariable value
;
107 DvmBufferVariable buffer
;
109 } __attribute__((packed
)) DvmStackVariable
;
113 DvmOpcode data[DVM_CAPSULE_SIZE];
119 DvmStackVariable stack
[DVM_OPDEPTH
];
120 } __attribute__((packed
)) DvmOperandStack
;
122 /* A DvmCapsule is the unit of propagation. */
125 //DvmCapsuleOption options;
126 DvmCapsuleLength dataSize;
127 int8_t data[DVM_CAPSULE_SIZE];
128 } __attribute__((packed)) DvmCapsule;
132 uint8_t moduleID
; // Event information
134 DvmCapsuleLength dataSize
; // Size of script in bytes
135 uint8_t libraryMask
; // Indicates required libraries
136 uint16_t pc
; // Current pc value
137 uint8_t state
; // Context state
138 DvmCapsuleID which
; // Context ID
139 uint8_t heldSet
[(DVM_LOCK_COUNT
+ 7) / 8]; // Held locks
140 uint8_t releaseSet
[(DVM_LOCK_COUNT
+ 7) / 8]; // Pending lock releases
141 uint8_t acquireSet
[(DVM_LOCK_COUNT
+ 7) / 8]; // Locks to acquire
142 list_link_t link
; // Link entry for wait queues
143 DvmQueue
* queue
; // Current wait queue
144 uint16_t num_executed
;
145 uint8_t *init_data
; // Initial data attached with an event message
147 } __attribute__((packed
)) DvmContext
;
151 DvmOperandStack stack
;
152 DvmStackVariable vars
[DVM_NUM_LOCAL_VARS
];
153 codemem_t cm
; // the handle to codemem
158 } __attribute__((packed
)) DvmLock
;
160 typedef struct DvmErrorMsg
{
166 } __attribute__((packed
)) DvmErrorMsg
;
168 typedef struct DvmTrickleTimer
{
169 uint16_t elapsed
; // Current time (in ticks)
170 uint16_t threshold
; // Time to consider transmitting (in ticks) (t)
171 uint16_t interval
; // Size of current interval (in ticks) (tau)
172 uint16_t numHeard
; // Number of messages heard (c)
173 } __attribute__((packed
)) DvmTrickleTimer
;
176 sos_pid_t destModID
; // lddata requirement: destination module ID
177 uint8_t capsuleID
; // lddata requirement: data ID
180 DvmCapsuleLength length
;
182 uint8_t data
[DVM_MAX_SCRIPT_LENGTH
];
183 } __attribute__((packed
)) DvmScript
;
186 DvmCapsuleVersion version
;
189 uint8_t chunk
[MVIRUS_CHUNK_SIZE
];
190 } __attribute__((packed
)) DvmCapsuleChunkMsg
;
193 DvmCapsuleVersion versions
[DVM_CAPSULE_NUM
];
194 } __attribute__((packed
)) DvmVersionMsg
;
197 DvmCapsuleVersion version
;
199 uint8_t bitmask
[MVIRUS_BITMASK_SIZE
];
200 } __attribute__((packed
)) DvmCapsuleStatusMsg
;