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_TEST_NEEDS_CONSOLE_DRIVER |
---|
13 | #define CONFIGURE_TEST_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 | |
---|
35 | #include <errno.h> |
---|
36 | #include <time.h> |
---|
37 | |
---|
38 | #include <confdefs.h> |
---|
39 | #include <stdio.h> |
---|
40 | #include <rtems/rtems_bsdnet.h> |
---|
41 | #include <ftpd.h> |
---|
42 | |
---|
43 | |
---|
44 | #include <rtems/error.h> |
---|
45 | #include <rpc/rpc.h> |
---|
46 | #include <netinet/in.h> |
---|
47 | #include <time.h> |
---|
48 | |
---|
49 | #include <arpa/inet.h> |
---|
50 | #include <sys/socket.h> |
---|
51 | #include "../networkconfig.h" |
---|
52 | |
---|
53 | #include <rtems_webserver.h> |
---|
54 | |
---|
55 | #define ARGUMENT 0 |
---|
56 | |
---|
57 | /* |
---|
58 | * The tarfile is built in $(ARCH) so includes whether we were |
---|
59 | * built optimized or debug. |
---|
60 | */ |
---|
61 | |
---|
62 | #if defined(USE_FTPD) |
---|
63 | /* |
---|
64 | #if defined(RTEMS_DEBUG) |
---|
65 | extern int _binary_o_debug_tarfile_start; |
---|
66 | extern int _binary_o_debug_tarfile_size; |
---|
67 | #define TARFILE_START _binary_o_debug_tarfile_start |
---|
68 | #define TARFILE_SIZE _binary_o_debug_tarfile_size |
---|
69 | #else |
---|
70 | extern int _binary_o_optimize_tarfile_start; |
---|
71 | extern int _binary_o_optimize_tarfile_size; |
---|
72 | #define TARFILE_START _binary_o_optimize_tarfile_start |
---|
73 | #define TARFILE_SIZE _binary_o_optimize_tarfile_size |
---|
74 | #endif |
---|
75 | */ |
---|
76 | extern int _binary_tarfile_start; |
---|
77 | extern int _binary_tarfile_size; |
---|
78 | #define TARFILE_START _binary_tarfile_start |
---|
79 | #define TARFILE_SIZE _binary_tarfile_size |
---|
80 | #endif |
---|
81 | |
---|
82 | #if defined(USE_FTPD) |
---|
83 | struct rtems_ftpd_configuration rtems_ftpd_configuration = { |
---|
84 | 10, /* FTPD task priority */ |
---|
85 | 1024, /* Maximum buffersize for hooks */ |
---|
86 | 21, /* Well-known port */ |
---|
87 | NULL /* List of hooks */ |
---|
88 | }; |
---|
89 | #endif |
---|
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 | /* init_paging(); */ |
---|
99 | |
---|
100 | rtems_bsdnet_initialize_network (); |
---|
101 | #if defined(USE_FTPD) |
---|
102 | rtems_initialize_ftpd(); |
---|
103 | |
---|
104 | status = Untar_FromMemory((unsigned char *)(&TARFILE_START), &TARFILE_SIZE); |
---|
105 | #endif |
---|
106 | |
---|
107 | #if defined(USE_HTTPD) |
---|
108 | rtems_initialize_webserver(); |
---|
109 | #endif |
---|
110 | |
---|
111 | status = rtems_task_delete( RTEMS_SELF ); |
---|
112 | } |
---|
113 | |
---|
114 | |
---|
115 | |
---|
116 | |
---|