| Digital Power Starter Kit 3 Firmware dsPIC33C Boost Converter Voltage Mode Control Example |

p33c_dsp.c
1 /*LICENSE *****************************************************************************************
2 *
3 * Software License Agreement
4 *
5 * Copyright (R) 2021 Microchip Technology Inc. All rights reserved. Microchip licenses to you the
6 * right to use, modify, copy and distribute Software only when embedded on a Microchip
7 * microcontroller or digital signal controller, which is integrated into your product or third
8 * party product (pursuant to the sublicense terms in the accompanying license agreement).
9 *
10 * You should refer to the license agreement accompanying this Software for additional information
11 * regarding your rights and obligations.
12 *
13 * SOFTWARE AND DOCUMENTATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR
14 * IMPLIED, INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY, TITLE, NON-INFRINGEMENT
15 * AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROCHIP OR ITS LICENSORS BE LIABLE OR
16 * OBLIGATED UNDER CONTRACT, NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR
17 * OTHER LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES INCLUDING BUT NOT
18 * LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT, PUNITIVE OR CONSEQUENTIAL DAMAGES, LOST PROFITS
19 * OR LOST DATA, COST OF PROCUREMENT OF SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY
20 * THIRD PARTIES (INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS.
21 *
22 * ***********************************************************************************************/
23
24 // Include Header Files
25 #include <xc.h> // include processor files - each processor file is guarded.
26 #include <stdint.h> // include standard integer number data types
27 #include <stdbool.h> // include standard boolean data types (true/false)
28
29 #include "p33c_dsp.h"
30
31 /*************************************************************************************************
32 * @file p33c_dsp.c
33 * @brief Driver file for dsPIC33C DSP Configuration SFRs
34 * @details
35 * The DSP engine of dsPIC33 offers several options to optimize data processing for integer
36 * and fixed-point algorithmic, which can be defined and enabled using this library.
37 ************************************************************************************************/
38
39
40 /******************************************************************************************************
41 * @fn uint16_t p33c_Dsp_WriteConfig(volatile struct P33C_DSP_CONFIG_s dsp_cfg)
42 * @ingroup lib-layer-pral-functions-public-dsp
43 * @brief Initializes the DSP engine in accordance to user settings
44 * @param dsp_cfg DSP configuration SFR object of type struct P33C_DSP_CONFIG_s
45 * @return unsigned integer (0=failure, 1=success)
46 *
47 * @details
48 * This routine writes a DSP user-configuration into the core configuration register and verifies
49 * the data has been written correctly.
50 *
51 ******************************************************************************************************/
52
53 volatile uint16_t p33c_Dsp_WriteConfig(volatile struct P33C_DSP_CONFIG_s dsp_cfg)
54 {
55 volatile uint16_t retval = 0;
56 volatile struct P33C_DSP_CONFIG_s* dsp;
57
58 dsp = p33c_DspConfig_GetHandle();
59 *dsp = dsp_cfg;
60
61 return(retval);
62
63 }
64
65
66 /******************************************************************************************************
67 * @fn struct P33C_DSP_CONFIG_s p33c_Dsp_GetConfig(void)
68 * @ingroup lib-layer-pral-functions-public-dsp
69 * @brief Reads the DSP engine configuration
70 * @return struct P33C_DSP_CONFIG_s
71 *
72 * @details
73 * This routine writes a DSP user-configuration into the core configuration register and verifies
74 * the data has been written correctly.
75 *
76 ******************************************************************************************************/
77
78 volatile struct P33C_DSP_CONFIG_s p33c_Dsp_ReadConfig(void)
79 {
80 volatile struct P33C_DSP_CONFIG_s* dsp;
81
82 dsp = p33c_DspConfig_GetHandle();
83
84 return(*dsp);
85
86 }
87
88 //------------------------------------------------------------------------------
89 //------------------------------------------------------------------------------
90
91
92 // end of file
P33C_DSP_CONFIG_s
Definition: p33c_dsp.h:166