Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG UE
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenXG
OpenXG UE
Commits
243e44e9
Commit
243e44e9
authored
Feb 19, 2021
by
laurent
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add LOG_M() binary format
parent
1ea8cd15
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
51 additions
and
2 deletions
+51
-2
common/utils/LOG/log.c
common/utils/LOG/log.c
+32
-1
common/utils/LOG/log.h
common/utils/LOG/log.h
+19
-1
No files found.
common/utils/LOG/log.c
View file @
243e44e9
...
@@ -88,16 +88,19 @@ int write_file_matlab(const char *fname,
...
@@ -88,16 +88,19 @@ int write_file_matlab(const char *fname,
void
*
data
,
void
*
data
,
int
length
,
int
length
,
int
dec
,
int
dec
,
char
format
)
unsigned
int
format
)
{
{
FILE
*
fp
=
NULL
;
FILE
*
fp
=
NULL
;
int
i
;
int
i
;
AssertFatal
((
format
&~
MATLAB_RAW
)
<
16
,
""
);
if
(
data
==
NULL
)
if
(
data
==
NULL
)
return
-
1
;
return
-
1
;
//printf("Writing %d elements of type %d to %s\n",length,format,fname);
//printf("Writing %d elements of type %d to %s\n",length,format,fname);
if
(
format
==
10
||
format
==
11
||
format
==
12
||
format
==
13
||
format
==
14
)
{
if
(
format
==
10
||
format
==
11
||
format
==
12
||
format
==
13
||
format
==
14
)
{
fp
=
fopen
(
fname
,
"a+"
);
fp
=
fopen
(
fname
,
"a+"
);
}
else
if
(
format
!=
10
&&
format
!=
11
&&
format
!=
12
&&
format
!=
13
&&
format
!=
14
)
{
}
else
if
(
format
!=
10
&&
format
!=
11
&&
format
!=
12
&&
format
!=
13
&&
format
!=
14
)
{
...
@@ -109,6 +112,32 @@ int write_file_matlab(const char *fname,
...
@@ -109,6 +112,32 @@ int write_file_matlab(const char *fname,
return
(
-
1
);
return
(
-
1
);
}
}
if
(
(
format
&
MATLAB_RAW
)
==
MATLAB_RAW
)
{
int
sz
[
16
]
=
{
sizeof
(
short
),
2
*
sizeof
(
short
),
sizeof
(
int
),
2
*
sizeof
(
int
),
sizeof
(
char
),
2
*
sizeof
(
char
),
sizeof
(
long
long
),
sizeof
(
double
),
2
*
sizeof
(
double
),
sizeof
(
unsigned
char
),
sizeof
(
short
),
sizeof
(
short
),
sizeof
(
short
),
sizeof
(
short
),
sizeof
(
short
),
sizeof
(
short
)
};
int
eltSz
=
sz
[
format
&~
MATLAB_RAW
];
if
(
dec
==
1
)
fwrite
(
data
,
eltSz
,
length
,
fp
);
else
for
(
i
=
0
;
i
<
length
;
i
+=
dec
)
fwrite
(
data
+
i
*
eltSz
,
eltSz
,
1
,
fp
);
fclose
(
fp
);
return
(
0
);
}
if
(
format
!=
10
&&
format
!=
11
&&
format
!=
12
&&
format
!=
13
&&
format
!=
14
)
if
(
format
!=
10
&&
format
!=
11
&&
format
!=
12
&&
format
!=
13
&&
format
!=
14
)
fprintf
(
fp
,
"%s = ["
,
vname
);
fprintf
(
fp
,
"%s = ["
,
vname
);
...
@@ -214,6 +243,8 @@ int write_file_matlab(const char *fname,
...
@@ -214,6 +243,8 @@ int write_file_matlab(const char *fname,
case
12
:
// case eren for log2_maxh real unsigned 8 bit
case
12
:
// case eren for log2_maxh real unsigned 8 bit
fprintf
(
fp
,
"%d
\n
"
,((
unsigned
char
*
)
&
data
)[
0
]);
fprintf
(
fp
,
"%d
\n
"
,((
unsigned
char
*
)
&
data
)[
0
]);
break
;
break
;
default:
AssertFatal
(
false
,
"unknown dump format: %d
\n
"
,
format
);
}
}
if
(
format
!=
10
&&
format
!=
11
&&
format
!=
12
&&
format
!=
13
&&
format
!=
15
)
{
if
(
format
!=
10
&&
format
!=
11
&&
format
!=
12
&&
format
!=
13
&&
format
!=
15
)
{
...
...
common/utils/LOG/log.h
View file @
243e44e9
...
@@ -336,7 +336,25 @@ typedef struct {
...
@@ -336,7 +336,25 @@ typedef struct {
@param dec decimation level
@param dec decimation level
@param format data format (0 = real 16-bit, 1 = complex 16-bit,2 real 32-bit, 3 complex 32-bit,4 = real 8-bit, 5 = complex 8-bit)
@param format data format (0 = real 16-bit, 1 = complex 16-bit,2 real 32-bit, 3 complex 32-bit,4 = real 8-bit, 5 = complex 8-bit)
*/
*/
int32_t
write_file_matlab
(
const
char
*
fname
,
const
char
*
vname
,
void
*
data
,
int
length
,
int
dec
,
char
format
);
#define MATLAB_RAW (1<<31)
#define MATLAB_SHORT 0
#define MATLAB_CSHORT 1
#define MATLAB_INT 2
#define MATLAB_CINT 3
#define MATLAB_INT8 4
#define MATLAB_CINT8 5
#define MATLAB_LLONG 6
#define MATLAB_DOUBLE 7
#define MATLAB_CDOUBLE 8
#define MATLAB_UINT8 9
#define MATLEB_EREN1 10
#define MATLEB_EREN2 11
#define MATLEB_EREN3 12
#define MATLAB_CSHORT_BRACKET1 13
#define MATLAB_CSHORT_BRACKET2 14
#define MATLAB_CSHORT_BRACKET3 15
int32_t
write_file_matlab
(
const
char
*
fname
,
const
char
*
vname
,
void
*
data
,
int
length
,
int
dec
,
unsigned
int
format
);
/*----------------macro definitions for reading log configuration from the config module */
/*----------------macro definitions for reading log configuration from the config module */
#define CONFIG_STRING_LOG_PREFIX "log_config"
#define CONFIG_STRING_LOG_PREFIX "log_config"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment