1 |
145 |
lanttu |
/*
|
2 |
|
|
* Copyright (c) 2010, Mentor Graphics Corporation
|
3 |
|
|
* All rights reserved.
|
4 |
|
|
*
|
5 |
|
|
* Redistribution and use in source and binary forms, with or without
|
6 |
|
|
* modification, are permitted provided that the following conditions are met:
|
7 |
|
|
*
|
8 |
|
|
* 1. Redistributions of source code must retain the above copyright notice,
|
9 |
|
|
* this list of conditions and the following disclaimer.
|
10 |
|
|
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
11 |
|
|
* this list of conditions and the following disclaimer in the documentation
|
12 |
|
|
* and/or other materials provided with the distribution.
|
13 |
|
|
* 3. Neither the name of the <ORGANIZATION> nor the names of its contributors
|
14 |
|
|
* may be used to endorse or promote products derived from this software
|
15 |
|
|
* without specific prior written permission.
|
16 |
|
|
*
|
17 |
|
|
* Alternatively, this software may be distributed under the terms of the
|
18 |
|
|
* GNU General Public License ("GPL") version 2 as published by the Free
|
19 |
|
|
* Software Foundation.
|
20 |
|
|
*
|
21 |
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
22 |
|
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
23 |
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
24 |
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
25 |
|
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
26 |
|
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
27 |
|
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
28 |
|
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
29 |
|
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
30 |
|
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
31 |
|
|
* POSSIBILITY OF SUCH DAMAGE.
|
32 |
|
|
*/
|
33 |
|
|
|
34 |
|
|
#ifndef __MCOMM_H__
|
35 |
|
|
#define __MCOMM_H__
|
36 |
|
|
|
37 |
|
|
#include <linux/kernel.h>
|
38 |
|
|
#include <linux/ioctl.h>
|
39 |
|
|
#include <linux/cdev.h>
|
40 |
|
|
#include <linux/wait.h>
|
41 |
|
|
#include <linux/ioport.h>
|
42 |
|
|
|
43 |
|
|
typedef u32 mcomm_core_t;
|
44 |
|
|
typedef u32 mcomm_mbox_t;
|
45 |
|
|
|
46 |
|
|
/* Specify the layout of the mailboxes in shared memory */
|
47 |
|
|
#define MCOMM_INIT _IOW('*', 0, struct mcomm_init_device)
|
48 |
|
|
/* All values in bytes */
|
49 |
|
|
struct mcomm_init_device {
|
50 |
|
|
mcomm_mbox_t nr_mboxes;
|
51 |
|
|
u32 offset; /* Offset from base of shared memory to first mailbox */
|
52 |
|
|
u32 mbox_size;
|
53 |
|
|
u32 mbox_stride; /* Offset from mailbox N to mailbox N+1 */
|
54 |
|
|
};
|
55 |
|
|
|
56 |
|
|
/* Get hardware-defined number for the current core */
|
57 |
|
|
#define MCOMM_CPUID _IOR('*', 1, mcomm_core_t)
|
58 |
|
|
|
59 |
|
|
/* Block until data is available for specified mailbox */
|
60 |
|
|
#define MCOMM_WAIT_READ _IOW('*', 2, mcomm_mbox_t)
|
61 |
|
|
|
62 |
|
|
/* Notify the specified core that data has been made available to it */
|
63 |
|
|
#define MCOMM_NOTIFY _IOW('*', 3, mcomm_core_t)
|
64 |
|
|
|
65 |
|
|
#ifdef __KERNEL__
|
66 |
|
|
|
67 |
|
|
#ifndef NO_IRQ
|
68 |
|
|
#define NO_IRQ 0
|
69 |
|
|
#endif
|
70 |
|
|
|
71 |
|
|
struct vm_area_struct;
|
72 |
|
|
|
73 |
|
|
struct mcomm_platform_ops {
|
74 |
|
|
pgprot_t (*mmap_pgprot)(struct vm_area_struct *vma);
|
75 |
|
|
/* Can't call this "ioremap" because ARM #defines it to other names. */
|
76 |
|
|
void __iomem *(*map)(unsigned long phys_addr, size_t size);
|
77 |
|
|
void (*notify)(u32 core_nr);
|
78 |
|
|
void (*ack)(void);
|
79 |
|
|
unsigned long (*cpuid)(void);
|
80 |
|
|
};
|
81 |
|
|
|
82 |
|
|
int mcomm_init(struct mcomm_platform_ops *ops, struct module *module);
|
83 |
|
|
void mcomm_exit(void);
|
84 |
|
|
|
85 |
|
|
int mcomm_new_region(struct device *dev, struct resource *mem,
|
86 |
|
|
struct resource *irq);
|
87 |
|
|
void mcomm_remove_region(struct device *dev);
|
88 |
|
|
|
89 |
|
|
#endif /* __KERNEL__ */
|
90 |
|
|
|
91 |
|
|
#endif /* __MCOMM_H__ */
|