[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] Pointer to a function in a structure in flash?
From: |
Bob Paddock |
Subject: |
Re: [avr-gcc-list] Pointer to a function in a structure in flash? |
Date: |
Mon, 27 Oct 2003 16:58:36 -0500 |
User-agent: |
Opera7.21/Win32 M2 build 3218 |
I'm not sure what to make of your response.
When you say "command", do you mean "function"? As only
functions take parameters.
The code I'm working on is part of a command parser, and it is very similar
to the Menu code that Ted posted.
And when did "searching the table" come into the picture?
How are you doing this search? etc.
#define STRCMP(x,y) strcmp_P( x, (PGM_P) pgm_read_word( &y ) )/* for GCC */
Below 'token' is from strtok() RAM buffer with what you typed like "Baud
1200".
for( i = 0; i < COMMANDS_AVAILABLE; ++i )
{/* If find a table match then call that function */
if( !STRCMP( (const char *) token , cmd_func_table[i].command ) )
{
...
/* Call the function from the function table */
#if defined( __IAR__ )
retval = ( *(cmd_func_table[i].function) )( (char const *) token,
(char const *) tokptr );
#endif
#if defined( __GCC_VERSION__ )
retval =
(*((functype_t)(pgm_read_word(&cmd_func_table[i].function))))((char const
*)token, (char const *)tokptr);
#endif
...
}
}
Keep in mind this is code that is working fine with IAR.
- Re: [avr-gcc-list] Pointer to a function in a structure in flash?, (continued)
Re: [avr-gcc-list] Pointer to a function in a structure in flash?, E . Weddington, 2003/10/27
Re: [avr-gcc-list] Pointer to a function in a structure in flash?, E . Weddington, 2003/10/27
Re: [avr-gcc-list] Pointer to a function in a structure in flash?, E . Weddington, 2003/10/27
- Re: [avr-gcc-list] Pointer to a function in a structure in flash?,
Bob Paddock <=
Re: [avr-gcc-list] Pointer to a function in a structure in flash?, E . Weddington, 2003/10/27
Re: [avr-gcc-list] Pointer to a function in a structure in flash?, E . Weddington, 2003/10/28
Re: [avr-gcc-list] Pointer to a function in a structure in flash?, E . Weddington, 2003/10/28