And perhaps define PORTDIR_INPUT and PORTDIR_OUTPUT.

        Although I'm personally of a mind that you'd want to prefix everything 
with
IO.

        IO_DIRPIN_INPUT
        IO_DIRPIN_OUTPUT
        IO_DIRPORT_OUTPUT
        IO_DIRPORT_INPUT

        I say this because any defines relating to the I/O ports should start 
with
IO_ to keep them in the same namespace.  Next, you've got the major
funtionality class, like DIR, DATA, etc.  Then the affected item, like PIN
or PORT.  And finally the actual value that gets set.

        What I would be concerned about is namespace clashes with #defines 
people
are already using.  DIR_INPUT and PINDIR_INPUT seem like they could be very
common names.

        Great change, BTW.  Very much needed.

        --John

-----Original Message-----
From: mspgcc-users-ad...@lists.sourceforge.net
[mailto:mspgcc-users-ad...@lists.sourceforge.net]on Behalf Of Dmitry
Sent: Tuesday, December 10, 2002 08:40
To: mspgcc-users@lists.sourceforge.net
Subject: Re: [Mspgcc-users] ports declaration.



port0.dir.reg_p = 0xff;

probably will be better to change DIR_XX to PINDIR_XXX

~d

On Tuesday 10 December 2002 16:35, J.C.Wren wrote:
> I haven't had time to pull and play with this, but can you do this also?
>
> port0.dir = DIR_OUTPUT;
>
> and 'unsigned char oldPortDir = port.dir;'?
>
>       --John
>
> -----Original Message-----
> From: mspgcc-users-ad...@lists.sourceforge.net
> [mailto:mspgcc-users-ad...@lists.sourceforge.net]on Behalf Of Dmitry
> Sent: Tuesday, December 10, 2002 06:01
> To: mspgcc-users@lists.sourceforge.net
> Subject: Re: [Mspgcc-users] ports declaration.
>
>
> currently:
>
> port0.dir.pin0 = DIR_INPUT;
> port6.dir.pin3 = DIR_OUTPUT;
>
>
> ~d
>
> On Tuesday 10 December 2002 04:40, Tim Wade wrote:
> > excellent idea! it would still be nice if you could write:
> >
> > pin_blah = Z; // make pin an input!
> >
> > i suspect this would over challenge the language ;-)
> >
> > > -----Original Message-----
> > > From: Dmitry [mailto:di...@eis.ru]
> > > Sent: Monday, 9 December 2002 9:58 PM
> > > To: mspgcc-users@lists.sourceforge.net
> > > Subject: [Mspgcc-users] ports declaration.
> > >
> > >
> > > Folks,
> > > I am thinking of changind some io API (not really changing,
> > > but extensions).
> > > So, will it worth if we declare ports as  structures:
> > > --------------------------------------------------------------
> > > -------------------------
> > > typedef union port {
> > >   volatile unsigned char reg_p;
> > >   volatile struct {
> > >     unsigned __p0:1, __p1:1, __p2:1, __p3:1, __p4:1, __p5:1,
> > > __p6:1, __p7:1;
> > >   } __pin;
> > > } ioport_t;
> > >
> > > #define pin0    __pin.__p0
> > > #define pin1    __pin.__p1
> > > #define pin2    __pin.__p2
> > > #define pin3    __pin.__p3
> > > #define pin4    __pin.__p4
> > > #define pin5    __pin.__p5
> > > #define pin6    __pin.__p6
> > > #define pin7    __pin.__p7
> > >
> > > typedef struct {
> > >   ioport_t in, out,dir,ifg,ies,ie,sel;
> > > } xport_t;
> > >
> > > xport_t port0 asm("0x10");
> > > /// and so on...
> > > ----------------------------------------------------------------------
> > > So, user can write:
> > >   port0.out.pin1 = 1;
> > >   xxx = port0.in.pin2;
> > >   port0.reg_p      = 0x7e;
> > > or something.
> > >
> > > Of course this will not discard existing declarations.
> > >
> > > If we're going to add this declaration to header files, we
> > > need to choose a
> > > name for portX. Will 'port0 .. port6' be suitable for it?
> > >
> > > Or just forget about it?
> > >
> > > ~d
> > >
> > >
> > > /********************************************************************
> > >      ("`-''-/").___..--''"`-._     (\   Dimmy the Wild      UA1ACZ
> > >       `6_ 6  )   `-.  (     ).`-.__.`)  Enterprise Information Sys
> > >       (_Y_.)'  ._   )  `._ `. ``-..-'   Nevsky prospekt,   20 / 44
> > >     _..`--'_..-_/  /--'_.' ,'           Saint Petersburg,   Russia
> > >    (il),-''  (li),'  ((!.-'             +7 (812)  3468202, 5585314
> > >  ********************************************************************/
> > >
> > >
> > >
> > > -------------------------------------------------------
> > > This sf.net email is sponsored by:ThinkGeek
> > > Welcome to geek heaven.
> > > http://thinkgeek.com/sf
> > > _______________________________________________
> > > Mspgcc-users mailing list
> > > Mspgcc-users@lists.sourceforge.net
> > > https://lists.sourceforge.net/lists/listinfo/mspgcc-users
> >
> > ____
> > This communication contains information which is confidential and the
> > copyright of Nautronix.
> >
> > If you are not the intended recipient of this communication please
delete
> > and destroy all copies and advise Nautronix immediately. If you are the
> > intended recipient of this communication you should not copy, disclose
or
> > distribute this communication without the prior authority of Nautronix.
>
> Any
>
> > views expressed in this Communication are those of the individual
sender,
> > except where the sender specifically states them to be the views of
> > Nautronix.
> >
> > Except as required at law, Nautronix does not represent, warrant and/or
> > guarantee that the integrity of this communication has been maintained
> > nor that the communication is free of errors, virus, interception or
> > interference.
> >
> >
> >
> > -------------------------------------------------------
> > This sf.net email is sponsored by:ThinkGeek
> > Welcome to geek heaven.
> > http://thinkgeek.com/sf
> > _______________________________________________
> > Mspgcc-users mailing list
> > Mspgcc-users@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/mspgcc-users

--
/********************************************************************
     ("`-''-/").___..--''"`-._     (\   Dimmy the Wild      UA1ACZ
      `6_ 6  )   `-.  (     ).`-.__.`)  Enterprise Information Sys
      (_Y_.)'  ._   )  `._ `. ``-..-'   Nevsky prospekt,   20 / 44
    _..`--'_..-_/  /--'_.' ,'           Saint Petersburg,   Russia
   (il),-''  (li),'  ((!.-'             +7 (812)  3468202, 5585314
 ********************************************************************/



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Mspgcc-users mailing list
Mspgcc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mspgcc-users



Reply via email to