1/****************************************************************************** 2 * 3 * Copyright (C) 2009-2012 Broadcom Corporation 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); 6 * you may not use this file except in compliance with the License. 7 * You may obtain a copy of the License at: 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 * 17 ******************************************************************************/ 18 19/****************************************************************************** 20 * 21 * Filename: userial_vendor.h 22 * 23 * Description: Contains vendor-specific definitions used in serial port 24 * controls 25 * 26 ******************************************************************************/ 27 28#ifndef USERIAL_VENDOR_H 29#define USERIAL_VENDOR_H 30 31#include "bt_vendor_brcm.h" 32#include "userial.h" 33 34/****************************************************************************** 35** Constants & Macros 36******************************************************************************/ 37 38/**** baud rates ****/ 39#define USERIAL_BAUD_300 0 40#define USERIAL_BAUD_600 1 41#define USERIAL_BAUD_1200 2 42#define USERIAL_BAUD_2400 3 43#define USERIAL_BAUD_9600 4 44#define USERIAL_BAUD_19200 5 45#define USERIAL_BAUD_57600 6 46#define USERIAL_BAUD_115200 7 47#define USERIAL_BAUD_230400 8 48#define USERIAL_BAUD_460800 9 49#define USERIAL_BAUD_921600 10 50#define USERIAL_BAUD_1M 11 51#define USERIAL_BAUD_1_5M 12 52#define USERIAL_BAUD_2M 13 53#define USERIAL_BAUD_3M 14 54#define USERIAL_BAUD_4M 15 55#define USERIAL_BAUD_AUTO 16 56 57/**** Data Format ****/ 58/* Stop Bits */ 59#define USERIAL_STOPBITS_1 1 60#define USERIAL_STOPBITS_1_5 (1<<1) 61#define USERIAL_STOPBITS_2 (1<<2) 62 63/* Parity Bits */ 64#define USERIAL_PARITY_NONE (1<<3) 65#define USERIAL_PARITY_EVEN (1<<4) 66#define USERIAL_PARITY_ODD (1<<5) 67 68/* Data Bits */ 69#define USERIAL_DATABITS_5 (1<<6) 70#define USERIAL_DATABITS_6 (1<<7) 71#define USERIAL_DATABITS_7 (1<<8) 72#define USERIAL_DATABITS_8 (1<<9) 73 74 75#if (BT_WAKE_VIA_USERIAL_IOCTL==TRUE) 76/* These are the ioctl values used for bt_wake ioctl via UART driver. you may 77 * need to redefine them on you platform! 78 * Logically they need to be unique and not colide with existing uart ioctl's. 79 */ 80#ifndef USERIAL_IOCTL_BT_WAKE_ASSERT 81#define USERIAL_IOCTL_BT_WAKE_ASSERT 0x8003 82#endif 83#ifndef USERIAL_IOCTL_BT_WAKE_DEASSERT 84#define USERIAL_IOCTL_BT_WAKE_DEASSERT 0x8004 85#endif 86#ifndef USERIAL_IOCTL_BT_WAKE_GET_ST 87#define USERIAL_IOCTL_BT_WAKE_GET_ST 0x8005 88#endif 89#endif // (BT_WAKE_VIA_USERIAL_IOCTL==TRUE) 90 91/****************************************************************************** 92** Type definitions 93******************************************************************************/ 94 95/* Structure used to configure serial port during open */ 96typedef struct 97{ 98 uint16_t fmt; /* Data format */ 99 uint8_t baud; /* Baud rate */ 100} tUSERIAL_CFG; 101 102typedef enum { 103#if (BT_WAKE_VIA_USERIAL_IOCTL==TRUE) 104 USERIAL_OP_ASSERT_BT_WAKE, 105 USERIAL_OP_DEASSERT_BT_WAKE, 106 USERIAL_OP_GET_BT_WAKE_STATE, 107#endif 108 USERIAL_OP_NOP, 109} userial_vendor_ioctl_op_t; 110 111/****************************************************************************** 112** Extern variables and functions 113******************************************************************************/ 114 115/****************************************************************************** 116** Functions 117******************************************************************************/ 118 119/******************************************************************************* 120** 121** Function userial_vendor_init 122** 123** Description Initialize userial vendor-specific control block 124** 125** Returns None 126** 127*******************************************************************************/ 128void userial_vendor_init(void); 129 130/******************************************************************************* 131** 132** Function userial_vendor_open 133** 134** Description Open the serial port with the given configuration 135** 136** Returns device fd 137** 138*******************************************************************************/ 139int userial_vendor_open(tUSERIAL_CFG *p_cfg); 140 141/******************************************************************************* 142** 143** Function userial_vendor_close 144** 145** Description Conduct vendor-specific close work 146** 147** Returns None 148** 149*******************************************************************************/ 150void userial_vendor_close(void); 151 152/******************************************************************************* 153** 154** Function userial_vendor_set_baud 155** 156** Description Set new baud rate 157** 158** Returns None 159** 160*******************************************************************************/ 161void userial_vendor_set_baud(uint8_t userial_baud); 162 163/******************************************************************************* 164** 165** Function userial_vendor_ioctl 166** 167** Description ioctl inteface 168** 169** Returns None 170** 171*******************************************************************************/ 172void userial_vendor_ioctl(userial_vendor_ioctl_op_t op, void *p_data); 173 174#endif /* USERIAL_VENDOR_H */ 175 176