direwolf/rrbb.h
WB2OSZ b5d1d1c3dd Version 1.1
modified:   .gitattributes
	modified:   APRStt-Implementation-Notes.pdf
	modified:   CHANGES.txt
	modified:   Makefile.linux
	modified:   Makefile.win
	new file:   Raspberry-Pi-APRS-Tracker.pdf
	modified:   Raspberry-Pi-APRS.pdf
	modified:   User-Guide.pdf
	modified:   aclients.c
	modified:   aprs_tt.c
	modified:   aprs_tt.h
	modified:   atest.c
	modified:   audio.c
	modified:   audio.h
	modified:   audio_win.c
	modified:   ax25_pad.c
	modified:   ax25_pad.h
	modified:   beacon.c
	modified:   beacon.h
	modified:   config.c
	modified:   config.h
	modified:   decode_aprs.c
	modified:   decode_aprs.h
	modified:   demod_afsk.c
	modified:   digipeater.c
	modified:   digipeater.h
	modified:   direwolf.c
	modified:   direwolf.conf
	modified:   direwolf.h
	modified:   dsp.c
	modified:   dwgps.c
	modified:   encode_aprs.c
	modified:   encode_aprs.h
	modified:   fsk_demod_state.h
	new file:   grm_sym.h
	modified:   hdlc_rec.c
	modified:   hdlc_rec2.c
	modified:   hdlc_rec2.h
	modified:   kiss.c
	modified:   kiss_frame.c
	modified:   kiss_frame.h
	modified:   kissnet.c
	modified:   latlong.c
	modified:   latlong.h
	new file:   log.c
	new file:   log.h
	new file:   log2gpx.c
	new file:   mgn_icon.h
	modified:   misc/README-dire-wolf.txt
	modified:   multi_modem.c
	new file:   nmea.c
	new file:   nmea.h
	modified:   ptt.c
	modified:   rdq.c
	modified:   regex/README-dire-wolf.txt
	new file:   rpack.h
	modified:   rrbb.c
	modified:   rrbb.h
	modified:   server.c
	modified:   symbols-new.txt
	modified:   symbols.c
	modified:   symbolsX.txt
	new file:   telemetry.c
	new file:   telemetry.h
	modified:   textcolor.c
	modified:   tocalls.txt
	modified:   utm/README.txt
	modified:   version.h
	modified:   xmit.c
	modified:   xmit.h
2015-07-26 21:05:48 -04:00

112 lines
2.4 KiB
C

#ifndef RRBB_H
#define RRBB_H
/* Try something new in version 1.0 */
/* Get back to this later. Disable for now. */
//#define SLICENDICE 1
typedef short slice_t;
#ifdef RRBB_C
/*
* Maximum size (in bytes) of an AX.25 frame including the 2 octet FCS.
*/
#define MAX_FRAME_LEN ((AX25_MAX_PACKET_LEN) + 2)
/*
* Maximum number of bits in AX.25 frame excluding the flags.
* Adequate for extreme case of bit stuffing after every 5 bits
* which could never happen.
*/
#define MAX_NUM_BITS (MAX_FRAME_LEN * 8 * 6 / 5)
#define SOI 32
typedef struct rrbb_s {
int magic1;
struct rrbb_s* nextp; /* Next pointer to maintain a queue. */
int chan; /* Radio channel from which it was received. */
int subchan; /* Which modem when more than one per channel. */
int audio_level; /* Received audio level at time of frame capture. */
unsigned int len; /* Current number of samples in array. */
int fix_bits; /* Level of effort to recover from */
/* a bad FCS on the frame. */
int is_scrambled; /* Is data scrambled G3RUH / K9NG style? */
int descram_state; /* Descrambler state before first data bit of frame. */
#if SLICENDICE
slice_t slice_val;
slice_t data[MAX_NUM_BITS];
#else
unsigned int data[(MAX_NUM_BITS+SOI-1)/SOI];
unsigned int computed_data[MAX_NUM_BITS];
#endif
int magic2;
} *rrbb_t;
#else
/* Hide the implementation. */
typedef void *rrbb_t;
#endif
rrbb_t rrbb_new (int chan, int subchan, int is_scrambled, int descram_state);
void rrbb_clear (rrbb_t b, int is_scrambled, int descram_state);
#if SLICENDICE
void rrbb2_append_bit (rrbb_t b, float val);
#else
void rrbb_append_bit (rrbb_t b, int val);
#endif
void rrbb_chop8 (rrbb_t b);
int rrbb_get_len (rrbb_t b);
#if SLICENDICE
void rrbb_set_slice_val (rrbb_t b, slice_t slice_val);
#endif
int rrbb_get_bit (rrbb_t b, unsigned int ind);
unsigned int rrbb_get_computed_bit (rrbb_t b, unsigned int ind);
int rrbb_compute_bits (rrbb_t b);
//void rrbb_flip_bit (rrbb_t b, unsigned int ind);
void rrbb_delete (rrbb_t b);
void rrbb_set_nextp (rrbb_t b, rrbb_t np);
rrbb_t rrbb_get_nextp (rrbb_t b);
int rrbb_get_chan (rrbb_t b);
int rrbb_get_subchan (rrbb_t b);
void rrbb_set_audio_level (rrbb_t b, int a);
int rrbb_get_audio_level (rrbb_t b);
int rrbb_get_is_scrambled (rrbb_t b);
int rrbb_get_descram_state (rrbb_t b);
int rrbb_get_fix_bits(rrbb_t b);
void rrbb_set_fix_bits(rrbb_t b, int fix_bits);
#endif