OpenCores
URL https://opencores.org/ocsvn/amber/amber/trunk

Subversion Repositories amber

[/] [amber/] [trunk/] [sw/] [boot-loader-ethmac/] [boot-loader-ethmac.c] - Blame information for rev 80

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 61 csantifort
/*----------------------------------------------------------------
2
//                                                              //
3
//  boot-loader-ethmac.c                                        //
4
//                                                              //
5
//  This file is part of the Amber project                      //
6
//  http://www.opencores.org/project,amber                      //
7
//                                                              //
8
//  Description                                                 //
9
//  The main functions for the boot loader application. This    //
10 78 csantifort
//  application is embedded in the FPGA's SRAM and is used      //
11 61 csantifort
//  to load larger applications into the DDR3 memory on         //
12
//  the development board.                                      //
13
//                                                              //
14
//  Author(s):                                                  //
15
//      - Conor Santifort, csantifort.amber@gmail.com           //
16
//                                                              //
17
//////////////////////////////////////////////////////////////////
18
//                                                              //
19
// Copyright (C) 2011 Authors and OPENCORES.ORG                 //
20
//                                                              //
21
// This source file may be used and distributed without         //
22
// restriction provided that this copyright statement is not    //
23
// removed from the file and that any derivative work contains  //
24
// the original copyright notice and the associated disclaimer. //
25
//                                                              //
26
// This source file is free software; you can redistribute it   //
27
// and/or modify it under the terms of the GNU Lesser General   //
28
// Public License as published by the Free Software Foundation; //
29
// either version 2.1 of the License, or (at your option) any   //
30
// later version.                                               //
31
//                                                              //
32
// This source is distributed in the hope that it will be       //
33
// useful, but WITHOUT ANY WARRANTY; without even the implied   //
34
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      //
35
// PURPOSE.  See the GNU Lesser General Public License for more //
36
// details.                                                     //
37
//                                                              //
38
// You should have received a copy of the GNU Lesser General    //
39
// Public License along with this source; if not, download it   //
40
// from http://www.opencores.org/lgpl.shtml                     //
41
//                                                              //
42
----------------------------------------------------------------*/
43
 
44
#include "line-buffer.h"
45
#include "timer.h"
46
#include "utilities.h"
47 80 csantifort
#include "packet.h"
48 61 csantifort
#include "ethmac.h"
49
#include "tcp.h"
50
#include "udp.h"
51
#include "telnet.h"
52 78 csantifort
#include "serial.h"
53 61 csantifort
 
54
 
55
int main ( void ) {
56 80 csantifort
    socket_t* socket;
57 78 csantifort
 
58
    /* Enable the serial debug port */
59
    init_serial();
60
    print_serial("Amber debug port\n\r");
61
 
62
 
63
    /* initialize the memory allocation system */
64 61 csantifort
    init_malloc();
65 78 csantifort
 
66 80 csantifort
    /* Enable the hardware timer to generate interrrupts 100 timer per second,
67
       current time will start incrementing from this point onwards */
68
    init_timer();
69 78 csantifort
 
70 80 csantifort
    /* Create a timer to flash a led periodically */
71
    init_led();
72 78 csantifort
 
73 80 csantifort
    /* initialize the tftp stuff */
74
    init_tftp();
75 78 csantifort
 
76
 
77 80 csantifort
    /* create a tcp socket for listening */
78
    first_socket_g = new_socket(NULL);
79
    socket = first_socket_g;
80 78 csantifort
 
81 80 csantifort
    /* initialize the PHY and MAC and listen for connections
82
       This is the last init because packets will be received from this point
83
       onwards. */
84
    init_ethmac();
85 78 csantifort
 
86
 
87 80 csantifort
    /* Process loop. Everything is timer, interrupt and queue driven from here on down */
88 61 csantifort
    while (1) {
89 78 csantifort
 
90 80 csantifort
        /* flash an led */
91
        process_led();
92 78 csantifort
 
93 80 csantifort
        /* Check for received tftp files and reboot */
94
        process_tftp();
95 78 csantifort
 
96 80 csantifort
        /* handle tcp connections and process buffers */
97
            /* Poll all sockets in turn for activity */
98
        if (socket->next == NULL)
99
            socket = first_socket_g;
100 61 csantifort
        else
101 80 csantifort
            socket = socket->next;
102 78 csantifort
 
103 80 csantifort
        process_tcp(socket);
104 61 csantifort
    }
105
}
106
 
107
 
108
 
109 78 csantifort
 
110
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.