Changes between Version 5 and Version 6 of howto/bitfields_in_microblaze


Ignore:
Timestamp:
Feb 18, 2015, 10:57:48 AM (9 years ago)
Author:
chunter
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • howto/bitfields_in_microblaze

    v5 v6  
    194194}}}
    195195
    196 {{{phy_header}}} is a struct made up of two bit-fields ({{{l_sig_bf}}} and {{{ht_sig_bf}}}) followed by a 16-bit variable {{{service}}}.
     196{{{phy_header}}} is a struct made up of two bit-fields ({{{l_sig_bf}}} and {{{ht_sig_bf}}}) followed by a 16-bit variable {{{service}}}. We now define a function that will print these various elements when given a pointer to a {{{phy_header}}} struct:
     197
     198{{{
     199#!div style="font-size: 90%"
     200  {{{#!C
     201void print_phy_header(phy_header* my_header){
     202        xil_printf("L-SIG Rate:            %d\n",   my_header->l_sig.rate);
     203        xil_printf("L-SIG Reserved:        %d\n",   my_header->l_sig.reserved);
     204        xil_printf("L-SIG Length:          %d\n",   my_header->l_sig.length);
     205        xil_printf("L-SIG Parity:          %d\n",   my_header->l_sig.parity);
     206        xil_printf("L-SIG Tail:            %d\n",   my_header->l_sig.tail);
     207        xil_printf("HT-SIG MCS:            %d\n",   my_header->ht_sig.mcs);
     208        xil_printf("HT-SIG BW:             %d\n",   my_header->ht_sig.bw);
     209        xil_printf("HT-SIG LEN:            %d\n",   my_header->ht_sig.len);
     210        xil_printf("HT-SIG SMOOTHING:      %d\n",   my_header->ht_sig.smoothing);
     211        xil_printf("HT-SIG NOT_SOUNDING:   %d\n",   my_header->ht_sig.not_sounding);
     212        xil_printf("HT-SIG RESERVED:       %d\n",   my_header->ht_sig.reserved);
     213        xil_printf("HT-SIG AGG:            %d\n",   my_header->ht_sig.agg);
     214        xil_printf("HT-SIG STBC:           %d\n",   my_header->ht_sig.stbc);
     215        xil_printf("HT-SIG FEC:            %d\n",   my_header->ht_sig.fec);
     216        xil_printf("HT-SIG SHORT_GI:       %d\n",   my_header->ht_sig.short_gi);
     217        xil_printf("HT-SIG N_ESS:          %d\n",   my_header->ht_sig.n_ess);
     218        xil_printf("HT-SIG CRC:            %d\n",   my_header->ht_sig.crc);
     219        xil_printf("HT-SIG TAIL:           %d\n",   my_header->ht_sig.tail);
     220        xil_printf("Service:               0x%x\n", my_header->service);
     221}
     222  }}}
     223}}}
     224
     225Finally, we use this struct to recast the {{{rx_bytes}} array defined earlier and print the result:
     226
     227{{{
     228#!div style="font-size: 90%"
     229  {{{#!C
     230void print_phy_header(phy_header* my_header){
     231        print_phy_header( (phy_header*)rx_bytes );
     232}
     233  }}}
     234}}}
     235
     236
     237
    197238
    198239= Example: Register Access =