Compare commits
7 Commits
d8728e319c
...
develop
| Author | SHA1 | Date | |
|---|---|---|---|
| 9d7fed6ae1 | |||
| dd0fe0cc72 | |||
| 499468b819 | |||
| 925f08e0b9 | |||
| be32d2467c | |||
| c8ea882b3e | |||
| 5f220ff09b |
1
env/entry.S
vendored
1
env/entry.S
vendored
@@ -92,5 +92,4 @@ trap_entry:
|
|||||||
handle_trap:
|
handle_trap:
|
||||||
1:
|
1:
|
||||||
j 1b
|
j 1b
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
175
env/riscv_vp/flash.lds
vendored
175
env/riscv_vp/flash.lds
vendored
@@ -4,174 +4,9 @@ ENTRY( _start )
|
|||||||
|
|
||||||
INCLUDE memory_map.ld
|
INCLUDE memory_map.ld
|
||||||
|
|
||||||
PHDRS
|
REGION_ALIAS("REGION_TEXT", flash);
|
||||||
{
|
REGION_ALIAS("REGION_RODATA", flash);
|
||||||
flash PT_LOAD;
|
REGION_ALIAS("REGION_DATA", ram);
|
||||||
ram_init PT_LOAD;
|
REGION_ALIAS("REGION_BSS", ram);
|
||||||
ram PT_NULL;
|
|
||||||
dram PT_NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
SECTIONS
|
INCLUDE sections.ld
|
||||||
{
|
|
||||||
__stack_size = DEFINED(__stack_size) ? __stack_size : 2K;
|
|
||||||
|
|
||||||
.init ORIGIN(flash) :
|
|
||||||
{
|
|
||||||
KEEP (*(SORT_NONE(.init)))
|
|
||||||
} >flash AT>flash :flash
|
|
||||||
|
|
||||||
.text :
|
|
||||||
{
|
|
||||||
*(.text.unlikely .text.unlikely.*)
|
|
||||||
*(.text.startup .text.startup.*)
|
|
||||||
*(.text .text.*)
|
|
||||||
*(.gnu.linkonce.t.*)
|
|
||||||
} >flash AT>flash :flash
|
|
||||||
|
|
||||||
.fini :
|
|
||||||
{
|
|
||||||
KEEP (*(SORT_NONE(.fini)))
|
|
||||||
} >flash AT>flash :flash
|
|
||||||
|
|
||||||
PROVIDE (__etext = .);
|
|
||||||
PROVIDE (_etext = .);
|
|
||||||
PROVIDE (etext = .);
|
|
||||||
|
|
||||||
.rodata :
|
|
||||||
{
|
|
||||||
*(.rdata)
|
|
||||||
*(.rodata .rodata.*)
|
|
||||||
*(.gnu.linkonce.r.*)
|
|
||||||
} >flash AT>flash :flash
|
|
||||||
|
|
||||||
. = ALIGN(4);
|
|
||||||
|
|
||||||
.preinit_array :
|
|
||||||
{
|
|
||||||
PROVIDE_HIDDEN (__preinit_array_start = .);
|
|
||||||
KEEP (*(.preinit_array))
|
|
||||||
PROVIDE_HIDDEN (__preinit_array_end = .);
|
|
||||||
} >flash AT>flash :flash
|
|
||||||
|
|
||||||
.init_array :
|
|
||||||
{
|
|
||||||
PROVIDE_HIDDEN (__init_array_start = .);
|
|
||||||
KEEP (*(SORT_BY_INIT_PRIORITY(.init_array.*) SORT_BY_INIT_PRIORITY(.ctors.*)))
|
|
||||||
KEEP (*(.init_array EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o ) .ctors))
|
|
||||||
PROVIDE_HIDDEN (__init_array_end = .);
|
|
||||||
} >flash AT>flash :flash
|
|
||||||
|
|
||||||
.fini_array :
|
|
||||||
{
|
|
||||||
PROVIDE_HIDDEN (__fini_array_start = .);
|
|
||||||
KEEP (*(SORT_BY_INIT_PRIORITY(.fini_array.*) SORT_BY_INIT_PRIORITY(.dtors.*)))
|
|
||||||
KEEP (*(.fini_array EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o ) .dtors))
|
|
||||||
PROVIDE_HIDDEN (__fini_array_end = .);
|
|
||||||
} >flash AT>flash :flash
|
|
||||||
|
|
||||||
.ctors :
|
|
||||||
{
|
|
||||||
/* gcc uses crtbegin.o to find the start of
|
|
||||||
the constructors, so we make sure it is
|
|
||||||
first. Because this is a wildcard, it
|
|
||||||
doesn't matter if the user does not
|
|
||||||
actually link against crtbegin.o; the
|
|
||||||
linker won't look for a file to match a
|
|
||||||
wildcard. The wildcard also means that it
|
|
||||||
doesn't matter which directory crtbegin.o
|
|
||||||
is in. */
|
|
||||||
KEEP (*crtbegin.o(.ctors))
|
|
||||||
KEEP (*crtbegin?.o(.ctors))
|
|
||||||
/* We don't want to include the .ctor section from
|
|
||||||
the crtend.o file until after the sorted ctors.
|
|
||||||
The .ctor section from the crtend file contains the
|
|
||||||
end of ctors marker and it must be last */
|
|
||||||
KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors))
|
|
||||||
KEEP (*(SORT(.ctors.*)))
|
|
||||||
KEEP (*(.ctors))
|
|
||||||
} >flash AT>flash :flash
|
|
||||||
|
|
||||||
.dtors :
|
|
||||||
{
|
|
||||||
KEEP (*crtbegin.o(.dtors))
|
|
||||||
KEEP (*crtbegin?.o(.dtors))
|
|
||||||
KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors))
|
|
||||||
KEEP (*(SORT(.dtors.*)))
|
|
||||||
KEEP (*(.dtors))
|
|
||||||
} >flash AT>flash :flash
|
|
||||||
|
|
||||||
.dummy :
|
|
||||||
{
|
|
||||||
*(.comment.*)
|
|
||||||
|
|
||||||
}
|
|
||||||
.lalign :
|
|
||||||
{
|
|
||||||
. = ALIGN(4);
|
|
||||||
PROVIDE( _data_lma = . );
|
|
||||||
} >flash AT>flash :flash
|
|
||||||
|
|
||||||
.dalign :
|
|
||||||
{
|
|
||||||
. = ALIGN(4);
|
|
||||||
PROVIDE( _data = . );
|
|
||||||
} >ram AT>flash :ram_init
|
|
||||||
|
|
||||||
.data :
|
|
||||||
{
|
|
||||||
__DATA_BEGIN__ = .;
|
|
||||||
*(.data .data.*)
|
|
||||||
*(.gnu.linkonce.d.*)
|
|
||||||
} >ram AT>flash :ram_init
|
|
||||||
|
|
||||||
.sdata :
|
|
||||||
{
|
|
||||||
__SDATA_BEGIN__ = .;
|
|
||||||
*(.sdata .sdata.*)
|
|
||||||
*(.gnu.linkonce.s.*)
|
|
||||||
} >ram AT>flash :ram_init
|
|
||||||
|
|
||||||
.srodata :
|
|
||||||
{
|
|
||||||
*(.srodata.cst16)
|
|
||||||
*(.srodata.cst8)
|
|
||||||
*(.srodata.cst4)
|
|
||||||
*(.srodata.cst2)
|
|
||||||
*(.srodata .srodata.*)
|
|
||||||
} >ram AT>flash :ram_init
|
|
||||||
|
|
||||||
. = ALIGN(4);
|
|
||||||
PROVIDE( _edata = . );
|
|
||||||
PROVIDE( edata = . );
|
|
||||||
|
|
||||||
PROVIDE( _fbss = . );
|
|
||||||
PROVIDE( __bss_start = . );
|
|
||||||
.bss :
|
|
||||||
{
|
|
||||||
*(.sbss*)
|
|
||||||
*(.gnu.linkonce.sb.*)
|
|
||||||
*(.bss .bss.*)
|
|
||||||
*(.gnu.linkonce.b.*)
|
|
||||||
*(COMMON)
|
|
||||||
. = ALIGN(4);
|
|
||||||
} >ram AT>ram :ram
|
|
||||||
|
|
||||||
. = ALIGN(8);
|
|
||||||
__BSS_END__ = .;
|
|
||||||
__global_pointer$ = MIN(__SDATA_BEGIN__ + 0x800, MAX(__DATA_BEGIN__ + 0x800, __BSS_END__ - 0x800));
|
|
||||||
PROVIDE( _end = . );
|
|
||||||
PROVIDE( end = . );
|
|
||||||
|
|
||||||
.stack ORIGIN(ram) + LENGTH(ram) - __stack_size :
|
|
||||||
{
|
|
||||||
PROVIDE( _heap_end = . );
|
|
||||||
. = __stack_size;
|
|
||||||
PROVIDE( _sp = . );
|
|
||||||
} >ram AT>ram :ram
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
PROVIDE( tohost = . );
|
|
||||||
PROVIDE( fromhost = . + 8 );
|
|
||||||
}
|
|
||||||
5
env/riscv_vp/init.c
vendored
5
env/riscv_vp/init.c
vendored
@@ -103,7 +103,10 @@ void __attribute__((weak)) _init() {
|
|||||||
while(i < NUM_INTERRUPTS) {
|
while(i < NUM_INTERRUPTS) {
|
||||||
localISR[i++] = default_handler;
|
localISR[i++] = default_handler;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
#if defined(NUM_HARTS) && NUM_HARTS > 1
|
||||||
|
for(int i = 1; i < NUM_HARTS; ++i)
|
||||||
|
set_aclint_msip(aclint, i, 1);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
12
env/riscv_vp/ram.lds
vendored
Normal file
12
env/riscv_vp/ram.lds
vendored
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
OUTPUT_ARCH( "riscv" )
|
||||||
|
|
||||||
|
ENTRY( _start )
|
||||||
|
|
||||||
|
INCLUDE memory_map.ld
|
||||||
|
|
||||||
|
REGION_ALIAS("REGION_TEXT", ram);
|
||||||
|
REGION_ALIAS("REGION_RODATA", ram);
|
||||||
|
REGION_ALIAS("REGION_DATA", ram);
|
||||||
|
REGION_ALIAS("REGION_BSS", ram);
|
||||||
|
|
||||||
|
INCLUDE sections.ld
|
||||||
175
env/riscv_vp/rom.lds
vendored
175
env/riscv_vp/rom.lds
vendored
@@ -4,174 +4,9 @@ ENTRY( _start )
|
|||||||
|
|
||||||
INCLUDE memory_map.ld
|
INCLUDE memory_map.ld
|
||||||
|
|
||||||
PHDRS
|
REGION_ALIAS("REGION_TEXT", rom);
|
||||||
{
|
REGION_ALIAS("REGION_RODATA", rom);
|
||||||
rom PT_LOAD;
|
REGION_ALIAS("REGION_DATA", ram);
|
||||||
ram_init PT_LOAD;
|
REGION_ALIAS("REGION_BSS", ram);
|
||||||
ram PT_NULL;
|
|
||||||
dram PT_NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
SECTIONS
|
INCLUDE sections.ld
|
||||||
{
|
|
||||||
__stack_size = DEFINED(__stack_size) ? __stack_size : 2K;
|
|
||||||
|
|
||||||
.init ORIGIN(rom) :
|
|
||||||
{
|
|
||||||
KEEP (*(SORT_NONE(.init)))
|
|
||||||
} >rom AT>rom :rom
|
|
||||||
|
|
||||||
.text :
|
|
||||||
{
|
|
||||||
*(.text.unlikely .text.unlikely.*)
|
|
||||||
*(.text.startup .text.startup.*)
|
|
||||||
*(.text .text.*)
|
|
||||||
*(.gnu.linkonce.t.*)
|
|
||||||
} >rom AT>rom :rom
|
|
||||||
|
|
||||||
.fini :
|
|
||||||
{
|
|
||||||
KEEP (*(SORT_NONE(.fini)))
|
|
||||||
} >rom AT>rom :rom
|
|
||||||
|
|
||||||
PROVIDE (__etext = .);
|
|
||||||
PROVIDE (_etext = .);
|
|
||||||
PROVIDE (etext = .);
|
|
||||||
|
|
||||||
.rodata :
|
|
||||||
{
|
|
||||||
*(.rdata)
|
|
||||||
*(.rodata .rodata.*)
|
|
||||||
*(.gnu.linkonce.r.*)
|
|
||||||
} >rom AT>rom :rom
|
|
||||||
|
|
||||||
. = ALIGN(4);
|
|
||||||
|
|
||||||
.preinit_array :
|
|
||||||
{
|
|
||||||
PROVIDE_HIDDEN (__preinit_array_start = .);
|
|
||||||
KEEP (*(.preinit_array))
|
|
||||||
PROVIDE_HIDDEN (__preinit_array_end = .);
|
|
||||||
} >rom AT>rom :rom
|
|
||||||
|
|
||||||
.init_array :
|
|
||||||
{
|
|
||||||
PROVIDE_HIDDEN (__init_array_start = .);
|
|
||||||
KEEP (*(SORT_BY_INIT_PRIORITY(.init_array.*) SORT_BY_INIT_PRIORITY(.ctors.*)))
|
|
||||||
KEEP (*(.init_array EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o ) .ctors))
|
|
||||||
PROVIDE_HIDDEN (__init_array_end = .);
|
|
||||||
} >rom AT>rom :rom
|
|
||||||
|
|
||||||
.fini_array :
|
|
||||||
{
|
|
||||||
PROVIDE_HIDDEN (__fini_array_start = .);
|
|
||||||
KEEP (*(SORT_BY_INIT_PRIORITY(.fini_array.*) SORT_BY_INIT_PRIORITY(.dtors.*)))
|
|
||||||
KEEP (*(.fini_array EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o ) .dtors))
|
|
||||||
PROVIDE_HIDDEN (__fini_array_end = .);
|
|
||||||
} >rom AT>rom :rom
|
|
||||||
|
|
||||||
.ctors :
|
|
||||||
{
|
|
||||||
/* gcc uses crtbegin.o to find the start of
|
|
||||||
the constructors, so we make sure it is
|
|
||||||
first. Because this is a wildcard, it
|
|
||||||
doesn't matter if the user does not
|
|
||||||
actually link against crtbegin.o; the
|
|
||||||
linker won't look for a file to match a
|
|
||||||
wildcard. The wildcard also means that it
|
|
||||||
doesn't matter which directory crtbegin.o
|
|
||||||
is in. */
|
|
||||||
KEEP (*crtbegin.o(.ctors))
|
|
||||||
KEEP (*crtbegin?.o(.ctors))
|
|
||||||
/* We don't want to include the .ctor section from
|
|
||||||
the crtend.o file until after the sorted ctors.
|
|
||||||
The .ctor section from the crtend file contains the
|
|
||||||
end of ctors marker and it must be last */
|
|
||||||
KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors))
|
|
||||||
KEEP (*(SORT(.ctors.*)))
|
|
||||||
KEEP (*(.ctors))
|
|
||||||
} >rom AT>rom :rom
|
|
||||||
|
|
||||||
.dtors :
|
|
||||||
{
|
|
||||||
KEEP (*crtbegin.o(.dtors))
|
|
||||||
KEEP (*crtbegin?.o(.dtors))
|
|
||||||
KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors))
|
|
||||||
KEEP (*(SORT(.dtors.*)))
|
|
||||||
KEEP (*(.dtors))
|
|
||||||
} >rom AT>rom :rom
|
|
||||||
|
|
||||||
.dummy :
|
|
||||||
{
|
|
||||||
*(.comment.*)
|
|
||||||
|
|
||||||
}
|
|
||||||
.lalign :
|
|
||||||
{
|
|
||||||
. = ALIGN(4);
|
|
||||||
PROVIDE( _data_lma = . );
|
|
||||||
} >rom AT>rom :rom
|
|
||||||
|
|
||||||
.dalign :
|
|
||||||
{
|
|
||||||
. = ALIGN(4);
|
|
||||||
PROVIDE( _data = . );
|
|
||||||
} >ram AT>rom :ram_init
|
|
||||||
|
|
||||||
.data :
|
|
||||||
{
|
|
||||||
__DATA_BEGIN__ = .;
|
|
||||||
*(.data .data.*)
|
|
||||||
*(.gnu.linkonce.d.*)
|
|
||||||
} >ram AT>rom :ram_init
|
|
||||||
|
|
||||||
.sdata :
|
|
||||||
{
|
|
||||||
__SDATA_BEGIN__ = .;
|
|
||||||
*(.sdata .sdata.*)
|
|
||||||
*(.gnu.linkonce.s.*)
|
|
||||||
} >ram AT>rom :ram_init
|
|
||||||
|
|
||||||
.srodata :
|
|
||||||
{
|
|
||||||
*(.srodata.cst16)
|
|
||||||
*(.srodata.cst8)
|
|
||||||
*(.srodata.cst4)
|
|
||||||
*(.srodata.cst2)
|
|
||||||
*(.srodata .srodata.*)
|
|
||||||
} >ram AT>rom :ram_init
|
|
||||||
|
|
||||||
. = ALIGN(4);
|
|
||||||
PROVIDE( _edata = . );
|
|
||||||
PROVIDE( edata = . );
|
|
||||||
|
|
||||||
PROVIDE( _fbss = . );
|
|
||||||
PROVIDE( __bss_start = . );
|
|
||||||
.bss :
|
|
||||||
{
|
|
||||||
*(.sbss*)
|
|
||||||
*(.gnu.linkonce.sb.*)
|
|
||||||
*(.bss .bss.*)
|
|
||||||
*(.gnu.linkonce.b.*)
|
|
||||||
*(COMMON)
|
|
||||||
. = ALIGN(4);
|
|
||||||
} >ram AT>ram :ram
|
|
||||||
|
|
||||||
. = ALIGN(8);
|
|
||||||
__BSS_END__ = .;
|
|
||||||
__global_pointer$ = MIN(__SDATA_BEGIN__ + 0x800, MAX(__DATA_BEGIN__ + 0x800, __BSS_END__ - 0x800));
|
|
||||||
PROVIDE( _end = . );
|
|
||||||
PROVIDE( end = . );
|
|
||||||
|
|
||||||
.stack ORIGIN(ram) + LENGTH(ram) - __stack_size :
|
|
||||||
{
|
|
||||||
PROVIDE( _heap_end = . );
|
|
||||||
. = __stack_size;
|
|
||||||
PROVIDE( _sp = . );
|
|
||||||
} >ram AT>ram :ram
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
PROVIDE( tohost = . );
|
|
||||||
PROVIDE( fromhost = . + 8 );
|
|
||||||
}
|
|
||||||
171
env/riscv_vp/sections.ld
vendored
Normal file
171
env/riscv_vp/sections.ld
vendored
Normal file
@@ -0,0 +1,171 @@
|
|||||||
|
PHDRS
|
||||||
|
{
|
||||||
|
flash PT_LOAD;
|
||||||
|
ram_init PT_LOAD;
|
||||||
|
ram PT_NULL;
|
||||||
|
dram PT_NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
SECTIONS
|
||||||
|
{
|
||||||
|
__stack_size = DEFINED(__stack_size) ? __stack_size : 2K;
|
||||||
|
__stack_segment_size = DEFINED(__stack_segment_size) ? __stack_segment_size : __stack_size;
|
||||||
|
.init ORIGIN(REGION_TEXT) :
|
||||||
|
{
|
||||||
|
KEEP (*(SORT_NONE(.init)))
|
||||||
|
} >REGION_TEXT AT>REGION_TEXT :flash
|
||||||
|
|
||||||
|
.text :
|
||||||
|
{
|
||||||
|
*(.text.unlikely .text.unlikely.*)
|
||||||
|
*(.text.startup .text.startup.*)
|
||||||
|
*(.text .text.*)
|
||||||
|
*(.gnu.linkonce.t.*)
|
||||||
|
} >REGION_TEXT AT>REGION_TEXT :flash
|
||||||
|
|
||||||
|
.fini :
|
||||||
|
{
|
||||||
|
KEEP (*(SORT_NONE(.fini)))
|
||||||
|
} >REGION_TEXT AT>REGION_TEXT :flash
|
||||||
|
|
||||||
|
PROVIDE (__etext = .);
|
||||||
|
PROVIDE (_etext = .);
|
||||||
|
PROVIDE (etext = .);
|
||||||
|
|
||||||
|
.rodata :
|
||||||
|
{
|
||||||
|
*(.rdata)
|
||||||
|
*(.rodata .rodata.*)
|
||||||
|
*(.gnu.linkonce.r.*)
|
||||||
|
} >REGION_RODATA AT>REGION_RODATA :flash
|
||||||
|
|
||||||
|
.srodata :
|
||||||
|
{
|
||||||
|
*(.srodata.cst16)
|
||||||
|
*(.srodata.cst8)
|
||||||
|
*(.srodata.cst4)
|
||||||
|
*(.srodata.cst2)
|
||||||
|
*(.srodata .srodata.*)
|
||||||
|
} >REGION_RODATA AT>REGION_RODATA :flash
|
||||||
|
|
||||||
|
. = ALIGN(4);
|
||||||
|
|
||||||
|
.preinit_array :
|
||||||
|
{
|
||||||
|
PROVIDE_HIDDEN (__preinit_array_start = .);
|
||||||
|
KEEP (*(.preinit_array))
|
||||||
|
PROVIDE_HIDDEN (__preinit_array_end = .);
|
||||||
|
} >REGION_RODATA AT>REGION_RODATA :flash
|
||||||
|
|
||||||
|
.init_array :
|
||||||
|
{
|
||||||
|
PROVIDE_HIDDEN (__init_array_start = .);
|
||||||
|
KEEP (*(SORT_BY_INIT_PRIORITY(.init_array.*) SORT_BY_INIT_PRIORITY(.ctors.*)))
|
||||||
|
KEEP (*(.init_array EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o ) .ctors))
|
||||||
|
PROVIDE_HIDDEN (__init_array_end = .);
|
||||||
|
} >REGION_RODATA AT>REGION_RODATA :flash
|
||||||
|
|
||||||
|
.fini_array :
|
||||||
|
{
|
||||||
|
PROVIDE_HIDDEN (__fini_array_start = .);
|
||||||
|
KEEP (*(SORT_BY_INIT_PRIORITY(.fini_array.*) SORT_BY_INIT_PRIORITY(.dtors.*)))
|
||||||
|
KEEP (*(.fini_array EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o ) .dtors))
|
||||||
|
PROVIDE_HIDDEN (__fini_array_end = .);
|
||||||
|
} >REGION_RODATA AT>REGION_RODATA :flash
|
||||||
|
|
||||||
|
.ctors :
|
||||||
|
{
|
||||||
|
/* gcc uses crtbegin.o to find the start of
|
||||||
|
the constructors, so we make sure it is
|
||||||
|
first. Because this is a wildcard, it
|
||||||
|
doesn't matter if the user does not
|
||||||
|
actually link against crtbegin.o; the
|
||||||
|
linker won't look for a file to match a
|
||||||
|
wildcard. The wildcard also means that it
|
||||||
|
doesn't matter which directory crtbegin.o
|
||||||
|
is in. */
|
||||||
|
KEEP (*crtbegin.o(.ctors))
|
||||||
|
KEEP (*crtbegin?.o(.ctors))
|
||||||
|
/* We don't want to include the .ctor section from
|
||||||
|
the crtend.o file until after the sorted ctors.
|
||||||
|
The .ctor section from the crtend file contains the
|
||||||
|
end of ctors marker and it must be last */
|
||||||
|
KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors))
|
||||||
|
KEEP (*(SORT(.ctors.*)))
|
||||||
|
KEEP (*(.ctors))
|
||||||
|
} >REGION_RODATA AT>REGION_RODATA :flash
|
||||||
|
|
||||||
|
.dtors :
|
||||||
|
{
|
||||||
|
KEEP (*crtbegin.o(.dtors))
|
||||||
|
KEEP (*crtbegin?.o(.dtors))
|
||||||
|
KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors))
|
||||||
|
KEEP (*(SORT(.dtors.*)))
|
||||||
|
KEEP (*(.dtors))
|
||||||
|
} >REGION_RODATA AT>REGION_RODATA :flash
|
||||||
|
|
||||||
|
.dummy :
|
||||||
|
{
|
||||||
|
*(.comment.*)
|
||||||
|
|
||||||
|
}
|
||||||
|
.lalign :
|
||||||
|
{
|
||||||
|
. = ALIGN(4);
|
||||||
|
PROVIDE( _data_lma = . );
|
||||||
|
} >REGION_RODATA AT>REGION_RODATA :flash
|
||||||
|
|
||||||
|
.dalign :
|
||||||
|
{
|
||||||
|
. = ALIGN(4);
|
||||||
|
PROVIDE( _data = . );
|
||||||
|
} >REGION_DATA AT>REGION_RODATA :ram_init
|
||||||
|
|
||||||
|
.data :
|
||||||
|
{
|
||||||
|
__DATA_BEGIN__ = .;
|
||||||
|
*(.data .data.*)
|
||||||
|
*(.gnu.linkonce.d.*)
|
||||||
|
} >REGION_DATA AT>REGION_RODATA :ram_init
|
||||||
|
|
||||||
|
.sdata :
|
||||||
|
{
|
||||||
|
__SDATA_BEGIN__ = .;
|
||||||
|
*(.sdata .sdata.*)
|
||||||
|
*(.gnu.linkonce.s.*)
|
||||||
|
} >REGION_DATA AT>REGION_RODATA :ram_init
|
||||||
|
|
||||||
|
. = ALIGN(4);
|
||||||
|
PROVIDE( _edata = . );
|
||||||
|
PROVIDE( edata = . );
|
||||||
|
|
||||||
|
PROVIDE( _fbss = . );
|
||||||
|
PROVIDE( __bss_start = . );
|
||||||
|
.bss :
|
||||||
|
{
|
||||||
|
*(.sbss*)
|
||||||
|
*(.gnu.linkonce.sb.*)
|
||||||
|
*(.bss .bss.*)
|
||||||
|
*(.gnu.linkonce.b.*)
|
||||||
|
*(COMMON)
|
||||||
|
. = ALIGN(4);
|
||||||
|
} >REGION_BSS AT>REGION_BSS :ram
|
||||||
|
|
||||||
|
. = ALIGN(8);
|
||||||
|
__BSS_END__ = .;
|
||||||
|
__global_pointer$ = MIN(__SDATA_BEGIN__ + 0x800, MAX(__DATA_BEGIN__ + 0x800, __BSS_END__ - 0x800));
|
||||||
|
PROVIDE( _end = . );
|
||||||
|
PROVIDE( end = . );
|
||||||
|
|
||||||
|
.stack ORIGIN(ram) + LENGTH(ram) - __stack_segment_size :
|
||||||
|
{
|
||||||
|
PROVIDE( _heap_end = . );
|
||||||
|
. = __stack_segment_size;
|
||||||
|
PROVIDE( _sp = . );
|
||||||
|
} >REGION_BSS AT>REGION_BSS :ram
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
PROVIDE( tohost = . );
|
||||||
|
PROVIDE( fromhost = . + 8 );
|
||||||
|
}
|
||||||
35
env/start.S
vendored
35
env/start.S
vendored
@@ -9,18 +9,38 @@ _start:
|
|||||||
.option push
|
.option push
|
||||||
.option norelax
|
.option norelax
|
||||||
.option norvc
|
.option norvc
|
||||||
//#ifdef WITH_SIGNATURE
|
#ifdef WITH_SIGNATURE
|
||||||
j 1f
|
j 1f
|
||||||
.2byte 0x4e4d
|
.2byte 0x4e4d
|
||||||
.2byte 0x5352
|
.2byte 0x5352
|
||||||
.4byte 0x669
|
.4byte 0x669
|
||||||
1:
|
1:
|
||||||
//#endif
|
#endif
|
||||||
la gp, __global_pointer$
|
la gp, __global_pointer$
|
||||||
.option pop
|
.option pop
|
||||||
la sp, _sp
|
csrr t0, mhartid // Get hart ID
|
||||||
|
la t1, __stack_size // stack size
|
||||||
|
la sp, _sp // Base stack address
|
||||||
|
/* this loop is to avoid multiplication which is not available on all ISAs */
|
||||||
|
1:
|
||||||
|
beqz t0, 2f
|
||||||
|
sub sp, sp, t1 // Subtract __stack_size to get per-hart stack base
|
||||||
|
addi t0, t0, -1
|
||||||
|
j 1b
|
||||||
|
2:
|
||||||
la t0, trap_entry
|
la t0, trap_entry
|
||||||
csrw mtvec, t0
|
csrw mtvec, t0
|
||||||
|
#if defined(NUM_HARTS)
|
||||||
|
/* block other cores until hart 0 has finished initialization */
|
||||||
|
csrr t0, mhartid
|
||||||
|
beqz t0, hart0_init
|
||||||
|
/* enable MSI locally */
|
||||||
|
csrwi mie, 0x8
|
||||||
|
wfi
|
||||||
|
csrw mie, zero
|
||||||
|
j hartx_start
|
||||||
|
hart0_init:
|
||||||
|
#endif
|
||||||
/* Load data section */
|
/* Load data section */
|
||||||
la a0, _data_lma
|
la a0, _data_lma
|
||||||
la a1, _data
|
la a1, _data
|
||||||
@@ -50,6 +70,10 @@ _start:
|
|||||||
call atexit
|
call atexit
|
||||||
call __libc_init_array
|
call __libc_init_array
|
||||||
#endif
|
#endif
|
||||||
|
la a0, mtx
|
||||||
|
li t0, 1
|
||||||
|
sw t0, 0(a0)
|
||||||
|
hartx_start:
|
||||||
#ifndef __riscv_float_abi_soft
|
#ifndef __riscv_float_abi_soft
|
||||||
/* Enable FPU */
|
/* Enable FPU */
|
||||||
li t0, MSTATUS_FS
|
li t0, MSTATUS_FS
|
||||||
@@ -66,3 +90,8 @@ _start:
|
|||||||
li a1, 0
|
li a1, 0
|
||||||
call main
|
call main
|
||||||
tail _exit
|
tail _exit
|
||||||
|
|
||||||
|
|
||||||
|
.data
|
||||||
|
mtx:
|
||||||
|
.word 0 # 32-bit value
|
||||||
|
|||||||
@@ -13,26 +13,26 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
volatile uint32_t MSIP0;
|
volatile uint32_t MSIP[4096];
|
||||||
uint8_t fill0[16380];
|
struct {
|
||||||
volatile uint32_t MTIMECMP0LO;
|
volatile uint32_t LO;
|
||||||
volatile uint32_t MTIMECMP0HI;
|
volatile uint32_t HI;
|
||||||
uint8_t fill1[32752];
|
} MTIMECMP[4095];
|
||||||
volatile uint32_t MTIME_LO;
|
volatile uint32_t MTIME_LO;
|
||||||
volatile uint32_t MTIME_HI;
|
volatile uint32_t MTIME_HI;
|
||||||
} aclint_t;
|
} aclint_t;
|
||||||
|
|
||||||
#define ACLINT_MSIP0_OFFS 0
|
#define ACLINT_MSIP_OFFS 0
|
||||||
#define ACLINT_MSIP0_MASK 0x1
|
#define ACLINT_MSIP_MASK 0x1
|
||||||
#define ACLINT_MSIP0(V) ((V & ACLINT_MSIP0_MASK) << ACLINT_MSIP0_OFFS)
|
#define ACLINT_MSIP(V) ((V & ACLINT_MSIP0_MASK) << ACLINT_MSIP0_OFFS)
|
||||||
|
|
||||||
#define ACLINT_MTIMECMP0LO_OFFS 0
|
#define ACLINT_MTIMECMPLO_OFFS 0
|
||||||
#define ACLINT_MTIMECMP0LO_MASK 0xffffffff
|
#define ACLINT_MTIMECMPLO_MASK 0xffffffff
|
||||||
#define ACLINT_MTIMECMP0LO(V) ((V & ACLINT_MTIMECMP0LO_MASK) << ACLINT_MTIMECMP0LO_OFFS)
|
#define ACLINT_MTIMECMPLO(V) ((V & ACLINT_MTIMECMP0LO_MASK) << ACLINT_MTIMECMP0LO_OFFS)
|
||||||
|
|
||||||
#define ACLINT_MTIMECMP0HI_OFFS 0
|
#define ACLINT_MTIMECMPHI_OFFS 0
|
||||||
#define ACLINT_MTIMECMP0HI_MASK 0xffffffff
|
#define ACLINT_MTIMECMPHI_MASK 0xffffffff
|
||||||
#define ACLINT_MTIMECMP0HI(V) ((V & ACLINT_MTIMECMP0HI_MASK) << ACLINT_MTIMECMP0HI_OFFS)
|
#define ACLINT_MTIMECMPHI(V) ((V & ACLINT_MTIMECMP0HI_MASK) << ACLINT_MTIMECMP0HI_OFFS)
|
||||||
|
|
||||||
#define ACLINT_MTIME_LO_OFFS 0
|
#define ACLINT_MTIME_LO_OFFS 0
|
||||||
#define ACLINT_MTIME_LO_MASK 0xffffffff
|
#define ACLINT_MTIME_LO_MASK 0xffffffff
|
||||||
@@ -43,21 +43,43 @@ typedef struct {
|
|||||||
#define ACLINT_MTIME_HI(V) ((V & ACLINT_MTIME_HI_MASK) << ACLINT_MTIME_HI_OFFS)
|
#define ACLINT_MTIME_HI(V) ((V & ACLINT_MTIME_HI_MASK) << ACLINT_MTIME_HI_OFFS)
|
||||||
|
|
||||||
// ACLINT_MSIP0
|
// ACLINT_MSIP0
|
||||||
static inline uint32_t get_aclint_msip0(volatile aclint_t* reg) { return reg->MSIP0; }
|
static inline uint32_t get_aclint_msip0(volatile aclint_t* reg) { return reg->MSIP[0]; }
|
||||||
static inline void set_aclint_msip0(volatile aclint_t* reg, uint32_t value) { reg->MSIP0 = value; }
|
static inline void set_aclint_msip0(volatile aclint_t* reg, uint32_t value) { reg->MSIP[0] = value; }
|
||||||
static inline uint32_t get_aclint_msip0_msip(volatile aclint_t* reg) { return (reg->MSIP0 >> 0) & 0x1; }
|
static inline uint32_t get_aclint_msip0_msip(volatile aclint_t* reg) { return (reg->MSIP[0] >> 0) & 0x1; }
|
||||||
static inline void set_aclint_msip0_msip(volatile aclint_t* reg, uint8_t value) { reg->MSIP0 = (reg->MSIP0 & ~(0x1U << 0)) | (value << 0); }
|
static inline void set_aclint_msip0_msip(volatile aclint_t* reg, uint8_t value) {
|
||||||
|
reg->MSIP[0] = (reg->MSIP[0] & ~(0x1U << 0)) | (value << 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ACLINT_MSIP
|
||||||
|
static inline uint32_t get_aclint_msip(volatile aclint_t* reg, unsigned idx) { return reg->MSIP[idx]; }
|
||||||
|
static inline void set_aclint_msip(volatile aclint_t* reg, unsigned idx, uint32_t value) { reg->MSIP[idx] = value; }
|
||||||
|
static inline uint32_t get_aclint_msip_msip(volatile aclint_t* reg, unsigned idx) { return (reg->MSIP[idx] >> 0) & 0x1; }
|
||||||
|
static inline void set_aclint_msip_msip(volatile aclint_t* reg, unsigned idx, uint8_t value) {
|
||||||
|
reg->MSIP[idx] = (reg->MSIP[idx] & ~(0x1U << 0)) | (value << 0);
|
||||||
|
}
|
||||||
|
|
||||||
// ACLINT_MTIMECMP0LO
|
// ACLINT_MTIMECMP0LO
|
||||||
static inline uint32_t get_aclint_mtimecmp0lo(volatile aclint_t* reg) { return (reg->MTIMECMP0LO >> 0) & 0xffffffff; }
|
static inline uint32_t get_aclint_mtimecmp0lo(volatile aclint_t* reg) { return (reg->MTIMECMP[0].LO >> 0) & 0xffffffff; }
|
||||||
static inline void set_aclint_mtimecmp0lo(volatile aclint_t* reg, uint32_t value) {
|
static inline void set_aclint_mtimecmp0lo(volatile aclint_t* reg, uint32_t value) {
|
||||||
reg->MTIMECMP0LO = (reg->MTIMECMP0LO & ~(0xffffffffU << 0)) | (value << 0);
|
reg->MTIMECMP[0].LO = (reg->MTIMECMP[0].LO & ~(0xffffffffU << 0)) | (value << 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ACLINT_MTIMECMPxLO
|
||||||
|
static inline uint32_t get_aclint_mtimecmplo(volatile aclint_t* reg, unsigned idx) { return (reg->MTIMECMP[idx].LO >> 0) & 0xffffffff; }
|
||||||
|
static inline void set_aclint_mtimecmplo(volatile aclint_t* reg, unsigned idx, uint32_t value) {
|
||||||
|
reg->MTIMECMP[idx].LO = (reg->MTIMECMP[idx].LO & ~(0xffffffffU << 0)) | (value << 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ACLINT_MTIMECMP0HI
|
// ACLINT_MTIMECMP0HI
|
||||||
static inline uint32_t get_aclint_mtimecmp0hi(volatile aclint_t* reg) { return (reg->MTIMECMP0HI >> 0) & 0xffffffff; }
|
static inline uint32_t get_aclint_mtimecmp0hi(volatile aclint_t* reg) { return (reg->MTIMECMP[0].HI >> 0) & 0xffffffff; }
|
||||||
static inline void set_aclint_mtimecmp0hi(volatile aclint_t* reg, uint32_t value) {
|
static inline void set_aclint_mtimecmp0hi(volatile aclint_t* reg, uint32_t value) {
|
||||||
reg->MTIMECMP0HI = (reg->MTIMECMP0HI & ~(0xffffffffU << 0)) | (value << 0);
|
reg->MTIMECMP[0].HI = (reg->MTIMECMP[0].HI & ~(0xffffffffU << 0)) | (value << 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ACLINT_MTIMECMPxHI
|
||||||
|
static inline uint32_t get_aclint_mtimecmphi(volatile aclint_t* reg, unsigned idx) { return (reg->MTIMECMP[idx].HI >> 0) & 0xffffffff; }
|
||||||
|
static inline void set_aclint_mtimecmphi(volatile aclint_t* reg, unsigned idx, uint32_t value) {
|
||||||
|
reg->MTIMECMP[idx].HI = (reg->MTIMECMP[idx].HI & ~(0xffffffffU << 0)) | (value << 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ACLINT_MTIME_LO
|
// ACLINT_MTIME_LO
|
||||||
|
|||||||
169
include/minres/devices/gen/ethmac.h
Normal file
169
include/minres/devices/gen/ethmac.h
Normal file
@@ -0,0 +1,169 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2023 - 2026 MINRES Technologies GmbH
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*
|
||||||
|
* Generated at 2026-01-10 12:50:16 UTC
|
||||||
|
* by peakrdl_mnrs version 1.2.10
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _BSP_ETHMAC_H
|
||||||
|
#define _BSP_ETHMAC_H
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
volatile uint32_t MAC_CTRL;
|
||||||
|
uint8_t fill0[12];
|
||||||
|
volatile uint32_t TX_DATA_REG;
|
||||||
|
volatile uint32_t TX_AVAIL_REG;
|
||||||
|
uint8_t fill1[8];
|
||||||
|
volatile uint32_t RX_DATA_REG;
|
||||||
|
uint8_t fill2[8];
|
||||||
|
volatile uint32_t RX_STAT_REG;
|
||||||
|
volatile uint32_t INT_CTRL_REG;
|
||||||
|
}ethmac_t;
|
||||||
|
|
||||||
|
#define ETHMAC_MAC_CTRL_TX_FLUSH_OFFS 0
|
||||||
|
#define ETHMAC_MAC_CTRL_TX_FLUSH_MASK 0x1
|
||||||
|
#define ETHMAC_MAC_CTRL_TX_FLUSH(V) ((V & ETHMAC_MAC_CTRL_TX_FLUSH_MASK) << ETHMAC_MAC_CTRL_TX_FLUSH_OFFS)
|
||||||
|
|
||||||
|
#define ETHMAC_MAC_CTRL_TX_SPACE_AVAIL_OFFS 1
|
||||||
|
#define ETHMAC_MAC_CTRL_TX_SPACE_AVAIL_MASK 0x1
|
||||||
|
#define ETHMAC_MAC_CTRL_TX_SPACE_AVAIL(V) ((V & ETHMAC_MAC_CTRL_TX_SPACE_AVAIL_MASK) << ETHMAC_MAC_CTRL_TX_SPACE_AVAIL_OFFS)
|
||||||
|
|
||||||
|
#define ETHMAC_MAC_CTRL_TX_ALIGNER_ENABLE_OFFS 2
|
||||||
|
#define ETHMAC_MAC_CTRL_TX_ALIGNER_ENABLE_MASK 0x1
|
||||||
|
#define ETHMAC_MAC_CTRL_TX_ALIGNER_ENABLE(V) ((V & ETHMAC_MAC_CTRL_TX_ALIGNER_ENABLE_MASK) << ETHMAC_MAC_CTRL_TX_ALIGNER_ENABLE_OFFS)
|
||||||
|
|
||||||
|
#define ETHMAC_MAC_CTRL_RX_FLUSH_OFFS 4
|
||||||
|
#define ETHMAC_MAC_CTRL_RX_FLUSH_MASK 0x1
|
||||||
|
#define ETHMAC_MAC_CTRL_RX_FLUSH(V) ((V & ETHMAC_MAC_CTRL_RX_FLUSH_MASK) << ETHMAC_MAC_CTRL_RX_FLUSH_OFFS)
|
||||||
|
|
||||||
|
#define ETHMAC_MAC_CTRL_RX_DATA_AVAIL_OFFS 5
|
||||||
|
#define ETHMAC_MAC_CTRL_RX_DATA_AVAIL_MASK 0x1
|
||||||
|
#define ETHMAC_MAC_CTRL_RX_DATA_AVAIL(V) ((V & ETHMAC_MAC_CTRL_RX_DATA_AVAIL_MASK) << ETHMAC_MAC_CTRL_RX_DATA_AVAIL_OFFS)
|
||||||
|
|
||||||
|
#define ETHMAC_MAC_CTRL_RX_ALIGNER_ENABLE_OFFS 6
|
||||||
|
#define ETHMAC_MAC_CTRL_RX_ALIGNER_ENABLE_MASK 0x1
|
||||||
|
#define ETHMAC_MAC_CTRL_RX_ALIGNER_ENABLE(V) ((V & ETHMAC_MAC_CTRL_RX_ALIGNER_ENABLE_MASK) << ETHMAC_MAC_CTRL_RX_ALIGNER_ENABLE_OFFS)
|
||||||
|
|
||||||
|
#define ETHMAC_TX_DATA_REG_OFFS 0
|
||||||
|
#define ETHMAC_TX_DATA_REG_MASK 0xffffffff
|
||||||
|
#define ETHMAC_TX_DATA_REG(V) ((V & ETHMAC_TX_DATA_REG_MASK) << ETHMAC_TX_DATA_REG_OFFS)
|
||||||
|
|
||||||
|
#define ETHMAC_TX_AVAIL_REG_OFFS 0
|
||||||
|
#define ETHMAC_TX_AVAIL_REG_MASK 0x1ff
|
||||||
|
#define ETHMAC_TX_AVAIL_REG(V) ((V & ETHMAC_TX_AVAIL_REG_MASK) << ETHMAC_TX_AVAIL_REG_OFFS)
|
||||||
|
|
||||||
|
#define ETHMAC_RX_DATA_REG_OFFS 0
|
||||||
|
#define ETHMAC_RX_DATA_REG_MASK 0xffffffff
|
||||||
|
#define ETHMAC_RX_DATA_REG(V) ((V & ETHMAC_RX_DATA_REG_MASK) << ETHMAC_RX_DATA_REG_OFFS)
|
||||||
|
|
||||||
|
#define ETHMAC_RX_STAT_REG_RX_ERRORS_OFFS 0
|
||||||
|
#define ETHMAC_RX_STAT_REG_RX_ERRORS_MASK 0xff
|
||||||
|
#define ETHMAC_RX_STAT_REG_RX_ERRORS(V) ((V & ETHMAC_RX_STAT_REG_RX_ERRORS_MASK) << ETHMAC_RX_STAT_REG_RX_ERRORS_OFFS)
|
||||||
|
|
||||||
|
#define ETHMAC_RX_STAT_REG_RX_DROPS_OFFS 8
|
||||||
|
#define ETHMAC_RX_STAT_REG_RX_DROPS_MASK 0xff
|
||||||
|
#define ETHMAC_RX_STAT_REG_RX_DROPS(V) ((V & ETHMAC_RX_STAT_REG_RX_DROPS_MASK) << ETHMAC_RX_STAT_REG_RX_DROPS_OFFS)
|
||||||
|
|
||||||
|
#define ETHMAC_INT_CTRL_REG_TX_FREE_INTR_ENABLE_OFFS 0
|
||||||
|
#define ETHMAC_INT_CTRL_REG_TX_FREE_INTR_ENABLE_MASK 0x1
|
||||||
|
#define ETHMAC_INT_CTRL_REG_TX_FREE_INTR_ENABLE(V) ((V & ETHMAC_INT_CTRL_REG_TX_FREE_INTR_ENABLE_MASK) << ETHMAC_INT_CTRL_REG_TX_FREE_INTR_ENABLE_OFFS)
|
||||||
|
|
||||||
|
#define ETHMAC_INT_CTRL_REG_RX_DATA_AVAIL_INTR_ENABLE_OFFS 1
|
||||||
|
#define ETHMAC_INT_CTRL_REG_RX_DATA_AVAIL_INTR_ENABLE_MASK 0x1
|
||||||
|
#define ETHMAC_INT_CTRL_REG_RX_DATA_AVAIL_INTR_ENABLE(V) ((V & ETHMAC_INT_CTRL_REG_RX_DATA_AVAIL_INTR_ENABLE_MASK) << ETHMAC_INT_CTRL_REG_RX_DATA_AVAIL_INTR_ENABLE_OFFS)
|
||||||
|
|
||||||
|
//ETHMAC_MAC_CTRL
|
||||||
|
static inline uint32_t get_ethmac_mac_ctrl(volatile ethmac_t* reg){
|
||||||
|
return reg->MAC_CTRL;
|
||||||
|
}
|
||||||
|
static inline void set_ethmac_mac_ctrl(volatile ethmac_t* reg, uint32_t value){
|
||||||
|
reg->MAC_CTRL = value;
|
||||||
|
}
|
||||||
|
static inline uint32_t get_ethmac_mac_ctrl_tx_flush(volatile ethmac_t* reg){
|
||||||
|
return (reg->MAC_CTRL >> 0) & 0x1;
|
||||||
|
}
|
||||||
|
static inline void set_ethmac_mac_ctrl_tx_flush(volatile ethmac_t* reg, uint8_t value){
|
||||||
|
reg->MAC_CTRL = (reg->MAC_CTRL & ~(0x1U << 0)) | (value << 0);
|
||||||
|
}
|
||||||
|
static inline uint32_t get_ethmac_mac_ctrl_tx_space_avail(volatile ethmac_t* reg){
|
||||||
|
return (reg->MAC_CTRL >> 1) & 0x1;
|
||||||
|
}
|
||||||
|
static inline uint32_t get_ethmac_mac_ctrl_tx_aligner_enable(volatile ethmac_t* reg){
|
||||||
|
return (reg->MAC_CTRL >> 2) & 0x1;
|
||||||
|
}
|
||||||
|
static inline void set_ethmac_mac_ctrl_tx_aligner_enable(volatile ethmac_t* reg, uint8_t value){
|
||||||
|
reg->MAC_CTRL = (reg->MAC_CTRL & ~(0x1U << 2)) | (value << 2);
|
||||||
|
}
|
||||||
|
static inline uint32_t get_ethmac_mac_ctrl_rx_flush(volatile ethmac_t* reg){
|
||||||
|
return (reg->MAC_CTRL >> 4) & 0x1;
|
||||||
|
}
|
||||||
|
static inline void set_ethmac_mac_ctrl_rx_flush(volatile ethmac_t* reg, uint8_t value){
|
||||||
|
reg->MAC_CTRL = (reg->MAC_CTRL & ~(0x1U << 4)) | (value << 4);
|
||||||
|
}
|
||||||
|
static inline uint32_t get_ethmac_mac_ctrl_rx_data_avail(volatile ethmac_t* reg){
|
||||||
|
return (reg->MAC_CTRL >> 5) & 0x1;
|
||||||
|
}
|
||||||
|
static inline uint32_t get_ethmac_mac_ctrl_rx_aligner_enable(volatile ethmac_t* reg){
|
||||||
|
return (reg->MAC_CTRL >> 6) & 0x1;
|
||||||
|
}
|
||||||
|
static inline void set_ethmac_mac_ctrl_rx_aligner_enable(volatile ethmac_t* reg, uint8_t value){
|
||||||
|
reg->MAC_CTRL = (reg->MAC_CTRL & ~(0x1U << 6)) | (value << 6);
|
||||||
|
}
|
||||||
|
|
||||||
|
//ETHMAC_TX_DATA_REG
|
||||||
|
static inline uint32_t get_ethmac_tx_data_reg(volatile ethmac_t* reg){
|
||||||
|
return (reg->TX_DATA_REG >> 0) & 0xffffffff;
|
||||||
|
}
|
||||||
|
static inline void set_ethmac_tx_data_reg(volatile ethmac_t* reg, uint32_t value){
|
||||||
|
reg->TX_DATA_REG = (reg->TX_DATA_REG & ~(0xffffffffU << 0)) | (value << 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
//ETHMAC_TX_AVAIL_REG
|
||||||
|
static inline uint32_t get_ethmac_tx_avail_reg(volatile ethmac_t* reg){
|
||||||
|
return reg->TX_AVAIL_REG;
|
||||||
|
}
|
||||||
|
static inline uint32_t get_ethmac_tx_avail_reg_tx_availibility(volatile ethmac_t* reg){
|
||||||
|
return (reg->TX_AVAIL_REG >> 0) & 0x1ff;
|
||||||
|
}
|
||||||
|
|
||||||
|
//ETHMAC_RX_DATA_REG
|
||||||
|
static inline uint32_t get_ethmac_rx_data_reg(volatile ethmac_t* reg){
|
||||||
|
return (reg->RX_DATA_REG >> 0) & 0xffffffff;
|
||||||
|
}
|
||||||
|
|
||||||
|
//ETHMAC_RX_STAT_REG
|
||||||
|
static inline uint32_t get_ethmac_rx_stat_reg(volatile ethmac_t* reg){
|
||||||
|
return reg->RX_STAT_REG;
|
||||||
|
}
|
||||||
|
static inline uint32_t get_ethmac_rx_stat_reg_rx_errors(volatile ethmac_t* reg){
|
||||||
|
return (reg->RX_STAT_REG >> 0) & 0xff;
|
||||||
|
}
|
||||||
|
static inline uint32_t get_ethmac_rx_stat_reg_rx_drops(volatile ethmac_t* reg){
|
||||||
|
return (reg->RX_STAT_REG >> 8) & 0xff;
|
||||||
|
}
|
||||||
|
|
||||||
|
//ETHMAC_INT_CTRL_REG
|
||||||
|
static inline uint32_t get_ethmac_int_ctrl_reg(volatile ethmac_t* reg){
|
||||||
|
return reg->INT_CTRL_REG;
|
||||||
|
}
|
||||||
|
static inline void set_ethmac_int_ctrl_reg(volatile ethmac_t* reg, uint32_t value){
|
||||||
|
reg->INT_CTRL_REG = value;
|
||||||
|
}
|
||||||
|
static inline uint32_t get_ethmac_int_ctrl_reg_tx_free_intr_enable(volatile ethmac_t* reg){
|
||||||
|
return (reg->INT_CTRL_REG >> 0) & 0x1;
|
||||||
|
}
|
||||||
|
static inline void set_ethmac_int_ctrl_reg_tx_free_intr_enable(volatile ethmac_t* reg, uint8_t value){
|
||||||
|
reg->INT_CTRL_REG = (reg->INT_CTRL_REG & ~(0x1U << 0)) | (value << 0);
|
||||||
|
}
|
||||||
|
static inline uint32_t get_ethmac_int_ctrl_reg_rx_data_avail_intr_enable(volatile ethmac_t* reg){
|
||||||
|
return (reg->INT_CTRL_REG >> 1) & 0x1;
|
||||||
|
}
|
||||||
|
static inline void set_ethmac_int_ctrl_reg_rx_data_avail_intr_enable(volatile ethmac_t* reg, uint8_t value){
|
||||||
|
reg->INT_CTRL_REG = (reg->INT_CTRL_REG & ~(0x1U << 1)) | (value << 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* _BSP_ETHMAC_H */
|
||||||
Reference in New Issue
Block a user