LedChaser without PWM:
self.submodules.leds = LedChaser(
pads = platform.request_all("user_led"),
sys_clk_freq = sys_clk_freq)
self.add_csr("leds")
Add PWM to it (with default values: 50% duty cycle):
self.leds.add_pwm()
Add PWM with custom default values (25% duty cycle here):
self.leds.add_pwm(default_width=128, default_period=1024)
Then adjust brightness dynamically from the BIOS or your software:
$cat csr.csv:
csr_register,leds_out,0x82003000,1,rw
csr_register,leds_pwm_enable,0x82003004,1,rw
csr_register,leds_pwm_width,0x82003008,1,rw
csr_register,leds_pwm_period,0x8200300c,1,rw
Set PWM to 0%:
$mem_write 0x82003008 0
Set PWM to 25%:
$mem_write 0x82003008 256
Set PWM to 50%:
$mem_write 0x82003008 512
Set PWM to 75%:
$mem_write 0x82003008 768
Set PWM to 100%:
$mem_write 0x82003008 1024
You can also only use default values and disable CSR is dynamic configuration is not
required (with_csr=False) or adjust PWM period if want to use a specific PWM period
in your system.
When the system/bus clock frequency is an exact power-of-2 multiple of
the desired sdcard frequency, we can drive the latter at the "maximum"
speed via the "perfect" divider. That sometimes turns out too fast, so
in order to be conservative, we double the divider, thus halving the
resulting sdclock.
This allows the Linux driver in single-block mode (cmd17-only) to
operate solidly, without running into timeouts from LiteSDCard FSMs.
FIXME: multi-block (cmd18) transfers still time out, so revisit this
after some additional debugging.
Use irqs dict and "rise", "fall" strings instead of Enums:
Ex: pads=Signal(8), irqs={} : 8-bit Input, No IRQ.
pads=Signal(8), irqs={0: "rise", 7: "fall"}: 8-bit Input, rising IRQ on 0, falling IRQ on 1.
Also simplify the logic.
Change wording of demo README to make it more clear what the process is
and how things related. This should help the newcomer and it still
usefull for the triained.
Change the command example to be more copy paste friendly.
Fixes#814
In order for mor1kx to run an SMP kernel shadow registers must be
enabled. This patch adds two new variants:
- linux+smp - basic linux + smp support
- linux+smp+fpu - linux with FPU and smp support
puts() and putsnonl() are very similar, and can share code.
Reduce code size by making the former call the latter.
Impact for a RISC-V build:
$ size console.o.orig console.o
text data bss dec hex filename
868 0 12 880 370 console.o.orig
832 0 12 844 34c console.o
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
When building with --cpu-type=mor1kx:
litex/soc/software/bios/readline.c: In function 'readline':
litex/soc/software/bios/readline.c:271:3: warning: case label value exceeds maximum value for type [-Wswitch-outside-range]
271 | case KEY_END:
| ^~~~
litex/soc/software/bios/readline.c:297:3: warning: case label value exceeds maximum value for type [-Wswitch-outside-range]
297 | case KEY_DEL:
| ^~~~
litex/soc/software/bios/readline.c:281:3: warning: case label value exceeds maximum value for type [-Wswitch-outside-range]
281 | case DEL:
| ^~~~
The C standard does not specify the signedness of "char", hence this
depends on the implementation. On e.g. RISC-V, "char" is unsigned, but
on OpenRISC, it is signed.
Fix this by making the "ichar" variable explicitly unsigned.
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
When building the linux-on-litex-vexriscv documentation with Sphinx
v1.8.5:
Sphinx error:
master file linux-on-litex-vexriscv/build/orangecrab/doc/contents.rst not found
The default value of "master_doc" was changed from "contents" to "index"
in Sphinx v2[1]. As the LiteX doc system creates "index.rst", it thus
fails to build with Sphinx v1.x.
Explicitly configure "master_doc" to "index", to make it work with all
versions of Sphinx, regardless of the default.
[1] https://www.sphinx-doc.org/ca/latest/usage/configuration.html?highlight=master_doc
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>