*/
+#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. */
-void MAIN_STATE_MACHINE(RLP_F96Frame *frame, RLP_F96Header *header);
+static void MAIN_STATE_MACHINE(RLP_F96Frame *frame, RLP_F96Header *header);
/* This is the type we are just handling. */
-RLP_FrameTypes CurrentFrameType;
+static RLP_FrameTypes CurrentFrameType;
/* Current state of RLP state machine. */
-RLP_State CurrentState=RLP_S0; /* We start at ADM and Detached */
+static RLP_State CurrentState=RLP_S0; /* We start at ADM and Detached */
/* Next state of RLP state machine. */
-RLP_State NextState;
+static RLP_State NextState;
/* Pointer to Send function that sends frame to phone. */
-bool (*RLPSendFunction)(RLP_F96Frame *frame, bool out_dtx);
+static bool (*RLPSendFunction)(RLP_F96Frame *frame, bool out_dtx);
/* Pointer to Passup function which returns data/inds */
-int (*RLP_Passup)(RLP_UserInds ind, u8 *buffer, int length);
+static int (*RLP_Passup)(RLP_UserInds ind, u8 *buffer, int length);
/* State variables - see GSM 04.22, Annex A, section A.1.2 */
-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;
+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;
#define RLP_M 62
-RLP_Data R[RLP_M];
-RLP_Data S[RLP_M];
+static RLP_Data R[RLP_M];
+static RLP_Data S[RLP_M];
-RLP_StateVariable SABM_State;
-int SABM_Count;
+static RLP_StateVariable SABM_State;
+static int SABM_Count;
-RLP_UserRequestStore UserRequests;
+static RLP_UserRequestStore UserRequests;
-u8 Poll_Count=0;
+static 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 */
-int T;
-int T_RCVS[RLP_M];
+static int T;
+static int T_RCVS[RLP_M];
-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 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;
-u8 LastStatus=0xff; /* Last Status byte */
+static u8 LastStatus=0xff; /* Last Status byte */
/* RLP Parameters. FIXME: Reset these - e.g. when entering state 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;
+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;
/* Check whether a user event is set */
-bool RLP_GetUserRequest(RLP_UserRequests type) {
+static bool RLP_GetUserRequest(RLP_UserRequests type) {
bool result=false, *x;
return result;
}
-void RLP_SetTimer(int *timer)
+static void RLP_SetTimer(int *timer)
{
*timer=(int)(RLP_Timeout1_Limit/RLP_T_Scaling);
}
return (val <= upper) || (val >= lower);
}
-void RLP_Init_link_vars(void)
+static void RLP_Init_link_vars(void)
{
int i;
}
-void RLP_AddRingBufferDataToSlots(void)
+static void RLP_AddRingBufferDataToSlots(void)
{
u8 buffer[24];
int size;
}
+#ifndef UCLINUX
+
/* FIXME: Remove this after finishing. */
-void X(RLP_F96Frame *frame) {
+static void X(RLP_F96Frame *frame) {
int i;
}
+#endif /* UCLINUX */
-void ResetAllT_RCVS(void)
+static void ResetAllT_RCVS(void)
{
int i;
/* This function is used for sending RLP frames to the phone. */
-void RLP_SendF96Frame(RLP_FrameTypes FrameType,
+static 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. */
-void TEST_Handling() {
+static void TEST_Handling() {
}
/* FIXME: better XID_handling - but this will answer a XID command. */
-bool XID_Handling (RLP_F96Frame *frame, RLP_F96Header *header) {
+static bool XID_Handling (RLP_F96Frame *frame, RLP_F96Header *header) {
u8 count;
u8 type;
}
-bool Send_TXU(RLP_F96Frame *frame, RLP_F96Header *header) {
+static bool Send_TXU(RLP_F96Frame *frame, RLP_F96Header *header) {
#ifdef DEBUG
// fprintf(stdout, _("Send_TXU()\n"));
/* Deliver data */
-void RLP_DeliverAllInSeqIF()
+static void RLP_DeliverAllInSeqIF()
{
int i,j;
/* Mark any missing information frames between VR and Ns*/
-void RLP_MarkMissingIF(u8 Ns)
+static void RLP_MarkMissingIF(u8 Ns)
{
u8 i;
for (i=VR; i!=Ns; i=Incr(i)) {
/* Information frame handler */
-bool RLP_I_Handler(RLP_F96Frame *frame, RLP_F96Header *header)
+static bool RLP_I_Handler(RLP_F96Frame *frame, RLP_F96Header *header)
{
if ((header->CR) && (header->PF))
/* Mark acknowledged send frames */
-void RLP_AdvanceVA(u8 Nr)
+static void RLP_AdvanceVA(u8 Nr)
{
while (VA!=Nr) {
S[VA].State=_idle;
/* Decrease VS back down to Nr since these have not been acknowledged */
-void RLP_DecreaseVS(u8 Nr)
+static void RLP_DecreaseVS(u8 Nr)
{
while (VS!=Nr) {
VS=Decr(VS);
/* Supervisory frame handling */
-void RLP_S_Handler(RLP_F96Frame *frame, RLP_F96Header *header)
+static void RLP_S_Handler(RLP_F96Frame *frame, RLP_F96Header *header)
{
u8 i;
/* Find the first SREJ frame */
-bool RLP_SREJSlot(u8 *x)
+static bool RLP_SREJSlot(u8 *x)
{
u8 i;
/* Check if any SREJ frames need sending, if not send the next in line */
-bool RLP_PrepareDataToTransmit(u8 *p)
+static bool RLP_PrepareDataToTransmit(u8 *p)
{
u8 i;
/* Send a SREJ command */
-void RLP_SendSREJ(u8 x)
+static void RLP_SendSREJ(u8 x)
{
u8 k;
/* Send a command */
-void RLP_Send_XX_Cmd(RLP_FrameTypes type)
+static void RLP_Send_XX_Cmd(RLP_FrameTypes type)
{
u8 k;
/* Send a Response */
-void RLP_Send_XX_Resp(RLP_FrameTypes type)
+static void RLP_Send_XX_Resp(RLP_FrameTypes type)
{
u8 k;
/* Decide which frame to use and send it - currently only used in state 4 */
-void RLP_SendData()
+static void RLP_SendData()
{
u8 x;
else RLP_Send_XX_Cmd(RLPFT_S_RNR);
}
-void MAIN_STATE_MACHINE(RLP_F96Frame *frame, RLP_F96Header *header) {
+static 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. */
-void RLP_DisplayXID(u8 *frame)
+#ifdef RLP_DEBUG
+
+static 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. */
-void RLP_DecodeF96Header(RLP_F96Frame *frame, RLP_F96Header *header)
+static void RLP_DecodeF96Header(RLP_F96Frame *frame, RLP_F96Header *header)
{
/* Poll/Final bit. */