forked from oe5hpm/openBCM
-
Notifications
You must be signed in to change notification settings - Fork 0
/
l1main_l.cpp
109 lines (91 loc) · 2.8 KB
/
l1main_l.cpp
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
/***************************************************************
BayCom(R) Packet-Radio fuer IBM PC
OpenBCM-Mailbox
------------------------------------
AX.25 Physical layer1 main functions
------------------------------------
Copyright (C) Florian Radlherr
Taubenbergstr. 32
83627 Warngau
Alle Rechte vorbehalten / All Rights reserved
***************************************************************/
//#include <stdio.h>
//#include <unistd.h>
//#include <sys/types.h>
//#include <sys/ioctl.h>
//#include <fcntl.h>
//#include <termios.h>
#include "baycom.h"
/*---------------------------------------------------------------------------*/
frame_t *rxout = NULL; // Zeiger auf den Layer 1 Empfangspuffer
frame_t *bfree = NULL; // Zeiger auf naechsten freien Buffer, NULL=voll
l2_para_t w;
/*---------------------------------------------------------------------------*/
int l1state (int channel)
//*************************************************************************
//
//*************************************************************************
{
int mask;
switch (w.mode[channel].chmode)
{
case c_kiss: mask = l1state_kiss(channel); break;
case c_axip: mask = l1state_axip(channel); break;
default: mask = 0;
}
if (rxout) mask |= CH_RXB;
return mask;
}
/*---------------------------------------------------------------------------*/
void pactx (frame_t *packl)
//*************************************************************************
//
// legt ein Frame in den Sendepuffer
//
//*************************************************************************
{
int kanal = packl->channel;
packl->next = NULL;
if (w.mode[kanal].xmitok)
{
switch (w.mode[kanal].chmode)
{
case c_kiss: pactx_kiss(packl); break;
case c_axip: pactx_axip(packl); break;
default: goto nichtsenden;
}
}
else
{
nichtsenden:
packl->channel |= 0x80;
vornehin(packl, rxout);
}
}
/*---------------------------------------------------------------------------*/
int l1init (int einschalt)
//*************************************************************************
//
//*************************************************************************
{
l1init_kiss(einschalt);
l1init_axip(einschalt);
return 1;
}
/*---------------------------------------------------------------------------*/
void layer1 (void)
//*************************************************************************
//
//*************************************************************************
{
unsigned int channel;
for (channel = 0; channel < KANAELE; channel++)
{
switch (w.mode[channel].chmode)
{
case c_kiss: cyclic_kiss(channel); break;
case c_axip: cyclic_axip(channel); break;
default: break;
}
}
}