- 积分
- 71
贡献112
飞刀36 FD
注册时间2016-2-29
在线时间60 小时
扫一扫,手机访问本帖
|
请教各位大大,要修改ok6410的com1做普通串口应该要怎么改?
在smdk6410.bat里面发现- set BSP_NOSERIAL=
- set BSP_NOUART0=1
- set BSP_NOUART1=
- set BSP_NOUART2=
- set BSP_NOUART3=
- set BSP_NOIRDA2=1
- set BSP_NOIRDA3=1
- set BSP_NOI2C=
- set BSP_NOSPI=1
- set BSP_NOUSBHCD=
- @REM If you want to exclude USB Function driver in BSP. Set this variable
- set BSP_NOUSBFN=
- @REM This select default function driver
- set BSP_USBFNCLASS=SERIAL
- @REM set BSP_USBFNCLASS=MASS_STORAGE
- @REM DVFS is not yet implemented.
- set BSP_USEDVS=1
- set BSP_DEBUGPORT=SERIAL_UART0
- @REM set BSP_DEBUGPORT=SERIAL_UART1
- @REM set BSP_DEBUGPORT=SERIAL_UART2
- @REM set BSP_DEBUGPORT=SERIAL_UART3
复制代码 据说还要修改debug.c,在src\oal\oallib里面发现debug.c,内容如下:- //
- // Copyright (c) Microsoft Corporation. All rights reserved.
- //
- //
- // Use of this source code is subject to the terms of the Microsoft end-user
- // license agreement (EULA) under which you licensed this SOFTWARE PRODUCT.
- // If you did not accept the terms of the EULA, you are not authorized to use
- // this source code. For a copy of the EULA, please see the LICENSE.RTF on your
- // install media.
- //
- //------------------------------------------------------------------------------
- //
- // File: debug.c
- //
- // This module is provides the interface to the serial port.
- //
- #include <bsp.h>
- #include <nkintr.h>
- //------------------------------------------------------------------------------
- // Defines
- //------------------------------------------------------------------------------
- // Externs
- //------------------------------------------------------------------------------
- // Global Variables
- //------------------------------------------------------------------------------
- // Local Variables
- static volatile S3C6410_UART_REG *g_pUARTReg = NULL;
- static volatile S3C6410_GPIO_REG *g_pGPIOReg = NULL;
- static volatile S3C6410_SYSCON_REG *g_pSysConReg = NULL;
- static const UINT32 aSlotTable[16] =
- {
- 0x0000, 0x0080, 0x0808, 0x0888,
- 0x2222, 0x4924, 0x4a52, 0x54aa,
- 0x5555, 0xd555, 0xd5d5, 0xddd5,
- 0xdddd, 0xdfdd, 0xdfdf, 0xffdf
- };
- //------------------------------------------------------------------------------
- // Local Functions
- //------------------------------------------------------------------------------
- //
- // Function: OEMInitDebugSerial
- //
- // Initializes the debug serial port
- //
- VOID OEMInitDebugSerial()
- {
- UINT32 logMask;
- UINT32 DivSlot;
- float Div;
- //OALMSG(TRUE, (TEXT("[OAL] ++OEMInitDebugSerial()\n\r")));
- // At this moment we must suppress logging.
- //
- logMask = dpCurSettings.ulZoneMask;
- dpCurSettings.ulZoneMask = 0;
- // Map SFR Address
- //
- if (g_pUARTReg == NULL)
- {
- #if (DEBUG_PORT == DEBUG_UART0)
- // UART0
- g_pUARTReg = (S3C6410_UART_REG *)OALPAtoVA(S3C6410_BASE_REG_PA_UART0, FALSE);
- #elif (DEBUG_PORT == DEBUG_UART1)
- // UART1
- g_pUARTReg = (S3C6410_UART_REG *)OALPAtoVA(S3C6410_BASE_REG_PA_UART1, FALSE);
- #elif (DEBUG_PORT == DEBUG_UART2)
- // UART2
- g_pUARTReg = (S3C6410_UART_REG *)OALPAtoVA(S3C6410_BASE_REG_PA_UART2, FALSE);
- #elif (DEBUG_PORT == DEBUG_UART3)
- // UART3
- g_pUARTReg = (S3C6410_UART_REG *)OALPAtoVA(S3C6410_BASE_REG_PA_UART3, FALSE);
- #else
- INVALID_DEBUG_PORT // Error
- #endif
- }
- if (g_pGPIOReg == NULL)
- {
- g_pGPIOReg = (S3C6410_GPIO_REG *)OALPAtoVA(S3C6410_BASE_REG_PA_GPIO, FALSE);
- }
- if (g_pSysConReg == NULL)
- {
- g_pSysConReg = (S3C6410_SYSCON_REG *)OALPAtoVA(S3C6410_BASE_REG_PA_SYSCON, FALSE);
- }
- // UART I/O port initialize
- #if (DEBUG_PORT == DEBUG_UART0)
- // UART0 Clock Enable
- g_pSysConReg->PCLK_GATE |= (1<<1); // UART0
- g_pSysConReg->SCLK_GATE |= (1<<5); // UART0~3
- // UART0 Port Initialize (RXD0 : GPA0, TXD0: GPA1)
- g_pGPIOReg->GPACON = (g_pGPIOReg->GPACON & ~(0xff<<0)) | (0x22<<0); // GPA0->RXD0, GPA1->TXD0
- g_pGPIOReg->GPAPUD = (g_pGPIOReg->GPAPUD & ~(0xf<<0)) | (0x1<<0); // RXD0: Pull-down, TXD0: pull up/down disable
- #elif (DEBUG_PORT == DEBUG_UART1)
- // UART1 Clock Enable
- g_pSysConReg->PCLK_GATE |= (1<<2); // UART1
- g_pSysConReg->SCLK_GATE |= (1<<5); // UART0~3
- // UART1 Port Initialize (RXD1 : GPA4, TXD1: GPA5)
- g_pGPIOReg->GPACON = (g_pGPIOReg->GPACON & ~(0xff<<16)) | (0x22<<16); // GPA4->RXD1, GPA5->TXD1
- g_pGPIOReg->GPAPUD = (g_pGPIOReg->GPAPUD & ~(0xf<<8)) | (0x1<<8); // RXD1: Pull-down, TXD1: pull up/down disable
- #elif (DEBUG_PORT == DEBUG_UART2)
- // UART2 Clock Enable
- g_pSysConReg->PCLK_GATE |= (1<<3); // UART2
- g_pSysConReg->SCLK_GATE |= (1<<5); // UART0~3
- // UART2 Port Initialize (RXD2 : GPAB0, TXD2: GPB1)
- g_pGPIOReg->GPBCON = (g_pGPIOReg->GPBCON & ~(0xff<<0)) | (0x22<<0); // GPB0->RXD2, GPB1->TXD2
- g_pGPIOReg->GPBPUD = (g_pGPIOReg->GPBPUD & ~(0xf<<0)) | (0x1<<0); // RXD2: Pull-down, TXD2: pull up/down disable
- #elif (DEBUG_PORT == DEBUG_UART3)
- // UART3 Clock Enable
- g_pSysConReg->PCLK_GATE |= (1<<4); // UART3
- g_pSysConReg->SCLK_GATE |= (1<<5); // UART0~3
- // UART3 Port Initialize (RXD3 : GPB2, TXD3: GPB3)
- g_pGPIOReg->GPBCON = (g_pGPIOReg->GPBCON & ~(0xff<<8)) | (0x22<<8); // GPB2->RXD3, GPB3->TXD3
- g_pGPIOReg->GPBPUD = (g_pGPIOReg->GPBPUD & ~(0xf<<4)) | (0x1<<4); // RXD3: Pull-down, TXD3: pull up/down disable
- #endif
- // Initialize UART
- //
- g_pUARTReg->ULCON = (0<<6)|(0<<3)|(0<<2)|(3<<0); // Normal Mode, No Parity, 1 Stop Bit, 8 Bit Data
- g_pUARTReg->UCON = (0<<10)|(1<<9)|(1<<8)|(0<<7)|(0<<6)|(0<<5)|(0<<4)|(1<<2)|(1<<0); // PCLK divide, Polling Mode
- g_pUARTReg->UFCON = (0<<6)|(0<<4)|(0<<2)|(0<<1)|(0<<0); // Disable FIFO
- g_pUARTReg->UMCON = (0<<5)|(0<<4)|(0<<0); // Disable Auto Flow Control
- Div = (float)((float)S3C6410_PCLK/(16.0*(float)DEBUG_BAUDRATE)) - 1;
- DivSlot = (UINT32)((Div-(int)Div)*16);
- g_pUARTReg->UBRDIV = (UINT32)Div; // Baud rate
- g_pUARTReg->UDIVSLOT = aSlotTable[DivSlot];
- //OALMSG(TRUE, (TEXT("[OAL] OEMInitDebugSerial() : UBRDIV0 = %d, DivSlot = %d, UDIVSLOT0 = 0x%08x\n\r"), (int)Div, DivSlot, aSlotTable[DivSlot]));
- // Restore the logging mask.
- //
- dpCurSettings.ulZoneMask = logMask;
- //OALMSG(TRUE, (TEXT("[OAL] --OEMInitDebugSerial()\n\r")));
- }
- //------------------------------------------------------------------------------
- //
- // Function: OEMWriteDebugByte
- //
- // Transmits a character out the debug serial port.
- //
- VOID OEMWriteDebugByte(UINT8 ch)
- {
- // Wait for TX Buffer Empty
- //
- while (!(g_pUARTReg->UTRSTAT & 0x2));
- // TX Character
- //
- g_pUARTReg->UTXH = ch;
- }
- //------------------------------------------------------------------------------
- //
- // Function: OEMReadDebugByte
- //
- // Reads a byte from the debug serial port. Does not wait for a character.
- // If a character is not available function returns "OEM_DEBUG_READ_NODATA".
- //
- int OEMReadDebugByte()
- {
- int ch;
- if (g_pUARTReg->UTRSTAT & 0x1) // There is received data
- {
- ch = (int)(g_pUARTReg->URXH);
- }
- else // There no data in RX Buffer;
- {
- ch = OEM_DEBUG_READ_NODATA;
- }
- return ch;
- }
- void OEMWriteDebugLED(UINT16 Index, DWORD Pattern)
- {
- if (g_pGPIOReg == NULL)
- {
- // It is first time. Initialize SFR and GPIO set to output
- g_pGPIOReg = (S3C6410_GPIO_REG *)OALPAtoVA(S3C6410_BASE_REG_PA_GPIO, FALSE);
- // g_pGPIOReg->GPNPUD &= ~(0xff<<24); // Pull Up/Down Disable
- // g_pGPIOReg->GPNCON = (g_pGPIOReg->GPNCON & ~(0xff<<24)) | (0x55<<24); // GPN[15:12] set to output
- }
- // The SMDK6410 Evaluation Platform supports 4 LEDs
- // g_pGPIOReg->GPNDAT = (g_pGPIOReg->GPNDAT & ~(0xf<<12)) | ((Pattern&0xf)<<12);
- }
- //------------------------------------------------------------------------------
复制代码 就是不知道应该改哪,跪求各位大侠赐教 |
|