Re: [cc65] Serial port API

Date view Thread view Subject view

From: Mike McCarty (jmccarty_at_ssd.usa.alcatel.com)
Date: 2001-11-06 18:16:14


On Mon, 5 Nov 2001, MagerValp wrote:

> >>>>> "gpz" == groepaz  <groepaz_at_gmx.net> writes:
> 
> gpz> BTW... different thing... is there already some header file that
> gpz> defines an api for serial-port access? i have just recently made
> gpz> the serial routines for the silversurfer (serial port for use
> gpz> with the new retro-replay hardware) and since i am going to write
> gpz> some debugging-stub using that for cc65 anyway (atm its just pure
> gpz> asm) i'd be glad to do it in a way so other ppl can re-use those
> gpz> pieces of code.... however, if there's no api defined for now,
> gpz> mine looks like
> 
> gpz> sio_init(portname,baudrate); /* init port, return 0 on success or -1 on error) */
> 
> Might I suggest that you add controls for word length, stop bits and
> parity as well? And is baudrate a long or a named constant? 115200 and
> up doesn't fit in an int.
> 
> gpz> sio_readbyte();              /* waits until character arrives and returns it */
> gpz> sio_readbyte_nowait();       /* if character is waiting, returns it. otherwhise return 0 */

[snip]

May I suggest a return of -1 rather than 0? Returning 0 would preclude
implementing binary links with NUL characters in them.

Mike

----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo_at_musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.


Date view Thread view Subject view

This archive was generated by hypermail 2.1.3 : 2001-12-14 22:05:44 CET