⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pit_b.h

📁 摩托罗拉MMC2107在ucosII的移植代码
💻 H
📖 第 1 页 / 共 3 页
字号:
/*                                                                    */
/* Purpose:     Shall enable or disable the PIT                       */
/*                                                                    */
/* Input:                                                             */
/* PITPtr       : PIT register block base address                     */
/* PITEnable    : Enable or disable the PIT                           */
/*                                                                    */
/* Output:                                                            */
/* PIT_B_ERR_NONE               : For successful completion           */
/* PIT_B_ERR_INVALID_HANDLE     : PIT base address parameter is zero  */
/* PIT_B_ERR_INVALID_PIT_ENABLE : PIT enable is invalid.              */
/**********************************************************************/
#define PIT_B_ControlOperation( PITPtr,                                \
                                PITEnable                              \
                              )                                        \
(                                                                      \
  (PIT_B_PARAM_CHECKING) ?                                             \
  (                                                                    \
    ((PITPtr) == NULL) ?                                               \
      PIT_B_ERR_INVALID_HANDLE :                                       \
    (((PITEnable) < PIT_B_FUNCTION_DISABLE) ||                         \
       ((PITEnable) > PIT_B_FUNCTION_ENABLE)) ?                        \
       PIT_B_ERR_INVALID_PIT_ENABLE:                                   \
      PIT_B_ControlOperation_f((PITPtr),                               \
                               (PITEnable)                             \
                               )                                       \
  )                                                                    \
  :                                                                    \
    PIT_B_ControlOperation_f((PITPtr),                                 \
                             (PITEnable)                               \
                            )                                          \
) /* End of PIT_B_ControlOperation Macro */
/**********************************************************************/
/* Macro:       PIT_B_SetModulus_f                                    */
/*                                                                    */
/* Purpose:     Return the status bit of the PIT                      */
/*                                                                    */
/* Input:                                                             */
/* PITPtr                 : PIT base address associated.              */
/* Modulus                : Data to copy into selected                */
/*                          PIT_B register.                           */
/* CounterOverwriteEnable : Determines whether the                    */
/*                          modulus latch is transparent              */
/*                          or a holding register.                    */
/*                                                                    */
/* Output:                                                            */
/* PIT_B_ERR_NONE                             : For successful        */
/*                                              completion            */
/* PIT_B_ERR_INVALID_HANDLE                   : PIT base address      */
/*                                              parameter is zero     */
/* PIT_B_ERR_INVALID_COUNTER_OVERWRITE_ENABLE : Counter overwrite     */
/*                                              enable is invalid.    */
/**********************************************************************/
#define PIT_B_SetModulus( PITPtr,                                      \
                          Modulus,                                     \
                          CounterOverwriteEnable                       \
                         )                                             \
(                                                                      \
  (PIT_B_PARAM_CHECKING) ?                                             \
  (                                                                    \
    ((PITPtr) == NULL) ?                                               \
      PIT_B_ERR_INVALID_HANDLE :                                       \
    (((CounterOverwriteEnable) < PIT_B_DISABLE_COUNTER_OVERWRITE) ||   \
       ((CounterOverwriteEnable) > PIT_B_ENABLE_COUNTER_OVERWRITE))?   \
       PIT_B_ERR_INVALID_COUNTER_OVERWRITE_ENABLE :                    \
    PIT_B_SetModulus_f( (PITPtr),                                      \
                        (Modulus),                                     \
                        (CounterOverwriteEnable)                       \
                       )                                               \
  )                                                                    \
  :                                                                    \
    PIT_B_SetModulus_f( (PITPtr),                                      \
                        (Modulus),                                     \
                        (CounterOverwriteEnable)                       \
                      )                                                \
) /* End of SetModulus Macro */

/**********************************************************************/
/* Macro:       PIT_B_SetRegister                                     */
/*                                                                    */
/* Purpose:     Write a 16-bit data value to a sub-set of PIT         */
/*              registers.  Parameter checking is a compile-time      */
/*              option.                                               */
/*                                                                    */
/* Input:                                                             */
/* PITPtr         : PIT_B base address associated with this driver.   */
/* RegisterSelect : Select among PIT_B registers.                     */
/* RegisterValue  : Data to copy into the user specified register.    */
/*                                                                    */
/* Output:                                                            */
/* PIT_B_ERR_NONE             : No error                              */
/* PIT_B_ERR_INVALID_HANDLE   : PIT base address parameter is zero    */
/* PIT_B_ERR_INVALID_REGISTER : PIT Register Selection switch         */
/*                              is invalid                            */
/**********************************************************************/
#define PIT_B_SetRegister(PITPtr,                                      \
                          RegisterSelect,                              \
                          RegisterValue                                \
                          )                                            \
(                                                                      \
  (PIT_B_PARAM_CHECKING) ?                                             \
  (                                                                    \
    ((PITPtr) == NULL) ?                                               \
      PIT_B_ERR_INVALID_HANDLE :                                       \
    (((RegisterSelect) < PIT_B_PCSR) ||                                \
       ((RegisterSelect) > PIT_B_PMR)) ?                               \
       PIT_B_ERR_INVALID_REGISTER :                                    \
    PIT_B_SetRegister_f((PITPtr),                                      \
                        (RegisterSelect),                              \
                        (RegisterValue)                                \
                        )                                              \
  )                                                                    \
  :                                                                    \
    PIT_B_SetRegister_f((PITPtr),                                      \
                        (RegisterSelect),                              \
                        (RegisterValue)                                \
                        )                                              \
                                                                       \
) /* End of PIT_B_SetRegister Macro */
/**********************************************************************/
/* Macro:       PIT_B_GetRegister                                     */
/*                                                                    */
/* Purpose:     Return the contents of a sub-set of PIT registers.    */
/*              Parameter checking is a compile-time option.          */
/* Input:                                                             */
/* PITPtr         : PIT_B base address associated with this driver.   */
/* RegisterSelect : Select among a sub-set of PIT_B registers.        */
/* GetRegisterPtr : Result address for selected PIT_B register.       */
/*                                                                    */
/* Output:                                                            */
/*   PIT_B_ERR_NONE             : No error                            */
/*   PIT_B_ERR_INVALID_HANDLE   : PIT base address parameter is zero  */
/*   PIT_B_ERR_BAD_RESULT_ADDR  : Result Pointer is zero              */
/*   PIT_B_ERR_INVALID_REGISTER : PIT Register Selection switch is    */
/*                                invalid                             */
/**********************************************************************/
#define PIT_B_GetRegister(PITPtr,                                      \
                          RegisterSelect,                              \
                          GetRegisterPtr                               \
                          )                                            \
(                                                                      \
  (PIT_B_PARAM_CHECKING) ?                                             \
  (                                                                    \
    ((PITPtr) == NULL) ?                                               \
      PIT_B_ERR_INVALID_HANDLE :                                       \
    ((GetRegisterPtr) == NULL) ?                                       \
      PIT_B_ERR_BAD_RESULT_ADDR :                                      \
    (((RegisterSelect) < PIT_B_PCSR) ||                                \
       ((RegisterSelect) > PIT_B_PCNTR)) ?                             \
       PIT_B_ERR_INVALID_REGISTER :                                    \
    PIT_B_GetRegister_f( (PITPtr),                                     \
                         (RegisterSelect),                             \
                         (GetRegisterPtr)                              \
                       )                                               \
  )                                                                    \
  :                                                                    \
    PIT_B_GetRegister_f( (PITPtr),                                     \
                         (RegisterSelect),                             \
                         (GetRegisterPtr)                              \
                        )                                              \
) /* End of PIT_B_GetRegister Macro */

/**********************************************************************/
/* Macro:       PIT_B_Reset                                           */
/*                                                                    */
/* Purpose:     Resets the programmable interval timer.               */
/*              Parameter checking is a compile-time option.          */
/*                                                                    */
/* Input:                                                             */
/* PITPtr : PIT_B base address associated with this driver.           */
/*                                                                    */
/* Output:                                                            */
/* PIT_B_ERR_NONE           : No error                                */
/* PIT_B_ERR_INVALID_HANDLE : PIT base address parameter is zero      */
/**********************************************************************/
#define PIT_B_Reset( PITPtr                                         \
                   )                                                \
(                                                                   \
   (PIT_B_PARAM_CHECKING) ?                                         \
   (                                                                \
      ((PITPtr) == NULL) ?                                          \
        PIT_B_ERR_INVALID_HANDLE :                                  \
      PIT_B_Reset_f ( (PITPtr)                                      \
                    )                                               \
   )                                                                \
   :                                                                \
      PIT_B_Reset_f ( (PITPtr)                                      \
                    )                                               \
) /* end of PIT_B_Reset Macro */





#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -