*/
-#include "config.h"
-
#include <stdio.h>
#include <string.h>
#include <ctype.h>
/* Our state machine which handles all of nine possible states of RLP
machine. */
-static void MAIN_STATE_MACHINE(RLP_F96Frame *frame, RLP_F96Header *header);
+void MAIN_STATE_MACHINE(RLP_F96Frame *frame, RLP_F96Header *header);
/* This is the type we are just handling. */
-static RLP_FrameTypes CurrentFrameType;
+RLP_FrameTypes CurrentFrameType;
/* Current state of RLP state machine. */
-static RLP_State CurrentState=RLP_S0; /* We start at ADM and Detached */
+RLP_State CurrentState=RLP_S0; /* We start at ADM and Detached */
/* Next state of RLP state machine. */
-static RLP_State NextState;
+RLP_State NextState;
/* Pointer to Send function that sends frame to phone. */
-static bool (*RLPSendFunction)(RLP_F96Frame *frame, bool out_dtx);
+bool (*RLPSendFunction)(RLP_F96Frame *frame, bool out_dtx);
/* Pointer to Passup function which returns data/inds */
-static int (*RLP_Passup)(RLP_UserInds ind, u8 *buffer, int length);
+int (*RLP_Passup)(RLP_UserInds ind, u8 *buffer, int length);
/* State variables - see GSM 04.22, Annex A, section A.1.2 */
-static RLP_StateVariable UA_State;
-/*
-static RLP_StateVariable UI_State;
-*/
-static RLP_StateVariable Ackn_State;
-static RLP_StateVariable Poll_State;
-static RLP_StateVariable Poll_xchg;
-static RLP_StateVariable SABM_State;
-static RLP_StateVariable DISC_State;
-static RLP_StateVariable DM_State; /* FIXME - not handled */
-/*
-static RLP_StateVariable XID_C_State;
-*/
-static RLP_StateVariable XID_R_State;
-/*
-static RLP_StateVariable TEST_R_State;
-*/
-
-static u8 VR=0;
-static u8 VA=0;
-static u8 VS=0;
-static u8 VD=0;
-static u8 DISC_Count;
-
-static u8 DTX_VR;
-static RLP_FrameTypes DTX_SF;
+RLP_StateVariable UA_State;
+RLP_StateVariable UI_State;
+RLP_StateVariable Ackn_State;
+RLP_StateVariable Poll_State;
+RLP_StateVariable Poll_xchg;
+RLP_StateVariable SABM_State;
+RLP_StateVariable DISC_State;
+RLP_StateVariable DM_State; /* FIXME - not handled */
+RLP_StateVariable XI_R_State;
+RLP_StateVariable XID_C_State;
+RLP_StateVariable XID_R_State;
+RLP_StateVariable TEST_R_State;
+
+u8 VR=0;
+u8 VA=0;
+u8 VS=0;
+u8 VD=0;
+u8 DISC_Count;
+
+u8 DTX_VR;
+RLP_FrameTypes DTX_SF;
#define RLP_M 62
-static RLP_Data R[RLP_M];
-static RLP_Data S[RLP_M];
+RLP_Data R[RLP_M];
+RLP_Data S[RLP_M];
-static RLP_StateVariable SABM_State;
-static int SABM_Count;
+RLP_StateVariable SABM_State;
+int SABM_Count;
-static RLP_UserRequestStore UserRequests;
+RLP_UserRequestStore UserRequests;
-static u8 Poll_Count=0;
+u8 Poll_Count=0;
/* For now timing is done based on a frame reception rate of 20ms */
/* Serge has measured it as 18.4ms */
/* To set, timer is loaded with RLP_Timeout1_Limit/RLP_T_Scaling. */
/* Each received frame (including NULLS / errors) any >0 timer is decrease */
-static int T;
-static int T_RCVS[RLP_M];
+int T;
+int T_RCVS[RLP_M];
-static bool UA_FBit=true;
-static bool Ackn_FBit=false;
-static bool DM_FBit=false; /* FIXME - not handled */
-static bool RRReady=false;
-static bool LRReady=true; /* FIXME - not handled (as if we couldn't keep up with 9600bps :-) */
-static bool DISC_PBit=false;
+bool UA_FBit=true;
+bool Ackn_FBit=false;
+bool DM_FBit=false; /* FIXME - not handled */
+bool RRReady=false;
+bool LRReady=true; /* FIXME - not handled (as if we couldn't keep up with 9600bps :-) */
+bool DISC_PBit=false;
-static u8 LastStatus=0xff; /* Last Status byte */
+u8 LastStatus=0xff; /* Last Status byte */
/* RLP Parameters. FIXME: Reset these - e.g. when entering state 0 */
-static u8 RLP_SEND_WS = RLP_M-1;
-static u8 RLP_RCV_WS = RLP_M-1;
-static u8 RLP_Timeout1_Limit = 55;
-static u8 RLP_N2 = 15; /* Maximum number of retransmisions. GSM spec says 6 here, but
- Nokia will XID this. */
-static u8 RLP_T2=0;
-static u8 RLP_VersionNumber=0;
+u8 RLP_SEND_WS = RLP_M-1;
+u8 RLP_RCV_WS = RLP_M-1;
+u8 RLP_Timeout1_Limit = 55;
+u8 RLP_N2 = 15; /* Maximum number of retransmisions. GSM spec says 6 here, but
+ Nokia will XID this. */
+u8 RLP_T2=0;
+u8 RLP_VersionNumber=0;
/* Check whether a user event is set */
-static bool RLP_GetUserRequest(RLP_UserRequests type) {
+bool RLP_GetUserRequest(RLP_UserRequests type) {
bool result=false, *x;
return result;
}
-static void RLP_SetTimer(int *timer)
+void RLP_SetTimer(int *timer)
{
*timer=(int)(RLP_Timeout1_Limit/RLP_T_Scaling);
}
return (val <= upper) || (val >= lower);
}
-static void RLP_Init_link_vars(void)
+void RLP_Init_link_vars(void)
{
int i;
}
-static void RLP_AddRingBufferDataToSlots(void)
+void RLP_AddRingBufferDataToSlots(void)
{
u8 buffer[24];
int size;
}
-#ifndef UCLINUX
-
/* FIXME: Remove this after finishing. */
-static void X(RLP_F96Frame *frame) {
+void X(RLP_F96Frame *frame) {
int i;
}
-#endif /* UCLINUX */
-static void ResetAllT_RCVS(void)
+void ResetAllT_RCVS(void)
{
int i;
/* This function is used for sending RLP frames to the phone. */
-static void RLP_SendF96Frame(RLP_FrameTypes FrameType,
+void RLP_SendF96Frame(RLP_FrameTypes FrameType,
bool OutCR, bool OutPF,
u8 OutNR, u8 OutNS,
u8 *OutData, u8 OutDTX)
}
-static void RLP_DecodeF96Header(RLP_F96Frame *frame, RLP_F96Header *header);
-
/* Check_input_PDU in Serge's code. */
void RLP_DisplayF96Frame(RLP_F96Frame *frame)
/* FIXME: real TEST_Handling - we do not handle TEST yet. */
-static void TEST_Handling() {
+void TEST_Handling() {
}
/* FIXME: better XID_handling - but this will answer a XID command. */
-static bool XID_Handling (RLP_F96Frame *frame, RLP_F96Header *header) {
+bool XID_Handling (RLP_F96Frame *frame, RLP_F96Header *header) {
u8 count;
u8 type;
}
-static bool Send_TXU(RLP_F96Frame *frame, RLP_F96Header *header) {
+bool Send_TXU(RLP_F96Frame *frame, RLP_F96Header *header) {
#ifdef DEBUG
// fprintf(stdout, _("Send_TXU()\n"));
/* Deliver data */
-static void RLP_DeliverAllInSeqIF()
+void RLP_DeliverAllInSeqIF()
{
int i,j;
/* Mark any missing information frames between VR and Ns*/
-static void RLP_MarkMissingIF(u8 Ns)
+void RLP_MarkMissingIF(u8 Ns)
{
u8 i;
for (i=VR; i!=Ns; i=Incr(i)) {
/* Information frame handler */
-static bool RLP_I_Handler(RLP_F96Frame *frame, RLP_F96Header *header)
+bool RLP_I_Handler(RLP_F96Frame *frame, RLP_F96Header *header)
{
if ((header->CR) && (header->PF))
/* Mark acknowledged send frames */
-static void RLP_AdvanceVA(u8 Nr)
+void RLP_AdvanceVA(u8 Nr)
{
while (VA!=Nr) {
S[VA].State=_idle;
/* Decrease VS back down to Nr since these have not been acknowledged */
-static void RLP_DecreaseVS(u8 Nr)
+void RLP_DecreaseVS(u8 Nr)
{
while (VS!=Nr) {
VS=Decr(VS);
/* Supervisory frame handling */
-static void RLP_S_Handler(RLP_F96Frame *frame, RLP_F96Header *header)
+void RLP_S_Handler(RLP_F96Frame *frame, RLP_F96Header *header)
{
u8 i;
/* Find the first SREJ frame */
-static bool RLP_SREJSlot(u8 *x)
+bool RLP_SREJSlot(u8 *x)
{
u8 i;
/* Check if any SREJ frames need sending, if not send the next in line */
-static bool RLP_PrepareDataToTransmit(u8 *p)
+bool RLP_PrepareDataToTransmit(u8 *p)
{
u8 i;
/* Send a SREJ command */
-static void RLP_SendSREJ(u8 x)
+void RLP_SendSREJ(u8 x)
{
u8 k;
/* Send a command */
-static void RLP_Send_XX_Cmd(RLP_FrameTypes type)
+void RLP_Send_XX_Cmd(RLP_FrameTypes type)
{
u8 k;
/* Send a Response */
-static void RLP_Send_XX_Resp(RLP_FrameTypes type)
+void RLP_Send_XX_Resp(RLP_FrameTypes type)
{
u8 k;
/* Decide which frame to use and send it - currently only used in state 4 */
-static void RLP_SendData()
+void RLP_SendData()
{
u8 x;
else RLP_Send_XX_Cmd(RLPFT_S_RNR);
}
-static void MAIN_STATE_MACHINE(RLP_F96Frame *frame, RLP_F96Header *header) {
+void MAIN_STATE_MACHINE(RLP_F96Frame *frame, RLP_F96Header *header) {
int i;
switch (CurrentState) {
if(SABM_State!=_idle) printf("[SABM_State %d]",SABM_State);
if(DISC_State!=_idle) printf("[DISC_State %d]",DISC_State);
if(DM_State!=_idle) printf("[DM_State %d]",DM_State);
+ if(XI_R_State!=_idle) printf("[XI_R_State %d]",XI_R_State);
if(XID_C_State!=_idle) printf("[XID_C_State %d]",XID_C_State);
if(XID_R_State!=_idle) printf("[XID_R_State %d]",XID_R_State);
if(TEST_R_State!=_idle) printf("[TEST_R_State %d]",TEST_R_State);
exact implementation of section 5.2.2.6, Exchange Identification, XID of
the GSM specification 04.22. */
-#ifdef RLP_DEBUG
-
-static void RLP_DisplayXID(u8 *frame)
+void RLP_DisplayXID(u8 *frame)
{
int count = 25; /* Sanity check */
return;
}
-#endif /* RLP_DEBUG */
-
/* Given a pointer to an F9.6 Frame, split data out into component parts of
header and determine frame type. */
-static void RLP_DecodeF96Header(RLP_F96Frame *frame, RLP_F96Header *header)
+void RLP_DecodeF96Header(RLP_F96Frame *frame, RLP_F96Header *header)
{
/* Poll/Final bit. */