source: rtems/testsuites/smptests/smp02/tasks.c @ cf288c38

4.115
Last change on this file since cf288c38 was cf288c38, checked in by Jennifer Averett <Jennifer.Averett@…>, on Jul 29, 2011 at 12:29:34 PM

2011-07-29 Jennifer Averett <Jennifer.Averett@…>

  • smp01/init.c, smp02/init.c, smp02/tasks.c, smp03/init.c, smp03/tasks.c, smp04/Makefile.am, smp04/init.c, smp05/init.c, smp06/init.c, smp07/init.c, smp08/init.c: Cleaned up tests and fixed some print statement problems.
  • smp04/tasks.c: Removed.
  • Property mode set to 100644
File size: 1.2 KB
Line 
1/*
2 *  COPYRIGHT (c) 1989-2011.
3 *  On-Line Applications Research Corporation (OAR).
4 *
5 *  The license and distribution terms for this file may be
6 *  found in the file LICENSE in this distribution or at
7 *  http://www.rtems.com/license/LICENSE.
8 *
9 *  $Id$
10 */
11
12#ifdef HAVE_CONFIG_H
13#include "config.h"
14#endif
15
16#include "system.h"
17
18void Loop(void) {
19  volatile int i;
20
21  for (i=0; i<300000; i++);
22}
23
24void LogSemaphore(
25  bool      obtained,
26  int       cpu_num,
27  uint32_t  task_index
28){
29  if (Log_index < LOG_SIZE) { 
30    /* Log the information */
31    Log[ Log_index ].IsLocked   = obtained;
32    Log[ Log_index ].cpu_num    = cpu_num;
33    Log[ Log_index ].task_index = task_index;
34    Log_index++;
35  }
36}
37
38rtems_task Test_task(
39  rtems_task_argument task_index
40)
41{
42  int               cpu_num;
43  rtems_status_code sc;
44
45  cpu_num = bsp_smp_processor_id();
46
47  do {
48
49    /* Poll to obtain the synchronization semaphore */
50    do {
51      sc = rtems_semaphore_obtain( Semaphore, RTEMS_NO_WAIT, 0 );
52    } while (sc != RTEMS_SUCCESSFUL );
53
54    LogSemaphore(true, cpu_num, task_index);
55    LogSemaphore(false, cpu_num, task_index);
56 
57    rtems_semaphore_release( Semaphore );
58  } while(1);
59}
Note: See TracBrowser for help on using the repository browser.