home *** CD-ROM | disk | FTP | other *** search
- Path: god.bel.alcatel.be!nlev00!barnhoorn
- From: barnhoorn@nlev00 ()
- Newsgroups: comp.sys.amiga.programmer,comp.sys.amiga.misc,comp.sys.amiga.hardware
- Subject: Re: CIA
- Date: 13 Mar 1996 11:40:43 GMT
- Organization: Alcatel Bell
- Distribution: world
- Message-ID: <4i6c7r$fiq@btmpjg.god.bel.alcatel.be>
- References: <3145A310.61E1@fs1.ee.man.ac.uk>
- Reply-To: barnhoorn@nlev00 ()
- NNTP-Posting-Host: 138.203.178.61
- X-Newsreader: mxrn 6.18-10
-
-
- In article <3145A310.61E1@fs1.ee.man.ac.uk>, Christos Dimitrakakis <mbge4cd1@fs1.ee.man.ac.uk> writes:
- >Anyone willing to post me details on how the CIA chips work
- >and how I can use them for timing?
- >I would also require in-depth information on resource-allocating,
- >as well as asynchronous IO operations.
- >
- >Any help would be greatly appreciated.
- >
-
- .that's all?
-
- No need to use the CIA for timing - if you really want to access the
- CIA directly, then don't use the method described below, because in this
- example I use the official way of performing IO-operations.
-
- /* for the timeout */
- struct MsgPort *tport;
- struct timerequest tr;
- unsigned long time=0L; /* in milliseconds */
- unsigned long error;
-
- if (time<1000)
- error=OpenDevice(TIMERNAME,UNIT_MICROHZ,(struct IORequest *)&tr,0);
- else
- error=OpenDevice(TIMERNAME,UNIT_VBLANK,(struct IORequest *)&tr,0);
- tport=CreatePort(0,0);
- /* now let's check for timer */
- if (error && !tport) {
- /* no... */
- if (tport) DeletePort(tport);
- if (!error) CloseDevice((struct IORequest *)&tr);
- /* now just use the old method of delaying... */
- } else {
- /* all initializing is done now */
- tr.tr_node.io_Message.mn_Node.ln_Type=NT_MESSAGE;
- tr.tr_node.io_Message.mn_Node.ln_Pri=0;
- tr.tr_node.io_Message.mn_Node.ln_Name=NULL;
- tr.tr_node.io_Message.mn_ReplyPort=tport;
- tr.tr_time.tv_secs=time/1000;
- tr.tr_time.tv_micro=(time%1000)*1000;
- tr.tr_node.io_Command=TR_ADDREQUEST;
- SendIO((struct IORequest *)&tr);
- waitflags|=1<<tport->mp_SigBit;
- }
-
- --
- ---------------------------------------------------------------------------
- Jaco Barnhoorn barnie@xs4all.nl
- Software Test Engineer barnhoorn%nlev00@btmv56.se.bel.alcatel.be
- Alcatel Telecom Systems
- Rijswijk, The Netherlands
- ---------------------------------------------------------------------------
-