]> rtime.felk.cvut.cz Git - arc.git/commitdiff
Dio_ReadChannel now reads output value if channel is set as output mpc551x_mcal
authortojo <tobias.johansson@arccore.com>
Thu, 24 Feb 2011 09:29:55 +0000 (10:29 +0100)
committertojo <tobias.johansson@arccore.com>
Thu, 24 Feb 2011 09:29:55 +0000 (10:29 +0100)
arch/ppc/mpc55xx/drivers/Dio.c

index 9de43cb38cceda6405f8da88d3ee6feaf7c4fd72..96b7e2d8dd3d06b5d387fd7461319d744a179531 100644 (file)
@@ -105,16 +105,24 @@ static int Channel_Group_Config_Contains(const Dio_ChannelGroupType* _channelGro
 \r
 Dio_LevelType Dio_ReadChannel(Dio_ChannelType channelId)\r
 {\r
-  Dio_LevelType level;\r
+  Dio_LevelType level = STD_LOW;\r
   VALIDATE_CHANNEL(channelId, DIO_READCHANNEL_ID);\r
-  // Read level from SIU.\r
-  if (SIU.GPDI [channelId].R)\r
-  {\r
-    level = STD_HIGH;\r
-  } else\r
-  {\r
-    level = STD_LOW;\r
+  if (SIU.PCR[channelId].B.IBE) {\r
+    // Read level from SIU.\r
+    if (SIU.GPDI [channelId].R) {\r
+      level = STD_HIGH;\r
+    } else {\r
+      level = STD_LOW;\r
+    }\r
+  } else if(SIU.PCR[channelId].B.OBE) {\r
+    // Read level from SIU.\r
+    if (SIU.GPDO [channelId].R) {\r
+      level = STD_HIGH;\r
+    } else {\r
+      level = STD_LOW;\r
+    }\r
   }\r
+\r
   cleanup: return (level);\r
 }\r
 \r
@@ -122,7 +130,9 @@ void Dio_WriteChannel(Dio_ChannelType channelId, Dio_LevelType level)
 {\r
   VALIDATE_CHANNEL(channelId, DIO_WRITECHANNEL_ID);\r
   // Write level to SIU.\r
-  SIU.GPDO [channelId].R = level;\r
+  if(SIU.PCR[channelId].B.OBE) {\r
+    SIU.GPDO [channelId].R = level;\r
+  }\r
   cleanup: return;\r
 }\r
 \r