| Link cable management layer

### ticables_cable_open

TIEXPORT1 int TICALL ticables_cable_open(CableHandle* handle)

Attempt to open a connection on the cable with the parameters given with #ticables_handle_new().

handle : | a previously allocated handle
Return value : | 0 if successful, an error code otherwise.

### ticables_cable_reset

TIEXPORT1 int TICALL ticables_cable_reset(CableHandle* handle)

Reset link cable status (flush buffers, set ready).

handle : | a previously allocated handle
Return value : | 0 if successful, an error code otherwise.

### ticables_cable_probe

TIEXPORT1 int TICALL ticables_cable_probe(CableHandle* handle, int* result)

Attempt to probe if a cable is present. Open device if not opened.

handle : | a previously allocated handle
result : | cable found (!0) or not (0)
Return value : | 0 if successful, an error code otherwise.

### ticables_cable_close

TIEXPORT1 int TICALL ticables_cable_close(CableHandle* handle)

Attempt to close a connection on the cable with the parameters given with #ticables_handle_new().

handle : | a previously allocated handle
Return value : | 0 if successful, an error code otherwise.

### ticables_cable_send

TIEXPORT1 int TICALL ticables_cable_send(CableHandle* handle, uint8_t *data, uint32_t len)

Send %len bytes of the %data buffer from PC to hand-held.

handle : | a previously allocated handle
data : | buffer with data to send
len : | length of buffer
Return value : | 0 if successful, an error code otherwise.

### ticables_cable_put

TIEXPORT1 int TICALL ticables_cable_put(CableHandle* handle, uint8_t data)

Send one byte from PC to hand-held. Convenient function implemented for compatibility.

handle : | a previously allocated handle
data : | data to send
Return value : | 0 if successful, an error code otherwise.

### ticables_cable_recv

TIEXPORT1 int TICALL ticables_cable_recv(CableHandle* handle, uint8_t *data, uint32_t len)

Attempt to receive %len bytes from hand-held to PC.

handle : | a previously allocated handle
data : | buffer where data can be placed
len : | number of bytes requested
Return value : | 0 if successful, an error code otherwise.

### ticables_cable_get

TIEXPORT1 int TICALL ticables_cable_get(CableHandle* handle, uint8_t *data)

Receive one byte from hand-held to PC. Convenient function implemented for compatibility.

handle : | a previously allocated handle
data : | data to receive
Return value : | 0 if successful, an error code otherwise.

### ticables_cable_check

TIEXPORT1 int TICALL ticables_cable_check(CableHandle* handle, CableStatus *status)

Check for link cable status

handle : | a previously allocated handle
status : | status is placed here
Return value : | 0 if successful, an error code otherwise.

### ticables_cable_set_raw

TIEXPORT1 int TICALL ticables_cable_set_raw(CableHandle* handle, int state)

Set the raw cable state (if the hardware supports raw access.) An input of 3 is the default state; 2 means to pull the D0 ("red") line low; 1 means to pull the D1 ("white") line low; 0 means both (never used in the TI link protocol.)

handle : | a previously allocated handle
state : | bit mask of lines to pull low
Return value : | 0 if successful, an error code otherwise.

### ticables_cable_get_raw

TIEXPORT1 int TICALL ticables_cable_get_raw(CableHandle* handle, int *state)

Get the raw cable state (if the hardware supports raw access.) A bit set in the output means the line is high (1 for the D0 or "red" line, 2 for the D1 or "white" line.)

handle : | a previously allocated handle
state : | pointer to variable to store current state
Return value : | 0 if successful, an error code otherwise.

### ticables_cable_set_d0

TIEXPORT1 int TICALL ticables_cable_set_d0(CableHandle* handle, int state)

Set the electrical state of the D0 wire (if possible).

handle : | a previously allocated handle
state : | logical state (0 or 1) of D0 wire.
Return value : | 0 if successful, an error code otherwise.

### ticables_cable_set_d1

TIEXPORT1 int TICALL ticables_cable_set_d1(CableHandle* handle, int state)

Set the electrical state of the D1 wire (if possible).

handle : | a previously allocated handle
state : | logical state (0 or 1) of D1 wire.
Return value : | 0 if successful, an error code otherwise.

### ticables_cable_get_d0

TIEXPORT1 int TICALL ticables_cable_get_d0(CableHandle* handle)

Get the electrical state of the D0 wire (if possible).

handle : | a previously allocated handle
Return value : | 0 or 1.

### ticables_cable_get_d1

TIEXPORT1 int TICALL ticables_cable_get_d1(CableHandle* handle)

Get the electrical state of the D1 wire (if possible).

handle : | a previously allocated handle
Return value : | 0 or 1.

### ticables_cable_progress_reset

TIEXPORT1 int TICALL ticables_progress_reset(CableHandle* handle)

Reset byte counter and timer used for computing data rate.

handle : | a previously allocated handle
Return value : | always 0.

### ticables_cable_progress_get

TIEXPORT1 int TICALL ticables_progress_get(CableHandle* handle, int* count, int* msec, float* rate)

Returns information needed to compute the transfer rate of the link cable.

handle : | a previously allocated handle
count : | number of bytes transfered
msec : | time needed for the operation
rate : | data rate
Return value : | always 0.

### Return to the main index