Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
NuttX RTOS
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
f4grx
NuttX RTOS
Commits
4c54db68
Commit
4c54db68
authored
9 years ago
by
Gregory Nutt
Browse files
Options
Downloads
Patches
Plain Diff
Implementment board_power_off() for the simulation platform.
parent
f2351449
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
ChangeLog
+2
-0
2 additions, 0 deletions
ChangeLog
arch/Kconfig
+1
-0
1 addition, 0 deletions
arch/Kconfig
arch/sim/src/up_head.c
+56
-1
56 additions, 1 deletion
arch/sim/src/up_head.c
with
59 additions
and
1 deletion
ChangeLog
+
2
−
0
View file @
4c54db68
...
...
@@ -10663,3 +10663,5 @@
* sched/sched/sched_waitpid.c: Implement WNOHANG for waitpid() only and
for the case of CONFIG_SCHED_HAVE_PARENT not selected. From Max
Neklyudov (2015-07-02).
* arch/sim/src/up_head.S: Implement board_power_off() for the simulation
platform (2015-07-04).
This diff is collapsed.
Click to expand it.
arch/Kconfig
+
1
−
0
View file @
4c54db68
...
...
@@ -54,6 +54,7 @@ config ARCH_SH
config ARCH_SIM
bool "Simulation"
select ARCH_HAVE_TICKLESS
select ARCH_HAVE_POWEROFF
---help---
Linux/Cywgin user-mode simulation.
...
...
This diff is collapsed.
Click to expand it.
arch/sim/src/up_head.c
+
56
−
1
View file @
4c54db68
...
...
@@ -47,6 +47,7 @@
#include
<nuttx/init.h>
#include
<nuttx/arch.h>
#include
<nuttx/board.h>
#include
<nuttx/power/pm.h>
/****************************************************************************
...
...
@@ -54,11 +55,20 @@
****************************************************************************/
static
jmp_buf
sim_abort
;
static
int
retcode
=
0
;
/****************************************************************************
* Global Functions
****************************************************************************/
/****************************************************************************
* Name: main
*
* Description:
* This is the main entry point into the simulation.
*
****************************************************************************/
int
main
(
int
argc
,
char
**
argv
,
char
**
envp
)
{
/* Power management should be initialized early in the (simulated) boot
...
...
@@ -75,16 +85,61 @@ int main(int argc, char **argv, char **envp)
{
os_start
();
}
return
0
;
return
retcode
;
}
/****************************************************************************
* Name: up_assert
*
* Description:
* Called to terminate the simulation abnormally in the event of a failed
* assertion.
*
****************************************************************************/
void
up_assert
(
const
uint8_t
*
filename
,
int
line
)
{
/* Show the location of the failed assertion */
fprintf
(
stderr
,
"Assertion failed at file:%s line: %d
\n
"
,
filename
,
line
);
/* Allow for any board/configuration specific crash information */
#ifdef CONFIG_BOARD_CRASHDUMP
board_crashdump
(
up_getsp
(),
g_readytorun
.
head
,
filename
,
line
);
#endif
/* Exit the simulation */
retcode
=
EXIT_FAILURE
;
longjmp
(
sim_abort
,
1
);
}
/****************************************************************************
* Name: board_power_off
*
* Description:
* Power off the board. This function may or may not be supported by a
* particular board architecture.
*
* Input Parameters:
* status - Status information provided with the power off event.
*
* Returned Value:
* If this function returns, then it was not possible to power-off the
* board due to some constraints. The return value int this case is a
* board-specific reason for the failure to shutdown.
*
****************************************************************************/
#ifdef CONFIG_BOARDCTL_POWEROFF
int
board_power_off
(
int
status
)
{
/* Save the return code and exit the simulation */
retcode
=
status
;
longjmp
(
sim_abort
,
1
);
}
#endif
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment