Main Page | File List | Globals

xmodem.c

Go to the documentation of this file.
00001 // This file has been prepared for Doxygen automatic documentation generation.
00023 #include "xmodem.h"
00024 
00025 volatile unsigned char buf[133];
00026 
00027 struct global
00028 {
00029   volatile unsigned char *recv_ptr;
00030   volatile unsigned char buffer_status;
00031   volatile unsigned char recv_error;
00032   volatile unsigned char t1_timed_out;
00033 } gl;
00034 
00035 
00036 __C_task void main(void)
00037 {
00038   CLKPR = (1 << CLKPCE);  // enable prescaler update
00039   CLKPR = 0;              // set maximum clock frequency
00040 
00041   // PortD bit 2 - pushbutton used to start data reception
00042   // PortD bit 3 - pushbutton used for simulating errors - see validate_packet.c
00043   // Pin:        PD7, PD6, PD5, PD4, PD3, PD2, PD1, PD0
00044   // Direction:  O    O    O    O    I    I    O    O
00045   // DDR bit:    1    1    1    1    0    0    1    1
00046   DDRD = 0xf3;
00047   PORTD = 0xff;
00048 
00049   init();     // low level hardware initialization
00050   __enable_interrupt();     /* enable interrupts */
00051 
00052   purge();   // clear uart data register ... allow transmitter opportunity to unload its buffer
00053   for(;;)
00054   {
00055     while (PIND &= 0x04);   // wait until pd2 pulled low
00056 
00057     receive(&buf[0]);
00058   }
00059 } // main

Generated on Tue Aug 23 13:47:53 2005 for Atmel AVR Application Note by  doxygen 1.4.4