wlconf: add a new util for handling conf binary files

This is a new tool that can be used to parse, read and write settings
to a binary configuration file compatible with the TI WLAN drivers.

Initial implementation.

Signed-off-by: Luciano Coelho <coelho@ti.com>
wlconf: add skeleton for some more options

Add a few more options to define the header file to parse or the
binary file that contains the structure and commands to print the
struct or dump the parsed binary configuration file.

Signed-off-by: Luciano Coelho <coelho@ti.com>
wlconf: add help option

Add an option to print the usage and exit.

Signed-off-by: Luciano Coelho <coelho@ti.com>
wlconf: add makefiles

Add Makefile and Android.mk.

Signed-off-by: Luciano Coelho <coelho@ti.com>
wlconf: rename dump_struct to root_struct

Dump struct sounds confusing when we are not going to dump the data.
Rename it to root_struct to make it clearer.

Signed-off-by: Luciano Coelho <coelho@ti.com>
wlconf: add dump and print-struct commands

Add a command to dump the binary in human-readable format and a
command to print out only the structure (useful when no binary data is
available).

Signed-off-by: Luciano Coelho <coelho@ti.com>
wlconf: merge dump_conf with print_structs

The print_structs() function was broken and the proper one is very
similar to the existing dump_conf() function.  Modify the existing
dump_conf() function to work with both cases and rename it to
print_structs.

Signed-off-by: Luciano Coelho <coelho@ti.com>
wlconf: remove print_struct() function

The print_struct() function was not used and probably broken.

Signed-off-by: Luciano Coelho <coelho@ti.com>
wlconf: simplify ELEMENT_PATTERN regular expression

There was an unnecessary substring match in the ELEMENT_PATTERN
regular expression.  Remove it to simpligy the regex a bit.

Signed-off-by: Luciano Coelho <coelho@ti.com>
wlconf: fix parsting of zero-sized arrays

If the array had a size of zero (eg. in the end of the struct as a
place-holder for priv), we were assigning a size of 1.  This commit
fixes that.

Signed-off-by: Luciano Coelho <coelho@ti.com>
wlconf: print all the array elements

We were printing only the first element of arrays.  Now we print the
whole array as a comma separated list of hex values.

Signed-off-by: Luciano Coelho <coelho@ti.com>
wlconf: store and print the relative position of the elements

To make it easier to navigate through the binary configuration data,
store the relative position of each element inside the structures.

Signed-off-by: Luciano Coelho <coelho@ti.com>
wlconf: add get value command

With this command, the value of the specified field can be read.

Signed-off-by: Luciano Coelho <coelho@ti.com>
wlconf: add conf.h file with current structures

This should not be used in production, it is here just as an example
of the small changes that need to be done in the conf.h files in order
to get it to work with wlconf.

The two main things to keep in mind are: arrays with non-numerical
(ie. defines or enums) sizes are not supported; the priv part needs to
be manually included in the same file.

Signed-off-by: Luciano Coelho <coelho@ti.com>
wlconf: simplify usage printout

With so many options and commands, the usage description was getting
complicated.  Simplify it by referencing the OPTIONS and COMMANDS in
the header line.

Signed-off-by: Luciano Coelho <coelho@ti.com>
wlconf: add command to generate the binary struct file

In most cases we don't want to parse the entire source file everytime
we run the command.  So we can pre-parse it and write the results to a
binary file that can be used next times.  Add an option -G to parse
the header file and write the structure data into a binary.

Signed-off-by: Luciano Coelho <coelho@ti.com>
wlconf: read binary struct from file

Implement the code to read the structure from the specified binary
file.  If no source and no binary files are specified, use conf.bin in
the current directory as default.

Signed-off-by: Luciano Coelho <coelho@ti.com>
wlconf: split configuration binary into input and output

We need two configuration binaries, one to use as the input values and
one to write when any value is modified.  To make things clearer,
split the --configuration into --input-config and --output-config.

Signed-off-by: Luciano Coelho <coelho@ti.com>
wlconf: add command to set a value

Add a new --set command to modify a value and write the resulting
configuration to the output binary configuration file.  Also change
the short option for --source-struct from -s to -S to accomodate the
set command better.

Signed-off-by: Luciano Coelho <coelho@ti.com>
wlconf: add default struct and configuration binaries

It is rather cumbersome for the end-user to parse a source header file
and generate the structure binaries.  Add a default struct.bin file
with the correct structures for the current driver.

Also add a default configuration binary to be used when generating
modified ones, instead of reading it from the driver debugfs entry and
change the default input configuration binary accordingly.

Signed-off-by: Luciano Coelho <coelho@ti.com>