Commit 789c1a26 authored by Federico Vaga's avatar Federico Vaga

sw:drv: make it more kernel-doc like

Signed-off-by: Federico Vaga's avatarFederico Vaga <federico.vaga@cern.ch>
parent 22af3460
......@@ -20,20 +20,33 @@
#define MAX_MQUEUE_SLOTS (TRTL_MAX_HMQ_SLOT / 2)
#define TRTL_MAX_CPU_MINORS (TRTL_MAX_CPU * TRTL_MAX_CARRIER)
#define TRTL_MAX_HMQ_MINORS (TRTL_MAX_MQ_CHAN * TRTL_MAX_CARRIER)
#define TRTL_MAX_MINORS (TRTL_MAX_CARRIER + TRTL_MAX_CPU_MINORS + TRTL_MAX_HMQ_MINORS)
#define TRTL_MAX_MINORS (TRTL_MAX_CARRIER + \
TRTL_MAX_CPU_MINORS + \
TRTL_MAX_HMQ_MINORS)
#define TRTL_SMEM_MAX_SIZE 65536
#define to_trtl_cpu(_dev) (container_of(_dev, struct trtl_cpu, dev))
#define to_trtl_dev(_dev) (container_of(_dev, struct trtl_dev, dev))
#define to_pdev_dev(_trtl) (container_of(_trtl->dev.parent, struct platform_device, dev))
#define to_pdev_dev(_trtl) (container_of(_trtl->dev.parent, \
struct platform_device, \
dev))
#define to_trtl_hmq(_dev) (container_of(_dev, struct trtl_hmq, dev))
#define TRTL_FLAG_HMQ_DIR (1 << 0) /**< 1 CPU input, 0 CPU output */
#define TRTL_FLAG_HMQ_SHR (1 << 1) /**< 1 shared, means that more than
1 CPU is using it */
/**
* 1 CPU input, 0 CPU output
*/
#define TRTL_FLAG_HMQ_DIR (1 << 0)
#define TRTL_FLAG_HMQ_SHR_USR (1 << 2) /**< Shared by users */
/**
* 1 shared, means that more than 1 CPU is using it
*/
#define TRTL_FLAG_HMQ_SHR (1 << 1)
/**
* Shared by users
*/
#define TRTL_FLAG_HMQ_SHR_USR (1 << 2)
extern struct class trtl_cdev_class;
......@@ -76,19 +89,24 @@ extern struct trtl_memory_ops memops;
/**
* Available type of devices
* @TRTL_DEV: the whole TRTL component
* @TRTL_CPU: CPU core of the TRTL
* @TRTL_HMQ: HMQ slot ot the TRTL
*/
enum trtl_dev_type {
TRTL_DEV, /**< the whole TRTL component */
TRTL_CPU, /**< CPU core of the TRTL*/
TRTL_HMQ, /**< HMQ slot ot the TRTL */
TRTL_DEV,
TRTL_CPU,
TRTL_HMQ,
};
/**
* Message structure for the driver
* @list: to keep it in our local queue
* @msg: the real message
*/
struct trtl_msg_element {
struct list_head list; /**< to keep it in our local queue */
struct trtl_msg *msg; /**< the real message */
struct list_head list;
struct trtl_msg *msg;
};
......@@ -119,71 +137,93 @@ struct trtl_hmq_slot {
/**
* It describe the status of a HMQ slot
* @msg_in: list of incoming messages
* @msg_out: list of outgoing messages
* @dev:
* @index: instance number
* @flags: describe the status of the HMQ slot from the driver point of view
* @status: describe the status of the HMQ slot from the cpu point of view
* @base_in: base address for incoming HMQ
* @base_out: base address for outgoing HMQ
* @head list_msg_input: list of messages to input slot
* @n_input: number of messages in the list
* @lock: to protect list read/write
* @mtx: to protect operations on the HMQ
* @q_msg: wait queue for messages
* @list_usr: list of consumer of the output slot
* @n_user: number of users in the list
* @cfg: configuration information for the MQ
* @max_width: maximum words number per single buffer
* @max_depth: maximum buffer queue length (HW)
* @buf_in: Circular buffer incoming messages
* @buf_out: Circular buffer outgoing messages
*/
struct trtl_hmq {
struct device dev;
int index; /**< instance number */
unsigned long flags; /**< describe the status of the HMQ slot from
the driver point of view */
uint32_t status; /**< describe the status of the HMQ slot from the
cpu point of view */
void *base_in; /**< base address for incoming HMQ */
void *base_out; /**< base address for outgoing HMQ */
struct list_head list_msg_input; /**< list of messages to
input slot */
unsigned int n_input; /**< number of messages in the list */
struct spinlock lock; /**< to protect list read/write */
struct mutex mtx; /**< to protect operations on the HMQ */
wait_queue_head_t q_msg; /**< wait queue for messages */
struct list_head list_usr; /**< list of consumer of the output slot */
unsigned int n_user; /**< number of users in the list */
int index;
unsigned long flags;
uint32_t status;
void *base_in;
void *base_out;
struct list_head list_msg_input;
unsigned int n_input;
spinlock_t lock;
struct mutex mtx;
wait_queue_head_t q_msg;
struct list_head list_usr;
unsigned int n_user;
const struct trtl_config_rom_mq *cfg;
unsigned int max_width; /**< maximum words number per single buffer */
unsigned int max_depth; /**< maximum buffer queue length (HW) */
struct mturtle_hmq_buffer buf_in; /**< Circular buffer incoming
messages */
struct mturtle_hmq_buffer buf_out; /**< Circular buffer outgoing
messages */
unsigned int max_width;
unsigned int max_depth;
struct mturtle_hmq_buffer buf_in;
struct mturtle_hmq_buffer buf_out;
};
/**
* It describes the consumer of the output slot
* @list: to keep it in our local queue
* @hmq: reference to opened HMQ
* @lock: to protect list read/write
* @list_filters: list of filters to apply
* @n_filters: number of filters
* @lock_filter: to protect filter list read/write
* @ptr_r: read pointer for the message circular buffer
* @idx_r:
*/
struct trtl_hmq_user {
struct list_head list; /**< to keep it in our local queue */
struct trtl_hmq *hmq; /**< reference to opened HMQ */
spinlock_t lock; /**< to protect list read/write */
struct list_head list_filters; /**< list of filters to apply */
unsigned int n_filters; /**< number of filters */
spinlock_t lock_filter; /**< to protect filter list read/write */
unsigned int ptr_r; /**< read pointer for the message circular buffer */
struct list_head list;
struct trtl_hmq *hmq;
spinlock_t lock;
struct list_head list_filters;
unsigned int n_filters;
spinlock_t lock_filter;
unsigned int ptr_r;
unsigned int idx_r;
};
/**
* It describes a single instance of a CPU of the TRTL
* @index: instance number
* @dev: device representing a single CPU
* @cbuf: debug circular buffer
* @lock:
* @hmq: list of HMQ slots used by this CPU
* @tty_dev;
* @tty_port:
* @tty_index:
* @q_notify:
* @notification:
* @idx_r:
* @idx_w:
*/
struct trtl_cpu {
int index; /**< instance number */
struct device dev; /**< device representing a single CPU */
struct circ_buf cbuf; /**< debug circular buffer */
int index;
struct device dev;
struct circ_buf cbuf;
spinlock_t lock;
struct trtl_hmq hmq[TRTL_MAX_MQ_CHAN]; /**< list of HMQ slots used by
this CPU */
struct trtl_hmq hmq[TRTL_MAX_MQ_CHAN];
struct device *tty_dev;
struct tty_port tty_port;
unsigned int tty_index;
wait_queue_head_t q_notify;
enum trtl_cpu_notification notification[TRTL_CPU_NOTIFY_HISTORY_N];
unsigned int idx_r;
......@@ -192,33 +232,43 @@ struct trtl_cpu {
/**
* It describes the generic instance of a TRTL
* @
* @dev;
* @cpu: CPU instances
* @base_core: base address of the TRTL component
* @base_csr: base address of the Shared Control Register
* @base_hmq: base address of the HMQ
* @base_cfg: base address for the configuration ROM
* @base_smem: base address of the Shared Memory
* @irq_mask: IRQ mask in use
* @mod: smem operation modifier
* @message_sequence: message sequence number
* @lock_cpu_sel:
* @lock_hmq_sel:
* @cfgrom: synthesis configuration ROM
* @tty_driver:
* @memops:
* @dbg_dir: root debug directory
* @dbg_info: information
*/
struct trtl_dev {
struct device dev;
struct trtl_cpu cpu[TRTL_MAX_CPU]; /**< CPU instances */
void *base_core; /**< base address of the TRTL component */
void *base_csr; /**< base address of the Shared Control Register */
void *base_hmq; /**< base address of the HMQ */
void *base_cfg; /**< base address for the configuration ROM */
void *base_smem; /**< base address of the Shared Memory */
uint64_t irq_mask; /**< IRQ mask in use */
enum trtl_smem_modifier mod; /**< smem operation modifier */
uint32_t message_sequence; /**< message sequence number */
struct trtl_cpu cpu[TRTL_MAX_CPU];
void *base_core;
void *base_csr;
void *base_hmq;
void *base_cfg;
void *base_smem;
uint64_t irq_mask;
enum trtl_smem_modifier mod;
uint32_t message_sequence;
spinlock_t lock_cpu_sel;
spinlock_t lock_hmq_sel;
const struct trtl_config_rom cfgrom; /**< synthesis configuration ROM */
const struct trtl_config_rom cfgrom;
struct tty_driver *tty_driver;
struct trtl_memory_ops memops;
struct dentry *dbg_dir; /**< root debug directory */
struct dentry *dbg_info; /**< information */
struct dentry *dbg_dir;
struct dentry *dbg_info;
};
static inline u32 trtl_ioread(struct trtl_dev *trtl, void *addr)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment