~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/net/caif/caif_hsi.h

Version: ~ [ linux-5.5-rc6 ] ~ [ linux-5.4.11 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.95 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.164 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.209 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.209 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.19.8 ] ~ [ linux-3.18.140 ] ~ [ linux-3.17.8 ] ~ [ linux-3.16.81 ] ~ [ linux-3.15.10 ] ~ [ linux-3.14.79 ] ~ [ linux-3.13.11 ] ~ [ linux-3.12.74 ] ~ [ linux-3.11.10 ] ~ [ linux-3.10.108 ] ~ [ linux-3.9.11 ] ~ [ linux-3.8.13 ] ~ [ linux-3.7.10 ] ~ [ linux-3.6.11 ] ~ [ linux-3.5.7 ] ~ [ linux-3.4.113 ] ~ [ linux-3.3.8 ] ~ [ linux-3.2.102 ] ~ [ linux-3.1.10 ] ~ [ linux-3.0.101 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /*
  2  * Copyright (C) ST-Ericsson AB 2010
  3  * Contact: Sjur Brendeland / sjur.brandeland@stericsson.com
  4  * Author:  Daniel Martensson / daniel.martensson@stericsson.com
  5  *          Dmitry.Tarnyagin  / dmitry.tarnyagin@stericsson.com
  6  * License terms: GNU General Public License (GPL) version 2
  7  */
  8 
  9 #ifndef CAIF_HSI_H_
 10 #define CAIF_HSI_H_
 11 
 12 #include <net/caif/caif_layer.h>
 13 #include <net/caif/caif_device.h>
 14 #include <linux/atomic.h>
 15 
 16 /*
 17  * Maximum number of CAIF frames that can reside in the same HSI frame.
 18  */
 19 #define CFHSI_MAX_PKTS 15
 20 
 21 /*
 22  * Maximum number of bytes used for the frame that can be embedded in the
 23  * HSI descriptor.
 24  */
 25 #define CFHSI_MAX_EMB_FRM_SZ 96
 26 
 27 /*
 28  * Decides if HSI buffers should be prefilled with 0xFF pattern for easier
 29  * debugging. Both TX and RX buffers will be filled before the transfer.
 30  */
 31 #define CFHSI_DBG_PREFILL               0
 32 
 33 /* Structure describing a HSI packet descriptor. */
 34 #pragma pack(1) /* Byte alignment. */
 35 struct cfhsi_desc {
 36         u8 header;
 37         u8 offset;
 38         u16 cffrm_len[CFHSI_MAX_PKTS];
 39         u8 emb_frm[CFHSI_MAX_EMB_FRM_SZ];
 40 };
 41 #pragma pack() /* Default alignment. */
 42 
 43 /* Size of the complete HSI packet descriptor. */
 44 #define CFHSI_DESC_SZ (sizeof(struct cfhsi_desc))
 45 
 46 /*
 47  * Size of the complete HSI packet descriptor excluding the optional embedded
 48  * CAIF frame.
 49  */
 50 #define CFHSI_DESC_SHORT_SZ (CFHSI_DESC_SZ - CFHSI_MAX_EMB_FRM_SZ)
 51 
 52 /*
 53  * Maximum bytes transferred in one transfer.
 54  */
 55 #define CFHSI_MAX_CAIF_FRAME_SZ 4096
 56 
 57 #define CFHSI_MAX_PAYLOAD_SZ (CFHSI_MAX_PKTS * CFHSI_MAX_CAIF_FRAME_SZ)
 58 
 59 /* Size of the complete HSI TX buffer. */
 60 #define CFHSI_BUF_SZ_TX (CFHSI_DESC_SZ + CFHSI_MAX_PAYLOAD_SZ)
 61 
 62 /* Size of the complete HSI RX buffer. */
 63 #define CFHSI_BUF_SZ_RX ((2 * CFHSI_DESC_SZ) + CFHSI_MAX_PAYLOAD_SZ)
 64 
 65 /* Bitmasks for the HSI descriptor. */
 66 #define CFHSI_PIGGY_DESC                (0x01 << 7)
 67 
 68 #define CFHSI_TX_STATE_IDLE                     0
 69 #define CFHSI_TX_STATE_XFER                     1
 70 
 71 #define CFHSI_RX_STATE_DESC                     0
 72 #define CFHSI_RX_STATE_PAYLOAD                  1
 73 
 74 /* Bitmasks for power management. */
 75 #define CFHSI_WAKE_UP                           0
 76 #define CFHSI_WAKE_UP_ACK                       1
 77 #define CFHSI_WAKE_DOWN_ACK                     2
 78 #define CFHSI_AWAKE                             3
 79 #define CFHSI_WAKELOCK_HELD                     4
 80 #define CFHSI_SHUTDOWN                          5
 81 #define CFHSI_FLUSH_FIFO                        6
 82 
 83 #ifndef CFHSI_INACTIVITY_TOUT
 84 #define CFHSI_INACTIVITY_TOUT                   (1 * HZ)
 85 #endif /* CFHSI_INACTIVITY_TOUT */
 86 
 87 #ifndef CFHSI_WAKE_TOUT
 88 #define CFHSI_WAKE_TOUT                 (3 * HZ)
 89 #endif /* CFHSI_WAKE_TOUT */
 90 
 91 #ifndef CFHSI_MAX_RX_RETRIES
 92 #define CFHSI_MAX_RX_RETRIES            (10 * HZ)
 93 #endif
 94 
 95 /* Structure implemented by the CAIF HSI driver. */
 96 struct cfhsi_drv {
 97         void (*tx_done_cb) (struct cfhsi_drv *drv);
 98         void (*rx_done_cb) (struct cfhsi_drv *drv);
 99         void (*wake_up_cb) (struct cfhsi_drv *drv);
100         void (*wake_down_cb) (struct cfhsi_drv *drv);
101 };
102 
103 /* Structure implemented by HSI device. */
104 struct cfhsi_dev {
105         int (*cfhsi_up) (struct cfhsi_dev *dev);
106         int (*cfhsi_down) (struct cfhsi_dev *dev);
107         int (*cfhsi_tx) (u8 *ptr, int len, struct cfhsi_dev *dev);
108         int (*cfhsi_rx) (u8 *ptr, int len, struct cfhsi_dev *dev);
109         int (*cfhsi_wake_up) (struct cfhsi_dev *dev);
110         int (*cfhsi_wake_down) (struct cfhsi_dev *dev);
111         int (*cfhsi_get_peer_wake) (struct cfhsi_dev *dev, bool *status);
112         int (*cfhsi_fifo_occupancy)(struct cfhsi_dev *dev, size_t *occupancy);
113         int (*cfhsi_rx_cancel)(struct cfhsi_dev *dev);
114         struct cfhsi_drv *drv;
115 };
116 
117 /* Structure holds status of received CAIF frames processing */
118 struct cfhsi_rx_state {
119         int state;
120         int nfrms;
121         int pld_len;
122         int retries;
123         bool piggy_desc;
124 };
125 
126 /* Structure implemented by CAIF HSI drivers. */
127 struct cfhsi {
128         struct caif_dev_common cfdev;
129         struct net_device *ndev;
130         struct platform_device *pdev;
131         struct sk_buff_head qhead;
132         struct cfhsi_drv drv;
133         struct cfhsi_dev *dev;
134         int tx_state;
135         struct cfhsi_rx_state rx_state;
136         unsigned long inactivity_timeout;
137         int rx_len;
138         u8 *rx_ptr;
139         u8 *tx_buf;
140         u8 *rx_buf;
141         spinlock_t lock;
142         int flow_off_sent;
143         u32 q_low_mark;
144         u32 q_high_mark;
145         struct list_head list;
146         struct work_struct wake_up_work;
147         struct work_struct wake_down_work;
148         struct work_struct out_of_sync_work;
149         struct workqueue_struct *wq;
150         wait_queue_head_t wake_up_wait;
151         wait_queue_head_t wake_down_wait;
152         wait_queue_head_t flush_fifo_wait;
153         struct timer_list timer;
154         struct timer_list rx_slowpath_timer;
155         unsigned long bits;
156 };
157 
158 extern struct platform_driver cfhsi_driver;
159 
160 #endif          /* CAIF_HSI_H_ */
161 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp