From: "Huang Qiang" <jameshq@liverpool.ac.uk>
To: "eCos" <ecos-discuss@sources.redhat.com>,
"Andrew Lunn" <andrew.lunn@ascom.ch>
Subject: RE: [ECOS] Strange Problem in cyg_thread_delay( )?
Date: Mon, 23 Apr 2001 04:45:00 -0000 [thread overview]
Message-ID: <KIEBICHBADHFCLGCKOPDIEEPCBAA.jameshq@liv.ac.uk> (raw)
In-Reply-To: <20010423130822.E2129@biferten.ma.tech.ascom.ch>
My code listed as bellow:
****************************************************************************
**************************
****************************************************************************
**************************
#define IOPDATA ((volatile unsigned *)(0x03FF5008)) // define the LED
PORT address
#include <cyg/kernel/kapi.h>
void delay(int cnt); // delay routine
cyg_thread thread_s;
char stack[4096];
cyg_handle_t LED_thread;
cyg_thread_entry_t LED_program;
int dispcnt; // display counter
void cyg_user_start(void)
{
cyg_thread_create(4,LED_program, (cyg_addrword_t) 0, "LED Thread",
(void *) stack,4096, &LED_thread, &thread_s);
dispcnt = 0;
*IOPDATA = 0x00; // clear display of the LED
(note: bit4~bit7 represent the LED1~LED4 on the ARM Evaluator7T board)
delay(20); // manual delay
cyg_thread_resume(LED_thread); // resume the led thread
}
void LED_program(cyg_addrword_t data)
{
for(;;)
{
if(dispcnt>=16) // ensure the display counter not exceed 4-bit. (value 15)(we got 4 led on the evaluator7T board so 4 bits)
dispcnt = 0;
switch(dispcnt)
{
case 0:
*IOPDATA = 0x00; // bit4~bit7 as the LED1~LED4 on the Evaluator7T board
break;
case 1:
*IOPDATA = 0x10; //bit4~bit7 as the LED1~LED4 on the Evaluator7T board
break;
case 2:
*IOPDATA = 0x20; //bit4~bit7 as the LED1~LED4 on the Evaluator7T board
break;
case 3:
*IOPDATA = 0x30; //bit4~bit7 as the LED1~LED4 on the Evaluator7T board
break;
case 4:
*IOPDATA = 0x40;
break;
case 5:
*IOPDATA = 0x50;
break;
case 6:
*IOPDATA = 0x60;
break;
case 7:
*IOPDATA = 0x70;
break;
case 8:
*IOPDATA = 0x80;
break;
case 9:
*IOPDATA = 0x90;
break;
case 10:
*IOPDATA = 0xa0;
break;
case 11:
*IOPDATA = 0xb0;
break;
case 12:
*IOPDATA = 0xc0;
break;
case 13:
*IOPDATA = 0xd0;
break;
case 14:
*IOPDATA = 0xe0;
break;
case 15:
*IOPDATA = 0xf0;
break;
}
cyg_thread_delay(200);
dispcnt++;
}
}
// manual delay routine
void delay(int cnt)
{
int cnt1, cnt2, cnt3;
for(cnt1=0;cnt1<40000;cnt1++)
{
for(cnt2=0;cnt2<cnt;cnt2++)
cnt3 = 0;
}
}
*************************************************************************************************
*************************************************************************************************
The LED comes to a 2 the halted forever. ( means it pass two cyg_thread_delay(200) then die)
===================================================================================================
===================================================================================================
-----Original Messa
ge-----
From: Andrew Lunn [ mailto:andrew.lunn@ascom.ch ]
Sent: 23 April 2001 12:08
To: Huang Qiang
Cc: eCos
Subject: Re: [ECOS] Strange Problem in cyg_thread_delay( )?
On Mon, Apr 23, 2001 at 12:03:05PM +0100, Huang Qiang wrote:
> Dear all:
> I am using ARM Evaluator7T . My test program has a sigle thread
> runnning, while I call cyg_thread_delay(200) each time in the thread
(loop).
> It pass the first and second call to the cyg_thread_delay(200), but halted
> at the third call to the cyg_thread_delay. What's wrong with it? Can
anyone
> help me?
> Thanks a lot!
> james
Given the little information you have provided there could be lots of
possibilites....
Have you started the schedular?
Is your stack big enough?
Have you memset(0,0,10000);
Have you built eCos with assertions enables in package infra? That may
help.
Supply more details and then we may be able to help.
Andrew
next prev parent reply other threads:[~2001-04-23 4:45 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-04-23 4:02 Huang Qiang
2001-04-24 20:27 ` Andrew Lunn
2001-04-23 4:45 ` Huang Qiang [this message]
2001-04-26 2:43 ` Robert Cragie
2001-04-23 4:46 Huang Qiang
2001-04-24 20:18 ` Andrew Lunn
2001-04-23 5:24 Nielsen Linus
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=KIEBICHBADHFCLGCKOPDIEEPCBAA.jameshq@liv.ac.uk \
--to=jameshq@liverpool.ac.uk \
--cc=andrew.lunn@ascom.ch \
--cc=ecos-discuss@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).