@@ -142,6 +142,10 @@ static int up_ioctl(struct file *filep, int cmd, unsigned long arg);
142
142
static int up_receive (struct uart_dev_s * dev , unsigned int * status );
143
143
static void up_rxint (struct uart_dev_s * dev , bool enable );
144
144
static bool up_rxavailable (struct uart_dev_s * dev );
145
+ #ifdef CONFIG_SERIAL_IFLOWCONTROL
146
+ static bool up_rxflowcontrol (struct uart_dev_s * dev ,
147
+ unsigned int nbuffered , bool upper );
148
+ #endif
145
149
static void up_send (struct uart_dev_s * dev , int ch );
146
150
static void up_txint (struct uart_dev_s * dev , bool enable );
147
151
static bool up_txready (struct uart_dev_s * dev );
@@ -162,7 +166,7 @@ static const struct uart_ops_s g_uart_ops =
162
166
.rxint = up_rxint ,
163
167
.rxavailable = up_rxavailable ,
164
168
#ifdef CONFIG_SERIAL_IFLOWCONTROL
165
- .rxflowcontrol = NULL ,
169
+ .rxflowcontrol = up_rxflowcontrol ,
166
170
#endif
167
171
.send = up_send ,
168
172
.txint = up_txint ,
@@ -1015,6 +1019,47 @@ static bool up_rxavailable(struct uart_dev_s *dev)
1015
1019
return ((up_serialin (priv , MPFS_UART_LSR_OFFSET ) & UART_LSR_DR ) != 0 );
1016
1020
}
1017
1021
1022
+ #ifdef CONFIG_SERIAL_IFLOWCONTROL
1023
+ /****************************************************************************
1024
+ * Name: up_rxflowcontrol
1025
+ *
1026
+ * Description:
1027
+ * Basic flowcontrol functionality.
1028
+ * Disable RX interrupts and clear the fifo in case of full RX buffer.
1029
+ * Enable RX interrupts in case of empty buffer.
1030
+ * Return true if RX FIFO was cleared.
1031
+ *
1032
+ ****************************************************************************/
1033
+
1034
+ static bool up_rxflowcontrol (struct uart_dev_s * dev ,
1035
+ unsigned int nbuffered , bool upper )
1036
+ {
1037
+ struct up_dev_s * priv = (struct up_dev_s * )dev -> priv ;
1038
+ bool ret = false;
1039
+
1040
+ if (nbuffered == 0 || upper == false)
1041
+ {
1042
+ /* Empty buffer. Enable RX ints */
1043
+
1044
+ up_rxint (dev , true);
1045
+
1046
+ ret = false;
1047
+ }
1048
+ else
1049
+ {
1050
+ /* Full buffer. Disable RX ints and clear the RX FIFO */
1051
+
1052
+ up_rxint (dev , false);
1053
+
1054
+ up_serialout (priv , MPFS_UART_FCR_OFFSET , UART_FCR_RFIFOR );
1055
+
1056
+ ret = true;
1057
+ }
1058
+
1059
+ return ret ;
1060
+ }
1061
+ #endif
1062
+
1018
1063
/****************************************************************************
1019
1064
* Name: up_send
1020
1065
*
0 commit comments