Interleaving

## Files

file | gsm0503_interleaving.h
file | gsm0503_interleaving.c

## Functions

void | gsm0503_xcch_deinterleave (sbit_t *cB, const sbit_t *iB)
| De-Interleave burst bits according to TS 05.03 4.1.4. More...
void | gsm0503_xcch_interleave (const ubit_t *cB, ubit_t *iB)
| Interleave burst bits according to TS 05.03 4.1.4. More...
void | gsm0503_tch_fr_deinterleave (sbit_t *cB, const sbit_t *iB)
| GSM TCH FR/EFR/AFS De-Interleaving and burst mapping. More...
void | gsm0503_tch_fr_interleave (const ubit_t *cB, ubit_t *iB)
| GSM TCH FR/EFR/AFS Interleaving and burst mapping. More...
void | gsm0503_tch_hr_deinterleave (sbit_t *cB, const sbit_t *iB)
| GSM TCH HR/AHS De-Interleaving and burst mapping. More...
void | gsm0503_tch_hr_interleave (const ubit_t *cB, ubit_t *iB)
| GSM TCH HR/AHS Interleaving and burst mapping. More...
void | gsm0503_mcs1_ul_deinterleave (sbit_t *hc, sbit_t *dc, const sbit_t *iB)
| Interleave MCS1 UL burst bits according to TS 05.03 5.1.5.2.4. More...
void | gsm0503_mcs1_ul_interleave (const ubit_t *hc, const ubit_t *dc, ubit_t *iB)
| Interleave MCS1 DL burst bits according to TS 05.03 5.1.5.2.4. More...
void | gsm0503_mcs1_dl_deinterleave (sbit_t *u, sbit_t *hc, sbit_t *dc, const sbit_t *iB)
| De-Interleave MCS1 DL burst bits according to TS 05.03 5.1.5.1.5. More...
void | gsm0503_mcs1_dl_interleave (const ubit_t *up, const ubit_t *hc, const ubit_t *dc, ubit_t *iB)
| Interleave MCS1 DL burst bits according to TS 05.03 5.1.5.1.5. More...
void | gsm0503_mcs5_ul_deinterleave (sbit_t *hc, sbit_t *dc, const sbit_t *hi, const sbit_t *di)
| De-Interleave MCS5 UL burst bits according to TS 05.03 5.1.9.2.4. More...
void | gsm0503_mcs5_ul_interleave (const ubit_t *hc, const ubit_t *dc, ubit_t *hi, ubit_t *di)
| Interleave MCS5 UL burst bits according to TS 05.03 5.1.9.2.4. More...
void | gsm0503_mcs5_dl_deinterleave (sbit_t *hc, sbit_t *dc, const sbit_t *hi, const sbit_t *di)
| De-Interleave MCS5 UL burst bits according to TS 05.03 5.1.9.1.5. More...
void | gsm0503_mcs5_dl_interleave (const ubit_t *hc, const ubit_t *dc, ubit_t *hi, ubit_t *di)
| Interleave MCS5 DL burst bits according to TS 05.03 5.1.9.1.5. More...
void | gsm0503_mcs7_ul_deinterleave (sbit_t *hc, sbit_t *c1, sbit_t *c2, const sbit_t *hi, const sbit_t *di)
| De-Interleave MCS7 UL burst bits according to TS 05.03 5.1.11.2.4. More...
void | gsm0503_mcs7_ul_interleave (const ubit_t *hc, const ubit_t *c1, const ubit_t *c2, ubit_t *hi, ubit_t *di)
| Interleave MCS7 UL burst bits according to TS 05.03 5.1.11.2.4. More...
void | gsm0503_mcs7_dl_deinterleave (sbit_t *hc, sbit_t *c1, sbit_t *c2, const sbit_t *hi, const sbit_t *di)
| De-Interleave MCS7 DL burst bits according to TS 05.03 5.1.11.1.5. More...
void | gsm0503_mcs7_dl_interleave (const ubit_t *hc, const ubit_t *c1, const ubit_t *c2, ubit_t *hi, ubit_t *di)
| Interleave MCS7 DL burst bits according to TS 05.03 5.1.11.1.5. More...
void | gsm0503_mcs8_ul_deinterleave (sbit_t *hc, sbit_t *c1, sbit_t *c2, const sbit_t *hi, const sbit_t *di)
| De-Interleave MCS8 UL burst bits according to TS 05.03 5.1.12.2.4. More...
void | gsm0503_mcs8_ul_interleave (const ubit_t *hc, const ubit_t *c1, const ubit_t *c2, ubit_t *hi, ubit_t *di)
| Interleave MCS8 UL burst bits according to TS 05.03 5.1.12.2.4. More...
void | gsm0503_mcs8_dl_deinterleave (sbit_t *hc, sbit_t *c1, sbit_t *c2, const sbit_t *hi, const sbit_t *di)
| De-Interleave MCS8 DL burst bits according to TS 05.03 5.1.12.1.5. More...
void | gsm0503_mcs8_dl_interleave (const ubit_t *hc, const ubit_t *c1, const ubit_t *c2, ubit_t *hi, ubit_t *di)
| Interleave MCS8 DL burst bits according to TS 05.03 5.1.12.1.5. More...

## Detailed Description

GSM TS 05.03 interleaving

This module contains interleaving / de-interleaving routines for various channel types, as defined in 3GPP TS 05.03 / 45.003.

GSM xCCH interleaving and burst mapping:

Interleaving:

Given 456 coded input bits, form 4 blocks of 114 bits:

     i(B, j) = c(n, k)       k = 0, ..., 455
                             n = 0, ..., N, N + 1, ...
                             B = B_0 + 4n + (k mod 4)
                             j = 2(49k mod 57) + ((k mod 8) div 4)

Mapping on Burst:

     e(B, j) = i(B, j)
     e(B, 59 + j) = i(B, 57 + j)     j = 0, ..., 56
     e(B, 57) = h_l(B)
     e(B, 58) = h_n(B)

Where hl(B) and hn(B) are bits in burst B indicating flags.

GSM TCH HR/AHS interleaving and burst mapping:

Interleaving:

Given 288 coded input bits, form 4 blocks of 114 bits, where even bits of the first 2 blocks and odd bits of the last 2 blocks are used:

     i(B, j) = c(n, k)       k = 0, ..., 227
                             n = 0, ..., N, N + 1, ...
                             B = B_0 + 2n + b
                             j, b = table[k];

Mapping on Burst:

     e(B, j) = i(B, j)
     e(B, 59 + j) = i(B, 57 + j)     j = 0, ..., 56
     e(B, 57) = h_l(B)
     e(B, 58) = h_n(B)

Where hl(B) and hn(B) are bits in burst B indicating flags.

## Function Documentation

## gsm0503_mcs1_dl_deinterleave()

void gsm0503_mcs1_dl_deinterleave | ( | sbit_t * | u,
|  | sbit_t * | hc,
|  | sbit_t * | dc,
|  | const sbit_t * | iB
| ) |  |

De-Interleave MCS1 DL burst bits according to TS 05.03 5.1.5.1.5.

Parameters

  [out] | u | caller-allocated output buffer for 12 soft coded bits
  [out] | hc | caller-allocated output buffer for 68 soft coded bits
  [out] | dc | caller-allocated output buffer for 372 soft coded bits
  [in] | iB | 452 interleaved soft input bits

References gsm0503_xcch_deinterleave().

## gsm0503_mcs1_dl_interleave()

void gsm0503_mcs1_dl_interleave | ( | const ubit_t * | up,
|  | const ubit_t * | hc,
|  | const ubit_t * | dc,
|  | ubit_t * | iB
| ) |  |

Interleave MCS1 DL burst bits according to TS 05.03 5.1.5.1.5.

Parameters

  [in] | up | 12 input soft coded bits (usf)
  [in] | hc | 68 input soft coded bits (header)
  [in] | dc | 372 input soft bits (data)
  [out] | iB | 456 interleaved soft output bits

References gsm0503_xcch_interleave().

Referenced by egprs_type3_map().

## gsm0503_mcs1_ul_deinterleave()

void gsm0503_mcs1_ul_deinterleave | ( | sbit_t * | hc,
|  | sbit_t * | dc,
|  | const sbit_t * | iB
| ) |  |

Interleave MCS1 UL burst bits according to TS 05.03 5.1.5.2.4.

Parameters

  [out] | hc | caller-allocated output buffer for 80 soft coded header bits
  [out] | dc | caller-allocated output buffer for 372 soft coded data bits
  [in] | iB | 456 interleaved soft input bits

References gsm0503_xcch_deinterleave().

Referenced by egprs_type3_unmap().

## gsm0503_mcs1_ul_interleave()

void gsm0503_mcs1_ul_interleave | ( | const ubit_t * | hc,
|  | const ubit_t * | dc,
|  | ubit_t * | iB
| ) |  |

Interleave MCS1 DL burst bits according to TS 05.03 5.1.5.2.4.

Parameters

  [in] | hc | 80 input coded bits (header)
  [in] | dc | 372 input bits (data)
  [out] | iB | 456 interleaved output bits

References gsm0503_xcch_interleave().

## gsm0503_mcs5_dl_deinterleave()

void gsm0503_mcs5_dl_deinterleave | ( | sbit_t * | hc,
|  | sbit_t * | dc,
|  | const sbit_t * | hi,
|  | const sbit_t * | di
| ) |  |

De-Interleave MCS5 UL burst bits according to TS 05.03 5.1.9.1.5.

Parameters

  [out] | hc | caller-allocated output buffer for 100 soft coded header bits
  [out] | dc | caller-allocated output buffer for 1248 soft coded data bits
  [in] | iB | interleaved soft input bits

References gsm0503_interleave_mcs5.

## gsm0503_mcs5_dl_interleave()

void gsm0503_mcs5_dl_interleave | ( | const ubit_t * | hc,
|  | const ubit_t * | dc,
|  | ubit_t * | hi,
|  | ubit_t * | di
| ) |  |

Interleave MCS5 DL burst bits according to TS 05.03 5.1.9.1.5.

Parameters

  [in] | hc | 100 soft coded header input bits
  [in] | dc | 1248 soft coded data input bits
  [out] | hi | 100 interleaved header output bits
  [out] | di | 1248 interleaved data output bits

References gsm0503_interleave_mcs5.

Referenced by egprs_type2_map().

## gsm0503_mcs5_ul_deinterleave()

void gsm0503_mcs5_ul_deinterleave | ( | sbit_t * | hc,
|  | sbit_t * | dc,
|  | const sbit_t * | hi,
|  | const sbit_t * | di
| ) |  |

De-Interleave MCS5 UL burst bits according to TS 05.03 5.1.9.2.4.

Parameters

  [out] | hc | caller-allocated output buffer for 136 soft coded header bits
  [out] | dc | caller-allocated output buffer for 1248 soft coded data bits
  [in] | iB | interleaved soft input bits

References gsm0503_interleave_mcs5.

Referenced by egprs_type2_unmap().

## gsm0503_mcs5_ul_interleave()

void gsm0503_mcs5_ul_interleave | ( | const ubit_t * | hc,
|  | const ubit_t * | dc,
|  | ubit_t * | hi,
|  | ubit_t * | di
| ) |  |

Interleave MCS5 UL burst bits according to TS 05.03 5.1.9.2.4.

Parameters

  [in] | hc | 136 soft coded header input bits
  [in] | dc | 1248 soft coded data input bits
  [out] | hi | 136 interleaved header output bits
  [out] | di | 1248 interleaved data output bits

References gsm0503_interleave_mcs5.

## gsm0503_mcs7_dl_deinterleave()

void gsm0503_mcs7_dl_deinterleave | ( | sbit_t * | hc,
|  | sbit_t * | c1,
|  | sbit_t * | c2,
|  | const sbit_t * | hi,
|  | const sbit_t * | di
| ) |  |

De-Interleave MCS7 DL burst bits according to TS 05.03 5.1.11.1.5.

Parameters

  [out] | hc | caller-allocated output buffer for 124 soft coded header bits
  [out] | c1 | caller-allocated output buffer for 612 soft coded data bits
  [out] | c2 | caller-allocated output buffer for 612 soft coded data bits
  [in] | hi | interleaved soft input header bits
  [in] | di | interleaved soft input data bits

## gsm0503_mcs7_dl_interleave()

void gsm0503_mcs7_dl_interleave | ( | const ubit_t * | hc,
|  | const ubit_t * | c1,
|  | const ubit_t * | c2,
|  | ubit_t * | hi,
|  | ubit_t * | di
| ) |  |

Interleave MCS7 DL burst bits according to TS 05.03 5.1.11.1.5.

Parameters

  [in] | hc | 124 soft coded header input bits
  [in] | c1 | 612 soft coded data input bits
  [in] | c2 | 612 soft coded data input bits
  [out] | hi | 124 interleaved header output bits
  [out] | di | 1224 interleaved data output bits

Referenced by egprs_type1_map().

## gsm0503_mcs7_ul_deinterleave()

void gsm0503_mcs7_ul_deinterleave | ( | sbit_t * | hc,
|  | sbit_t * | c1,
|  | sbit_t * | c2,
|  | const sbit_t * | hi,
|  | const sbit_t * | di
| ) |  |

De-Interleave MCS7 UL burst bits according to TS 05.03 5.1.11.2.4.

Parameters

  [out] | hc | caller-allocated output buffer for 160 soft coded header bits
  [out] | c1 | caller-allocated output buffer for 612 soft coded data bits
  [out] | c2 | caller-allocated output buffer for 612 soft coded data bits
  [in] | hi | interleaved soft input header bits
  [in] | di | interleaved soft input data bits

Referenced by egprs_type1_unmap().

## gsm0503_mcs7_ul_interleave()

void gsm0503_mcs7_ul_interleave | ( | const ubit_t * | hc,
|  | const ubit_t * | c1,
|  | const ubit_t * | c2,
|  | ubit_t * | hi,
|  | ubit_t * | di
| ) |  |

Interleave MCS7 UL burst bits according to TS 05.03 5.1.11.2.4.

Parameters

  [in] | hc | 124 soft coded header input bits
  [in] | c1 | 612 soft coded data input bits
  [in] | c2 | 612 soft coded data input bits
  [out] | hi | 124 interleaved header output bits
  [out] | di | 1224 interleaved data output bits

## gsm0503_mcs8_dl_deinterleave()

void gsm0503_mcs8_dl_deinterleave | ( | sbit_t * | hc,
|  | sbit_t * | c1,
|  | sbit_t * | c2,
|  | const sbit_t * | hi,
|  | const sbit_t * | di
| ) |  |

De-Interleave MCS8 DL burst bits according to TS 05.03 5.1.12.1.5.

Parameters

  [out] | hc | caller-allocated output buffer for 124 soft coded header bits
  [out] | c1 | caller-allocated output buffer for 612 soft coded data bits
  [out] | c2 | caller-allocated output buffer for 612 soft coded data bits
  [in] | hi | interleaved soft input header bits
  [in] | di | interleaved soft input data bits

## gsm0503_mcs8_dl_interleave()

void gsm0503_mcs8_dl_interleave | ( | const ubit_t * | hc,
|  | const ubit_t * | c1,
|  | const ubit_t * | c2,
|  | ubit_t * | hi,
|  | ubit_t * | di
| ) |  |

Interleave MCS8 DL burst bits according to TS 05.03 5.1.12.1.5.

Parameters

  [in] | hc | 124 soft coded header input bits
  [in] | c1 | 612 soft coded data input bits
  [in] | c2 | 612 soft coded data input bits
  [out] | hi | 124 interleaved header output bits
  [out] | di | 1224 interleaved data output bits

Referenced by egprs_type1_map().

## gsm0503_mcs8_ul_deinterleave()

void gsm0503_mcs8_ul_deinterleave | ( | sbit_t * | hc,
|  | sbit_t * | c1,
|  | sbit_t * | c2,
|  | const sbit_t * | hi,
|  | const sbit_t * | di
| ) |  |

De-Interleave MCS8 UL burst bits according to TS 05.03 5.1.12.2.4.

Parameters

  [out] | hc | caller-allocated output buffer for 160 soft coded header bits
  [out] | c1 | caller-allocated output buffer for 612 soft coded data bits
  [out] | c2 | caller-allocated output buffer for 612 soft coded data bits
  [in] | hi | interleaved soft input header bits
  [in] | di | interleaved soft input data bits

Referenced by egprs_type1_unmap().

## gsm0503_mcs8_ul_interleave()

void gsm0503_mcs8_ul_interleave | ( | const ubit_t * | hc,
|  | const ubit_t * | c1,
|  | const ubit_t * | c2,
|  | ubit_t * | hi,
|  | ubit_t * | di
| ) |  |

Interleave MCS8 UL burst bits according to TS 05.03 5.1.12.2.4.

Parameters

  [in] | hc | 160 soft coded header input bits
  [in] | c1 | 612 soft coded data input bits
  [in] | c2 | 612 soft coded data input bits
  [out] | hi | 160 interleaved header output bits
  [out] | di | 1224 interleaved data output bits

## gsm0503_tch_fr_deinterleave()

void gsm0503_tch_fr_deinterleave | ( | sbit_t * | cB,
|  | const sbit_t * | iB
| ) |  |

GSM TCH FR/EFR/AFS De-Interleaving and burst mapping.

Parameters

  [out] | cB | caller-allocated buffer for 456 unpacked output bits
  [in] | iB | 456 unpacked interleaved input bits

Referenced by gsm0503_tch_afs_decode(), gsm0503_tch_ahs_decode(), gsm0503_tch_fr_decode(), and gsm0503_tch_hr_decode().

## gsm0503_tch_fr_interleave()

void gsm0503_tch_fr_interleave | ( | const ubit_t * | cB,
|  | ubit_t * | iB
| ) |  |

GSM TCH FR/EFR/AFS Interleaving and burst mapping.

Parameters

  [in] | cB | caller-allocated buffer for 456 unpacked input bits
  [out] | iB | 456 unpacked interleaved output bits

Referenced by gsm0503_tch_afs_encode(), gsm0503_tch_ahs_encode(), gsm0503_tch_fr_encode(), and gsm0503_tch_hr_encode().

## gsm0503_tch_hr_deinterleave()

void gsm0503_tch_hr_deinterleave | ( | sbit_t * | cB,
|  | const sbit_t * | iB
| ) |  |

GSM TCH HR/AHS De-Interleaving and burst mapping.

Parameters

  [out] | cB | caller-allocated buffer for 228 unpacked output bits
  [in] | iB | 228 unpacked interleaved input bits

References gsm0503_tch_hr_interleaving.

Referenced by gsm0503_tch_ahs_decode(), and gsm0503_tch_hr_decode().

## gsm0503_tch_hr_interleave()

void gsm0503_tch_hr_interleave | ( | const ubit_t * | cB,
|  | ubit_t * | iB
| ) |  |

GSM TCH HR/AHS Interleaving and burst mapping.

Parameters

  [in] | cB | caller-allocated buffer for 228 unpacked input bits
  [out] | iB | 228 unpacked interleaved output bits

References gsm0503_tch_hr_interleaving.

Referenced by gsm0503_tch_ahs_encode(), and gsm0503_tch_hr_encode().

## gsm0503_xcch_deinterleave()

void gsm0503_xcch_deinterleave | ( | sbit_t * | cB,
|  | const sbit_t * | iB
| ) |  |

De-Interleave burst bits according to TS 05.03 4.1.4.

Parameters

  [out] | cB | caller-allocated output buffer for 456 soft coded bits
  [in] | iB | 456 soft input bits

Referenced by gsm0503_mcs1_dl_deinterleave(), gsm0503_mcs1_ul_deinterleave(), gsm0503_pdtch_decode(), and gsm0503_xcch_decode().

## gsm0503_xcch_interleave()

void gsm0503_xcch_interleave | ( | const ubit_t * | cB,
|  | ubit_t * | iB
| ) |  |

Interleave burst bits according to TS 05.03 4.1.4.

Parameters

  [out] | iB | caller-allocated output buffer for 456 soft interleaved bits
  [in] | cB | 456 soft input coded bits

Referenced by gsm0503_mcs1_dl_interleave(), gsm0503_mcs1_ul_interleave(), gsm0503_pdtch_encode(), and gsm0503_xcch_encode().