The following might be a hint: ------------------------------ typedef union port { volatile unsigned char P11; volatile struct { unsigned p0:1; unsigned p1:1; unsigned p2:1; unsigned p3:1; unsigned p4:1; unsigned p5:1; unsigned p6:1; unsigned p7:1; } pin; } ioport_t;
ioport_t port1 asm ("0x21"); #define fpga_power_pin port1.pin.p7 #define fpga_overflow port1.pin.p6 #define fpga_ready port1.pin.p3 int ovfl; void foo() { fpga_power_pin = 1; } ---------------------------- ~d On Monday 09 December 2002 08:01, Tim Wade wrote: > Hi ho > > Just a quick query... > > I am writing a lot of code to do pin bashing and am getting a lot of: > > #define FPGA_POWER_PORT_SELECT P6SEL > #define FPGA_POWER_PORT_IN P6IN > #define FPGA_POWER_PORT_OUT P6OUT > #define FPGA_POWER_PORT_DIRECTION P6DIR > #define FPGA_POWER_PIN (1 << 4) > > void > powerOn(void) > { > FPGA_POWER_PORT_OUT |= FPGA_POWER_PIN; > FPGA_POWER_PORT_DIRECTION |= FPGA_POWER_PIN; > } > > What i would like to do is something like this: > > const Msp430Pin l_fpga_power_pin(6, 4); > > then: > > l_fpga_power_pin = 1; // set pin high > > or: > > state = l_fpga_power_pin; // check pin level > > or what would be really nice: > > l_fpga_power_pin = Z; // make pin an input! > > when i have a lot of pins it gets pretty messy doing it the current way > and from time to time i get the |= and the &=~ the wrong way around etc. > etc. > > The PIC compiler we also use has all the standard pins already defined so > you can do: > > RB0 = 1; // set bit 0 of PORTB high > > or what ever... it uses bit fields but i am not sure if we could do > something similar on the MSP430 with GCC and still get efficient code? > > as you have probably guessed i am a hardware type who mostly write VHDL!! > maybe a perl/python/ruby script? > > any ideas? > > cheers > Tim > > ____ > 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 ********************************************************************/