1 | /* Init |
---|
2 | * |
---|
3 | * This routine is the initialization task for this test program. |
---|
4 | * |
---|
5 | * Don't forget to change the IP addresses |
---|
6 | */ |
---|
7 | |
---|
8 | #define USE_HTTPD |
---|
9 | #define USE_FTPD |
---|
10 | #define TEST_INIT |
---|
11 | |
---|
12 | #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER |
---|
13 | #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER |
---|
14 | #define CONFIGURE_RTEMS_INIT_TASKS_TABLE |
---|
15 | #define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 20 |
---|
16 | #define CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM |
---|
17 | |
---|
18 | #define CONFIGURE_EXECUTIVE_RAM_SIZE (512*1024) |
---|
19 | #define CONFIGURE_MAXIMUM_SEMAPHORES 20 |
---|
20 | #define CONFIGURE_MAXIMUM_TASKS 20 |
---|
21 | |
---|
22 | #define CONFIGURE_MICROSECONDS_PER_TICK 10000 |
---|
23 | |
---|
24 | #define CONFIGURE_INIT_TASK_STACK_SIZE (10*1024) |
---|
25 | #define CONFIGURE_INIT_TASK_PRIORITY 120 |
---|
26 | #define CONFIGURE_INIT_TASK_INITIAL_MODES (RTEMS_PREEMPT | \ |
---|
27 | RTEMS_NO_TIMESLICE | \ |
---|
28 | RTEMS_NO_ASR | \ |
---|
29 | RTEMS_INTERRUPT_LEVEL(0)) |
---|
30 | |
---|
31 | #define CONFIGURE_INIT |
---|
32 | |
---|
33 | #include "system.h" |
---|
34 | #include <bsp.h> |
---|
35 | |
---|
36 | #include <errno.h> |
---|
37 | #include <time.h> |
---|
38 | |
---|
39 | #include <rtems/confdefs.h> |
---|
40 | #include <stdio.h> |
---|
41 | #include <rtems/rtems_bsdnet.h> |
---|
42 | #include <rtems/ftpd.h> |
---|
43 | #include <rtems/untar.h> |
---|
44 | |
---|
45 | |
---|
46 | #include <rtems/error.h> |
---|
47 | #include <rpc/rpc.h> |
---|
48 | #include <netinet/in.h> |
---|
49 | #include <time.h> |
---|
50 | |
---|
51 | #include <arpa/inet.h> |
---|
52 | #include <sys/socket.h> |
---|
53 | #include "../networkconfig.h" |
---|
54 | |
---|
55 | #include <rtems_webserver.h> |
---|
56 | |
---|
57 | #define ARGUMENT 0 |
---|
58 | |
---|
59 | /* |
---|
60 | * The tarfile is built automatically externally so we need to account |
---|
61 | * for the leading symbol on the names. |
---|
62 | */ |
---|
63 | #if defined(__sh__) |
---|
64 | #define SYM(_x) _x |
---|
65 | #else |
---|
66 | #define SYM(_x) _ ## _x |
---|
67 | #endif |
---|
68 | |
---|
69 | extern int SYM(binary_tarfile_start); |
---|
70 | extern int SYM(binary_tarfile_size); |
---|
71 | #define TARFILE_START SYM(binary_tarfile_start) |
---|
72 | #define TARFILE_SIZE SYM(binary_tarfile_size) |
---|
73 | |
---|
74 | #if defined(USE_FTPD) |
---|
75 | struct rtems_ftpd_configuration rtems_ftpd_configuration = { |
---|
76 | 10, /* FTPD task priority */ |
---|
77 | 1024, /* Maximum buffersize for hooks */ |
---|
78 | 21, /* Well-known port */ |
---|
79 | NULL /* List of hooks */ |
---|
80 | }; |
---|
81 | #endif |
---|
82 | |
---|
83 | /* GoAhead Trace Handler */ |
---|
84 | #include <goahead/uemf.h> |
---|
85 | void quietTraceHandler(int level, char *buf) |
---|
86 | { |
---|
87 | /* do nothing */ |
---|
88 | } |
---|
89 | |
---|
90 | rtems_task Init( |
---|
91 | rtems_task_argument argument |
---|
92 | ) |
---|
93 | { |
---|
94 | rtems_status_code status; |
---|
95 | |
---|
96 | printf("\n\n*** HTTP TEST ***\n\r" ); |
---|
97 | |
---|
98 | status = Untar_FromMemory((void *)(&TARFILE_START), (size_t)&TARFILE_SIZE); |
---|
99 | |
---|
100 | rtems_bsdnet_initialize_network (); |
---|
101 | #if defined(USE_FTPD) |
---|
102 | rtems_initialize_ftpd(); |
---|
103 | #endif |
---|
104 | |
---|
105 | #if defined(USE_HTTPD) |
---|
106 | if ( rtems_initialize_webserver() ) |
---|
107 | printf( "ERROR -- failed to initialize webserver\n" ); |
---|
108 | |
---|
109 | traceSetHandler( quietTraceHandler ); |
---|
110 | #endif |
---|
111 | |
---|
112 | status = rtems_task_delete( RTEMS_SELF ); |
---|
113 | } |
---|
114 | |
---|
115 | |
---|
116 | |
---|
117 | |
---|