| 1 |
/* Hey EMACS -*- linux-c -*- */ |
| 2 |
/* $Id$ */ |
| 3 |
|
| 4 |
/* libticables2 - link cable library, a part of the TiLP project |
| 5 |
* Copyright (C) 1999-2005 Romain Lievin |
| 6 |
* |
| 7 |
* This program is free software; you can redistribute it and/or modify |
| 8 |
* it under the terms of the GNU General Public License as published by |
| 9 |
* the Free Software Foundation; either version 2 of the License, or |
| 10 |
* (at your option) any later version. |
| 11 |
* |
| 12 |
* This program is distributed in the hope that it will be useful, |
| 13 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 |
* GNU General Public License for more details. |
| 16 |
* |
| 17 |
* You should have received a copy of the GNU General Public License |
| 18 |
* along with this program; if not, write to the Free Software Foundation, |
| 19 |
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 20 |
*/ |
| 21 |
|
| 22 |
/* Initialize the LinkCable structure with default functions */ |
| 23 |
/* This module can be used as sample code.*/ |
| 24 |
|
| 25 |
#ifdef HAVE_CONFIG_H |
| 26 |
#include <config.h> |
| 27 |
#endif |
| 28 |
|
| 29 |
#include <stdio.h> |
| 30 |
#include <stdint.h> |
| 31 |
|
| 32 |
#include "ticables.h" |
| 33 |
#include "gettext.h" |
| 34 |
#include "internal.h" |
| 35 |
|
| 36 |
int noop_prepare(CableHandle *h) |
| 37 |
{ |
| 38 |
(void)h; |
| 39 |
return 0; |
| 40 |
} |
| 41 |
|
| 42 |
int noop_probe(CableHandle *h) |
| 43 |
{ |
| 44 |
(void)h; |
| 45 |
return 0; |
| 46 |
} |
| 47 |
|
| 48 |
int noop_open(CableHandle *h) |
| 49 |
{ |
| 50 |
(void)h; |
| 51 |
return 0; |
| 52 |
} |
| 53 |
|
| 54 |
int noop_close(CableHandle *h) |
| 55 |
{ |
| 56 |
(void)h; |
| 57 |
return 0; |
| 58 |
} |
| 59 |
|
| 60 |
int noop_reset(CableHandle *h) |
| 61 |
{ |
| 62 |
(void)h; |
| 63 |
return 0; |
| 64 |
} |
| 65 |
|
| 66 |
int noop_put(CableHandle *h, uint8_t *data, uint32_t len) |
| 67 |
{ |
| 68 |
(void)h, (void)data, (void)len; |
| 69 |
return 0; |
| 70 |
} |
| 71 |
|
| 72 |
int noop_get(CableHandle *h, uint8_t *data, uint32_t len) |
| 73 |
{ |
| 74 |
(void)h, (void)data, (void)len; |
| 75 |
return 0; |
| 76 |
} |
| 77 |
|
| 78 |
int noop_check(CableHandle *h, int *status) |
| 79 |
{ |
| 80 |
(void)h; |
| 81 |
*status = STATUS_NONE; |
| 82 |
return 0; |
| 83 |
} |
| 84 |
|
| 85 |
int noop_set_red_wire(CableHandle *h, int b) |
| 86 |
{ |
| 87 |
(void)h, (void)b; |
| 88 |
return 0; |
| 89 |
} |
| 90 |
|
| 91 |
int noop_set_white_wire(CableHandle *h, int b) |
| 92 |
{ |
| 93 |
(void)h, (void)b; |
| 94 |
return 0; |
| 95 |
} |
| 96 |
|
| 97 |
int noop_get_red_wire(CableHandle *h) |
| 98 |
{ |
| 99 |
(void)h; |
| 100 |
return 1; |
| 101 |
} |
| 102 |
|
| 103 |
int noop_get_white_wire(CableHandle *h) |
| 104 |
{ |
| 105 |
(void)h; |
| 106 |
return 1; |
| 107 |
} |
| 108 |
|
| 109 |
int noop_set_device(CableHandle *h, const char * device) |
| 110 |
{ |
| 111 |
(void)h, (void)device; |
| 112 |
return 0; |
| 113 |
} |
| 114 |
|
| 115 |
extern const CableFncts cable_nul = |
| 116 |
{ |
| 117 |
CABLE_NUL, |
| 118 |
"NUL", |
| 119 |
N_("Dummy link"), |
| 120 |
N_("Dummy link used when no cable is set"), |
| 121 |
0, |
| 122 |
&noop_prepare, |
| 123 |
&noop_open, &noop_close, &noop_reset, &noop_probe, NULL, |
| 124 |
&noop_put, &noop_get, &noop_check, |
| 125 |
&noop_set_red_wire, &noop_set_white_wire, |
| 126 |
&noop_get_red_wire, &noop_get_white_wire, |
| 127 |
NULL, NULL, |
| 128 |
&noop_set_device, |
| 129 |
NULL |
| 130 |
}; |
| 131 |
|
| 132 |
/* no const ! */ CableFncts cable_ilp = |
| 133 |
{ |
| 134 |
CABLE_ILP, |
| 135 |
"ILP", |
| 136 |
N_("Dummy link for TiEmu"), |
| 137 |
N_("Internal Link Port cable for TiEmu (internal use)"), |
| 138 |
!0, |
| 139 |
&noop_prepare, |
| 140 |
&noop_open, &noop_close, &noop_reset, &noop_probe, NULL, |
| 141 |
&noop_put, &noop_get, &noop_check, |
| 142 |
&noop_set_red_wire, &noop_set_white_wire, |
| 143 |
&noop_get_red_wire, &noop_get_white_wire, |
| 144 |
NULL, NULL, |
| 145 |
&noop_set_device, |
| 146 |
NULL |
| 147 |
}; |