| Link cable management layer

### ticables_cable_open

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_close

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_reset

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

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_send

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_recv

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_check

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_d0

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

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

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

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_set_raw

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

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_device

int TICALL ticables_cable_set_device(CableHandle* handle, const char * device)

Sets cable device if that makes sense.

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

### ticables_cable_get_device_info

int ret = 0;

Get the type of device on the other end of the cable, if this can be determined.

handle : | a previously allocated handle
info : | pointer to structure to store device info
Return value : |

### ticables_cable_progress_reset

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

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.

### ticables_cable_put

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_get

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_get_pre_send_hook

{

Get the current pre send hook function pointer.

Return value : | a function pointer.

### ticables_cable_set_pre_send_hook

{

Set the current pre send hook function pointer.

hook : | new pre send hook
Return value : | the previous pre send hook, so that the caller can use it to chain hooks.

### ticables_cable_get_post_send_hook

{

Get the current post send hook function pointer.

Return value : | a function pointer.

### ticables_cable_set_post_send_hook

{

Set the current post send hook function pointer.

hook : | new post send hook
Return value : | the previous post send hook, so that the caller can use it to chain hooks.

### ticables_cable_get_pre_recv_hook

{

Get the current pre recv hook function pointer.

Return value : | a function pointer.

### ticables_cable_set_pre_recv_hook

{

Set the current pre recv hook function pointer.

hook : | new pre recv hook
Return value : | the previous pre recv hook, so that the caller can use it to chain hooks.

### ticables_cable_get_post_recv_hook

{

Get the current post recv hook function pointer.

Return value : | a function pointer.

### ticables_cable_set_post_recv_hook

{

Set the current post recv hook function pointer.

hook : | new post recv hook
Return value : | the previous post recv hook, so that the caller can use it to chain hooks.

### ticables_cable_get_event_hook

{

Get the current event hook function pointer.

Return value : | a function pointer.

### ticables_cable_set_post_recv_hook

{

Set the current post recv hook function pointer.

hook : | new post recv hook
Return value : | the previous post recv hook, so that the caller can use it to chain hooks.

### ticables_cable_get_event_user_pointer

{

Set the current post recv hook function pointer.

Return value : | the previous post recv hook, so that the caller can use it to chain hooks.

### ticables_cable_set_event_user_pointer

{

Set the current post recv hook function pointer.

user_pointer : | new user pointer
Return value : | the previous post recv hook, so that the caller can use it to chain hooks.

### ticables_cable_get_event_count

{

Get the current event count since the handle was initialized.

Return value : | an unsigned integer.

### ticables_cable_fire_user_event

{

Fire a user-specified event to the registered event hook function, if any.

handle : | a previously allocated handle.
type : | event type.
user_data : | user-specified data.
user_len : | user-specified length.
Return value : | 0 if successful, an error code otherwise.

### Return to the main index