[4018538] | 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 | |
---|
[d51d8b5] | 8 | #define USE_HTTPD |
---|
| 9 | #define USE_FTPD |
---|
[4018538] | 10 | #define TEST_INIT |
---|
| 11 | |
---|
[5c663c0] | 12 | #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER |
---|
| 13 | #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER |
---|
[4018538] | 14 | #define CONFIGURE_RTEMS_INIT_TASKS_TABLE |
---|
[1a1b41cd] | 15 | #define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 20 |
---|
| 16 | #define CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM |
---|
[4018538] | 17 | |
---|
| 18 | #define CONFIGURE_EXECUTIVE_RAM_SIZE (512*1024) |
---|
| 19 | #define CONFIGURE_MAXIMUM_SEMAPHORES 20 |
---|
| 20 | #define CONFIGURE_MAXIMUM_TASKS 20 |
---|
| 21 | |
---|
[7054195] | 22 | #define CONFIGURE_MICROSECONDS_PER_TICK 10000 |
---|
[4018538] | 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 | |
---|
[631f794] | 38 | #include <rtems/confdefs.h> |
---|
[4018538] | 39 | #include <stdio.h> |
---|
| 40 | #include <rtems/rtems_bsdnet.h> |
---|
[cf5b3fa] | 41 | #include <rtems/ftpd.h> |
---|
| 42 | #include <rtems/untar.h> |
---|
[4018538] | 43 | |
---|
| 44 | |
---|
| 45 | #include <rtems/error.h> |
---|
| 46 | #include <rpc/rpc.h> |
---|
| 47 | #include <netinet/in.h> |
---|
| 48 | #include <time.h> |
---|
| 49 | |
---|
| 50 | #include <arpa/inet.h> |
---|
| 51 | #include <sys/socket.h> |
---|
| 52 | #include "../networkconfig.h" |
---|
| 53 | |
---|
| 54 | #include <rtems_webserver.h> |
---|
| 55 | |
---|
| 56 | #define ARGUMENT 0 |
---|
| 57 | |
---|
[1a1b41cd] | 58 | /* |
---|
[c2a4686] | 59 | * The tarfile is built automatically externally so we need to account |
---|
| 60 | * for the leading symbol on the names. |
---|
[1a1b41cd] | 61 | */ |
---|
[c2a4686] | 62 | #if defined(__sh__) |
---|
| 63 | #define SYM(_x) _x |
---|
[1a1b41cd] | 64 | #else |
---|
[c2a4686] | 65 | #define SYM(_x) _ ## _x |
---|
[d51d8b5] | 66 | #endif |
---|
[4018538] | 67 | |
---|
[c2a4686] | 68 | extern int SYM(binary_tarfile_start); |
---|
| 69 | extern int SYM(binary_tarfile_size); |
---|
| 70 | #define TARFILE_START SYM(binary_tarfile_start) |
---|
| 71 | #define TARFILE_SIZE SYM(binary_tarfile_size) |
---|
| 72 | |
---|
[d51d8b5] | 73 | #if defined(USE_FTPD) |
---|
[4018538] | 74 | struct rtems_ftpd_configuration rtems_ftpd_configuration = { |
---|
| 75 | 10, /* FTPD task priority */ |
---|
| 76 | 1024, /* Maximum buffersize for hooks */ |
---|
[1a1b41cd] | 77 | 21, /* Well-known port */ |
---|
[4018538] | 78 | NULL /* List of hooks */ |
---|
| 79 | }; |
---|
[d51d8b5] | 80 | #endif |
---|
[4018538] | 81 | rtems_task Init( |
---|
| 82 | rtems_task_argument argument |
---|
| 83 | ) |
---|
| 84 | { |
---|
| 85 | rtems_status_code status; |
---|
| 86 | |
---|
| 87 | printf("\n\n*** HTTP TEST ***\n\r" ); |
---|
| 88 | |
---|
[c2a4686] | 89 | status = Untar_FromMemory((void *)(&TARFILE_START), (size_t)&TARFILE_SIZE); |
---|
| 90 | |
---|
[4018538] | 91 | rtems_bsdnet_initialize_network (); |
---|
[d51d8b5] | 92 | #if defined(USE_FTPD) |
---|
[4018538] | 93 | rtems_initialize_ftpd(); |
---|
[d51d8b5] | 94 | #endif |
---|
[c2a4686] | 95 | |
---|
[d51d8b5] | 96 | #if defined(USE_HTTPD) |
---|
[4018538] | 97 | rtems_initialize_webserver(); |
---|
[d51d8b5] | 98 | #endif |
---|
[4018538] | 99 | |
---|
| 100 | status = rtems_task_delete( RTEMS_SELF ); |
---|
| 101 | } |
---|
| 102 | |
---|
| 103 | |
---|
| 104 | |
---|
| 105 | |
---|