4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright (c) 1999 by Sun Microsystems, Inc.
24 * All rights reserved.
27 #pragma ident "%Z%%M% %I% %E% SMI"
36 #include <fcode/private.h>
37 #include <fcode/log.h>
39 #include <fcdriver/fcdriver.h>
42 dump_private(fcode_env_t
*env
)
47 if (env
->current_device
) {
48 p
= env
->current_device
->private;
59 log_message(MSG_ERROR
, "dump_private: NULL private ptr!\n");
63 log_message(MSG_DEBUG
, "Private Data:\n");
64 log_message(MSG_DEBUG
, "Progname: %s\n", cdp
->Progname
);
65 log_message(MSG_DEBUG
, "fcode_fd: %8p\n", cdp
->fcode_fd
);
66 log_message(MSG_DEBUG
, "attach: %llx\n", cdp
->attach
);
67 log_message(MSG_DEBUG
, "Params: (%8p)\n", &cdp
->fc
);
68 log_message(MSG_DEBUG
, " size: %d\n", cdp
->fc
.fcode_size
);
69 log_message(MSG_DEBUG
, " unit: %s\n", cdp
->fc
.unit_address
);
71 log_message(MSG_DEBUG
, "Node: %p\n", p
->node
);
72 log_message(MSG_DEBUG
, "Parent: %p\n", p
->parent
);
73 log_message(MSG_DEBUG
, "upload: %d\n", p
->upload
);
74 log_message(MSG_DEBUG
, "debug: %8x\n", p
->debug
);
79 trigger(fcode_env_t
*env
)
81 common_data_t
*cdp
= (common_data_t
*)env
->private;
85 cdp
->fcode_fd
= open("/dev/fcode", O_RDONLY
);
86 if (cdp
->fcode_fd
>= 0) {
87 log_message(MSG_INFO
, "Trigger...");
88 if (!fc_get_request(cdp
))
89 log_message(MSG_ERROR
, "fc_get_request failed\n");
91 log_message(MSG_INFO
, "\n");
93 forth_abort(env
, "Can't open /dev/fcode\n");
97 do_trigger(fcode_env_t
*env
)
101 install_builtin_nodes(env
);
109 fcode_env_t
*env
= initial_env
;
114 FORTH(0, "dump-private", dump_private
);
115 FORTH(0, "trigger", do_trigger
);