OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [freertos-6.1.1/] [Demo/] [ARM7_LPC2138_Rowley/] [threads.js] - Blame information for rev 623

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 577 jeremybenn
function decode_stack(sp)
2
{
3
  var i;
4
  var a = new Array();
5
 
6
  sp += 4; /* skip stored ulCriticalNesting */
7
 
8
  a[16] = Debug.evaluate("*(unsigned long*)" + sp);
9
 
10
  for (i = 0; i <= 15; i++)
11
  {
12
    sp += 4;
13
    a[i] = Debug.evaluate("*(unsigned long*)" + sp);
14
  }
15
 
16
  return a;
17
}
18
 
19
function add_task(task, state)
20
{
21
  var tcb, task_name, current_task, regs;
22
 
23
  current_task = Debug.evaluate("pxCurrentTCB");
24
  tcb = Debug.evaluate("*(tskTCB *)" + task);
25
 
26
  task_name = Debug.evaluate("(char*)&(*(tskTCB *)" + task + ").pcTaskName[0]");
27
  task_name = "#" + tcb.uxTCBNumber + " \"" + task_name + "\"";
28
 
29
  if (task == current_task)
30
  {
31
    state = "executing";
32
    regs = [];
33
  }
34
  else
35
  {
36
    regs = decode_stack(tcb.pxTopOfStack);
37
  }
38
 
39
  Threads.add(task_name, tcb.uxPriority, state, regs);
40
}
41
 
42
function add_list(list, state)
43
{
44
  var i, index, item, task;
45
 
46
  if (list && list.uxNumberOfItems>0)
47
  {
48
    index = list.xListEnd.pxNext;
49
 
50
    for (i = 0; i < list.uxNumberOfItems; i++)
51
    {
52
      item = Debug.evaluate("*(xListItem *)" + index);
53
 
54
      task = item ? item.pvOwner : 0;
55
 
56
      if (task)
57
        add_task(task, state);
58
 
59
      index = item.pxNext;
60
    }
61
  }
62
}
63
 
64
function update()
65
{
66
  var i, list, lists, max_priority;
67
 
68
  Threads.clear();
69
 
70
  if( Debug.evaluate("pxCurrentTCB") == 0 )
71
    return;
72
 
73
  max_priority = Debug.evaluate("uxTopUsedPriority");
74
 
75
  Threads.newqueue("Ready");
76
  for (i = max_priority; i >= 0; i--)
77
  {
78
     list = Debug.evaluate("pxReadyTasksLists[" + i + "]");
79
     add_list(list, "ready");
80
  }
81
 
82
  Threads.newqueue("Blocked");
83
  list = Debug.evaluate("pxDelayedTaskList");
84
  if (list)
85
  {
86
    list = Debug.evaluate("*(xList *)" + list);
87
    add_list(list, "blocked");
88
  }
89
 
90
  list = Debug.evaluate("pxOverflowDelayedTaskList");
91
  if (list)
92
  {
93
    list = Debug.evaluate("*(xList *)" + list);
94
    add_list(list, "blocked");
95
  }
96
 
97
  Threads.newqueue("Suspended");
98
  list = Debug.evaluate("xSuspendedTaskList");
99
  if (list)
100
  {
101
    add_list(list, "suspended");
102
  }
103
 
104
}
105
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.