Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
Simple VME FMC Carrier SVEC
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
14
Issues
14
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
Simple VME FMC Carrier SVEC
Commits
e922da65
Commit
e922da65
authored
Oct 12, 2017
by
Federico Vaga
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel: add more comments
Signed-off-by:
Federico Vaga
<
federico.vaga@vaga.pv.it
>
parent
8cc7f7de
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
2 deletions
+20
-2
svec-core.c
kernel/svec-core.c
+20
-2
No files found.
kernel/svec-core.c
View file @
e922da65
...
@@ -236,6 +236,7 @@ static int svec_fpga_write_word(struct svec_dev *svec,
...
@@ -236,6 +236,7 @@ static int svec_fpga_write_word(struct svec_dev *svec,
* It starts the programming procedure
* It starts the programming procedure
* It is usable only when there is a valid CR/CSR space mapped
* It is usable only when there is a valid CR/CSR space mapped
* @svec svec device instance
* @svec svec device instance
* Return 0 on success, otherwise a negative errno number.
*/
*/
static
int
svec_fpga_write_start
(
struct
svec_dev
*
svec
)
static
int
svec_fpga_write_start
(
struct
svec_dev
*
svec
)
{
{
...
@@ -369,7 +370,7 @@ out:
...
@@ -369,7 +370,7 @@ out:
* @inode file system node
* @inode file system node
* @file char device file open instance
* @file char device file open instance
*
*
* By just opening this device you m
ya
reset the FPGA
* By just opening this device you m
ay
reset the FPGA
* (unless other errors prevent the user from programming).
* (unless other errors prevent the user from programming).
* Only one user at time can access the programming procedure.
* Only one user at time can access the programming procedure.
* Return: 0 on success, otherwise a negative errno number
* Return: 0 on success, otherwise a negative errno number
...
@@ -436,6 +437,7 @@ err_mod_get:
...
@@ -436,6 +437,7 @@ err_mod_get:
* destroy the instance that asked for FPGA reprogramming
* destroy the instance that asked for FPGA reprogramming
* @inode file system node
* @inode file system node
* @file char device file open instance
* @file char device file open instance
* Return 0 on success, otherwise a negative errno number.
*/
*/
static
int
svec_close
(
struct
inode
*
inode
,
struct
file
*
file
)
static
int
svec_close
(
struct
inode
*
inode
,
struct
file
*
file
)
{
{
...
@@ -479,7 +481,7 @@ static int svec_close(struct inode *inode, struct file *file)
...
@@ -479,7 +481,7 @@ static int svec_close(struct inode *inode, struct file *file)
* @buf user space buffer
* @buf user space buffer
* @count user space buffer size
* @count user space buffer size
* @offp offset where to copy the buffer (ignored here)
* @offp offset where to copy the buffer (ignored here)
* Return: number of byte actually copied
* Return: number of byte actually copied
, otherwise a negative errno
*/
*/
static
ssize_t
svec_write
(
struct
file
*
file
,
const
char
__user
*
buf
,
static
ssize_t
svec_write
(
struct
file
*
file
,
const
char
__user
*
buf
,
size_t
count
,
loff_t
*
offp
)
size_t
count
,
loff_t
*
offp
)
...
@@ -527,6 +529,10 @@ static void svec_release(struct device *dev)
...
@@ -527,6 +529,10 @@ static void svec_release(struct device *dev)
svec_minor_put
(
minor
);
svec_minor_put
(
minor
);
}
}
/**
* It shows the current AFPGA programming locking status
*/
static
ssize_t
svec_afpga_lock_show
(
struct
device
*
dev
,
static
ssize_t
svec_afpga_lock_show
(
struct
device
*
dev
,
struct
device_attribute
*
attr
,
struct
device_attribute
*
attr
,
char
*
buf
)
char
*
buf
)
...
@@ -538,6 +544,10 @@ static ssize_t svec_afpga_lock_show(struct device *dev,
...
@@ -538,6 +544,10 @@ static ssize_t svec_afpga_lock_show(struct device *dev,
"locked"
:
"unlocked"
);
"locked"
:
"unlocked"
);
}
}
/**
* It unlocks the AFPGA programming when the user write "unlock"
*/
static
ssize_t
svec_afpga_lock_store
(
struct
device
*
dev
,
static
ssize_t
svec_afpga_lock_store
(
struct
device
*
dev
,
struct
device_attribute
*
attr
,
struct
device_attribute
*
attr
,
const
char
*
buf
,
size_t
count
)
const
char
*
buf
,
size_t
count
)
...
@@ -555,6 +565,7 @@ static ssize_t svec_afpga_lock_store(struct device *dev,
...
@@ -555,6 +565,7 @@ static ssize_t svec_afpga_lock_store(struct device *dev,
}
}
static
DEVICE_ATTR
(
lock
,
0644
,
svec_afpga_lock_show
,
svec_afpga_lock_store
);
static
DEVICE_ATTR
(
lock
,
0644
,
svec_afpga_lock_show
,
svec_afpga_lock_store
);
static
struct
attribute
*
svec_dev_attrs
[]
=
{
static
struct
attribute
*
svec_dev_attrs
[]
=
{
&
dev_attr_lock
.
attr
,
&
dev_attr_lock
.
attr
,
NULL
,
NULL
,
...
@@ -569,6 +580,7 @@ static const struct attribute_group *svec_dev_groups[] = {
...
@@ -569,6 +580,7 @@ static const struct attribute_group *svec_dev_groups[] = {
NULL
,
NULL
,
};
};
/**
/**
* It initialize a new SVEC instance
* It initialize a new SVEC instance
* @pdev correspondend Linux device instance
* @pdev correspondend Linux device instance
...
@@ -633,6 +645,12 @@ err:
...
@@ -633,6 +645,12 @@ err:
}
}
/**
* It removes a SVEC device instance
* @pdev Linux device pointer
* @ndev DEPRECATED Device instance
* Return: 0 on success, otherwise a negative errno number
*/
static
int
svec_remove
(
struct
device
*
pdev
,
unsigned
int
ndev
)
static
int
svec_remove
(
struct
device
*
pdev
,
unsigned
int
ndev
)
{
{
struct
svec_dev
*
svec
=
dev_get_drvdata
(
pdev
);
struct
svec_dev
*
svec
=
dev_get_drvdata
(
pdev
);
...
...
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