DESCRIPTION: How to implement bit sync and frame decoding

AUTHOR:     Stephan Esterhuizen

DATE:       15 January 2004

--------------------------------------------------------------------------------

In order to decode the nav message, a few things must happen:

1) If using FLL, must rotate IQ vector so that all power is in I
2) Bit flip position must be found and ms_counter synchronised (align)
3) Once aligned, 20ms running sum must be kept (for data bit)
4) Bit identification using 20ms sum
5) Keep count of bits and frames

Timing
------

Bit sync can run at any rate (as long as ms_count is incremented). Let's run bit
sync at 20ms, thus we can accomplish both bitSync and Frame decode in one task.

New Task(s)
-----------

I propose to add a new task that will be unblocked whenever ms_count=20.

If (!bitSync) 
 	- create histogram
else if (bitSync) 
	- decide what bit we have
	- find_preamble
	- read_preamble
	- send nav bits to user land if preamble found
	
Problem: ms_count will be 20 at different times for different channels.
Also, how do I sync up code_track and carrier_track's integration times after
I've aligned these?

Solution: Have NUM_CH tasks (frameDecode) that get called whenever the channel 
has ms_count=20, then these tasks will be woken up whenever
chan[ch].ms_count=20. To take care of the synchronization problem, readTask can
re-sync a task if ms_count != numSamples-count

What do I do for frame sync when operating a channel(s) in a non-tracking mode?
For now, just try to decode msg anyways, I think we have the processing power.

frameDecode.txt

Task name: frameDecode
Parameters: AlignTimePeriod (how long to collect data for histogram)
			RepeatAlign
			chanRead (should be woken up when these channels are ready)
			numSamples (should be 20ms worth of samples)

When readTask calls updateProducers, make sure that ms_count is always sync'ed
with numSamples. This can be done in two ways

1) When bitSync is obtained for the first time, set a flag, then readTask can
check that flag when waking up Consumers and reset their 'count' variables if
they don't match ms_count. This flag will then be cleared by readTask also (flag
is cleared on chanRead-basis).

Problem: Need flags for when bitSync and such things are valid.
