OpenCores
URL https://opencores.org/ocsvn/funbase_ip_library/funbase_ip_library/trunk

Subversion Repositories funbase_ip_library

[/] [funbase_ip_library/] [trunk/] [TUT/] [ip.application/] [h.263_encoder_dct/] [1.0/] [src/] [linux_init_dct.c] - Blame information for rev 145

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 145 lanttu
#include <stdlib.h>
2
#include <stdio.h>
3
#include <signal.h>
4
#include <getopt.h>
5
 
6
#include <mcapi.h>
7
 
8
extern void startup(unsigned int local, unsigned int remote);
9
extern void demo(unsigned int local, int listen);
10
extern int encoder();
11
extern int main_dct();
12
 
13
static struct sigaction oldactions[32];
14
 
15
static void usage(const char *name)
16
{
17
        printf("Usage: %s [options] <local node id> <remote node id>\n"
18
                        "Options:\n"
19
                        "  -l, --loop      send and receive messages until killed.\n",
20
                        name);
21
        exit(1);
22
}
23
 
24
static void cleanup(void)
25
{
26
        mcapi_status_t status;
27
 
28
        printf("%s\n", __func__);
29
        mcapi_finalize(&status);
30
}
31
 
32
static void signalled(int signal, siginfo_t *info, void *context)
33
{
34
        struct sigaction *action;
35
 
36
        action = &oldactions[signal];
37
 
38
        if ((action->sa_flags & SA_SIGINFO) && action->sa_sigaction)
39
                action->sa_sigaction(signal, info, context);
40
        else if (action->sa_handler)
41
                action->sa_handler(signal);
42
 
43
        exit(signal);
44
}
45
 
46
struct sigaction action = {
47
        .sa_sigaction = signalled,
48
        .sa_flags = SA_SIGINFO,
49
};
50
 
51
int main(int argc, char *argv[])
52
{
53
 
54
  atexit(cleanup);
55
        sigaction(SIGQUIT, &action, &oldactions[SIGQUIT]);
56
        sigaction(SIGABRT, &action, &oldactions[SIGABRT]);
57
        sigaction(SIGTERM, &action, &oldactions[SIGTERM]);
58
        sigaction(SIGINT,  &action, &oldactions[SIGINT]);
59
 
60
 
61
 
62
        main_dct();
63
 
64
        return 0;
65
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.