This is the mail archive of the ecos-discuss@sourceware.org mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: how to implement EDF scheduling in eCos


Hi John,

You are right, I added EDF specific block

> #elif defined(CYGSEM_KERNEL_SCHED_EDF)
> # define CYG_SCHEDTHREAD_SCHEDIMP_MEMBERS                                    \
>    cyg_thread *next;                                                        \
>    cyg_thread *prev;                                                        \
>    cyg_priority_t      priority;            /* current thread priority */     \
>    cyg_edf_sched_info_t *edf_thread_info;  /* thread specific EDF properties */
> #else

to kapidata.h

Next, I could add:
> cyg_edf_sched_info_t *thread_edf_info;
member variable to my Cyg_SchedThread_Implementation class at my edf.hxx file.

At the same time I have:
> typedef struct
> {
>    cyg_tick_count deadline; /* abs ddl of the thread, 2b changed to rel */
>    cyg_tick_count wcet; /* Worst Case Execution time of the thread */
>    cyg_tick_count period; /* Call frequency of the thread */
> } cyg_edf_sched_info;

> typedef cyg_edf_sched_info cyg_edf_sched_info_t;  /* EDF scheduling info type */

in ktypes.h file.

Now my Cyg_SchedThread_Implementation class constructor looks like:
> Cyg_SchedThread_Implementation::Cyg_SchedThread_Implementation
> (
>    CYG_ADDRWORD sched_info
> )
> {
>    CYG_REPORT_FUNCTION();
>    CYG_REPORT_FUNCARG1("sched_info=%08x", sched_info);
	
>    thread_edf_info = (cyg_edf_sched_info_t *) sched_info;

>    // Set priority to the supplied value.
>    priority = (cyg_priority) thread_edf_info->deadline;

>    CYG_TRACE1(1, "thread_edf_info->deadline = %d\n", thread_edf_info->deadline);
>    CYG_TRACE1(1, "thread_edf_info->wcet = %d\n", thread_edf_info->wcet);
>    CYG_TRACE1(1, "thread_edf_info->period = %d\n", thread_edf_info->period);
>    ...

I included #include <cyg/kernel/ktypes.h> to my eCos application and I
am creating threads:
> void cyg_user_start(void)
> {
>	cyg_edf_sched_info_t my_edf_info_A = {7, 11, 12};
>	cyg_mutex_init(&cliblock);
>	cyg_thread_create((cyg_addrword_t) &my_edf_info_A, simple_program, (cyg_addrword_t) 0,
>		"Thread A", (void *) stack[0], 4096, &simple_threadA, &thread_s[0]);
>	printf("Threads are created\n");
>	cyg_thread_resume(simple_threadA);

There is no problem in building eCos library, application compile and
running on the board.
But, my eCos application is TRACE ing me wrong values.

Output which I give on my board is:
*** TRACE: edf.cxx [595] <nofunc>() 'thread_edf_info->deadline = 16688624'
*** TRACE: edf.cxx [596] <nofunc>() 'thread_edf_info->wcet = 15691760'
*** TRACE: edf.cxx [597] <nofunc>() 'thread_edf_info->period = 15691760'

However, according to
>	cyg_edf_sched_info_t my_edf_info_A = {7, 11, 12};
values should be: "deadline=7; wcet=11, period=12".

I think I am doing something wrong at *struct* creation or accessing
its fields. But, I tried again and again, still having same output...

I know it is hard to answer this question without having application
on hand, but, any ideas how this come?

Regards,
Nodir.

On 23 January 2010 20:23, John Dallaway <john@dallaway.org.uk> wrote:
>
> > Last line of the assertion is:
> >
> > *** ASSERT FAIL: <1> kapi.cxx [1250]
> > Cyg_Check_Structure_Sizes::Cyg_Check_Structure_Sizes() Size check
> > failed
> >
> > Seems that kernel is checking Cyg_SchedThread_Implementation class
> > size and as I modified it it throws error. Is it safe, if I disable
> > size check? Or is there any other way to overcome this problem?
>
> It looks like you will need to add a new definition of
> CYG_SCHEDTHREAD_SCHEDIMP_MEMBERS in kapidata.h which matches the
> Cyg_SchedThread_Implementation for your new scheduler.
>
> John Dallaway
> eCos maintainer

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]