18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0+ */ 28c2ecf20Sopenharmony_ci/************************************************************************ 38c2ecf20Sopenharmony_ci * 48c2ecf20Sopenharmony_ci * io_edgeport.h Edgeport Linux Interface definitions 58c2ecf20Sopenharmony_ci * 68c2ecf20Sopenharmony_ci * Copyright (C) 2000 Inside Out Networks, Inc. 78c2ecf20Sopenharmony_ci * 88c2ecf20Sopenharmony_ci ************************************************************************/ 98c2ecf20Sopenharmony_ci 108c2ecf20Sopenharmony_ci#if !defined(_IO_EDGEPORT_H_) 118c2ecf20Sopenharmony_ci#define _IO_EDGEPORT_H_ 128c2ecf20Sopenharmony_ci 138c2ecf20Sopenharmony_ci 148c2ecf20Sopenharmony_ci#define MAX_RS232_PORTS 8 /* Max # of RS-232 ports per device */ 158c2ecf20Sopenharmony_ci 168c2ecf20Sopenharmony_ci/* typedefs that the insideout headers need */ 178c2ecf20Sopenharmony_ci#ifndef LOW8 188c2ecf20Sopenharmony_ci #define LOW8(a) ((unsigned char)(a & 0xff)) 198c2ecf20Sopenharmony_ci#endif 208c2ecf20Sopenharmony_ci#ifndef HIGH8 218c2ecf20Sopenharmony_ci #define HIGH8(a) ((unsigned char)((a & 0xff00) >> 8)) 228c2ecf20Sopenharmony_ci#endif 238c2ecf20Sopenharmony_ci 248c2ecf20Sopenharmony_ci#ifndef __KERNEL__ 258c2ecf20Sopenharmony_ci#define __KERNEL__ 268c2ecf20Sopenharmony_ci#endif 278c2ecf20Sopenharmony_ci 288c2ecf20Sopenharmony_ci#include "io_usbvend.h" 298c2ecf20Sopenharmony_ci 308c2ecf20Sopenharmony_ci 318c2ecf20Sopenharmony_ci 328c2ecf20Sopenharmony_ci/* The following table is used to map the USBx port number to 338c2ecf20Sopenharmony_ci * the device serial number (or physical USB path), */ 348c2ecf20Sopenharmony_ci#define MAX_EDGEPORTS 64 358c2ecf20Sopenharmony_ci 368c2ecf20Sopenharmony_cistruct comMapper { 378c2ecf20Sopenharmony_ci char SerialNumber[MAX_SERIALNUMBER_LEN+1]; /* Serial number/usb path */ 388c2ecf20Sopenharmony_ci int numPorts; /* Number of ports */ 398c2ecf20Sopenharmony_ci int Original[MAX_RS232_PORTS]; /* Port numbers set by IOCTL */ 408c2ecf20Sopenharmony_ci int Port[MAX_RS232_PORTS]; /* Actual used port numbers */ 418c2ecf20Sopenharmony_ci}; 428c2ecf20Sopenharmony_ci 438c2ecf20Sopenharmony_ci 448c2ecf20Sopenharmony_ci#define EDGEPORT_CONFIG_DEVICE "/proc/edgeport" 458c2ecf20Sopenharmony_ci 468c2ecf20Sopenharmony_ci/* /proc/edgeport Interface 478c2ecf20Sopenharmony_ci * This interface uses read/write/lseek interface to talk to the edgeport driver 488c2ecf20Sopenharmony_ci * the following read functions are supported: */ 498c2ecf20Sopenharmony_ci#define PROC_GET_MAPPING_TO_PATH 1 508c2ecf20Sopenharmony_ci#define PROC_GET_COM_ENTRY 2 518c2ecf20Sopenharmony_ci#define PROC_GET_EDGE_MANUF_DESCRIPTOR 3 528c2ecf20Sopenharmony_ci#define PROC_GET_BOOT_DESCRIPTOR 4 538c2ecf20Sopenharmony_ci#define PROC_GET_PRODUCT_INFO 5 548c2ecf20Sopenharmony_ci#define PROC_GET_STRINGS 6 558c2ecf20Sopenharmony_ci#define PROC_GET_CURRENT_COM_MAPPING 7 568c2ecf20Sopenharmony_ci 578c2ecf20Sopenharmony_ci/* The parameters to the lseek() for the read is: */ 588c2ecf20Sopenharmony_ci#define PROC_READ_SETUP(Command, Argument) ((Command) + ((Argument)<<8)) 598c2ecf20Sopenharmony_ci 608c2ecf20Sopenharmony_ci 618c2ecf20Sopenharmony_ci/* the following write functions are supported: */ 628c2ecf20Sopenharmony_ci#define PROC_SET_COM_MAPPING 1 638c2ecf20Sopenharmony_ci#define PROC_SET_COM_ENTRY 2 648c2ecf20Sopenharmony_ci 658c2ecf20Sopenharmony_ci 668c2ecf20Sopenharmony_ci/* The following structure is passed to the write */ 678c2ecf20Sopenharmony_cistruct procWrite { 688c2ecf20Sopenharmony_ci int Command; 698c2ecf20Sopenharmony_ci union { 708c2ecf20Sopenharmony_ci struct comMapper Entry; 718c2ecf20Sopenharmony_ci int ComMappingBasedOnUSBPort; /* Boolean value */ 728c2ecf20Sopenharmony_ci } u; 738c2ecf20Sopenharmony_ci}; 748c2ecf20Sopenharmony_ci 758c2ecf20Sopenharmony_ci/* 768c2ecf20Sopenharmony_ci * Product information read from the Edgeport 778c2ecf20Sopenharmony_ci */ 788c2ecf20Sopenharmony_cistruct edgeport_product_info { 798c2ecf20Sopenharmony_ci __u16 ProductId; /* Product Identifier */ 808c2ecf20Sopenharmony_ci __u8 NumPorts; /* Number of ports on edgeport */ 818c2ecf20Sopenharmony_ci __u8 ProdInfoVer; /* What version of structure is this? */ 828c2ecf20Sopenharmony_ci 838c2ecf20Sopenharmony_ci __u32 IsServer :1; /* Set if Server */ 848c2ecf20Sopenharmony_ci __u32 IsRS232 :1; /* Set if RS-232 ports exist */ 858c2ecf20Sopenharmony_ci __u32 IsRS422 :1; /* Set if RS-422 ports exist */ 868c2ecf20Sopenharmony_ci __u32 IsRS485 :1; /* Set if RS-485 ports exist */ 878c2ecf20Sopenharmony_ci __u32 IsReserved :28; /* Reserved for later expansion */ 888c2ecf20Sopenharmony_ci 898c2ecf20Sopenharmony_ci __u8 RomSize; /* Size of ROM/E2PROM in K */ 908c2ecf20Sopenharmony_ci __u8 RamSize; /* Size of external RAM in K */ 918c2ecf20Sopenharmony_ci __u8 CpuRev; /* CPU revision level (chg only if s/w visible) */ 928c2ecf20Sopenharmony_ci __u8 BoardRev; /* PCB revision level (chg only if s/w visible) */ 938c2ecf20Sopenharmony_ci 948c2ecf20Sopenharmony_ci __u8 BootMajorVersion; /* Boot Firmware version: xx. */ 958c2ecf20Sopenharmony_ci __u8 BootMinorVersion; /* yy. */ 968c2ecf20Sopenharmony_ci __le16 BootBuildNumber; /* zzzz (LE format) */ 978c2ecf20Sopenharmony_ci 988c2ecf20Sopenharmony_ci __u8 FirmwareMajorVersion; /* Operational Firmware version:xx. */ 998c2ecf20Sopenharmony_ci __u8 FirmwareMinorVersion; /* yy. */ 1008c2ecf20Sopenharmony_ci __le16 FirmwareBuildNumber; /* zzzz (LE format) */ 1018c2ecf20Sopenharmony_ci 1028c2ecf20Sopenharmony_ci __u8 ManufactureDescDate[3]; /* MM/DD/YY when descriptor template was compiled */ 1038c2ecf20Sopenharmony_ci __u8 HardwareType; 1048c2ecf20Sopenharmony_ci 1058c2ecf20Sopenharmony_ci __u8 iDownloadFile; /* What to download to EPiC device */ 1068c2ecf20Sopenharmony_ci __u8 EpicVer; /* What version of EPiC spec this device supports */ 1078c2ecf20Sopenharmony_ci 1088c2ecf20Sopenharmony_ci struct edge_compatibility_bits Epic; 1098c2ecf20Sopenharmony_ci}; 1108c2ecf20Sopenharmony_ci 1118c2ecf20Sopenharmony_ci/* 1128c2ecf20Sopenharmony_ci * Edgeport Stringblock String locations 1138c2ecf20Sopenharmony_ci */ 1148c2ecf20Sopenharmony_ci#define EDGESTRING_MANUFNAME 1 /* Manufacture Name */ 1158c2ecf20Sopenharmony_ci#define EDGESTRING_PRODNAME 2 /* Product Name */ 1168c2ecf20Sopenharmony_ci#define EDGESTRING_SERIALNUM 3 /* Serial Number */ 1178c2ecf20Sopenharmony_ci#define EDGESTRING_ASSEMNUM 4 /* Assembly Number */ 1188c2ecf20Sopenharmony_ci#define EDGESTRING_OEMASSEMNUM 5 /* OEM Assembly Number */ 1198c2ecf20Sopenharmony_ci#define EDGESTRING_MANUFDATE 6 /* Manufacture Date */ 1208c2ecf20Sopenharmony_ci#define EDGESTRING_ORIGSERIALNUM 7 /* Serial Number */ 1218c2ecf20Sopenharmony_ci 1228c2ecf20Sopenharmony_cistruct string_block { 1238c2ecf20Sopenharmony_ci __u16 NumStrings; /* Number of strings in block */ 1248c2ecf20Sopenharmony_ci __u16 Strings[1]; /* Start of string block */ 1258c2ecf20Sopenharmony_ci}; 1268c2ecf20Sopenharmony_ci 1278c2ecf20Sopenharmony_ci 1288c2ecf20Sopenharmony_ci 1298c2ecf20Sopenharmony_ci#endif 130