summaryrefslogtreecommitdiffstats
path: root/cpukit/libmisc/capture/captureimpl.h
diff options
context:
space:
mode:
authorJennifer Averett <jennifer.averett@oarcorp.com>2014-08-05 15:48:01 -0500
committerJennifer Averett <jennifer.averett@oarcorp.com>2014-09-05 06:50:29 -0500
commit2a86615b98ee22eb2cb664011f97ae3a4d07e294 (patch)
tree85efc211e857475d43746da23492b2500f9415f6 /cpukit/libmisc/capture/captureimpl.h
parentcapture: Split user extension methods out. (diff)
downloadrtems-2a86615b98ee22eb2cb664011f97ae3a4d07e294.tar.bz2
capture: Add support for variable length records.
Diffstat (limited to 'cpukit/libmisc/capture/captureimpl.h')
-rw-r--r--cpukit/libmisc/capture/captureimpl.h116
1 files changed, 116 insertions, 0 deletions
diff --git a/cpukit/libmisc/capture/captureimpl.h b/cpukit/libmisc/capture/captureimpl.h
index ee18d827ad..fa366889b7 100644
--- a/cpukit/libmisc/capture/captureimpl.h
+++ b/cpukit/libmisc/capture/captureimpl.h
@@ -154,6 +154,89 @@ rtems_capture_task_t* rtems_capture_create_capture_task (rtems_tcb* new_task);
bool rtems_capture_trigger (rtems_capture_task_t* ft,
rtems_capture_task_t* tt,
uint32_t events);
+
+/**
+ * @brief Capture append to record
+ *
+ * This function Capture appends data to a capture record. It should
+ * be called between rtems_capture_begin_add_record and
+ * rtems_capture_end_add_record.
+ *
+ * @param[in] rec specifies the next location to write in the record
+ * @param[in] data specifies the data to write
+ * @param[in] size specifies specifies the size of the data
+ *
+ * @retval This method returns a pointer which is used as a marker
+ * for the next location in the capture record. it should only be
+ * used as input into rtems_capture_append_to_record or
+ * rtems_capture_end_add_record.
+ */
+static void *rtems_capture_append_to_record(void* rec,
+ void* data,
+ size_t size );
+
+/**
+ * @brief Capture filter
+ *
+ * This function this function specifies if the given task
+ * and events should be logged.
+ *
+ * @param[in] task specifies the capture task control block
+ * @param[in] events specifies the events
+ *
+ * @retval This method returns true if this data should be
+ * filtered from the log. It returns false if this data
+ * should be logged.
+ */
+bool rtems_capture_filter( rtems_capture_task_t* task,
+ uint32_t events);
+/**
+ * @brief Capture begin add record.
+ *
+ * This function opens a record for writing and inserts
+ * the header information
+ *
+ * @param[in] _task specifies the capture task block
+ * @param[in] _events specifies the events
+ * @param[in] _size specifies the expected size of the capture record
+ * @param[out] _rec specifies the next write point in the capture record
+ */
+#define rtems_capture_begin_add_record( _task, _events, _size, _rec) \
+ do { \
+ rtems_interrupt_lock_context _lock_context; \
+ *_rec = rtems_capture_record_open( _task, _events, _size, &_lock_context );
+
+/**
+ * @brief Capture append to record.
+ *
+ * This function appends data of a specifed size into a capture record.
+ *
+ * @param[in] rec specifies the next write point in the capture record
+ * @param[in] data specifies the data to write
+ * @param[in] size specifies the size of the data
+ *
+ * @retval This method returns the next write point in the capture record.
+ */
+static inline void *rtems_capture_append_to_record(void* rec,
+ void* data,
+ size_t size )
+{
+ uint8_t *ptr = rec;
+ memcpy( ptr, data, size );
+ return (ptr + size);
+}
+
+/**
+ * @brief Capture end add record.
+ *
+ * This function completes the add capture record process
+ *
+ * @param[in] _rec specifies the end of the capture record
+ */
+#define rtems_capture_end_add_record( _rec ) \
+ rtems_capture_record_close( _rec, &_lock_context ); \
+ } while (0)
+
/**
* @brief Capture initialize stack usage
*
@@ -187,6 +270,39 @@ void rtems_capture_destroy_capture_task (rtems_capture_task_t* task);
*/
void rtems_capture_get_time (rtems_capture_time_t* time);
+/**
+ * @brief Capture record open.
+ *
+ * This function allocates a record and fills in the
+ * header information. It does a lock acquire
+ * which will remain in effect until
+ * rtems_capture_record_close is called. This method
+ * should only be used by rtems_capture_begin_add_record.
+ *
+ * @param[in] task specifies the caputre task block
+ * @param[in] events specifies the events
+ * @param[in] size specifies capture record size
+ * @param[out] lock_context specifies the lock context
+ *
+ * @retval This method returns a pointer to the next location in
+ * the capture record to store data.
+ */
+void* rtems_capture_record_open (rtems_capture_task_t* task,
+ uint32_t events,
+ size_t size,
+ rtems_interrupt_lock_context* lock_context);
+/**
+ * @brief Capture record close.
+ *
+ * This function closes writing to capure record and
+ * releases the lock that was held on the record. This
+ * method should only be used by rtems_capture_end_add_record.
+ *
+ * @param[in] rec specifies the record
+ * @param[out] lock_context specifies the lock context
+ */
+void rtems_capture_record_close( void *rec, rtems_interrupt_lock_context* lock_context);
+
#ifdef __cplusplus
}