MAX32655 Peripheral Driver API
Peripheral Driver API for the MAX32655
pt.h
1 
6 /* *****************************************************************************
7  * Copyright (C) 2016 Maxim Integrated Products, Inc., All Rights Reserved.
8  *
9  * Permission is hereby granted, free of charge, to any person obtaining a
10  * copy of this software and associated documentation files (the "Software"),
11  * to deal in the Software without restriction, including without limitation
12  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
13  * and/or sell copies of the Software, and to permit persons to whom the
14  * Software is furnished to do so, subject to the following conditions:
15  *
16  * The above copyright notice and this permission notice shall be included
17  * in all copies or substantial portions of the Software.
18  *
19  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
20  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
22  * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES
23  * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
24  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25  * OTHER DEALINGS IN THE SOFTWARE.
26  *
27  * Except as contained in this notice, the name of Maxim Integrated
28  * Products, Inc. shall not be used except as stated in the Maxim Integrated
29  * Products, Inc. Branding Policy.
30  *
31  * The mere transfer of this software does not imply any licenses
32  * of trade secrets, proprietary technology, copyrights, patents,
33  * trademarks, maskwork rights, or any other form of intellectual
34  * property whatsoever. Maxim Integrated Products, Inc. retains allts
35  * ownership rights.
36  *
37  * $Date$
38  * $Revision$
39  *
40  ***************************************************************************** */
41 
42 /* Define to prevent redundant inclusion */
43 #ifndef _MXC_PT_H_
44 #define _MXC_PT_H_
45 
46 /* **** Includes **** */
47 
48 #include "pt.h"
49 #include "gcr_regs.h"
50 #include "pt_regs.h"
51 #include "ptg_regs.h"
52 #include "mxc_device.h"
53 #include "mxc_errors.h"
54 #include "mxc_assert.h"
55 #include "mxc_sys.h"
56 #include "mcr_regs.h"
57 #include <stdio.h>
58 
59 #ifdef __cplusplus
60 extern "C" {
61 #endif
62 
74 typedef struct {
75  unsigned channel;
76  uint32_t bps;
77  uint32_t pattern;
78  uint8_t ptLength;
79  uint16_t loop;
80  uint16_t loopDelay;
81 } mxc_pt_cfg_t;
85 typedef enum {
86  MXC_PT_CLK_DIV1,
87  MXC_PT_CLK_DIV2,
88  MXC_PT_CLK_DIV4,
89  MXC_PT_CLK_DIV8,
90  MXC_PT_CLK_DIV16,
91  MXC_PT_CLK_DIV32,
92  MXC_PT_CLK_DIV64,
93  MXC_PT_CLK_DIV128,
95 
101 void MXC_PT_Init (mxc_clk_scale_t clk_scale);
102 
113 void MXC_PT_Shutdown (uint32_t pts);
114 
127 int MXC_PT_Config (mxc_pt_cfg_t *cfg);
128 
139 int MXC_PT_SqrWaveConfig (unsigned channel, uint32_t freq);
140 
146 void MXC_PT_Start (unsigned pts);
147 
153 void MXC_PT_Stop (unsigned pts);
154 
164 uint32_t MXC_PT_IsActive (uint32_t pts);
165 
173 void MXC_PT_SetPattern (unsigned pts, uint32_t pattern);
174 
183 void MXC_PT_EnableInt (uint32_t pts);
184 
193 void MXC_PT_DisableInt (uint32_t pts);
194 
201 uint32_t MXC_PT_GetFlags (void);
202 
208 void MXC_PT_ClearFlags (uint32_t flags);
209 
219 void MXC_PT_EnableRestart (unsigned start, unsigned stop, uint8_t restartIndex);
220 
226 void MXC_PT_DisableRestart (unsigned channel, uint8_t restartIndex);
227 
235 void MXC_PT_Resync (uint32_t pts);
238 #ifdef __cplusplus
239 }
240 #endif
241 
242 #endif /* _MXC_PT_H_ */
int MXC_PT_SqrWaveConfig(unsigned channel, uint32_t freq)
Configures the pulse train in the square wave mode.
void MXC_PT_Init(mxc_clk_scale_t clk_scale)
This function initializes the pulse trains to a known stopped state and sets the global PT clock scal...
mxc_clk_scale_t
Definition: pt.h:85
void MXC_PT_EnableInt(uint32_t pts)
Enable interrupts for the pulse trains selected.
uint32_t bps
Definition: pt.h:76
void MXC_PT_Resync(uint32_t pts)
Resynchronize individual pulse trains together. Resync will stop those resync_pts; others will be sti...
void MXC_PT_Start(unsigned pts)
Starts the pulse trains specified.
unsigned channel
Definition: pt.h:75
void MXC_PT_ClearFlags(uint32_t flags)
Clears the pulse train&#39;s interrupt flag.
uint16_t loopDelay
Definition: pt.h:80
void MXC_PT_SetPattern(unsigned pts, uint32_t pattern)
Sets the pattern of the pulse train.
void MXC_PT_EnableRestart(unsigned start, unsigned stop, uint8_t restartIndex)
Setup and enables a pulse train to restart after another pulse train has exited its loop...
void MXC_PT_Stop(unsigned pts)
Stops pulse trains.
uint16_t loop
Definition: pt.h:79
int MXC_PT_Config(mxc_pt_cfg_t *cfg)
Configures the pulse train in the specified mode.
uint32_t MXC_PT_GetFlags(void)
Gets the pulse trains&#39;s interrupt flags.
void MXC_PT_DisableInt(uint32_t pts)
Disable interrupts for the pulse trains selected.
uint8_t ptLength
Definition: pt.h:78
Definition: pt.h:74
void MXC_PT_Shutdown(uint32_t pts)
Shutdown the pulse train channel/channels.
void MXC_PT_DisableRestart(unsigned channel, uint8_t restartIndex)
Disable the restart for the specified pulse train.
uint32_t pattern
Definition: pt.h:77
uint32_t MXC_PT_IsActive(uint32_t pts)
Determines if the pulse trains selected are running.