Freescale Semiconductor Inc.
    Regional Technical Application Center

 

Main Page | Class List | Directories | File List | File Members | Related Pages

Emios.h

Go to the documentation of this file.
00001 /****************************************************************************************************/
00013 /****************************************************************************************************/
00014 /*                                                                                                  */
00015 /* All software, source code, included documentation, and any implied know-how are property of      */
00016 /* Freescale Semiconductor and therefore considered CONFIDENTIAL INFORMATION.                       */
00017 /* This confidential information is disclosed FOR DEMONSTRATION PURPOSES ONLY.                      */
00018 /*                                                                                                  */
00019 /* All Confidential Information remains the property of Freescale Semiconductor and will not be     */
00020 /* copied or reproduced without the express written permission of the Discloser, except for copies  */
00021 /* that are absolutely necessary in order to fulfill the Purpose.                                   */
00022 /*                                                                                                  */
00023 /* Services performed by FREESCALE in this matter are performed AS IS and without any warranty.     */
00024 /* CUSTOMER retains the final decision relative to the total design and functionality of the end    */
00025 /* product.                                                                                         */
00026 /* FREESCALE neither guarantees nor will be held liable by CUSTOMER for the success of this project.*/
00027 /*                                                                                                  */
00028 /* FREESCALE disclaims all warranties, express, implied or statutory including, but not limited to, */
00029 /* implied warranty of merchantability or fitness for a particular purpose on any hardware,         */
00030 /* software ore advise supplied to the project by FREESCALE, and or any product resulting from      */
00031 /* FREESCALE services.                                                                              */
00032 /* In no event shall FREESCALE be liable for incidental or consequential damages arising out of     */
00033 /* this agreement. CUSTOMER agrees to hold FREESCALE harmless against any and all claims demands or */
00034 /* actions by anyone on account of any damage,or injury, whether commercial, contractual, or        */
00035 /* tortuous, rising directly or indirectly as a result of the advise or assistance supplied CUSTOMER*/ 
00036 /* in connectionwith product, services or goods supplied under this Agreement.                      */
00037 /*                                                                                                  */
00038 /****************************************************************************************************/
00039 #ifndef __EMIOS_H__
00040  #define __EMIOS_H__
00041 
00042  /*--------------------------Includes -------------------------------------------------------------*/
00043   #include "Derivative.h"
00044   
00045  #if (PWM_ERROR_DETECT == ON)   /* If Pwm Error Layer Enabled, validate errors */ 
00046    #include "Pwm_ReportError.h"
00047  #endif  
00048     
00049     /*------------------------- Type definitions --------------------------------------------------------------*/    
00050     typedef void(*Emios_CallbackType)(void);
00051     
00052     /*------------------------- Defines --------------------------------------------------------------*/  
00053         /* This file violates MISRA 2004 rule 11.3 because addressing memory mapped registers */
00055         #define EMIOS_MCB_MODE                          ((uint8_t)0x50)
00056         
00058         #define eMIOS_GLOBAL_PRESCALER                  ((uint8_t)128)
00059 
00060         #define eMIOS_ENABLE_GLOBAL_TIMEBASE()          (EMIOS.MCR.B.GTBE  = (uint8_t)(1))
00061 
00062         #define eMIOS_ENABLE_GLOBAL_PRESCALER()         (EMIOS.MCR.B.GPREN = (uint8_t)(1))
00063 
00064         #define eMIOS_SET_GLOBAL_PRESCALER_VALUE(value) (EMIOS.MCR.B.GPRE  = (uint8_t)(value))
00065 
00066         #define eMIOS_ENABLE_GLOBAL_FREEZE_IN_DEBUG()   (EMIOS.MCR.B.FRZ   = (uint8_t)1)
00067 
00068         #define eMIOS_SET_COUNT_A(channel,count)        (EMIOS.CH[channel].CADR.R = (uint16_t)(count)) 
00069 
00070         #define eMIOS_SET_COUNT_B(channel,count)        (EMIOS.CH[channel].CBDR.R = (uint16_t)(count))
00071 
00072         #define eMIOS_STATUS_FLAG(channel)              EMIOS.CH[channel].CSR.B.FLAG 
00073 
00074         #define eMIOS_TIMER_COUNT(channel)              EMIOS.CH[channel].CCNTR.R
00075 
00076         #define eMIOS_ENABLE_LOCAL_PRESCALER(channel)   (EMIOS.CH[channel].CCR.B.UCPEN = (uint8_t)(1))
00077 
00078         #define eMIOS_SET_PRESCALER(channel,value)      (EMIOS.CH[channel].CCR.B.UCPRE = (uint8_t)(value))
00079 
00080         #define eMIOS_ENABLE_CHANNEL_INTERRUPT(channel) (EMIOS.CH[channel].CCR.B.FEN   = (uint8_t)(1))           
00081 
00082         #define eMIOS_CLEAR_COUNTER(channel)            (eMIOS_TIMER_COUNT(channel)    = (uint8_t)(0))
00083 
00084         #define eMIOS_CLEAR_STATUS_FLAG(channel)        (eMIOS_STATUS_FLAG(channel)    = (uint8_t)(1)) 
00085 
00086         #define eMIOS_FREEZE_IN_DEBUG(channel)          (EMIOS.CH[channel].CCR.B.FREN  = (uint8_t)(1))
00087 
00088         #define eMIOS_SET_INTERNAL_TIME_BASE(channel)   (EMIOS.CH[channel].CCR.B.BSL    = (uint8_t)(3))  
00089 
00090         #define eMIOS_SET_EDGE_POLARITY(channel,pol)    (EMIOS.CH[channel].CCR.B.EDPOL = (uint8_t)(pol))
00091 
00092         #define eMIOS_MATCH_EVENT_FLAG(channel)         EMIOS.CH[channel].CSR.B.FLAG
00093         /* Select Modulus Counter, up counter, internal clock source */
00094     #define eMIOS_SET_MODULUS_UP_COUNTER(channel)   EMIOS.CH[channel].CCR.B.MODE = EMIOS_MCB_MODE
00095 
00096         #define SCHEDULER_EMIOS_CHANNEL                 ((uint8_t)0)
00097 
00098     #define INTERRUPT_EMIOS_0                       ((uint8_t)58)
00099 
00100     #define eMIOS_TM_LOCAL_PRESCALER                ((uint8_t)4)
00101     
00102     
00103 /*------------------------- Function prototypes --------------------------------------------------------------*/  
00105   void Emios_Scheduler_Isr(void);
00107   extern void vfnEmios_Set_Callback_Fnc(Emios_CallbackType Callback_Fnc);
00108 #endif