SimpleLink MCU SDK Driver APIs  tidrivers_msp43x_3_01_01_03
Capture.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2016, Texas Instruments Incorporated
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  *
9  * * Redistributions of source code must retain the above copyright
10  * notice, this list of conditions and the following disclaimer.
11  *
12  * * Redistributions in binary form must reproduce the above copyright
13  * notice, this list of conditions and the following disclaimer in the
14  * documentation and/or other materials provided with the distribution.
15  *
16  * * Neither the name of Texas Instruments Incorporated nor the names of
17  * its contributors may be used to endorse or promote products derived
18  * from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
30  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
127 #ifndef ti_drivers_Capture__include
128 #define ti_drivers_Capture__include
129 
130 #ifdef __cplusplus
131 extern "C"
132 {
133 #endif
134 
135 #include <stdint.h>
136 #include <stdbool.h>
137 
142 
154 #define CAPTURE_CMD_RESERVED (32)
155 
168 #define CAPTURE_STATUS_RESERVED (-32)
169 
176 #define CAPTURE_STATUS_SUCCESS (0)
177 
184 #define CAPTURE_STATUS_ERROR (-1)
185 
193 #define CAPTURE_STATUS_UNDEFINEDCMD (-2)
194 
202 typedef enum Capture_Period_Unit_ {
203  CAPTURE_PERIOD_US, /* Period in microseconds */
204  CAPTURE_PERIOD_HZ, /* Period in frequency */
205  CAPTURE_PERIOD_COUNTS, /* Period in counts */
207 
215 typedef enum Capture_Mode_ {
220 } Capture_Mode;
221 
234 typedef void (*Capture_CallBackFxn)(Capture_Handle handle, uint32_t interval);
235 
243 typedef struct Capture_Params_ {
248 
253 typedef void (*Capture_CloseFxn)(Capture_Handle handle);
254 
259 typedef int_fast16_t (*Capture_ControlFxn)(Capture_Handle handle,
260  uint_fast16_t cmd, void *arg);
261 
266 typedef void (*Capture_InitFxn)(Capture_Handle handle);
267 
272 typedef Capture_Handle (*Capture_OpenFxn)(Capture_Handle handle,
273  Capture_Params *params);
274 
279 typedef void (*Capture_StartFxn)(Capture_Handle handle);
280 
285 typedef void (*Capture_StopFxn)(Capture_Handle handle);
286 
292 typedef struct Capture_FxnTable_ {
295 
298 
301 
304 
307 
310 
312 
313 typedef struct Capture_Config_ {
315  void *object;
316  void const *hwAttrs;
318 
331 extern void Capture_close(Capture_Handle handle);
332 
352 extern int_fast16_t Capture_control(Capture_Handle handle, uint_fast16_t cmd,
353  void *arg);
354 
358 extern void Capture_init(void);
359 
383 extern Capture_Handle Capture_open(uint_least8_t index, Capture_Params *params);
384 
396 extern void Capture_Params_init(Capture_Params *params);
397 
409 extern void Capture_start(Capture_Handle handle);
410 
417 extern void Capture_stop(Capture_Handle handle);
418 
419 #ifdef __cplusplus
420 }
421 #endif
422 
423 #endif /* ti_drivers_Capture__include */
Definition: Capture.h:203
struct Capture_FxnTable_ Capture_FxnTable
The definition of a Capture function table that contains the required set of functions to control a s...
void Capture_stop(Capture_Handle handle)
Function to stop Capture after Capture_start() is called with success.
Capture_OpenFxn openFxn
Definition: Capture.h:303
Definition: Capture.h:313
Capture_Handle(* Capture_OpenFxn)(Capture_Handle handle, Capture_Params *params)
A function pointer to a driver specific implementation of Capture_open().
Definition: Capture.h:272
Capture_Period_Unit periodUnit
Definition: Capture.h:246
void(* Capture_CloseFxn)(Capture_Handle handle)
A function pointer to a driver specific implementation of Capture_close().
Definition: Capture.h:253
Capture Parameters.
Definition: Capture.h:243
Capture_Mode_
Capture mode enum.
Definition: Capture.h:215
Capture_Handle Capture_open(uint_least8_t index, Capture_Params *params)
Function to initialize a given Capture module specified by the particular index value. The parameter specifies which mode the Capture will operate.
enum Capture_Mode_ Capture_Mode
Capture mode enum.
Definition: Capture.h:216
struct Capture_Config_ Capture_Config
void Capture_init(void)
Function to initialize Capture.
void * object
Definition: Capture.h:315
Capture_CallBackFxn callbackFxn
Definition: Capture.h:245
Capture_StartFxn startFxn
Definition: Capture.h:306
void Capture_Params_init(Capture_Params *params)
Function to initialize the Capture_Params struct to its defaults.
void Capture_start(Capture_Handle handle)
Function to start capture. The Capture running mode and interval period unit are specfied in the Capt...
struct Capture_Params_ Capture_Params
Capture Parameters.
Capture_CloseFxn closeFxn
Definition: Capture.h:294
void const * hwAttrs
Definition: Capture.h:316
int_fast16_t Capture_control(Capture_Handle handle, uint_fast16_t cmd, void *arg)
Function performs implementation specific features on a given Capture_Handle.
Capture_ControlFxn controlFxn
Definition: Capture.h:297
struct Capture_Config_ * Capture_Handle
A handle that is returned from a Capture_open() call.
Definition: Capture.h:141
Definition: Capture.h:217
void(* Capture_InitFxn)(Capture_Handle handle)
A function pointer to a driver specific implementation of Capture_init().
Definition: Capture.h:266
void(* Capture_StartFxn)(Capture_Handle handle)
A function pointer to a driver specific implementation of Capture_start().
Definition: Capture.h:279
int_fast16_t(* Capture_ControlFxn)(Capture_Handle handle, uint_fast16_t cmd, void *arg)
A function pointer to a driver specific implementation of Capture_control().
Definition: Capture.h:259
Definition: Capture.h:218
void(* Capture_CallBackFxn)(Capture_Handle handle, uint32_t interval)
Capture callback function.
Definition: Capture.h:234
Definition: Capture.h:205
The definition of a Capture function table that contains the required set of functions to control a s...
Definition: Capture.h:292
Capture_FxnTable const * fxnTablePtr
Definition: Capture.h:314
enum Capture_Period_Unit_ Capture_Period_Unit
Capture period unit enum.
Capture_Mode mode
Definition: Capture.h:244
Capture_StopFxn stopFxn
Definition: Capture.h:309
Capture_InitFxn initFxn
Definition: Capture.h:300
void(* Capture_StopFxn)(Capture_Handle handle)
A function pointer to a driver specific implementation of Capture_stop().
Definition: Capture.h:285
Capture_Period_Unit_
Capture period unit enum.
Definition: Capture.h:202
Definition: Capture.h:204
void Capture_close(Capture_Handle handle)
Function to close a Capture module specified by the Capture handle.
Copyright 2016, Texas Instruments Incorporated