/* HSI message status codes */ enum {
HSI_STATUS_COMPLETED, /* Message transfer is completed */
HSI_STATUS_PENDING, /* Message pending to be read/write (POLL) */
HSI_STATUS_PROCEEDING, /* Message transfer is ongoing */
HSI_STATUS_QUEUED, /* Message waiting to be served */
HSI_STATUS_ERROR, /* Error when message transfer was ongoing */
};
/** * struct hsi_channel - channel resource used by the hsi clients * @id: Channel number * @name: Channel name
*/ struct hsi_channel { unsignedint id; constchar *name;
};
/** * struct hsi_config - Configuration for RX/TX HSI modules * @mode: Bit transmission mode (STREAM or FRAME) * @channels: Channel resources used by the client * @num_channels: Number of channel resources * @num_hw_channels: Number of channels the transceiver is configured for [1..16] * @speed: Max bit transmission speed (Kbit/s) * @flow: RX flow type (SYNCHRONIZED or PIPELINE) * @arb_mode: Arbitration mode for TX frame (Round robin, priority)
*/ struct hsi_config { unsignedint mode; struct hsi_channel *channels; unsignedint num_channels; unsignedint num_hw_channels; unsignedint speed; union { unsignedint flow; /* RX only */ unsignedint arb_mode; /* TX only */
};
};
/** * struct hsi_board_info - HSI client board info * @name: Name for the HSI device * @hsi_id: HSI controller id where the client sits * @port: Port number in the controller where the client sits * @tx_cfg: HSI TX configuration * @rx_cfg: HSI RX configuration * @platform_data: Platform related data * @archdata: Architecture-dependent device data
*/ struct hsi_board_info { constchar *name; unsignedint hsi_id; unsignedint port; struct hsi_config tx_cfg; struct hsi_config rx_cfg; void *platform_data; struct dev_archdata *archdata;
};
/** * struct hsi_msg - HSI message descriptor * @link: Free to use by the current descriptor owner * @cl: HSI device client that issues the transfer * @sgt: Head of the scatterlist array * @context: Client context data associated to the transfer * @complete: Transfer completion callback * @destructor: Destructor to free resources when flushing * @status: Status of the transfer when completed * @actual_len: Actual length of data transferred on completion * @channel: Channel were to TX/RX the message * @ttype: Transfer type (TX if set, RX otherwise) * @break_frame: if true HSI will send/receive a break frame. Data buffers are * ignored in the request.
*/ struct hsi_msg { struct list_head link; struct hsi_client *cl; struct sg_table sgt; void *context;
/** * struct hsi_port - HSI port device * @device: Driver model representation of the device * @tx_cfg: Current TX path configuration * @rx_cfg: Current RX path configuration * @num: Port number * @shared: Set when port can be shared by different clients * @claimed: Reference count of clients which claimed the port * @lock: Serialize port claim * @async: Asynchronous transfer callback * @setup: Callback to set the HSI client configuration * @flush: Callback to clean the HW state and destroy all pending transfers * @start_tx: Callback to inform that a client wants to TX data * @stop_tx: Callback to inform that a client no longer wishes to TX data * @release: Callback to inform that a client no longer uses the port * @n_head: Notifier chain for signaling port events to the clients.
*/ struct hsi_port { struct device device; struct hsi_config tx_cfg; struct hsi_config rx_cfg; unsignedint num; unsignedint shared:1; int claimed; struct mutex lock; int (*async)(struct hsi_msg *msg); int (*setup)(struct hsi_client *cl); int (*flush)(struct hsi_client *cl); int (*start_tx)(struct hsi_client *cl); int (*stop_tx)(struct hsi_client *cl); int (*release)(struct hsi_client *cl); /* private */ struct blocking_notifier_head n_head;
};
/* * API for HSI clients
*/ int hsi_async(struct hsi_client *cl, struct hsi_msg *msg);
int hsi_get_channel_id_by_name(struct hsi_client *cl, char *name);
/** * hsi_id - Get HSI controller ID associated to a client * @cl: Pointer to a HSI client * * Return the controller id where the client is attached to
*/ staticinlineunsignedint hsi_id(struct hsi_client *cl)
{ return to_hsi_controller(cl->device.parent->parent)->id;
}
/** * hsi_port_id - Gets the port number a client is attached to * @cl: Pointer to HSI client * * Return the port number associated to the client
*/ staticinlineunsignedint hsi_port_id(struct hsi_client *cl)
{ return to_hsi_port(cl->device.parent)->num;
}
/** * hsi_setup - Configure the client's port * @cl: Pointer to the HSI client * * When sharing ports, clients should either relay on a single * client setup or have the same setup for all of them. * * Return -errno on failure, 0 on success
*/ staticinlineint hsi_setup(struct hsi_client *cl)
{ if (!hsi_port_claimed(cl)) return -EACCES; return hsi_get_port(cl)->setup(cl);
}
/** * hsi_flush - Flush all pending transactions on the client's port * @cl: Pointer to the HSI client * * This function will destroy all pending hsi_msg in the port and reset * the HW port so it is ready to receive and transmit from a clean state. * * Return -errno on failure, 0 on success
*/ staticinlineint hsi_flush(struct hsi_client *cl)
{ if (!hsi_port_claimed(cl)) return -EACCES; return hsi_get_port(cl)->flush(cl);
}
/** * hsi_async_read - Submit a read transfer * @cl: Pointer to the HSI client * @msg: HSI message descriptor of the transfer * * Return -errno on failure, 0 on success
*/ staticinlineint hsi_async_read(struct hsi_client *cl, struct hsi_msg *msg)
{
msg->ttype = HSI_MSG_READ; return hsi_async(cl, msg);
}
/** * hsi_async_write - Submit a write transfer * @cl: Pointer to the HSI client * @msg: HSI message descriptor of the transfer * * Return -errno on failure, 0 on success
*/ staticinlineint hsi_async_write(struct hsi_client *cl, struct hsi_msg *msg)
{
msg->ttype = HSI_MSG_WRITE; return hsi_async(cl, msg);
}
/** * hsi_start_tx - Signal the port that the client wants to start a TX * @cl: Pointer to the HSI client * * Return -errno on failure, 0 on success
*/ staticinlineint hsi_start_tx(struct hsi_client *cl)
{ if (!hsi_port_claimed(cl)) return -EACCES; return hsi_get_port(cl)->start_tx(cl);
}
/** * hsi_stop_tx - Signal the port that the client no longer wants to transmit * @cl: Pointer to the HSI client * * Return -errno on failure, 0 on success
*/ staticinlineint hsi_stop_tx(struct hsi_client *cl)
{ if (!hsi_port_claimed(cl)) return -EACCES; return hsi_get_port(cl)->stop_tx(cl);
} #endif/* __LINUX_HSI_H__ */
Messung V0.5
¤ Dauer der Verarbeitung: 0.2 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.