source: network-demos/tftpTest/init.c @ f7b674f

4.11netdemos-4-5-branchnetwork-demos-4-10-branchnetwork-demos-4-6-branchnetwork-demos-4-7-branchnetwork-demos-4-8-branchnetwork-demos-4-9-branchrtems-4-5-branch
Last change on this file since f7b674f was 9399732, checked in by Joel Sherrill <joel.sherrill@…>, on 07/30/98 at 22:38:15

Switched to using a single usercfg.h file.

  • Property mode set to 100644
File size: 2.4 KB
Line 
1/*
2 * Test RTEMS/KA9Q TFTP device driver
3 *
4 * This program may be distributed and used for any purpose.
5 * I ask only that you:
6 *      1. Leave this author information intact.
7 *      2. Document any changes you make.
8 *
9 * W. Eric Norum
10 * Saskatchewan Accelerator Laboratory
11 * University of Saskatchewan
12 * Saskatoon, Saskatchewan, CANADA
13 * eric@skatter.usask.ca
14 */
15
16#include "../usercfg.h"
17
18#include <bsp.h>
19#include <rtems/error.h>
20#include <tftp.h>
21#include <rtems_ka9q.h>
22#include <stdio.h>
23
24#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
25
26#define CONFIGURE_EXECUTIVE_RAM_SIZE    (128*1024)
27#define CONFIGURE_MAXIMUM_SEMAPHORES    10
28#define CONFIGURE_MAXIMUM_TIMERS        5
29#define CONFIGURE_MAXIMUM_PERIODS       1
30
31#define CONFIGURE_MICROSECONDS_PER_TICK 10486
32
33#define CONFIGURE_INIT
34rtems_task Init (rtems_task_argument argument);
35
36#define CONFIGURE_HAS_OWN_DEVICE_DRIVER_TABLE
37rtems_driver_address_table Device_drivers[] = {
38  CONSOLE_DRIVER_TABLE_ENTRY,
39  CLOCK_DRIVER_TABLE_ENTRY,
40  TFTP_DRIVER_TABLE_ENTRY,
41};
42
43#include <confdefs.h>
44
45#include <bootp.h>
46extern void testTFTP (void);
47
48/*
49 * RTEMS Startup Task
50 */
51rtems_task
52Init (rtems_task_argument ignored)
53{
54        int i;
55        rtems_task_priority oldPri;
56        rtems_interval ticksPerSecond;
57
58        /*
59         * Get some timing information
60         */
61        rtems_clock_get (RTEMS_CLOCK_GET_TICKS_PER_SECOND, &ticksPerSecond);
62
63        /*
64         * Start KA9Q
65         */
66        rtems_task_set_priority (RTEMS_SELF, 30, &oldPri);
67        rtems_ka9q_start (20);
68
69        /*
70         * Hook up drivers
71         */
72        if (rtems_ka9q_execute_command ("attach rtems broadcast n ether " MY_ETHERNET_ADDRESS))
73                rtems_panic ("Can't attach Ethernet driver.\n");
74
75        /*
76         * Configure the driver
77         */
78        if (rtems_ka9q_execute_command ("ifconfig rtems broadcast 255.255.255.255"))
79                rtems_panic ("Can't configure Ethernet driver.\n");
80
81        /*
82         * Add the ethernet broadcast address to the ARP table.
83         */
84        if (rtems_ka9q_execute_command ("arp add 255.255.255.255 ether FF:FF:FF:FF:FF:FF"))
85                rtems_panic ("Can't add broadcast entry to ARP table.\n");
86
87        /*
88         * Get BOOTP information
89         */
90        for (i = 0 ; ; ) {
91                if (rtems_ka9q_execute_command ("bootp") == 0)
92                        break;
93                if (++i == 10)
94                        rtems_panic ("Can't get information from BOOTP server.\n");
95                rtems_task_wake_after (i * ticksPerSecond);
96        }
97
98        /*
99         * Test TFTP driver
100         */
101        testTFTP ();
102
103        /*
104         * Wind things up
105         */
106        rtems_task_wake_after (2 * ticksPerSecond);
107        rtems_ka9q_execute_command ("detach rtems");
108        exit (0);
109}
Note: See TracBrowser for help on using the repository browser.