225
|
1 /*
|
|
2 * Copyright (C) 2000, 2001 Martin Norbäck, Håkan Hjort
|
|
3 *
|
|
4 * This file is part of libdvdnav, a DVD navigation library. It is modified
|
|
5 * from a file originally part of the Ogle DVD player.
|
|
6 *
|
|
7 * libdvdnav is free software; you can redistribute it and/or modify
|
|
8 * it under the terms of the GNU General Public License as published by
|
|
9 * the Free Software Foundation; either version 2 of the License, or
|
|
10 * (at your option) any later version.
|
|
11 *
|
|
12 * libdvdnav is distributed in the hope that it will be useful,
|
|
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
15 * GNU General Public License for more details.
|
|
16 *
|
|
17 * You should have received a copy of the GNU General Public License
|
|
18 * along with this program; if not, write to the Free Software
|
|
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
|
20 *
|
|
21 * $Id$
|
|
22 *
|
|
23 */
|
|
24
|
|
25 #ifndef DECODER_H_INCLUDED
|
|
26 #define DECODER_H_INCLUDED
|
|
27
|
|
28 #include <inttypes.h>
|
|
29 #include <sys/time.h>
|
|
30
|
|
31 /* link command types */
|
|
32 typedef enum {
|
|
33 LinkNoLink = 0,
|
|
34
|
|
35 LinkTopC = 1,
|
|
36 LinkNextC = 2,
|
|
37 LinkPrevC = 3,
|
|
38
|
|
39 LinkTopPG = 5,
|
|
40 LinkNextPG = 6,
|
|
41 LinkPrevPG = 7,
|
|
42
|
|
43 LinkTopPGC = 9,
|
|
44 LinkNextPGC = 10,
|
|
45 LinkPrevPGC = 11,
|
|
46 LinkGoUpPGC = 12,
|
|
47 LinkTailPGC = 13,
|
|
48
|
|
49 LinkRSM = 16,
|
|
50
|
|
51 LinkPGCN,
|
|
52 LinkPTTN,
|
|
53 LinkPGN,
|
|
54 LinkCN,
|
|
55
|
|
56 Exit,
|
|
57
|
|
58 JumpTT, /* 22 */
|
|
59 JumpVTS_TT,
|
|
60 JumpVTS_PTT,
|
|
61
|
|
62 JumpSS_FP,
|
|
63 JumpSS_VMGM_MENU,
|
|
64 JumpSS_VTSM,
|
|
65 JumpSS_VMGM_PGC,
|
|
66
|
|
67 CallSS_FP, /* 29 */
|
|
68 CallSS_VMGM_MENU,
|
|
69 CallSS_VTSM,
|
|
70 CallSS_VMGM_PGC,
|
|
71
|
|
72 PlayThis
|
|
73 } link_cmd_t;
|
|
74
|
|
75 /* a link's data set */
|
|
76 typedef struct {
|
|
77 link_cmd_t command;
|
|
78 uint16_t data1;
|
|
79 uint16_t data2;
|
|
80 uint16_t data3;
|
|
81 } link_t;
|
|
82
|
|
83 /* the VM registers */
|
|
84 typedef struct {
|
|
85 uint16_t SPRM[24];
|
|
86 uint16_t GPRM[16];
|
|
87 uint8_t GPRM_mode[16]; /* Need to have some thing to indicate normal/counter mode for every GPRM */
|
|
88 struct timeval GPRM_time[16]; /* For counter mode */
|
|
89 } registers_t;
|
|
90
|
|
91 /* a VM command data set */
|
|
92 typedef struct {
|
|
93 uint64_t instruction;
|
|
94 uint64_t examined;
|
|
95 registers_t *registers;
|
|
96 } command_t;
|
|
97
|
|
98 /* the big VM function, executing the given commands and writing
|
|
99 * the link where to continue, the return value indicates if a jump
|
|
100 * has been performed */
|
|
101 int32_t vmEval_CMD(vm_cmd_t commands[], int32_t num_commands,
|
|
102 registers_t *registers, link_t *return_values);
|
|
103
|
|
104 /* extracts some bits from the command */
|
|
105 uint32_t vm_getbits(command_t* command, int32_t start, int32_t count);
|
|
106
|
|
107 #ifdef TRACE
|
|
108 /* for debugging: prints a link in readable form */
|
|
109 void vm_print_link(link_t value);
|
|
110
|
|
111 /* for debugging: dumps VM registers */
|
|
112 void vm_print_registers( registers_t *registers );
|
|
113 #endif
|
|
114
|
|
115 #endif /* DECODER_H_INCLUDED */
|