Add port to Zilogic Systems ZKIT-ARM-1769 board (more coming)

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5673 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo 2013-02-26 14:09:43 +00:00
parent 5ff8bb8c4f
commit 11b87dd5d9

View File

@ -83,7 +83,8 @@ static void get_primes(int *count, int *last)
{ {
int number; int number;
int local_count = 0; int local_count = 0;
*last = 0; // to make compiler happy
*last = 0; /* To make the compiler happy */
for (number = 1; number < CONFIG_EXAMPLES_OSTEST_RR_RANGE; number++) for (number = 1; number < CONFIG_EXAMPLES_OSTEST_RR_RANGE; number++)
{ {
@ -114,10 +115,12 @@ static void get_primes(int *count, int *last)
* Name: get_primes_thread * Name: get_primes_thread
********************************************************************************/ ********************************************************************************/
static void *get_primes_thread(void *parameter) static FAR void *get_primes_thread(FAR void *parameter)
{ {
int id = (int)parameter; int id = (int)parameter;
int i, count, last; int count;
int last;
int i;
printf("get_primes_thread id=%d started, looking for primes < %d, doing %d run(s)\n", printf("get_primes_thread id=%d started, looking for primes < %d, doing %d run(s)\n",
id, CONFIG_EXAMPLES_OSTEST_RR_RANGE, CONFIG_EXAMPLES_OSTEST_RR_RUNS); id, CONFIG_EXAMPLES_OSTEST_RR_RANGE, CONFIG_EXAMPLES_OSTEST_RR_RUNS);
@ -154,14 +157,14 @@ void rr_test(void)
status = pthread_attr_init(&attr); status = pthread_attr_init(&attr);
if (status != OK) if (status != OK)
{ {
printf("rr_test: pthread_attr_init failed, status=%d\n", status); printf("rr_test: ERROR: pthread_attr_init failed, status=%d\n", status);
} }
sparam.sched_priority = sched_get_priority_min(SCHED_FIFO); sparam.sched_priority = sched_get_priority_min(SCHED_FIFO);
status = pthread_attr_setschedparam(&attr, &sparam); status = pthread_attr_setschedparam(&attr, &sparam);
if (status != OK) if (status != OK)
{ {
printf("rr_test: pthread_attr_setschedparam failed, status=%d\n", status); printf("rr_test: ERROR: pthread_attr_setschedparam failed, status=%d\n", status);
} }
else else
{ {
@ -171,7 +174,7 @@ void rr_test(void)
status = pthread_attr_setschedpolicy(&attr, SCHED_RR); status = pthread_attr_setschedpolicy(&attr, SCHED_RR);
if (status != OK) if (status != OK)
{ {
printf("rr_test: pthread_attr_setschedpolicy failed, status=%d\n", status); printf("rr_test: ERROR: pthread_attr_setschedpolicy failed, status=%d\n", status);
} }
else else
{ {
@ -180,23 +183,25 @@ void rr_test(void)
printf("rr_test: Starting first get_primes_thread\n"); printf("rr_test: Starting first get_primes_thread\n");
status = pthread_create(&get_primes1_thread, &attr, get_primes_thread, (void*)1); status = pthread_create(&get_primes1_thread, &attr, get_primes_thread, (FAR void *)1);
if (status != 0) if (status != 0)
{ {
printf("rr_test: Error in thread 1 creation, status=%d\n", status); printf(" ERROR: Thread 1 creation failed: %d\n", status);
} }
printf(" First get_primes_thread: %d\n", (int)get_primes1_thread);
printf("rr_test: Starting second get_primes_thread\n"); printf("rr_test: Starting second get_primes_thread\n");
status = pthread_create(&get_primes2_thread, &attr, get_primes_thread, (void*)2); status = pthread_create(&get_primes2_thread, &attr, get_primes_thread, (FAR void *)2);
if (status != 0) if (status != 0)
{ {
printf("rr_test: Error in thread 2 creation, status=%d\n", status); printf(" ERROR: Thread 2 creation failed: %d\n", status);
} }
printf(" Second get_primes_thread: %d\n", (int)get_primes2_thread);
printf("rr_test: Waiting for threads to complete -- this should take awhile\n"); printf("rr_test: Waiting for threads to complete -- this should take awhile\n");
printf("rr_test: If RR scheduling is working, they should start and complete at\n"); printf(" If RR scheduling is working, they should start and complete at\n");
printf("rr_test: about the same time\n"); printf(" about the same time\n");
pthread_join(get_primes2_thread, &result); pthread_join(get_primes2_thread, &result);
pthread_join(get_primes1_thread, &result); pthread_join(get_primes1_thread, &result);