MTK serial drive part-3

Source: Internet
Author: User

/*************************************** **************************************
* Copyright statement:
*--------------------
* This software is protected by copyright and the information contained
* Herein is confidential. The software may not be copied and the information
* Contained herein may not be used or disclosed should T with the written
* Permission of mediatek Inc. (c) 2005
*
* By Opening this file, Buyer hereby unequivocally acknowledges and agrees
* That the software/firmware and Its documentations ("mediatek software ")
* Received from mediatek and/or its representatives are provided to buyer on
* An "as-is" basis only. mediatek expressly disclaims any and all warranties,
* Express or implied, including but not limited to the implied warranties
* Merchantability, fitness for a particle purpose or noninfringement.
* Neither does mediatek provide any warranty whatsoever with respect to
* Software of any third party which may be used by, ininitialized in, or
* Supplied with the mediatek software, and Buyer agrees to look only to such
* Third Party for any warranty claim relating thereto. mediatek shall also
* Not be responsible for any mediatek software releases made to buyer's
* Specification or to conform to a special standard or open forum.
*
* Buyer's sole and exclusive remedy and mediatek's entire and cumulative
* Liability with respect to the mediatek software released hereunder will be,
* At mediatek's option, to revise or replace the mediatek software at issue,
* Or refund any software license fees or service charge paid by buyer
* Mediatek for such mediatek software at issue.
*
* The transaction contemplated hereunder shall be construed in accordance
* With the laws of the State of California, USA, excluding its conflict
* Laws principles. Any disputes, controversies or claims arising thereof and
* Related thereto shall be settled by arbitration in San Francisco, CA, under
* The Rules of the International Chamber of Commerce (ICC ).
*
**************************************** *************************************/

/*************************************** **************************************
*
* Filename:
*---------
* Bl_uart_sw.h
*
* Project:
*--------
* NFB-bootloader
*
* Description:
*------------
* This file is intends for UART driver.
*
* Author:
*-------
*-------
*
* ===================================================== ============================================
* History
* Below this line, this part is controlled by PVCs VM. Do not modify !!
*------------------------------------------------------------------------------
* Removed!
* Removed!
* Removed!
*
* Removed!
* Removed!
* Removed!
* Removed!
* Removed!
* Removed!
* Removed!
* Removed!
* Removed!
*------------------------------------------------------------------------------
* Upper this line, this part is controlled by PVCs VM. Do not modify !!
* ===================================================== ============================================
**************************************** ************************************/
 
# Ifndef _ bootloader_uart_sw_h
# DEFINE _ bootloader_uart_sw_h

# Include <bl_uart_h1_h>

/*
* Baud rates.
*/
Typedef Enum {
Uart_baud_75,
Uart_baud_150,
Uart_baud_300,
Uart_baud_600,
Uart_baud_1200,
Uart_baud_2400,
Uart_baud_4800,
Uart_baud_7200,
Uart_baud_9600,
Uart_baud_14400,
Uart_baud_19200,
Uart_baud_28800,
Uart_baud_38400,
Uart_baud_57600,
Uart_baud_115200
} T_baudrate;

/*
* Bits per character.
*/
Typedef Enum {
Wls_5,
Wls_6,
Wls_7,
Wls_8
} T_bitspercharacter;

/*
* Stop bits.
*/
Typedef Enum {
SB_1,
SB_2,
Sb_00005
} T_stopbits;

/*
* Parity.
*/
Typedef Enum {
Pa_none,
Pa_even,
Pa_odd,
Pa_space,
Pa_mark
} T_parity;

/*
* Flow control mode.
*/
Typedef Enum {
Fc_none,
Fc_rts,
Fc_dtr,
Fc_xoff
} T_flowctrlmode;

/*
* Interrupt.
*/
Typedef Enum {
Int_ms,
Int_rls,
Int_thr,
Int_rda
} T_interrupt;

Void uart_init (void );
Void uart_putbytes (kal_uint8 *, kal_uint16, kal_uint16 *);
Void uart_getbytes (kal_uint8 *, kal_uint16, kal_uint16 *);
Void getuartbyte_nonloop (kal_uint8 *, kal_uint16 *);
Void putuartbyte (kal_uint8 data );
Kal_uint8 getuartbyte (void );
Void uart_writereg (kal_uint32 ADDR, kal_uint16 data );
Kal_uint16 uart_readreg (kal_uint32 ADDR );

Void uart2_init (void );
Void uart2_lisr (void );

# Define uart2_rx_buffer_size 1024
# Define uart2_tx_buffer_size 1024

Extern kal_uint8 uart2_rx_buffer [uart2_rx_buffer_size];
Extern kal_uint8 uart2_tx_buffer [uart2_tx_buffer_size];
Extern kal_uint16 uart2_tx_buffer_count;
Extern kal_uint16 uart2_rx_buffer_head;
Extern kal_uint16 uart2_rx_buffer_tail;
Extern kal_uint16 uart2_tx_buffer_head;
Extern kal_uint16 uart2_tx_buffer_tail;

Extern kal_uint32 uart2_tx_size;
Extern kal_uint32 uart2_tx_offset;
Extern kal_uint32 uart2_rx_size;
Extern kal_uint32 uart2_rx_offset;
Extern kal_uint32 uart2_tx_file_base_address;
Extern kal_uint8 uart2_rx_check_sum;
Extern kal_uint8 uart2_tx_check_sum;

Kal_uint16 uart2_get_byte (void );

# Endif

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.