[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
No subject
from
your hardware. If I understood correctly, you are using the Leon2 =
hardware
timer to generate interrupts every 50 us. Supposing that your ISR takes
about 10 us to execute (which I think is an conservative estimate), 20% =
of
your CPU usage is spent here :S. Furthermore, waking up other threads =
(with
the semaphore release) takes even more time...
Remember that an ISR takes some time to execute.=20
I would advice, if possible, to call directly the functions you need to
perform INSIDE the timer2 interrupt routine. Perhaps this is not easy or =
not
even possible :S. Since you use semaphores, I suppose you need some =
mutual
exclusion algorithms. This could only be achieved by disabling =
interrupts in
that region (with this approach). Of course, if your operations take a =
long
time to execute...your timer2 accuracy will suffer since interrupts are
disabled for a long time :S.
This is a though problem and it's hard to suggest a better solution =
without
understanding more of the system :S
Nevertheless, hope this helped...at least a bit :)
Manuel Coutinho
> -----Original Message-----
> From: rtems-users-bounces at rtems.org =
[mailto:rtems-users-bounces at rtems.org]
> On Behalf Of Arquer Stephane
> Sent: Thursday, November 20, 2008 9:03 AM
> To: rtems-users at rtems.com
> Subject: Microseconds sleep with Leon2
>=20
> Hi,
>=20
> I try to make a specific function to wake up tasks after some hundreds =
of
> =B5 seconds.
> I use the timer 2 of a Leon2 with a resolution set to 50=B5s , but I =
obtain
> a rough result with 200=B5s more than the request time.
> Does anybody have an idea ?
>=20
> I can't load the timer with a value less than 50, a lower value block =
the
> execution.
> Is it possible to manage an ISR every 10=B5s ?
>=20
> I work with rtems 4.8.0 with the patch 4.8.1diff, and a Leon2.
>=20
>=20
> Thanks for help.
>=20
> sa
>=20
>=20
>=20
>=20
> /*****/
> rtems_isr handleTimer2(rtems_vector_number vector)
> {
> int i;
> TIMER2_TICKS ++;
>=20
> if (Nbre_Timer_Actifs > 0){
> for (i=3D0; i < MAX_TIMER; i++)
> {
> if (TAB_Timer[i].actif) {
> if (TAB_Timer[i].decompte > 0) {
> TAB_Timer[i].decompte--;
> } else {
>=20
> rtems_semaphore_release(TAB_Timer[i].sem_id);
> TAB_Timer[i].actif =3D FALSE;
> }
> } /*if*/
> } /*for*/
> }/*if*/
> } /*handleTimer2*/
>=20
>=20
>=20
>=20
>=20
>=20
> _______________________________________________
> rtems-users mailing list
> rtems-users at rtems.com
> http://rtems.rtems.org/mailman/listinfo/rtems-users