Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
Sunxi Tools
Commits
1351c828
Commit
1351c828
authored
Oct 28, 2016
by
NiteHawk
Committed by
GitHub
Oct 28, 2016
Browse files
Merge pull request #72 from n1tehawk/contrib
Minor compilation fixes
parents
9a3d62aa
beed0028
Changes
7
Show whitespace changes
Inline
Side-by-side
Makefile
View file @
1351c828
...
...
@@ -98,8 +98,14 @@ sunxi-fexc: fexc.h script.h script.c \
script_fex.h script_fex.c
LIBUSB
=
libusb-1.0
LIBUSB_CFLAGS
=
`
pkg-config
--cflags
$(LIBUSB)
`
LIBUSB_LIBS
=
`
pkg-config
--libs
$(LIBUSB)
`
LIBUSB_CFLAGS
?=
`
pkg-config
--cflags
$(LIBUSB)
`
LIBUSB_LIBS
?=
`
pkg-config
--libs
$(LIBUSB)
`
ifeq
($(OS),Windows_NT)
# Windows lacks mman.h / mmap()
DEFINES
+=
-DNO_MMAP
# portable_endian.h relies on winsock2
LIBS
+=
-lws2_32
endif
sunxi-fel
:
fel.c fel-to-spl-thunk.h progress.c progress.h
$(CC)
$(CFLAGS)
$(LIBUSB_CFLAGS)
$(LDFLAGS)
-o
$@
$(
filter
%.c,
$^
)
$(LIBS)
$(LIBUSB_LIBS)
...
...
bootinfo.c
View file @
1351c828
...
...
@@ -198,7 +198,7 @@ void print_boot_file_head(boot_file_head_t *hdr)
void
print_boot_dram_para
(
boot_dram_para_t
*
dram
)
{
pprintf
(
&
dram
->
dram_baseaddr
,
"DRAM base : %p
\n
"
,
(
void
*
)(
long
)
dram
->
dram_baseaddr
);
pprintf
(
&
dram
->
dram_baseaddr
,
"DRAM base : %p
\n
"
,
(
void
*
)(
uintptr_t
)
dram
->
dram_baseaddr
);
pprintf
(
&
dram
->
dram_clk
,
"DRAM clk : %d
\n
"
,
dram
->
dram_clk
);
pprintf
(
&
dram
->
dram_type
,
"DRAM type : %d
\n
"
,
dram
->
dram_type
);
pprintf
(
&
dram
->
dram_rank_num
,
"DRAM rank : %d
\n
"
,
dram
->
dram_rank_num
);
...
...
fel.c
View file @
1351c828
...
...
@@ -15,6 +15,10 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "common.h"
#include "portable_endian.h"
#include "progress.h"
#include <libusb.h>
#include <stdint.h>
#include <stdbool.h>
...
...
@@ -28,10 +32,6 @@
#include <unistd.h>
#include <sys/stat.h>
#include "common.h"
#include "portable_endian.h"
#include "progress.h"
static
const
uint16_t
AW_USB_VENDOR_ID
=
0x1F3A
;
static
const
uint16_t
AW_USB_PRODUCT_ID
=
0xEFE8
;
...
...
@@ -325,7 +325,7 @@ void hexdump(void *data, uint32_t offset, size_t size)
unsigned
char
*
buf
=
data
;
for
(
j
=
0
;
j
<
size
;
j
+=
16
)
{
size_t
i
;
printf
(
"%08
l
x: "
,
(
long
int
)
offset
+
j
);
printf
(
"%08
z
x: "
,
offset
+
j
);
for
(
i
=
0
;
i
<
16
;
i
++
)
{
if
(
j
+
i
<
size
)
printf
(
"%02x "
,
buf
[
j
+
i
]);
...
...
fexc.c
View file @
1351c828
...
...
@@ -21,7 +21,9 @@
#include <libgen.h>
#include <stdlib.h>
#include <string.h>
#include <sys/mman.h>
#ifndef NO_MMAP
#include <sys/mman.h>
#endif
#include <sys/stat.h>
#include <unistd.h>
#include <fcntl.h>
...
...
@@ -117,6 +119,7 @@ static inline int script_parse(enum script_format format,
pr_err
(
"%s: %s: %s
\n
"
,
filename
,
"fstat"
,
strerror
(
errno
));
goto
bin_close
;
#ifndef NO_MMAP
}
else
if
(
S_ISREG
(
sb
.
st_mode
))
{
/* regular file, mmap it */
bin
=
mmap
(
0
,
sb
.
st_size
,
PROT_READ
,
MAP_SHARED
,
in
,
0
);
...
...
@@ -127,6 +130,7 @@ static inline int script_parse(enum script_format format,
}
bin_size
=
sb
.
st_size
;
allocated
=
0
;
#endif
}
else
{
/* something else... just read it all! */
bin
=
read_all
(
in
,
filename
,
&
bin_size
);
...
...
@@ -138,10 +142,12 @@ static inline int script_parse(enum script_format format,
ret
=
script_decompile_bin
(
bin
,
bin_size
,
filename
,
script
);
if
(
allocated
)
free
(
bin
);
#ifndef NO_MMAP
else
if
(
munmap
(
bin
,
bin_size
)
==
-
1
)
{
pr_err
(
"%s: %s: %s
\n
"
,
filename
,
"munmap"
,
strerror
(
errno
));
}
#endif
bin_close:
close
(
in
);
};
break
;
...
...
meminfo.c
View file @
1351c828
...
...
@@ -25,6 +25,8 @@
#include <sys/io.h>
#include <stdbool.h>
#include "common.h"
typedef
uint32_t
u32
;
/* from u-boot code: */
...
...
@@ -412,7 +414,7 @@ sun4i_dram_para_print_fex(struct sun4i_dram_para *dram_para)
static
int
sun4i_dram_para_print
(
bool
uboot
)
{
struct
sun4i_dram_para
dram_para
=
{
0
};
struct
sun4i_dram_para
dram_para
=
{
.
baseaddr
=
0
};
int
ret
;
ret
=
sunxi_dram_clock_read
(
&
dram_para
.
clock
);
...
...
@@ -710,6 +712,7 @@ sun8i_dram_regs_print(void)
static
void
print_usage
(
const
char
*
name
)
{
puts
(
"sunxi-meminfo "
VERSION
"
\n
"
);
printf
(
"Utility to retrieve DRAM information from registers on "
"Allwinner SoCs.
\n
"
);
printf
(
"
\n
"
);
...
...
nand-image-builder.c
View file @
1351c828
...
...
@@ -257,7 +257,7 @@ static void encode_bch(struct bch_control *bch, const uint8_t *data,
}
/* process first unaligned data bytes */
m
=
((
u
nsigned
long
)
data
)
&
3
;
m
=
((
u
intptr_t
)
data
)
&
3
;
if
(
m
)
{
mlen
=
(
len
<
(
4
-
m
))
?
len
:
4
-
m
;
encode_bch_unaligned
(
bch
,
data
,
mlen
,
bch
->
ecc_buf
);
...
...
pio.c
View file @
1351c828
...
...
@@ -24,7 +24,9 @@
#include <unistd.h>
#include <stdlib.h>
#include <errno.h>
#include <sys/mman.h>
#ifndef NO_MMAP
#include <sys/mman.h>
#endif
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
...
...
@@ -365,6 +367,10 @@ int main(int argc, char **argv)
if
(
!
in_name
&&
!
do_mmap
)
usage
(
1
);
if
(
do_mmap
)
{
#ifdef NO_MMAP
errno
=
ENOSYS
;
/* Function not implemented */
perror
(
"mmap PIO"
);
#else
int
pagesize
=
sysconf
(
_SC_PAGESIZE
);
int
fd
=
open
(
"/dev/mem"
,
O_RDWR
);
int
addr
=
0x01c20800
&
~
(
pagesize
-
1
);
...
...
@@ -380,6 +386,7 @@ int main(int argc, char **argv)
}
close
(
fd
);
buf
+=
offset
;
#endif
}
if
(
in_name
)
{
if
(
strcmp
(
in_name
,
"-"
)
==
0
)
{
...
...
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