| NUC472_NUC442_BSP V3.04.000 The Board Support Package for NUC472/NUC442

Macros | Functions
PS2 Exported Functions
NUC472/NUC442 Device Driver » PS2 Driver
Collaboration diagram for PS2 Exported Functions:

## Macros
#define | PS2_SET_TX_BYTE_CNT(u32Count)
| This function use to set TX FIFO length. More...
#define | PS2_GET_STATUS()
| This function use to get PS2 status. More...
#define | PS2_CLR_STATUS(u32Mask) (PS2D->PS2STATUS = u32Mask)
| This function use to clear PS2 status. More...
#define | PS2_CLR_RX_INT_FLAG()
| This function use to clear PS2 Rx interrupt. More...
#define | PS2_CLR_TX_INT_FLAG()
| This function use to clear PS2 Tx interrupt. More...
#define | PS2_GET_INT_FLAG(u32IntFlag)
| This function use to get PS2 interrupt. More...
#define | PS2_DISABLE_OVERRIDE()
| This function use to set PS2CLK and PS2DATA pins are controlled by hardware. More...
#define | PS2_ENABLE_OVERRIDE()
| This function use to set PS2CLK and PS2DATA pins are controlled by software. More...
#define | PS2_GET_TX_BYTE_INDEX()
| This function use to get indicates which data byte in transmit data shift register. More...
#define | PS2_SET_DATA_LOW()
| This function use to set PS2DATA Pin low. More...
#define | PS2_SET_DATA_HIGH()
| This function use to set PS2DATA Pin high. More...
#define | PS2_SET_CLK_LOW()
| This function use to set PS2CLK Pin low. More...
#define | PS2_SET_CLK_HIGH()
| This function use to set PS2CLK Pin high. More...
#define | PS2_DISABLE_ACK_ALWAYS()
| If Parity error or Stop bit is Not Received Correctly, Acknowledge will Not be Sent to host at 12th clock. More...
#define | PS2_ENABLE_ACK_ALWAYS()
| Always sends acknowledge to host at 12th clock for host to device communication. More...

## Functions
__STATIC_INLINE void | PS2_CLEAR_TX_FIFO (void)
| This function use to clear PS2 Tx FIFO. More...
void | PS2_Open (void)
| This function use to enable PS2 function and set one byte per trnasfer. More...
void | PS2_Close (void)
| This function use to disable PS2 function. More...
uint8_t | PS2_Read (void)
| This function use to read PS2 Rx data. More...
int32_t | PS2_Write (uint32_t *pu32Buf, uint32_t u32ByteCount)
| This function use to transmit PS2 data. More...
void | PS2_EnableInt (uint32_t u32Mask)
| The function is used to enable PS2 specified interrupt. More...
void | PS2_DisableInt (uint32_t u32Mask)
| The function is used to disable PS2 specified interrupt. More...

## Detailed Description

## Macro Definition Documentation

## ◆ PS2_CLR_RX_INT_FLAG

#define PS2_CLR_RX_INT_FLAG | ( |  | ) |

This function use to clear PS2 Rx interrupt.

Parameters

  None |

Returns
  None

Definition at line 93 of file ps2.h.

## ◆ PS2_CLR_STATUS

#define PS2_CLR_STATUS | ( |  | u32Mask | ) | (PS2D->PS2STATUS = u32Mask)

This function use to clear PS2 status.

Parameters

  [in] | u32Mask | Clear the specified status of Ps2 module: PS2_STATUS_FRAMEERR_Msk , PS2_STATUS_RXOV_Msk

Returns
  None

Definition at line 69 of file ps2.h.

## ◆ PS2_CLR_TX_INT_FLAG

#define PS2_CLR_TX_INT_FLAG | ( |  | ) |

This function use to clear PS2 Tx interrupt.

Parameters

  None |

Returns
  None

Definition at line 103 of file ps2.h.

## ◆ PS2_DISABLE_ACK_ALWAYS

#define PS2_DISABLE_ACK_ALWAYS | ( |  | ) |

If Parity error or Stop bit is Not Received Correctly, Acknowledge will Not be Sent to host at 12th clock.

Parameters

  None |

Returns
  None.

Definition at line 194 of file ps2.h.

## ◆ PS2_DISABLE_OVERRIDE

#define PS2_DISABLE_OVERRIDE | ( |  | ) |

This function use to set PS2CLK and PS2DATA pins are controlled by hardware.

Parameters

  None |

Returns
  None

Definition at line 124 of file ps2.h.

## ◆ PS2_ENABLE_ACK_ALWAYS

#define PS2_ENABLE_ACK_ALWAYS | ( |  | ) |

Always sends acknowledge to host at 12th clock for host to device communication.

Parameters

  None |

Returns
  None.

Definition at line 204 of file ps2.h.

## ◆ PS2_ENABLE_OVERRIDE

#define PS2_ENABLE_OVERRIDE | ( |  | ) |

This function use to set PS2CLK and PS2DATA pins are controlled by software.

Parameters

  None |

Returns
  None

Definition at line 134 of file ps2.h.

## ◆ PS2_GET_INT_FLAG

#define PS2_GET_INT_FLAG | ( |  | u32IntFlag | ) |

This function use to get PS2 interrupt.

Parameters

  [in] | u32IntFlag | interrupt flag: PS2_INTSTS_TXIF_Msk , PS2_INTSTS_RXIF_Msk

Returns
  1: interrupt occurs 0: interrupt not occurs

Definition at line 114 of file ps2.h.

## ◆ PS2_GET_STATUS

#define PS2_GET_STATUS | ( |  | ) |

This function use to get PS2 status.

Parameters

  None |

Returns
  PS2 status

Definition at line 59 of file ps2.h.

## ◆ PS2_GET_TX_BYTE_INDEX

#define PS2_GET_TX_BYTE_INDEX | ( |  | ) |

This function use to get indicates which data byte in transmit data shift register.

Parameters

  None |

Returns
  The indicates which data byte in transmit data shift register.

Definition at line 144 of file ps2.h.

## ◆ PS2_SET_CLK_HIGH

#define PS2_SET_CLK_HIGH | ( |  | ) |

This function use to set PS2CLK Pin high.

Parameters

  None |

Returns
  None.

Definition at line 184 of file ps2.h.

## ◆ PS2_SET_CLK_LOW

#define PS2_SET_CLK_LOW | ( |  | ) |

This function use to set PS2CLK Pin low.

Parameters

  None |

Returns
  None.

Definition at line 174 of file ps2.h.

## ◆ PS2_SET_DATA_HIGH

#define PS2_SET_DATA_HIGH | ( |  | ) |

This function use to set PS2DATA Pin high.

Parameters

  None |

Returns
  None.

Definition at line 164 of file ps2.h.

## ◆ PS2_SET_DATA_LOW

#define PS2_SET_DATA_LOW | ( |  | ) |

This function use to set PS2DATA Pin low.

Parameters

  None |

Returns
  None.

Definition at line 154 of file ps2.h.

## ◆ PS2_SET_TX_BYTE_CNT

#define PS2_SET_TX_BYTE_CNT | ( |  | u32Count | ) |

This function use to set TX FIFO length.

Parameters

  [in] | u32Count | TX FIFO length

Returns
  None

Definition at line 48 of file ps2.h.

## Function Documentation

## ◆ PS2_CLEAR_TX_FIFO()

__STATIC_INLINE void PS2_CLEAR_TX_FIFO | ( | void |  | ) |

This function use to clear PS2 Tx FIFO.

Parameters

  None |

Returns
  None

Definition at line 79 of file ps2.h.

## ◆ PS2_Close()

void PS2_Close | ( | void |  | ) |

This function use to disable PS2 function.

Parameters

  None |

Returns
  None

Definition at line 95 of file ps2.c.

## ◆ PS2_DisableInt()

void PS2_DisableInt | ( | uint32_t | u32Mask | ) |

The function is used to disable PS2 specified interrupt.

Parameters

  [in] | u32Mask | The specified interrupt of PS2 module: PS2_CTL_TXIEN_Msk : PS2 Tx interrupt PS2_CTL_RXIEN_Msk : PS2 Rx interrupt

Returns
  None

Definition at line 59 of file ps2.c.

## ◆ PS2_EnableInt()

void PS2_EnableInt | ( | uint32_t | u32Mask | ) |

The function is used to enable PS2 specified interrupt.

Parameters

  [in] | u32Mask | The specified interrupt of PS2 module: PS2_CTL_TXIEN_Msk : PS2 Tx interrupt PS2_CTL_RXIEN_Msk : PS2 Rx interrupt

Returns
  None

Definition at line 45 of file ps2.c.

## ◆ PS2_Open()

void PS2_Open | ( | void |  | ) |

This function use to enable PS2 function and set one byte per trnasfer.

Parameters

  None |

Returns
  None

Definition at line 71 of file ps2.c.

## ◆ PS2_Read()

uint8_t PS2_Read | ( | void |  | ) |

This function use to read PS2 Rx data.

Parameters

  None |

Returns
  Rx data

Definition at line 108 of file ps2.c.

## ◆ PS2_Write()

int32_t PS2_Write | ( | uint32_t * | pu32Buf,
|  | uint32_t | u32ByteCount
| ) |  |

This function use to transmit PS2 data.

Parameters

  [in] | pu32Buf | The buffer to send the data to PS2 transmission FIFO.
  [in] | u32ByteCount | The byte number of data.

Returns
  FALSE: transmit data time-out TRUE: transmit data successful

Definition at line 122 of file ps2.c.