Skip to content
Snippets Groups Projects
Commit fb4c4275 authored by Niccolò Betto's avatar Niccolò Betto
Browse files

[USART] Call Miosix IRQ handlers instead of accessing driver implementation details

In order to reduce the number of patches we make to the Miosix kernel, we're moving to calling Miosix USART IRQ handlers instead of accessing static port objects directly, which would require marking them for external linkage.
With this commit we are dropping support for USART ports higher than 3 when using the Miosix USART driver. For higher port counts, the boardcore driver must be used.
parent 68c257bf
Branches
No related tags found
1 merge request!243[Miosix][sbs] Upgrade to Miosix 2.7 and move BSPs to Boardcore
......@@ -36,6 +36,11 @@
Boardcore::USART *ports[N_USART_PORTS];
#ifdef USART1
/**
* \internal interrupt routine for usart1 miosix implementation
*/
void usart1irqImpl();
/**
* \internal Interrupt routine for usart1 actual implementation.
*/
......@@ -43,12 +48,12 @@ void __attribute__((used)) usart1irqImplBoardcore()
{
Boardcore::USART *port_boardcore = ports[0];
if (port_boardcore)
{
port_boardcore->IRQhandleInterrupt();
}
else
{
miosix::STM32Serial *port = miosix::STM32Serial::ports[0];
if (port)
port->IRQhandleInterrupt();
usart1irqImpl();
}
}
......@@ -64,6 +69,11 @@ void __attribute__((naked, used)) USART1_IRQHandler()
#endif
#ifdef USART2
/**
* \internal interrupt routine for usart2 miosix implementation
*/
void usart2irqImpl();
/**
* \internal Interrupt routine for usart2 actual implementation.
*/
......@@ -71,12 +81,12 @@ void __attribute__((used)) usart2irqImplBoardcore()
{
Boardcore::USART *port_boardcore = ports[1];
if (port_boardcore)
{
port_boardcore->IRQhandleInterrupt();
}
else
{
miosix::STM32Serial *port = miosix::STM32Serial::ports[1];
if (port)
port->IRQhandleInterrupt();
usart2irqImpl();
}
}
......@@ -92,6 +102,11 @@ void __attribute__((naked, used)) USART2_IRQHandler()
#endif
#ifdef USART3
/**
* \internal interrupt routine for usart3 miosix implementation
*/
void usart3irqImpl();
/**
* \internal Interrupt routine for usart3 actual implementation.
*/
......@@ -99,12 +114,12 @@ void __attribute__((used)) usart3irqImplBoardcore()
{
Boardcore::USART *port_boardcore = ports[2];
if (port_boardcore)
{
port_boardcore->IRQhandleInterrupt();
}
else
{
miosix::STM32Serial *port = miosix::STM32Serial::ports[2];
if (port)
port->IRQhandleInterrupt();
usart3irqImpl();
}
}
......@@ -127,12 +142,8 @@ void __attribute__((used)) uart4irqImplBoardcore()
{
Boardcore::USART *port_boardcore = ports[3];
if (port_boardcore)
port_boardcore->IRQhandleInterrupt();
else
{
miosix::STM32Serial *port = miosix::STM32Serial::ports[3];
if (port)
port->IRQhandleInterrupt();
port_boardcore->IRQhandleInterrupt();
}
}
......@@ -155,12 +166,8 @@ void __attribute__((used)) uart5irqImplBoardcore()
{
Boardcore::USART *port_boardcore = ports[4];
if (port_boardcore)
port_boardcore->IRQhandleInterrupt();
else
{
miosix::STM32Serial *port = miosix::STM32Serial::ports[4];
if (port)
port->IRQhandleInterrupt();
port_boardcore->IRQhandleInterrupt();
}
}
......@@ -183,12 +190,8 @@ void __attribute__((used)) usart6irqImplBoardcore()
{
Boardcore::USART *port_boardcore = ports[5];
if (port_boardcore)
port_boardcore->IRQhandleInterrupt();
else
{
miosix::STM32Serial *port = miosix::STM32Serial::ports[5];
if (port)
port->IRQhandleInterrupt();
port_boardcore->IRQhandleInterrupt();
}
}
......@@ -211,12 +214,8 @@ void __attribute__((used)) uart7irqImplBoardcore()
{
Boardcore::USART *port_boardcore = ports[6];
if (port_boardcore)
port_boardcore->IRQhandleInterrupt();
else
{
miosix::STM32Serial *port = miosix::STM32Serial::ports[6];
if (port)
port->IRQhandleInterrupt();
port_boardcore->IRQhandleInterrupt();
}
}
......@@ -239,12 +238,8 @@ void __attribute__((used)) uart8irqImplBoardcore()
{
Boardcore::USART *port_boardcore = ports[7];
if (port_boardcore)
port_boardcore->IRQhandleInterrupt();
else
{
miosix::STM32Serial *port = miosix::STM32Serial::ports[7];
if (port)
port->IRQhandleInterrupt();
port_boardcore->IRQhandleInterrupt();
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment