Add M16C serial driver

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@1509 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo 2009-02-17 02:43:47 +00:00
parent 84afa0acb5
commit 2c7e99fd96
5 changed files with 1223 additions and 21 deletions

View File

@ -43,10 +43,8 @@ CMN_CSRCS = up_allocateheap.c up_assert.c up_blocktask.c \
up_udelay.c up_unblocktask.c up_usestack.c
CHIP_ASRCS = m16c_vectors.S
#CHIP_CSRCS = m16c_initialstate.c m16c_copystate.c m16c_lowputc.c m16c_irq.c \
# m16c_timerisr.c m16c_serial.c m16c_dumpstate.c
CHIP_CSRCS = m16c_initialstate.c m16c_copystate.c m16c_lowputc.c m16c_irq.c \
m16c_timerisr.c m16c_dumpstate.c
m16c_timerisr.c m16c_serial.c m16c_dumpstate.c
ifneq ($(CONFIG_DISABLE_SIGNALS),y)
CHIP_CSRCS += m16c_schedulesigaction.c m16c_sigdeliver.c

View File

@ -261,11 +261,19 @@ extern uint32 g_sfbss; /* Start of far .bss */
extern uint32 g_efbss; /* End+1 of far .bss */
extern uint32 g_sfdata; /* Start of far .data */
extern uint32 g_efdata; /* End_1 of far .data */
extern uint32 g_efronly; /* Start of relocated read-only data in FLASH */
xtern uint32 g_efronly; /* Start of relocated read-only data in FLASH */
#endif
extern uint32 g_svarvect; /* Start of variable vectors */
extern uint32 g_heapbase; /* Start of the heap */
/* Address of the saved user stack pointer */
#ifndef __ASSEMBLY__
# if CONFIG_ARCH_INTERRUPTSTACK > 3
extern uint16 g_userstack;
# endif
#endif
#endif /* __ASSEMBLY__ */
#endif /* __ARCH_SH_SRC_M16C_CHIP_H */

View File

@ -91,6 +91,18 @@ static inline uint16 m16c_getsp(void)
return sp;
}
/****************************************************************************
* Name: m16c_getusersp
****************************************************************************/
#if CONFIG_ARCH_INTERRUPTSTACK > 3
static inline uint16 m16c_getusersp(void)
{
ubyte *ptr = (ubyte*) current_regs;
return (uint16)ptr[REG_SP] << 8 | ptr[REG_SP+1];
}
#endif
/****************************************************************************
* Name: m16c_stackdump
****************************************************************************/
@ -199,11 +211,9 @@ void up_dumpstate(void)
m16c_stackdump(sp, istackbase);
/* Extract the user stack pointer which should lie
* at the base of the interrupt stack.
*/
/* Extract the user stack pointer from the register area */
sp = g_userstack;
sp = m16c_getusersp();
lldbg("sp: %04x\n", sp);
}

View File

@ -71,8 +71,8 @@
# undef CONFIG_UART2_SERIAL_CONSOLE
#elif defined(CONFIG_UART2_SERIAL_CONSOLE) && !defined(CONFIG_UART2_DISABLE)
# define HAVE_CONSOLE 1
# undef CONFIG_UART0_SERIAL_CONSOLE
# undef CONFIG_UART1_SERIAL_CONSOLE
# undef CONFIG_UART2_SERIAL_CONSOLE
#else
# if defined(CONFIG_UART0_SERIAL_CONSOLE) || defined(CONFIG_UART1_SERIAL_CONSOLE)|| defined(CONFIG_UART2_SERIAL_CONSOLE)
# error "Serial console selected, but corresponding UART not enabled"
@ -183,7 +183,7 @@
#ifdef HAVE_CONSOLE
static inline int up_txready(void)
{
/* Check the TI bit in the CI register. 1=Transmit buffer emptyy */
/* Check the TI bit in the CI register. 1=Transmit buffer empty */
return ((getreg8(M16C_UART_BASE + M16C_UART_C1) & UART_C1_TI) != 0);
}

File diff suppressed because it is too large Load Diff