Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
micropython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
micropython
Commits
2673374d
Commit
2673374d
authored
Aug 09, 2015
by
Daniel Campora
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cc3200: Refactor PRCM special user bits implementation.
parent
651c870d
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
36 additions
and
76 deletions
+36
-76
cc3200/bootmgr/main.c
cc3200/bootmgr/main.c
+2
-2
cc3200/hal/prcm.c
cc3200/hal/prcm.c
+18
-62
cc3200/hal/prcm.h
cc3200/hal/prcm.h
+10
-6
cc3200/misc/mperror.c
cc3200/misc/mperror.c
+1
-1
cc3200/mods/pybsleep.c
cc3200/mods/pybsleep.c
+1
-1
cc3200/mptask.c
cc3200/mptask.c
+4
-4
No files found.
cc3200/bootmgr/main.c
View file @
2673374d
...
...
@@ -171,7 +171,7 @@ static void bootmgr_board_init(void) {
mperror_init0
();
// clear the safe boot flag, since we can't trust its content after reset
PRCMClearS
afeBootRequest
(
);
PRCMClearS
pecialBit
(
PRCM_SAFE_BOOT_BIT
);
}
//*****************************************************************************
...
...
@@ -287,7 +287,7 @@ static void wait_for_safe_boot (sBootInfo_t *psBootInfo) {
// turn off the system led
MAP_GPIOPinWrite
(
MICROPY_SYS_LED_PORT
,
MICROPY_SYS_LED_PORT_PIN
,
0
);
// request a safe boot to the application
PRCM
RequestSafeBoot
(
);
PRCM
SetSpecialBit
(
PRCM_SAFE_BOOT_BIT
);
}
// deinit the safe boot pin
mperror_deinit_sfe_pin
();
...
...
cc3200/hal/prcm.c
View file @
2673374d
...
...
@@ -129,11 +129,12 @@
//*****************************************************************************
//
// Bit: 31 is used to indicate use of RTC. If set as '1', RTC feature is used.
// Bit: 30 is used to indicate that a safe boot should be performed
// bit: 29 is used to indicate that the last reset was caused by the WDT
// Bits: 28 to 26 are unused
// Bit: 30 is used to indicate that a safe boot should be performed.
// bit: 29 is used to indicate that the last reset was caused by the WDT.
// bit: 28 is used to indicate that the board is booting for the first time after being programmed in factory.
// Bits: 27 and 26 are unused.
// Bits: 25 to 16 are used to save millisecond part of RTC reference.
// Bits: 15 to 0 are being used for HW Changes / ECO
// Bits: 15 to 0 are being used for HW Changes / ECO
.
//
//*****************************************************************************
...
...
@@ -254,94 +255,49 @@ static const PRCM_PeriphRegs_t PRCM_PeriphRegsList[] =
//*****************************************************************************
//
//!
Requests a safe boo
t
//!
Set a special bi
t
//!
//! \return None.
//
//*****************************************************************************
void
PRCM
RequestSafeBoot
(
void
)
void
PRCM
SetSpecialBit
(
unsigned
char
bit
)
{
unsigned
int
uiRegValue
;
uiRegValue
=
MAP_PRCMHIBRegRead
(
RTC_MSEC_U32_REG_ADDR
)
|
(
1
<<
30
);
uiRegValue
=
MAP_PRCMHIBRegRead
(
RTC_MSEC_U32_REG_ADDR
)
|
(
1
<<
bit
);
PRCMHIBRegWrite
(
RTC_MSEC_U32_REG_ADDR
,
uiRegValue
);
}
//*****************************************************************************
//
//! Clear
the safe boot reques
t
//! Clear
a special bi
t
//!
//! \return None.
//
//*****************************************************************************
void
PRCMClearS
afeBootRequest
(
void
)
void
PRCMClearS
pecialBit
(
unsigned
char
bit
)
{
unsigned
int
uiRegValue
;
uiRegValue
=
MAP_PRCMHIBRegRead
(
RTC_MSEC_U32_REG_ADDR
)
&
(
~
(
1
<<
30
));
uiRegValue
=
MAP_PRCMHIBRegRead
(
RTC_MSEC_U32_REG_ADDR
)
&
(
~
(
1
<<
bit
));
PRCMHIBRegWrite
(
RTC_MSEC_U32_REG_ADDR
,
uiRegValue
);
}
//*****************************************************************************
//
//! Read
the safe boot request bit. This bit is cleared after reading.
//! Read
a special bit
//!
//! \return Value of the
safe boot
bit
//! \return Value of the bit
//
//*****************************************************************************
tBoolean
PRCM
IsSafeBootRequested
(
void
)
tBoolean
PRCM
GetSpecialBit
(
unsigned
char
bit
)
{
tBoolean
safeboot
=
(
MAP_PRCMHIBRegRead
(
RTC_MSEC_U32_REG_ADDR
)
&
(
1
<<
30
))
?
true
:
false
;
PRCMClearSafeBootRequest
();
return
safeboot
;
}
//*****************************************************************************
//
//! Signals that a WDT reset has occurred
//!
//! \return None.
//
//*****************************************************************************
void
PRCMSignalWDTReset
(
void
)
{
unsigned
int
uiRegValue
;
uiRegValue
=
MAP_PRCMHIBRegRead
(
RTC_MSEC_U32_REG_ADDR
)
|
(
1
<<
29
);
PRCMHIBRegWrite
(
RTC_MSEC_U32_REG_ADDR
,
uiRegValue
);
}
//*****************************************************************************
//
//! Clear the WDT reset signal
//!
//! \return None.
//
//*****************************************************************************
void
PRCMClearWDTResetSignal
(
void
)
{
unsigned
int
uiRegValue
;
uiRegValue
=
MAP_PRCMHIBRegRead
(
RTC_MSEC_U32_REG_ADDR
)
&
(
~
(
1
<<
29
));
PRCMHIBRegWrite
(
RTC_MSEC_U32_REG_ADDR
,
uiRegValue
);
}
//*****************************************************************************
//
//! Read the WDT reset signal bit
//!
//! \return Value of the WDT reset signal bit
//
//*****************************************************************************
tBoolean
PRCMWasResetBecauseOfWDT
(
void
)
{
return
(
MAP_PRCMHIBRegRead
(
RTC_MSEC_U32_REG_ADDR
)
&
(
1
<<
29
))
?
true
:
false
;
tBoolean
value
=
(
MAP_PRCMHIBRegRead
(
RTC_MSEC_U32_REG_ADDR
)
&
(
1
<<
bit
))
?
true
:
false
;
// special bits must be cleared immediatelly after reading
PRCMClearSpecialBit
(
bit
);
return
value
;
}
//*****************************************************************************
...
...
cc3200/hal/prcm.h
View file @
2673374d
...
...
@@ -192,17 +192,21 @@ unsigned char ulRstReg;
// PRCM_ADC should never be used in any user code.
#define PRCM_ADC 0x000000FF
//*****************************************************************************
// User bits in the PRCM persistent registers
//*****************************************************************************
#define PRCM_SAFE_BOOT_BIT 30
#define PRCM_WDT_RESET_BIT 29
#define PRCM_FIRST_BOOT_BIT 28
//*****************************************************************************
//
// API Function prototypes
//
//*****************************************************************************
extern
void
PRCMRequestSafeBoot
(
void
);
extern
void
PRCMClearSafeBootRequest
(
void
);
extern
tBoolean
PRCMIsSafeBootRequested
(
void
);
extern
void
PRCMSignalWDTReset
(
void
);
extern
void
PRCMClearWDTResetSignal
(
void
);
extern
tBoolean
PRCMWasResetBecauseOfWDT
(
void
);
extern
void
PRCMSetSpecialBit
(
unsigned
char
bit
);
extern
void
PRCMClearSpecialBit
(
unsigned
char
bit
);
extern
tBoolean
PRCMGetSpecialBit
(
unsigned
char
bit
);
extern
void
PRCMSOCReset
(
void
);
extern
void
PRCMMCUReset
(
tBoolean
bIncludeSubsystem
);
extern
unsigned
long
PRCMSysResetCauseGet
(
void
);
...
...
cc3200/misc/mperror.c
View file @
2673374d
...
...
@@ -115,7 +115,7 @@ void mperror_bootloader_check_reset_cause (void) {
// since the reset cause will be changed, we must store the right reason
// so that the application knows it when booting for the next time
PRCMS
ignalWDTReset
(
);
PRCMS
etSpecialBit
(
PRCM_WDT_RESET_BIT
);
MAP_PRCMHibernateWakeupSourceEnable
(
PRCM_HIB_SLOW_CLK_CTR
);
// set the sleep interval to 10ms
...
...
cc3200/mods/pybsleep.c
View file @
2673374d
...
...
@@ -178,7 +178,7 @@ void pybsleep_init0 (void) {
pybsleep_reset_cause
=
PYB_SLP_WDT_RESET
;
break
;
case
PRCM_HIB_EXIT
:
if
(
PRCM
WasResetBecauseOfWDT
(
))
{
if
(
PRCM
GetSpecialBit
(
PRCM_WDT_RESET_BIT
))
{
pybsleep_reset_cause
=
PYB_SLP_WDT_RESET
;
}
else
{
...
...
cc3200/mptask.c
View file @
2673374d
...
...
@@ -105,7 +105,10 @@ void TASK_Micropython (void *pvParameters) {
// initialize the garbage collector with the top of our stack
uint32_t
sp
=
gc_helper_get_sp
();
gc_collect_init
(
sp
);
bool
safeboot
=
false
;
#ifndef DEBUG
bool
safeboot
=
PRCMGetSpecialBit
(
PRCM_SAFE_BOOT_BIT
);
#endif
mptask_pre_init
();
...
...
@@ -161,9 +164,6 @@ soft_reset:
else
{
// only if not comming out of hibernate or a soft reset
mptask_enter_ap_mode
();
#ifndef DEBUG
safeboot
=
PRCMIsSafeBootRequested
();
#endif
}
// enable telnet and ftp
...
...
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