CVS: libraries/mspgcc eventhandler_find.c, NONE, 1.1 makefile, 1.4, 1.5

Chris Liechti <[email protected]> Mon, 24 Mar 2008 09:05:06 -0700
Newsgroups gmane.comp.hardware.texas-instruments.msp430.gcc.cvs
Message-ID <[email protected]>
Update of /cvsroot/mspgcc/libraries/mspgcc
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv2440/mspgcc

Modified Files:
	makefile 
Added Files:
	eventhandler_find.c 
Log Message:
- provinde and alternate way to find event bits
- commandline lib fix


--- NEW FILE: eventhandler_find.c ---
#include "mspgcc/eventhandler.h"

// search the eventhandler_table for a function and return the corresponding
// bit mask for use with EVENTHANDLER_LAUNCH.
// returns 0 if function is not found.

// This table has to be provided by the user.
extern const EVENTHANDLER_TABLE eventhandler_table[];

unsigned short eventhandler_find(EVENTHANDLER_TABLE event_function) {
    unsigned short mask = 0x8000;
    const EVENTHANDLER_TABLE *entry = eventhandler_table;
    while (*entry && mask) {
        if (*entry == event_function) return mask;
        mask >>= 1;
        entry++;
    }
    return 0;
}

Index: makefile
===================================================================
RCS file: /cvsroot/mspgcc/libraries/mspgcc/makefile,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -w -d -r1.4 -r1.5
--- makefile	19 Sep 2005 09:28:58 -0000	1.4
+++ makefile	24 Mar 2008 16:04:33 -0000	1.5
@@ -5,7 +5,7 @@
                   flash_erase_segment.c flash_write_byte.c flash_write_word.c \
                   hex_decode_inline.c hex_decode.c hex_encode.c hex_fromdigit.c \
                   hexdigits.c escape_encode.c escape_decode.c \
-                  event_scheduler.c
+                  eventhandler_find.c event_scheduler.c
 ASOURCES        = eventhandler.S eventhandler_idle.S delay.S
 CPU             = msp1
 


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/