AM64x MCU+ SDK  08.06.00
sddf_api.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2023 Texas Instruments Incorporated - https://www.ti.com/
3  *
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
15  * distribution.
16  *
17  * * Neither the name of Texas Instruments Incorporated nor the names of
18  * its contributors may be used to endorse or promote products derived
19  * from this software without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32  */
33 
34 #ifndef _SDDF_API_H_
35 #define _SDDF_API_H_
36 
37 #ifdef __cplusplus
38 extern "C" {
39 #endif
40 
41 #include <stdint.h>
42 #include "../firmware/icssg_sddf.h"
44 
62 /* Number of ICSSG PRUs */
63 #define NUM_PRU ( 2 )
64 
65 /* PRU IDs */
66 #define PRU_ID_0 ( 0 ) /* PRU 0 ID */
67 #define PRU_ID_1 ( 1 ) /* PRU 1 ID */
68 
69 /* Number of SD channels */
70 #define NUM_SD_CH ( ICSSG_NUM_SD_CH )
71 /* ICSSG INTC event */
72 #define SDFM_EVT ( TRIGGER_HOST_SDFM_EVT )
73 
74 /* SDFM handle */
75 typedef SDFM *sdfm_handle;
76 
86 sdfm_handle SDFM_init(uint8_t pru_id);
87 
98 void SDFM_configIepCount(sdfm_handle h_sdfm, uint32_t epwm_out_freq);
99 
110 void SDFM_configEcap(sdfm_handle h_sdfm, uint8_t ecap_divider);
111 
123 void SDFM_setEnableChannel(sdfm_handle h_sdfm, uint8_t channel_number);
124 
136 void SDFM_setAccOverSamplingRatio(sdfm_handle h_sdfm, uint8_t ch_id, uint8_t osr);
137 
148 
160 void SDFM_setCompFilterThresholds(sdfm_handle h_sdfm, uint8_t ch_id, SDFM_ThresholdParms thresholdParms);
161 
172 void SDFM_setSampleReadingTime(sdfm_handle h_sdfm, float trig_samp_time);
173 
186 void SDFM_configDataFilter(sdfm_handle h_sdfm, uint8_t ch_id, uint8_t filter);
187 
199 void SDFM_selectClockSource(sdfm_handle h_sdfm, uint8_t ch_id, SDFM_ClkSourceParms clkPrams);
200 
212 void SDFM_enableComparator(sdfm_handle h_sdfm, uint8_t ch);
213 
225 void SDFM_disableComparator(sdfm_handle h_sdfm, uint8_t ch);
226 
240 void SDFM_configComparatorGpioPins(sdfm_handle h_sdfm, uint8_t ch,uint32_t gpio_base_addr, uint32_t pin_number, uint32_t threshold_type);
241 
252 uint32_t SDFM_getFilterData(uint8_t ch);
253 
265 
276 void SDFM_setFilterOverSamplingRatio(sdfm_handle h_sdfm, uint16_t nc_osr, uint16_t oc_osr);
277 
280 #ifdef __cplusplus
281 }
282 #endif
283 
284 #endif
SDFM_setAccOverSamplingRatio
void SDFM_setAccOverSamplingRatio(sdfm_handle h_sdfm, uint8_t ch_id, uint8_t osr)
Configure Accumulator over sampling ratio.
sdfm_drv.h
SDFM_setCompFilterThresholds
void SDFM_setCompFilterThresholds(sdfm_handle h_sdfm, uint8_t ch_id, SDFM_ThresholdParms thresholdParms)
configuration of SDFM threshold values
SDFM_enableComparator
void SDFM_enableComparator(sdfm_handle h_sdfm, uint8_t ch)
This API enables the Comparator for the selected channel.
sdfm_handle
SDFM * sdfm_handle
Definition: sddf_api.h:75
SDFM_init
sdfm_handle SDFM_init(uint8_t pru_id)
Initialize SDFM instance.
SDFM_configIepCount
void SDFM_configIepCount(sdfm_handle h_sdfm, uint32_t epwm_out_freq)
Configure iep increment & iep count in one epwm cycle.
SDFM_configComparatorGpioPins
void SDFM_configComparatorGpioPins(sdfm_handle h_sdfm, uint8_t ch, uint32_t gpio_base_addr, uint32_t pin_number, uint32_t threshold_type)
configure GPIO pin number and address for associate Channel Number
SDFM_enable
void SDFM_enable(sdfm_handle h_sdfm)
SDFM global enable.
SDFM_configEcap
void SDFM_configEcap(sdfm_handle h_sdfm, uint8_t ecap_divider)
Configure ecap parameters for generate 20MHz SD clock.
SDFM_ThresholdParms
Structure defining SDFM thresholds parametrs.
Definition: sdfm_drv.h:232
SDFM_configDataFilter
void SDFM_configDataFilter(sdfm_handle h_sdfm, uint8_t ch_id, uint8_t filter)
configuration of SDFM channel Acc source (sync filter type). Current SDFM firmware implementation s...
SDFM_setCompFilterOverSamplingRatio
void SDFM_setCompFilterOverSamplingRatio(sdfm_handle h_sdfm, uint16_t osr)
Configure iep count for over current sampling.
SDFM_selectClockSource
void SDFM_selectClockSource(sdfm_handle h_sdfm, uint8_t ch_id, SDFM_ClkSourceParms clkPrams)
configuration of SDFM channel clock source & clock inversion
SDFM_ClkSourceParms
Structure defining clk source for sdfm ch.
Definition: sdfm_drv.h:218
SDFM_setEnableChannel
void SDFM_setEnableChannel(sdfm_handle h_sdfm, uint8_t channel_number)
Enable the channel specified by the channel number parameter.
SDFM_getFilterData
uint32_t SDFM_getFilterData(uint8_t ch)
get sample data from DMEM
SDFM
Structure defining SDFM interface.
Definition: sdfm_drv.h:305
SDFM_setSampleReadingTime
void SDFM_setSampleReadingTime(sdfm_handle h_sdfm, float trig_samp_time)
configuration of sample read time one Epwm cycle
SDFM_setFilterOverSamplingRatio
void SDFM_setFilterOverSamplingRatio(sdfm_handle h_sdfm, uint16_t nc_osr, uint16_t oc_osr)
Configure iep count for normal current sampling.
SDFM_disableComparator
void SDFM_disableComparator(sdfm_handle h_sdfm, uint8_t ch)
This API disables the Comparator for the selected channel.