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#define USERIAL_LINESPEED_600 600 58#define USERIAL_LINESPEED_1200 1200 59#define USERIAL_LINESPEED_2400 2400 60#define USERIAL_LINESPEED_9600 9600 61#define USERIAL_LINESPEED_19200 19200 62#define USERIAL_LINESPEED_57600 57600 63#define USERIAL_LINESPEED_115200 115200 64#define USERIAL_LINESPEED_230400 230400 65#define USERIAL_LINESPEED_460800 460800 66#define USERIAL_LINESPEED_921600 921600 67#define USERIAL_LINESPEED_1M 1000000 68#define USERIAL_LINESPEED_1_5M 1500000 69#define USERIAL_LINESPEED_2M 2000000 70#define USERIAL_LINESPEED_3M 3000000 71#define USERIAL_LINESPEED_4M 4000000 72 73/**** Data Format ****/ 74/* Stop Bits */ 75#define USERIAL_STOPBITS_1 1 76#define USERIAL_STOPBITS_1_5 (1 << 1) 77#define USERIAL_STOPBITS_2 (1 << 2) 78 79/* Parity Bits */ 80#define USERIAL_PARITY_NONE (1 << 3) 81#define USERIAL_PARITY_EVEN (1 << 4) 82#define USERIAL_PARITY_ODD (1 << 5) 83 84/* Data Bits */ 85#define USERIAL_DATABITS_5 (1 << 6) 86#define USERIAL_DATABITS_6 (1 << 7) 87#define USERIAL_DATABITS_7 (1 << 8) 88#define USERIAL_DATABITS_8 (1 << 9) 89 90#if (BT_WAKE_VIA_USERIAL_IOCTL == TRUE) 91/* These are the ioctl values used for bt_wake ioctl via UART driver. you may 92 * need to redefine them on you platform! 93 * Logically they need to be unique and not colide with existing uart ioctl's. 94 */ 95#ifndef USERIAL_IOCTL_BT_WAKE_ASSERT 96#define USERIAL_IOCTL_BT_WAKE_ASSERT 0x8003 97#endif 98#ifndef USERIAL_IOCTL_BT_WAKE_DEASSERT 99#define USERIAL_IOCTL_BT_WAKE_DEASSERT 0x8004 100#endif 101#ifndef USERIAL_IOCTL_BT_WAKE_GET_ST 102#define USERIAL_IOCTL_BT_WAKE_GET_ST 0x8005 103#endif 104#endif // (BT_WAKE_VIA_USERIAL_IOCTL==TRUE) 105 106/****************************************************************************** 107** Type definitions 108******************************************************************************/ 109 110/* Structure used to configure serial port during open */ 111typedef struct { 112 uint16_t fmt; /* Data format */ 113 uint8_t baud; /* Baud rate */ 114} tUSERIAL_CFG; 115 116typedef enum { 117#if (BT_WAKE_VIA_USERIAL_IOCTL == TRUE) 118 USERIAL_OP_ASSERT_BT_WAKE, 119 USERIAL_OP_DEASSERT_BT_WAKE, 120 USERIAL_OP_GET_BT_WAKE_STATE, 121#endif 122 USERIAL_OP_NOP, 123} userial_vendor_ioctl_op_t; 124 125/****************************************************************************** 126** Extern variables and functions 127******************************************************************************/ 128 129/****************************************************************************** 130** Functions 131******************************************************************************/ 132 133/******************************************************************************* 134** 135** Function userial_vendor_init 136** 137** Description Initialize userial vendor-specific control block 138** 139** Returns None 140** 141*******************************************************************************/ 142void userial_vendor_init(void); 143 144/******************************************************************************* 145** 146** Function userial_vendor_open 147** 148** Description Open the serial port with the given configuration 149** 150** Returns device fd 151** 152*******************************************************************************/ 153int userial_vendor_open(tUSERIAL_CFG *p_cfg); 154 155/******************************************************************************* 156** 157** Function userial_vendor_close 158** 159** Description Conduct vendor-specific close work 160** 161** Returns None 162** 163*******************************************************************************/ 164void userial_vendor_close(void); 165 166/******************************************************************************* 167** 168** Function userial_vendor_set_baud 169** 170** Description Set new baud rate 171** 172** Returns None 173** 174*******************************************************************************/ 175void userial_vendor_set_baud(uint8_t userial_baud); 176 177/******************************************************************************* 178** 179** Function userial_vendor_ioctl 180** 181** Description ioctl inteface 182** 183** Returns None 184** 185*******************************************************************************/ 186void userial_vendor_ioctl(userial_vendor_ioctl_op_t op, void *p_data); 187 188#endif /* USERIAL_VENDOR_H */ 189