view src/cs/layer1/gtt_include/l1gtt_baudot_functions.h @ 600:8f50b202e81f

board preprocessor conditionals: prep for more FC hw in the future This change eliminates the CONFIG_TARGET_FCDEV3B preprocessor symbol and all preprocessor conditionals throughout the code base that tested for it, replacing them with CONFIG_TARGET_FCFAM or CONFIG_TARGET_FCMODEM. These new symbols are specified as follows: CONFIG_TARGET_FCFAM is intended to cover all hardware designs created by Mother Mychaela under the FreeCalypso trademark. This family will include modem products (repackagings of the FCDEV3B, possibly with RFFE or even RF transceiver changes), and also my desired FreeCalypso handset product. CONFIG_TARGET_FCMODEM is intended to cover all FreeCalypso modem products (which will be firmware-compatible with the FCDEV3B if they use TI Rita transceiver, or will require a different fw build if we switch to one of Silabs Aero transceivers), but not the handset product. Right now this CONFIG_TARGET_FCMODEM preprocessor symbol is used to conditionalize everything dealing with MCSI. At the present moment the future of FC hardware evolution is still unknown: it is not known whether we will ever have any beyond-FCDEV3B hardware at all (contingent on uncertain funding), and if we do produce further FC hardware designs, it is not known whether they will retain the same FIC modem core (triband), if we are going to have a quadband design that still retains the classic Rita transceiver, or if we are going to switch to Silabs Aero II or some other transceiver. If we produce a quadband modem that still uses Rita, it will run exactly the same fw as the FCDEV3B thanks to the way we define TSPACT signals for the RF_FAM=12 && CONFIG_TARGET_FCFAM combination, and the current fcdev3b build target will be renamed to fcmodem. OTOH, if that putative quadband modem will be Aero-based, then it will require a different fw build target, the fcdev3b target will stay as it is, and the two targets will both define CONFIG_TARGET_FCFAM and CONFIG_TARGET_FCMODEM, but will have different RF_FAM numbers. But no matter which way we are going to evolve, it is not right to have conditionals on CONFIG_TARGET_FCDEV3B in places like ACI, and the present change clears the way for future evolution.
author Mychaela Falconia <falcon@freecalypso.org>
date Mon, 01 Apr 2019 01:05:24 +0000
parents 945cf7f506b2
children
line wrap: on
line source

/*****************************************************************************/
/*                                                                           */
/* ========================================================================= */
/*                                                                           */
/* Copyright (c) 2002                                                        */
/* Matsushita Communication Industrial, MMCD USA                             */
/*                                                                           */
/* ========================================================================= */
/*                                                                           */
/* File Name:                                                                */
/*     l1gtt_baudot_functions.h                                              */
/*                                                                           */
/* Purpose:                                                                  */
/*     This is the header file for "l1gtt_baudot_functions.c".               */
/*                                                                           */
/*                                                                           */
/* Warnings:                                                                 */
/*                                                                           */
/*                                                                           */
/*****************************************************************************/

/*** Maintenance *********************************************************/
/*                                                                       */
/*                                                                       */
/*                 02/11/2002   initial version created       Laura Ning */
/*                                                                       */
/*************************************************************************/
#ifndef _BAUDOT_DECODE_H_
#define BAUDOT_DECODE_H

#include "ctm_typedefs.h"

/*
*******************************************************************************
*                         DEFINITIONS
*******************************************************************************
*/

/* definitions (might be of global interest) */
#define BAUDOT_NUM_INFO_BITS    5 /* number of info bits per TTY character  */
#define BAUDOT_SHIFT_FIGURES   27 /* code of shift to figures symbol        */
#define BAUDOT_SHIFT_LETTERS   31 /* code of shift to letters symbol        */

#define BAUDOT_LOGICAL_1  1
#define BAUDOT_LOGICAL_0  -1
#define BAUDOT_NON_TTY   0
#define BAUDOT_START_BIT  -1
#define BAUDOT_STOP_BIT   1

#define BAUDOT_STOP_OUTPUT  2 /* STOP bit as the output of baudot_encode() to DSP */

/* definations (be only of local interest)   */

#define START_OF_STOP_BIT  26

#define DETECT_WINDOW_WIDTH  4   /* A sliding window is used to detect start,stop and data bits */
#define BAUDOT_SAMPLE_DURATION 3   /* The duration to meet to determine a valid baudot bit        */

/* A temporary assumption of the input buffer size, to be    */
/* replaced later when TI has the actual buffer size defined */
#define MAX_WORDS_OF_BUFFER1      40  /* Number of the 5ms-bits it can contain  */
#define TIME_INTERVAL_OF_BUFFER1  200 /* in the unit of ms                      */
#define MAX_WORDS_ONE_TTYCODE   36  /* Number of 5ms-bits a TTY character has */

#define NUM_STOP_BITS_TX        2    /* number of stop bits per character    */

/* ******************************************************************/
/* Type definitions for variables that contain all states of the    */
/* Baudot decoder                                                   */
/* ******************************************************************/


typedef struct 
{
  WORD16    remainedSampleVec[MAX_WORDS_ONE_TTYCODE]; /* hold the samples for last unfinished detection */
  UWORD16   remainedSampleLen;  /* length of the remaining samples for last unfinished detection */
  WORD16    ttyCode;
  UWORD16   cntBitsActualChar;
  UWORD16   samplesRemained;  /* number of samples left from last detection      */
  BOOL        startBitDetected;
  BOOL        inFigureMode;

} baudot_decode_state_t;

/* ******************************************************************/
/* Type definitions for variables that contain all states of the    */
/* Baudot encoder                                                   */
/* ******************************************************************/
typedef struct 
{
  WORD16       cntCharsSinceLastShift;
  BOOL           inFigureMode;
  BOOL           tailBitsGenerated;
//  fifo_state_t   fifo_state;
} baudot_encode_state_t;

/****************************************************************************/
/* convertChar2ttyCode()                                                    */
/* *********************                                                    */
/* Conversion from character into tty code                                  */
/*                                                                          */
/* input variables:                                                         */
/* - inChar       charcater that shall be converted                         */
/*                                                                          */
/* return value:  baudot code of the input character                        */
/*                or -1 in case that inChar is not valid (e.g. inChar=='\0')*/
/*                                                                          */
/* Matthias Doerbecker, Ericsson Eurolab Deutschland (EED/N/RV), 2000/02/17 */
/****************************************************************************/

WORD16 convertChar2ttyCode(char inChar);



/****************************************************************************/
/* convertTTYcode2char()                                                    */
/* *********************                                                    */
/* Conversion from tty code into character                                  */
/*                                                                          */
/* input variables:                                                         */
/* - ttyCode      Baudot code (must be within the range 0...63)             */
/*                or -1 if there is nothing to convert                      */
/*                                                                          */
/* return value:  character (or '\0' if ttyCode is not valid)               */
/*                                                                          */
/* Matthias Doerbecker, Ericsson Eurolab Deutschland (EED/N/RV), 2000/02/17 */
/****************************************************************************/

char convertTTYcode2char(WORD16 ttyCode);

/* prototype declarations */
void init_baudot_decode(baudot_decode_state_t* state);

void init_baudot_encode(baudot_encode_state_t* state);

void reset_baudot_decode(baudot_decode_state_t* state);

void baudot_decode(WORD16* sampleVec, WORD16 numSamples,
                      fifo_state_t* ptrOutFifoState,
                      baudot_decode_state_t* state);
void baudot_encode(WORD16 inputTTYcode,
       fifo_state_t* ptrOutFifoState,
       baudot_encode_state_t* state);
  
#endif