2
* Copyright (C) Jan 2013 Mellanox Technologies Ltd. All rights reserved.
4
* This software is available to you under a choice of one of two
5
* licenses. You may choose to be licensed under the terms of the GNU
6
* General Public License (GPL) Version 2, available from the file
7
* COPYING in the main directory of this source tree, or the
8
* OpenIB.org BSD license below:
10
* Redistribution and use in source and binary forms, with or
11
* without modification, are permitted provided that the following
14
* - Redistributions of source code must retain the above
15
* copyright notice, this list of conditions and the following
18
* - Redistributions in binary form must reproduce the above
19
* copyright notice, this list of conditions and the following
20
* disclaimer in the documentation and/or other materials
21
* provided with the distribution.
23
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
27
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
28
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
29
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
34
*** This file was generated at "2014-03-11 10:10:14"
36
*** > /mswg/release/eat_me/last_release/adabe_plugins/adb2c/adb2pack.py --input adb/tools/tools.adb --file-prefix tools --prefix tools_
37
*** and modified to fit the needs of mstflint.
39
#include "tools_layouts.h"
41
void tools_mnv_hdr_pack(const struct tools_mnv_hdr *ptr_struct, u_int8_t* ptr_buff){
50
adb2c_push_bits_to_buff(ptr_buff, offset, 16, (u_int32_t)ptr_struct->type);
53
adb2c_push_bits_to_buff(ptr_buff, offset, 12, (u_int32_t)ptr_struct->length);
56
adb2c_push_bits_to_buff(ptr_buff, offset, 8, (u_int32_t)ptr_struct->type_mod);
59
adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->shadow);
62
adb2c_push_bits_to_buff(ptr_buff, offset, 2, (u_int32_t)ptr_struct->pad_cnt);
65
adb2c_push_bits_to_buff(ptr_buff, offset, 4, (u_int32_t)ptr_struct->version);
69
void tools_mnv_hdr_unpack(struct tools_mnv_hdr *ptr_struct, const u_int8_t* ptr_buff){
78
ptr_struct->type = (u_int16_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 16);
81
ptr_struct->length = (u_int16_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 12);
84
ptr_struct->type_mod = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 8);
87
ptr_struct->shadow = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
90
ptr_struct->pad_cnt = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 2);
93
ptr_struct->version = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 4);
97
void tools_mnv_hdr_print(const struct tools_mnv_hdr *ptr_struct, FILE* file, int indent_level){
98
adb2c_add_indentation(file, indent_level);
99
fprintf(file, "======== mnv_hdr ========\n");
101
(void)i;(void)ptr_struct;
105
adb2c_add_indentation(file, indent_level);
106
fprintf(file, "type : "UH_FMT"\n", ptr_struct->type);
108
adb2c_add_indentation(file, indent_level);
109
fprintf(file, "length : "UH_FMT"\n", ptr_struct->length);
111
adb2c_add_indentation(file, indent_level);
112
fprintf(file, "type_mod : "UH_FMT"\n", ptr_struct->type_mod);
114
adb2c_add_indentation(file, indent_level);
115
fprintf(file, "shadow : "UH_FMT"\n", ptr_struct->shadow);
117
adb2c_add_indentation(file, indent_level);
118
fprintf(file, "pad_cnt : "UH_FMT"\n", ptr_struct->pad_cnt);
120
adb2c_add_indentation(file, indent_level);
121
fprintf(file, "version : "UH_FMT"\n", ptr_struct->version);
125
int tools_mnv_hdr_size(){
129
void tools_mnv_hdr_dump(const struct tools_mnv_hdr *ptr_struct, FILE* file) {
130
tools_mnv_hdr_print(ptr_struct, file, 0);
133
void tools_mnvia_pack(const struct tools_mnvia *ptr_struct, u_int8_t* ptr_buff){
142
tools_mnv_hdr_pack(&(ptr_struct->mnv_hdr), ptr_buff + offset/8);
146
void tools_mnvia_unpack(struct tools_mnvia *ptr_struct, const u_int8_t* ptr_buff){
155
tools_mnv_hdr_unpack(&(ptr_struct->mnv_hdr), ptr_buff + offset/8);
159
void tools_mnvia_print(const struct tools_mnvia *ptr_struct, FILE* file, int indent_level){
160
adb2c_add_indentation(file, indent_level);
161
fprintf(file, "======== mnvia ========\n");
163
(void)i;(void)ptr_struct;
167
adb2c_add_indentation(file, indent_level);
168
fprintf(file, "mnv_hdr:\n");
169
tools_mnv_hdr_print(&(ptr_struct->mnv_hdr), file, indent_level + 1);
173
int tools_mnvia_size(){
177
void tools_mnvia_dump(const struct tools_mnvia *ptr_struct, FILE* file) {
178
tools_mnvia_print(ptr_struct, file, 0);
181
void tools_mnvi_pack(const struct tools_mnvi *ptr_struct, u_int8_t* ptr_buff){
190
tools_mnv_hdr_pack(&(ptr_struct->mnv_hdr), ptr_buff + offset/8);
194
void tools_mnvi_unpack(struct tools_mnvi *ptr_struct, const u_int8_t* ptr_buff){
203
tools_mnv_hdr_unpack(&(ptr_struct->mnv_hdr), ptr_buff + offset/8);
207
void tools_mnvi_print(const struct tools_mnvi *ptr_struct, FILE* file, int indent_level){
208
adb2c_add_indentation(file, indent_level);
209
fprintf(file, "======== mnvi ========\n");
211
(void)i;(void)ptr_struct;
215
adb2c_add_indentation(file, indent_level);
216
fprintf(file, "mnv_hdr:\n");
217
tools_mnv_hdr_print(&(ptr_struct->mnv_hdr), file, indent_level + 1);
221
int tools_mnvi_size(){
225
void tools_mnvi_dump(const struct tools_mnvi *ptr_struct, FILE* file) {
226
tools_mnvi_print(ptr_struct, file, 0);
229
void tools_mnva_pack(const struct tools_mnva *ptr_struct, u_int8_t* ptr_buff){
238
tools_mnv_hdr_pack(&(ptr_struct->mnv_hdr), ptr_buff + offset/8);
240
for (i=0; i < 128; i++) {
241
offset=adb2c_calc_array_field_address(88, 8, i, 2048, 1);
242
adb2c_push_bits_to_buff(ptr_buff, offset, 8, (u_int32_t)ptr_struct->data[i]);
247
void tools_mnva_unpack(struct tools_mnva *ptr_struct, const u_int8_t* ptr_buff){
256
tools_mnv_hdr_unpack(&(ptr_struct->mnv_hdr), ptr_buff + offset/8);
258
for (i=0; i < 128; i++) {
259
offset=adb2c_calc_array_field_address(88, 8, i, 2048, 1);
260
ptr_struct->data[i] = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 8);
265
void tools_mnva_print(const struct tools_mnva *ptr_struct, FILE* file, int indent_level){
266
adb2c_add_indentation(file, indent_level);
267
fprintf(file, "======== mnva ========\n");
269
(void)i;(void)ptr_struct;
273
adb2c_add_indentation(file, indent_level);
274
fprintf(file, "mnv_hdr:\n");
275
tools_mnv_hdr_print(&(ptr_struct->mnv_hdr), file, indent_level + 1);
277
for (i=0; i < 128; i++) {
278
adb2c_add_indentation(file, indent_level);
279
fprintf(file, "data[%3d] : "UH_FMT"\n", i, ptr_struct->data[i]);
284
int tools_mnva_size(){
288
void tools_mnva_dump(const struct tools_mnva *ptr_struct, FILE* file) {
289
tools_mnva_print(ptr_struct, file, 0);
292
void tools_sriov_pack(const struct tools_sriov *ptr_struct, u_int8_t* ptr_buff){
301
adb2c_push_bits_to_buff(ptr_buff, offset, 16, (u_int32_t)ptr_struct->total_vfs);
304
adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->sriov_en);
308
void tools_sriov_unpack(struct tools_sriov *ptr_struct, const u_int8_t* ptr_buff){
317
ptr_struct->total_vfs = (u_int16_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 16);
320
ptr_struct->sriov_en = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
324
void tools_sriov_print(const struct tools_sriov *ptr_struct, FILE* file, int indent_level){
325
adb2c_add_indentation(file, indent_level);
326
fprintf(file, "======== sriov ========\n");
328
(void)i;(void)ptr_struct;
332
adb2c_add_indentation(file, indent_level);
333
fprintf(file, "total_vfs : "UH_FMT"\n", ptr_struct->total_vfs);
335
adb2c_add_indentation(file, indent_level);
336
fprintf(file, "sriov_en : "UH_FMT"\n", ptr_struct->sriov_en);
340
int tools_sriov_size(){
344
void tools_sriov_dump(const struct tools_sriov *ptr_struct, FILE* file) {
345
tools_sriov_print(ptr_struct, file, 0);
348
void tools_bar_size_pack(const struct tools_bar_size *ptr_struct, u_int8_t* ptr_buff){
357
adb2c_push_integer_to_buff(ptr_buff, offset, 4, (u_int64_t)ptr_struct->log_uar_bar_size);
361
void tools_bar_size_unpack(struct tools_bar_size *ptr_struct, const u_int8_t* ptr_buff){
370
ptr_struct->log_uar_bar_size = (u_int32_t)adb2c_pop_integer_from_buff(ptr_buff, offset, 4);
374
void tools_bar_size_print(const struct tools_bar_size *ptr_struct, FILE* file, int indent_level){
375
adb2c_add_indentation(file, indent_level);
376
fprintf(file, "======== bar_size ========\n");
378
(void)i;(void)ptr_struct;
382
adb2c_add_indentation(file, indent_level);
383
fprintf(file, "log_uar_bar_size : "U32H_FMT"\n", ptr_struct->log_uar_bar_size);
387
int tools_bar_size_size(){
391
void tools_bar_size_dump(const struct tools_bar_size *ptr_struct, FILE* file) {
392
tools_bar_size_print(ptr_struct, file, 0);
395
void tools_vpi_settings_pack(const struct tools_vpi_settings *ptr_struct, u_int8_t* ptr_buff){
404
adb2c_push_bits_to_buff(ptr_buff, offset, 2, (u_int32_t)ptr_struct->network_link_type);
408
void tools_vpi_settings_unpack(struct tools_vpi_settings *ptr_struct, const u_int8_t* ptr_buff){
417
ptr_struct->network_link_type = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 2);
421
void tools_vpi_settings_print(const struct tools_vpi_settings *ptr_struct, FILE* file, int indent_level){
422
adb2c_add_indentation(file, indent_level);
423
fprintf(file, "======== vpi_settings ========\n");
425
(void)i;(void)ptr_struct;
429
adb2c_add_indentation(file, indent_level);
430
fprintf(file, "network_link_type : "UH_FMT"\n", ptr_struct->network_link_type);
434
int tools_vpi_settings_size(){
438
void tools_vpi_settings_dump(const struct tools_vpi_settings *ptr_struct, FILE* file) {
439
tools_vpi_settings_print(ptr_struct, file, 0);
442
void tools_wol_pack(const struct tools_wol *ptr_struct, u_int8_t* ptr_buff){
451
adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->reserved0);
454
adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->en_wol_magic);
457
adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->reserved1);
460
adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->reserved2);
463
adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->reserved3);
466
adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->reserved4);
469
adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->reserved5);
473
void tools_wol_unpack(struct tools_wol *ptr_struct, const u_int8_t* ptr_buff){
482
ptr_struct->reserved0 = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
485
ptr_struct->en_wol_magic = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
488
ptr_struct->reserved1 = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
491
ptr_struct->reserved2 = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
494
ptr_struct->reserved3 = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
497
ptr_struct->reserved4 = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
500
ptr_struct->reserved5 = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
504
void tools_wol_print(const struct tools_wol *ptr_struct, FILE* file, int indent_level){
505
adb2c_add_indentation(file, indent_level);
506
fprintf(file, "======== wol ========\n");
508
(void)i;(void)ptr_struct;
512
adb2c_add_indentation(file, indent_level);
513
fprintf(file, "reserved0 : "UH_FMT"\n", ptr_struct->reserved0);
515
adb2c_add_indentation(file, indent_level);
516
fprintf(file, "en_wol_magic : "UH_FMT"\n", ptr_struct->en_wol_magic);
518
adb2c_add_indentation(file, indent_level);
519
fprintf(file, "reserved1 : "UH_FMT"\n", ptr_struct->reserved1);
521
adb2c_add_indentation(file, indent_level);
522
fprintf(file, "reserved2 : "UH_FMT"\n", ptr_struct->reserved2);
524
adb2c_add_indentation(file, indent_level);
525
fprintf(file, "reserved3 : "UH_FMT"\n", ptr_struct->reserved3);
527
adb2c_add_indentation(file, indent_level);
528
fprintf(file, "reserved4 : "UH_FMT"\n", ptr_struct->reserved4);
530
adb2c_add_indentation(file, indent_level);
531
fprintf(file, "reserved5 : "UH_FMT"\n", ptr_struct->reserved5);
535
int tools_wol_size(){
539
void tools_wol_dump(const struct tools_wol *ptr_struct, FILE* file) {
540
tools_wol_print(ptr_struct, file, 0);