More coding-style and cosmetic fixes.
This commit is contained in:
@@ -55,10 +55,11 @@ SECTIONS
|
||||
* You may need to fix this if you're using C++.
|
||||
*/
|
||||
/DISCARD/ : { *(.eh_frame) }
|
||||
/*
|
||||
* Another section used by C++ stuff, appears when using newlib with 64bit
|
||||
* (long long) printf support - discard it for now.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Another section used by C++ stuff, appears when using newlib with
|
||||
* 64bit (long long) printf support - discard it for now.
|
||||
*/
|
||||
/DISCARD/ : { *(.ARM.exidx) }
|
||||
|
||||
end = .;
|
||||
|
||||
@@ -55,10 +55,11 @@ SECTIONS
|
||||
* You may need to fix this if you're using C++.
|
||||
*/
|
||||
/DISCARD/ : { *(.eh_frame) }
|
||||
/*
|
||||
* Another section used by C++ stuff, appears when using newlib with 64bit
|
||||
* (long long) printf support - discard it for now.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Another section used by C++ stuff, appears when using newlib with
|
||||
* 64bit (long long) printf support - discard it for now.
|
||||
*/
|
||||
/DISCARD/ : { *(.ARM.exidx) }
|
||||
|
||||
end = .;
|
||||
|
||||
@@ -59,10 +59,11 @@ SECTIONS
|
||||
* You may need to fix this if you're using C++.
|
||||
*/
|
||||
/DISCARD/ : { *(.eh_frame) }
|
||||
/*
|
||||
* Another section used by C++ stuff, appears when using newlib with 64bit
|
||||
* (long long) printf support - discard it for now.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Another section used by C++ stuff, appears when using newlib with
|
||||
* 64bit (long long) printf support - discard it for now.
|
||||
*/
|
||||
/DISCARD/ : { *(.ARM.exidx) }
|
||||
|
||||
. = ALIGN(4);
|
||||
|
||||
@@ -59,10 +59,11 @@ SECTIONS
|
||||
* You may need to fix this if you're using C++.
|
||||
*/
|
||||
/DISCARD/ : { *(.eh_frame) }
|
||||
/*
|
||||
* Another section used by C++ stuff, appears when using newlib with 64bit
|
||||
* (long long) printf support - discard it for now.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Another section used by C++ stuff, appears when using newlib with
|
||||
* 64bit (long long) printf support - discard it for now.
|
||||
*/
|
||||
/DISCARD/ : { *(.ARM.exidx) }
|
||||
|
||||
. = ALIGN(4);
|
||||
|
||||
@@ -59,10 +59,11 @@ SECTIONS
|
||||
* You may need to fix this if you're using C++.
|
||||
*/
|
||||
/DISCARD/ : { *(.eh_frame) }
|
||||
/*
|
||||
* Another section used by C++ stuff, appears when using newlib with 64bit
|
||||
* (long long) printf support - discard it for now.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Another section used by C++ stuff, appears when using newlib with
|
||||
* 64bit (long long) printf support - discard it for now.
|
||||
*/
|
||||
/DISCARD/ : { *(.ARM.exidx) }
|
||||
|
||||
. = ALIGN(4);
|
||||
|
||||
@@ -22,37 +22,37 @@
|
||||
|
||||
void nvic_enable_irq(u8 irqn)
|
||||
{
|
||||
NVIC_ISER(irqn / 32) = (1 << (irqn % 32));
|
||||
NVIC_ISER(irqn / 32) = (1 << (irqn % 32));
|
||||
}
|
||||
|
||||
void nvic_disable_irq(u8 irqn)
|
||||
{
|
||||
NVIC_ICER(irqn / 32) = (1 << (irqn % 32));
|
||||
NVIC_ICER(irqn / 32) = (1 << (irqn % 32));
|
||||
}
|
||||
|
||||
u8 nvic_get_pending_irq(u8 irqn)
|
||||
{
|
||||
return NVIC_ISPR(irqn / 32) & (1 << (irqn % 32)) ? 1:0;
|
||||
return NVIC_ISPR(irqn / 32) & (1 << (irqn % 32)) ? 1 : 0;
|
||||
}
|
||||
|
||||
void nvic_set_pending_irq(u8 irqn)
|
||||
{
|
||||
NVIC_ISPR(irqn / 32) = (1 << (irqn % 32));
|
||||
NVIC_ISPR(irqn / 32) = (1 << (irqn % 32));
|
||||
}
|
||||
|
||||
void nvic_clear_pending_irq(u8 irqn)
|
||||
{
|
||||
NVIC_ICPR(irqn / 32) = (1 << (irqn % 32));
|
||||
NVIC_ICPR(irqn / 32) = (1 << (irqn % 32));
|
||||
}
|
||||
|
||||
u8 nvic_get_active_irq(u8 irqn)
|
||||
{
|
||||
return NVIC_IABR(irqn / 32) & (1 << (irqn % 32)) ? 1:0;
|
||||
return NVIC_IABR(irqn / 32) & (1 << (irqn % 32)) ? 1 : 0;
|
||||
}
|
||||
|
||||
u8 nvic_get_irq_enabled(u8 irqn)
|
||||
{
|
||||
return NVIC_ISER(irqn / 32) & (1 << (irqn % 32)) ? 1:0;
|
||||
return NVIC_ISER(irqn / 32) & (1 << (irqn % 32)) ? 1 : 0;
|
||||
}
|
||||
|
||||
void nvic_set_priority(u8 irqn, u8 priority)
|
||||
|
||||
@@ -47,15 +47,16 @@ void usart_set_baudrate(u32 usart, u32 baud)
|
||||
#endif
|
||||
*/
|
||||
|
||||
/* yes it is as simple as that. The reference manual is
|
||||
* talking about factional calculation but it seems to be only
|
||||
* marketting bable to sound awesome. It is nothing else but a
|
||||
* simple divider to generate the correct baudrate. >_< If I
|
||||
* am wrong feel free to correct me on that. :) (esden)
|
||||
*
|
||||
* Changed to round rather than floor (Fergus)
|
||||
/*
|
||||
* Yes it is as simple as that. The reference manual is
|
||||
* talking about fractional calculation but it seems to be only
|
||||
* marketting babble to sound awesome. It is nothing else but a
|
||||
* simple divider to generate the correct baudrate.
|
||||
*
|
||||
* Note: We round() the value rather than floor()ing it, for more
|
||||
* accurate divisor selection.
|
||||
*/
|
||||
USART_BRR(usart) = (2*clock + baud) / (2*baud);
|
||||
USART_BRR(usart) = ((2 * clock) + baud) / (2 * baud);
|
||||
}
|
||||
|
||||
void usart_set_databits(u32 usart, u32 bits)
|
||||
@@ -151,21 +152,20 @@ u16 usart_recv_blocking(u32 usart)
|
||||
|
||||
void usart_enable_rx_dma(u32 usart)
|
||||
{
|
||||
USART_CR3(usart) |= USART_CR3_DMAR;
|
||||
USART_CR3(usart) |= USART_CR3_DMAR;
|
||||
}
|
||||
|
||||
void usart_disable_rx_dma(u32 usart)
|
||||
{
|
||||
USART_CR3(usart) &= ~USART_CR3_DMAR;
|
||||
USART_CR3(usart) &= ~USART_CR3_DMAR;
|
||||
}
|
||||
|
||||
void usart_enable_tx_dma(u32 usart)
|
||||
{
|
||||
USART_CR3(usart) |= USART_CR3_DMAT;
|
||||
USART_CR3(usart) |= USART_CR3_DMAT;
|
||||
}
|
||||
|
||||
void usart_disable_tx_dma(u32 usart)
|
||||
{
|
||||
USART_CR3(usart) &= ~USART_CR3_DMAT;
|
||||
USART_CR3(usart) &= ~USART_CR3_DMAT;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user