blob: 8912b787c70e499ed104f05db6f20391ddfdd988 [file] [log] [blame]
yuezonghe824eb0c2024-06-27 02:32:26 -07001/***********************************************************************
2* Copyright (C) 2001, ZTE Corporation.
3*
4* File Name: drvs_io_sio.h
5* File Mark:
6* Description: sio define.
7* Others:
8* Version: 1.4.9
9* Author: wangxia
10* Date: 2010-04-2
11*
12* History 1:
13* Date:
14* Version:
15* Author:
16* Modification:
17
18* History 2:
19**********************************************************************/
20#include "drvs_io_keys.h"
21#ifndef _DRVS_SIO_H_
22#define _DRVS_SIO_H_
23
24/*************************************************************************
25 * Include files *
26 *************************************************************************/
27
28
29/*************************************************************************
30 * Macro *
31 *************************************************************************/
32
33/**************************************************************************
34 * Types *
35 **************************************************************************/
36
37typedef struct _T_ZDrvSio_DataConfig
38{
39 UINT32 baudrate;
40 UINT32 flowControl;
41 UINT8 dataBits;
42 UINT8 stopBits;
43 UINT8 parity;
44 UINT8 workMode;
45}T_ZDrvSio_DataConfig;
46
47
48typedef enum
49{
50 ZDRV_DEV_UART_FCTL_OFF,
51 ZDRV_DEV_UART_FCTL_SW,
52 ZDRV_DEV_UART_FCTL_HW
53}T_ZDrvSio_UartFlowCtrl_Types;
54
55typedef enum
56{
57 ZDRV_DEV_UART_PARITY_EVEN,
58 ZDRV_DEV_UART_PARITY_ODD,
59 ZDRV_DEV_UART_PARITY_NULL
60}T_ZDrvSio_UartParity_Types;
61
62typedef enum
63{
64 ZDRV_DEV_UART_MODE_CPU,
65 ZDRV_DEV_UART_MODE_DMA,
66 ZDRV_DEV_UART_MODE_NULL
67}T_ZDrvSio_UartWorkMode_Types;
68
69/*sio ioctl command*/
70typedef enum
71{
72 IOCTL_SIO_SET_DATA, /*set data config command,set baudrate.param:T_ZDrvSio_DataConfig*/
73 IOCTL_SIO_SET_BUFFER, /*set data buffer command,param:T_ZDrvSio_SetConfig */
74 IOCTL_SIO_CLEAN_BLOCK, /*clean the sio block read*/
75 IOCTL_SIO_CALLBACK, /*set sio non block callback function.param:T_ZDrvSio_Read_CallBack*/
76
77 IOCTL_SIO_CMD_MAX
78} T_ZDrvSio_IOCTL; /*sio ioctl command*/
79
80
81
82typedef struct _T_ZDrvUsbSio_SetConfig
83{
84
85 UINT8 endpoint;
86 UINT32 txBufferSize;
87 UINT32 rxBufferSize;
88 BOOL block;
89 UINT32 blocktime;
90
91}T_ZDrvUsbSio_SetConfig; /*usbsio use to config the param*/
92
93typedef struct _T_ZDrvSio_SetConfig
94{
95
96 UINT8 endpoint;
97 UINT32 txBufferSize;
98 UINT32 rxBufferSize;
99 BOOL block;
100 UINT32 blocktime;
101 T_ZDrvSio_DataConfig dataconfig;
102}T_ZDrvSio_SetConfig; /*usbsio use to config the param*/
103
104
105typedef struct _T_Sio_Dev_Hw
106{
107 VOID * regs;
108 T_ZDrvSio_DataConfig settings;
109 VOID * upLayerSet;
110
111}
112T_Sio_Dev_Hw;
113
114
115typedef struct _T_Sio_HalOpt
116{
117 SINT32 (*open)(UINT32 portNum,T_ZDrvSio_DataConfig * portConfig);
118 SINT32 (*read)(UINT32 portNum, UINT8* pBuf, UINT32 len);
119 SINT32 (*write)(UINT32 portNum, UINT8* pBuf, UINT32 len);
120 SINT32 (*close)(UINT32 portNum);
121 SINT32 (*ctrl)(UINT32 portNum,T_DRVIO_CTRL_KEY function, VOID* arg);
122}
123T_Sio_HalOpt;
124
125/**************************************************************************
126 * Global Variable *
127 **************************************************************************/
128
129/**************************************************************************
130 * Function Prototypes *
131 **************************************************************************/
132SINT32 zDrvSio_Install(UINT32 portNum, CHAR* name, T_Sio_HalOpt * pDevHalOpt);
133
134
135#endif/*_DRVS_SIO_H_ */
136
137
138