EMILE/libemile/emile_second_get_output.c

48 lines
1.2 KiB
C
Raw Normal View History

2004-12-09 22:57:09 +00:00
static __attribute__((used)) char* rcsid = "$CVSHeader$";
/*
*
* (c) 2004 Laurent Vivier <LaurentVivier@wanadoo.fr>
*
*/
#include <sys/types.h>
#include <unistd.h>
#include <stdio.h>
#include "libemile.h"
#include "emile.h"
#include "../second/head.h"
2004-12-10 00:24:31 +00:00
int emile_second_get_output(int fd, unsigned int *console_mask,
unsigned int *bitrate0, int *datasize0,
2004-12-09 22:57:09 +00:00
int *parity0, int *stopbits0,
2004-12-10 00:24:31 +00:00
unsigned int *bitrate1, int *datasize1,
2004-12-09 22:57:09 +00:00
int *parity1, int *stopbits1,
int *gestaltid)
{
emile_l2_header_t header;
int ret;
ret = read(fd, &header, sizeof(header));
if (ret != sizeof(header))
2004-12-12 22:59:38 +00:00
return EEMILE_CANNOT_READ_SECOND;
2004-12-09 22:57:09 +00:00
if (!EMILE_COMPAT(EMILE_03_SIGNATURE, read_long(&header.signature)))
2004-12-12 22:59:38 +00:00
return EEMILE_INVALID_SECOND;
2004-12-09 22:57:09 +00:00
*console_mask = read_long(&header.console_mask);
*bitrate0 = read_long(&header.serial0_bitrate);
*datasize0 = header.serial0_datasize;
*parity0 = header.serial0_parity;
*stopbits0 = header.serial0_stopbits;
*bitrate1 = read_long(&header.serial1_bitrate);
*datasize1 = header.serial1_datasize;
*parity1 = header.serial1_parity;
*stopbits1 = header.serial1_stopbits;
*gestaltid = read_long(&header.gestaltID);
return 0;
}