source: rtems/cpukit/libmisc/capture/capture.h @ c5782a2

4.115
Last change on this file since c5782a2 was c5782a2, checked in by Mathew Kallada <matkallada@…>, on 12/28/12 at 17:16:29

Header File Doxygen Enhancement Task #7

  • Property mode set to 100644
File size: 24.4 KB
Line 
1/**
2 * @file rtems/capture.h
3 *
4 * @brief Capture Engine Component of the RTEMS Measurement and
5 * Monitoring System
6 *
7 * This is the Capture Engine component of the RTEMS Measurement and
8 * Monitoring system.
9 */
10
11/*
12  ------------------------------------------------------------------------
13
14  Copyright Objective Design Systems Pty Ltd, 2002
15  All rights reserved Objective Design Systems Pty Ltd, 2002
16  Chris Johns (ccj@acm.org)
17
18  COPYRIGHT (c) 1989-1998.
19  On-Line Applications Research Corporation (OAR).
20
21  The license and distribution terms for this file may be
22  found in the file LICENSE in this distribution.
23
24  This software with is provided ``as is'' and with NO WARRANTY.
25
26  ------------------------------------------------------------------------
27
28  RTEMS Performance Monitoring and Measurement Framework.
29  This is the Capture Engine component.
30
31*/
32
33#ifndef __CAPTURE_H_
34#define __CAPTURE_H_
35
36#ifdef __cplusplus
37extern "C" {
38#endif
39
40#include <rtems.h>
41
42/**
43 * The number of tasks in a trigger group.
44 */
45#define RTEMS_CAPTURE_TRIGGER_TASKS (32)
46
47/**
48 * rtems_capture_from_t
49 *
50 *  DESCRIPTION:
51 *
52 * A from capture is a task id and a mask for the type of
53 * from trigger we are interested in. The mask uses the same
54 * bit maps as the flags field in the control structure. There
55 * will only be a from type trigger if the flags in the control
56 * structure has the specific *_BY bit set.
57 */
58typedef struct rtems_capture_from_s
59{
60  rtems_name name;
61  rtems_id   id;
62  uint32_t   trigger;
63} rtems_capture_from_t;
64
65/**
66 * rtems_capture_control_t
67 *
68 *  DESCRIPTION:
69 *
70 * RTEMS control holds the trigger and watch configuration for a group of
71 * tasks with the same name. The flags hold global control flags.
72 *
73 * The to_triggers fields holds triggers TO this task. The from_triggers holds
74 * triggers from this task. The by_triggers is an OR or triggers which are
75 * caused BY the task listed TO this task. The by_valid flag which entries
76 * in by are valid.
77 */
78typedef struct rtems_capture_control_s
79{
80  rtems_name                      name;
81  rtems_id                        id;
82  uint32_t                        flags;
83  uint32_t                        to_triggers;
84  uint32_t                        from_triggers;
85  uint32_t                        by_triggers;
86  uint32_t                        by_valid;
87  rtems_capture_from_t            by[RTEMS_CAPTURE_TRIGGER_TASKS];
88  struct rtems_capture_control_s* next;
89} rtems_capture_control_t;
90
91/**
92 * The from_valid mask.
93 */
94#define RTEMS_CAPTURE_CONTROL_FROM_MASK(_s) \
95 (UINT32_C(1) << (RTEMS_CAPTURE_TRIGGER_TASKS - ((_s) + 1)))
96
97/**
98 * Control flags.
99 */
100#define RTEMS_CAPTURE_WATCH         (1U << 0)
101
102/**
103 * Control triggers.
104 */
105#define RTEMS_CAPTURE_SWITCH        (1 << 0)
106#define RTEMS_CAPTURE_CREATE        (1 << 1)
107#define RTEMS_CAPTURE_START         (1 << 2)
108#define RTEMS_CAPTURE_RESTART       (1 << 3)
109#define RTEMS_CAPTURE_DELETE        (1 << 4)
110#define RTEMS_CAPTURE_BEGIN         (1 << 5)
111#define RTEMS_CAPTURE_EXITTED       (1 << 6)
112
113#define RTEMS_CAPTURE_FROM_TRIGS    (RTEMS_CAPTURE_SWITCH  | \
114                                     RTEMS_CAPTURE_CREATE | \
115                                     RTEMS_CAPTURE_START | \
116                                     RTEMS_CAPTURE_RESTART | \
117                                     RTEMS_CAPTURE_DELETE)
118
119#define RTEMS_CAPTURE_TO_TRIGS      (RTEMS_CAPTURE_SWITCH | \
120                                     RTEMS_CAPTURE_CREATE | \
121                                     RTEMS_CAPTURE_START | \
122                                     RTEMS_CAPTURE_RESTART | \
123                                     RTEMS_CAPTURE_DELETE | \
124                                     RTEMS_CAPTURE_BEGIN | \
125                                     RTEMS_CAPTURE_EXITTED)
126
127/**
128 * rtems_capture_task_t
129 *
130 *  DESCRIPTION:
131 *
132 * RTEMS capture control provdes the information about a task, along
133 * with its trigger state. The control is referenced by each
134 * capture record. This is information neeed by the decoder. The
135 * capture record cannot assume the task will exist when the record is
136 * dumped via the target interface so task info needed for tracing is
137 * copied and held here. Once the references in the trace buffer
138 * have been removed and the task is deleted this structure is
139 * released back to the heap.
140 *
141 * The inline helper functions provide more details about the info
142 * contained in this structure.
143 *
144 * Note, the tracer code exploits the fact an rtems_name is a
145 * 32bit value.
146 */
147typedef struct rtems_capture_task_s
148{
149  rtems_name                   name;
150  rtems_id                     id;
151  uint32_t                     flags;
152  uint32_t                     refcount;
153  rtems_tcb*                   tcb;
154  uint32_t                     in;
155  uint32_t                     out;
156  rtems_task_priority          start_priority;
157  uint32_t                     stack_size;
158  uint32_t                     stack_clean;
159  uint32_t                     ticks;
160  uint32_t                     tick_offset;
161  uint32_t                     ticks_in;
162  uint32_t                     tick_offset_in;
163  uint32_t                     last_ticks;
164  uint32_t                     last_tick_offset;
165  rtems_capture_control_t*     control;
166  struct rtems_capture_task_s* forw;
167  struct rtems_capture_task_s* back;
168} rtems_capture_task_t;
169
170/**
171 * Task flags.
172 */
173#define RTEMS_CAPTURE_TRACED  (1U << 0)
174
175/*
176 * rtems_capture_record_t
177 *
178 *  DESCRIPTION:
179 *
180 * RTEMS capture record. This is a record that is written into
181 * the buffer. The events includes the priority of the task
182 * at the time of the context switch.
183 */
184typedef struct rtems_capture_record_s
185{
186  rtems_capture_task_t* task;
187  uint32_t              events;
188  uint32_t              ticks;
189  uint32_t              tick_offset;
190} rtems_capture_record_t;
191
192/**
193 * The capture record event flags.
194 */
195#define RTEMS_CAPTURE_REAL_PRI_EVENT_MASK UINT32_C (0x000000ff)
196#define RTEMS_CAPTURE_CURR_PRI_EVENT_MASK UINT32_C (0x0000ff00)
197#define RTEMS_CAPTURE_REAL_PRIORITY_EVENT (0)
198#define RTEMS_CAPTURE_CURR_PRIORITY_EVENT (8)
199#define RTEMS_CAPTURE_EVENT_START         (16)
200#define RTEMS_CAPTURE_CREATED_BY_EVENT    UINT32_C (0x00010000)
201#define RTEMS_CAPTURE_CREATED_EVENT       UINT32_C (0x00020000)
202#define RTEMS_CAPTURE_STARTED_BY_EVENT    UINT32_C (0x00040000)
203#define RTEMS_CAPTURE_STARTED_EVENT       UINT32_C (0x00080000)
204#define RTEMS_CAPTURE_RESTARTED_BY_EVENT  UINT32_C (0x00100000)
205#define RTEMS_CAPTURE_RESTARTED_EVENT     UINT32_C (0x00200000)
206#define RTEMS_CAPTURE_DELETED_BY_EVENT    UINT32_C (0x00400000)
207#define RTEMS_CAPTURE_DELETED_EVENT       UINT32_C (0x00800000)
208#define RTEMS_CAPTURE_BEGIN_EVENT         UINT32_C (0x01000000)
209#define RTEMS_CAPTURE_EXITTED_EVENT       UINT32_C (0x02000000)
210#define RTEMS_CAPTURE_SWITCHED_OUT_EVENT  UINT32_C (0x04000000)
211#define RTEMS_CAPTURE_SWITCHED_IN_EVENT   UINT32_C (0x08000000)
212#define RTEMS_CAPTURE_TIMESTAMP           UINT32_C (0x10000000)
213#define RTEMS_CAPTURE_EVENT_END           (28)
214
215/**
216 * rtems_capture_trigger_mode_t
217 *
218 *  DESCRIPTION:
219 *
220 * The types of trigger modes that exist.
221 */
222typedef enum rtems_capture_trigger_mode_e
223{
224  rtems_capture_to_any,
225  rtems_capture_from_any,
226  rtems_capture_from_to
227} rtems_capture_trigger_mode_t;
228
229/**
230 * rtems_capture_trigger_t
231 *
232 *  DESCRIPTION:
233 *
234 * The types of triggers that exist.
235 */
236typedef enum rtems_capture_trigger_e
237{
238  rtems_capture_switch,
239  rtems_capture_create,
240  rtems_capture_start,
241  rtems_capture_restart,
242  rtems_capture_delete,
243  rtems_capture_begin,
244  rtems_capture_exitted
245} rtems_capture_trigger_t;
246
247/**
248 * rtems_capture_timestamp
249 *
250 *  DESCRIPTION:
251 *
252 * This defines the callout handler to obtain a time stamp. The
253 * value returned is time count since the last read.
254 *
255 */
256
257typedef void (*rtems_capture_timestamp)
258                (uint32_t* ticks, uint32_t* micro);
259
260/**
261 * rtems_capture_open
262 *
263 *  DESCRIPTION:
264 *
265 * This function initialises the realtime trace manager allocating the
266 * capture buffer. It is assumed we have a working heap at stage of
267 * initialisation.
268 *
269 */
270rtems_status_code
271rtems_capture_open (uint32_t                size,
272                    rtems_capture_timestamp timestamp);
273
274/**
275 * rtems_capture_close
276 *
277 *  DESCRIPTION:
278 *
279 * This function shutdowns the tracer and release any claimed
280 * resources.
281 */
282rtems_status_code
283rtems_capture_close (void);
284
285/**
286 * rtems_capture_control
287 *
288 *  DESCRIPTION:
289 *
290 * This function allows control of tracing at a global level.
291 */
292rtems_status_code
293rtems_capture_control (bool enable);
294
295/**
296 * rtems_capture_monitor
297 *
298 *  DESCRIPTION:
299 *
300 * This function enable the monitor mode. When in the monitor mode
301 * the tasks are monitored but no data is saved. This can be used
302 * to profile the load on a system.
303 */
304rtems_status_code
305rtems_capture_monitor (bool enable);
306
307/*
308 * rtems_capture_flush
309 *
310 *  DESCRIPTION:
311 *
312 * This function flushes the trace buffer. The prime parameter allows the
313 * capture engine to also be primed again.
314 */
315rtems_status_code
316rtems_capture_flush (bool prime);
317
318/**
319 * rtems_capture_watch_add
320 *
321 *  DESCRIPTION:
322 *
323 * This function defines a watch for a specific task given a name. A watch
324 * causes it to be traced either in or out of context. The watch can be
325 * optionally enabled or disabled with the set routine. It is disabled by
326 * default.
327 */
328rtems_status_code
329rtems_capture_watch_add (rtems_name name, rtems_id id);
330
331/**
332 * rtems_capture_watch_del
333 *
334 *  DESCRIPTION:
335 *
336 * This function removes a watch for a specific task given a name. The task
337 * description will still exist if referenced by a trace record in the trace
338 * buffer or a global watch is defined.
339 */
340rtems_status_code
341rtems_capture_watch_del (rtems_name name, rtems_id id);
342
343/**
344 * rtems_capture_watch_set
345 *
346 *  DESCRIPTION:
347 *
348 * This function allows control of a watch. The watch can be enabled or
349 * disabled.
350 */
351rtems_status_code
352rtems_capture_watch_ctrl (rtems_name    name,
353                          rtems_id      id,
354                          bool enable);
355
356/**
357 * rtems_capture_watch_global
358 *
359 *  DESCRIPTION:
360 *
361 * This function allows control of a global watch. The watch can
362 * be enabled or disabled. A global watch configures all tasks below
363 * the ceiling and above the floor to be traced.
364 */
365rtems_status_code
366rtems_capture_watch_global (bool enable);
367
368/**
369 * rtems_capture_watch_global_on
370 *
371 *  DESCRIPTION:
372 *
373 * This function returns the global watch state.
374 */
375bool
376rtems_capture_watch_global_on (void);
377
378/**
379 * rtems_capture_watch_ceiling
380 *
381 *  DESCRIPTION:
382 *
383 * This function sets a watch ceiling. Tasks at or greating that the
384 * ceiling priority are not watched. This is a simple way to monitor
385 * an application and exclude system tasks running at a higher
386 * priority level.
387 */
388rtems_status_code
389rtems_capture_watch_ceiling (rtems_task_priority ceiling);
390
391/**
392 * rtems_capture_watch_get_ceiling
393 *
394 *  DESCRIPTION:
395 *
396 * This function gets the watch ceiling.
397 */
398rtems_task_priority
399rtems_capture_watch_get_ceiling (void);
400
401/**
402 * rtems_capture_watch_floor
403 *
404 *  DESCRIPTION:
405 *
406 * This function sets a watch floor. Tasks at or less that the
407 * floor priority are not watched. This is a simple way to monitor
408 * an application and exclude system tasks running at a lower
409 * priority level.
410 */
411rtems_status_code
412rtems_capture_watch_floor (rtems_task_priority floor);
413
414/**
415 * rtems_capture_watch_get_floor
416 *
417 *  DESCRIPTION:
418 *
419 * This function gets the watch floor.
420 */
421rtems_task_priority
422rtems_capture_watch_get_floor (void);
423
424/**
425 * rtems_capture_set_trigger
426 *
427 *  DESCRIPTION:
428 *
429 * This function sets a trigger.
430 *
431 * This set trigger routine will create a trace control for the
432 * target task. The task list is searched and any existing tasks
433 * are linked to the new control.
434 *
435 * We can have a number of tasks that have the same name so we
436 * search using names. This means a number of tasks can be
437 * linked to single control.
438 */
439rtems_status_code
440rtems_capture_set_trigger (rtems_name                   from_name,
441                           rtems_id                     from_id,
442                           rtems_name                   to_name,
443                           rtems_id                     to_id,
444                           rtems_capture_trigger_mode_t mode,
445                           rtems_capture_trigger_t      trigger);
446
447/**
448 * rtems_capture_clear_trigger
449 *
450 *  DESCRIPTION:
451 *
452 * This function clears a trigger.
453 *
454 * This clear trigger routine will not clear a watch.
455 */
456rtems_status_code
457rtems_capture_clear_trigger (rtems_name                   from_name,
458                             rtems_id                     from_id,
459                             rtems_name                   to_name,
460                             rtems_id                     to_id,
461                             rtems_capture_trigger_mode_t mode,
462                             rtems_capture_trigger_t      trigger);
463
464/**
465 * rtems_capture_read
466 *
467 *  DESCRIPTION:
468 *
469 * This function reads a number of records from the capture buffer.
470 * The user can optionally block and wait until the buffer as a
471 * specific number of records available or a specific time has
472 * elasped.
473 *
474 * The function returns the number of record that is has that are
475 * in a continous block of memory. If the number of available records
476 * wrap then only those records are provided. This removes the need for
477 * caller to be concerned about buffer wrappings. If the number of
478 * requested records cannot be met due to the wrapping of the records
479 * less than the specified number will be returned.
480 *
481 * The user must release the records. This is achieved with a call to
482 * rtems_capture_release. Calls this function without a release will
483 * result in at least the same number of records being released.
484 *
485 * The 'threshold' parameter is the number of records that must be
486 * captured before returning. If a timeout period is specified (non-0)
487 * any captured records will be returned. These parameters stop
488 * thrashing occuring for a small number of records, yet allows
489 * a user configured latiency to be applied for single events.
490 *
491 * The 'timeout' parameter is in micro-seconds. A value of 0 will
492 * disable the timeout.
493 *
494 */
495rtems_status_code
496rtems_capture_read (uint32_t                 threshold,
497                    uint32_t                 timeout,
498                    uint32_t*                read,
499                    rtems_capture_record_t** recs);
500
501/**
502 * rtems_capture_release
503 *
504 *  DESCRIPTION:
505 *
506 * This function releases the requested number of record slots back
507 * to the capture engine. The count must match the number read.
508 */
509rtems_status_code
510rtems_capture_release (uint32_t count);
511
512/**
513 * rtems_capture_tick_time
514 *
515 *  DESCRIPTION:
516 *
517 * This function returns the tick period in micro-seconds.
518 */
519uint32_t
520rtems_capture_tick_time (void);
521
522/*
523 * rtems_capture_tick_time
524 *
525 *  DESCRIPTION:
526 *
527 * This function returns the tick period in micro-seconds.
528 */
529uint32_t
530rtems_capture_tick_time (void);
531
532/**
533 * rtems_capture_event_text
534 *
535 *  DESCRIPTION:
536 *
537 * This function returns a string for an event based on the bit in the
538 * event. The functions takes the bit offset as a number not the bit
539 * set in a bit map.
540 */
541const char*
542rtems_capture_event_text (int event);
543
544/**
545 * rtems_capture_get_task_list
546 *
547 *  DESCRIPTION:
548 *
549 * This function returns the head of the list of tasks that the
550 * capture engine has detected.
551 */
552rtems_capture_task_t*
553rtems_capture_get_task_list (void);
554
555/**
556 * rtems_capture_next_task
557 *
558 *  DESCRIPTION:
559 *
560 * This function returns the pointer to the next task in the list. The
561 * pointer NULL terminates the list.
562 */
563static inline rtems_capture_task_t*
564rtems_capture_next_task (rtems_capture_task_t* task)
565{
566  return task->forw;
567}
568
569/**
570 * rtems_capture_task_valid
571 *
572 *  DESCRIPTION:
573 *
574 * This function returns true if the task control block points to
575 * a valid task.
576 */
577static inline bool
578rtems_capture_task_valid (rtems_capture_task_t* task)
579{
580  return task->tcb != NULL;
581}
582
583/**
584 * rtems_capture_task_id
585 *
586 *  DESCRIPTION:
587 *
588 * This function returns the task id.
589 */
590static inline rtems_id
591rtems_capture_task_id (rtems_capture_task_t* task)
592{
593  return task->id;
594}
595
596/**
597 * rtems_capture_task_state
598 *
599 *  DESCRIPTION:
600 *
601 * This function returns the task state.
602 */
603static inline States_Control
604rtems_capture_task_state (rtems_capture_task_t* task)
605{
606  if (rtems_capture_task_valid (task))
607    return task->tcb->current_state;
608  return 0;
609}
610
611/**
612 * rtems_capture_task_name
613 *
614 *  DESCRIPTION:
615 *
616 * This function returns the task name.
617 */
618static inline rtems_name
619rtems_capture_task_name (rtems_capture_task_t* task)
620{
621  return task->name;
622}
623
624/**
625 * rtems_capture_task_flags
626 *
627 *  DESCRIPTION:
628 *
629 * This function returns the task flags.
630 */
631static inline uint32_t
632rtems_capture_task_flags (rtems_capture_task_t* task)
633{
634  return task->flags;
635}
636
637/**
638 * rtems_capture_task_control
639 *
640 *  DESCRIPTION:
641 *
642 * This function returns the task control if present.
643 */
644static inline rtems_capture_control_t*
645rtems_capture_task_control (rtems_capture_task_t* task)
646{
647  return task->control;
648}
649
650/**
651 * rtems_capture_task_control_flags
652 *
653 *  DESCRIPTION:
654 *
655 * This function returns the task control flags if a control is present.
656 */
657static inline uint32_t
658rtems_capture_task_control_flags (rtems_capture_task_t* task)
659{
660  if (!task->control)
661    return 0;
662  return task->control->flags;
663}
664
665/**
666 * rtems_capture_task_switched_in
667 *
668 *  DESCRIPTION:
669 *
670 * This function returns the number of times the task has
671 * been switched into context.
672 */
673static inline uint32_t
674rtems_capture_task_switched_in (rtems_capture_task_t* task)
675{
676  return task->in;
677}
678
679/**
680 * rtems_capture_task_switched_out
681 *
682 *  DESCRIPTION:
683 *
684 * This function returns the number of times the task has
685 * been switched out of context.
686 */
687static inline uint32_t
688rtems_capture_task_switched_out (rtems_capture_task_t* task)
689{
690  return task->out;
691}
692
693/**
694 * rtems_capture_task_curr_priority
695 *
696 *  DESCRIPTION:
697 *
698 * This function returns the tasks start priority. The tracer needs this
699 * to track where the task's priority goes.
700 */
701static inline rtems_task_priority
702rtems_capture_task_start_priority (rtems_capture_task_t* task)
703{
704  return task->start_priority;
705}
706
707/**
708 * rtems_capture_task_real_priority
709 *
710 *  DESCRIPTION:
711 *
712 * This function returns the tasks real priority.
713 */
714static inline rtems_task_priority
715rtems_capture_task_real_priority (rtems_capture_task_t* task)
716{
717  if (rtems_capture_task_valid (task))
718    return task->tcb->real_priority;
719  return 0;
720}
721
722/**
723 * rtems_capture_task_curr_priority
724 *
725 *  DESCRIPTION:
726 *
727 * This function returns the tasks current priority.
728 */
729static inline rtems_task_priority
730rtems_capture_task_curr_priority (rtems_capture_task_t* task)
731{
732  if (rtems_capture_task_valid (task))
733    return task->tcb->current_priority;
734  return 0;
735}
736
737/**
738 * rtems_capture_task_stack_usage
739 *
740 *  DESCRIPTION:
741 *
742 * This function updates the stack usage. The task control block
743 * is updated.
744 */
745uint32_t
746rtems_capture_task_stack_usage (rtems_capture_task_t* task);
747
748/**
749 * rtems_capture_task_stack_size
750 *
751 *  DESCRIPTION:
752 *
753 * This function returns the task's stack size.
754 */
755static inline uint32_t
756rtems_capture_task_stack_size (rtems_capture_task_t* task)
757{
758  return task->stack_size;
759}
760
761/**
762 * rtems_capture_task_stack_used
763 *
764 *  DESCRIPTION:
765 *
766 * This function returns the amount of stack used.
767 */
768static inline uint32_t
769rtems_capture_task_stack_used (rtems_capture_task_t* task)
770{
771  return task->stack_size - task->stack_clean;
772}
773
774/**
775 * rtems_capture_task_ticks
776 *
777 *  DESCRIPTION:
778 *
779 * This function returns the current execution time as ticks.
780 */
781static inline uint32_t
782rtems_capture_task_ticks (rtems_capture_task_t* task)
783{
784  return task->ticks;
785}
786
787/**
788 * rtems_capture_task_tick_offset
789 *
790 *  DESCRIPTION:
791 *
792 * This function returns the current execution time tick offset.
793 */
794static inline uint32_t
795rtems_capture_task_tick_offset (rtems_capture_task_t* task)
796{
797  return task->tick_offset;
798}
799
800/**
801 * rtems_capture_task_time
802 *
803 *  DESCRIPTION:
804 *
805 * This function returns the current execution time.
806 */
807static inline unsigned long long
808rtems_capture_task_time (rtems_capture_task_t* task)
809{
810  unsigned long long t = task->ticks;
811  return (t * rtems_capture_tick_time ()) + task->tick_offset;;
812}
813
814/**
815 * rtems_capture_task_delta_time
816 *
817 *  DESCRIPTION:
818 *
819 * This function returns the execution time as a different between the
820 * last time the detla time was and now.
821 */
822static inline unsigned long long
823rtems_capture_task_delta_time (rtems_capture_task_t* task)
824{
825  unsigned long long t = task->ticks - task->last_ticks;
826  uint32_t     o = task->tick_offset - task->last_tick_offset;
827
828  task->last_ticks       = task->ticks;
829  task->last_tick_offset = task->tick_offset;
830
831  return (t * rtems_capture_tick_time ()) + o;
832}
833
834/**
835 * rtems_capture_task_count
836 *
837 *  DESCRIPTION:
838 *
839 * This function returns the number of tasks the capture
840 * engine knows about.
841 */
842static inline uint32_t
843rtems_capture_task_count (void)
844{
845  rtems_capture_task_t* task = rtems_capture_get_task_list ();
846  uint32_t        count = 0;
847
848  while (task)
849  {
850    count++;
851    task = rtems_capture_next_task (task);
852  }
853
854  return count;
855}
856
857/**
858 * rtems_capture_get_control_list
859 *
860 *  DESCRIPTION:
861 *
862 * This function returns the head of the list of controls in the
863 * capture engine.
864 */
865rtems_capture_control_t*
866rtems_capture_get_control_list (void);
867
868/**
869 * rtems_capture_next_control
870 *
871 *  DESCRIPTION:
872 *
873 * This function returns the pointer to the next control in the list. The
874 * pointer NULL terminates the list.
875 */
876static inline rtems_capture_control_t*
877rtems_capture_next_control (rtems_capture_control_t* control)
878{
879  return control->next;
880}
881
882/**
883 * rtems_capture_control_id
884 *
885 *  DESCRIPTION:
886 *
887 * This function returns the control id.
888 */
889static inline rtems_id
890rtems_capture_control_id (rtems_capture_control_t* control)
891{
892  return control->id;
893}
894
895/**
896 * rtems_capture_control_name
897 *
898 *  DESCRIPTION:
899 *
900 * This function returns the control name.
901 */
902static inline rtems_name
903rtems_capture_control_name (rtems_capture_control_t* control)
904{
905  return control->name;
906}
907
908/**
909 * rtems_capture_control_flags
910 *
911 *  DESCRIPTION:
912 *
913 * This function returns the control flags.
914 */
915static inline uint32_t
916rtems_capture_control_flags (rtems_capture_control_t* control)
917{
918  return control->flags;
919}
920
921/**
922 * rtems_capture_control_to_triggers
923 *
924 *  DESCRIPTION:
925 *
926 * This function returns the task control to triggers.
927 */
928static inline uint32_t
929rtems_capture_control_to_triggers (rtems_capture_control_t* control)
930{
931  return control->to_triggers;
932}
933
934/**
935 * rtems_capture_control_from_triggers
936 *
937 *  DESCRIPTION:
938 *
939 * This function returns the task control from triggers.
940 */
941static inline uint32_t
942rtems_capture_control_from_triggers (rtems_capture_control_t* control)
943{
944  return control->from_triggers;
945}
946
947/**
948 * rtems_capture_control_all_by_triggers
949 *
950 *  DESCRIPTION:
951 *
952 * This function returns the task control by triggers.
953 */
954static inline uint32_t
955rtems_capture_control_all_by_triggers (rtems_capture_control_t* control)
956{
957  return control->by_triggers;
958}
959
960/**
961 * rtems_capture_control_by_valid
962 *
963 *  DESCRIPTION:
964 *
965 * This function returns the control valid BY flags.
966 */
967static inline int
968rtems_capture_control_by_valid (rtems_capture_control_t* control, int slot)
969{
970  return control->by_valid & RTEMS_CAPTURE_CONTROL_FROM_MASK (slot);
971}
972
973/**
974 * rtems_capture_control_by_name
975 *
976 *  DESCRIPTION:
977 *
978 * This function returns the control BY task name.
979 */
980static inline rtems_name
981rtems_capture_control_by_name (rtems_capture_control_t* control, int by)
982{
983  if (by < RTEMS_CAPTURE_TRIGGER_TASKS)
984    return control->by[by].name;
985  return control->by[0].name;
986}
987
988/**
989 * rtems_capture_control_by_id
990 *
991 *  DESCRIPTION:
992 *
993 * This function returns the control BY task id.
994 */
995static inline rtems_id
996rtems_capture_control_by_id (rtems_capture_control_t* control, int by)
997{
998  if (by < RTEMS_CAPTURE_TRIGGER_TASKS)
999    return control->by[by].id;
1000  return control->by[0].id;
1001}
1002
1003/**
1004 * rtems_capture_control_by_triggers
1005 *
1006 *  DESCRIPTION:
1007 *
1008 * This function returns the control BY task triggers.
1009 */
1010static inline uint32_t
1011rtems_capture_control_by_triggers (rtems_capture_control_t* control,
1012                                   int                      by)
1013{
1014  if (by < RTEMS_CAPTURE_TRIGGER_TASKS)
1015    return control->by[by].trigger;
1016  return control->by[0].trigger;
1017}
1018
1019/**
1020 * rtems_capture_control_count
1021 *
1022 *  DESCRIPTION:
1023 *
1024 * This function returns the number of controls the capture
1025 * engine has.
1026 */
1027static inline uint32_t
1028rtems_capture_control_count (void)
1029{
1030  rtems_capture_control_t* control = rtems_capture_get_control_list ();
1031  uint32_t                 count = 0;
1032
1033  while (control)
1034  {
1035    count++;
1036    control = rtems_capture_next_control (control);
1037  }
1038
1039  return count;
1040}
1041
1042#ifdef __cplusplus
1043}
1044#endif
1045
1046#endif
Note: See TracBrowser for help on using the repository browser.