ofs | hex dump | ascii |
---|
0000 | 25 50 44 46 2d 31 2e 37 0a 25 ce bc e1 bf a6 0a 0a 32 20 30 20 6f 62 6a 0a 3c 3c 20 2f 54 79 70 | %PDF-1.7.%.......2.0.obj.<<./Typ |
0020 | 65 20 2f 43 61 74 61 6c 6f 67 20 2f 50 61 67 65 73 20 33 20 30 20 52 20 3e 3e 0a 65 6e 64 6f 62 | e./Catalog./Pages.3.0.R.>>.endob |
0040 | 6a 0a 0a 35 20 30 20 6f 62 6a 0a 3c 3c 20 2f 4c 65 6e 67 74 68 20 38 33 32 20 2f 46 69 6c 74 65 | j..5.0.obj.<<./Length.832./Filte |
0060 | 72 20 2f 46 6c 61 74 65 44 65 63 6f 64 65 20 3e 3e 0a 73 74 72 65 61 6d 0a e9 13 6e 22 9a fc e9 | r./FlateDecode.>>.stream...n"... |
0080 | 4d 25 b9 4c df 5d fb 6b 7f 88 c0 32 b1 e9 ca 46 7d 62 fe 90 b7 87 15 ca 15 9e a4 18 58 d8 d6 71 | M%.L.].k...2...F}b..........X..q |
00a0 | ad ec f9 4e ed 3f 7e 8a 9b be 7d 30 e2 8b e2 fd 1d 51 c0 4a df a3 90 2c 2b e1 43 ef 2b 59 5b fe | ...N.?~...}0.....Q.J...,+.C.+Y[. |
00c0 | 88 43 88 b5 03 80 26 a8 84 7d 7e 77 95 df 13 4c c9 c4 57 b8 f2 ef 64 61 7c f5 0c cb 1b 6e 06 bd | .C....&..}~w...L..W...da|....n.. |
00e0 | 83 93 8d 03 29 de 29 1d 34 b2 8a 2a b9 29 07 78 1a 57 9e 35 6f 7c 97 df f1 9f a7 fc 4b d2 84 86 | ....).).4..*.).x.W.5o|......K... |
0100 | 22 a8 c9 ed 40 4f 48 dc 76 d3 60 67 67 2a 81 b7 c4 e1 de 77 b0 1e 5a 6c 66 ff 22 36 57 99 95 aa | "...@OH.v.`gg*.....w..Zlf."6W... |
0120 | 47 49 d5 32 16 44 70 98 48 00 0b af 50 57 0e 55 f5 16 c5 70 cc a5 9d 46 01 20 48 5d 06 56 08 ff | GI.2.Dp.H...PW.U...p...F..H].V.. |
0140 | 97 3c c2 5f 47 38 5e d4 2e 48 f4 50 4c 7f 1c e0 1f 2b d2 51 6d 99 0d 38 3d a8 b4 31 e6 f1 be a8 | .<._G8^..H.PL....+.Qm..8=..1.... |
0160 | ef 32 cd 8c 90 82 1c 1c aa 16 5f 71 f8 ed 66 f4 25 02 f6 20 20 a2 2e a3 ce ec 50 88 ec 66 be b8 | .2........_q..f.%.........P..f.. |
0180 | 8c b9 16 35 6d a8 85 66 8a 30 7b 74 14 5f 4e 04 12 e1 9b 6c 56 66 4a 64 2f f0 d1 46 07 8c ee 6f | ...5m..f.0{t._N....lVfJd/..F...o |
01a0 | 2c fb 42 0a e3 cf b2 97 99 53 ee c3 d5 9a 17 32 6d d0 58 24 bc bc f5 5c ce e8 a3 bc b6 3a a3 9e | ,.B......S.....2m.X$...\.....:.. |
01c0 | 2c 32 04 d2 5b 47 95 8e dc 87 4c d7 3a 10 59 8c 76 cc 40 ef bc 4e dc 9d c3 68 78 e8 06 fd 6b 29 | ,2..[G....L.:.Y.v.@..N...hx...k) |
01e0 | f6 f2 34 d6 9a ab 36 eb 78 38 40 1d e8 53 69 df 66 33 92 f1 66 73 8f da 36 94 c5 7e e9 72 c4 f0 | ..4...6.x8@..Si.f3..fs..6..~.r.. |
0200 | 16 fd d1 90 6f b8 ed 40 69 52 5a 59 12 1f 41 aa af 81 61 be bc 19 9a 65 53 a1 df 25 7f 89 5f 12 | ....o..@iRZY..A...a....eS..%.._. |
0220 | 71 cb 86 e3 a7 0b 79 f7 ce 0c 81 6e 32 df 52 78 0a 9d 8f 0e 04 fa db 09 a4 ee ce 9b 7b c9 67 4d | q.....y....n2.Rx............{.gM |
0240 | 4a 7e 40 03 d6 da 8f 36 39 2c c3 1f 30 25 56 52 b1 6a 74 8b c1 cf 42 15 49 5d 89 92 f0 d3 ae 89 | J~@....69,..0%VR.jt...B.I]...... |
0260 | d6 2a ea 12 dc 9a 2f 90 25 bc 65 cd 20 47 0c 25 80 9e 0c ae 70 64 e4 6c 98 b6 34 fd 9e 3c 64 f5 | .*..../.%.e..G.%....pd.l..4..<d. |
0280 | 50 3c ea 59 a5 4f af ac 68 27 97 bf d8 7e 4b 36 38 da e5 2f 1f 7d 45 65 16 df e9 5d 29 48 b6 a0 | P<.Y.O..h'...~K68../.}Ee...])H.. |
02a0 | 17 1d e8 f4 79 7a 32 d9 9b f5 6b 17 58 5f 53 b4 68 7c de 54 a7 76 4b c4 8b 66 86 e6 54 4d b5 40 | ....yz2...k.X_S.h|.T.vK..f..TM.@ |
02c0 | 54 03 b4 df 83 90 a4 43 55 c9 0f 60 a7 a7 a3 c2 94 2d 70 fa ff 37 c8 1b 7f a0 66 11 0d c4 50 6a | T......CU..`.....-p..7....f...Pj |
02e0 | a0 6f d6 20 49 10 b9 85 45 0a c5 fd 35 81 95 44 65 98 f4 53 e9 4e 46 59 65 6d 3e e9 39 f1 2f 0f | .o..I...E...5..De..S.NFYem>.9./. |
0300 | 97 43 21 10 15 1c 6b 6b 9c 69 2a 6b cd 7d d8 26 3c e4 11 18 77 5a a3 3f d2 5e 21 ff 54 30 e3 02 | .C!...kk.i*k.}.&<...wZ.?.^!.T0.. |
0320 | 20 65 0e 25 f1 5f 2d 72 4f 3e 14 90 a4 4d 72 6f 71 c1 e6 48 0d ed 4f fa a1 9d 98 7e 02 f6 8a 5c | .e.%._-rO>...Mroq..H..O....~...\ |
0340 | 05 7e 44 bf 63 25 2e 3b 80 18 18 f6 db a5 25 01 c3 19 73 53 4c d0 db 41 07 cd bd 74 6d e1 88 52 | .~D.c%.;......%...sSL..A...tm..R |
0360 | ad 08 f5 69 f9 dc 25 1d 0d dc 74 3a f3 2a 63 b0 9f 02 a4 12 ae 78 a7 28 b4 79 03 49 32 4f 8e 78 | ...i..%...t:.*c......x.(.y.I2O.x |
0380 | b7 a3 90 83 90 67 dc 61 79 64 11 34 f2 49 2f 84 cf 30 ff 46 67 b2 f4 36 92 1d 13 6e 5a 9b 2e c2 | .....g.ayd.4.I/..0.Fg..6...nZ... |
03a0 | 88 ec 0f 0c 48 94 a6 7b 69 65 0d f4 88 d1 15 7a de d4 b2 29 ae c9 7c 5f 0a 0a 65 6e 64 73 74 72 | ....H..{ie.....z...)..|_..endstr |
03c0 | 65 61 6d 0a 65 6e 64 6f 62 6a 0a 0a 36 20 30 20 6f 62 6a 0a 3c 3c 20 2f 53 75 62 74 79 70 65 20 | eam.endobj..6.0.obj.<<./Subtype. |
03e0 | 2f 43 49 44 46 6f 6e 74 54 79 70 65 30 43 20 2f 4c 65 6e 67 74 68 20 31 32 33 30 34 20 2f 46 69 | /CIDFontType0C./Length.12304./Fi |
0400 | 6c 74 65 72 20 2f 46 6c 61 74 65 44 65 63 6f 64 65 20 3e 3e 0a 73 74 72 65 61 6d 0a 3b ca 43 9e | lter./FlateDecode.>>.stream.;.C. |
0420 | 82 fc 1d 5a db 0c 1a 5a c8 14 63 01 8f 8f fc 3a db dc da eb 58 a5 45 ed be 27 cf 27 48 ab 61 56 | ...Z...Z..c....:....X.E..'.'H.aV |
0440 | 09 49 62 7e 7c ec 1b cf 39 39 07 19 eb 3d d8 d9 40 81 64 c2 2a c1 b5 9f 71 0c 4f 55 92 2f e4 21 | .Ib~|...99...=..@.d.*...q.OU./.! |
0460 | c1 8d b1 78 91 84 f6 b0 91 ff d5 b4 58 43 b9 21 3c 88 9e 59 62 b9 e1 67 29 4c 53 fd db 41 f7 e0 | ...x........XC.!<..Yb..g)LS..A.. |
0480 | ee 04 88 bc 04 73 f9 15 bf df dc 0b c6 84 e2 11 23 1c 86 93 e1 56 df 56 41 70 08 88 df 6b 0f 59 | .....s..........#....V.VAp...k.Y |
04a0 | 57 3d 40 6c 62 35 96 bf 59 b2 89 a8 b4 a8 70 a3 67 68 e8 82 db c1 84 65 9f f2 e1 4c d9 55 56 ef | W=@lb5..Y.....p.gh.....e...L.UV. |
04c0 | 1a 01 06 17 0d 1f 58 f6 e5 6d c4 07 9c 4a ef ad c2 9a bd ba e3 92 b9 09 c5 85 91 04 0b 44 d3 5d | ......X..m...J...............D.] |
04e0 | 60 8e 50 33 7b 76 15 2a a5 b0 2e a2 ea fe ae 38 ff 59 0e 39 b0 6f 09 7c 2e 47 21 cc 23 a7 4a 6d | `.P3{v.*.......8.Y.9.o.|.G!.#.Jm |
0500 | b7 f0 54 33 e1 40 82 b6 7c 6e 97 78 22 5c d5 a8 72 a0 cd f3 9b 0c 1b d9 9a b1 dd 79 91 43 5e 7f | ..T3.@..|n.x"\..r..........y.C^. |
0520 | 6f 5e 9a 03 2d f7 8f a4 45 10 dc 65 05 86 49 ad 44 4f 99 d3 89 58 ab a8 02 36 c5 03 17 a2 e5 de | o^..-...E..e..I.DO...X...6...... |
0540 | ad c8 16 74 3c 9e 53 6f ca 7e 91 78 38 09 5c 14 07 be 0a 68 0b 3c eb bd 32 cf be 47 45 63 d0 f4 | ...t<.So.~.x8.\....h.<..2..GEc.. |
0560 | c4 f3 c8 ef 77 93 97 2d c1 c8 7c db e0 b7 c4 67 dc fe 0a e8 d7 8a 01 43 6c 62 07 b5 27 ad d1 4a | ....w..-..|....g.......Clb..'..J |
0580 | 1b 04 f8 e5 5f fd c0 75 68 ad 66 4c a0 9c 4b 15 ac 84 25 4b 7b b2 b1 94 b2 f1 c0 30 f5 76 9a 2b | /*
* mostcore.h - Interface between MostCore,
* Hardware Dependent Module (HDM) and Application Interface Module (AIM).
*
* Copyright (C) 2013-2015, Microchip Technology Germany II GmbH & Co. KG
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This file is licensed under GPLv2.
*/
/*
* Authors:
* Andrey Shvetsov <andrey.shvetsov@k2l.de>
* Christian Gromm <christian.gromm@microchip.com>
* Sebastian Graf
*/
#ifndef __MOST_CORE_H__
#define __MOST_CORE_H__
#include <linux/types.h>
#include <linux/kobject.h> /* struct kobj_type */
#include <linux/sysfs.h> /* struct attribute */
struct module;
/**
* Interface type
*/
enum most_interface_type {
ITYPE_LOOPBACK = 1,
ITYPE_I2C,
ITYPE_I2S,
ITYPE_TSI,
ITYPE_HBI,
ITYPE_MEDIALB_DIM,
ITYPE_MEDIALB_DIM2,
ITYPE_USB,
ITYPE_PCIE
};
/**
* Channel direction.
*/
enum most_channel_direction {
MOST_CH_RX = 1 << 0,
MOST_CH_TX = 1 << 1,
};
/**
* Channel data type.
*/
enum most_channel_data_type {
MOST_CH_CONTROL = 1 << 0,
MOST_CH_ASYNC = 1 << 1,
MOST_CH_ISOC = 1 << 2,
MOST_CH_SYNC = 1 << 5,
};
enum mbo_status_flags {
/* MBO was processed successfully (data was send or received )*/
MBO_SUCCESS = 0,
/* The MBO contains wrong or missing information. */
MBO_E_INVAL,
/* MBO was completed as HDM Channel will be closed */
MBO_E_CLOSE,
};
/**
* struct most_channel_capability - Channel capability
* @direction: Supported channel directions.
* The value is bitwise OR-combination of the values from the
* enumeration most_channel_direction. Zero is allowed value and means
* "channel may not be used".
* @data_type: Supported channel data types.
* The value is bitwise OR-combination of the values from the
* enumeration most_channel_data_type. Zero is allowed value and means
* "channel may not be used".
* @num_buffer_packet: Maximum number of buffers supported by this channel
* for packet data types (Async,Control,QoS)
* @buffer_size_packet: Maximum buffer size supported by this channel
* for packet data types (Async,Control,QoS)
* @num_buffer_streaming: Maximum number of buffers supported by this channel
* for streaming data types (Sync,AV Packetized)
* @buffer_size_streaming: Maximum buffer size supported by this channel
* for streaming data types (Sync,AV Packetized)
* @name_suffix: Optional suffix providean by an HDM that is attached to the
* regular channel name.
*
* Describes the capabilities of a MostCore channel like supported Data Types
* and directions. This information is provided by an HDM for the MostCore.
*
* The Core creates read only sysfs attribute files in
* /sys/devices/virtual/most/mostcore/devices/mdev-#/mdev#-ch#/ with the
* following attributes:
* -available_directions
* -available_datatypes
* -number_of_packet_buffers
* -number_of_stream_buffers
* -size_of_packet_buffer
* -size_of_stream_buffer
* where content of each file is a string with all supported properties of this
* very channel attribute.
*/
struct most_channel_capability {
u16 direction;
u16 data_type;
u16 num_buffers_packet;
u16 buffer_size_packet;
u16 num_buffers_streaming;
u16 buffer_size_streaming;
const char *name_suffix;
};
/**
* struct most_channel_config - stores channel configuration
* @direction: direction of the channel
* @data_type: data type travelling over this channel
* @num_buffers: number of buffers
* @buffer_size: size of a buffer for AIM.
* Buffer size may be cutted down by HDM in a configure callback
* to match to a given interface and channel type.
* @extra_len: additional buffer space for internal HDM purposes like padding.
* May be set by HDM in a configure callback if needed.
* @subbuffer_size: size of a subbuffer
* @packets_per_xact: number of MOST frames that are packet inside one USB
* packet. This is USB specific
*
* Describes the configuration for a MostCore channel. This information is
* provided from the MostCore to a HDM (like the Medusa PCIe Interface) as a
* parameter of the "configure" function call.
*/
struct most_channel_config {
enum most_channel_direction direction;
enum most_channel_data_type data_type;
u16 num_buffers;
u16 buffer_size;
u16 extra_len;
u16 subbuffer_size;
u16 packets_per_xact;
u16 dbr_size;
};
/*
* struct mbo - MOST Buffer Object.
* @context: context for core completion handler
* @priv: private data for HDM
*
* public: documented fields that are used for the communications
* between MostCore and HDMs
*
* @list: list head for use by the mbo's current owner
* @ifp: (in) associated interface instance
* @hdm_channel_id: (in) HDM channel instance
* @virt_address: (in) kernel virtual address of the buffer
* @bus_address: (in) bus address of the buffer
* @buffer_length: (in) buffer payload length
* @processed_length: (out) processed length
* @status: (out) transfer status
* @complete: (in) completion routine
*
* The MostCore allocates and initializes the MBO.
*
* The HDM receives MBO for transfer from MostCore with the call to enqueue().
* The HDM copies the data to- or from the buffer depending on configured
* channel direction, set "processed_length" and "status" and completes
* the transfer procedure by calling the completion routine.
*
* At the end the MostCore deallocates the MBO or recycles it for further
* transfers for the same or different HDM.
*
* Directions of usage:
* The core driver should never access any MBO fields (even if marked
* as "public") while the MBO is owned by an HDM. The ownership starts with
* the call of enqueue() and ends with the call of its complete() routine.
*
* II.
* Every HDM attached to the core driver _must_ ensure that it returns any MBO
* it owns (due to a previous call to enqueue() by the core driver) before it
* de-registers an interface or gets unloaded from the kernel. If this direction
* is violated memory leaks will occur, since the core driver does _not_ track
* MBOs it is currently not in control of.
*
*/
struct mbo {
void *context;
void *priv;
struct list_head list;
struct most_interface *ifp;
int *num_buffers_ptr;
u16 hdm_channel_id;
void *virt_address;
dma_addr_t bus_address;
u16 buffer_length;
u16 processed_length;
enum mbo_status_flags status;
void (*complete)(struct mbo *);
};
/**
* Interface instance description.
*
* Describes one instance of an interface like Medusa PCIe or Vantage USB.
* This structure is allocated and initialized in the HDM. MostCore may not
* modify this structure.
*
* @interface Interface type. \sa most_interface_type.
* @description PRELIMINARY.
* Unique description of the device instance from point of view of the
* interface in free text form (ASCII).
* It may be a hexadecimal presentation of the memory address for the MediaLB
* IP or USB device ID with USB properties for USB interface, etc.
* @num_channels Number of channels and size of the channel_vector.
* @channel_vector Properties of the channels.
* Array index represents channel ID by the driver.
* @configure Callback to change data type for the channel of the
* interface instance. May be zero if the instance of the interface is not
* configurable. Parameter channel_config describes direction and data
* type for the channel, configured by the higher level. The content of
* @enqueue Delivers MBO to the HDM for processing.
* After HDM completes Rx- or Tx- operation the processed MBO shall
* be returned back to the MostCore using completion routine.
* The reason to get the MBO delivered from the MostCore after the channel
* is poisoned is the re-opening of the channel by the application.
* In this case the HDM shall hold MBOs and service the channel as usual.
* The HDM must be able to hold at least one MBO for each channel.
* The callback returns a negative value on error, otherwise 0.
* @poison_channel Informs HDM about closing the channel. The HDM shall
* cancel all transfers and synchronously or asynchronously return
* all enqueued for this channel MBOs using the completion routine.
* The callback returns a negative value on error, otherwise 0.
* @request_netinfo: triggers retrieving of network info from the HDM by
* means of "Message exchange over MDP/MEP"
* The call of the function request_netinfo with the parameter on_netinfo as
* NULL prohibits use of the previously obtained function pointer.
* @priv Private field used by mostcore to store context information.
*/
struct most_interface {
struct module *mod;
struct device *dev;
enum most_interface_type interface;
const char *description;
int num_channels;
struct most_channel_capability *channel_vector;
void *(*dma_alloc)(struct mbo *mbo, u32 size);
void (*dma_free)(struct mbo *mbo, u32 size);
int (*configure)(struct most_interface *iface, int channel_idx,
struct most_channel_config *channel_config);
int (*enqueue)(struct most_interface *iface, int channel_idx,
struct mbo *mbo);
int (*poison_channel)(struct most_interface *iface, int channel_idx);
void (*request_netinfo)(struct most_interface *iface, int channel_idx,
void (*on_netinfo)(struct most_interface *iface,
unsigned char link_stat,
unsigned char *mac_addr));
struct attribute *attrs[14];
struct kobj_type ktype;
enum { NONE_ATTRS /* default */, XACT_ATTRS, DBR_ATTRS } extra_attrs;
void *priv;
};
/**
* struct most_aim - identifies MOST device driver to mostcore
* @name: Driver name
* @probe_channel: function for core to notify driver about channel connection
* @disconnect_channel: callback function to disconnect a certain channel
* @rx_completion: completion handler for received packets
* @tx_completion: completion handler for transmitted packets
* @context: context pointer to be used by mostcore
*/
struct most_aim {
const char *name;
int (*probe_channel)(struct most_interface *iface, int channel_idx,
struct most_channel_config *cfg,
struct kobject *parent, char *name);
int (*disconnect_channel)(struct most_interface *iface,
int channel_idx);
int (*rx_completion)(struct mbo *mbo);
int (*tx_completion)(struct most_interface *iface, int channel_idx);
void *context;
};
/**
* most_register_interface - Registers instance of the interface.
* @iface: Pointer to the interface instance description.
*
* Returns a pointer to the kobject of the generated instance.
*
* Note: HDM has to ensure that any reference held on the kobj is
* released before deregistering the interface.
*/
struct kobject *most_register_interface(struct most_interface *iface);
/**
* Deregisters instance of the interface.
* @intf_instance Pointer to the interface instance description.
*/
void most_deregister_interface(struct most_interface *iface);
void most_submit_mbo(struct mbo *mbo);
/**
* most_stop_enqueue - prevents core from enqueing MBOs
* @iface: pointer to interface
* @channel_idx: channel index
*/
void most_stop_enqueue(struct most_interface *iface, int channel_idx);
/**
* most_resume_enqueue - allow core to enqueue MBOs again
* @iface: pointer to interface
* @channel_idx: channel index
*
* This clears the enqueue halt flag and enqueues all MBOs currently
* in wait fifo.
*/
void most_resume_enqueue(struct most_interface *iface, int channel_idx);
int most_register_aim(struct most_aim *aim);
int most_deregister_aim(struct most_aim *aim);
struct mbo *most_get_mbo(struct most_interface *iface, int channel_idx,
struct most_aim *);
void most_put_mbo(struct mbo *mbo);
int channel_has_mbo(struct most_interface *iface, int channel_idx,
struct most_aim *aim);
int most_start_channel(struct most_interface *iface, int channel_idx,
struct most_aim *);
int most_stop_channel(struct most_interface *iface, int channel_idx,
struct most_aim *);
#endif /* MOST_CORE_H_ */