Logo SoCRocket

Transaction-Level Modeling Framework for Space Applications

Macros | Functions | Variables
pocsag.c File Reference
#include <stdlib.h>
Include dependency graph for pocsag.c:

Macros

#define TRUE   1
 
#define FALSE   0
 
#define NOT   !
 
#define AND   &&
 
#define OR   ||
 
#define const   static
 
#define dx   int
 
#define d8   unsigned char
 
#define d32   unsigned long int
 
#define UNDEFINED
 
#define EVEN_PARITY_MASK   0x00000001
 
#define ERROR_MASK   0x00000001
 
#define BIT_MASK   0x80000000
 
#define MAX_MSG   256 /* maximum length of message */
 
#define PREAMBLE   0xaaaaaaaa /* preamble pattern */
 
#define POCSAG_SYNC   0x3e4ba81b /* POCSAG sync word */
 
#define CAPCODE_A   0x2a74e /* 19-bit Capcode A */
 
#define CAPCODE_B   0x1d25a /* 19-bit Capcode B */
 
#define MSG_MASK   0xfffff /* 20-bit data message mask */
 
#define ALPHA_MASK   0x7f /* 7-bit mask for alphanumeric data */
 
#define NUM_MASK   0xf /* 4-bit mask for numeric data */
 
#define FUNC_MASK   0x3 /* 2-bit function code mask */
 
#define BAD_BYTE   0x80 /* bad message byte (uncorrectable) */
 

Functions

d32 error_corr (register d32)
 
void fix_bit (register char)
 
void find_syndromes (void)
 
char normalized_locator (void)
 
void validation (void)
 
dx comp32 (register d32, register d32)
 
d32sync_find (register d32 *)
 
dx addr_corr (register d32)
 
dx num_proc (register dx, register d32)
 
dx alpha_proc (register dx, register d32)
 
dx msg_proc (register d32 *)
 
int main (void)
 
d32 err_corr (register d32 datain)
 

Variables

d32 hexword
 
d32 parity
 
dx error_code
 
char s1
 
char s3
 
const char alpha []
 
const char alpha3 []
 
const char alpha_inv []
 
const char roots []
 
d8 msg [MAX_MSG]
 
dx alpha_count =0
 
dx func
 
const d8 err_tab []
 
unsigned long alpha_data []
 
unsigned long numeric_data []
 

Macro Definition Documentation

#define ALPHA_MASK   0x7f /* 7-bit mask for alphanumeric data */

Referenced by alpha_proc().

#define AND   &&
#define BAD_BYTE   0x80 /* bad message byte (uncorrectable) */

Referenced by alpha_proc(), and num_proc().

#define BIT_MASK   0x80000000

Referenced by find_syndromes().

#define CAPCODE_A   0x2a74e /* 19-bit Capcode A */

Referenced by addr_corr(), and msg_proc().

#define CAPCODE_B   0x1d25a /* 19-bit Capcode B */

Referenced by addr_corr(), and msg_proc().

#define const   static
#define d32   unsigned long int
#define d8   unsigned char
#define dx   int
#define ERROR_MASK   0x00000001

Referenced by fix_bit().

#define EVEN_PARITY_MASK   0x00000001

Referenced by find_syndromes().

#define FALSE   0

Referenced by addr_corr(), and msg_proc().

#define FUNC_MASK   0x3 /* 2-bit function code mask */

Referenced by addr_corr().

#define MAX_MSG   256 /* maximum length of message */
#define MSG_MASK   0xfffff /* 20-bit data message mask */

Referenced by msg_proc().

#define NOT   !
#define NUM_MASK   0xf /* 4-bit mask for numeric data */

Referenced by num_proc().

#define OR   ||

Referenced by msg_proc(), and sync_find().

#define POCSAG_SYNC   0x3e4ba81b /* POCSAG sync word */

Referenced by msg_proc(), and sync_find().

#define PREAMBLE   0xaaaaaaaa /* preamble pattern */

Referenced by sync_find().

#define TRUE   1

Referenced by addr_corr(), and msg_proc().

#define UNDEFINED

Function Documentation

dx addr_corr ( register d32  data)

References CAPCODE_A, CAPCODE_B, comp32(), d32, d8, dx, err_corr(), error_code, FALSE, func, FUNC_MASK, and TRUE.

Referenced by msg_proc().

Here is the call graph for this function:

dx alpha_proc ( register dx  i,
register d32  codeword 
)

References alpha_count, ALPHA_MASK, BAD_BYTE, d8, dx, error_code, i, and msg.

Referenced by msg_proc().

dx comp32 ( register d32  sample,
register d32  reference 
)

References d8, dx, err_tab, and i.

Referenced by addr_corr(), msg_proc(), and sync_find().

d32 err_corr ( register d32  datain)

References error_code, find_syndromes(), fix_bit(), hexword, normalized_locator(), parity, and s1.

Referenced by addr_corr(), and msg_proc().

Here is the call graph for this function:

d32 error_corr ( register  d32)
void find_syndromes ( void  )

References BIT_MASK, d32, dx, EVEN_PARITY_MASK, hexword, i, and parity.

Referenced by err_corr().

void fix_bit ( register char  eroot)

References ERROR_MASK, and hexword.

Referenced by err_corr().

int main ( void  )

References alpha_count, alpha_data, d32, dx, i, msg_proc(), numeric_data, and sync_find().

Here is the call graph for this function:

dx msg_proc ( register d32 dptr)

References addr_corr(), alpha_proc(), CAPCODE_A, CAPCODE_B, comp32(), d32, dx, err_corr(), error_code, FALSE, func, i, MSG_MASK, num_proc(), OR, POCSAG_SYNC, and TRUE.

Referenced by main().

Here is the call graph for this function:

char normalized_locator ( void  )

References s1, and s3.

Referenced by err_corr().

dx num_proc ( register dx  i,
register d32  codeword 
)

References BAD_BYTE, count, d8, dx, error_code, i, msg, and NUM_MASK.

Referenced by msg_proc().

d32 * sync_find ( register d32 dptr)

References comp32(), d32, dx, OR, POCSAG_SYNC, and PREAMBLE.

Referenced by main().

Here is the call graph for this function:

void validation ( void  )

Variable Documentation

const char alpha[]
Initial value:
=
{
0x01, 0x02, 0x04, 0x08, 0x10, 0x05,
0x0A, 0x14, 0x0D, 0x1A, 0x11, 0x07,
0x0E, 0x1C, 0x1D, 0x1F, 0x1B, 0x13,
0x03, 0x06, 0x0C, 0x18, 0x15, 0x0F,
0x1E, 0x19, 0x17, 0x0B, 0x16, 0x09,
0x12
}
const char alpha3[]
Initial value:
=
{
0x01, 0x08, 0x0A, 0x1A, 0x0E, 0x1F,
0x03, 0x18, 0x1E, 0x0B, 0x12, 0x04,
0x05, 0x0D, 0x07, 0x1D, 0x13, 0x0C,
0x0F, 0x17, 0x09, 0x02, 0x10, 0x14,
0x11, 0x1C, 0x1B, 0x06, 0x15, 0x19,
0x16
}
dx alpha_count =0

Referenced by alpha_proc(), and main().

unsigned long alpha_data[]

Referenced by main().

const char alpha_inv[]
Initial value:
=
{
0x00, 0x00, 0x01, 0x12, 0x02, 0x05,
0x13, 0x0B, 0x03, 0x1D, 0x06, 0x1B,
0x14, 0x08, 0x0C, 0x17, 0x04, 0x0A,
0x1E, 0x11, 0x07, 0x16, 0x1C, 0x1A,
0x15, 0x19, 0x09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7,
0x4,0x5,0x5,0x6,0x5,0x6,0x6,0x7,0x5,0x6,0x6,0x7,0x6,0x7,0x7,0x8
}

Referenced by comp32().

dx error_code
dx func
d32 hexword

Referenced by err_corr(), find_syndromes(), and fix_bit().

d8 msg[MAX_MSG]
unsigned long numeric_data[]

Referenced by main().

d32 parity

Referenced by err_corr(), and find_syndromes().

const char roots[]
Initial value:
=
{
0x00, 0x80, 0x03, 0x80, 0x06, 0x80,
0x01, 0x80, 0x80, 0x07, 0x80, 0x0D,
0x80, 0x0F, 0x80, 0x1A, 0x0C, 0x80,
0x0B, 0x80, 0x02, 0x80, 0x08, 0x80,
0x80, 0x09, 0x80, 0x11, 0x80, 0x04,
0x80, 0x15
}
char s1
char s3