Skip to content

RTL8195AM - fix us_ticker_fire_interrupt and us_ticker_clear_interrupt #5418

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

Closed
wants to merge 1 commit into from

Conversation

tung7970
Copy link
Contributor

@tung7970 tung7970 commented Nov 2, 2017

Description

TIMER2_7_IRQ is shared among several timer sources, including
us_ticker. Raising TIMER2_7_IRQ pending bit will trigger the timer
interrupt, but the timer interrupt handler will not know which timer
source this interrupt is for. This patch sets timer load value to one
tick and force us_ticker to fire almost "immediately".

TIMER2_7_IRQ is handled through a common interrupt handler, and
is automatically cleared. Therefore, there is no need to clear IRQ.

The underlying timer HAL treats load value as micro-seconds and does
conversion internally. Therefore, simply pass micro-seconds to timer
HAL without converting to tick first.

Status

READY

Migrations

NO

Related PRs

NONE

Todos

NONE

Deploy notes

NONE

Steps to test or reproduce

NONE

TIMER2_7_IRQ is shared among several timer sources, including
us_ticker. Raising TIMER2_7_IRQ pending bit will trigger the timer
interrupt, but the timer interrupt handler will not know which timer
source this interrupt is for. This patch sets timer load value to one
tick and force us_ticker to fire almost "immediately".

TIMER2_7_IRQ is handled through a common interrupt handler, and
is automatically cleared. Therefore, there is no need to clear IRQ.

The underlying timer HAL treats load value as micro-seconds and does
conversion internally. Therefore, simply pass micro-seconds to timer
HAL without converting to tick first.

Signed-off-by: Tony Wu <[email protected]>
Copy link
Contributor

@0xc0170 0xc0170 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How was this tested, as we have fire ticker interrupt test case there.

@0xc0170
Copy link
Contributor

0xc0170 commented Nov 2, 2017

/morph build

@tung7970
Copy link
Contributor Author

tung7970 commented Nov 2, 2017

@0xc0170 I trigger timeout every 1 micro-second to force entering us_ticker_fire_interrupt() every timeout event. Without this patch, the timeout event is blocked.

`
#include "mbed.h"

Timer timer;
Timeout timeout;

static void timeout_update()
{
timeout.attach_us(timeout_update, 1);
printf("timeout triggered at %u\r\n", timer.read_ms());
}

int main(int argc, char **argv)
{
timer.start();
timeout.attach_us(timeout_update, 1);
while (1);
}
`

@mbed-ci
Copy link

mbed-ci commented Nov 3, 2017

Build : SUCCESS

Build number : 418
Build artifacts/logs : http://mbed-os.s3-website-eu-west-1.amazonaws.com/?prefix=builds/5418/

Triggering tests

/morph test
/morph uvisor-test

@mbed-ci
Copy link

mbed-ci commented Nov 3, 2017

@0xc0170
Copy link
Contributor

0xc0170 commented Nov 3, 2017

/morph uvisor-test

@theotherjimmy
Copy link
Contributor

uvisor CI actually failed on this one.

@0xc0170
Copy link
Contributor

0xc0170 commented Nov 7, 2017

/morph uvisor-test

@tung7970
Copy link
Contributor Author

tung7970 commented Nov 9, 2017

I am closing this PR. This patch is incorporated in Ameba's official PR#5464.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants