[En-Nut-Discussion] Set Idle Heartbeat on entry and reset on leave of idle function
Ulrich Prinz
uprinz2 at netscape.net
Thu Apr 29 20:46:13 CEST 2010
Hi!
Seems, that you're really lost, and I assume you're a Padawan Apprentice
not a Jedi...
Can you please keep the Netiquette and stop replying to posts which do
not have anything to do with your topic.
Unfortunately I have lost your initial question, it's somewhere inside
another thread...
It was something with locked interrupts if I recall correct?
Best regards, Ulrich
Am 29.04.2010 18:41, schrieb Lost Jedi:
> Hi,
>
> Not sure if this is relevant to an ARM chip.
>
> In either case, the main thread isn't hanging.. its only the interrupt handler that is hanging. All other functions carry on normally. Once the ISR is cleared, the handler resumes too.
>
>
> Warm Regards
>
>
> --- On Thu, 4/29/10, Uwe Bonnes<bon at elektron.ikp.physik.tu-darmstadt.de> wrote:
>
>> From: Uwe Bonnes<bon at elektron.ikp.physik.tu-darmstadt.de>
>> Subject: [En-Nut-Discussion] Set Idle Heartbeat on entry and reset on leave of idle function
>> To: en-nut-discussion at egnite.de
>> Date: Thursday, April 29, 2010, 10:46 AM
>> Hello,
>>
>> at present, in arch/avr/os/nutinit.c the idle heartbeat
>> function toggles the
>> heartbeat bit once in the idle function. That way, you
>> can't see, how long
>> the CPU stays idle.
>>
>> Appended patch clears the heartbeart bit on idle-entry and
>> sets on
>> idle-leave. That way, you can see on the scope how long the
>> CPU is idle.
>> It also saves a byte on the stack and probably doesn't
>> increas cycle usage.
>>
>> --
>> Uwe Bonnes
>> bon at elektron.ikp.physik.tu-darmstadt.de
>>
>> Institut fuer Kernphysik Schlossgartenstrasse 9
>> 64289 Darmstadt
>> --------- Tel. 06151 162516 -------- Fax. 06151 164321
>> ----------
>> Index: conf/os/os.nut
>> ===================================================================
>> Index: arch/avr/os/nutinit.c
>> ===================================================================
>> --- arch/avr/os/nutinit.c (Revision
>> 2181)
>> +++ arch/avr/os/nutinit.c (Arbeitskopie)
>> @@ -473,9 +473,6 @@
>> #if defined(__GNUC__)&&
>> defined(__AVR_ENHANCED__)
>> uint8_t sleep_mode;
>> #endif
>> -#ifdef IDLE_HEARTBEAT_BIT
>> - uint8_t beat = 0;
>> -#endif
>>
>> /* Initialize system timers. */
>> NutTimerInit();
>> @@ -494,16 +491,6 @@
>> NutThreadYield();
>> NutThreadDestroy();
>>
>> -#ifdef IDLE_HEARTBEAT_BIT
>> - if ((beat = !beat) == 0) {
>> - //UDR = '*';
>> -
>> cbi(IDLE_HEARTBEAT_PORT, IDLE_HEARTBEAT_BIT);
>> - }
>> - else {
>> -
>> sbi(IDLE_HEARTBEAT_PORT, IDLE_HEARTBEAT_BIT);
>> - }
>> - sbi(IDLE_HEARTBEAT_DDR,
>> IDLE_HEARTBEAT_BIT);
>> -#endif
>>
>> #if defined(__GNUC__)&&
>> defined(__AVR_ENHANCED__)
>> if (idle_sleep_mode
>> != SLEEP_MODE_NONE) {
>> @@ -517,11 +504,17 @@
>>
>> uint8_t bitkeeper = bit_is_set(XMCRB,
>> XMBK);
>>
>> cbi(XMCRB, XMBK); // disable buskeeper
>> #endif
>> - /* Note:
>> avr-libc has a sleep_mode() function, but it's broken for
>> +#ifdef IDLE_HEARTBEAT_BIT
>> +
>> cbi(IDLE_HEARTBEAT_PORT, IDLE_HEARTBEAT_BIT);
>> +#endif
>> + /*
>> Note: avr-libc has a sleep_mode() function, but it's
>> broken for
>>
>> AT90CAN128 with avr-libc version earlier
>> than 1.2 */
>>
>> AVR_SLEEP_CTRL_REG |= _BV(SE);
>>
>> __asm__ __volatile__ ("sleep" "\n\t" ::
>> );
>>
>> AVR_SLEEP_CTRL_REG&= ~_BV(SE);
>> +#ifdef IDLE_HEARTBEAT_BIT
>> +
>> sbi(IDLE_HEARTBEAT_PORT, IDLE_HEARTBEAT_BIT);
>> +#endif
>> #ifdef IDLE_THREAD_ADC_OFF
>> if
>> (bitkeeper) {
>>
>> sbi(XMCRB, XMBK); // re-enable buskeeper
>> _______________________________________________
>> http://lists.egnite.de/mailman/listinfo/en-nut-discussion
>>
>
>
>
>
> _______________________________________________
> http://lists.egnite.de/mailman/listinfo/en-nut-discussion
More information about the En-Nut-Discussion
mailing list