mirror of
https://github.com/apache/nuttx.git
synced 2026-06-06 00:14:22 +08:00
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:
@@ -43,10 +43,8 @@ CMN_CSRCS = up_allocateheap.c up_assert.c up_blocktask.c \
|
|||||||
up_udelay.c up_unblocktask.c up_usestack.c
|
up_udelay.c up_unblocktask.c up_usestack.c
|
||||||
|
|
||||||
CHIP_ASRCS = m16c_vectors.S
|
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 \
|
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)
|
ifneq ($(CONFIG_DISABLE_SIGNALS),y)
|
||||||
CHIP_CSRCS += m16c_schedulesigaction.c m16c_sigdeliver.c
|
CHIP_CSRCS += m16c_schedulesigaction.c m16c_sigdeliver.c
|
||||||
|
|||||||
+20
-12
@@ -251,20 +251,28 @@
|
|||||||
|
|
||||||
#ifndef __ASSEMBLY__
|
#ifndef __ASSEMBLY__
|
||||||
|
|
||||||
extern uint16 g_snbss; /* Start of near .bss */
|
extern uint16 g_snbss; /* Start of near .bss */
|
||||||
extern uint16 g_enbss; /* End+1 of near .bss */
|
extern uint16 g_enbss; /* End+1 of near .bss */
|
||||||
extern uint16 g_sndata; /* Start of near .data */
|
extern uint16 g_sndata; /* Start of near .data */
|
||||||
extern uint16 g_endata; /* End+1 of near .data */
|
extern uint16 g_endata; /* End+1 of near .data */
|
||||||
extern uint32 g_enronly; /* Start of relocated read-only data in FLASH */
|
extern uint32 g_enronly; /* Start of relocated read-only data in FLASH */
|
||||||
#ifdef CONFIG_M16C_HAVEFARRAM
|
#ifdef CONFIG_M16C_HAVEFARRAM
|
||||||
extern uint32 g_sfbss; /* Start of far .bss */
|
extern uint32 g_sfbss; /* Start of far .bss */
|
||||||
extern uint32 g_efbss; /* End+1 of far .bss */
|
extern uint32 g_efbss; /* End+1 of far .bss */
|
||||||
extern uint32 g_sfdata; /* Start of far .data */
|
extern uint32 g_sfdata; /* Start of far .data */
|
||||||
extern uint32 g_efdata; /* End_1 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
|
||||||
extern uint32 g_svarvect; /* Start of variable vectors */
|
|
||||||
extern uint32 g_heapbase; /* Start of the heap */
|
|
||||||
|
|
||||||
#endif /* __ASSEMBLY__ */
|
#endif /* __ASSEMBLY__ */
|
||||||
|
|
||||||
|
|||||||
@@ -91,6 +91,18 @@ static inline uint16 m16c_getsp(void)
|
|||||||
return sp;
|
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
|
* Name: m16c_stackdump
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@@ -199,11 +211,9 @@ void up_dumpstate(void)
|
|||||||
|
|
||||||
m16c_stackdump(sp, istackbase);
|
m16c_stackdump(sp, istackbase);
|
||||||
|
|
||||||
/* Extract the user stack pointer which should lie
|
/* Extract the user stack pointer from the register area */
|
||||||
* at the base of the interrupt stack.
|
|
||||||
*/
|
|
||||||
|
|
||||||
sp = g_userstack;
|
sp = m16c_getusersp();
|
||||||
lldbg("sp: %04x\n", sp);
|
lldbg("sp: %04x\n", sp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -71,8 +71,8 @@
|
|||||||
# undef CONFIG_UART2_SERIAL_CONSOLE
|
# undef CONFIG_UART2_SERIAL_CONSOLE
|
||||||
#elif defined(CONFIG_UART2_SERIAL_CONSOLE) && !defined(CONFIG_UART2_DISABLE)
|
#elif defined(CONFIG_UART2_SERIAL_CONSOLE) && !defined(CONFIG_UART2_DISABLE)
|
||||||
# define HAVE_CONSOLE 1
|
# define HAVE_CONSOLE 1
|
||||||
|
# undef CONFIG_UART0_SERIAL_CONSOLE
|
||||||
# undef CONFIG_UART1_SERIAL_CONSOLE
|
# undef CONFIG_UART1_SERIAL_CONSOLE
|
||||||
# undef CONFIG_UART2_SERIAL_CONSOLE
|
|
||||||
#else
|
#else
|
||||||
# if defined(CONFIG_UART0_SERIAL_CONSOLE) || defined(CONFIG_UART1_SERIAL_CONSOLE)|| defined(CONFIG_UART2_SERIAL_CONSOLE)
|
# 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"
|
# error "Serial console selected, but corresponding UART not enabled"
|
||||||
@@ -183,7 +183,7 @@
|
|||||||
#ifdef HAVE_CONSOLE
|
#ifdef HAVE_CONSOLE
|
||||||
static inline int up_txready(void)
|
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);
|
return ((getreg8(M16C_UART_BASE + M16C_UART_C1) & UART_C1_TI) != 0);
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user