Commit 01972b89 authored by Federico Vaga's avatar Federico Vaga

tools:vuart: add option to select big-endian

Signed-off-by: Federico Vaga's avatarFederico Vaga <federico.vaga@cern.ch>
parent fc7ab8d9
...@@ -121,12 +121,11 @@ struct mapping_desc *dev_map(struct mapping_args *map_args, uint32_t map_length) ...@@ -121,12 +121,11 @@ struct mapping_desc *dev_map(struct mapping_args *map_args, uint32_t map_length)
desc->base = desc->mmap + map_args->offset - pa_offset; desc->base = desc->mmap + map_args->offset - pa_offset;
/* /*
* @todo for future VME devices handled via a resource file, * @todo when WhiteRabbit will use a Byte-Order-Mask, use it to
* exposed in standard place (/sys/bus/vme/device/xxx/resource-file) * detect endianess automatically
* the bus type (pci or vme) should be checked to set properly
* the endianess (could be get from the path's resource)
*/ */
desc->is_be = 0; /* default set to little endian */ desc->is_be = map_args->is_be;
return desc; return desc;
out_mmap: out_mmap:
...@@ -284,7 +283,7 @@ struct mapping_args *dev_parse_mapping_args(int argc, char *argv[]) ...@@ -284,7 +283,7 @@ struct mapping_args *dev_parse_mapping_args(int argc, char *argv[])
return map_args; return map_args;
} }
#endif #endif
while ((c = getopt (argc, argv, "o:f:")) != -1) while ((c = getopt (argc, argv, "o:f:b")) != -1)
{ {
switch (c) switch (c)
{ {
...@@ -300,6 +299,9 @@ struct mapping_args *dev_parse_mapping_args(int argc, char *argv[]) ...@@ -300,6 +299,9 @@ struct mapping_args *dev_parse_mapping_args(int argc, char *argv[])
map_args->resource_file = optarg; map_args->resource_file = optarg;
++arg_count; ++arg_count;
break; break;
case 'b':
map_args->is_be = 1;
break;
case '?': case '?':
/* ignore unknown arguments */ /* ignore unknown arguments */
break; break;
...@@ -326,10 +328,11 @@ const char * const dev_mapping_help() ...@@ -326,10 +328,11 @@ const char * const dev_mapping_help()
{ {
static char help_msg[] = static char help_msg[] =
"Device mapping options: \n" "Device mapping options: \n"
"\t-f <file resource path> -o 0x<address offset>\n" "\t-f <file resource path> -o 0x<address offset> [-b]\n"
"Arguments:\n" "Arguments:\n"
"\t-t resource file to mmap\n" "\t-t resource file to mmap\n"
"\t-o memory offset from within the resource\n" "\t-o memory offset from within the resource\n"
"\t-b big endian access\n"
#ifdef SUPPORT_CERN_VMEBRIDGE #ifdef SUPPORT_CERN_VMEBRIDGE
"Device mapping options for CERN vmebus driver: \n" "Device mapping options for CERN vmebus driver: \n"
"\t--cern-vmebridge -a 0x<VME base address> \n" "\t--cern-vmebridge -a 0x<VME base address> \n"
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
struct mapping_args { struct mapping_args {
char *resource_file; char *resource_file;
uint64_t offset; uint64_t offset;
int is_be;
void *vme_extra_args; void *vme_extra_args;
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment