adc.h

Go to the documentation of this file.
00001 /******************************************************************************/
00002 /** \file   adc.h
00003  *
00004  *  \brief  This file provides all the APIs provided by QADC64E module 
00005  *          of Freescale MPC563 power-pc MCU
00006  *
00007  *  \version    1.0A - Initial Draft
00008  *  \date       25 June 2010
00009  *
00010  *  \version    1.1A - Design changed to support run-time CCW addition and 
00011  *                      configuration
00012  *  \date       16 July 2010
00013  ******************************************************************************/
00014 #ifndef ADC_H
00015 #define ADC_H
00016 /******************************************************************************
00017 Include Files
00018 ******************************************************************************/
00019 
00020  
00021  
00022 /** \typedef    QADC_Module_ID
00023  *  \brief      This typedefine enum provides the ADC conversion modules */
00024  typedef enum
00025  {
00026     /** \brief  This is channel-A ADC converter */
00027     ADC_MOD_A,
00028     /** \brief  This is channel-B ADC converter */
00029     ADC_MOD_B,
00030     /** \brief  Defines the total no of ADC converters supported */
00031     ADC_TOT_MOD
00032  }QADC_Module_ID;
00033  
00034 /** \typedef    QADC_Drv_Status
00035  *  \brief      This enum typedefine provides various status of ADC driver 
00036                 module */ 
00037  typedef enum
00038  {
00039     /** This indicates that driver is not initialized */
00040     ADC_DRV_UNINIT,
00041     /** This indicates that driver is initialized but not ready for conversion */
00042     ADC_DRV_INIT,
00043     /** This indicates that ADC converter module is ready for conversion */
00044     ADC_DRV_ACTIVE,
00045     /** Unknown ADC converter state */
00046     ADC_UNKNOWN_STATE,
00047  }QADC_Drv_Status;
00048 
00049 /** \typedef    QADC_DrvOpStatus
00050  *  \brief      This enum typedefine provides various operation states 
00051                 if the ADC driver */ 
00052 typedef enum
00053 {
00054     /** Driver operation failed due to unknwon reason */
00055     ADC_OP_FAIL,
00056     /** Driver operation success */
00057     ADC_OP_SUCCESS,
00058     /** Driver operation failed due to invalid ADC converter module ID */
00059     ADC_OP_INVALID_MOD_ID,
00060     /** Driver operation failed due to invalid CCW ID */
00061     ADC_OP_INVALID_CCW_ID,
00062     /** Driver operation failed due to invalid user provided data */
00063     ADC_OP_INVALID_DATA,
00064     /** Driver operation failed as the current state of driver does not support the requested action */
00065     ADC_OP_UNSUPP_STATE,
00066     /** Read operation failed, as the read format provided is not supported */
00067     ADC_OP_UNSUPP_RD_FMT,
00068 }QADC_DrvOpStatus;;
00069 
00070 /** \typedef    QADC_ConvMod_CCWs
00071  *  \brief      This enum typedefine provides all the CCW IDs 
00072                 registered for both ADC converter module A and B */ 
00073  typedef enum 
00074  {
00075     /* ADC converter module CCWs */
00076     ADC_MOD_CCW_0,
00077     ADC_MOD_CCW_1,
00078     ADC_MOD_CCW_2,
00079     ADC_MOD_CCW_3,
00080     ADC_MOD_CCW_4,
00081     ADC_MOD_CCW_5,
00082     ADC_MOD_CCW_6,
00083     ADC_MOD_CCW_7,
00084     ADC_MOD_CCW_8,
00085     ADC_MOD_CCW_9,
00086     ADC_MOD_CCW_10,
00087     ADC_MOD_CCW_11,
00088     ADC_MOD_CCW_12,
00089     ADC_MOD_CCW_13,
00090     ADC_MOD_CCW_14,
00091     ADC_MOD_CCW_15,
00092     ADC_MOD_CCW_16,
00093     ADC_MOD_CCW_17,
00094     ADC_MOD_CCW_18,
00095     ADC_MOD_CCW_19,
00096     ADC_MOD_CCW_20,
00097     ADC_MOD_CCW_21,
00098     ADC_MOD_CCW_22,
00099     ADC_MOD_CCW_23,
00100     ADC_MOD_CCW_24,
00101     ADC_MOD_CCW_25,
00102     ADC_MOD_CCW_26,
00103     ADC_MOD_CCW_27,
00104     ADC_MOD_CCW_28,
00105     ADC_MOD_CCW_29,
00106     ADC_MOD_CCW_30,
00107     ADC_MOD_CCW_31,
00108     ADC_MOD_CCW_32,
00109     ADC_MOD_CCW_33,
00110     ADC_MOD_CCW_34,
00111     ADC_MOD_CCW_35,
00112     ADC_MOD_CCW_36,
00113     ADC_MOD_CCW_37,
00114     ADC_MOD_CCW_38,
00115     ADC_MOD_CCW_39,
00116     ADC_MOD_CCW_40,
00117     ADC_MOD_CCW_41,
00118     ADC_MOD_CCW_42,
00119     ADC_MOD_CCW_43,
00120     ADC_MOD_CCW_44,
00121     ADC_MOD_CCW_45,
00122     ADC_MOD_CCW_46,
00123     ADC_MOD_CCW_47,
00124     ADC_MOD_CCW_48,
00125     ADC_MOD_CCW_49,
00126     ADC_MOD_CCW_50,
00127     ADC_MOD_CCW_51,
00128     ADC_MOD_CCW_52,
00129     ADC_MOD_CCW_53,
00130     ADC_MOD_CCW_54,
00131     ADC_MOD_CCW_55,
00132     ADC_MOD_CCW_56,
00133     ADC_MOD_CCW_57,
00134     ADC_MOD_CCW_58,
00135     ADC_MOD_CCW_59,
00136     ADC_MOD_CCW_60,
00137     ADC_MOD_CCW_61,
00138     ADC_MOD_CCW_62,
00139     ADC_MOD_CCW_63,
00140     ADC_MOD_CCW_TOT,
00141  }QADC_ConvMod_CCWs;
00142 
00143 struct QADC64_tag 
00144 {
00145         union 
00146     {
00147         VUINT16 R;
00148         struct 
00149         {
00150             VUINT16 STOP:1;
00151             VUINT16 FRZ:1;
00152             VUINT16:4;
00153             VUINT16 LOCK:1;
00154             VUINT16 FLIP:1;
00155             VUINT16 SUPV:1;
00156             VUINT16:7;
00157         }B;
00158     }QADC64MCR;
00159 
00160 };
00161 #endif