Uncrustify.

This commit is contained in:
Maxim Salov 2014-01-04 17:27:24 -05:00 committed by Ian Martin
parent f576489c6e
commit 096ff72bd9
3 changed files with 118 additions and 119 deletions

29
main.c
View File

@ -5,24 +5,24 @@ volatile unsigned char ticks = 0;
volatile unsigned char flag_1hz = 0;
__attribute__((interrupt))
void wdti_handler(void)
void
wdti_handler(void)
{
}
__attribute__((interrupt))
void it_handler(void)
void
it_handler(void)
{
++ticks;
LED1 ^= 1;
if (0 == (0x07 & ticks))
{
if(0 == (0x07 & ticks)) {
flag_1hz = 1;
}
}
int main(void)
int
main(void)
{
asm("di");
asm ("di");
/* Setup LEDs */
LED1 = 1;
LED2 = 1;
@ -34,8 +34,9 @@ int main(void)
CKC.ckc = 0x00U;
/* Delay 1 second */
register unsigned long int i;
for (i = 0x000FFFFFUL; i; --i)
asm("nop");
for(i = 0x000FFFFFUL; i; --i) {
asm ("nop");
}
OSMC.osmc = 0x00; /* Supply fsub to peripherals, including Interval Timer */
uart0_init();
/* Setup 12-bit interval timer */
@ -47,15 +48,13 @@ int main(void)
ITIF = 0; /* Clear interrupt request flag */
ITMK = 0; /* Enable IT interrupt */
asm ("ei"); /* Enable interrupts */
for(;;)
{
if (flag_1hz)
{
for(;;) {
if(flag_1hz) {
LED2 = 0;
flag_1hz = 0;
uart0_puts("Hello, RL78! [:");
LED2 = 1;
}
asm("halt");
asm ("halt");
}
}

32
uart0.c
View File

@ -2,7 +2,8 @@
#include <iodefine.h>
#include <iodefine_ext.h>
void uart0_init(void)
void
uart0_init(void)
{
/* Reference R01AN0459EJ0100 or hardware manual for details */
PIOR.pior = 0U; /* Disable IO redirection */
@ -71,46 +72,45 @@ void uart0_init(void)
SS0.ss0 |= 0x03U; /* Enable UART0 operation (both channels) */
STIF0 = 1; /* Set buffer empty interrupt request flag */
}
int uart0_puts(const char __far * s)
int
uart0_puts(const char __far *s)
{
int len = 0;
SMR00.smr00 |= 0x0001U; /* Set buffer empty interrupt */
while ('\0' != *s)
{
while (0 == STIF0);
while('\0' != *s) {
while(0 == STIF0) ;
STIF0 = 0;
SDR00.sdr00 = *s++;
++len;
}
#if 0
while (0 == STIF0);
while(0 == STIF0) ;
STIF0 = 0;
SDR00.sdr00 = '\r';
#endif
while (0 == STIF0);
while(0 == STIF0) ;
STIF0 = 0;
SMR00.smr00 &= ~0x0001U;
SDR00.sdr00 = '\n';
while (0 == STIF0);
while(0 == STIF0) ;
#if 0
while (0 != SSR00.BIT.bit6); /* Wait until TSF00 == 0 */
while(0 != SSR00.BIT.bit6) ; /* Wait until TSF00 == 0 */
#endif
return len;
}
__attribute__((interrupt))
void st0_handler(void)
void
st0_handler(void)
{
}
__attribute__((interrupt))
void sr0_handler(void)
void
sr0_handler(void)
{
}
/* This is actually INTSRE0 interrupt handler */
__attribute__((interrupt))
void tm01h_handler(void)
void
tm01h_handler(void)
{
}

View File

@ -2,6 +2,6 @@
#define UART0_H__
void uart0_init(void);
int uart0_puts(const char __far * s);
int uart0_puts(const char __far *s);
#endif // UART0_H__
#endif /* UART0_H__ */