public inbox for insight@sourceware.org
 help / color / mirror / Atom feed
From: Duane Ellis <duane_ellis@franklin.com>
To: insight@sources.redhat.com
Subject: Re: External Program interaction with Insight
Date: Fri, 22 Feb 2002 09:30:00 -0000	[thread overview]
Message-ID: <200202221729.MAA17271@mercury.franklin.com> (raw)
In-Reply-To: <Pine.GSO.4.33.0202220734320.2777-100000@makita.cygnus.com> (message from Keith Seitz on Fri, 22 Feb 2002 07:42:48 -0800 (PST))


duane > In my simulator I used Tcl/Tk's tcp/ip socket interface to simulate a
duane > serial port. When things come in from the remote socket, the 'appear'
duane > as interrupts from the serial port, you read from the 'rx-data'
duane > register and you pull bytes out.

keith> I hope you're using a safe tcl interpreter to do this, interfacing this
keith> interpreter to insight's. It would be a little risky to allow direct
keith> access to Insight's interp. 

In my case, i have a 'compiled in simulator' thus I have a single
thread of execution. As such, I can make use of insights interp :->
directly

keith> I would love to see an interface class for
       this specific purpose. (Hint, hint ;-)

The simulator has been out for quite some time, register to be an
ebookman developer (http://www.franklin.com/ebookman) and download the
sdk source code. It's all right there. You can buy an eBookman quite
cheap too (it ain't no stinking $500 pocket pc)

If you don't want to purchase the unit, You can try out the simulation
and build what we call the "gui test app" under cygwin or RH LINUX
INTEL without purchasing the product.

If you dig into the simulator source, you'll notice that the simulator
builds as a standalone application, without gdb, and builds as a
library that gets compiled into gdb. As such, the code in some places
will seem quite strange... Which answers the question: Why the hell
did he write the code that way....

Basically the simulator execute engine works like this:

At some point, gdb calls a function to tell the target to "run" and
then some function to "wait for it to finish" {ie: wait for target}.

In my 'wait for target' I have a loop that:

a) calls an "execute_some_more_opcodes()" function Every few thousand
   instructions, it returns.  {It 'comes up for air, otherwise it
   would 'drown'}

b) If things look ok, ie: No errors, breakpoints, etc, ie: it is just
   comming up for air, I monitor some other simple flags to see if I
   should stop, or not, and make some calls to ui_loop_hook(),
   notice_quit() and Tcl_DoOneEvent(). Then execute more opcodes.

the majic is "Tcl_DoOneEvent()"

Because I call that, I can simulate buttons being pressed, a touch
screen and all that sort of stuff this way.

to handle the SIO simulation, I do some small setup in tcl (ie: the
"socket -server" function), and then pass the socket handle [called a
channel-handle in tcl] to a C function. In the C function I use it as
a parameter to "Tcl_CreateChannelHandler()" along with a callback
function.

Now that the channel has a "handler" Tcl_DoOneEvent() calls my
"callback" when it discovers incomming data in the socket. In the
callback, I convert the channel handle into an "int" token for the low
level read() call.

to tx data, I do basically the same thing, and but call write()

Works quite nicely.

Sadly, I do not get true simulation (ie: serial Interrupts do not
occur at intervals based on programed baud rate). I'm not after that,
I'm after something that runs close enough...

-Duane.

  reply	other threads:[~2002-02-22 17:30 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-02-22  3:59 David Mc Kenna
2002-02-22  6:17 ` Duane Ellis
2002-02-22  7:42   ` Keith Seitz
2002-02-22  9:30     ` Duane Ellis [this message]
2002-02-25  3:20 David Mc Kenna
2002-02-25 10:12 ` Keith Seitz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200202221729.MAA17271@mercury.franklin.com \
    --to=duane_ellis@franklin.com \
    --cc=insight@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).