Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
elphel-apps-camogm
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Elphel
elphel-apps-camogm
Commits
a9f84049
Commit
a9f84049
authored
Sep 09, 2016
by
Mikhail Karpenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use sysfs file names from common header in uapi directory
parent
8d2a6316
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
12 deletions
+6
-12
camogm.c
camogm.c
+6
-12
No files found.
camogm.c
View file @
a9f84049
...
@@ -28,6 +28,7 @@
...
@@ -28,6 +28,7 @@
#include <string.h>
#include <string.h>
#include <getopt.h>
#include <getopt.h>
#include <ctype.h>
#include <ctype.h>
#include <elphel/ahci_cmd.h>
#include "camogm_ogm.h"
#include "camogm_ogm.h"
#include "camogm_jpeg.h"
#include "camogm_jpeg.h"
...
@@ -60,8 +61,6 @@
...
@@ -60,8 +61,6 @@
#define ALL_CHN_INACTIVE 0x00
#define ALL_CHN_INACTIVE 0x00
/** @brief This is a basic helper macro for processing all sensor ports at a time */
/** @brief This is a basic helper macro for processing all sensor ports at a time */
#define FOR_EACH_PORT(indtype, indvar) for (indtype indvar = 0; indvar < SENSOR_PORTS; indvar++)
#define FOR_EACH_PORT(indtype, indvar) for (indtype indvar = 0; indvar < SENSOR_PORTS; indvar++)
/** @brief The path to Elphel AHCI driver sysfs entry. The trailing slash is mandatory. */
#define SYSFS_DRIVER_ENTRY "/sys/devices/soc0/amba@0/80000000.elphel-ahci/"
char
trailer
[
TRAILER_SIZE
]
=
{
0xff
,
0xd9
};
char
trailer
[
TRAILER_SIZE
]
=
{
0xff
,
0xd9
};
...
@@ -150,7 +149,7 @@ void camogm_set_frames_per_chunk(camogm_state *state, int d);
...
@@ -150,7 +149,7 @@ void camogm_set_frames_per_chunk(camogm_state *state, int d);
static
uint64_t
get_disk_size
(
const
char
*
name
);
static
uint64_t
get_disk_size
(
const
char
*
name
);
static
int
get_sysfs_name
(
const
char
*
dev_name
,
char
*
sys_name
,
size_t
str_sz
,
int
type
);
static
int
get_sysfs_name
(
const
char
*
dev_name
,
char
*
sys_name
,
size_t
str_sz
,
int
type
);
static
int
get_disk_range
(
const
char
*
name
,
struct
range
*
rng
);
static
int
get_disk_range
(
const
char
*
name
,
struct
range
*
rng
);
static
int
set_disk_range
(
const
char
*
name
,
const
struct
range
*
rng
);
static
int
set_disk_range
(
const
struct
range
*
rng
);
int
open_files
(
camogm_state
*
state
);
int
open_files
(
camogm_state
*
state
);
unsigned
long
getGPValue
(
unsigned
int
port
,
unsigned
long
GPNumber
);
unsigned
long
getGPValue
(
unsigned
int
port
,
unsigned
long
GPNumber
);
void
setGValue
(
unsigned
int
port
,
unsigned
long
GNumber
,
unsigned
long
value
);
void
setGValue
(
unsigned
int
port
,
unsigned
long
GNumber
,
unsigned
long
value
);
...
@@ -833,7 +832,7 @@ void camogm_set_prefix(camogm_state *state, const char * p, path_type type)
...
@@ -833,7 +832,7 @@ void camogm_set_prefix(camogm_state *state, const char * p, path_type type)
.
to
=
0
.
to
=
0
};
};
if
(
get_disk_range
(
state
->
rawdev
.
rawdev_path
,
&
rng
)
==
0
)
{
if
(
get_disk_range
(
state
->
rawdev
.
rawdev_path
,
&
rng
)
==
0
)
{
set_disk_range
(
SYSFS_DRIVER_ENTRY
,
&
rng
);
set_disk_range
(
&
rng
);
}
else
{
}
else
{
D0
(
fprintf
(
debug_file
,
"ERROR: unable to get disk size and starting sector
\n
"
));
D0
(
fprintf
(
debug_file
,
"ERROR: unable to get disk size and starting sector
\n
"
));
}
}
...
@@ -1686,26 +1685,21 @@ static int get_disk_range(const char *name, struct range *rng)
...
@@ -1686,26 +1685,21 @@ static int get_disk_range(const char *name, struct range *rng)
* @param[in] rng pointer to structure containing disk size
* @param[in] rng pointer to structure containing disk size
* @return 0 if the values from @e rng were set successfully and -1 in case of an error
* @return 0 if the values from @e rng were set successfully and -1 in case of an error
*/
*/
static
int
set_disk_range
(
const
char
*
name
,
const
struct
range
*
rng
)
static
int
set_disk_range
(
const
struct
range
*
rng
)
{
{
int
fd
;
int
fd
;
int
ret
=
0
;
int
ret
=
0
;
const
char
lba_start
[]
=
"lba_start"
;
const
char
lba_end
[]
=
"lba_end"
;
char
path
[
ELPHEL_PATH_MAX
]
=
{
0
};
char
buff
[
SMALL_BUFF_LEN
]
=
{
0
};
char
buff
[
SMALL_BUFF_LEN
]
=
{
0
};
int
len
;
int
len
;
snprintf
(
path
,
ELPHEL_PATH_MAX
,
"%s%s"
,
name
,
lba_start
);
fd
=
open
(
SYSFS_AHCI_LBA_START
,
O_WRONLY
);
fd
=
open
(
path
,
O_WRONLY
);
if
(
fd
<
0
)
if
(
fd
<
0
)
return
-
1
;
return
-
1
;
len
=
snprintf
(
buff
,
SMALL_BUFF_LEN
,
"%llu"
,
rng
->
from
);
len
=
snprintf
(
buff
,
SMALL_BUFF_LEN
,
"%llu"
,
rng
->
from
);
write
(
fd
,
buff
,
len
+
1
);
write
(
fd
,
buff
,
len
+
1
);
close
(
fd
);
close
(
fd
);
snprintf
(
path
,
ELPHEL_PATH_MAX
,
"%s%s"
,
name
,
lba_end
);
fd
=
open
(
SYSFS_AHCI_LBA_END
,
O_WRONLY
);
fd
=
open
(
path
,
O_WRONLY
);
if
(
fd
<
0
)
if
(
fd
<
0
)
return
-
1
;
return
-
1
;
len
=
snprintf
(
buff
,
SMALL_BUFF_LEN
,
"%llu"
,
rng
->
to
);
len
=
snprintf
(
buff
,
SMALL_BUFF_LEN
,
"%llu"
,
rng
->
to
);
...
...
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