lte_cfi_channel_encode.m 1.73 KB
Newer Older
Ben Wojtowicz's avatar
Ben Wojtowicz committed
1
%
2
% Copyright 2011-2012 Ben Wojtowicz
Ben Wojtowicz's avatar
Ben Wojtowicz committed
3 4
%
%    This program is free software: you can redistribute it and/or modify
5
%    it under the terms of the GNU Affero General Public License as published by
Ben Wojtowicz's avatar
Ben Wojtowicz committed
6 7 8 9 10 11
%    the Free Software Foundation, either version 3 of the License, or
%    (at your option) any later version.
%
%    This program is distributed in the hope that it will be useful,
%    but WITHOUT ANY WARRANTY; without even the implied warranty of
%    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
%    GNU Affero General Public License for more details.
Ben Wojtowicz's avatar
Ben Wojtowicz committed
13
%
14
%    You should have received a copy of the GNU Affero General Public License
Ben Wojtowicz's avatar
Ben Wojtowicz committed
15 16 17 18 19 20 21 22 23 24 25
%    along with this program.  If not, see <http://www.gnu.org/licenses/>.
%
% Function:    lte_cfi_channel_encode
% Description: Channel encodes the control format
%              indicator channel
% Inputs:      cfi - Control format indicator
% Outputs:     cfi_bits - Control format indicator
%                         channel encoded bits
% Spec:        3GPP TS 36.212 section 5.3.4 v10.1.0
% Notes:       None
% Rev History: Ben Wojtowicz 12/26/2011 Created
26
%              Ben Wojtowicz 01/29/2012 Fixed license statement
Ben Wojtowicz's avatar
Ben Wojtowicz committed
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
%
function [cfi_bits] = lte_cfi_channel_encode(cfi)
    % Check cfi
    if(cfi == 1)
        cfi_bits = [0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1];
    elseif(cfi == 2)
        cfi_bits = [1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0];
    elseif(cfi == 3)
        cfi_bits = [1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1];
    elseif(cfi == 4)
        cfi_bits = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];
    else
        printf("ERROR: Invalid cfi %u\n", cfi);
        cfi_bits = 0;
    endif
endfunction