Blame |
Last modification |
View Log
| RSS feed
/*
* main.c
*
* Created on: 18. dec. 2018
* Author: Domen
*/
/* MAIN PROGRAM */
#include "data_handling.h"
#include "server.h"
HW_system system_data
= {0,0,0,0,0,0,0,0,0,0};
volatile const HW_system system_data_init
= {0,0,0,0,0,0,0,0,0,0};
int main
(void)
{
int server_info
[2]; //sock_server in sock_client: PC_client; //ID PC clienta
uint32_t *virt_addr_ptr
; // virtualni naslov, kjer so podatki v HW
static uint8_t data_status
; // flag, ki pove, da se je vpis HW podatkov v strukturo ze vsaj 1x izvedel
while(1)
{
server_info
[0] = 0; // sock_server
server_info
[1] = 0; //sock_client
//PC_client = 0;
data_status
= 0;
//SERVER AND HARDWARE INIT
Server_init
(server_info
);
virt_addr_ptr
= HW_init
();
// DATA HANDLING
while(1)
{
Server_comm
(server_info
, &system_data
, data_status
);
data_status
= HW_comm
(&system_data
, virt_addr_ptr
);
if (system_data.
disconnect_flag == 1)
{
//system_data.disconnect_flag = 0; //ponastavi flag
system_data
= system_data_init
;
printf("Server disconnected\n!");
break;
}
//sleep(1);
}
}
}