summaryrefslogtreecommitdiffstats
path: root/file_io/crc/init.c
blob: 4888e70754149ccf30c5c5d7f9ae6a05d1bc57da (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/*
 *  COPYRIGHT (c) 1989-2011.
 *  On-Line Applications Research Corporation (OAR).
 *
 *  The license and distribution terms for this file may be
 *  found in the file LICENSE in this distribution or at
 *  http://www.rtems.com/license/LICENSE.
 */



#include <rtems.h>
#include <bsp.h>

#include <stdio.h>
#include <stdlib.h>

#include "fs-root-tar.h"
#include <rtems/untar.h>

/* sha-specific includes */
#include <string.h>
#include <time.h>
#include "crc.h"
#include <errno.h>

rtems_task Init(
  rtems_task_argument ignored
)
{
  char in_file[20] = "/image.img";
  DWORD crc;
  long charcnt;

  puts( "\n\n*** untar/imfs/crc example ***" );

  printf("Unpacking tar filesystem\nThis may take awhile...\n");
  if(Untar_FromMemory((char*) fs_root_tar, fs_root_tar_size) != 0) {
    printf("Can't unpack tar filesystem\n");
    exit(1);
  }

  crc32file(in_file,&crc, &charcnt);
  printf("%08lX %7ld %s\n", crc, charcnt, in_file);

  printf( "*** end of demonstration ***\n" );
  exit( 0 );
}

/* configuration */
/* drivers */
#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER

/* filesystem */
#define CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM
#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 40
#define CONFIGURE_IMFS_MEMFILE_BYTES_PER_BLOCK 512

/* tasks */
#define CONFIGURE_MAXIMUM_TASKS             4
#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
#define CONFIGURE_EXTRA_TASK_STACKS         (3 * RTEMS_MINIMUM_STACK_SIZE)

#define CONFIGURE_INIT
#include <rtems/confdefs.h>
/* end of file */