public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* [ECOS] Question about def_alm (UITRON)
@ 2007-05-04  9:40 LONY David
  2007-05-07  8:12 ` LONY David
  0 siblings, 1 reply; 2+ messages in thread
From: LONY David @ 2007-05-04  9:40 UTC (permalink / raw)
  To: ecos-discuss

Hi all,

I wrote a small program which define an alarm (def_alm function). I 
wanted to know if eCos with UITRON compatibilty support extended 
informations (VP attribute) and if it supported how I can have them when 
the handler (alarm_hand) is called.
This is my program :

#include <cyg/compat/uitron/uit_func.h>
#include <stdio.h>

void alarm_hand(void* a)
{
  char test_chaine[]="test chaine";
  printf("In alarm_hand param a-->%s   test_chaine--->%s\n",a,test_chaine);
}

int main()
{
  T_DALM dalm;
  int retval;
 
  char chaine[]="salut";
  VP info = (VP)chaine;
 
  dalm.exinf  = (VP)info;
  dalm.almatr = TA_HLNG;
  dalm.almhdr = (FP)&alarm_hand;
  dalm.tmmode = TTM_REL;                
  dalm.almtim = 1000;
 
  retval = def_alm(20, &dalm);
 
  if(retval != E_OK)
    {
      printf("Error --> Cannot create a alarm in main %d !!!\n",retval);
    }
  else
    {
      printf("Good --> I succeded to create a alarm in main! \n");
      printf("I finish to create a alarm and RETVAL equals %d\n",retval);
    }

  return 0;
}

Does I make something wrong ? I debug this program in GDB, and I cannot 
have the extended information....
This is GDB output :
Good --> I succeded to create a alarm in main!
I finish to create a alarm and RETVAL equals 0
In alarm_hand param a-->   test_chaine--->test chaine

Thanks a lot.
David




-- 
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] 2+ messages in thread

* Re: [ECOS] Question about def_alm (UITRON)
  2007-05-04  9:40 [ECOS] Question about def_alm (UITRON) LONY David
@ 2007-05-07  8:12 ` LONY David
  0 siblings, 0 replies; 2+ messages in thread
From: LONY David @ 2007-05-07  8:12 UTC (permalink / raw)
  To: LONY David, ecos-discuss

Hi all,

I found the solution for my problem...

#include <cyg/compat/uitron/uit_func.h>
#include <stdio.h>

void alarm_hand(void)
{
  T_RALM ralm;
  int retval;

  retval=ref_alm(&ralm,20);

  if(retval != E_OK)
    {
      printf("Error --> Cannot reference the alarm in alarm_hand %d 
!!!\n",retval);
    }
  else
    {
      printf("Good --> I succeded to reference the alarm in alarm_hand 
CHAINE --->%s  CHAINE POINTER --->%p\n",ralm.exinf,ralm.exinf);
      printf("I finish to reference the alarm and RETVAL equals 
%d\n",retval);
    }
}


int main()
{

  T_DALM dalm;
  int retval;

  char* chaine= (void*)malloc(5*sizeof(char));
  chaine = "salut";

  VP info = (VP)chaine;

  dalm.exinf  = info;
  dalm.almatr = TA_HLNG;
  dalm.almhdr = (FP)&alarm_hand;
  dalm.tmmode = TTM_REL;
  dalm.almtim = 1000;

  retval = def_alm(20, &dalm);

  if(retval != E_OK)
    {
      printf("Error --> Cannot create a alarm in main %d !!!\n",retval);
    }
  else
    {
      printf("Good --> I succeded to create a alarm in main INFO pointer 
--->%p CHAINE --->%p\n",info,chaine);
      printf("I finish to create a alarm and RETVAL equals %d\n",retval);
      }
  return 0;
}

Thanks a lot.
David

LONY David wrote:

> Hi all,
>
> I wrote a small program which define an alarm (def_alm function). I 
> wanted to know if eCos with UITRON compatibilty support extended 
> informations (VP attribute) and if it supported how I can have them 
> when the handler (alarm_hand) is called.
> This is my program :
>
> #include <cyg/compat/uitron/uit_func.h>
> #include <stdio.h>
>
> void alarm_hand(void* a)
> {
>  char test_chaine[]="test chaine";
>  printf("In alarm_hand param a-->%s   
> test_chaine--->%s\n",a,test_chaine);
> }
>
> int main()
> {
>  T_DALM dalm;
>  int retval;
>
>  char chaine[]="salut";
>  VP info = (VP)chaine;
>
>  dalm.exinf  = (VP)info;
>  dalm.almatr = TA_HLNG;
>  dalm.almhdr = (FP)&alarm_hand;
>  dalm.tmmode = TTM_REL;                 dalm.almtim = 1000;
>
>  retval = def_alm(20, &dalm);
>
>  if(retval != E_OK)
>    {
>      printf("Error --> Cannot create a alarm in main %d !!!\n",retval);
>    }
>  else
>    {
>      printf("Good --> I succeded to create a alarm in main! \n");
>      printf("I finish to create a alarm and RETVAL equals %d\n",retval);
>    }
>
>  return 0;
> }
>
> Does I make something wrong ? I debug this program in GDB, and I 
> cannot have the extended information....
> This is GDB output :
> Good --> I succeded to create a alarm in main!
> I finish to create a alarm and RETVAL equals 0
> In alarm_hand param a-->   test_chaine--->test chaine
>
> Thanks a lot.
> David
>
>
>
>



-- 
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] 2+ messages in thread

end of thread, other threads:[~2007-05-07  8:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-05-04  9:40 [ECOS] Question about def_alm (UITRON) LONY David
2007-05-07  8:12 ` LONY David

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).