summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillaume Knispel <gknispel@avencall.com>2012-07-06 15:57:55 +0200
committerGuillaume Knispel <gknispel@avencall.com>2012-07-06 15:57:55 +0200
commit9603a96ae87212c2759ace4ea10c4213782fc308 (patch)
tree3196e234ad8dd93835ed04be2bf096672799f863
parentf77d27191ba4e81e90de283bc7bfd01a2c7ed6e6 (diff)
move SW1State out of TENSION_EXPIRED
TENSION_EXPIRED is not a name that implies that it is also monitoring the power button, and there also are litteral uses of SW1State alone in some states, so it is better to be more explicit and write SW1State || TENSION_EXPIRED where TENSION_EXPIRED was previously used.
-rw-r--r--main.c14
-rwxr-xr-xperm.sh4
2 files changed, 11 insertions, 7 deletions
diff --git a/main.c b/main.c
index 7805625..72b701a 100644
--- a/main.c
+++ b/main.c
@@ -44,12 +44,12 @@ volatile u8 bV1P8_DDR = true;
volatile u8 bV2P5 = true;
volatile u8 bVCC3 = true;
-#define TENSION_EXPIRED (SW1State || Timer1 == 0)
+#define TENSION_EXPIRED (Timer1 == 0)
#define TENSION_WAIT(t) (t)
#else
-#define TENSION_EXPIRED (SW1State)
+#define TENSION_EXPIRED (0)
#define TENSION_WAIT(t) (Timer1 == 0)
#endif
@@ -94,7 +94,7 @@ int main(void)
break;
case WAIT_ATX_OK:
- if (TENSION_EXPIRED)
+ if (SW1State || TENSION_EXPIRED)
state = STOP; // if SW1 just pressed during power or ATX didn't set up
// ATX power OK, stop
if ((P4IN & ATX_PWROK) && TENSION_WAIT(bV2P5 && bVCC3)) {
@@ -107,7 +107,7 @@ int main(void)
break;
case WAIT_V1P2:
- if (TENSION_EXPIRED)
+ if (SW1State || TENSION_EXPIRED)
state = STOP;
if (TENSION_WAIT(bV1P2)) { // Got V1P2 stable
Timer1 = 30; // set Timer1 @ 30 milli seconde to get V1P8-DDR stable
@@ -127,7 +127,7 @@ int main(void)
break;
case WAIT_V1P8:
- if (TENSION_EXPIRED)
+ if (SW1State || TENSION_EXPIRED)
state = STOP;
if (TENSION_WAIT(bV1P8)) {
ClrBit(P2OUT, CPU_VCCP_EN_N); // enable V1P0
@@ -137,7 +137,7 @@ int main(void)
break;
case WAIT_V1P0:
- if (TENSION_EXPIRED)
+ if (SW1State || TENSION_EXPIRED)
state = STOP;
if (TENSION_WAIT(bV1P0)) { // Got V1P0 stable and all other supplies too
SetBit(P3OUT, VRMPWRGD);
@@ -167,7 +167,7 @@ int main(void)
}
break;
case CPU_RUN + 1:
- if (SW1State != 0) // if SW1 just pressed during power up go STOP
+ if (SW1State) // if SW1 just pressed during power up go STOP
state = STOP;
if (Timer1 == 0) {
ClrBit(P2DIR, IMCH_PWRBTN_N); // Release IMCH-PWRBTN-N signal after 200
diff --git a/perm.sh b/perm.sh
new file mode 100755
index 0000000..96e4ad9
--- /dev/null
+++ b/perm.sh
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+set -e
+chmod a-x def.h hardware.h main.c