/usr/include/tilp2/ticables.h is in libticables-dev 1.3.4+dfsg-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 | /* Hey EMACS -*- linux-c -*- */
/* $Id$ */
/* libticables2 - link cable library, a part of the TiLP project
* Copyright (C) 1999-2005 Romain Lievin
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef __TICABLES__
#define __TICABLES__
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include "stdints1.h"
#include "export1.h"
#include "timeout.h"
#ifdef __cplusplus
extern "C" {
#endif
/***********************/
/* Types & Definitions */
/***********************/
/* Versioning */
#ifdef __WIN32__
# define libticables2_VERSION "1.3.4"
#else
# define libticables2_VERSION VERSION
#endif
/* Types */
#define DFLT_TIMEOUT 15 /* 1.5 second */
#define DFLT_DELAY 10 /* 10 micro-seconds */
#define ERROR_READ_TIMEOUT 4 /* fixed in error.h */
#define ERROR_WRITE_TIMEOUT 6 /* fixed in error.h */
/**
* CableModel:
*
* An enumeration which contains the following cable types:
**/
typedef enum
{
CABLE_NUL = 0,
CABLE_GRY, CABLE_BLK, CABLE_PAR, CABLE_SLV, CABLE_USB,
CABLE_VTI, CABLE_TIE, CABLE_ILP, CABLE_DEV,
CABLE_MAX,
} CableModel;
/**
* CablePort:
*
* An enumeration which contains the following ports:
**/
typedef enum
{
PORT_0 = 0,
PORT_1, PORT_2, PORT_3, PORT_4,
} CablePort;
/**
* UsbPid:
*
* An enumeration which contains the following devices:
**/
typedef enum
{
PID_UNKNOWN = 0,
PID_TIGLUSB = 0xE001,
PID_TI89TM = 0xE004,
PID_TI84P = 0xE003,
PID_TI84P_SE = 0xE008,
PID_NSPIRE = 0xE012,
} UsbPid;
/**
* CableStatus:
*
* An enumeration which contains the following values:
**/
typedef enum
{
STATUS_NONE = 0,
STATUS_RX = 1,
STATUS_TX = 2,
} CableStatus;
/**
* ProbingMethod:
*
* Defines how to probe cables:
**/
typedef enum
{
PROBE_NONE = 0,
PROBE_FIRST = 1,
PROBE_USB = 2,
PROBE_DBUS = 4,
PROBE_ALL = 6,
} ProbingMethod;
/**
* DataRate:
* @count: number of bytes transferred
* @start: the time when transfer started
* @current: free of use
* @stop: the time when transfer finished
*
* A structure used for benchmarks.
* !!! This structure is for private use !!!
**/
typedef struct
{
int count;
tiTIME start;
tiTIME current;
tiTIME stop;
} DataRate;
typedef struct _CableFncts CableFncts;
typedef struct _CableHandle CableHandle;
/**
* Cable:
* @model: link cable model (CableModel).
* @name: name of cable like "SER"
* @fullname: complete name of cable like "BlackLink"
* @description: description of cable like "serial cable"
* @need_open: set if cable need to be 'open'/'close' before calling 'probe'
* @prepare: detect and map I/O
* @probe: check for cable presence
* @timeout: used to update timeout
* @open: open I/O port or device
* @close: close I/O port or device
* @reset: reset I/O port or device
* @send: send data onto the cable
* @recv: recv data from cable
* @check: check for data arrival
* @set_d0: set D0/red wire
* @set_d1: set D1/white wire
* @get_d0 get D0/red wire
* @get_d1 set D1/red wire
* @set_raw: set both wires
* @get_raw: read both wires
*
* A structure used for handling a link cable.
* !!! This structure is for private use !!!
**/
struct _CableFncts
{
const int model;
const char* name;
const char* fullname;
const char* description;
const int need_open;
int (*prepare) (CableHandle *);
int (*open) (CableHandle *);
int (*close) (CableHandle *);
int (*reset) (CableHandle *);
int (*probe) (CableHandle *);
int (*timeout) (CableHandle *);
int (*send) (CableHandle *, uint8_t *, uint32_t);
int (*recv) (CableHandle *, uint8_t *, uint32_t);
int (*check) (CableHandle *, int *);
int (*set_d0) (CableHandle *, int);
int (*set_d1) (CableHandle *, int);
int (*get_d0) (CableHandle *);
int (*get_d1) (CableHandle *);
int (*set_raw) (CableHandle *, int);
int (*get_raw) (CableHandle *, int *);
};
/**
* CableHandle:
* @model: cable model
* @port: generic port
* @timeout: timeout value in 0.1 seconds
* @delay: inter-bit delay for serial/parallel cable in µs
* @device: device name like COMx or ttySx (if used)
* @address: I/O base address of device (if used)
* @cable: a Cable structure used by this handle
* @rate: data rate during transfers
* @priv: opaque data for internal/private use (static)
* @priv2: idem (allocated)
* @priv3: idem (static)
* @open: set if cable has been open
* @busy: set if cable is busy
*
* A structure used to store information as an handle.
* !!! This structure is for private use !!!
**/
struct _CableHandle
{
CableModel model;
CablePort port;
unsigned int timeout;
unsigned int delay;
char * device;
unsigned int address;
CableFncts* cable;
DataRate rate;
void* priv;
void* priv2;
void* priv3;
int open;
int busy;
};
/**
* CableOptions:
* @cable_model: model
* @cable_port: port
* @cable_timeout: timeout in tenth of seconds
* @cable_delay: inter-bit delay in µs
* @calc_model: calculator model
*
* A convenient structure free of use by the user.
**/
typedef struct
{
CableModel model;
CablePort port;
int timeout;
int delay;
int calc; // unused
} CableOptions;
// namespace scheme: library_class_function like ticables_fext_get
/****************/
/* Entry points */
/****************/
TIEXPORT1 int TICALL ticables_library_init(void);
TIEXPORT1 int TICALL ticables_library_exit(void);
/*********************/
/* General functions */
/*********************/
// ticables.c
TIEXPORT1 const char* TICALL ticables_version_get (void);
TIEXPORT1 CableHandle* TICALL ticables_handle_new(CableModel, CablePort);
TIEXPORT1 int TICALL ticables_handle_del(CableHandle*);
TIEXPORT1 int TICALL ticables_options_set_timeout(CableHandle*, int);
TIEXPORT1 int TICALL ticables_options_set_delay(CableHandle*, int);
TIEXPORT1 CableModel TICALL ticables_get_model(CableHandle*);
TIEXPORT1 CablePort TICALL ticables_get_port(CableHandle*);
TIEXPORT1 int TICALL ticables_handle_show(CableHandle*);
// link_xxx.c
TIEXPORT1 int TICALL ticables_cable_open(CableHandle*);
TIEXPORT1 int TICALL ticables_cable_close(CableHandle*);
TIEXPORT1 int TICALL ticables_cable_reset(CableHandle* handle);
TIEXPORT1 int TICALL ticables_cable_probe(CableHandle*, int* result);
TIEXPORT1 int TICALL ticables_cable_send(CableHandle*, uint8_t *data, uint32_t len);
TIEXPORT1 int TICALL ticables_cable_recv(CableHandle*, uint8_t *data, uint32_t len);
TIEXPORT1 int TICALL ticables_cable_check(CableHandle*, CableStatus*);
TIEXPORT1 int TICALL ticables_cable_set_d0(CableHandle*, int state);
TIEXPORT1 int TICALL ticables_cable_set_d1(CableHandle*, int state);
TIEXPORT1 int TICALL ticables_cable_get_d0(CableHandle*);
TIEXPORT1 int TICALL ticables_cable_get_d1(CableHandle*);
TIEXPORT1 int TICALL ticables_cable_set_raw(CableHandle*, int state);
TIEXPORT1 int TICALL ticables_cable_get_raw(CableHandle*, int *state);
TIEXPORT1 int TICALL ticables_progress_reset(CableHandle*);
TIEXPORT1 int TICALL ticables_progress_get(CableHandle*, int* count, int* msec, float* rate);
TIEXPORT1 int TICALL ticables_cable_put(CableHandle*, uint8_t data);
TIEXPORT1 int TICALL ticables_cable_get(CableHandle*, uint8_t *data);
// error.c
TIEXPORT1 int TICALL ticables_error_get (int number, char **message);
// type2str.c
TIEXPORT1 const char* TICALL ticables_model_to_string(CableModel model);
TIEXPORT1 CableModel TICALL ticables_string_to_model (const char *str);
TIEXPORT1 const char* TICALL ticables_port_to_string(CablePort port);
TIEXPORT1 CablePort TICALL ticables_string_to_port(const char *str);
TIEXPORT1 const char* TICALL ticables_usbpid_to_string(UsbPid pid);
TIEXPORT1 UsbPid TICALL ticables_string_to_usbpid(const char *str);
// probe.c
TIEXPORT1 int TICALL ticables_probing_do(int ***result, int timeout, ProbingMethod method);
TIEXPORT1 int TICALL ticables_probing_finish(int ***result);
TIEXPORT1 int TICALL ticables_is_usb_enabled(void);
TIEXPORT1 int TICALL ticables_get_usb_devices(int **array, int *len);
/************************/
/* Deprecated functions */
/************************/
#ifdef __cplusplus
}
#endif
#endif
|