Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
uPython-mirror
Commits
ed20ac56
Commit
ed20ac56
authored
Mar 16, 2015
by
danicampora
Browse files
cc3200: Fix bug in RTC msec register access functions.
parent
5dd8ae6b
Changes
2
Hide whitespace changes
Inline
Side-by-side
cc3200/hal/prcm.c
View file @
ed20ac56
...
...
@@ -142,11 +142,11 @@
//*****************************************************************************
static
void
RTCUseSet
(
void
)
{
unsigned
shor
t
u
s
RegValue
;
unsigned
in
t
u
i
RegValue
;
u
s
RegValue
=
MAP_PRCMHIBRegRead
(
RTC_MSEC_U32_REG_ADDR
)
|
(
1
<<
31
);
u
i
RegValue
=
MAP_PRCMHIBRegRead
(
RTC_MSEC_U32_REG_ADDR
)
|
(
1
<<
31
);
PRCMHIBRegWrite
(
RTC_MSEC_U32_REG_ADDR
,
u
s
RegValue
);
PRCMHIBRegWrite
(
RTC_MSEC_U32_REG_ADDR
,
u
i
RegValue
);
}
//*****************************************************************************
...
...
@@ -154,11 +154,11 @@ static void RTCUseSet(void)
//*****************************************************************************
static
void
RTCUseClear
(
void
)
{
unsigned
shor
t
u
s
RegValue
;
unsigned
in
t
u
i
RegValue
;
u
s
RegValue
=
MAP_PRCMHIBRegRead
(
RTC_MSEC_U32_REG_ADDR
)
&
(
~
(
1
<<
31
));
u
i
RegValue
=
MAP_PRCMHIBRegRead
(
RTC_MSEC_U32_REG_ADDR
)
&
(
~
(
1
<<
31
));
PRCMHIBRegWrite
(
RTC_MSEC_U32_REG_ADDR
,
u
s
RegValue
);
PRCMHIBRegWrite
(
RTC_MSEC_U32_REG_ADDR
,
u
i
RegValue
);
}
//*****************************************************************************
...
...
@@ -172,7 +172,7 @@ static tBoolean IsRTCUsed(void)
//*****************************************************************************
// Read 16-bit mSecs
//*****************************************************************************
static
unsigned
short
RTCU
16
MSecRegRead
(
void
)
static
unsigned
short
RTCU
32
MSecRegRead
(
void
)
{
return
((
MAP_PRCMHIBRegRead
(
RTC_MSEC_U32_REG_ADDR
)
>>
16
)
&
0x03FF
);
}
...
...
@@ -180,15 +180,15 @@ static unsigned short RTCU16MSecRegRead(void)
//*****************************************************************************
// Write 16-bit mSecs
//*****************************************************************************
static
void
RTCU
16
MSecRegWrite
(
unsigned
shor
t
u
16
Msec
)
static
void
RTCU
32
MSecRegWrite
(
unsigned
in
t
u
32
Msec
)
{
unsigned
shor
t
u
s
RegValue
;
unsigned
in
t
u
i
RegValue
;
// read the whole register and clear the msec bits
u
s
RegValue
=
MAP_PRCMHIBRegRead
(
RTC_MSEC_U32_REG_ADDR
)
&
(
~
(
0x03FF
<<
16
));
u
i
RegValue
=
MAP_PRCMHIBRegRead
(
RTC_MSEC_U32_REG_ADDR
)
&
(
~
(
0x03FF
<<
16
));
// write the msec bits only
MAP_PRCMHIBRegWrite
(
RTC_MSEC_U32_REG_ADDR
,
u
s
RegValue
|
((
u
16
Msec
&
0x03FF
)
<<
16
));
MAP_PRCMHIBRegWrite
(
RTC_MSEC_U32_REG_ADDR
,
u
i
RegValue
|
((
u
32
Msec
&
0x03FF
)
<<
16
));
}
//*****************************************************************************
...
...
@@ -214,8 +214,8 @@ static void RTCU32SecRegWrite(unsigned long u32Msec)
#define RTC_USE_SET() RTCUseSet()
#define RTC_USE_CLR() RTCUseClear()
#define RTC_U
16
MSEC_REG_RD() RTCU
16
MSecRegRead()
#define RTC_U
16
MSEC_REG_WR(u
16
Msec) RTCU
16
MSecRegWrite(u
16
Msec)
#define RTC_U
32
MSEC_REG_RD() RTCU
32
MSecRegRead()
#define RTC_U
32
MSEC_REG_WR(u
32
Msec) RTCU
32
MSecRegWrite(u
32
Msec)
#define RTC_U32SECS_REG_RD() RTCU32SecRegRead()
#define RTC_U32SECS_REG_WR(u32Secs) RTCU32SecRegWrite(u32Secs)
...
...
@@ -261,11 +261,11 @@ static const PRCM_PeriphRegs_t PRCM_PeriphRegsList[] =
//*****************************************************************************
void
PRCMRequestSafeBoot
(
void
)
{
unsigned
shor
t
u
s
RegValue
;
unsigned
in
t
u
i
RegValue
;
u
s
RegValue
=
MAP_PRCMHIBRegRead
(
RTC_MSEC_U32_REG_ADDR
)
|
(
1
<<
30
);
u
i
RegValue
=
MAP_PRCMHIBRegRead
(
RTC_MSEC_U32_REG_ADDR
)
|
(
1
<<
30
);
PRCMHIBRegWrite
(
RTC_MSEC_U32_REG_ADDR
,
u
s
RegValue
);
PRCMHIBRegWrite
(
RTC_MSEC_U32_REG_ADDR
,
u
i
RegValue
);
}
//*****************************************************************************
...
...
@@ -277,11 +277,11 @@ void PRCMRequestSafeBoot(void)
//*****************************************************************************
void
PRCMClearSafeBootRequest
(
void
)
{
unsigned
shor
t
u
s
RegValue
;
unsigned
in
t
u
i
RegValue
;
u
s
RegValue
=
MAP_PRCMHIBRegRead
(
RTC_MSEC_U32_REG_ADDR
)
&
(
~
(
1
<<
30
));
u
i
RegValue
=
MAP_PRCMHIBRegRead
(
RTC_MSEC_U32_REG_ADDR
)
&
(
~
(
1
<<
30
));
PRCMHIBRegWrite
(
RTC_MSEC_U32_REG_ADDR
,
u
s
RegValue
);
PRCMHIBRegWrite
(
RTC_MSEC_U32_REG_ADDR
,
u
i
RegValue
);
}
//*****************************************************************************
...
...
@@ -293,7 +293,7 @@ void PRCMClearSafeBootRequest(void)
//*****************************************************************************
tBoolean
PRCMIsSafeBootRequested
(
void
)
{
tBoolean
safeboot
=
(
MAP_PRCMHIBRegRead
(
RTC_MSEC_U32_REG_ADDR
)
&
(
1
<<
30
))
?
true
:
false
;
tBoolean
safeboot
=
(
MAP_PRCMHIBRegRead
(
RTC_MSEC_U32_REG_ADDR
)
&
(
1
<<
30
))
?
true
:
false
;
PRCMClearSafeBootRequest
();
...
...
@@ -309,11 +309,11 @@ tBoolean PRCMIsSafeBootRequested(void)
//*****************************************************************************
void
PRCMSignalWDTReset
(
void
)
{
unsigned
shor
t
u
s
RegValue
;
unsigned
in
t
u
i
RegValue
;
u
s
RegValue
=
MAP_PRCMHIBRegRead
(
RTC_MSEC_U32_REG_ADDR
)
|
(
1
<<
29
);
u
i
RegValue
=
MAP_PRCMHIBRegRead
(
RTC_MSEC_U32_REG_ADDR
)
|
(
1
<<
29
);
PRCMHIBRegWrite
(
RTC_MSEC_U32_REG_ADDR
,
u
s
RegValue
);
PRCMHIBRegWrite
(
RTC_MSEC_U32_REG_ADDR
,
u
i
RegValue
);
}
//*****************************************************************************
...
...
@@ -325,11 +325,11 @@ void PRCMSignalWDTReset(void)
//*****************************************************************************
void
PRCMClearWDTResetSignal
(
void
)
{
unsigned
shor
t
u
s
RegValue
;
unsigned
in
t
u
i
RegValue
;
u
s
RegValue
=
MAP_PRCMHIBRegRead
(
RTC_MSEC_U32_REG_ADDR
)
&
(
~
(
1
<<
29
));
u
i
RegValue
=
MAP_PRCMHIBRegRead
(
RTC_MSEC_U32_REG_ADDR
)
&
(
~
(
1
<<
29
));
PRCMHIBRegWrite
(
RTC_MSEC_U32_REG_ADDR
,
u
s
RegValue
);
PRCMHIBRegWrite
(
RTC_MSEC_U32_REG_ADDR
,
u
i
RegValue
);
}
//*****************************************************************************
...
...
@@ -1598,7 +1598,7 @@ void PRCMRTCSet(unsigned long ulSecs, unsigned short usMsec)
ullMsec
=
RTC_U64MSEC_MK
(
ulSecs
,
usMsec
)
-
SCC_U64MSEC_GET
();
RTC_U32SECS_REG_WR
(
RTC_SECS_IN_U64MSEC
(
ullMsec
));
RTC_U
16
MSEC_REG_WR
(
RTC_MSEC_IN_U64MSEC
(
ullMsec
));
RTC_U
32
MSEC_REG_WR
(
RTC_MSEC_IN_U64MSEC
(
ullMsec
));
}
return
;
...
...
@@ -1629,7 +1629,7 @@ void PRCMRTCGet(unsigned long *ulSecs, unsigned short *usMsec)
if
(
IS_RTC_USED
())
{
ullMsec
=
RTC_U64MSEC_MK
(
RTC_U32SECS_REG_RD
(),
RTC_U
16
MSEC_REG_RD
());
RTC_U
32
MSEC_REG_RD
());
ullMsec
+=
SCC_U64MSEC_GET
();
}
...
...
@@ -1665,7 +1665,7 @@ void PRCMRTCMatchSet(unsigned long ulSecs, unsigned short usMsec)
if
(
IS_RTC_USED
())
{
ullMsec
=
RTC_U64MSEC_MK
(
ulSecs
,
usMsec
);
ullMsec
-=
RTC_U64MSEC_MK
(
RTC_U32SECS_REG_RD
(),
RTC_U
16
MSEC_REG_RD
());
RTC_U
32
MSEC_REG_RD
());
SCC_U64MSEC_MATCH_SET
(
SELECT_SCC_U42BITS
(
ullMsec
));
}
...
...
@@ -1698,7 +1698,7 @@ void PRCMRTCMatchGet(unsigned long *ulSecs, unsigned short *usMsec)
if
(
IS_RTC_USED
())
{
ullMsec
=
SCC_U64MSEC_MATCH_GET
();
ullMsec
+=
RTC_U64MSEC_MK
(
RTC_U32SECS_REG_RD
(),
RTC_U
16
MSEC_REG_RD
());
RTC_U
32
MSEC_REG_RD
());
}
*
ulSecs
=
RTC_SECS_IN_U64MSEC
(
ullMsec
);
...
...
cc3200/mods/pybrtc.c
View file @
ed20ac56
...
...
@@ -113,7 +113,7 @@ STATIC void pyb_rtc_callback_disable (mp_obj_t self_in) {
///
/// (year, month, day, weekday, hours, minutes, seconds, milliseconds)
///
/// `weekday` is
1-7
for Monday through Sunday.
/// `weekday` is
0-6
for Monday through Sunday.
///
mp_obj_t
pyb_rtc_datetime
(
mp_uint_t
n_args
,
const
mp_obj_t
*
args
)
{
mod_struct_time
tm
;
...
...
Write
Preview
Supports
Markdown
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