source: rtems/cpukit/libmisc/capture/capture.h @ 9f9c0bb

4.115
Last change on this file since 9f9c0bb was 9f9c0bb, checked in by Chris Johns <chrisj@…>, on 12/24/13 at 05:42:23

cpukit/capture: Use the new RTEMS API to get the uptime in nanoseconds.

Use the new API to get the uptime in nanoseconds and update the capture
engine.

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