Subversion Repositories pentevo

Rev

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

Rev 180 Rev 186
Line 15... Line 15...
15
#include "rs232.h"
15
#include "rs232.h"
16
#include "rtc.h"
16
#include "rtc.h"
17
#include "atx.h"
17
#include "atx.h"
18
#include "joystick.h"
18
#include "joystick.h"
19
 
19
 
20
/** Pointer to current byte in FPGA. */
20
/** FPGA data pointer [far address] (linker symbol). */
-
 
21
extern ULONG fpga PROGMEM;
-
 
22
 
-
 
23
// FPGA data index..
21
ULONG curFpga;
24
volatile ULONG curFpga;
22
 
25
 
23
//Common flag register.
26
// Common flag register.
24
volatile UBYTE flags_register;
27
volatile UBYTE flags_register;
25
 
28
 
26
// Common modes register.
29
// Common modes register.
27
volatile UBYTE modes_register;
30
volatile UBYTE modes_register;
28
 
31
 
29
//buffer for depacking FPGA configuration
32
// Buffer for depacking FPGA configuration.
30
//you can USED for other purposed after setup FPGA
33
// You can USED for other purposed after setup FPGA.
31
UBYTE dbuf[DBSIZE];
34
UBYTE dbuf[DBSIZE];
32
 
35
 
33
void put_buffer(UWORD size)
36
void put_buffer(UWORD size)
34
{
37
{
35
        // writes specified length of buffer to the output
38
        // writes specified length of buffer to the output
Line 129... Line 132...
129
 
132
 
130
        DDRF |= (1<<nCONFIG); // pull low for a time
133
        DDRF |= (1<<nCONFIG); // pull low for a time
131
        _delay_us(40);
134
        _delay_us(40);
132
        DDRF &= ~(1<<nCONFIG);
135
        DDRF &= ~(1<<nCONFIG);
133
        while( !(PINF & (1<<nSTATUS)) ); // wait ready
136
        while( !(PINF & (1<<nSTATUS)) ); // wait ready
-
 
137
 
134
        curFpga = fpga; // prepare for data fetching
138
        curFpga = GET_FAR_ADDRESS(fpga); // prepare for data fetching
-
 
139
#ifdef LOGENABLE
-
 
140
        {
-
 
141
        char log_fpga[]="F........\r\n";
-
 
142
        UBYTE b = (UBYTE)((curFpga>>24)&0xFF);
-
 
143
        log_fpga[1] = ((b >> 4) <= 9 )?'0'+(b >> 4):'A'+(b >> 4)-10;
-
 
144
        log_fpga[2] = ((b & 0x0F) <= 9 )?'0'+(b & 0x0F):'A'+(b & 0x0F)-10;
-
 
145
        b = (UBYTE)((curFpga>>16)&0xFF);
-
 
146
        log_fpga[3] = ((b >> 4) <= 9 )?'0'+(b >> 4):'A'+(b >> 4)-10;
-
 
147
        log_fpga[4] = ((b & 0x0F) <= 9 )?'0'+(b & 0x0F):'A'+(b & 0x0F)-10;
-
 
148
        b = (UBYTE)((curFpga>>8)&0xFF);
-
 
149
        log_fpga[5] = ((b >> 4) <= 9 )?'0'+(b >> 4):'A'+(b >> 4)-10;
-
 
150
        log_fpga[6] = ((b & 0x0F) <= 9 )?'0'+(b & 0x0F):'A'+(b & 0x0F)-10;
-
 
151
        b = (UBYTE)(curFpga&0xFF);
-
 
152
        log_fpga[7] = ((b >> 4) <= 9 )?'0'+(b >> 4):'A'+(b >> 4)-10;
-
 
153
        log_fpga[8] = ((b & 0x0F) <= 9 )?'0'+(b & 0x0F):'A'+(b & 0x0F)-10;
-
 
154
        to_log(log_fpga);
-
 
155
        }
-
 
156
#endif
135
        depacker_dirty();
157
        depacker_dirty();
136
 
158
 
137
        //power led OFF
159
        //power led OFF
138
        LED_PORT |= 1<<LED;
160
        LED_PORT |= 1<<LED;
139
 
161
 
Line 165... Line 187...
165
        //INT7 - RTC  (falling edge)
187
        //INT7 - RTC  (falling edge)
166
        EICRB = (1<<ISC41)+(0<<ISC40) + (1<<ISC51)+(0<<ISC50) + (1<<ISC61)+(0<<ISC60) + (1<<ISC71)+(0<<ISC70); // set condition for interrupt
188
        EICRB = (1<<ISC41)+(0<<ISC40) + (1<<ISC51)+(0<<ISC50) + (1<<ISC61)+(0<<ISC60) + (1<<ISC71)+(0<<ISC70); // set condition for interrupt
167
        EIFR = (1<<INTF4)|(1<<INTF5)|(1<<INTF6)|(1<<INTF7); // clear spurious ints there
189
        EIFR = (1<<INTF4)|(1<<INTF5)|(1<<INTF6)|(1<<INTF7); // clear spurious ints there
168
        EIMSK |= (1<<INT4)|(1<<INT5)|(1<<INT6)|(1<<INT7); // enable
190
        EIMSK |= (1<<INT4)|(1<<INT5)|(1<<INT6)|(1<<INT7); // enable
169
 
191
 
170
        rtc_init();
-
 
171
        zx_init();
192
        zx_init();
-
 
193
        rtc_init();
172
 
194
 
173
 
195
 
174
#ifdef LOGENABLE
196
#ifdef LOGENABLE
175
        to_log("zx_init OK\r\n");
197
        to_log("zx_init OK\r\n");
176
#endif
198
#endif