Subversion Repositories pentevo

Rev

Rev 855 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 855 Rev 861
Line 30... Line 30...
30
#endif
30
#endif
31
 
31
 
32
        //check power
32
        //check power
33
        if ( (nCONFIG_PIN & (1<<nCONFIG)) == 0 )
33
        if ( (nCONFIG_PIN & (1<<nCONFIG)) == 0 )
34
        {
34
        {
-
 
35
                // only after poweron reset we should wait for soft reset button before powering on
-
 
36
                if(  !(j & ((1<<JTRF)|(1<<WDRF)|(1<<BORF)|(1<<EXTRF)))  ||  (j & (1<<PORF))  )
-
 
37
                {
-
 
38
                        // have at least 2 sec pause before turning on, as this hopefully gives enough time
-
 
39
                        // for FPGA voltages to drop and it will powerup cleanly without compromising the firmware
-
 
40
                        UBYTE soft_rst_pressed = 0;
-
 
41
                        UBYTE i = PRE_PWRON_WAIT;
-
 
42
 
-
 
43
                        do
-
 
44
                        {
35
                //if not external reset
45
                                // blink power LED
-
 
46
                                if( i&7 )
-
 
47
                                        LED_PORT |=  (1<<LED);
-
 
48
                                else
-
 
49
                                        LED_PORT &= ~(1<<LED);
-
 
50
 
-
 
51
                                _delay_ms(20);
-
 
52
 
36
                //then wait for atx power on button (SOFTRESET)
53
                                // if soft reset was pressed during wait, remember it and go poweron immediately after the wait ends
37
                if ( !(j & ((1<<JTRF)|(1<<WDRF)|(1<<BORF)|(1<<EXTRF))) ||
54
                                soft_rst_pressed |= !(SOFTRES_PIN & (1<<SOFTRES));
-
 
55
 
38
                         (j & (1<<PORF)) )
56
                        } while(--i);
-
 
57
 
-
 
58
                        // wait further for soft reset press
39
                while( SOFTRES_PIN&(1<<SOFTRES) );
59
                        if( !soft_rst_pressed ) while( SOFTRES_PIN&(1<<SOFTRES) );
-
 
60
                }
40
 
61
 
41
                //switch on ATX power (PF3 pin in PORTF)
62
                //switch on ATX power (PF3 pin in PORTF)
42
                ATXPWRON_PORT |= (1<<ATXPWRON);
63
                ATXPWRON_PORT |= (1<<ATXPWRON);
43
 
64
 
44
                //1 sec delay
65
                //1 sec delay
Line 58... Line 79...
58
 
79
 
59
        if ( atx_counter > PWROFF_KEY_TIME )
80
        if ( atx_counter > PWROFF_KEY_TIME )
60
        {
81
        {
61
                //here if either SOFTRES_PIN or F12 held for more than ~5 seconds
82
                //here if either SOFTRES_PIN or F12 held for more than ~5 seconds
62
 
83
 
63
//              if ( ( SOFTRES_PIN & (1<<SOFTRES) ) == 0 )
-
 
64
//              {
-
 
65
//                      //atx power off button pressed (~5 sec)
-
 
66
//
-
 
67
//                      //switch off atx power
-
 
68
//                      atxpwron_port &= ~(1<<atxpwron);
-
 
69
//
-
 
70
//                      // wait for power to drop 
-
 
71
//              }
-
 
72
//              else
-
 
73
//              {
-
 
74
//                      //enable hard reset
-
 
75
//                      flags_register |= FLAG_HARD_RESET;
-
 
76
//              }
-
 
77
 
84
 
78
 
85
 
79
                // no more need in executing mainloop and servicing interrupts
86
                // no more need in executing mainloop and servicing interrupts
80
                cli();
87
                cli();
81
 
88
 
Line 114... Line 121...
114
                //soft reset (reset Z80 only) -- F12 or softreset pressed for less than 1700 ticks
121
                //soft reset (reset Z80 only) -- F12 or softreset pressed for less than 1700 ticks
115
                zx_spi_send(SPI_RST_REG, 0, 0x7F);
122
                zx_spi_send(SPI_RST_REG, 0, 0x7F);
116
        }
123
        }
117
        last_count = atx_counter;
124
        last_count = atx_counter;
118
 
125
 
119
//      if ( ( nCONFIG_PIN & (1<<nCONFIG) ) == 0 )
-
 
120
//      {
-
 
121
//              //power down
-
 
122
//
-
 
123
//              //power led off (timer output disconnect from led pin)
-
 
124
//              TCCR2 &= ~((1<<COM20)|(1<<COM21));
-
 
125
//
-
 
126
//              //wait for button released
-
 
127
//              while (  ( SOFTRES_PIN & (1<<SOFTRES) ) == 0 );
-
 
128
//
-
 
129
//              //1 sec delay
-
 
130
//              do _delay_ms(20); while(--j);
-
 
131
//
-
 
132
//              last_count = 0;
-
 
133
//
-
 
134
//              //enable hard reset
-
 
135
//              flags_register |= FLAG_HARD_RESET;
-
 
136
//      }
-
 
137
 
126
 
138
}
127
}