Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
linux-elphel
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Elphel
linux-elphel
Commits
7630393b
Commit
7630393b
authored
Sep 09, 2016
by
Mikhail Karpenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move ahci command structure declaration to uapi directory
parent
0910be0d
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
106 additions
and
37 deletions
+106
-37
ahci_elphel.c
src/drivers/ata/ahci_elphel.c
+17
-29
ahci_elphel.h
src/drivers/ata/ahci_elphel.h
+1
-1
circbuf.h
src/drivers/elphel/circbuf.h
+1
-7
Kbuild
src/include/uapi/Kbuild
+16
-0
Kbuild
src/include/uapi/elphel/Kbuild
+8
-0
ahci_cmd.h
src/include/uapi/elphel/ahci_cmd.h
+63
-0
No files found.
src/drivers/ata/ahci_elphel.c
View file @
7630393b
...
...
@@ -27,17 +27,16 @@
#include <linux/platform_device.h>
#include <linux/dma-mapping.h>
#include <linux/sysfs.h>
#include <linux/uio.h>
#include <elphel/exifa.h>
#include <elphel/elphel393-mem.h>
#include "ahci.h"
#include "ahci_elphel.h"
#include "../elphel/exif393.h"
#include "../elphel/exifa.h"
#include "../elphel/jpeghead.h"
#include "../elphel/circbuf.h"
#include "../elphel/x393_helpers.h"
#include <elphel/elphel393-mem.h>
#define DRV_NAME "elphel-ahci"
/*
* FPGA bitstream control address and bit mask. These are used to check whether
...
...
@@ -409,19 +408,6 @@ static void elphel_qc_prep(struct ata_queued_cmd *qc)
AHCI_CMD_TBL_AR_SZ
,
DMA_TO_DEVICE
);
}
/* this should be placed to system includes directory*/
#define DRV_CMD_WRITE 0
#define DRV_CMD_FINISH 1
struct
frame_data
{
unsigned
int
sensor_port
;
int
cirbuf_ptr
;
int
jpeg_len
;
int
meta_index
;
int
cmd
;
};
/* end of system includes */
/** Map buffer vectors to S/G list and return the number of vectors mapped */
static
int
map_vectors
(
struct
elphel_ahci_priv
*
dpriv
)
{
...
...
@@ -1071,7 +1057,7 @@ static ssize_t rawdev_write(struct device *dev, ///<
}
spin_unlock_irqrestore
(
&
dpriv
->
flags_lock
,
irq_flags
);
if
(
fdata
.
cmd
==
DRV_CMD_FINISH
)
{
if
(
fdata
.
cmd
&
DRV_CMD_FINISH
)
{
if
((
dpriv
->
flags
&
PROC_CMD
)
==
0
&&
proceed
)
{
finish_rec
(
dpriv
);
}
else
{
...
...
@@ -1088,9 +1074,11 @@ static ssize_t rawdev_write(struct device *dev, ///<
chunks
=
dpriv
->
data_chunks
[
dpriv
->
tail_ptr
];
buffs
=
&
dpriv
->
fbuffs
[
dpriv
->
tail_ptr
];
dev_dbg
(
dev
,
"process frame from sensor port: %u
\n
"
,
fdata
.
sensor_port
);
dev_dbg
(
dev
,
"process frame from sensor port: %u, command = %d
\n
"
,
fdata
.
sensor_port
,
fdata
.
cmd
);
if
(
fdata
.
cmd
&
DRV_CMD_EXIF
)
{
rcvd
=
exif_get_data
(
fdata
.
sensor_port
,
fdata
.
meta_index
,
buffs
->
exif_buff
.
iov_base
,
buffs
->
exif_buff
.
iov_len
);
chunks
[
CHUNK_EXIF
].
iov_len
=
rcvd
;
}
rcvd
=
jpeghead_get_data
(
fdata
.
sensor_port
,
buffs
->
jpheader_buff
.
iov_base
,
buffs
->
jpheader_buff
.
iov_len
,
0
);
chunks
[
CHUNK_LEADER
].
iov_len
=
JPEG_MARKER_LEN
;
...
...
@@ -1329,16 +1317,16 @@ static ssize_t lba_current_write(struct device *dev, struct device_attribute *at
}
static
DEVICE_ATTR
(
load_module
,
S_IWUSR
|
S_IWGRP
,
NULL
,
set_load_flag
);
static
DEVICE_ATTR
(
write
,
S_IWUSR
|
S_IWGRP
,
NULL
,
rawdev_write
);
static
DEVICE_ATTR
(
lba_start
,
S_IRUSR
|
S_IRGRP
|
S_IWUSR
|
S_IWGRP
,
lba_start_read
,
lba_start_write
);
static
DEVICE_ATTR
(
lba_end
,
S_IRUSR
|
S_IRGRP
|
S_IWUSR
|
S_IWGRP
,
lba_end_read
,
lba_end_write
);
static
DEVICE_ATTR
(
lba_current
,
S_IRUSR
|
S_IRGRP
|
S_IWUSR
|
S_IRGRP
,
lba_current_read
,
lba_current_write
);
static
DEVICE_ATTR
(
SYSFS_AHCI_FNAME_WRITE
,
S_IWUSR
|
S_IWGRP
,
NULL
,
rawdev_write
);
static
DEVICE_ATTR
(
SYSFS_AHCI_FNAME_START
,
S_IRUSR
|
S_IRGRP
|
S_IWUSR
|
S_IWGRP
,
lba_start_read
,
lba_start_write
);
static
DEVICE_ATTR
(
SYSFS_AHCI_FNAME_END
,
S_IRUSR
|
S_IRGRP
|
S_IWUSR
|
S_IWGRP
,
lba_end_read
,
lba_end_write
);
static
DEVICE_ATTR
(
SYSFS_AHCI_FNAME_CURR
,
S_IRUSR
|
S_IRGRP
|
S_IWUSR
|
S_IRGRP
,
lba_current_read
,
lba_current_write
);
static
struct
attribute
*
root_dev_attrs
[]
=
{
&
dev_attr_load_module
.
attr
,
&
dev_attr_
write
.
attr
,
&
dev_attr_
lba_start
.
attr
,
&
dev_attr_
lba_end
.
attr
,
&
dev_attr_
lba_current
.
attr
,
&
dev_attr_
SYSFS_AHCI_FNAME_WRITE
.
attr
,
&
dev_attr_
SYSFS_AHCI_FNAME_START
.
attr
,
&
dev_attr_
SYSFS_AHCI_FNAME_END
.
attr
,
&
dev_attr_
SYSFS_AHCI_FNAME_CURR
.
attr
,
NULL
};
static
const
struct
attribute_group
dev_attr_root_group
=
{
...
...
src/drivers/ata/ahci_elphel.h
View file @
7630393b
...
...
@@ -19,7 +19,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include
"../elphel/circbuf.h"
#include
<uapi/elphel/ahci_cmd.h>
#ifndef _AHCI_ELPHEL_EXT
#define _AHCI_ELPHEL_EXT
...
...
src/drivers/elphel/circbuf.h
View file @
7630393b
...
...
@@ -23,6 +23,7 @@
#define _CIRCBUF_H
#include <linux/poll.h>
#include <uapi/elphel/ahci_cmd.h>
/** @brief Circular buffer private data */
struct
circbuf_priv_t
{
...
...
@@ -55,13 +56,6 @@ extern unsigned short circbuf_width;
extern
unsigned
char
circbuf_byrshift
;
/* end of debug code */
/* this should be placed to drivers common includes */
struct
fvec
{
void
*
iov_base
;
///< pointer to allocated buffer
size_t
iov_len
;
///< the size (in bytes) of allocated buffer; set after allocation and is not modified during buffer lifetime
dma_addr_t
iov_dma
;
///< buffer physical address
};
/* end of common includes */
int
circbuf_get_ptr
(
int
sensor_port
,
size_t
offset
,
size_t
len
,
struct
fvec
*
vect_0
,
struct
fvec
*
vect_1
);
#endif
/* _CIRCBUF_H */
src/include/uapi/Kbuild
0 → 100644
View file @
7630393b
# UAPI Header export list
# Top-level Makefile calls into asm-$(ARCH)
# List only non-arch directories below
header-y += asm-generic/
header-y += linux/
header-y += sound/
header-y += mtd/
header-y += rdma/
header-y += video/
header-y += drm/
header-y += xen/
header-y += scsi/
header-y += misc/
header-y += elphel/
src/include/uapi/elphel/Kbuild
0 → 100644
View file @
7630393b
# UAPI Header export list
# Top-level Makefile calls into asm-$(ARCH)
# List only non-arch directories below
#header-y += exifa.h
#header-y += c313a.h
#header-y += x393_devices.h
header-y += ahci_cmd.h
src/include/uapi/elphel/ahci_cmd.h
0 → 100644
View file @
7630393b
/** @file ahci_cmd.h
*
* @brief Elphel AHCI SATA platform driver for Elphel393 camera. This module provides
* constants and data structures which are used to organize interaction between drivers
* and user space applications during JPEG files recording.
*
* @copyright Copyright (C) 2016 Elphel, Inc
*
* @par <b>License</b>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* 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.
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _AHCI_CMD
#define _AHCI_CMD
#define DRV_CMD_WRITE (1 << 0)
#define DRV_CMD_FINISH (1 << 1)
#define DRV_CMD_EXIF (1 << 2)
/** The path to Elphel AHCI driver sysfs entry. The trailing slash is mandatory. */
#define SYSFS_AHCI_ENTRY "/sys/devices/soc0/amba@0/80000000.elphel-ahci/"
/** sysfs entry name, no double quotes. This macro is used to populate <em>struct attribute</em> in #ahci_elphel.c */
#define SYSFS_AHCI_FNAME_WRITE write
/** sysfs entry name, no double quotes. This macro is used to populate <em>struct attribute</em> in #ahci_elphel.c */
#define SYSFS_AHCI_FNAME_START lba_start
/** sysfs entry name, no double quotes. This macro is used to populate <em>struct attribute</em> in #ahci_elphel.c */
#define SYSFS_AHCI_FNAME_END lba_end
/** sysfs entry name, no double quotes. This macro is used to populate <em>struct attribute</em> in #ahci_elphel.c */
#define SYSFS_AHCI_FNAME_CURR lba_current
/** This file is used to send commands to AHCI driver from user space applications (camogm as for now). */
#define SYSFS_AHCI_WRITE SYSFS_AHCI_ENTRY #SYSFS_AHCI_FNAME_WRITE
/** This file is used to control starting LBA of a disk buffer (R/W). */
#define SYSFS_AHCI_LBA_START SYSFS_AHCI_ENTRY #SYSFS_AHCI_FNAME_START
/** This file is used to control ending LBA of a disk buffer (R/W). */
#define SYSFS_AHCI_LBA_END SYSFS_AHCI_ENTRY #SYSFS_AHCI_FNAME_END
/** This file is used to control current LBA of a disk buffer (R/W). Use this file to set a pointer inside
* [lba_start..lba_end] area where next write operation will begin. */
#define SYSFS_AHCI_LBA_CURRENT SYSFS_AHCI_ENTRY #SYSFS_AHCI_FNAME_CURR
struct
frame_data
{
unsigned
int
sensor_port
;
int
cirbuf_ptr
;
int
jpeg_len
;
int
meta_index
;
int
cmd
;
};
struct
fvec
{
void
*
iov_base
;
///< pointer to allocated buffer
size_t
iov_len
;
///< the size (in bytes) of allocated buffer; set after allocation and is not modified during buffer lifetime
dma_addr_t
iov_dma
;
///< buffer physical address
};
#endif
/* _AHCI_CMD */
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