Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
linux-davinci
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
linux
linux-davinci
Commits
6b752515
Commit
6b752515
authored
May 26, 2009
by
Ramesh Gupta
Committed by
Hari Kanigeri
Sep 15, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Chech patch fixes in ducati driver Chech patch fixes in ducati driver
Signed-off-by:
Ramesh Gupta G
<
grgupta@ti.com
>
parent
2f6543df
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
283 additions
and
266 deletions
+283
-266
arch/arm/plat-omap/include/syslink/notify_ducatidriver.h
arch/arm/plat-omap/include/syslink/notify_ducatidriver.h
+1
-3
drivers/dsp/syslink/notify_dispatcher/hw_mbox.c
drivers/dsp/syslink/notify_dispatcher/hw_mbox.c
+6
-7
drivers/dsp/syslink/notify_dispatcher/notify_dispatcher.c
drivers/dsp/syslink/notify_dispatcher/notify_dispatcher.c
+1
-2
drivers/dsp/syslink/notify_ducatidriver/drv_ducati.c
drivers/dsp/syslink/notify_ducatidriver/drv_ducati.c
+76
-74
drivers/dsp/syslink/notify_ducatidriver/notify_ducati.c
drivers/dsp/syslink/notify_ducatidriver/notify_ducati.c
+199
-180
No files found.
arch/arm/plat-omap/include/syslink/notify_ducatidriver.h
View file @
6b752515
...
...
@@ -40,9 +40,7 @@
#define REG volatile
extern
u32
get_ducati_virt_mem
();
/*
* func notify_mbxdrv_register_event
...
...
drivers/dsp/syslink/notify_dispatcher/hw_mbox.c
View file @
6b752515
...
...
@@ -337,8 +337,7 @@ long hw_mbox_event_status(
const
unsigned
long
base_address
,
const
enum
hw_mbox_id_t
mail_box_id
,
const
enum
hw_mbox_userid_t
user_id
,
unsigned
long
*
const
p_eventStatus
)
unsigned
long
*
const
p_eventStatus
)
{
long
status
=
RET_OK
;
unsigned
long
irq_status_reg
;
...
...
drivers/dsp/syslink/notify_dispatcher/notify_dispatcher.c
View file @
6b752515
...
...
@@ -29,7 +29,6 @@ MODULE_AUTHOR("Suman Anna");
MODULE_AUTHOR
(
"Hari Kanigeri"
);
MODULE_DESCRIPTION
(
"Dispatchers mailbox events"
);
#define OMAP_MBOX_BASE 0x4A0F4000
#define OMAP_MBOX_SIZE 0x2000
...
...
@@ -375,7 +374,7 @@ EXPORT_SYMBOL(ntfy_disp_send);
*
* Remove the ISR to the HW interrupt line coming into the processor
*/
int
ntfy_disp_unbind_interrupt
(
int
interrupt_no
)
int
ntfy_disp_unbind_interrupt
(
int
interrupt_no
)
{
int
i
;
short
int
valid_interrupt
=
false
;
...
...
drivers/dsp/syslink/notify_ducatidriver/drv_ducati.c
View file @
6b752515
...
...
@@ -39,8 +39,8 @@ static signed long int major = 234 ;
/* driver function to open the notify mailbox driver object. */
static
int
drvducati_open
(
struct
inode
*
inode
,
struct
file
*
filp
);
static
int
drvducati_release
(
struct
inode
*
inode
,
struct
file
*
filp
);
static
int
drvducati_ioctl
(
struct
inode
*
inode
,
static
int
drvducati_release
(
struct
inode
*
inode
,
struct
file
*
filp
);
static
int
drvducati_ioctl
(
struct
inode
*
inode
,
struct
file
*
filp
,
unsigned
int
cmd
,
unsigned
long
args
);
...
...
@@ -54,7 +54,7 @@ static void __exit drvducati_finalize_module(void) ;
/* Function to invoke the APIs through ioctl. */
static
struct
file_operations
driver_ops
=
{
static
const
struct
file_operations
driver_ops
=
{
.
open
=
drvducati_open
,
.
release
=
drvducati_release
,
.
ioctl
=
drvducati_ioctl
,
...
...
@@ -85,7 +85,7 @@ static int drvducati_open(struct inode *inode, struct file *filp)
}
/*drivr close*/
static
int
drvducati_release
(
struct
inode
*
inode
,
struct
file
*
filp
)
static
int
drvducati_release
(
struct
inode
*
inode
,
struct
file
*
filp
)
{
return
0
;
}
...
...
@@ -96,7 +96,7 @@ static int drvducati_release(struct inode * inode, struct file * filp)
* brief linux driver function to invoke the APIs through ioctl.
*
*/
static
int
drvducati_ioctl
(
struct
inode
*
inode
,
static
int
drvducati_ioctl
(
struct
inode
*
inode
,
struct
file
*
filp
,
unsigned
int
cmd
,
unsigned
long
args
)
...
...
@@ -104,41 +104,40 @@ static int drvducati_ioctl(struct inode * inode,
int
status
=
0
;
int
osStatus
=
0
;
int
retVal
=
0
;
struct
notify_ducatidrv_cmdargs
*
cmd_args
=
(
struct
notify_ducatidrv_cmdargs
*
)
args
;
struct
notify_ducatidrv_cmdargs
*
cmd_args
=
(
struct
notify_ducatidrv_cmdargs
*
)
args
;
struct
notify_ducatidrv_cmdargs
common_args
;
switch
(
cmd
)
{
case
CMD_NOTIFYDRIVERSHM_GETCONFIG
:
{
struct
notify_ducatidrv_cmdargs_getconfig
*
src_args
=
struct
notify_ducatidrv_cmdargs_getconfig
*
src_args
=
(
struct
notify_ducatidrv_cmdargs_getconfig
*
)
args
;
struct
notify_ducatidrv_config
cfg
;
notify_ducatidrv_getconfig
(
&
cfg
);
if
(
osStatus
==
0
)
{
retVal
=
copy_to_user
((
void
*
)(
src_args
->
cfg
),
(
const
void
*
)
&
cfg
,
sizeof
(
struct
notify_ducatidrv_config
));
if
(
retVal
!=
0
)
{
retVal
=
copy_to_user
((
void
*
)(
src_args
->
cfg
),
(
const
void
*
)
&
cfg
,
sizeof
(
struct
notify_ducatidrv_config
));
if
(
retVal
!=
0
)
osStatus
=
-
EFAULT
;
}
}
}
break
;
case
CMD_NOTIFYDRIVERSHM_SETUP
:
{
struct
notify_ducatidrv_cmdargs_setup
*
src_args
=
struct
notify_ducatidrv_cmdargs_setup
*
src_args
=
(
struct
notify_ducatidrv_cmdargs_setup
*
)
args
;
struct
notify_ducatidrv_config
cfg
;
retVal
=
copy_from_user
((
void
*
)
&
cfg
,
(
const
void
*
)(
src_args
->
cfg
),
(
const
void
*
)(
src_args
->
cfg
),
sizeof
(
struct
notify_ducatidrv_config
));
if
(
retVal
!=
0
)
{
osStatus
=
-
EFAULT
;
}
else
{
status
=
notify_ducatidrv_setup
(
&
cfg
);
if
(
status
<
0
)
{
printk
(
"FAIL: notify_ducatidrv_setup
\n
"
);
}
if
(
status
<
0
)
printk
(
KERN_ERR
"FAIL: notify_ducatidrv_setup
\n
"
);
}
}
break
;
...
...
@@ -146,9 +145,8 @@ static int drvducati_ioctl(struct inode * inode,
case
CMD_NOTIFYDRIVERSHM_DESTROY
:
{
status
=
notify_ducatidrv_destroy
();
if
(
status
<
0
)
{
printk
(
"FAIL: notify_ducatidrv_destroy
\n
"
);
}
if
(
status
<
0
)
printk
(
KERN_ERR
"FAIL: notify_ducatidrv_destroy
\n
"
);
}
break
;
...
...
@@ -156,64 +154,66 @@ static int drvducati_ioctl(struct inode * inode,
struct
notify_ducatidrv_cmdargs_paramsinit
src_args
;
struct
notify_ducatidrv_params
params
;
retVal
=
copy_from_user
((
void
*
)
&
src_args
,
(
const
void
*
)(
args
),
sizeof
(
struct
notify_ducatidrv_cmdargs_paramsinit
));
if
(
retVal
!=
0
)
{
(
const
void
*
)(
args
),
sizeof
(
struct
notify_ducatidrv_cmdargs_paramsinit
));
if
(
retVal
!=
0
)
osStatus
=
-
EFAULT
;
}
else
{
notify_ducatidrv_params_init
(
src_args
.
handle
,
&
params
);
}
else
notify_ducatidrv_params_init
(
src_args
.
handle
,
&
params
);
if
(
osStatus
==
0
)
{
retVal
=
copy_to_user
((
void
*
)(
src_args
.
params
),
(
const
void
*
)
&
params
,
retVal
=
copy_to_user
((
void
*
)(
src_args
.
params
),
(
const
void
*
)
&
params
,
sizeof
(
struct
notify_ducatidrv_params
));
if
(
retVal
!=
0
)
{
if
(
retVal
!=
0
)
osStatus
=
-
EFAULT
;
}
}
}
break
;
case
CMD_NOTIFYDRIVERSHM_CREATE
:
{
struct
notify_ducatidrv_cmdargs_create
src_args
;
retVal
=
copy_from_user
((
void
*
)
&
src_args
,
(
const
void
*
)(
args
),
retVal
=
copy_from_user
((
void
*
)
&
src_args
,
(
const
void
*
)(
args
),
sizeof
(
struct
notify_ducatidrv_cmdargs_create
));
if
(
retVal
!=
0
)
{
if
(
retVal
!=
0
)
osStatus
=
-
EFAULT
;
}
else
{
src_args
.
handle
=
notify_ducatidrv_create
(
src_args
.
driverName
,
else
{
src_args
.
handle
=
notify_ducatidrv_create
(
src_args
.
driverName
,
&
(
src_args
.
params
));
if
(
src_args
.
handle
==
NULL
)
{
status
=
-
EFAULT
;
printk
(
"drvducati_ioctl:status 0x%x,NotifyDriverShm_create failed"
,
status
);
printk
(
KERN_ERR
"drvducati_ioctl:status 0x%x,"
"NotifyDriverShm_create failed"
,
status
);
}
}
if
(
osStatus
==
0
)
{
retVal
=
copy_to_user
((
void
*
)(
args
),
(
const
void
*
)
&
src_args
,
retVal
=
copy_to_user
((
void
*
)(
args
),
(
const
void
*
)
&
src_args
,
sizeof
(
struct
notify_ducatidrv_cmdargs_create
));
if
(
retVal
!=
0
)
{
if
(
retVal
!=
0
)
osStatus
=
-
EFAULT
;
}
}
}
break
;
case
CMD_NOTIFYDRIVERSHM_DELETE
:
{
struct
notify_ducatidrv_cmdargs_delete
src_args
;
retVal
=
copy_from_user
((
void
*
)
&
src_args
,
(
const
void
*
)(
args
),
retVal
=
copy_from_user
((
void
*
)
&
src_args
,
(
const
void
*
)(
args
),
sizeof
(
struct
notify_ducatidrv_cmdargs_delete
));
if
(
retVal
!=
0
)
{
if
(
retVal
!=
0
)
osStatus
=
-
EFAULT
;
}
else
{
else
{
status
=
notify_ducatidrv_delete
(
&
(
src_args
.
handle
));
if
(
status
<
0
)
{
printk
(
"drvducati_ioctl: notify_ducatidrv_delete failed status = %d
\n
"
,
status
);
}
if
(
status
<
0
)
printk
(
KERN_ERR
"drvducati_ioctl:"
" notify_ducatidrv_delete failed"
" status = %d
\n
"
,
status
);
}
}
break
;
...
...
@@ -221,8 +221,8 @@ static int drvducati_ioctl(struct inode * inode,
case
CMD_NOTIFYDRIVERSHM_OPEN
:
{
struct
notify_ducatidrv_cmdargs_open
src_args
;
retVal
=
copy_from_user
((
void
*
)
&
src_args
,
(
const
void
*
)(
args
),
retVal
=
copy_from_user
((
void
*
)
&
src_args
,
(
const
void
*
)(
args
),
sizeof
(
struct
notify_ducatidrv_cmdargs_open
));
if
(
retVal
!=
0
)
{
osStatus
=
-
EFAULT
;
...
...
@@ -230,34 +230,36 @@ static int drvducati_ioctl(struct inode * inode,
status
=
notify_ducatidrv_open
(
src_args
.
driverName
,
&
(
src_args
.
handle
));
if
(
status
<
0
)
{
printk
(
"drvducati_ioctl: notify_ducatidrv_open failed status = %d
\n
"
,
status
);
}
if
(
status
<
0
)
printk
(
KERN_ERR
"drvducati_ioctl:"
" notify_ducatidrv_open failed"
" status = %d
\n
"
,
status
);
}
if
(
osStatus
==
0
)
{
retVal
=
copy_to_user
((
void
*
)(
args
),
(
const
void
*
)
&
src_args
,
sizeof
(
struct
notify_ducatidrv_cmdargs_open
));
if
(
retVal
!=
0
)
{
retVal
=
copy_to_user
((
void
*
)(
args
),
(
const
void
*
)
&
src_args
,
sizeof
(
struct
notify_ducatidrv_cmdargs_open
));
if
(
retVal
!=
0
)
osStatus
=
-
EFAULT
;
}
}
}
break
;
case
CMD_NOTIFYDRIVERSHM_CLOSE
:
{
struct
notify_ducatidrv_cmdargs_close
src_args
;
retVal
=
copy_from_user
((
void
*
)
&
src_args
,
(
const
void
*
)(
args
),
retVal
=
copy_from_user
((
void
*
)
&
src_args
,
(
const
void
*
)(
args
),
sizeof
(
struct
notify_ducatidrv_cmdargs_close
));
if
(
retVal
!=
0
)
{
osStatus
=
-
EFAULT
;
}
else
{
status
=
notify_ducatidrv_close
(
&
(
src_args
.
handle
));
if
(
status
<
0
)
{
printk
(
"drvducati_ioctl: notify_ducatidrv_close failed status = %d
\n
"
,
status
);
}
if
(
status
<
0
)
printk
(
KERN_ERR
"drvducati_ioctl:"
" notify_ducatidrv_close"
" failed status = %d
\n
"
,
status
);
}
}
break
;
...
...
@@ -265,24 +267,24 @@ static int drvducati_ioctl(struct inode * inode,
default:
{
status
=
-
EINVAL
;
osStatus
=
-
EINVAL
;
printk
(
"drivducati_ioctl:Unsupported ioctl command specified"
);
printk
(
KERN_ERR
"drivducati_ioctl:Unsupported"
" ioctl command specified"
);
}
break
;
}
/* Set the status and copy the common args to user-side. */
common_args
.
api_status
=
status
;
retVal
=
copy_to_user
((
void
*
)
cmd_args
,
(
const
void
*
)
&
common_args
,
retVal
=
copy_to_user
((
void
*
)
cmd_args
,
(
const
void
*
)
&
common_args
,
sizeof
(
struct
notify_ducatidrv_cmdargs
));
if
(
retVal
!=
0
)
{
osStatus
=
-
EFAULT
;
}
else
{
if
(
status
==
-
ERESTARTSYS
)
{
if
(
status
==
-
ERESTARTSYS
)
osStatus
=
-
ERESTARTSYS
;
}
}
return
osStatus
;
}
...
...
drivers/dsp/syslink/notify_ducatidriver/notify_ducati.c
View file @
6b752515
...
...
@@ -59,8 +59,7 @@
#define PROC_DUCATI 1
#define PROC_GPP 2
extern
u32
get_ducati_virt_mem
();
static
void
notify_ducatidrv_isr
(
void
*
ref_data
);
/*
...
...
@@ -105,12 +104,6 @@ static struct notify_ducatidrv_module notify_ducatidriver_state = {
.
def_inst_params
.
send_int_id
=
(
int
)
-
1
};
void
notify_ducatidrv_isr
(
void
*
ref_data
);
/*
*This function searchs for a element the List.
*/
...
...
@@ -154,7 +147,8 @@ int notify_ducatidrv_open(char *driver_name,
BUG_ON
(
driver_name
==
NULL
);
BUG_ON
(
handle_ptr
==
NULL
);
/* Enter critical section protection. */
WARN_ON
(
mutex_lock_interruptible
(
notify_ducatidriver_state
.
gate_handle
)
!=
0
);
WARN_ON
(
mutex_lock_interruptible
(
notify_ducatidriver_state
.
gate_handle
)
!=
0
);
/* Get the handle from Notify module. */
status
=
notify_get_driver_handle
(
driver_name
,
handle_ptr
);
WARN_ON
(
status
<
0
);
...
...
@@ -197,7 +191,7 @@ void notify_ducatidrv_params_init(struct notify_driver_object *handle,
&
(
notify_ducatidriver_state
.
def_inst_params
),
sizeof
(
struct
notify_ducatidrv_params
));
}
else
{
/*
Return updated NotifyDriverShm instance specific parameters.
*/
/*
Return updated NotifyDriverShm instance specific parameters
*/
driver_obj
=
(
struct
notify_ducatidrv_object
*
)
handle
->
driver_object
;
memcpy
(
params
,
&
(
driver_obj
->
params
),
...
...
@@ -251,9 +245,9 @@ struct notify_driver_object *notify_ducatidrv_create(char *driver_name,
/* This driver supports interaction with one other remote
* processor.*/
for
(
i
=
0
;
i
<
MULTIPROC_MAXPROCESSORS
;
i
++
)
{
for
(
i
=
0
;
i
<
MULTIPROC_MAXPROCESSORS
;
i
++
)
{
/* Initialize all to invalid. */
drv_attrs
.
proc_info
[
i
].
proc_id
=
(
u16
)
0xFFFF
;
drv_attrs
.
proc_info
[
i
].
proc_id
=
(
u16
)
0xFFFF
;
}
drv_attrs
.
numProc
=
1
;
drv_attrs
.
proc_info
[
params
->
remote_proc_id
].
max_events
=
...
...
@@ -269,13 +263,13 @@ struct notify_driver_object *notify_ducatidrv_create(char *driver_name,
params
->
remote_proc_id
;
/* Function table information */
fxn_table
.
register_event
=
(
void
*
)
&
notify_ducatidrv_register_event
;
fxn_table
.
unregister_event
=
(
void
*
)
&
notify_ducatidrv_unregister_event
;
fxn_table
.
send_event
=
(
void
*
)
&
notify_ducatidrv_sendevent
;
fxn_table
.
disable
=
(
void
*
)
&
notify_ducatidrv_disable
;
fxn_table
.
restore
=
(
void
*
)
&
notify_ducatidrv_restore
;
fxn_table
.
disable_event
=
(
void
*
)
&
notify_ducatidrv_disable_event
;
fxn_table
.
enable_event
=
(
void
*
)
&
notify_ducatidrv_enable_event
;
fxn_table
.
register_event
=
(
void
*
)
&
notify_ducatidrv_register_event
;
fxn_table
.
unregister_event
=
(
void
*
)
&
notify_ducatidrv_unregister_event
;
fxn_table
.
send_event
=
(
void
*
)
&
notify_ducatidrv_sendevent
;
fxn_table
.
disable
=
(
void
*
)
&
notify_ducatidrv_disable
;
fxn_table
.
restore
=
(
void
*
)
&
notify_ducatidrv_restore
;
fxn_table
.
disable_event
=
(
void
*
)
&
notify_ducatidrv_disable_event
;
fxn_table
.
enable_event
=
(
void
*
)
&
notify_ducatidrv_enable_event
;
/* Register driver with the Notify module. */
status
=
notify_register_driver
(
driver_name
,
...
...
@@ -283,11 +277,9 @@ struct notify_driver_object *notify_ducatidrv_create(char *driver_name,
&
drv_attrs
,
&
drv_handle
);
if
(
status
<
0
)
{
/*
@
retval NULL Failed to register driver with Notify module!*/
/*retval NULL Failed to register driver with Notify module!*/
status
=
-
EINVAL
;
}
else
{
/* Allocate memory for the NotifyDriverShm_Object object. */
/* Allocate memory for the NotifyDriverShm_Object object. */
drv_handle
->
driver_object
=
driver_obj
=
kmalloc
(
sizeof
(
struct
notify_ducatidrv_object
),
...
...
@@ -299,78 +291,74 @@ struct notify_driver_object *notify_ducatidrv_create(char *driver_name,
}
else
{
memcpy
(
&
(
driver_obj
->
params
),
(
void
*
)
params
,
sizeof
(
struct
notify_ducatidrv_params
));
}
}
if
(
status
>=
0
)
{
/*FIX ME Need to use MultiProc*/
/*FIX ME Need to use MultiProc*/
driver_obj
->
self_id
=
OTHER_ID
;
driver_obj
->
other_id
=
SELF_ID
;
shm_va
=
get_ducati_virt_mem
();
driver_obj
->
ctrl_ptr
=
(
struct
notify_shmdrv_ctrl
*
)
shm_va
;
ctrl_ptr
=
&
(
driver_obj
->
ctrl_ptr
->
proc_ctrl
[
driver_obj
->
self_id
]);
ctrl_ptr
->
self_event_chart
=
(
struct
notify_shmdrv_event_entry
*
)
ctrl_ptr
=
&
(
driver_obj
->
ctrl_ptr
->
proc_ctrl
[
driver_obj
->
self_id
]);
ctrl_ptr
->
self_event_chart
=
(
struct
notify_shmdrv_event_entry
*
)
((
int
)(
driver_obj
->
ctrl_ptr
)
+
sizeof
(
struct
notify_shmdrv_ctrl
)
+
(
sizeof
(
struct
notify_shmdrv_event_entry
)
+
sizeof
(
struct
notify_shmdrv_ctrl
)
+
(
sizeof
(
struct
notify_shmdrv_event_entry
)
*
params
->
num_events
*
driver_obj
->
other_id
));
ctrl_ptr
->
other_event_chart
=
(
struct
notify_shmdrv_event_entry
*
)
ctrl_ptr
->
other_event_chart
=
(
struct
notify_shmdrv_event_entry
*
)
((
int
)(
driver_obj
->
ctrl_ptr
)
+
sizeof
(
struct
notify_shmdrv_ctrl
)
+
(
sizeof
(
struct
notify_shmdrv_event_entry
)
+
sizeof
(
struct
notify_shmdrv_ctrl
)
+
(
sizeof
(
struct
notify_shmdrv_event_entry
)
*
params
->
num_events
*
driver_obj
->
self_id
));
driver_obj
->
proc_id
=
params
->
remote_proc_id
;
driver_obj
->
event_list
=
kmalloc
((
sizeof
(
struct
notify_drv_eventlist
)
driver_obj
->
event_list
=
kmalloc
(
(
sizeof
(
struct
notify_drv_eventlist
)
*
params
->
num_events
),
GFP_ATOMIC
);
if
(
driver_obj
->
event_list
==
NULL
)
{
status
=
-
ENOMEM
;
goto
func_end
;
}
else
{
memset
(
driver_obj
->
event_list
,
0
,
sizeof
(
struct
notify_drv_eventlist
)
*
params
->
num_events
);
sizeof
(
struct
notify_drv_eventlist
)
*
params
->
num_events
);
}
driver_obj
->
reg_chart
=
kmalloc
(
sizeof
(
struct
notify_shmdrv_eventreg
)
*
params
->
num_events
,
GFP_ATOMIC
);
driver_obj
->
reg_chart
=
kmalloc
(
sizeof
(
struct
notify_shmdrv_eventreg
)
*
params
->
num_events
,
GFP_ATOMIC
);
if
(
driver_obj
->
reg_chart
==
NULL
)
{
status
=
-
ENOMEM
;
goto
func_end
;
}
else
{
memset
(
driver_obj
->
reg_chart
,
0
,
sizeof
(
struct
notify_shmdrv_eventreg
)
memset
(
driver_obj
->
reg_chart
,
0
,
sizeof
(
struct
notify_shmdrv_eventreg
)
*
params
->
num_events
);
}
event_list
=
driver_obj
->
event_list
;
for
(
i
=
0
;
(
i
<
params
->
num_events
)
;
i
++
)
{
ctrl_ptr
->
self_event_chart
[
i
].
flag
=
0
;
driver_obj
->
reg_chart
[
i
].
reg_event_no
=
(
int
)
-
1
;
event_list
[
i
].
event_handler_count
=
0
;
INIT_LIST_HEAD
(
&
event_list
[
i
].
listeners
);
}
}
mbox_hw_config
=
ntfy_disp_get_config
();
mbox_module_no
=
mbox_hw_config
->
mbox_modules
;
interrupt_no
=
mbox_hw_config
->
interrupt_lines
[
mbox_module_no
-
1
];
mbx_ret_val
=
ntfy_disp_bind_interrupt
(
interrupt_no
,
(
void
*
)
notify_mailbx0_user0_isr
,
NULL
);
(
void
*
)
notify_mailbx0_user0_isr
,
NULL
);
/*Set up the ISR on the Modena-ducati FIFO */
if
(
mbx_ret_val
==
0
)
{
proc_id
=
PROC_DUCATI
;
...
...
@@ -381,7 +369,8 @@ struct notify_driver_object *notify_ducatidrv_create(char *driver_name,
if
(
mbx_ret_val
==
0
)
{
mbx_ret_val
=
ntfy_disp_interrupt_enable
(
mbox_module_no
,
(
NOTIFYDRV_DUCATI_RECV_MBX
*
2
));
mbox_module_no
,
(
NOTIFYDRV_DUCATI_RECV_MBX
*
2
));
}
}
/*Set up the ISR on the Modena-Ducati FIFO */
...
...
@@ -399,14 +388,14 @@ struct notify_driver_object *notify_ducatidrv_create(char *driver_name,
ctrl_ptr
->
send_init_status
=
NOTIFYSHMDRV_INIT_STAMP
;
drv_handle
->
is_init
=
NOTIFY_DRIVERINITSTATUS_DONE
;
}
else
{
/* Check if drvHandle was
registered with Notify module. */
/* Check if drvHandle was
registered with Notify module. */
if
(
drv_handle
!=
NULL
)
{
/* Unregister driver from the Notify module
.
*/
/* Unregister driver from the Notify module*/
notify_unregister_driver
(
drv_handle
);
if
(
ctrl_ptr
!=
NULL
)
{
/* Clear initialization status in shared memory. */
/* Clear initialization status in
shared memory. */
ctrl_ptr
->
recv_init_status
=
0x0
;
ctrl_ptr
->
send_init_status
=
0x0
;
ctrl_ptr
=
NULL
;
...
...
@@ -415,9 +404,15 @@ struct notify_driver_object *notify_ducatidrv_create(char *driver_name,
if
(
driver_obj
!=
NULL
)
{
/* Check if event List was allocated. */
if
(
driver_obj
->
event_list
!=
NULL
)
{
/* Check if lists were created. */
for
(
i
=
0
;
i
<
params
->
num_events
;
i
++
)
{
list_del
((
struct
list_head
*
)
&
driver_obj
->
event_list
[
i
].
listeners
);
/* Check if lists were
created. */
for
(
i
=
0
;
i
<
params
->
num_events
;
i
++
)
{
list_del
(
(
struct
list_head
*
)
&
driver_obj
->
event_list
[
i
].
listeners
);
}
kfree
(
driver_obj
->
event_list
);
driver_obj
->
event_list
=
NULL
;
...
...
@@ -425,17 +420,17 @@ struct notify_driver_object *notify_ducatidrv_create(char *driver_name,
/* Check if regChart was allocated. */
if
(
driver_obj
->
reg_chart
!=
NULL
)
{
kfree
(
driver_obj
->
reg_chart
);
driver_obj
->
reg_chart
=
NULL
;
driver_obj
->
reg_chart
=
NULL
;
}
kfree
(
driver_obj
);
}
drv_handle
->
is_init
=
NOTIFY_DRIVERINITSTATUS_NOTDONE
;
drv_handle
->
is_init
=
NOTIFY_DRIVERINITSTATUS_NOTDONE
;
drv_handle
=
NULL
;
}
}
func_end:
/* Leave critical section protection. */
mutex_unlock
(
notify_ducatidriver_state
.
gate_handle
);
...
...
@@ -443,8 +438,6 @@ func_end:
}
EXPORT_SYMBOL
(
notify_ducatidrv_create
);
/*
* brief Function to delete the instance of shared memory driver
*
...
...
@@ -462,11 +455,11 @@ int notify_ducatidrv_delete(struct notify_driver_object **handle_ptr)
int
interrupt_no
;
int
mbx_ret_val
=
0
;
WARN_ON
(
handle_ptr
==
NULL
);
if
(
handle_ptr
==
NULL
)
return
-
1
;
driver_obj
=
(
struct
notify_ducatidrv_object
*
)(
*
handle_ptr
)
->
driver_object
;
driver_obj
=
(
struct
notify_ducatidrv_object
*
)
(
*
handle_ptr
)
->
driver_object
;
drv_handle
=
(
*
handle_ptr
);
WARN_ON
((
*
handle_ptr
)
->
driver_object
==
NULL
);
...
...
@@ -485,10 +478,10 @@ int notify_ducatidrv_delete(struct notify_driver_object **handle_ptr)
if
(
driver_obj
!=
NULL
)
{
if
(
driver_obj
->
ctrl_ptr
!=
NULL
)
{
/* Clear initialization status in shared memory. */
driver_obj
->
ctrl_ptr
->
proc_ctrl
[
driver_obj
->
self_id
].
recv_init_status
=
0x0
;
driver_obj
->
ctrl_ptr
->
proc_ctrl
[
driver_obj
->
self_id
].
send_init_status
=
0x0
;
driver_obj
->
ctrl_ptr
->
proc_ctrl
[
driver_obj
->
self_id
].
recv_init_status
=
0x0
;
driver_obj
->
ctrl_ptr
->
proc_ctrl
[
driver_obj
->
self_id
].
send_init_status
=
0x0
;
driver_obj
->
ctrl_ptr
=
NULL
;
}
...
...
@@ -496,9 +489,11 @@ int notify_ducatidrv_delete(struct notify_driver_object **handle_ptr)
if
(
event_list
!=
NULL
)
{
/* Check if lists were created. */
for
(
i
=
0
;
i
<
driver_obj
->
params
.
num_events
;
i
++
)
{
WARN_ON
(
event_list
[
i
].
event_handler_count
!=
0
);
WARN_ON
(
event_list
[
i
].
event_handler_count
!=
0
);
event_list
[
i
].
event_handler_count
=
0
;
list_del
((
struct
list_head
*
)
&
event_list
[
i
].
listeners
);
list_del
((
struct
list_head
*
)
&
event_list
[
i
].
listeners
);
}
kfree
(
event_list
);
...
...
@@ -531,7 +526,6 @@ int notify_ducatidrv_delete(struct notify_driver_object **handle_ptr)
}
return
status
;
}
EXPORT_SYMBOL
(
notify_ducatidrv_delete
);
...
...
@@ -541,16 +535,14 @@ EXPORT_SYMBOL(notify_ducatidrv_delete);
*/
int
notify_ducatidrv_destroy
(
void
)
{
int
status
=
0
;
WARN_ON
(
notify_ducatidriver_state
.
is_setup
!=
true
);
/* Check if the gate_handle was created internally. */
if
(
notify_ducatidriver_state
.
cfg
.
gate_handle
==
NULL
)
{
if
(
notify_ducatidriver_state
.
gate_handle
!=
NULL
)
{
if
(
notify_ducatidriver_state
.
gate_handle
!=
NULL
)
kfree
(
notify_ducatidriver_state
.
gate_handle
);
}
}
notify_ducatidriver_state
.
is_setup
=
false
;
return
status
;
}
...
...
@@ -586,8 +578,8 @@ int notify_ducatidrv_setup(struct notify_ducatidrv_config *cfg)
if
(
cfg
->
gate_handle
!=
NULL
)
notify_ducatidriver_state
.
gate_handle
=
cfg
->
gate_handle
;
else
{
notify_ducatidriver_state
.
gate_handle
=
kmalloc
(
sizeof
(
struct
mutex
),
GFP_KERNEL
);
notify_ducatidriver_state
.
gate_handle
=
kmalloc
(
sizeof
(
struct
mutex
),
GFP_KERNEL
);
mutex_init
(
notify_ducatidriver_state
.
gate_handle
);
}
...
...
@@ -633,20 +625,24 @@ int notify_ducatidrv_register_event(
BUG_ON
(
fn_notify_cbck
==
NULL
);
driver_object
=
(
struct
notify_ducatidrv_object
*
)
handle
->
driver_object
;
driver_object
=
(
struct
notify_ducatidrv_object
*
)
handle
->
driver_object
;
ctrl_ptr
=
driver_object
->
ctrl_ptr
;
/* Allocate memory for event listener. */
event_listener
=
kmalloc
(
sizeof
(
struct
notify_drv_eventlistner
),
GFP_ATOMIC
);
event_listener
=
kmalloc
(
sizeof
(
struct
notify_drv_eventlistner
),
GFP_ATOMIC
);
if
(
event_listener
==
NULL
)
{
status
=
-
ENOMEM
;
goto
func_end
;
}
else
{
memset
(
event_listener
,
0
,
sizeof
(
struct
notify_drv_eventlistner
));
memset
(
event_listener
,
0
,
sizeof
(
struct
notify_drv_eventlistner
));
}
if
(
mutex_lock_interruptible
(
notify_ducatidriver_state
.
gate_handle
)
!=
0
)
if
(
mutex_lock_interruptible
(
notify_ducatidriver_state
.
gate_handle
)
!=
0
)
WARN_ON
(
1
);
event_list
=
driver_object
->
event_list
;
...
...
@@ -679,9 +675,11 @@ int notify_ducatidrv_register_event(
/* Find the correct slot in the registration array. */
if
(
reg_chart
[
i
].
reg_event_no
==
(
int
)
-
1
)
{
for
(
j
=
(
i
-
1
);
j
>=
0
;
j
--
)
{
if
(
event_no
<
reg_chart
[
j
].
reg_event_no
)
{
if
(
event_no
<
reg_chart
[
j
].
reg_event_no
)
{
reg_chart
[
j
+
1
].
reg_event_no
=
reg_chart
[
j
].
reg_event_no
;
reg_chart
[
j
].
reg_event_no
;
reg_chart
[
j
+
1
].
reserved
=
reg_chart
[
j
].
reserved
;
i
=
j
;
...
...
@@ -743,13 +741,15 @@ int notify_ducatidrv_unregister_event(
BUG_ON
(
handle
==
NULL
);
BUG_ON
(
handle
->
driver_object
==
NULL
);
driver_object
=
(
struct
notify_ducatidrv_object
*
)
handle
->
driver_object
;
driver_object
=
(
struct
notify_ducatidrv_object
*
)
handle
->
driver_object
;
num_events
=
driver_object
->
params
.
num_events
;
ctrl_ptr
=
driver_object
->
ctrl_ptr
;
/* Enter critical section protection. */
if
(
mutex_lock_interruptible
(
notify_ducatidriver_state
.
gate_handle
)
!=
0
)
if
(
mutex_lock_interruptible
(
notify_ducatidriver_state
.
gate_handle
)
!=
0
)
WARN_ON
(
1
);
event_list
=
driver_object
->
event_list
;
...
...
@@ -793,7 +793,8 @@ int notify_ducatidrv_unregister_event(
}
if
(
j
==
num_events
)
{
reg_chart
[
j
-
1
].
reg_event_no
=
(
int
)
-
1
;
reg_chart
[
j
-
1
].
reg_event_no
=
(
int
)
-
1
;
}
break
;
}
...
...
@@ -817,7 +818,7 @@ int notify_ducatidrv_sendevent(struct notify_driver_object *handle,
int
payload
,
short
int
wait_clear
)
{
int
status
=
0
;
struct
notify_ducatidrv_object
*
driver_object
;
struct
notify_ducatidrv_object
*
driver_object
;
struct
notify_shmdrv_ctrl
*
ctrl_ptr
;
int
max_poll_count
;
struct
notify_shmdrv_event_entry
*
other_event_chart
;
...
...
@@ -829,56 +830,63 @@ int notify_ducatidrv_sendevent(struct notify_driver_object *handle,
BUG_ON
(
handle
==
NULL
);
BUG_ON
(
handle
->
driver_object
==
NULL
);
mbox_hw_config
=
ntfy_disp_get_config
();
mbox_hw_config
=
ntfy_disp_get_config
();
mbox_module_no
=
mbox_hw_config
->
mbox_modules
;
driver_object
=
(
struct
notify_ducatidrv_object
*
)
handle
->
driver_object
;
driver_object
=
(
struct
notify_ducatidrv_object
*
)
handle
->
driver_object
;
BUG_ON
(
event_no
>
driver_object
->
params
.
num_events
);
ctrl_ptr
=
driver_object
->
ctrl_ptr
;
other_event_chart
=
ctrl_ptr
->
proc_ctrl
[
driver_object
->
self_id
].
other_event_chart
;
other_event_chart
=
ctrl_ptr
->
proc_ctrl
[
driver_object
->
self_id
].
other_event_chart
;
max_poll_count
=
driver_object
->
params
.
send_event_poll_count
;
/* Check whether driver supports interrupts from this processor to the
*
other processor, and if it is initialized
other processor, and if it is initialized
*/
if
(
ctrl_ptr
->
proc_ctrl
[
driver_object
->
other_id
].
recv_init_status
!=
NOTIFYSHMDRV_INIT_STAMP
)
{
status
=
-
ENODEV
;
/* This may be used for polling till other-side
driver is ready, so
*
do not set failure reason.
/* This may be used for polling till other-side
driver is ready, so
do not set failure reason.
*/
}
else
{
/* Check if other side is ready to receive this event. */
if
((
TEST_BIT
(
ctrl_ptr
->
proc_ctrl
[
driver_object
->
other_id
].
reg_mask
.
mask
,
event_no
)
==
false
)
||
(
TEST_BIT
(
ctrl_ptr
->
proc_ctrl
[
driver_object
->
other_id
].
reg_mask
.
enable_mask
,
event_no
)
==
false
))
{
if
((
TEST_BIT
(
ctrl_ptr
->
proc_ctrl
[
driver_object
->
other_id
].
reg_mask
.
mask
,
event_no
)
==
false
)
||
(
TEST_BIT
(
ctrl_ptr
->
proc_ctrl
[
driver_object
->
other_id
].
reg_mask
.
enable_mask
,
event_no
)
==
false
))
{
status
=
-
ENODEV
;
/* This may be used for polling till other-side is ready, so
* do not set failure reason.
*/
/* This may be used for polling till other-side
is ready, so do not set failure reason.*/
}
else
{
/* Enter critical section protection. */
if
(
mutex_lock_interruptible
(
notify_ducatidriver_state
.
gate_handle
)
!=
0
)
if
(
mutex_lock_interruptible
(
notify_ducatidriver_state
.
gate_handle
)
!=
0
)
WARN_ON
(
1
);
if
(
wait_clear
==
true
)
{
/* Wait for completion of previous event from other side. */
while
((
other_event_chart
[
event_no
].
flag
/*Wait for completion of prev
event from other side*/
while
((
other_event_chart
[
event_no
].
flag
!=
DOWN
)
&&
status
==
0
)
{
/* Leave critical section protection. Create a window
* of opportunity for other interrupts to be handled.
/* Leave critical section protection
Create a window of opportunity
for other interrupts to be handled.
*/
mutex_unlock
(
notify_ducatidriver_state
.
gate_handle
);
mutex_unlock
(
notify_ducatidriver_state
.
gate_handle
);
i
++
;
if
((
max_poll_count
!=
(
int
)
-
1
)
&&
(
i
==
max_poll_count
))
{
status
=
-
EBUSY
;
}
/* Enter critical section protection. */
if
(
mutex_lock_interruptible
(
notify_ducatidriver_state
.
gate_handle
)
!=
0
)
if
(
mutex_lock_interruptible
(
notify_ducatidriver_state
.
gate_handle
)
!=
0
)
WARN_ON
(
1
);
}
}
...
...
@@ -886,9 +894,11 @@ int notify_ducatidrv_sendevent(struct notify_driver_object *handle,
/* Set the event bit field and payload. */
other_event_chart
[
event_no
].
payload
=
payload
;
other_event_chart
[
event_no
].
flag
=
UP
;
/* Send an interrupt with the event information to the
remote processor */
mbx_ret_val
=
ntfy_disp_send
(
mbox_module_no
,
NOTIFYDRV_DUCATI_SEND_MBX
,
event_no
);
/* Send an interrupt with the event
information to theremote processor */
mbx_ret_val
=
ntfy_disp_send
(
mbox_module_no
,
NOTIFYDRV_DUCATI_SEND_MBX
,
event_no
);
if
(
mbx_ret_val
==
0
)
{
status
=
0
;
}
else
{
...
...
@@ -952,10 +962,12 @@ int notify_ducatidrv_disable_event(
BUG_ON
(
handle
==
NULL
);
BUG_ON
(
handle
->
driver_object
==
NULL
);
access_count
++
;
driver_object
=
(
struct
notify_ducatidrv_object
*
)
handle
->
driver_object
;
driver_object
=
(
struct
notify_ducatidrv_object
*
)
handle
->
driver_object
;
/* Enter critical section protection. */
if
(
mutex_lock_interruptible
(
notify_ducatidriver_state
.
gate_handle
)
!=
0
)
if
(
mutex_lock_interruptible
(
notify_ducatidriver_state
.
gate_handle
)
!=
0
)
WARN_ON
(
1
);
CLEAR_BIT
(
driver_object
->
ctrl_ptr
->
proc_ctrl
[
driver_object
->
self_id
].
...
...
@@ -977,10 +989,12 @@ int notify_ducatidrv_enable_event(struct notify_driver_object *handle,
BUG_ON
(
handle
==
NULL
);
BUG_ON
(
handle
->
driver_object
==
NULL
);
driver_object
=
(
struct
notify_ducatidrv_object
*
)
handle
->
driver_object
;
driver_object
=
(
struct
notify_ducatidrv_object
*
)
handle
->
driver_object
;
/* Enter critical section protection. */
if
(
mutex_lock_interruptible
(
notify_ducatidriver_state
.
gate_handle
)
!=
0
)
if
(
mutex_lock_interruptible
(
notify_ducatidriver_state
.
gate_handle
)
!=
0
)
WARN_ON
(
1
);
SET_BIT
(
driver_object
->
ctrl_ptr
->
proc_ctrl
[
driver_object
->
self_id
].
...
...
@@ -997,7 +1011,7 @@ int notify_ducatidrv_enable_event(struct notify_driver_object *handle,
int
notify_ducatidrv_debug
(
struct
notify_driver_object
*
handle
)
{
int
status
=
0
;
printk
(
KERN_WARNING
"ducati Debug: Nothing being printed currently
.
\n
"
);
printk
(
KERN_WARNING
"ducati Debug: Nothing being printed currently
\n
"
);
return
status
;
}
...
...
@@ -1008,7 +1022,7 @@ int notify_ducatidrv_debug(struct notify_driver_object *handle)
* interrupt received from the Ducati processor.
*
*/
void
notify_ducatidrv_isr
(
void
*
ref_data
)
static
void
notify_ducatidrv_isr
(
void
*
ref_data
)
{
int
payload
=
0
;
int
i
=
0
;
...
...
@@ -1021,50 +1035,55 @@ void notify_ducatidrv_isr(void *ref_data)
int
event_no
;
driver_obj
=
(
struct
notify_ducatidrv_object
*
)
ref_data
;
proc_ctrl_ptr
=
&
(
driver_obj
->
ctrl_ptr
->
proc_ctrl
[
driver_obj
->
self_id
]);
proc_ctrl_ptr
=
&
(
driver_obj
->
ctrl_ptr
->
proc_ctrl
[
driver_obj
->
self_id
]);
reg_chart
=
driver_obj
->
reg_chart
;
self_event_chart
=
proc_ctrl_ptr
->
self_event_chart
;
/* Execute the loop till no asserted event is found for one complete loop
* through all registered events.
/* Execute the loop till no asserted event
is found for one complete loop
through all registered events
*/
do
{
/* Check if the entry is a valid registered event.
*/
/* Check if the entry is a valid registered event.*/
event_no
=
reg_chart
[
i
].
reg_event_no
;
if
(
event_no
!=
(
int
)
-
1
)
{
/* Determine the current high priority event. */
/* Check if the event is set and enabled. */
if
(
self_event_chart
[
event_no
].
flag
==
UP
)
{
if
(
TEST_BIT
(
proc_ctrl_ptr
->
reg_mask
.
enable_mask
,
event_no
))
{
payload
=
self_event_chart
[
event_no
].
payload
;
/* Determine the current high priority event.*/
/* Check if the event is set and enabled.*/
if
(
self_event_chart
[
event_no
].
flag
==
UP
&&
TEST_BIT
(
proc_ctrl_ptr
->
reg_mask
.
enable_mask
,
event_no
)
&&
(
event_no
!=
(
int
)
-
1
))
{
payload
=
self_event_chart
[
event_no
].
payload
;
/* Acknowledge the event. */
self_event_chart
[
event_no
].
flag
=
DOWN
;
/* Call the callbacks associated with the event. */
temp
=
driver_obj
->
event_list
[
event_no
].
listeners
.
next
;
/*Call the callbacks associated with the event*/
temp
=
driver_obj
->
event_list
[
event_no
].
listeners
.
next
;
if
(
temp
!=
NULL
)
{
for
(
j
=
0
;
j
<
driver_obj
->
event_list
[
event_no
].
event_handler_count
;
j
++
)
{
for
(
j
=
0
;
j
<
driver_obj
->
event_list
[
event_no
].
event_handler_count
;
j
++
)
{
/* Check for empty list. */
if
(
temp
!=
NULL
)
{
((
struct
notify_drv_eventlistner
*
)
temp
)
->
fn_notify_cbck
(
driver_obj
->
proc_id
,
event_no
,
if
(
temp
==
NULL
)
continue
;
((
struct
notify_drv_eventlistner
*
)
temp
)
->
fn_notify_cbck
(
driver_obj
->
proc_id
,
event_no
,
((
struct
notify_drv_eventlistner
*
)
temp
)
->
cbck_arg
,
payload
);
temp
=
temp
->
next
;
}
}
/* reinitialize the event check counter. */
i
=
0
;
}
}
}
else
{
/* check for next event. */
i
++
;
}
}
}
while
((
event_no
!=
(
int
)
-
1
)
&&
(
i
<
driver_obj
->
params
.
num_events
));
}
...
...
@@ -1082,7 +1101,6 @@ static void notify_ducatidrv_qsearch_elem(struct list_head *list,
struct
notify_drv_eventlistner
*
l_temp
=
NULL
;
short
int
found
=
false
;
BUG_ON
(
list
==
NULL
);
BUG_ON
(
check_obj
==
NULL
);
WARN_ON
(
listener
==
NULL
);
...
...
@@ -1095,7 +1113,8 @@ static void notify_ducatidrv_qsearch_elem(struct list_head *list,
temp
=
list
->
next
;
while
((
found
==
false
)
&&
(
temp
!=
NULL
))
{
l_temp
=
(
struct
notify_drv_eventlistner
*
)(
temp
);
(
struct
notify_drv_eventlistner
*
)
(
temp
);
if
((
l_temp
->
fn_notify_cbck
==
check_obj
->
fn_notify_cbck
)
&&
(
l_temp
->
cbck_arg
==
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment