Forked repo of Platform Drivers- Analog Devices

Committer:
Janani Sunil
Date:
Mon Nov 22 22:26:51 2021 +0530
Revision:
20:26b1a4570f4b
Parent:
19:3c61197500c4
The following changes were made:
1.) Modified udelay() function for generating more accurate smaller usec delays
2.) Implemented the irq_enable and irq_disable functions
3.) Removed the confusion b/w application created peripheral object and interrupt specific object
4.) Created PWM extra init structure and added PWM pin as it's member for multiplatform project compatibility
5.) Added a module for timer and its related header file

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Kjansen 19:3c61197500c4 1 /***************************************************************************//**
Kjansen 19:3c61197500c4 2 * @file aout.h
Kjansen 19:3c61197500c4 3 * @author PMallick (Pratyush.Mallick@analog.com)
Kjansen 19:3c61197500c4 4 ********************************************************************************
Kjansen 19:3c61197500c4 5 * Copyright (c) 2021 Analog Devices, Inc.
Kjansen 19:3c61197500c4 6 * All rights reserved.
Kjansen 19:3c61197500c4 7 *
Kjansen 19:3c61197500c4 8 * This software is proprietary to Analog Devices, Inc. and its licensors.
Kjansen 19:3c61197500c4 9 * By using this software you agree to the terms of the associated
Kjansen 19:3c61197500c4 10 * Analog Devices Software License Agreement.
Kjansen 19:3c61197500c4 11 *******************************************************************************/
Kjansen 19:3c61197500c4 12
Kjansen 19:3c61197500c4 13 #ifndef AOUT_H
Kjansen 19:3c61197500c4 14 #define AOUT_H
Kjansen 19:3c61197500c4 15
Kjansen 19:3c61197500c4 16 /******************************************************************************/
Kjansen 19:3c61197500c4 17 /***************************** Include Files **********************************/
Kjansen 19:3c61197500c4 18 /******************************************************************************/
Kjansen 19:3c61197500c4 19
Kjansen 19:3c61197500c4 20 #include <stdint.h>
Kjansen 19:3c61197500c4 21
Kjansen 19:3c61197500c4 22 /******************************************************************************/
Kjansen 19:3c61197500c4 23 /********************** Macros and Constants Definitions **********************/
Kjansen 19:3c61197500c4 24 /******************************************************************************/
Kjansen 19:3c61197500c4 25
Kjansen 19:3c61197500c4 26 /******************************************************************************/
Kjansen 19:3c61197500c4 27 /*************************** Types Declarations *******************************/
Kjansen 19:3c61197500c4 28 /******************************************************************************/
Kjansen 19:3c61197500c4 29 /**
Kjansen 19:3c61197500c4 30 * @struct aout_init_param
Kjansen 19:3c61197500c4 31 * @brief Structure holding the parameters for analog output initialization
Kjansen 19:3c61197500c4 32 */
Kjansen 19:3c61197500c4 33 struct aout_init_param {
Kjansen 19:3c61197500c4 34 /* Analog output pin number */
Kjansen 19:3c61197500c4 35 int32_t number;
Kjansen 19:3c61197500c4 36 /* Min output range of DAC in volts */
Kjansen 19:3c61197500c4 37 float aout_min_v;
Kjansen 19:3c61197500c4 38 /* Max output range of DAC in volts */
Kjansen 19:3c61197500c4 39 float aout_max_v;
Kjansen 19:3c61197500c4 40 /* Analog output reference voltage */
Kjansen 19:3c61197500c4 41 float vref;
Kjansen 19:3c61197500c4 42 /* Analog output platform specific functions */
Kjansen 19:3c61197500c4 43 const struct aout_platform_ops *platform_ops;
Kjansen 19:3c61197500c4 44 };
Kjansen 19:3c61197500c4 45
Kjansen 19:3c61197500c4 46 /**
Kjansen 19:3c61197500c4 47 * @struct aout_desc
Kjansen 19:3c61197500c4 48 * @brief Structure holding analog output descriptor
Kjansen 19:3c61197500c4 49 */
Kjansen 19:3c61197500c4 50 struct aout_desc {
Kjansen 19:3c61197500c4 51 /* Analog output pin number */
Kjansen 19:3c61197500c4 52 int32_t number;
Kjansen 19:3c61197500c4 53 /* Min output value of DAC in volts */
Kjansen 19:3c61197500c4 54 float aout_min_v;
Kjansen 19:3c61197500c4 55 /* Max output value of DAC in volts */
Kjansen 19:3c61197500c4 56 float aout_max_v;
Kjansen 19:3c61197500c4 57 /* Analog output reference voltage */
Kjansen 19:3c61197500c4 58 float vref;
Kjansen 19:3c61197500c4 59 /* Analog output platform specific functions */
Kjansen 19:3c61197500c4 60 const struct aout_platform_ops *platform_ops;
Kjansen 19:3c61197500c4 61 /* Analog extra parameters (device specific) */
Kjansen 19:3c61197500c4 62 void *extra;
Kjansen 19:3c61197500c4 63 };
Kjansen 19:3c61197500c4 64
Kjansen 19:3c61197500c4 65 /**
Kjansen 19:3c61197500c4 66 * @struct aout_platform_ops
Kjansen 19:3c61197500c4 67 * @brief Structure holding analog output function pointers that
Kjansen 19:3c61197500c4 68 * point to the platform specific function
Kjansen 19:3c61197500c4 69 */
Kjansen 19:3c61197500c4 70 struct aout_platform_ops {
Kjansen 19:3c61197500c4 71 /** Analog output initialization function pointer */
Kjansen 19:3c61197500c4 72 int32_t(*init)(struct aout_desc **, const struct aout_init_param *);
Kjansen 19:3c61197500c4 73 /** Analog output write function pointer */
Kjansen 19:3c61197500c4 74 int32_t(*write)(struct aout_desc *, float);
Kjansen 19:3c61197500c4 75 /** Analog output remove function pointer */
Kjansen 19:3c61197500c4 76 int32_t(*remove)(struct aout_desc *);
Kjansen 19:3c61197500c4 77 };
Kjansen 19:3c61197500c4 78
Kjansen 19:3c61197500c4 79 /******************************************************************************/
Kjansen 19:3c61197500c4 80 /************************ Functions Declarations ******************************/
Kjansen 19:3c61197500c4 81 /******************************************************************************/
Kjansen 19:3c61197500c4 82 /* Write analog output voltage */
Kjansen 19:3c61197500c4 83 int32_t aout_set_voltage(struct aout_desc *desc, float value);
Kjansen 19:3c61197500c4 84
Kjansen 19:3c61197500c4 85 /* Initialize the analog output pin */
Kjansen 19:3c61197500c4 86 int32_t aout_init(struct aout_desc **desc,
Kjansen 19:3c61197500c4 87 const struct aout_init_param *param);
Kjansen 19:3c61197500c4 88
Kjansen 19:3c61197500c4 89 /* Free the resources allocated by analog_out_init() */
Kjansen 19:3c61197500c4 90 int32_t aout_remove(struct aout_desc *desc);
Kjansen 19:3c61197500c4 91
Kjansen 19:3c61197500c4 92 #endif