⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 plugins-wimax-msg_dlmap.c

📁 Intel的WIMAX代码,主要是mac层code
💻 C
📖 第 1 页 / 共 5 页
字号:
	    XBIT(data, 2, "Num_Beamformed_Streams");
        }
    }

    /* CQICH Control Info */
    if (cqi == 1) {
        CQICH_num = 0;
	XBIT(data, 3, "Period");
	XBIT(data, 3, "Frame Offset");
	XBIT(data, 4, "Duration");
        for (j = 0; j < N_layer; j++) {
	    XBIT(data, 6, "Allocation Index");
        }
	XBIT(CQICH_num, 2, "CQICH_Num");
        for (j = 0; j < CQICH_num; j++) {
	    XBIT(data, 3, "Feedback type");
	    XBIT(data, 6, "Allocation index");
        }
    }

    /* Closed MIMO Control Info */
    if (cmi == 1) {
        if (mci == 1) {
            mimo_mode = matrix;
        } else {
            mimo_mode = STC_Zone_Matrix;
        }
        if (mimo_mode == 0 || mimo_mode == 1) {
	    XBIT(data, 3, "Antenna Grouping Index");
        } else if (mimo_mode == 2) {
	    XBIT(data, 2, "Num_stream");
	    XBIT(data, 3, "Antenna Selection Index");
        } else if (mimo_mode == 3) {
	    XBIT(data, 2, "Num_stream");
	    XBIT(data, 6, "Codebook Precoding Index");
        }
    }

    /* padding to nibble */
    pad = BIT_PADDING(bit,4);
    if(pad){
	proto_tree_add_text(tree, tvb, BITHI(bit,pad), "Padding: %d bits", pad);
	bit += pad;
    }

    return (bit - offset);
}

gint DL_HARQ_Chase_sub_burst_IE(proto_tree *diuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb)
{
    /* 8.4.5.3.21 DL_HARQ_Chase_sub_burst_IE */
    /* offset of IE in nibbles, length is variable */
    gint bit;
    gint data;
    proto_item *ti = NULL;
    proto_tree *tree = NULL;
    gint nsub, ddci, dur, sbi, res, diuc, rci, ind, per, ofs;
    gint j;

    bit = NIB_TO_BIT(offset);

    /* 8.4.5.3.21 table 286m */
    ti = proto_tree_add_text(diuc_tree, tvb, BITHI(bit, 4), "DL_HARQ_Chase_sub_burst_IE");
    tree = proto_item_add_subtree(ti, ett_286m);

    XBIT(nsub, 4, "N sub burst[ISI]");
    XBIT(data, 4, "N ACK channel");

    for (j = 0; j < nsub; j++) {
        bit += RCID_IE(tree, bufptr, bit, length, tvb, RCID_Type);
	XBIT(dur, 10, "Duration");
	XBIT(sbi,  1, "Sub-Burst DIUC Indicator");
	XBIT(res,  1, "Reserved");

        if (sbi == 1) {
	    XBIT(diuc, 4, "DIUC");
	    XBIT(rci, 2, "Repetition Coding Indication");
	    XBIT(res, 2, "Reserved");
        }

	XBIT(data, 4, "ACID");
	XBIT(data, 1, "AI_SN");
	XBIT(data, 1, "ACK disable");
	XBIT(ddci, 2, "Dedicated DL Control Indicator");

        if ((ddci & 1) == 1) {
	    XBIT(dur, 4, "Duration (d)");
            if (dur != 0) {
		XBIT(ind, 6, "Allocation Index");
		XBIT(per, 3, "Period (p)");
		XBIT(ofs, 3, "Frame offset");
            }
        }

        if ((ddci & 2) == 2) {
            bit += Dedicated_DL_Control_IE(tree, bufptr, BIT_TO_NIB(bit), length, tvb) * 4;
        }
    }

    proto_tree_add_text(tree, tvb, BITHI(bit,4), "(DL HARQ Chase sub-burst IE)");
    return (BIT_TO_NIB(bit) - offset);
}

gint DL_HARQ_IR_CTC_sub_burst_IE(proto_tree *diuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb)
{
    /* offset of IE in nibbles, length is variable */
    gint bit;
    guint data;
    proto_item *ti = NULL;
    proto_tree *tree = NULL;
    proto_item *generic_item = NULL;
    gint nsub, ddci, dur, ind, per, ofs;
    gint j;
    guint32	   calculated_crc;

    bit = NIB_TO_BIT(offset);

    /* 8.4.5.3.21 table 286n */
    ti = proto_tree_add_text(diuc_tree, tvb, BITHI(bit, 4), "DL HARQ IR CTC sub-burst IE");
    tree = proto_item_add_subtree(ti, ett_286n);

    XBIT(nsub, 4, "N sub burst[ISI]");
    XBIT(data, 4, "N ACK channel");

    nsub += 1;
    for (j = 0; j < nsub; j++) {
        bit += RCID_IE(tree, bufptr, bit, length, tvb, RCID_Type);

	XBIT(data, 4, "N(EP)");
	XBIT(data, 4, "N(SCH)");
	XBIT(data, 2, "SPID");
	XBIT(data, 4, "ACID");
	XBIT(data, 1, "AI_SN");
	XBIT(data, 1, "ACK disable");
	XBIT(data, 2, "Reserved");
	XBIT(ddci, 2, "Dedicated DL Control Indicator");

        if ((ddci & 1) == 1) {
	    XBIT(dur, 4, "Duration (d)");

            if (dur != 0) {
		XBIT(ind, 6, "Allocation Index");
		XBIT(per, 3, "Period (p)");
		XBIT(ofs, 3, "Frame offset");
            }
        }
        if ((ddci & 2) == 2) {
            bit += Dedicated_DL_Control_IE(tree, bufptr, BIT_TO_NIB(bit), length, tvb);
        }
    }

    if (include_cor2_changes)
    {
	/* CRC-16 is always appended */
	data = BIT_BITS(bit, bufptr, 16);
	generic_item = proto_tree_add_text(tree, tvb, BITHI(bit,16), "CRC-16: 0x%04x",data);
	/* calculate the CRC */
	calculated_crc = wimax_mac_calc_crc16((guint8 *)tvb_get_ptr(tvb, 0, BIT_TO_BYTE(bit)), BIT_TO_BYTE(bit));
	if (data != calculated_crc)
	{
		proto_item_append_text(generic_item, " - incorrect! (should be: 0x%x)", calculated_crc);
	}
	bit += 16;
    }

    return (BIT_TO_NIB(bit) - offset);
}

gint DL_HARQ_IR_CC_sub_burst_IE(proto_tree *diuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb)
{
    /* offset of IE in nibbles, length is variable */
    gint bit;
    gint data;
    proto_item *ti = NULL;
    proto_tree *tree = NULL;
    proto_item *generic_item = NULL;
    gint nsub, sbdi, ddci, dur, ind, per, ofs;
    gint j;
    guint16 calculated_crc;

    bit = NIB_TO_BIT(offset);

    /* 8.4.5.3.21 table 286o */
    ti = proto_tree_add_text(diuc_tree, tvb, BITHI(bit, 4), "DL HARQ IR CC sub-burst IE");
    tree = proto_item_add_subtree(ti, ett_286o);

    XBIT(nsub, 4, "N sub burst[ISI]");
    XBIT(data, 4, "N ACK channel");

    nsub += 1;
    for (j = 0; j < nsub; j++) {
        bit += RCID_IE(tree, bufptr, bit, length, tvb, RCID_Type) / 4;

	XBIT(data, 10, "Duration");
	XBIT(sbdi,  1, "Sub-Burst DIUC Indicator");
	XBIT(data,  1, "Reserved");

        if (sbdi) {
	    XBIT(data, 4, "DIUC");
	    XBIT(data, 2, "Repetition Coding Indication");
	    XBIT(data, 2, "Reserved");
        }

	XBIT(data, 4, "ACID");
	XBIT(data, 1, "AI_SN");
	XBIT(data, 2, "SPID");
	XBIT(data, 1, "ACK disable");
	XBIT(ddci, 2, "Dedicated DL Control Indicator");
	XBIT(data, 2, "Reserved");

        if (ddci & 1) {
	    XBIT(dur, 4, "Duration (d)");

            if (dur != 0) {
		XBIT(ind, 6, "Allocation Index");
		XBIT(per, 3, "Period (p)");
		XBIT(ofs, 3, "Frame offset");
            }
        }
        if ((ddci & 2) == 2) {
            bit += Dedicated_DL_Control_IE(tree, bufptr, BIT_TO_NIB(bit), length, tvb);
        }
    }

    if (include_cor2_changes)
    {
	/* CRC-16 is always appended */
	data = BIT_BITS(bit, bufptr, 16);
	generic_item = proto_tree_add_text(tree, tvb, BITHI(bit,16), "CRC-16: 0x%04x",data);
	/* calculate the CRC */
	calculated_crc = wimax_mac_calc_crc16((guint8 *)tvb_get_ptr(tvb, 0, BIT_TO_BYTE(bit)), BIT_TO_BYTE(bit));
	if (data != calculated_crc)
	{
		proto_item_append_text(generic_item, " - incorrect! (should be: 0x%x)", calculated_crc);
	}
	bit += 16;
    }

    return (BIT_TO_NIB(bit) - offset);
}

gint MIMO_DL_Chase_HARQ_sub_burst_IE(proto_tree *diuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb)
{
    /* offset of IE in nibbles, length is variable */
    gint bit;
    gint data;
    proto_item *ti = NULL;
    proto_tree *tree = NULL;
    proto_item *generic_item = NULL;
    gint nsub, mui, dci, akd;
    gint i, j;
    guint16 calculated_crc;

    bit = NIB_TO_BIT(offset);

    /* 8.4.5.3.21 table 286p */
    ti = proto_tree_add_text(diuc_tree, tvb, BITHI(bit, 1), "MIMO DL Chase HARQ sub-burst IE");
    tree = proto_item_add_subtree(ti, ett_286p);

    XBIT(nsub, 4, "N sub burst[ISI]");
    XBIT(data, 6, "N ACK channel");

    nsub += 1;
    for (j = 0; j < nsub; j++) {
	XBIT(mui, 1, "MU Indicator");
	XBIT(dci, 1, "Dedicated MIMO DL Control Indicator");
	XBIT(akd, 1, "ACK Disable");
        if (mui == 0) {
            bit += RCID_IE(tree, bufptr, bit, length, tvb, RCID_Type);
        }
        if (dci == 1) {
            bit += Dedicated_MIMO_DL_Control_IE(tree, bufptr, bit, length, tvb);
        }
	XBIT(data, 10, "Duration");
        for (i = 0; i < N_layer; i++) {
            if (mui == 1) {
                bit += RCID_IE(tree, bufptr, bit, length, tvb, RCID_Type);
            }
	    XBIT(data, 4, "DIUC");
	    XBIT(data, 2, "Repetition Coding Indication");
            if (akd == 0) {
		XBIT(data, 4, "ACID");
		XBIT(data, 1, "AI_SN");
            }
        }
    }
    /* Padding to nibble */
    data = BIT_PADDING(bit, 4);
    if (data) {
        proto_tree_add_text(tree, tvb, BITHI(bit,data), "Padding: %d bits", data);
        bit += data;
    }

    if (include_cor2_changes)
    {
	/* CRC-16 is always appended */
	data = BIT_BITS(bit, bufptr, 16);
	generic_item = proto_tree_add_text(tree, tvb, BITHI(bit,16), "CRC-16: 0x%04x",data);
	/* calculate the CRC */
	calculated_crc = wimax_mac_calc_crc16((guint8 *)tvb_get_ptr(tvb, 0, BIT_TO_BYTE(bit)), BIT_TO_BYTE(bit));
	if (data != calculated_crc)
	{
		proto_item_append_text(generic_item, " - incorrect! (should be: 0x%x)", calculated_crc);
	}
	bit += 16;
    }

    return (BIT_TO_NIB(bit) - offset);
}

gint MIMO_DL_IR_HARQ_sub_burst_IE(proto_tree *diuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb)
{
    /* offset of IE in nibbles, length is variable */
    gint bit;
    gint data;
    proto_item *ti = NULL;
    proto_tree *tree = NULL;
    proto_item *generic_item = NULL;
    gint nsub, mui, dci, akd;
    gint i, j;
    guint16 calculated_crc;

    bit = NIB_TO_BIT(offset);

    /* 8.4.5.3.21 table 286q */
    ti = proto_tree_add_text(diuc_tree, tvb, BITHI(bit, 4), "MIMO DL IR HARQ sub-burst IE");
    tree = proto_item_add_subtree(ti, ett_286q);

    XBIT(nsub, 4, "N sub burst[ISI]");
    XBIT(data, 6, "N ACK channel");

    nsub += 1;
    for (j = 0; j < nsub; j++) {
	XBIT(mui, 1, "MU Indicator");
	XBIT(dci, 1, "Dedicated MIMO DL Control Indicator");
	XBIT(akd, 1, "ACK Disable");
        if (mui == 0) {
            bit += RCID_IE(tree, bufptr, bit, length, tvb, RCID_Type);
        }
        if (dci == 1) {
            bit += Dedicated_MIMO_DL_Control_IE(tree, bufptr, bit, length, tvb);
        }
	XBIT(data, 4, "N(SCH)");
        for (i = 0; i < N_layer; i++) {
            if (mui == 1) {
                bit += RCID_IE(tree, bufptr, bit, length, tvb, RCID_Type);
            }
	    XBIT(data, 4, "N(EP)");
            if (akd) {
		XBIT(data, 2, "SPID");
		XBIT(data, 4, "ACID");
		XBIT(data, 1, "AI_SN");
            }
        }
    }

    if (include_cor2_changes)
    {
	/* CRC-16 is always appended */
	data = BIT_BITS(bit, bufptr, 16);
	generic_item = proto_tree_add_text(tree, tvb, BITHI(bit,16), "CRC-16: 0x%04x",data);
	/* calculate the CRC */
	calculated_crc = wimax_mac_calc_crc16((guint8 *)tvb_get_ptr(tvb, 0, BIT_TO_BYTE(bit)), BIT_TO_BYTE(bit));
	if (data != calculated_crc)
	{
		proto_item_append_text(generic_item, " - incorrect! (should be: 0x%x)", calculated_crc);
	}
	bit += 16;
    }

    return (BIT_TO_NIB(bit) - offset);
}

gint MIMO_DL_IR_HARQ_for_CC_sub_burst_IE(proto_tree *diuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb)
{
    /* offset of IE in nibbles, length is variable */
    gint bit;
    gint data;
    proto_item *ti = NULL;
    proto_tree *tree = NULL;
    proto_item *generic_item = NULL;
    gint nsub, mui, dci, akd;
    gint i, j;
    guint16 calculated_crc;

    bit = NIB_TO_BIT(offset);

    /* 8.4.5.3.21 table 286r */
    ti = proto_tree_add_text(diuc_tree, tvb, BITHI(bit, 1), "MIMO DL IR HARQ for CC sub-burst IE");
    tree = proto_item_add_subtree(ti, ett_286r);

    XBIT(nsub, 4, "N sub burst[ISI]");
    XBIT(data, 6, "N ACK channel");

    nsub += 1;
    for (j = 0; j < nsub; j++) {
	XBIT(mui, 1, "MU Indicator");
	XBIT(dci, 1, "Dedicated MIMO DL Control Indicator");
	XBIT(akd, 1, "ACK Disable");
        if (mui == 0) {
            bit += RCID_IE(tree, bufptr, bit, length, tvb, RCID_Type);
        }
        if (dci == 1) {
            bit += Dedicated_MIMO_DL_Control_IE(tree, bufptr, bit, length, tvb);
        }
	XBIT(data, 10, "Duration");
        for (i = 0; i < N_layer; i++) {
            if (mui == 1) {
                bit += RCID_IE(tree, bufptr, bit, length, tvb, RCID_Type);
            }
	    XBIT(data, 4, "DIUC");
	    XBIT(data, 2, "Repetition Coding Indication");
            if (akd == 0) {
		XBIT(data, 4, "ACID");
		XBIT(data, 1, "AI_SN");
		XBIT(data, 2, "SPID");
            }
        }
    }

    if (include_cor2_changes)
    {
	/* CRC-16 is always appended */
	data = BIT_BITS(bit, bufptr, 16);
	generic_item = proto_tree_add_text(tree, tvb, BITHI(bit,16), "CRC-16: 0x%04x",data);
	/* calculate the CRC */
	calculated_crc = wimax_mac_calc_crc16((guint8 *)tvb_get_ptr(tvb, 0, BIT_TO_BYTE(bit)), BIT_TO_BYTE(bit));
	if (data != calculated_crc)
	{
		proto_item_append_text(generic_item, " - incorrect! (should be: 0x%x)", calculated_crc);
	}
	bit += 16;
    }

    return (BIT_TO_NIB(bit) - offset);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -