public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* [ECOS] Type of alarm-function
@ 2008-03-05 12:53 Thomas Klöber
  2008-03-07 12:06 ` Andrew Lunn
  0 siblings, 1 reply; 3+ messages in thread
From: Thomas Klöber @ 2008-03-05 12:53 UTC (permalink / raw)
  To: ecos-discuss

Hello all,

I am porting eCos to the Infineon TriCore TC1796 as part of my studies. I am 
using the kernel testcases to verify it's working, most ones are running just 
fine. During stepping throug kclock0.c as it wouldn't work, I found the 
following:

The prototype for an alarm handler function in the C kernel api is

void alarm_handler(cyg_handle_t alarm, cyg_addrword_t data)

with cyg_handle_t being a cyg_uint32. The internal kernel prototype for 
calling the function however is

void cyg_alarm_fn(Cyg_Alarm *alarm, CYG_ADDRWORD data)

Note  that the first argument is a pointer in this case. While on most 
architectures this does not make any difference, it circumvents passing of 
parameters to the function.

The TC1796 has separate registers for addresses and for data which are used 
for passing parameters. When calling a function of type cyg_alarm_fn, the 
compiler puts the first argument into an address register (%a4) and the 
second one into a data register (%d4). Unfortunately, the called function has 
the type alarm_handler, so the compiler trys to read both values from data 
registers (%d4 and %d5) when entering the function.

The result is that neither of the arguments is passed correctly to the 
function as the first one lies in %a4 instead of %d4 and the second one lies 
in %d4 instead of %d5.

imho one of the prototypes for the function should be corrected to guarantee 
correct behaviour on all platforms.

Any opinions on this?


Tom

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-04-30 12:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-03-05 12:53 [ECOS] Type of alarm-function Thomas Klöber
2008-03-07 12:06 ` Andrew Lunn
2008-04-30 14:26   ` Fabian Scheler

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).