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

📄 port_a.h

📁 摩托罗拉MMC2107在ucosII的移植代码
💻 H
📖 第 1 页 / 共 3 页
字号:
/* Port                       :  Select a Port A-I.                  */
/* ReadPortPtr       	      :  Data to be copied into selected     */
/*                               Port Pin.                           */
/*                                                                   */
/* Output:                                                           */
/* PORT_A_ERR_NONE                     :  No error.                  */
/* PORT_A_ERR_INVALID_HANDLE           :  Port base address parmeter */
/*                                        is zero.                   */
/* PORT_A_ERR_INVALID_PORT             :  Port selection is invalid. */
/* PORT_A_ERR_BAD_RESULT_ADDRESS       :  Result pointer is zero.    */
/*-------------------------------------------------------------------*/
#define Port_A_ReadPortData( PortPtr,                                \
                             Port,                                   \
                             ReadPortPtr                             \
                           )                                         \
(                                                                    \
   (PORT_A_PARAM_CHECKING) ?                                         \
   (                                                                 \
   ((PortPtr) == NULL) ?                                             \
         PORT_A_ERR_INVALID_HANDLE  :                                \
   (((Port) < PORT_A_PORT_A ) ||                                     \
    ((Port) > PORT_A_PORT_I )) ?                                     \
         PORT_A_ERR_INVALID_PORT :                                   \
    ((ReadPortPtr) == NULL) ?                                        \
      PORT_A_ERR_BAD_RESULT_ADDRESS :                                \
      Port_A_ReadPortData_f ( (PortPtr),                             \
                              (Port),                                \
                              (ReadPortPtr)                          \
                            )                                        \
   )                                                                 \
   :                                                                 \
   Port_A_ReadPortData_f ( (PortPtr),                                \
                           (Port),                                   \
                           (ReadPortPtr)                             \
                         )                                           \
) /* end of Port_A_ReadPortData Macro */

/*-------------------------------------------------------------------*/
/* Macro:      Port_A_ConfigureGPIO                                  */
/*                                                                   */
/* Purpose:     Call Port_A_ConfigureGPIO_f function with optional   */
/*              parameter checking.                                  */
/*                                                                   */
/* Input:                                                            */
/* PortPtr                    :  Port base address associated with   */
/*                               this driver.                        */
/* SelectValue       	      :  Select Pin Assignament              */
/* FunctionType               :  Value to write to Port Pin.         */
/*                                                                   */
/* Output:                                                           */
/* PORT_A_ERR_NONE                     :  No error.                  */
/* PORT_A_ERR_INVALID_HANDLE           :  Port base address parmeter */
/*                                        is zero.                   */
/* PORT_A_ERR_INVALID_SELECTION        :  Selection chosen is        */
/*                                        invalid.                   */
/* PORT_A_ERR_INVALID_FUNCTION         :  Function Selection invalid.*/
/*-------------------------------------------------------------------*/
#define Port_A_ConfigureGPIO( PortPtr,                               \
                              SelectValue,                           \
                              FunctionType                           \
                            )                                        \
(                                                                    \
   (PORT_A_PARAM_CHECKING) ?                                         \
   (                                                                 \
   ((PortPtr) == NULL) ?                                             \
      PORT_A_ERR_INVALID_HANDLE  :                                   \
      (((SelectValue) < PORT_A_SHS ) ||                              \
       ((SelectValue) > PORT_A_PORT_CD)) ?                           \
         PORT_A_ERR_INVALID_SELECTION :                              \
      (((FunctionType) < PORT_A_DIGITAL_IO ) ||                      \
       ((FunctionType) > PORT_A_PRIMARY_FUNCTION)) ?                 \
         PORT_A_ERR_INVALID_FUNCTION :                               \
         Port_A_ConfigureGPIO_f ( (PortPtr),                         \
                                  (SelectValue),                     \
                                  (FunctionType)                     \
                                )                                    \
   )                                                                 \
   :                                                                 \
   Port_A_ConfigureGPIO_f ( (PortPtr),                               \
                            (SelectValue),                           \
                            (FunctionType)                           \
                         )                                           \
) /* end of Port_A_ConfigureGPIO Macro */

/*-------------------------------------------------------------------*/
/* Macro:   Port_A_SetRegister                                       */
/*                                                                   */
/* Purpose:   Call Port_A_SetRegister_f function with optional       */
/*            parameter checking.                                    */
/*                                                                   */
/* Input:                                                            */
/* PortPtr                    :  Port base address associated with   */
/*                               this driver.                        */
/* PortRegister               :  Select among Port registers.        */
/* RegisterValue              :  Data to copy into selected Register.*/
/*                                                                   */
/* Output:                                                           */
/* PORT_A_ERR_NONE                     :  No error.                  */
/* PORT_A_ERR_INVALID_HANDLE           :  Port base address parmeter */
/*                                        is zero.                   */
/* PORT_A_ERR_INVALID_REGISTER         :  Port Register selection is */
/*                                        invalid.                   */
/*-------------------------------------------------------------------*/
#define Port_A_SetRegister(  PortPtr,                                \
                             PortRegister,                           \
                             RegisterValue                           \
                          )                                          \
(                                                                    \
  (PORT_A_PARAM_CHECKING) ?                                          \
    (                                                                \
    ((PortPtr) == NULL) ?                                            \
      PORT_A_ERR_INVALID_HANDLE:                                     \
      (((PortRegister) < PORT_A_PORTA ) ||                           \
      ((PortRegister) > PORT_A_PEPAR))  ?                            \
      PORT_A_ERR_INVALID_REGISTER  :                                 \
      Port_A_SetRegister_f(   (PortPtr),                             \
                              (PortRegister),                        \
                              (RegisterValue)                        \
                          )                                          \
   )                                                                 \
   :                                                                 \
   Port_A_SetRegister_f(  (PortPtr),                                 \
                          (PortRegister),                            \
                          (RegisterValue)                            \
                       )                                             \
)  /* end of Port_A_SetRegister Macro  */                      

/*-------------------------------------------------------------------*/
/* Macro:   Port_A_GetRegister                                       */
/*                                                                   */
/* Purpose:     Call Port_A_GetRegister_f function with optional     */
/*              parameter checking.                                  */
/*                                                                   */
/* Input:                                                            */
/* PortPtr                    :  Port base address associated with   */
/*                               this driver.                        */
/* PortRegister               :  Select among Port registers.        */
/* GetRegisterPtr             :  Result address for selected Port    */
/*                               Register.                           */
/*                                                                   */
/* Output:                                                           */
/* PORT_A_ERR_NONE                     :  No error.                  */
/* PORT_A_ERR_INVALID_HANDLE           :  Port base address parmeter */
/*                                        is zero.                   */
/* PORT_A_ERR_INVALID_REGISTER         :  Port Register selection is */
/*                                        invalid.                   */
/* PORT_A_ERR_BAD_RESULT_ADDRESS       :  Result pointer is zero.    */
/*                                                                   */
/*-------------------------------------------------------------------*/
#define Port_A_GetRegister(   PortPtr,                               \
                              PortRegister,                          \
                              GetRegisterPtr                         \
                          )                                          \
(                                                                    \
   (PORT_A_PARAM_CHECKING) ?                                         \
   (                                                                 \
   ((PortPtr) == NULL) ?                                             \
      PORT_A_ERR_INVALID_HANDLE :                                    \
   ((GetRegisterPtr) == NULL) ?                                      \
      PORT_A_ERR_BAD_RESULT_ADDRESS :                                \
      (((PortRegister) < PORT_A_PORTA ) ||                           \
      ((PortRegister) > PORT_A_PEPAR))  ?                            \
      PORT_A_ERR_INVALID_REGISTER  :                                 \
      Port_A_GetRegister_f(   (PortPtr),                             \
                              (PortRegister),                        \
                              (GetRegisterPtr)                       \
                          )                                          \
    )                                                                \
    :                                                                \
    Port_A_GetRegister_f(  (PortPtr),                                \
                           (PortRegister),                           \
                           (GetRegisterPtr)                          \
                         )                                           \
)  /* end of Port_A_GetRegister Macro */

/*-------------------------------------------------------------------*/
/* Macro:   Port_A_WritePin                                          */
/*                                                                   */
/* Purpose:     Call Port_A_WritePin_f function with optional        */
/*              parameter checking.                                  */
/*                                                                   */
/* Input:                                                            */
/* PortPtr                    :  Port base address associated with   */
/*                               this driver.                        */
/* Port                       :  Select a Port A-I.                  */
/* PortPin                    :  Select a Port Pin 7:0               */
/* DataVal                    :  Zero or one will be written into    */
/*                               pin.                                */      
/*                                                                   */
/* Output:                                                           */
/* PORT_A_ERR_NONE                     :  No error.                  */
/* PORT_A_ERR_INVALID_HANDLE           :  Port base address parmeter */
/*                                        is zero.                   */
/* PORT_A_ERR_INVALID_PORT             :  Port selection is invalid. */
/* PORT_A_ERR_INVALID_PIN_NUMBER       :  Pin selection is invalid.  */
/* PORT_A_ERR_INVALID_DATA_VALUE       :  Value written invalid.     */
/*                                                                   */
/*-------------------------------------------------------------------*/
#define Port_A_WritePin(   PortPtr,                                  \
                           Port,                                     \
                           PortPin,                                  \
                           DataVal                                   \
                          )                                          \
(                                                                    \
   (PORT_A_PARAM_CHECKING) ?                                         \
   (                                                                 \
   ((PortPtr) == NULL) ?                                             \
      PORT_A_ERR_INVALID_HANDLE :                                    \
      (((Port) < PORT_A_PORT_A ) ||                                  \
       ((Port) > PORT_A_PORT_I))  ?                                  \
      PORT_A_ERR_INVALID_PORT  :                                     \
      (((PortPin) < PORT_A_PORTPIN_0 ) ||                            \
       ((PortPin) > PORT_A_PORTPIN_7))  ?                            \
       PORT_A_ERR_INVALID_PIN_NUMBER  :                              \
      (((DataVal) < PORT_A_CLEAR ) ||                                \
       ((DataVal) > PORT_A_SET))  ?                                  \
       PORT_A_ERR_INVALID_DATA_VALUE :                               \
       Port_A_WritePin_f(   (PortPtr),                               \
                            (Port),                                  \
                            (PortPin),                               \
                            (DataVal)                                \
                         )                                           \
    )                                                                \
    :                                                                \
    Port_A_WritePin_f(  (PortPtr),                                   \
                        (Port),                                      \
                        (PortPin),                                   \
                        (DataVal)                                    \
                     )                                               \
)  /* end of Port_A_WritePin Macro */

#endif

⌨️ 快捷键说明

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