当前位置:文档之家› MTK_BB_Driver_Customization

MTK_BB_Driver_Customization

MTK_BB_Driver_Customization
MTK_BB_Driver_Customization

Revision: 0.1

Preliminary Information

Document Number:

Driver Customization Guide

Baseband Device Driver

MediaTek

Legal Disclaimer

BY OPENING OR USING 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 OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT. NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED 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 PARTICULAR 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 TO 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 OF LAWS PRINCIPLES.

Revision History

Revision Date

Author Comments

(mm/dd/yyyy)

0.1 11/03/2003 Arthur Shieh Draft version, revised from MTK Device Driver design document

Table of Contents

Legal Disclaimer (2)

Revision History (3)

Table of Contents (4)

1Introduction (7)

1.1Overview (7)

1.2References (7)

2ADC Customization (8)

2.1Overview (8)

2.2Library Module (8)

2.3Const Variables (8)

2.3.1ADC channel definitions (8)

2.4Data Structure (9)

2.4.1adc_channel_type (9)

2.5Functions (9)

2.5.1custom_adc_get_channel (9)

3Accessory (AUX) Task (10)

3.1Overview (10)

3.2Library Module (10)

3.3Data Structures (10)

3.3.1AUX_ID (10)

3.4Message (11)

3.4.1MSG_ID_AUX_PLUGIN (11)

3.4.2MSG_ID_AUX_PLUGOUT (11)

3.4.3MSG_ID_AUX_ID (11)

4Charge parameters (12)

4.1Overview (12)

4.2Library Module (12)

4.3Const Variables (12)

4.3.1GPIO configure for charge control/vibrator (12)

4.3.2Battery/charge Parameters (12)

4.3.3Charge state parameters (13)

4.3.4Measured parameters (15)

5EINT parameters (17)

5.1Overview (17)

5.2Library Module (17)

5.3Definition (17)

6Keypad parameters (18)

6.1Overview (18)

6.2Library Module (18)

7UART parameters (20)

7.1Overview (20)

7.2Library Module (20)

7.3Definition (20)

8Customize driver initialize (21)

8.1Overview (21)

8.2Library Module (21)

8.3Example (21)

9Custom Equipment Configuration (22)

9.1Overview (22)

9.2Library Module (22)

9.3Data Structure (22)

9.3.1GPIO_MAP_ENTRY (22)

9.3.2GPIO_LABELID_ENUM (22)

9.3.3Const Value (23)

9.4Function (24)

9.4.1custom_cfg_hw_aud_output_path (24)

9.4.2custom_cfg_hw_aud_input_path (25)

9.4.3custom_cfg_outward_gpio_port (26)

9.4.4custom_cfg_gpio_set_level (27)

10Device Driver Level Information Configuration (30)

10.1Overview (30)

10.2References (30)

10.3Library Module (30)

10.4Data Structure and Functions (30)

10.4.1Overview (30)

10.4.2Constant Variable (30)

10.4.3Data Structure (31)

10.4.4Global Variables (32)

10.4.5Functions (33)

10.5LCD Level Information (34)

10.5.1Overview (34)

10.5.2Functions (34)

10.6PWM Level Information (34)

10.6.1Overview (34)

10.6.2Functions (34)

10.7Battery Level Information (35)

10.7.1Overview (35)

10.7.2Functions (35)

11LED/LCD/Vibrator Pattern Configuration (36)

11.1Overview (36)

11.2Library Module (36)

11.3Data Structure (36)

11.3.1PATTERN_ID (36)

11.3.2PATTERN_TYPE (37)

11.3.3LED_PATTERN_STRUCT (37)

11.3.4LCD_PATTERN_STRUCT (37)

11.3.5VIB_PATTERN_STRUCT (37)

11.3.6Const Value (38)

11.4Pattern Customization Procedure (38)

11.4.1Overview (38)

11.4.2 A Step-by-Step Example (38)

12NVRAM Configuration (42)

12.1Overview (42)

12.2Library Module (43)

12.3Configuration Guide (44)

12.3.1Define LID (44)

12.3.2Define Size and Total (44)

12.3.3Define Default Value (45)

12.3.4Define Data Item (46)

12.4Modify Data Version (47)

12.4.1Final step (47)

12.5Constraints (47)

12.5.1Constraints (47)

12.5.2Fields in Primitives (48)

12.6Fields in Primitives (48)

12.7Default Value (48)

12.8Read-Only attribute (48)

Index of Figures (49)

1 Introduction

1.1 Overview

This document describes the functional interface of the customized drivers. Basically, these files are allocated at custom\drv\misc_drv\{platform} folder. Some parameters are required to be modified in various customized setting. The customized parameters are ,as a result, placed in the custom folder.

Note that: for LCD driver detailed information, please refer to “Customer Device Driver Document - LCD driver”.

1.2 References

MT6205B GSM Baseband Processor Data Sheet

Exce Lee, “Non-Volatile Memory Data Service Functional Specification”, August 2002.

WS Lin, “NVRAM Task Driver Interface”, October 2002

2 ADC Customization

2.1 Overview

Define the physical ADC channel mapping. For instance, “const kal_uint8 ADC_VBAT = 0” means using ADC channel 0 for battery measurement. It will be modified according to the physical layout. The number of ADC channels depends on the baseband controller.

Module

2.2 Library

custom\drv\misc_drv\{platform}

adc_channel.h

adc_channel.c

Variables

2.3 Const

2.3.1 ADC channel definitions

Definition:

ADC_VBAT,

ADC_VBATTMP,

ADC_ACCESSORYID,

ADC_VISENSE,

ADC_VCHARGER

Parameters:

Parameter Description

ADC_VBAT Battery voltage channel

ADC_VBATTMP Battery temperature voltage channel

ADC_ACCESSORYID Accessory voltage channel

ADC_VISENSE Charge current sense voltage channel

ADC_VCHARGER Charger voltage channel

Example:

const kal_uint8 ADC_VBAT = 0;

/* Battery voltage channel is at channel 0 */

const kal_uint8 ADC_VBATTMP = 1;

/* Battery temperature voltage channel is at channel 1 */

const kal_uint8 ADC_ACCESSORYID = 2;

/* Accessory voltage channel is at channel 2 */

const kal_uint8 ADC_VISENSE = 3;

/* Charge current sense voltage channel is at channel 3 */

const kal_uint8 ADC_VCHARGER = 4;

/* Charger voltage channel is at channel 4 */

2.4 Data

Structure

2.4.1 adc_channel_type

Definition:

typedef enum {

vbat_adc_channel,

visense_adc_channel,

vbattmp_adc_channel,

vcharger_adc_channel,

aux_adc_channel

} adc_channel_type;

Note that: this data structure is only used in Engineering Mode.

Members:

Members Description

vbat_adc_channel Battery voltage channel type

vbattmp_adc_channel Battery temperature voltage channel type

aux_adc_channel Accessory voltage channel type

visense_adc_channel Charge current sense voltage channel type

vcharger_adc_channel Charger voltage channel type

2.5 Functions

2.5.1 custom_adc_get_channel

kal_uint8 custom_adc_get_channel(adc_channel_type type)

This function is to obtain the ADC channel information. This function is only used in Engineering Mode. Parameters:

Parameter Description

Type =vbat_adc_channel, vbattmp_adc_channel, aux_adc_channel,

visense_adc_channel, vcharger_adc_channel

Return value:

ADC channel number

Example:

None

3 Accessory (AUX) Task

3.1 Overview

This task is used to detect the accessory device (UART, EARPHONE, send/end key… etc) which is depended on base band board layout.

Module

3.2 Library

custom\drv\misc_drv\{platform}

auxmain.c

interface\hwdrv

drvsignals.h

3.3 Data

Structures

3.3.1 AUX_ID

Definition:

typedef enum

{

AUX_ID_PLUGOUT=0,

AUX_ID_EARPHONE,

AUX_ID_KEY_PRESS,

AUX_ID_KEY_RELEASE,

AUX_ID_UART,

AUX_ID_CLAM_OPEN,

AUX_ID_CLAM_CLOSE,

AUX_MAX_ID

}AUX_ID;

This enum defines all of the accessory ids. If phone add another accessory device, this enum definition should be modified.

Members:

Members Description

AUX_ID_PLUGOUT Accessory device is plugged out

AUX_ID_EARPHONE Accessory device is plug in, and accessory device is earphone.

AUX_ID_KEY_PRESS KEY PRESS event.

AUX_ID_KEY_RELEASE KEY RELEASE event.

AUX_ID_UART Accessory device is plug in, and accessory device is UART.

AUX_ID_CLAM_OPEN Open the phone

phone

the

AUX_ID_CLAM_CLOSE Clip

AUX_MAX_ID Maximum number of accessory device.

3.4 Message

3.4.1 MSG_ID_AUX_PLUGIN

Description:

This primitive is used to notify AUX that the device is plugged in. (HISR->AUX task)

Local Parameter:

N/A

Reference:

N/A

3.4.2 MSG_ID_AUX_PLUGOUT

Description:

This primitive is used to notify AUX that the device is plugged out. (HISR->AUX task)

Local Parameter:

N/A

Reference:

N/A

3.4.3 MSG_ID_AUX_ID

Description:

This primitive is used to notify UEM what the accessory id is issued. (AUX task->UEM)

Local Parameter:

Name Type Description Ref.

Aux_id_struct struct AUX id See Below

Reference:

typedef struct {

LOCAL_PARA_HDR

AUX_ID aux_id;

} aux_id_struct;

4 Charge parameters

4.1 Overview

These parameters states boundary conditions and exception conditions for charging algorithm, such as the conditions, when the charge action should be stopped, when battery voltage is high, or when battery temperature is high, or when charge current is high and etc.

There are many const variables to describe these parameters, and these variables are made available for other modules by declaring “extern ” in batvalue.h.

Module

4.2 Library

custom\drv\misc_drv\{platform}

batvalue.h

chr_parameter.c

Variables

4.3 Const

4.3.1 GPIO configure for charge control/vibrator

Definition:

GPIO_CHRCTRL,

GPIO_VIBRATOR,

Parameters:

Parameter Description

to control charge or not

channel

GPIO_CHRCTRL GPIO

GPIO_VIBRATOR GPIO channel to control vibrator

Example:

/*use GPIO12 to control charge or not*/

const kal_uint8 GPIO_CHRCTRL = 12;

/*use GPIO15 to control vibrator*/

const kal_uint8 GPIO_VIBRATOR = 15;

Parameters

4.3.2 Battery/charge

Definition:

Typical_LI_BATTYPE,

Typical_NI_BATTYPE,

ICHARGE_TBD,

BATTMP_0C,

BATTMP_45C,

MAX_VBAT_LI,

MAX_VBAT_NI,

CVPROTECT_HIGH,

CVPROTECT_LOW

Parameters:

Parameter Description

Typical_LI_BATTYPE Battery id voltage to check LI battery or NI battery. If phone doesn’t support Li and

NI-MH battery together, this value may be useless. unit: uV. For example, “the

value = 4000000” means “voltage = 4V”.

Typical_NI_BATTYPE Battery id voltage to check LI battery or NI battery. If phone doesn’t support Li and

NI-MH battery together, this value may be useless. unit: uV.

ICHARGE_TBD If measured charge current achieves this value, “over charge current” event is

issued. unit: uA.

BATTMP_0C The voltage value when battery temperature is 0℃. unit: uV.

BATTMP_45C The voltage value when battery temperature is 45℃. unit: uV.

MAX_VBAT_LI If measured battery(LI) voltage in charge mode archives this value, “over voltage

protect ” event is issued. unit: uV.

MAX_VBAT_NI If measured battery(NIMH) voltage in charge mode achieves this value, “over

voltage protect ” event is issued. unit: uV.

CVPROTECT_HIGH If measured battery(LI) voltage in charge mode achieves this value, and phone is in

talk mode, the charge action will automatically stop to protect the battery. unit: uV. CVPROTECT_LOW If measured battery(LI) voltage in charge mode achieves this value, and phone is in

talk mode, the charge action will automatically start again. unit: uV.

Example:

None

parameters

state

4.3.3 Charge

Definition:

CHVBATOFF,

CHARGE1_LI,

ICHARGE2_LI,

CHVBATOFF2_LI,

CHVBATTEMP_NI,

CHVBATOFF2_NI,

ICHARGE_HIGHLEVEL,

ICHARGE_LOWLEVEL,

PRE_TON,

PRE_TOFF,

TOPOFF_TON,

TOPOFF_TOFF,

BATFULL_TON_LI,

BATFULL_TOFF_LI,

BATFULL_TON_NI,

BATFULL_TOFF_NI,

BATFULL_TOFF,

BATHOLD_OFF,

Parameters:

Parameter Description

CHVBATOFF The battery voltage achieves this value when charge off, the charging algorithm

will enter charge Fast Mode.

CHARGE1_LI When battery is Li-Ion and the charge current is less than this value, the

charging algorithm will enter charge TOPOFF mode.

ICHARGE2_LI When battery is Li-Ion and the charge current is less than this value, the

charging algorithm will enter charge complete mode.

CHVBATOFF2_LI When battery is Li-Ion at charge complete mode, and the battery voltage is less

than this value, the charging algorithm will enter charge Fast mode. CHVBATTEMP_NI When battery is NiMH and the measured battery temperature is larger than this

temperature, the battery will enter charge complete mode.

CHVBATOFF2_NI When battery is NiMH at the charge complete mode, and the battery voltage is

less than this value, the charging algorithm will enter charge Fast mode. ICHARGE_HIGHLEVEL When battery is at charge Fast mode, this parameter and

ICHARGE_LOWLEVEL are used to expect the charge period. The period is

depended on TONOFFTABLE.

ICHARGE_LOWLEVEL When battery is at charge Fast mode, this parameter and

ICHARGE_HIGHLEVEL are used to expect the charge period. The period is

depended on TONOFFTABLE.

PRE_TON Charge on period in Pre charge mode.

PRE_TOFF Charge off period in Pre charge mode.

TOPOFF_TON Charge on period in TOPOFF charge mode.

TOPOFF_TOFF Charge off period in TOPOFF charge mode.

BATFULL_TON_NI Charge on period in BATFULL charge mode & charge is enabled. (NiMH) BATFULL_TOFF_NI Charge off period in BATFULL charge mode & charge is enabled. (NiMH) BATFULL_TOFF Charge off period in BATFULL charge mode & charge is disable. (Li&MiMH) BATHOLD_OFF Charge off period in charge hold mode.

Example:

const kal_int32 Typical_LI_BATTYPE = 1100000;

const kal_int32 Typical_NI_BATTYPE = 1100000;

const kal_int32 ICHARGE_TBD = 3000000;

const kal_int32 BATTMP_0C = -100000000;

const kal_int32 BATTMP_45C = 100000000;

const kal_int32 MAX_VBAT_LI = 4500000;

const kal_int32 MAX_VBAT_NI = 5500000;

const kal_int32 ICHARGE1_LI = 250000; /*250ma,FAST->TOPOFF*/

const kal_int32 ICHARGE2_LI = 60000; /*60ma,TOPOFF->BATFULL*/

const kal_int32 CHVBATOFF2_LI = 4100000; /*BATFULL->FAST*/

const kal_int32 CHVBATTEMP_NI = 100000000; /*50oC,FAST->BATFULL*/

const kal_int32 CHVBATOFF2_NI = 4100000;

const kal_int32 ICHARGE_HIGHLEVEL = 600000; /*600ma,for table search*/

const kal_int32 ICHARGE_LOWLEVEL = 400000; /*400ma,for table search*/

const kal_int32 CHVBATOFF = 3400000;

const kal_int32 ICHARGE1_LI = 250000; /*250ma,FAST->TOPOFF*/

const kal_int32 ICHARGE2_LI = 60000; /*60ma,TOPOFF->BATFULL*/

const kal_int32 CHVBATOFF2_LI = 4100000; /*BATFULL->FAST*/

const kal_int32 CHVBATTEMP_NI = 100000000; /*50oC,FAST->BATFULL*/

const kal_int32 CHVBATOFF2_NI = 4100000;

const kal_int32 ICHARGE_HIGHLEVEL = 600000; /*600ma,for table search*/

const kal_int32 ICHARGE_LOWLEVEL = 400000; /*400ma,for table search*/

const kal_int32 CVPROTECT_HIGH = 4050000;

const kal_int32 CVPROTECT_LOW = 3800000;

/*Time delay*/

/* PRE CHARGE ,search table*/

/*TON = 3s,TOFF=2s*/

const kal_uint32 PRE_TON = 3;

const kal_uint32 PRE_TOFF = 2;

/* FAST CHARGE ,search table*/

/*TON = 3s,TOFF=0s*/

const kal_uint32 TOPOFF_TON = 3;

const kal_uint32 TOPOFF_TOFF = 0;

const kal_uint32 BATFULL_TON_NI = 1; /*unit : second*/

const kal_uint32 BATFULL_TOFF_NI = 9;

const kal_uint32 BATFULL_TOFF = 6;

const kal_uint32 BATHOLD_OFF = 10;

parameters

4.3.4 Measured

Overview:

These parameters are used to translate the ADC values got from auxiliary ADC units into real voltages values and to calculate the charging current. The ADC is calibrated based on a linear relation assumption between ADC readings and the real voltage level.

Definition:

adc_cali_param,

adc_volt_factor,

CurrOffset,

ADC_ISENSE_RESISTANCE_FACTOR

Parameters:

Parameter Description

ADC calibration parameters specify the

structure,

adc_cali_param ADC_CALIDATA

adc_slop & adc_offset parameters.

adc_volt_factor The ADC calibration is dependent on the voltage of battery. Therefore, the

measured voltage should be multiplied with this factor.

CurrOffset The measured charge current is “Battery current” + “ baseband (BB)

current”. This parameter specifies the BB current.

ADC_ISENSE_RESISTANCE_FACTOR When evaluate the current, the resistance must divide the difference of two

voltages. The parameter is equal to “1/R”.

Note that: The measure voltage will be: V= (adc_slop*adc_value+adc_offset) * adc_volt_factor.

The measured current will be (V1-V2)/R = (V1-V2)* ADC_ISENSE_RESISTANCE_FACTOR

The actual battery charge current will be (V1-V2)* ADC_ISENSE_RESISTANCE_FACTOR – CurrOffset

Example:

const kal_uint16 ADC_ISENSE_RESISTANCE_FACTOR = 3; /*1/0.3333*/

ADC_CALIDATA adc_cali_param =

{

{

5369,

5369,

5369,

5369,

5369

},

{

(60428),

(60428),

(60428),

(60428),

(60428)

}

};

const kal_uint16 adc_volt_factor[ADC_MAX_CHANNEL] = {

100, /* = 100% */

50, /* = 50% */

50, /* = 50% */

100, /* = 100% */

250 /* = 250% */

};

const kal_int32 CurrOffset[3] = /*Only support 3 state, if don’t support any state, just specify the same value*/ {

100000, //100ma

100000,

100000

};

5 EINT parameters

5.1 Overview

These parameters define the assignment for each external interrupt.

Module

5.2 Library

custom\drv\misc_drv\{platform}

eint_def.c

5.3 Definition

AUX_EINT_NO

CHRDET_EINT_NO

MELODY_EINT_NO

Parameters:

Parameter Description

AUX_EINT_NO The external interrupt channel number for accessory id check CHRDET_EINT_NO The external interrupt channel number for charger detection. MELODY_EINT_NO The external interrupt channel number for melody Example:

const kal_uint8 AUX_EINT_NO = 0; /*EINT Channel 0 is for accessory id check */ const kal_uint8 CHRDET_EINT_NO = 1; /*EINT Channel 1 is for charger detection */

const kal_uint8 MELODY_EINT_NO = 2; /*EINT Channel 2 is for melody */

6 Keypad parameters

6.1 Overview

These parameters define the assignment of the physical keypad scan table. The keypad array varies according the physical layout.

6.2 Library Module

custom\drv\misc_drv\{platform}

keypad_def.c

Example :

#define DEVICE_KEY_0 0

#define DEVICE_KEY_1 1

#define DEVICE_KEY_2 2

#define DEVICE_KEY_3 3

#define DEVICE_KEY_4 4

#define DEVICE_KEY_5 5

#define DEVICE_KEY_6 6

#define DEVICE_KEY_7 7

#define DEVICE_KEY_8 8

#define DEVICE_KEY_9 9

#define DEVICE_KEY_STAR 10

#define DEVICE_KEY_HASH 11

#define DEVICE_KEY_VOL_UP 12

#define DEVICE_KEY_VOL_DOWN 13

#define DEVICE_KEY_UP 14

#define DEVICE_KEY_DOWN 15

#define DEVICE_KEY_LEFT 16

#define DEVICE_KEY_RIGHT 17

#define DEVICE_KEY_MENU 18

#define DEVICE_KEY_FUNCTION 19

#define DEVICE_KEY_SK_LEFT 20

#define DEVICE_KEY_SK_RIGHT 21

#define DEVICE_KEY_SEND 22

#define DEVICE_KEY_END 23

#define DEVICE_KEY_POWER 24

#define DEVICE_KEY_CLEAR 25

#define MAX_DEVICE_KEYS 26

const kal_uint8 keypad[32] =

{

/* row 0 */

DEVICE_KEY_SK_LEFT, //0x43,/*pw*/

DEVICE_KEY_SK_RIGHT, //0x5e,/*send*/ DEVICE_KEY_SEND, //0x61,/*clear*/ DEVICE_KEY_END, //0x56,/*end*/ DEVICE_KEY_MENU, //0x45,/* */

/* row 1 */

DEVICE_KEY_UP, //0x2d,/*up*/

DEVICE_KEY_1, //0x31,/*1*/

DEVICE_KEY_2, //0x32,/*2*/

DEVICE_KEY_3, //0x33,/*3*/

DEVICE_KEY_LEFT, /* */

/* row 2 */

DEVICE_KEY_DOWN, //0x62,/*down*/ DEVICE_KEY_4, //0x34,/*4*/

DEVICE_KEY_5, //0x35,/*5*/

DEVICE_KEY_6, //0x36,/*6*/

DEVICE_KEY_RIGHT, /* */

/* row 3 */

DEVICE_KEY_VOL_UP, //0xFE,/*shift*/ DEVICE_KEY_7,//0x37, /*7*/

DEVICE_KEY_8,//0x38, /*8*/

DEVICE_KEY_9,//0x39, /*9*/

DEVICE_KEY_FUNCTION, /* */

/* row 4 */

DEVICE_KEY_VOL_DOWN,//0xFE,/* */

DEVICE_KEY_STAR, //0x2a,/***/

DEVICE_KEY_0, //0x30,/*0*/

DEVICE_KEY_HASH, //0x23,/*#*/

DEVICE_KEY_CLEAR, /* */

/* row 5 */

0xFE,

0xFE,

0xFE,

0xFE,

0xFE,

0xFE,

0xFE

};

7 UART parameters

7.1 Overview

These parameters are used for defining the size of the UART ring buffers. For each UART port, there are three ring buffers, which are Rx ring buffer, Tx ring buffer and Tx ISR ring buffer. Tx ISR ring buffer is special for ISR usage to avoid race condition issues. If the UART is always busy for data transfer, you may increase the buffer length to prevent data overrun situation.

Module

7.2 Library

custom\drv\misc_drv\{platform}

uart_def.c

7.3 Definition

UART_RxRingBufferLength,

UART_TxRingBufferLength,

UART_TxRingBufferLength_ISR

Parameters:

Parameter Description

UART_RxRingBufferLength Rx ringbuffer length

UART_TxRingBufferLength Tx ringbuffer length

UART_TxRingBufferLength_ISR Tx isr ringbuffer length

Example:

const kal_uint16 UART_RxRingBufferLength[MAX_UART_PORT_NUM] = {

2048, /*UART1*/

2048, /*UART2*/

};

const kal_uint16 UART_TxRingBufferLength[MAX_UART_PORT_NUM] = {

2048, /*UART1*/

2048, /*UART2*/

};

const kal_uint16 UART_TxRingBufferLength_ISR[MAX_UART_PORT_NUM] = {

3072, /*UART1*/

3072, /*UART2*/

};

相关主题
文本预览
相关文档 最新文档