Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
DIOT Zynq Ultrascale-based System Board
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
41
Issues
41
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Projects
DIOT Zynq Ultrascale-based System Board
Commits
5730641a
Commit
5730641a
authored
Jul 18, 2022
by
Alén Arias Vázquez
😎
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
create another way to add functions
parent
f6296713
Pipeline
#3825
canceled with stages
in 1 minute and 46 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
52 additions
and
48 deletions
+52
-48
fpga_device.c
...spec/meta-user/recipes-apps/diot-util/files/fpga_device.c
+52
-48
No files found.
sw/petalinux/project-spec/meta-user/recipes-apps/diot-util/files/fpga_device.c
View file @
5730641a
...
...
@@ -10,60 +10,17 @@
/***************************** Include Files **********************************/
#include "fpga_device.h"
/************************** Functions Prototype *******************************/
static
int
cmd_fpga_status
(
char
*
params
);
/******************************** Structs *************************************/
struct
command_entry
commands_list_fpga_device
[]
=
{
{
.
cmd_name
=
"status"
,
.
cmd_func
=
cmd_fpga_status
,
.
cmd_help_string
=
"Get all the information about FPGA convention
\n
"
,
.
cmd_params
=
"<all>"
}
};
/******************************* Functions ************************************/
/******************************************************************************/
/**
* This function seach for subcommands related with FPGA information
*
******************************************************************************/
static
void
cmd_fpga
(
char
*
params
)
{
struct
command_entry
*
entry
;
char
*
cmd_start_p
=
params
;
int
ret
;
int
cmd_len
;
if
(
!
params
||
!
(
*
params
))
{
printf
(
"Please provide subcommand for the Gateware command
\n
"
);
cmd_help
(
"gateware"
);
return
-
ENOENT
;
}
params
=
strchr
(
params
,
' '
);
if
(
params
)
{
cmd_len
=
params
-
cmd_start_p
;
/* skip spaces for params */
while
(
*
params
&&
(
*
params
==
' '
))
{
params
++
;
}
}
else
{
cmd_len
=
strlen
(
cmd_start_p
);
}
entry
=
commands_list_fpga_device
;
while
(
entry
&&
entry
->
cmd_name
)
{
if
(
cmd_len
==
strlen
(
entry
->
cmd_name
)
&&
!
strncmp
(
entry
->
cmd_name
,
cmd_start_p
,
cmd_len
))
{
ret
=
entry
->
cmd_func
(
params
);
break
;
}
entry
++
;
}
if
(
!
(
entry
&&
entry
->
cmd_name
))
{
printf
(
"Commad
\"
%s
\"
not found
\n
"
,
cmd_start_p
);
ret
=
-
ENOENT
;
}
return
ret
;
}
static
void
cmd_fpga_status
(
char
*
params
)
{
static
int
cmd_fpga_status
(
char
*
params
)
{
/*{
struct tm build_date_s;
...
...
@@ -124,5 +81,52 @@ static void cmd_fpga_status(char *params) {
return;
*/
printf
(
"FPGA STATUS TO BE DONE"
);
return
;
return
0
;
}
/******************************************************************************/
/**
* This function seach for subcommands related with FPGA information
*
******************************************************************************/
int
cmd_fpga
(
char
*
params
)
{
struct
command_entry
*
entry
;
char
*
cmd_start_p
=
params
;
int
ret
;
int
cmd_len
;
if
(
!
params
||
!
(
*
params
))
{
printf
(
"Please provide subcommand for the Gateware command
\n
"
);
cmd_help
(
"gateware"
);
return
-
ENOENT
;
}
params
=
strchr
(
params
,
' '
);
if
(
params
)
{
cmd_len
=
params
-
cmd_start_p
;
/* skip spaces for params */
while
(
*
params
&&
(
*
params
==
' '
))
{
params
++
;
}
}
else
{
cmd_len
=
strlen
(
cmd_start_p
);
}
entry
=
commands_list_fpga_device
;
while
(
entry
&&
entry
->
cmd_name
)
{
if
(
cmd_len
==
strlen
(
entry
->
cmd_name
)
&&
!
strncmp
(
entry
->
cmd_name
,
cmd_start_p
,
cmd_len
))
{
ret
=
entry
->
cmd_func
(
params
);
break
;
}
entry
++
;
}
if
(
!
(
entry
&&
entry
->
cmd_name
))
{
printf
(
"Commad
\"
%s
\"
not found
\n
"
,
cmd_start_p
);
ret
=
-
ENOENT
;
}
return
0
;
}
\ No newline at end of file
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