亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? sdc.c

?? Nucleus 移植到OMAP1610的源代碼
?? C
?? 第 1 頁 / 共 3 頁
字號:
/**************************************************************************
*                                                                          
*               Copyright Mentor Graphics Corporation 2002              
*                         All Rights Reserved.                          
*                                                                       
* THIS WORK CONTAINS TRADE SECRET AND PROPRIETARY INFORMATION WHICH IS  
* THE PROPERTY OF MENTOR GRAPHICS CORPORATION OR ITS LICENSORS AND IS   
* SUBJECT TO LICENSE TERMS.                                             
*                                                                          
***************************************************************************
***************************************************************************
*                                                                          
* FILE NAME                               VERSION                          
*                                                                          
*  sdc.c                        Nucleus PLUS\ARM925\Code Composer 1.14.1 
*                                                                          
* DESCRIPTION                                                              
*                                                                          
*  This file contains the Serial Driver specific functions.                
*                                                                          
* DATA STRUCTURES                                                          
*                                                                          
*  SD_PORT *       :   An array of pointers to serial port structures.     
*                                                                          
* FUNCTIONS                                                                
*                                                                          
*  SDC_Init_Port                                                           
*  SDC_Date_Ready                                                          
*  SDC_Put_String                                                          
*  SDC_LISR                                                                
*  SDC_Get_Char                                                            
*  SDC_Put_Char                                                            
*  SDC_Set_Baud_Rate                                                       
*                                                                          
* DEPENDENCIES                                                             
*                                                                          
*  nucleus.h                                                               
*  sd_defs.h                                                               
*  sd_extr.h                                                               
*   target.h                                                               
* protocol.h                                                               
*  externs.h                                                               
*      ppp.h    
*
* HISTORY                                                               
*                                                                       
*         NAME            DATE                    REMARKS               
*
*      B. Ronquillo     08-28-2002           Released version 1.14.1    
****************************************************************************/

#include "nucleus.h"
#include "sd_defs.h"
#include "sd_extr.h"

#ifdef NU_ENABLE_PPP

#include "net\target.h"
#include "net\inc\externs.h"
#include "net\inc\tcp_errs.h"
#include "ppp\inc\ppp.h"

#endif /* NU_ENABLE_PPP */

extern NU_MEMORY_POOL   System_Memory;

/* Define a small array to hold pointers to the two UART data
   structures. This is used by the LISR to find the correct
   data structure for the interrupt being handled. */
SD_PORT         *SDC_Port_List[SD_MAX_UARTS];


/************** Begin Port Specific Section ****************/
UINT8   SDC_TX_Int_Flag=0;
/*************** End Port Specific Section ****************/

/* Define prototypes for functions local to this module. */

    /**************** Begin Port Specific Section **************/
#ifdef GRAFIX_MOUSE
extern NU_HISR Mouse_HISR;
#endif
    /**************** End Port Specific Section **************/

static  VOID    SDC_Set_Baud_Rate(UINT32, SD_PORT *);
/***************************************************************************
* FUNCTION
*
*    SDC_Init_Port
*
* DESCRIPTION
*
*    This function intializes the COM port that will be used for PPP
*    communications.
*
*
* INPUTS
*
*    SD_PORT *     :   device initialization structure.
*
* OUTPUTS
*
*    STATUS        :   Returns NU_SUCCESS if successful initialization,
*                      else a negative value is returned.
*
****************************************************************************/
STATUS  SDC_Init_Port(SD_PORT *uart)
{
STATUS      status = NU_SUCCESS;
INT32       int_level,          /* old interrupt level */
            tInt;
UINT8       temp_byte;
UINT32      temp_word, int_val;
CHAR        sem_name[8];
static INT  num_ports = 0;
VOID        (*old_lisr)(INT);   /* old LISR */

#ifdef GRAFIX_MOUSE
    if ((uart->communication_mode == SERIAL_MODE) ||
        (uart->communication_mode == SERIAL_MOUSE))
#else
    if (uart->communication_mode == SERIAL_MOUSE)
    {
        status = NU_INVALID_MOUSE_MODE;
    }
    else if (uart->communication_mode == SERIAL_MODE)
#endif

    {
    
        /* Check for max allowed UARTS. */
        if (num_ports >= SD_MAX_UARTS)

           /* We have already initialized the max allowed UARTS. */
           status = NU_UART_LIST_FULL;
    }
    
    if (status != NU_SUCCESS)
        return (status);

    /* Check the supplied parity */
    else if ((uart->parity != SD_PARITY_NONE) &&
             (uart->parity != SD_PARITY_EVEN) &&
             (uart->parity != SD_PARITY_ODD))

        /* The supplied parity is not valid */
        status = NU_INVALID_PARITY;

    /* Check the supplied number of data bits */
    else if ((uart->data_bits != SD_DATA_BITS_7) &&
             (uart->data_bits != SD_DATA_BITS_8))

        /* The supplied data bits value is not valid */
        status = NU_INVALID_DATA_BITS;

    /* Check the supplied number of stop bits */
    else if ((uart->stop_bits != SD_STOP_BITS_1) &&
             (uart->stop_bits != SD_STOP_BITS_2))

        /* The supplied stop bits value is not valid */
        status = NU_INVALID_STOP_BITS;

    /* Verify the baud rate is within acceptable range */
    else if ((uart->baud_rate < 300) || (uart->baud_rate > 115200))

        /* The baud rate is out of range */
        status = NU_INVALID_BAUD;

    /************** Begin Port Specific Section ****************/

    /* Validate the com port. */
    else if ((uart->com_port == SD_UART1) ||
             (uart->com_port == SD_UART2))
    {
        /* Handle UARTA */
        if (uart->com_port == SD_UART1)
        {
            /* Set the vector inside this structure */
            uart->vector = SD_UART1_VECTOR;

            /* Set the base address for this UART. */
            uart->base_address = SD_UART1_BASE;
        }
        else    /* Otherwise handle UARTB. */
        {
            /* Set the vector inside this structure */
            uart->vector = SD_UART2_VECTOR;
            
            /* Set the base address for this UART. */
            uart->base_address = SD_UART2_BASE;
        }
    }
    else

    /************** End Port Specific Section **************/

        /* Not a supported port. */
        status = NU_INVALID_COM_PORT;

#ifdef GRAFIX_MOUSE
    if ((uart->communication_mode == SERIAL_MODE) ||
        (uart->communication_mode == SERIAL_MOUSE))
#else
    if (uart->communication_mode == SERIAL_MODE)
#endif

    {
        /* Make sure the port was valid and the LISR was
           registered. Then create the semaphore used to make
           the SD_Put_String service thread safe. */
        if (status == NU_SUCCESS)
        {
            /* Allocate memory for the semaphore control block. */
           status = NU_Allocate_Memory(&System_Memory,(VOID**) &uart->sd_semaphore,
                        sizeof(NU_SEMAPHORE), NU_NO_SUSPEND);

            for(tInt=0; tInt < sizeof(NU_SEMAPHORE); tInt++)
                       /* Fixed SPR 211.  Changed type from (UINT32) to (CHAR *) */
                       SD_OUTBYTE((CHAR *) uart->sd_semaphore + tInt, 0x00);

            if (status == NU_SUCCESS)
            {
                /* Build the name. */
                sem_name[0] = 's';
                sem_name[1] = 'e';
                sem_name[2] = 'r';
                sem_name[3] = 'i';
                sem_name[4] = 'a';
                sem_name[5] = 'l';
                sem_name[6] = '_';
                sem_name[7] = (CHAR)(0x30 + num_ports);

                status = NU_Create_Semaphore (uart->sd_semaphore, sem_name,
                                              1, NU_FIFO);
            }                                   
        }

        /* Make sure all the above was completed. Then store off this
           UART stucture and initialize the chip. */
        if (status == NU_SUCCESS)
        {
            SDC_Port_List[num_ports++] = uart;
        }
    }

    if (status == NU_SUCCESS)
    {
        /* Allocate memory for the data buffers. PPP only requires a TX
           buffer so the allocation will be a little different for PPP mode. */
#ifdef GRAFIX_MOUSE
        if ((uart->communication_mode == SERIAL_MODE) ||
            (uart->communication_mode == SERIAL_MOUSE))
#else
        if (uart->communication_mode == SERIAL_MODE)
#endif

        {
            status = NU_Allocate_Memory (&System_Memory,(VOID**) &uart->tx_buffer, 
                         (2 * uart->sd_buffer_size), NU_NO_SUSPEND);

            /* Set the RX buffer to just past the TX buffer. */
            uart->rx_buffer = (CHAR *)(uart->tx_buffer + uart->sd_buffer_size);
        }
        else
        {
            status = NU_Allocate_Memory (&System_Memory,(VOID**) &uart->tx_buffer, 
                         uart->sd_buffer_size, NU_NO_SUSPEND);
        }

        if (status == NU_SUCCESS)
        {
            /* Setup the RX SD buffer */
            uart->rx_buffer_read = uart->rx_buffer_write = 0;
 
            uart->rx_buffer_status = NU_BUFFER_EMPTY;

            /* Setup the TX SD buffer */
            uart->tx_buffer_read = uart->tx_buffer_write = 0;
            uart->tx_buffer_status = NU_BUFFER_EMPTY;
        }
    }

    if (status == NU_SUCCESS)
    {
        /* Disable interrupts */
        int_level = NU_Local_Control_Interrupts(NU_DISABLE_INTERRUPTS);

        /* Initialize the UART */

        /************** Begin Port Specific Section *************/

        /* Determine the clock source of UART1 and UART2 */
        SD_OUTDWORD(FUNC_MUX_CTRL_0 + MOD_CONF_CTRL_0, UART_CLOCK_SET);

        if(uart->com_port==SD_UART1)
        {
            /* Turn off BT Module */
            temp_byte = SD_INBYTE(EPLD_PWR_CNTRL);
            SD_OUTBYTE (EPLD_PWR_CNTRL, (temp_byte | EPLD_PWR_BT_MOD));

            /* Turn-on power to UART 1 through the EPLD (FPGA memory-mapped registers) */            
            temp_byte = SD_INBYTE(EPLD_PWR_CNTRL);
            SD_OUTBYTE (EPLD_PWR_CNTRL, (temp_byte | EPLD_PWR_UART1));

        }
        else  /* Set up UART2 */
        {
            /* Turn-on power to UART 2 through the EPLD (FPGA memory-mapped registers) */
            temp_byte = SD_INBYTE(EPLD_PWR_CNTRL);
            SD_OUTBYTE (EPLD_PWR_CNTRL, (temp_byte | EPLD_PWR_UART2));
        }

        /* Enable UART clock, make sure to release peripheral reset */
        temp_word = SD_INDWORD(MPU_CLOCK_BASE + MPU_RSTCT2_OFFSET);
        SD_OUTDWORD(MPU_CLOCK_BASE + MPU_RSTCT2_OFFSET, (temp_word | MPU_RSTCT2_PER_EN)); 

        temp_word = SD_INDWORD(MPU_CLOCK_BASE + MPU_IDLECT2_OFFSET);
        SD_OUTDWORD(MPU_CLOCK_BASE + MPU_IDLECT2_OFFSET, (temp_word | MPU_EN_XORPCK | MPU_EN_PERCK)); 

        /* Configure the Mode Definition Register */
        SD_OUTBYTE(uart->base_address + MDR_OFFSET, MDR_RESET_MODE);

        /* MUX the UART Signals */
        temp_word = SD_INDWORD(FUNC_MUX_CTRL_0);
        if(uart->com_port==SD_UART1)
            SD_OUTDWORD(FUNC_MUX_CTRL_0,temp_word | (1UL << 25));
        else
            SD_OUTDWORD(FUNC_MUX_CTRL_0,temp_word | (1UL << 24));
        
        /* Reset the TX/RX FIFOs */
        SD_OUTBYTE(uart->base_address + FCR_OFFSET, FCR_FIFO_RESET);

        /* Setup baud rate */
        SDC_Set_Baud_Rate(uart->baud_rate, uart);

        /* Set the modem control register. Set DTR, RTS to output to LOW,
           and set INT output pin to normal operating mode */ 
        SD_OUTBYTE (uart->base_address + MCR_OFFSET, (MCR_DTR_LOW | MCR_RTS_LOW)); 

        /* Setup parity, data bits, and stop bits */
        SD_OUTBYTE (uart->base_address + LCR_OFFSET,
                          (LCR_NO_BREAK|uart->parity|uart->data_bits|uart->stop_bits ));

        /* Setup Fifo trigger level and enable FIFO */
        SD_OUTBYTE (uart->base_address + FCR_OFFSET, 0);

        /* Register the interrupt handler for the UART receiver */
        if (uart->com_port == SD_UART1)
            status = NU_Register_LISR(SD_UART1_VECTOR, SDC_LISR, &old_lisr);
        else
            status = NU_Register_LISR(SD_UART2_VECTOR, SDC_LISR, &old_lisr);

        if (status == NU_SUCCESS)
        {
            /* Enable the RX interrupts */
            SD_OUTBYTE (uart->base_address + IER_OFFSET, IER_RX_HOLDING_REG);

            /* Get the Level 1 Interrupt bit to be masked */
            int_val = SD_INDWORD (ICBASE + INT_MASK_OFFSET);
            int_val &= ~(LEVEL_2_INT);
            SD_OUTDWORD(ICBASE + INT_MASK_OFFSET, int_val);            

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久九九影视网| 亚洲欧美综合色| 国产精品国产精品国产专区不蜜| 亚洲视频网在线直播| 日本不卡视频在线| 日本韩国视频一区二区| 欧美成人bangbros| 午夜一区二区三区视频| 成人免费看视频| 久久久一区二区三区捆绑**| 亚洲综合视频在线观看| 91片黄在线观看| 国产欧美精品一区二区三区四区| 日本中文字幕不卡| 91视频在线看| 中文字幕一区二区三区视频| 国产精品原创巨作av| 欧美一区二区三区四区高清| 亚洲一区二区三区在线看| 91香蕉视频黄| 中文字幕一区二区三区视频| 国产精品亚洲成人| 国产日韩欧美一区二区三区乱码| 裸体一区二区三区| 日韩一区二区三区电影| 日本sm残虐另类| 日韩亚洲欧美高清| 日本在线不卡一区| 欧美一区二区三区四区五区| 丝袜美腿亚洲一区| 欧美精品成人一区二区三区四区| 亚洲综合视频网| 欧美日韩国产一区| 免费亚洲电影在线| 亚洲精品一线二线三线| 国产真实乱子伦精品视频| 久久日韩粉嫩一区二区三区| 国产高清在线精品| 国产精品网站在线| 93久久精品日日躁夜夜躁欧美| 成人免费小视频| 欧洲精品中文字幕| 日韩一区精品视频| 精品国产a毛片| 粉嫩一区二区三区性色av| 亚洲国产精品成人久久综合一区| 成人午夜在线播放| 亚洲精品日韩一| 欧美高清性hdvideosex| 精品一区二区三区免费观看| 国产精品午夜在线观看| 9色porny自拍视频一区二区| 一区二区三区视频在线观看| 欧美另类久久久品| 国产一区二区三区精品欧美日韩一区二区三区 | 亚洲妇熟xx妇色黄| 欧美一区二区视频免费观看| 国产激情一区二区三区| 亚洲欧美日韩在线播放| 3atv一区二区三区| 成人一级视频在线观看| 亚洲综合视频在线| 久久久久国产精品厨房| 一本久道久久综合中文字幕 | 亚洲欧美日韩综合aⅴ视频| 欧美视频在线一区二区三区 | 免费看日韩a级影片| 国产精品美女久久久久久| 欧美日韩不卡在线| 大尺度一区二区| 天天综合网 天天综合色| 亚洲国产精品精华液ab| 69堂亚洲精品首页| 94-欧美-setu| 国产精品一级黄| 亚洲成av人片一区二区三区| 国产网红主播福利一区二区| 欧美性大战久久久久久久蜜臀| 国产激情一区二区三区桃花岛亚洲| 亚洲午夜私人影院| 国产精品久久久久婷婷二区次| 91精品国产入口在线| 色综合网色综合| 懂色av一区二区夜夜嗨| 麻豆国产欧美一区二区三区| 亚洲男人的天堂在线观看| 久久一日本道色综合| 欧美人与性动xxxx| a级精品国产片在线观看| 国产在线国偷精品免费看| 亚洲成av人片一区二区三区 | 日本一区二区三区国色天香| 91麻豆精品国产自产在线观看一区 | 亚洲一区精品在线| 国产精品情趣视频| 久久久久国产精品厨房| 日韩精品中文字幕在线一区| 欧美日韩一区二区三区视频| 91丨porny丨国产| 国产福利一区二区三区视频 | 色噜噜狠狠成人中文综合| 国产美女一区二区三区| 捆绑调教美女网站视频一区| 日韩国产欧美在线播放| 亚洲www啪成人一区二区麻豆| 中文字幕一区二区三区在线不卡 | 日本中文一区二区三区| 亚洲国产你懂的| 亚洲乱码国产乱码精品精的特点| 国产精品青草综合久久久久99| 国产亚洲福利社区一区| 精品日韩欧美一区二区| 精品日韩一区二区三区免费视频| 欧美一区二区三区在线观看视频| 91精品国产日韩91久久久久久| 欧美日韩国产综合一区二区三区| 欧美色偷偷大香| 欧美久久久久久久久| 91超碰这里只有精品国产| 欧美三级日韩在线| 欧美精品粉嫩高潮一区二区| 欧美一区二区视频在线观看2020 | 午夜欧美一区二区三区在线播放| 亚洲国产一二三| 午夜久久久久久电影| 日韩成人一级大片| 韩国毛片一区二区三区| 粉嫩一区二区三区在线看 | 国产美女娇喘av呻吟久久| 国产伦精品一区二区三区视频青涩| 九九热在线视频观看这里只有精品| 久久成人综合网| 成人黄色小视频在线观看| 91免费视频网址| 91精品国产手机| 国产三级精品三级在线专区| 亚洲三级小视频| 丝袜a∨在线一区二区三区不卡| 久久av资源网| 91老师国产黑色丝袜在线| 欧美日韩精品久久久| 精品精品欲导航| 国产精品盗摄一区二区三区| 亚洲成人激情av| 国产在线观看一区二区| 一本色道久久综合亚洲91| 9191成人精品久久| 国产精品美女久久久久久久网站| 亚洲永久精品国产| 国产又粗又猛又爽又黄91精品| 成人网在线播放| 欧美一区二区视频在线观看2022| 国产欧美综合色| 亚洲成av人影院在线观看网| 国产精品伊人色| 欧美人与性动xxxx| 中文字幕一区二区日韩精品绯色| 三级影片在线观看欧美日韩一区二区| 国产一区二区91| 91精品黄色片免费大全| 国产精品剧情在线亚洲| 久久精品国产99国产精品| 91亚洲精品久久久蜜桃网站 | 国产亚洲精品福利| 亚洲一卡二卡三卡四卡五卡| 国产精品1区2区| 欧美日韩一区中文字幕| 国产精品美女视频| 国模套图日韩精品一区二区 | 强制捆绑调教一区二区| 91在线观看地址| 国产视频911| 久久99热这里只有精品| 欧美在线free| 亚洲欧美电影一区二区| 国产精品自拍在线| 日韩一区二区中文字幕| 亚洲午夜国产一区99re久久| 97se亚洲国产综合自在线观| 久久伊99综合婷婷久久伊| 老司机一区二区| 在线不卡欧美精品一区二区三区| 亚洲日穴在线视频| 成av人片一区二区| 久久久99久久| 国产美女av一区二区三区| 精品国产一区二区三区久久久蜜月 | 欧美三级电影在线看| 亚洲欧洲av在线| 成人黄色电影在线| 国产亚洲精品免费| 国产伦精品一区二区三区免费迷 | 欧美精品九九99久久| 亚洲一区二区3| 欧美午夜精品一区| 亚洲一区二区影院| 欧美日韩高清一区二区三区| 亚洲综合一二三区| 在线观看av一区二区| 亚洲综合在线第一页|