Deutsch   English   Français   Italiano  
<nnd$3c99179e$3dd4b32f@6cc2be919654136f>

View for Bookmarking (what is this?)
Look up another Usenet article

Newsgroups: comp.lang.forth
References: <87frpoewse.fsf@nightsong.com> <nnd$3d8918a3$47abdf13@03dd132c1b0f3b13> <vf5sit$2gjqb$1@paganini.bofh.team> <vfhgqc$3sajh$1@paganini.bofh.team>
From: albert@spenarnc.xs4all.nl
Subject: Re: 1 euro Olimex RISC-V mini-PC: this needs Forth ;)
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
Originator: albert@cherry.(none) (albert)
Message-ID: <nnd$3c99179e$3dd4b32f@6cc2be919654136f>
Organization: KPN B.V.
Date: Sat, 26 Oct 2024 10:48:27 +0200
Path: eternal-september.org!news.eternal-september.org!feeder2.eternal-september.org!2.eu.feeder.erje.net!3.eu.feeder.erje.net!feeder.erje.net!feeder2.feed.ams11.usenet.farm!feed.usenet.farm!feed.abavia.com!abe007.abavia.com!abp004.abavia.com!news.kpn.nl!not-for-mail
Lines: 47
Injection-Date: Sat, 26 Oct 2024 10:48:27 +0200
Injection-Info: news.kpn.nl; mail-complaints-to="abuse@kpn.com"

In article <vfhgqc$3sajh$1@paganini.bofh.team>,
Waldek Hebisch <antispam@fricas.org> wrote:
>Waldek Hebisch <antispam@fricas.org> wrote:
<SNIP>
>Milkv Duos have 5 GPIO ports, formally 32-bit but many lines are
>not connected to outputs.  One port in RTC block and has
>base address 0x05021000, the other ports are at 0x03020000 + n*0x1000
>where n is port number.  Output register is at offset 0, at offset
>4 is direction register (setting bit to 1 means that line is an
>output).  At offset 0x50 is input register.  Other registers
>deal with interrupts.
>
>ATM I have the following:
>
>HEX
>: LBIS DUP L@ ROT OR SWAP L! ;
>: LBIC DUP L@ ROT INVERT AND SWAP L! ;

These boards are all 32 bits io. So I lifted the BIS and BIC
from ARM boards into riscv.
So you can use BIS instead of LBIS, BIC instead of LBIC.
Of course they are in assembler, as these low level words must be.

>: gpio-base DUP 4 = IF DROP 2001000 ELSE 1000 * THEN VMA-IO @ + 20000 + ;
>: bit-data 20 /MOD SWAP 1 SWAP LSHIFT SWAP gpio-base ;
>: gpio-on bit-data LBIS ;
>: gpio-off bit-data LBIC ;
>
>which outputs bits to data register.  To get actual output one
>need to set direction register and associate PIN with GPIO function.

I defined set-function by ( fun# gpio#)
and redefine fun# that I always 0 for input , -1 for output.
This make a 1602 driver almost portable except for defining
the port numbers/


>--
>                              Waldek Hebisch

Groetjes Albert
-- 
Temu exploits Christians: (Disclaimer, only 10 apostles)
Last Supper Acrylic Suncatcher - 15Cm Round Stained Glass- Style Wall
Art For Home, Office And Garden Decor - Perfect For Windows, Bars,
And Gifts For Friends Family And Colleagues.