New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Realtek_RTL8195AM fix for debug profile #5044
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
-4 Bytes
(100%)
...TARGET_Realtek/TARGET_AMEBA/TARGET_RTL8195A/device/TOOLCHAIN_ARM_STD/lib_wlan_mbed_arm.ar
Binary file not shown.
31 changes: 31 additions & 0 deletions
31
...s/TARGET_Realtek/TARGET_AMEBA/TARGET_RTL8195A/device/TOOLCHAIN_ARM_STD/rtl8195a_startup.S
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
; | ||
; Copyright (c) 2017 Realtek Semiconductor Corp. | ||
; | ||
; Licensed under the Apache License, Version 2.0 (the "License"); | ||
; you may not use this file except in compliance with the License. | ||
; You may obtain a copy of the License at | ||
; | ||
; http://www.apache.org/licenses/LICENSE-2.0 | ||
; | ||
; Unless required by applicable law or agreed to in writing, software | ||
; distributed under the License is distributed on an "AS IS" BASIS, | ||
; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
; See the License for the specific language governing permissions and | ||
; limitations under the License. | ||
|
||
PRESERVE8 | ||
THUMB | ||
|
||
AREA |i.PLAT_Start|, CODE, READONLY | ||
|
||
PLAT_Start PROC | ||
|
||
EXPORT PLAT_Start | ||
IMPORT |Image$$ARM_LIB_STACK$$ZI$$Limit| | ||
IMPORT PLAT_Init | ||
LDR SP, =|Image$$ARM_LIB_STACK$$ZI$$Limit| | ||
LDR R0, =PLAT_Init | ||
BX R0 | ||
ENDP | ||
ALIGN | ||
END |
Binary file modified
BIN
+60 Bytes
(100%)
.../TARGET_Realtek/TARGET_AMEBA/TARGET_RTL8195A/device/TOOLCHAIN_GCC_ARM/lib_wlan_mbed_gcc.a
Binary file not shown.
32 changes: 32 additions & 0 deletions
32
...s/TARGET_Realtek/TARGET_AMEBA/TARGET_RTL8195A/device/TOOLCHAIN_GCC_ARM/rtl8195a_startup.S
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* | ||
* Copyright (c) 2017 Realtek Semiconductor Corp. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
.syntax unified | ||
.thumb | ||
|
||
.global __StackTop | ||
.global PLAT_Init | ||
|
||
/* entry point of application image */ | ||
.section .text.PLAT_Start | ||
.weak PLAT_Start | ||
.type PLAT_Start, %function | ||
PLAT_Start: | ||
ldr sp, =__StackTop | ||
ldr r0, =PLAT_Init | ||
bx r0 | ||
.size PLAT_Start, .-PLAT_Start | ||
.end |
Binary file modified
BIN
+8 Bytes
(100%)
targets/TARGET_Realtek/TARGET_AMEBA/TARGET_RTL8195A/device/TOOLCHAIN_IAR/lib_wlan_mbed_iar.a
Binary file not shown.
31 changes: 31 additions & 0 deletions
31
targets/TARGET_Realtek/TARGET_AMEBA/TARGET_RTL8195A/device/TOOLCHAIN_IAR/rtl8195a_startup.S
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
; | ||
; Copyright (c) 2017 Realtek Semiconductor Corp. | ||
; | ||
; Licensed under the Apache License, Version 2.0 (the "License"); | ||
; you may not use this file except in compliance with the License. | ||
; You may obtain a copy of the License at | ||
; | ||
; http://www.apache.org/licenses/LICENSE-2.0 | ||
; | ||
; Unless required by applicable law or agreed to in writing, software | ||
; distributed under the License is distributed on an "AS IS" BASIS, | ||
; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
; See the License for the specific language governing permissions and | ||
; limitations under the License. | ||
|
||
MODULE ?cstartup | ||
|
||
SECTION .text:CODE:NOROOT:REORDER(2) | ||
EXTERN CSTACK$$Limit | ||
EXTERN PLAT_Init | ||
|
||
; Default image 2 entry | ||
THUMB | ||
PUBWEAK PLAT_Start | ||
|
||
PLAT_Start | ||
LDR SP, =CSTACK$$Limit | ||
LDR R0, =PLAT_Init | ||
BX R0 | ||
|
||
END |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,24 +23,33 @@ | |
#define SYS_TIM_ID 1 // the G-Timer ID for System | ||
#define APP_TIM_ID 6 // the G-Timer ID for Application | ||
|
||
#define TICK_TO_US(x) (uint64_t)(((x)/2) * 61 + ((x)%2) * TIMER_TICK_US) | ||
|
||
static int us_ticker_inited = 0; | ||
static TIMER_ADAPTER TimerAdapter; | ||
|
||
extern HAL_TIMER_OP HalTimerOp; | ||
extern HAL_TIMER_OP_EXT HalTimerOpExt; | ||
|
||
VOID _us_ticker_irq_handler(IN VOID *Data) | ||
VOID _us_ticker_irq_handler(void *Data) | ||
{ | ||
us_ticker_irq_handler(); | ||
HalTimerOp.HalTimerDis((u32)TimerAdapter.TimerId); | ||
} | ||
|
||
void us_ticker_init(void) | ||
{ | ||
|
||
if (us_ticker_inited) return; | ||
if (us_ticker_inited){ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. space required before '{' There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also fixed in #5143 |
||
return; | ||
} | ||
|
||
us_ticker_inited = 1; | ||
|
||
|
||
HalTimerOp.HalTimerDis(SYS_TIM_ID); | ||
HalTimerOpExt.HalTimerReLoad(SYS_TIM_ID, 0xFFFFFFFFUL); | ||
HalTimerOp.HalTimerEn(SYS_TIM_ID); | ||
|
||
// Initial a G-Timer | ||
TimerAdapter.IrqDis = 0; // Enable Irq @ initial | ||
TimerAdapter.IrqHandle.IrqFun = (IRQ_FUN) _us_ticker_irq_handler; | ||
|
@@ -52,50 +61,45 @@ void us_ticker_init(void) | |
TimerAdapter.TimerLoadValueUs = 0xFFFFFFFF; | ||
TimerAdapter.TimerMode = USER_DEFINED; | ||
|
||
HalTimerOp.HalTimerInit((VOID*) &TimerAdapter); | ||
HalTimerOp.HalTimerInit((void *) &TimerAdapter); | ||
|
||
DBG_TIMER_INFO("%s: Timer_Id=%d\n", __FUNCTION__, APP_TIM_ID); | ||
} | ||
|
||
uint32_t us_ticker_read() | ||
uint32_t us_ticker_read(void) | ||
{ | ||
uint32_t tick_cnt; | ||
uint32_t ticks_125ms; | ||
uint32_t ticks_remain; | ||
uint64_t us_tick; | ||
|
||
uint64_t tick_us; | ||
|
||
if (!us_ticker_inited) { | ||
us_ticker_init(); | ||
} | ||
|
||
tick_cnt = HalTimerOp.HalTimerReadCount(SYS_TIM_ID); | ||
tick_cnt = 0xffffffff - tick_cnt; // it's a down counter | ||
ticks_125ms = tick_cnt/(GTIMER_CLK_HZ/8); //use 125ms as a intermediate unit; | ||
ticks_remain = tick_cnt - (ticks_125ms*(GTIMER_CLK_HZ/8)); //calculate the remainder | ||
us_tick = ticks_125ms * 125000; //change unit to us, 125ms is 125000 us | ||
us_tick += (ticks_remain * 1000000)/GTIMER_CLK_HZ; //also use us as unit | ||
tick_us = TICK_TO_US(0xFFFFFFFFUL - tick_cnt); | ||
|
||
return ((uint32_t)us_tick); //return ticker value in micro-seconds (us) | ||
return ((uint32_t)tick_us); //return ticker value in micro-seconds (us) | ||
} | ||
|
||
void us_ticker_set_interrupt(timestamp_t timestamp) | ||
{ | ||
uint32_t cur_time_us; | ||
uint32_t time_dif; | ||
uint32_t time_cur; | ||
uint32_t time_cnt; | ||
|
||
HalTimerOp.HalTimerDis((u32)TimerAdapter.TimerId); | ||
cur_time_us = us_ticker_read(); | ||
if ((uint32_t)timestamp > cur_time_us) { | ||
time_dif = (uint32_t)timestamp - cur_time_us; | ||
time_cur = us_ticker_read(); | ||
if (timestamp > time_cur + TIMER_TICK_US) { | ||
time_cnt = timestamp - time_cur; | ||
} else { | ||
HalTimerOpExt.HalTimerReLoad((u32)TimerAdapter.TimerId, 0xffffffff); | ||
HalTimerOpExt.HalTimerIrqEn((u32)TimerAdapter.TimerId); | ||
HalTimerOp.HalTimerEn((u32)TimerAdapter.TimerId); | ||
NVIC_SetPendingIRQ(TIMER2_7_IRQ); | ||
us_ticker_fire_interrupt(); | ||
return; | ||
} | ||
|
||
TimerAdapter.TimerLoadValueUs = time_dif; | ||
HalTimerOpExt.HalTimerReLoad((u32)TimerAdapter.TimerId, time_dif / TIMER_TICK_US); | ||
HalTimerOpExt.HalTimerIrqEn((u32)TimerAdapter.TimerId); | ||
TimerAdapter.TimerLoadValueUs = time_cnt / TIMER_TICK_US; | ||
HalTimerOpExt.HalTimerReLoad((u32)TimerAdapter.TimerId, TimerAdapter.TimerLoadValueUs); | ||
HalTimerOp.HalTimerEn((u32)TimerAdapter.TimerId); | ||
|
||
} | ||
|
||
void us_ticker_fire_interrupt(void) | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An explanation of where '61' comes from would be useful here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@adbridge Clock source is 32K, therefore, us per tick is 30.5. The TICK_TO_US macro is basically: (tick / 2) * (30.5*2) + residue
This patch is basically broken. I have submitted another PR #5143 to address us ticker issue, and also added proper inline comment.