Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.forth > #132498

Re: 1 euro Olimex RISC-V mini-PC: this needs Forth ;)

Newsgroups comp.lang.forth
References <87frpoewse.fsf@nightsong.com> <vfhgqc$3sajh$1@paganini.bofh.team> <nnd$3c99179e$3dd4b32f@6cc2be919654136f> <vfjlan$3vq70$1@paganini.bofh.team>
From albert@spenarnc.xs4all.nl
Subject Re: 1 euro Olimex RISC-V mini-PC: this needs Forth ;)
Message-ID <nnd$486f28f2$200c0880@0eff2d968d536edb> (permalink)
Organization KPN B.V.
Date 2024-10-27 11:12 +0100

Show all headers | View raw


In article <vfjlan$3vq70$1@paganini.bofh.team>,
Waldek Hebisch <antispam@fricas.org> wrote:
>albert@spenarnc.xs4all.nl wrote:
>> In article <vfhgqc$3sajh$1@paganini.bofh.team>,
>> Waldek Hebisch <antispam@fricas.org> wrote:
>>>
>>>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/
>
>One pin may have several functions, not only GPIO.  Do you mean
>that you change numbering of functions so that 0 is GPIO input,
>-1 is GPIO output and other functions get other numbers?

GA13 is pin 0x1D. That is never changed.
29 CONSTANT GA13
0 GA13 set-function / OR
-1 GA13 set-function /OR

In the following example I use PB0. This is directly
reference in the doc. Function 5 couples PB0 to UART2.
This is documented also.
"$20 CONSTANT PB0    7 PB0 setfunction"
This is all it takes. Screw linux protections and
abstraction layers.
Now it boils down to finding out how the UART works.
Note that 32 uS is the period I want for a midi signal.

We Forthers don't have to rely on Linux kernel gurus,
but we need documentation.

----------------------------

\ $Id: uart.frt,v 1.4 2023/04/19 20:09:55 albert Exp albert $
\ Copyright (2023): Albert van der Horst {by GNU Public License}
WANT $-PREFIX
WANT setfunction
DECIMAL    \ All other via prefixes
$20 CONSTANT PB0 7 PB0 setfunction   \ PB0 coupled to UART2
\ Common
VMA-IO @ $00,1000 + CONSTANT CCU-BASE
CCU-BASE $090C + CONSTANT UART_BGR_REG
\ Reset all uarts and start the clocks.
-1 UART_BGR_REG L!

VMA-IO @ $50,0000 + CONSTANT UART-BASE
UART-BASE $0000 + CONSTANT UART0
UART-BASE $0400 + CONSTANT UART1
UART-BASE $0800 + CONSTANT UART2
UART-BASE $0C00 + CONSTANT UART3

UART2 CONSTANT UART
: >DLL 0 + ;            : >DLH 4 + ;
: >THR 0 + ;            : >LCR $0C + ;
: >FCR 8 + ;
\ : >LSR 14 + ;        : >HALT $0A4 + ;
\ %0000,0100,0000,0100 UART_BGR_REG BIS  \ alternative only UART2.
\ 9.2.4.1
\ 24 Mhz default, leave it alone.
\ clock setting, break, don't care, parity, stop bit, bitlength
%1,0,00,0,0,00 UART >LCR BIS
\ The divider for a midi signal is 48 (24Mhz/48*16 ~ 32 uS)
48  UART >DLL L!  0 UART >DLH L!
%1,0,00,0,0,00 UART >LCR BIC

\ clock set, break, parity aux, parity, stop bit, bitlength
      %0,0,00,0,0,11 UART >LCR L!
      1 UART >FCR BIS    \ Enable fifo.
\ --------- API ------------
\ Start a break for indefinite time.
: break %0,1,00,0,0,00 UART >LCR BIS ;
\ Transmit a  byte  .
: TRANSMIT-U  UART >THR L! ;

\ --------- Tests and checks. ------------
: test   BEGIN $0AA TRANSMIT-U KEY? UNTIL ;
: test2 0 DO $0AA TRANSMIT-U 1 MS LOOP ;
: rdump  BEGIN DUP H. SPACE DUP L@ H. CR 4 + KEY &Q = UNTIL ;

\ Toggle break fast  n  times.
: breaky >R %0,1,00,0,0,00 UART >LCR
    R> 0 DO 2DUP BIS 2DUP BIC LOOP
    2DROP ;
--------------------------------------------------------------
[If I make an UART and object, it becomes infinitely more
elegant.

\ Usage : you have to look up port PB0
$20 CONSTANT PB0     7 PB0 set-function   \ PB0 coupled to UART2
2 NEW-UART midi-port   31,125 baudrate  fifo-on
]

>
>--
>                              Waldek Hebisch
-- 
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.

Back to comp.lang.forth | Previous | NextPrevious in thread | Find similar


Thread

1 euro Olimex RISC-V mini-PC: this needs Forth ;) Paul Rubin <no.email@nospam.invalid> - 2024-09-24 11:22 -0700
  Re: 1 euro Olimex RISC-V mini-PC: this needs Forth ;) dxf <dxforth@gmail.com> - 2024-09-25 11:03 +1000
    Re: 1 euro Olimex RISC-V mini-PC: this needs Forth ;) Paul Rubin <no.email@nospam.invalid> - 2024-09-24 20:37 -0700
      Re: 1 euro Olimex RISC-V mini-PC: this needs Forth ;) dxf <dxforth@gmail.com> - 2024-09-25 14:11 +1000
        Re: 1 euro Olimex RISC-V mini-PC: this needs Forth ;) Paul Rubin <no.email@nospam.invalid> - 2024-09-24 22:00 -0700
          Re: 1 euro Olimex RISC-V mini-PC: this needs Forth ;) antispam@fricas.org (Waldek Hebisch) - 2024-09-29 03:36 +0000
          Re: 1 euro Olimex RISC-V mini-PC: this needs Forth ;) zbigniew2011@gmail.com (LIT) - 2024-09-29 13:30 +0000
            Re: 1 euro Olimex RISC-V mini-PC: this needs Forth ;) dxf <dxforth@gmail.com> - 2024-09-30 00:26 +1000
              Re: 1 euro Olimex RISC-V mini-PC: this needs Forth ;) zbigniew2011@gmail.com (LIT) - 2024-09-29 14:51 +0000
                Re: 1 euro Olimex RISC-V mini-PC: this needs Forth ;) dxf <dxforth@gmail.com> - 2024-09-30 13:57 +1000
                Re: 1 euro Olimex RISC-V mini-PC: this needs Forth ;) zbigniew2011@gmail.com (LIT) - 2024-09-30 07:54 +0000
                Re: 1 euro Olimex RISC-V mini-PC: this needs Forth ;) dxf <dxforth@gmail.com> - 2024-09-30 19:08 +1000
    Re: 1 euro Olimex RISC-V mini-PC: this needs Forth ;) zbigniew2011@gmail.com (LIT) - 2024-09-28 17:06 +0000
  Re: 1 euro Olimex RISC-V mini-PC: this needs Forth ;) David De La Harpe Golden <david@harpegolden.net> - 2024-09-25 16:20 +0100
  Re: 1 euro Olimex RISC-V mini-PC: this needs Forth ;) antispam@fricas.org (Waldek Hebisch) - 2024-09-29 03:20 +0000
  Re: 1 euro Olimex RISC-V mini-PC: this needs Forth ;) zbigniew2011@gmail.com (LIT) - 2024-09-29 21:46 +0000
    Re: 1 euro Olimex RISC-V mini-PC: this needs Forth ;) Paul Rubin <no.email@nospam.invalid> - 2024-09-29 15:23 -0700
      Re: 1 euro Olimex RISC-V mini-PC: this needs Forth ;) zbigniew2011@gmail.com (LIT) - 2024-09-29 22:31 +0000
        Re: 1 euro Olimex RISC-V mini-PC: this needs Forth ;) Paul Rubin <no.email@nospam.invalid> - 2024-09-29 15:59 -0700
          Re: 1 euro Olimex RISC-V mini-PC: this needs Forth ;) antispam@fricas.org (Waldek Hebisch) - 2024-10-17 15:28 +0000
            Re: 1 euro Olimex RISC-V mini-PC: this needs Forth ;) zbigniew2011@gmail.com (LIT) - 2024-10-17 20:42 +0000
              Re: 1 euro Olimex RISC-V mini-PC: this needs Forth ;) antispam@fricas.org (Waldek Hebisch) - 2024-10-18 02:21 +0000
                Re: 1 euro Olimex RISC-V mini-PC: this needs Forth ;) albert@spenarnc.xs4all.nl - 2024-10-18 11:36 +0200
                Re: 1 euro Olimex RISC-V mini-PC: this needs Forth ;) antispam@fricas.org (Waldek Hebisch) - 2024-10-18 14:14 +0000
                Re: 1 euro Olimex RISC-V mini-PC: this needs Forth ;) albert@spenarnc.xs4all.nl - 2024-10-19 13:20 +0200
                Re: 1 euro Olimex RISC-V mini-PC: this needs Forth ;) antispam@fricas.org (Waldek Hebisch) - 2024-10-21 10:24 +0000
                Re: 1 euro Olimex RISC-V mini-PC: this needs Forth ;) albert@spenarnc.xs4all.nl - 2024-10-21 13:26 +0200
                Re: 1 euro Olimex RISC-V mini-PC: this needs Forth ;) antispam@fricas.org (Waldek Hebisch) - 2024-10-21 15:39 +0000
                Re: 1 euro Olimex RISC-V mini-PC: this needs Forth ;) albert@spenarnc.xs4all.nl - 2024-10-21 21:03 +0200
                Re: 1 euro Olimex RISC-V mini-PC: this needs Forth ;) antispam@fricas.org (Waldek Hebisch) - 2024-10-23 02:32 +0000
                Re: 1 euro Olimex RISC-V mini-PC: this needs Forth ;) albert@spenarnc.xs4all.nl - 2024-10-23 13:17 +0200
                Re: 1 euro Olimex RISC-V mini-PC: this needs Forth ;) antispam@fricas.org (Waldek Hebisch) - 2024-10-26 01:31 +0000
                Re: 1 euro Olimex RISC-V mini-PC: this needs Forth ;) albert@spenarnc.xs4all.nl - 2024-10-26 10:22 +0200
                Re: 1 euro Olimex RISC-V mini-PC: this needs Forth ;) antispam@fricas.org (Waldek Hebisch) - 2024-10-26 19:23 +0000
                Re: 1 euro Olimex RISC-V mini-PC: this needs Forth ;) albert@spenarnc.xs4all.nl - 2024-10-27 10:52 +0100
                Re: 1 euro Olimex RISC-V mini-PC: this needs Forth ;) albert@spenarnc.xs4all.nl - 2024-10-26 10:48 +0200
                Re: 1 euro Olimex RISC-V mini-PC: this needs Forth ;) antispam@fricas.org (Waldek Hebisch) - 2024-10-26 21:01 +0000
                Re: 1 euro Olimex RISC-V mini-PC: this needs Forth ;) albert@spenarnc.xs4all.nl - 2024-10-27 11:12 +0100

csiph-web