Blame view

main.c 1.04 KB
e583b6a9   henyxia   First version
1
  #include <stdio.h>
cdaa873f   henyxia   Log fixed
2
  #include <pthread.h>
ae25085d   henyxia   Output function done
3
  #include "printx.h"
ea1218f1   henyxia   UI finished
4
  #include "ui.h"
3bdc9daf   henyxia   NFC Added
5
  #include "nfc.h"
d4d5bb6d   henyxia   Bus working
6
  #include "bus.h"
9e9f365e   henyxia   Added HVC interface
7
  #include "hvc.h"
e583b6a9   henyxia   First version
8
  
cdaa873f   henyxia   Log fixed
9
10
  #include <unistd.h>
  
e583b6a9   henyxia   First version
11
12
  int main(void)
  {
19082eeb   henyxia   UI design not wor...
13
  	int ret;
c72d79dd   henyxia   Semaphores contro...
14
  	pthread_t tUI;
1fec343b   henyxia   NOT Working version
15
  	pthread_t tNFC;
c72d79dd   henyxia   Semaphores contro...
16
  	pthread_t tBUS;
1fec343b   henyxia   NOT Working version
17
  	pthread_t tHVC;
ea1218f1   henyxia   UI finished
18
19
20
21
22
23
  	initUILog();
  	if(!initLog())
  	{
  		printf("Log creation failed\n");
  		return 1;
  	}
297a72df   henyxia   Added sender
24
25
  	printx(INFO, MAIN, "Tweekd starting\n");
  	printx(DEBUG, MAIN, "Creating processes\n");
ea1218f1   henyxia   UI finished
26
  	displayUI();
19082eeb   henyxia   UI design not wor...
27
  	ret = pthread_create(&tUI, NULL, drawUI, NULL);
297a72df   henyxia   Added sender
28
  	printx(DEBUG, MAIN, "UI Started ID %08x ret %d\n", tUI, ret);
1fec343b   henyxia   NOT Working version
29
  	printx(INFO, MAIN, "Initializing NFC");
3bdc9daf   henyxia   NFC Added
30
31
32
33
34
  	if(!initNFC())
  	{
  		printx(ERROR, MAIN, "Unable to start the NFC interface\n");
  		return 2;
  	}
1fec343b   henyxia   NOT Working version
35
  	pthread_create(&tNFC, NULL, processNFC, NULL);
d4d5bb6d   henyxia   Bus working
36
37
38
39
40
  	if(!initBus())
  	{
  		printx(ERROR, MAIN, "Unable to start the BUS interface\n");
  		return 3;
  	}
1fec343b   henyxia   NOT Working version
41
  	pthread_create(&tBUS, NULL, processBus, NULL);
9e9f365e   henyxia   Added HVC interface
42
43
44
45
46
  	if(!initHVC())
  	{
  		printx(ERROR, MAIN, "Unable to start the HVC interface\n");
  		return 4;
  	}
1fec343b   henyxia   NOT Working version
47
  	pthread_create(&tHVC, NULL, processHVC, NULL);
cdaa873f   henyxia   Log fixed
48
  	pthread_join(tUI, NULL);
ae25085d   henyxia   Output function done
49
  	closeLog();
e583b6a9   henyxia   First version
50
51
  	return 0;
  }