summaryrefslogblamecommitdiffstats
path: root/Documentation/rpmsg.txt
blob: 409d9f964c5b547b9e3f09d76c662aebf1216536 (plain) (tree)




































































































































































































































































































                                                                                
Remote Processor Messaging (rpmsg) Framework

Note: this document describes the rpmsg bus and how to write rpmsg drivers.
To learn how to add rpmsg support for new platforms, check out remoteproc.txt
(also a resident of Documentation/).

1. Introduction

Modern SoCs typically employ heterogeneous remote processor devices in
asymmetric multiprocessing (AMP) configurations, which may be running
different instances of operating system, whether it's Linux or any other
flavor of real-time OS.

OMAP4, for example, has dual Cortex-A9, dual Cortex-M3 and a C64x+ DSP.
Typically, the dual cortex-A9 is running Linux in a SMP configuration,
and each of the other three cores (two M3 cores and a DSP) is running
its own instance of RTOS in an AMP configuration.

Typically AMP remote processors employ dedicated DSP codecs and multimedia
hardware accelerators, and therefore are often used to offload CPU-intensive
multimedia tasks from the main application processor.

These remote processors could also be used to control latency-sensitive
sensors, drive random hardware blocks, or just perform background tasks
while the main CPU is idling.

Users of those remote processors can either be userland apps (e.g. multimedia
frameworks talking with remote OMX components) or kernel drivers (controlling
hardware accessible only by the remote processor, reserving kernel-controlled
resources on behalf of the remote processor, etc..).

Rpmsg is a virtio-based messaging bus that allows kernel drivers to communicate
with remote processors available on the system. In turn, drivers could then
expose appropriate user space interfaces, if needed.

When writing a driver that exposes rpmsg communication to userland, please
keep in mind that remote processors might have direct access to the
system's physical memory and other sensitive hardware resources (e.g. on
OMAP4, remote cores and hardware accelerators may have direct access to the
physical memory, gpio banks, dma controllers, i2c bus, gptimers, mailbox
devices, hwspinlocks, etc..). Moreover, those remote processors might be
running RTOS where every task can access the entire memory/devices exposed
to the processor. To minimize the risks of rogue (or buggy) userland code
exploiting remote bugs, and by that taking over the system, it is often
desired to limit userland to specific rpmsg channels (see definition below)
it can send messages on, and if possible, minimize how much control
it has over the content of the messages.

Every rpmsg device is a communication channel with a remote processor (thus
rpmsg devices are called channels). Channels are identified by a textual name
and have a local ("source") rpmsg address, and remote ("destination") rpmsg
address.

When a driver starts listening on a channel, its rx callback is bound with
a unique rpmsg local address (a 32-bit integer). This way when inbound messages
arrive, the rpmsg core dispatches them to the appropriate driver according
to their destination address (this is done by invoking the driver's rx handler
with the payload of the inbound message).


2. User API

  int rpmsg_send(struct rpmsg_channel *rpdev, void *data, int len);
   - sends a message across to the remote processor on a given channel.
     The caller should specify the channel, the data it wants to send,
     and its length (in bytes). The message will be sent on the specified
     channel, i.e. its source and destination address fields will be
     set to the channel's src and dst addresses.

     In case there are no TX buffers available, the function will block until
     one becomes available (i.e. until the remote processor consumes
     a tx buffer and puts it back on virtio's used descriptor ring),
     or a timeout of 15 seconds elapses. When the latter happens,
     -ERESTARTSYS is returned.
     The function can only be called from a process context (for now).
     Returns 0 on success and an appropriate error value on failure.

  int rpmsg_sendto(struct rpmsg_channel *rpdev, void *data, int len, u32 dst);
   - sends a message across to the remote processor on a given channel,
     to a destination address provided by the caller.
     The caller should specify the channel, the data it wants to send,
     its length (in bytes), and an explicit destination address.
     The message will then be sent to the remote processor to which the
     channel belongs, using the channel's src address, and the user-provided
     dst address (thus the channel's dst address will be ignored).

     In case there are no TX buffers available, the function will block until
     one becomes available (i.e. until the remote processor consumes
     a tx buffer and puts it back on virtio's used descriptor ring),
     or a timeout of 15 seconds elapses. When the latter happens,
     -ERESTARTSYS is returned.
     The function can only be called from a process context (for now).
     Returns 0 on success and an appropriate error value on failure.

  int rpmsg_send_offchannel(struct rpmsg_channel *rpdev, u32 src, u32 dst,
							void *data, int len);
   - sends a message across to the remote processor, using the src and dst
     addresses provided by the user.
     The caller should specify the channel, the data it wants to send,
     its length (in bytes), and explicit source and destination addresses.
     The message will then be sent to the remote processor to which the
     channel belongs, but the channel's src and dst addresses will be
     ignored (and the user-provided addresses will be used instead).

     In case there are no TX buffers available, the function will block until
     one becomes available (i.e. until the remote processor consumes
     a tx buffer and puts it back on virtio's used descriptor ring),
     or a timeout of 15 seconds elapses. When the latter happens,
     -ERESTARTSYS is returned.
     The function can only be called from a process context (for now).
     Returns 0 on success and an appropriate error value on failure.

  int rpmsg_trysend(struct rpmsg_channel *rpdev, void *data, int len);
   - sends a message across to the remote processor on a given channel.
     The caller should specify the channel, the data it wants to send,
     and its length (in bytes). The message will be sent on the specified
     channel, i.e. its source and destination address fields will be
     set to the channel's src and dst addresses.

     In case there are no TX buffers available, the function will immediately
     return -ENOMEM without waiting until one becomes available.
     The function can only be called from a process context (for now).
     Returns 0 on success and an appropriate error value on failure.

  int rpmsg_trysendto(struct rpmsg_channel *rpdev, void *data, int len, u32 dst)
   - sends a message across to the remote processor on a given channel,
     to a destination address provided by the user.
     The user should specify the channel, the data it wants to send,
     its length (in bytes), and an explicit destination address.
     The message will then be sent to the remote processor to which the
     channel belongs, using the channel's src address, and the user-provided
     dst address (thus the channel's dst address will be ignored).

     In case there are no TX buffers available, the function will immediately
     return -ENOMEM without waiting until one becomes available.
     The function can only be called from a process context (for now).
     Returns 0 on success and an appropriate error value on failure.

  int rpmsg_trysend_offchannel(struct rpmsg_channel *rpdev, u32 src, u32 dst,
							void *data, int len);
   - sends a message across to the remote processor, using source and
     destination addresses provided by the user.
     The user should specify the channel, the data it wants to send,
     its length (in bytes), and explicit source and destination addresses.
     The message will then be sent to the remote processor to which the
     channel belongs, but the channel's src and dst addresses will be
     ignored (and the user-provided addresses will be used instead).

     In case there are no TX buffers available, the function will immediately
     return -ENOMEM without waiting until one becomes available.
     The function can only be called from a process context (for now).
     Returns 0 on success and an appropriate error value on failure.

  struct rpmsg_endpoint *rpmsg_create_ept(struct rpmsg_channel *rpdev,
		void (*cb)(struct rpmsg_channel *, void *, int, void *, u32),
		void *priv, u32 addr);
   - every rpmsg address in the system is bound to an rx callback (so when
     inbound messages arrive, they are dispatched by the rpmsg bus using the
     appropriate callback handler) by means of an rpmsg_endpoint struct.

     This function allows drivers to create such an endpoint, and by that,
     bind a callback, and possibly some private data too, to an rpmsg address
     (either one that is known in advance, or one that will be dynamically
     assigned for them).

     Simple rpmsg drivers need not call rpmsg_create_ept, because an endpoint
     is already created for them when they are probed by the rpmsg bus
     (using the rx callback they provide when they registered to the rpmsg bus).

     So things should just work for simple drivers: they already have an
     endpoint, their rx callback is bound to their rpmsg address, and when
     relevant inbound messages arrive (i.e. messages which their dst address
     equals to the src address of their rpmsg channel), the driver's handler
     is invoked to process it.

     That said, more complicated drivers might do need to allocate
     additional rpmsg addresses, and bind them to different rx callbacks.
     To accomplish that, those drivers need to call this function.
     Drivers should provide their channel (so the new endpoint would bind
     to the same remote processor their channel belongs to), an rx callback
     function, an optional private data (which is provided back when the
     rx callback is invoked), and an address they want to bind with the
     callback. If addr is RPMSG_ADDR_ANY, then rpmsg_create_ept will
     dynamically assign them an available rpmsg address (drivers should have
     a very good reason why not to always use RPMSG_ADDR_ANY here).

     Returns a pointer to the endpoint on success, or NULL on error.

  void rpmsg_destroy_ept(struct rpmsg_endpoint *ept);
   - destroys an existing rpmsg endpoint. user should provide a pointer
     to an rpmsg endpoint that was previously created with rpmsg_create_ept().

  int register_rpmsg_driver(struct rpmsg_driver *rpdrv);
   - registers an rpmsg driver with the rpmsg bus. user should provide
     a pointer to an rpmsg_driver struct, which contains the driver's
     ->probe() and ->remove() functions, an rx callback, and an id_table
     specifying the names of the channels this driver is interested to
     be probed with.

  void unregister_rpmsg_driver(struct rpmsg_driver *rpdrv);
   - unregisters an rpmsg driver from the rpmsg bus. user should provide
     a pointer to a previously-registered rpmsg_driver struct.
     Returns 0 on success, and an appropriate error value on failure.


3. Typical usage

The following is a simple rpmsg driver, that sends an "hello!" message
on probe(), and whenever it receives an incoming message, it dumps its
content to the console.

#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/rpmsg.h>

static void rpmsg_sample_cb(struct rpmsg_channel *rpdev, void *data, int len,
						void *priv, u32 src)
{
	print_hex_dump(KERN_INFO, "incoming message:", DUMP_PREFIX_NONE,
						16, 1, data, len, true);
}

static int rpmsg_sample_probe(struct rpmsg_channel *rpdev)
{
	int err;

	dev_info(&rpdev->dev, "chnl: 0x%x -> 0x%x\n", rpdev->src, rpdev->dst);

	/* send a message on our channel */
	err = rpmsg_send(rpdev, "hello!", 6);
	if (err) {
		pr_err("rpmsg_send failed: %d\n", err);
		return err;
	}

	return 0;
}

static void __devexit rpmsg_sample_remove(struct rpmsg_channel *rpdev)
{
	dev_info(&rpdev->dev, "rpmsg sample client driver is removed\n");
}

static struct rpmsg_device_id rpmsg_driver_sample_id_table[] = {
	{ .name	= "rpmsg-client-sample" },
	{ },
};
MODULE_DEVICE_TABLE(rpmsg, rpmsg_driver_sample_id_table);

static struct rpmsg_driver rpmsg_sample_client = {
	.drv.name	= KBUILD_MODNAME,
	.drv.owner	= THIS_MODULE,
	.id_table	= rpmsg_driver_sample_id_table,
	.probe		= rpmsg_sample_probe,
	.callback	= rpmsg_sample_cb,
	.remove		= __devexit_p(rpmsg_sample_remove),
};

static int __init init(void)
{
	return register_rpmsg_driver(&rpmsg_sample_client);
}
module_init(init);

static void __exit fini(void)
{
	unregister_rpmsg_driver(&rpmsg_sample_client);
}
module_exit(fini);

Note: a similar sample which can be built and loaded can be found
in samples/rpmsg/.

4. Allocations of rpmsg channels:

At this point we only support dynamic allocations of rpmsg channels.

This is possible only with remote processors that have the VIRTIO_RPMSG_F_NS
virtio device feature set. This feature bit means that the remote
processor supports dynamic name service announcement messages.

When this feature is enabled, creation of rpmsg devices (i.e. channels)
is completely dynamic: the remote processor announces the existence of a
remote rpmsg service by sending a name service message (which contains
the name and rpmsg addr of the remote service, see struct rpmsg_ns_msg).

This message is then handled by the rpmsg bus, which in turn dynamically
creates and registers an rpmsg channel (which represents the remote service).
If/when a relevant rpmsg driver is registered, it will be immediately probed
by the bus, and can then start sending messages to the remote service.

The plan is also to add static creation of rpmsg channels via the virtio
config space, but it's not implemented yet.
l-qcow2-linux.git/commit/net/ipv4/ip_fragment.c?id=1da177e4c3f41524e886b7f1b8a0c1fc7321cac2'>1da177e4c3f4
36c7778218b9 ^
1da177e4c3f4
321a3a99e471 ^

1da177e4c3f4

36c7778218b9 ^
abd6523d15f4 ^
36c7778218b9 ^

abd6523d15f4 ^

a02cec2155fb ^
cbc264cacd08 ^


9972f134a273 ^

abd6523d15f4 ^

36c7778218b9 ^
c6fda282294d ^

54db0cc2ba0d ^



36c7778218b9 ^
c6fda282294d ^


6623e3b24a5e ^
c6fda282294d ^

9972f134a273 ^
c6fda282294d ^

192132b9a034 ^

c6fda282294d ^

aa1f731e5280 ^
1da177e4c3f4
1e4b82873af0 ^




1da177e4c3f4

1da177e4c3f4


aa1f731e5280 ^
1da177e4c3f4
762cc40801ad ^
1da177e4c3f4






277e650ddfc6 ^
1da177e4c3f4

5cf422808244 ^



8bc04864ac89 ^


5cf422808244 ^

1da177e4c3f4




e521db9d790a ^
84a3aa000eac ^
e521db9d790a ^

84a3aa000eac ^
1da177e4c3f4
5ab11c98d3a9 ^
1da177e4c3f4
06aa8b8a0345 ^
1da177e4c3f4


7c73a6faffae ^
1da177e4c3f4
caaecdd3d3f8 ^
5ab11c98d3a9 ^
64f3b9e203bd ^

cb84663e4d23 ^
2e404f632f44 ^




69df9d5993bd ^

e9017b551893 ^


97599dc792b4 ^
64f3b9e203bd ^
c6cffba4ffa2 ^

64f3b9e203bd ^


2e404f632f44 ^
64f3b9e203bd ^
e9017b551893 ^
5cf422808244 ^

64f3b9e203bd ^

e9017b551893 ^

e9017b551893 ^
d1c9ae6d1e7b ^

1da177e4c3f4
5ab11c98d3a9 ^
4b6cb5d8e3f5 ^
1da177e4c3f4

abd6523d15f4 ^


9972f134a273 ^

1da177e4c3f4
c6fda282294d ^

abd6523d15f4 ^
1da177e4c3f4
c6fda282294d ^

9972f134a273 ^
9a375803feaa ^
abd6523d15f4 ^
1da177e4c3f4
ac18e7509e7d ^
5a3da1fe9561 ^



c6fda282294d ^
1da177e4c3f4

89cee8b1cbb9 ^
aa1f731e5280 ^
89cee8b1cbb9 ^













5ab11c98d3a9 ^
89cee8b1cbb9 ^

7c73a6faffae ^



89cee8b1cbb9 ^







d433673e5f91 ^
89cee8b1cbb9 ^
b2fd5321dd16 ^
5ab11c98d3a9 ^
89cee8b1cbb9 ^


5ab11c98d3a9 ^
89cee8b1cbb9 ^

d433673e5f91 ^


89cee8b1cbb9 ^

0e60d245a0be ^
89cee8b1cbb9 ^
06aa8b8a0345 ^
5ab11c98d3a9 ^


d6bebca92c66 ^
89cee8b1cbb9 ^
6623e3b24a5e ^
89cee8b1cbb9 ^



1da177e4c3f4
1706d58763c3 ^
1da177e4c3f4

1706d58763c3 ^
d6b915e29f4a ^
1da177e4c3f4

1706d58763c3 ^
6623e3b24a5e ^
1da177e4c3f4
06aa8b8a0345 ^
1da177e4c3f4

89cee8b1cbb9 ^
1706d58763c3 ^

89cee8b1cbb9 ^



6623e3b24a5e ^
eddc9ec53be2 ^
1da177e4c3f4


c9bdd4b52574 ^
1da177e4c3f4

0848f6428ba3 ^
1706d58763c3 ^
1da177e4c3f4



42b2aa86c667 ^
1da177e4c3f4
5ab11c98d3a9 ^
06aa8b8a0345 ^
1da177e4c3f4
06aa8b8a0345 ^
5ab11c98d3a9 ^
1da177e4c3f4





5ab11c98d3a9 ^
1da177e4c3f4
06aa8b8a0345 ^
1da177e4c3f4
5ab11c98d3a9 ^
1da177e4c3f4




1706d58763c3 ^
0848f6428ba3 ^
1da177e4c3f4
1706d58763c3 ^


1da177e4c3f4





d6bebca92c66 ^




1da177e4c3f4
5ab11c98d3a9 ^
1da177e4c3f4




d6bebca92c66 ^
1da177e4c3f4








1706d58763c3 ^
1da177e4c3f4

1706d58763c3 ^
1da177e4c3f4






1706d58763c3 ^

1da177e4c3f4









5ab11c98d3a9 ^
1da177e4c3f4





47c6bf7760bb ^
1da177e4c3f4






5ab11c98d3a9 ^
1da177e4c3f4
5ab11c98d3a9 ^
0e60d245a0be ^
d433673e5f91 ^
1da177e4c3f4






d6bebca92c66 ^

1da177e4c3f4


5ab11c98d3a9 ^
1da177e4c3f4
1706d58763c3 ^




5ab11c98d3a9 ^

6623e3b24a5e ^
0e60d245a0be ^
1da177e4c3f4
06aa8b8a0345 ^
1da177e4c3f4
d6b915e29f4a ^




5f2d04f1f9b5 ^
d6b915e29f4a ^

5f2d04f1f9b5 ^
06aa8b8a0345 ^
97599dc792b4 ^

1706d58763c3 ^
97599dc792b4 ^






1706d58763c3 ^
1da177e4c3f4


1706d58763c3 ^
1da177e4c3f4




1706d58763c3 ^

1da177e4c3f4
2bad35b7c958 ^
1da177e4c3f4
5ab11c98d3a9 ^
1da177e4c3f4

1706d58763c3 ^
5173cc057787 ^
1da177e4c3f4


be991971d53e ^
5173cc057787 ^



1706d58763c3 ^



1706d58763c3 ^



d6bebca92c66 ^

1706d58763c3 ^

5ab11c98d3a9 ^

1706d58763c3 ^
cbf8f7bb200f ^
5ab11c98d3a9 ^
1706d58763c3 ^

51456b2914a3 ^
547b792cac0a ^
1da177e4c3f4

c9bdd4b52574 ^
5ab11c98d3a9 ^
1da177e4c3f4
1706d58763c3 ^
132adf54639c ^
1da177e4c3f4


14bbd6a565e1 ^
1da177e4c3f4




21dc33015745 ^
1da177e4c3f4


51456b2914a3 ^

1da177e4c3f4



d7fcf1a5cae2 ^
9e903e085262 ^

1da177e4c3f4




0e60d245a0be ^
1da177e4c3f4

14fe22e33462 ^
d56f90a7c96d ^
1da177e4c3f4
14fe22e33462 ^


1da177e4c3f4

84fa7933a33f ^
1da177e4c3f4
14fe22e33462 ^
1da177e4c3f4
5510b3c2a173 ^
1da177e4c3f4


5ab11c98d3a9 ^
d6b915e29f4a ^
1da177e4c3f4
eddc9ec53be2 ^
1da177e4c3f4
5173cc057787 ^
d6b915e29f4a ^















0848f6428ba3 ^

2bad35b7c958 ^
5ab11c98d3a9 ^
d6bebca92c66 ^
1706d58763c3 ^
1da177e4c3f4

ba7a46f16dd2 ^
45542479fb26 ^
1da177e4c3f4

e87cc4728f0e ^
1da177e4c3f4
bbf31bf18d34 ^
1706d58763c3 ^
1da177e4c3f4


19bcf9f203c8 ^
1da177e4c3f4
9972f134a273 ^
385add906b61 ^
1da177e4c3f4
e905a9edab7f ^
7c73a6faffae ^
1da177e4c3f4
1da177e4c3f4
9972f134a273 ^
00db41243e8d ^
1706d58763c3 ^
1da177e4c3f4
5ab11c98d3a9 ^
1da177e4c3f4
1706d58763c3 ^
1da177e4c3f4
5ab11c98d3a9 ^
4b6cb5d8e3f5 ^
776c729e8d91 ^
1da177e4c3f4

7c73a6faffae ^
1da177e4c3f4
776c729e8d91 ^
1da177e4c3f4
4bc2f18ba4f2 ^
1da177e4c3f4
19bcf9f203c8 ^
bc416d9768aa ^
1bf3751ec90c ^
3e32e733d1bb ^
bc416d9768aa ^




3e32e733d1bb ^


bc416d9768aa ^

1bf3751ec90c ^
bc416d9768aa ^
1bf3751ec90c ^

3e32e733d1bb ^
bc416d9768aa ^

1bf3751ec90c ^
bc416d9768aa ^

3e32e733d1bb ^
1bf3751ec90c ^
3e32e733d1bb ^
bc416d9768aa ^

19bcf9f203c8 ^
bc416d9768aa ^
7539fadcb814 ^
bc416d9768aa ^





8d8354d2fb92 ^


0a64b4b81102 ^
8d8354d2fb92 ^
8d8354d2fb92 ^
e31e0bdc7e7f ^
8d8354d2fb92 ^

1bab4c75075b ^

8d8354d2fb92 ^

8d8354d2fb92 ^
e31e0bdc7e7f ^
8d8354d2fb92 ^

1bab4c75075b ^


8d8354d2fb92 ^

8d8354d2fb92 ^
b2fd5321dd16 ^
8d8354d2fb92 ^

6d9f239a1edb ^
8d8354d2fb92 ^
7d291ebb8342 ^


e3a57d18b061 ^

7d291ebb8342 ^
8d8354d2fb92 ^
8d8354d2fb92 ^
e3a57d18b061 ^
8d8354d2fb92 ^

6d9f239a1edb ^
8d8354d2fb92 ^





6d9f239a1edb ^
8d8354d2fb92 ^




2c8c1e7297e1 ^
8d8354d2fb92 ^
e4a2d5c2bccd ^
8d8354d2fb92 ^

0a64b4b81102 ^
09ad9bc75251 ^
0a64b4b81102 ^
51456b2914a3 ^
e4a2d5c2bccd ^

e31e0bdc7e7f ^
1bab4c75075b ^

e31e0bdc7e7f ^
1bab4c75075b ^
b2fd5321dd16 ^
464dc801c76a ^



e4a2d5c2bccd ^

ec8f23ce0f40 ^
51456b2914a3 ^
e4a2d5c2bccd ^





09ad9bc75251 ^
e4a2d5c2bccd ^




2c8c1e7297e1 ^
e4a2d5c2bccd ^





8d8354d2fb92 ^
7d291ebb8342 ^
57a02c39c1c2 ^
7d291ebb8342 ^
4344475797a1 ^
7d291ebb8342 ^
8d8354d2fb92 ^
aa1f731e5280 ^
8d8354d2fb92 ^


e4a2d5c2bccd ^
aa1f731e5280 ^
e4a2d5c2bccd ^

7d291ebb8342 ^
aa1f731e5280 ^
7d291ebb8342 ^

8d8354d2fb92 ^

2c8c1e7297e1 ^
8d8354d2fb92 ^
1d6119baf061 ^

c2a936600f78 ^












e31e0bdc7e7f ^
c2a936600f78 ^

e31e0bdc7e7f ^
b2fd5321dd16 ^





1d6119baf061 ^






8d8354d2fb92 ^

2c8c1e7297e1 ^
81566e8322c3 ^
0a64b4b81102 ^
81566e8322c3 ^







b7aa0bf70c4a ^
1da177e4c3f4
7d291ebb8342 ^
81566e8322c3 ^
321a3a99e471 ^
c6fda282294d ^
1e4b82873af0 ^
1e4b82873af0 ^
abd6523d15f4 ^
e521db9d790a ^
d4ad4d22e7ac ^


1da177e4c3f4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900