(no commit message)
authorlkcl <lkcl@web>
Tue, 10 May 2022 16:10:33 +0000 (17:10 +0100)
committerIkiWiki <ikiwiki.info>
Tue, 10 May 2022 16:10:33 +0000 (17:10 +0100)
docs/pinmux.mdwn

index 0a6b4197163f5b854eba99773d9635d099989f13..eabac69f4d11317972be9f53b79d8594094894b8 100644 (file)
@@ -7,6 +7,7 @@ Links:
 * <https://ftp.libre-soc.org/Pin_Control_Subsystem_Overview.pdf>
 * <https://bugs.libre-soc.org/show_bug.cgi?id=50>
 * <https://bugs.libre-soc.org/show_bug.cgi?id=750>
+* <https://bugs.libre-soc.org/show_bug.cgi?id=762>
 * <https://git.libre-soc.org/?p=c4m-jtag.git;a=tree;hb=HEAD>
 * Extra info: [[/docs/pinmux/temp_pinmux_info]]
 
@@ -500,6 +501,31 @@ The 32-bit on the other hand has four address rows, and so will take four write
 * 0x02 - Configure GPIOs  8-11 - requires 4-bit `sel` one bit per GPIO
 * 0x03 - Configure GPIOs 12-15 - requires 4-bit `sel` one bit per GPIO
 
+Here is the pseudocode for reading the GPIO
+data structs:
+
+    read_bytes = []
+    for i in range(len(sel)):
+        GPIO_num = adr*len(sel)+i
+        if sel[i]:
+            read_bytes.append(GPIO[GPIO_num])
+        else:
+            read_bytes.append(Const(0, 8))
+    if not wen:
+        dat_r.eq(Cat(read_bytes))
+
+and for writing, slightly different style:
+
+    if wen:
+        write_bytes = []
+        for i in range(len(sel)):
+            GPIO_num = adr*len(sel)+i
+            write_byte = dat_w.bit_select(i*8, 8)
+            if sel[i]:
+                GPIO[GPIO_num].eq(write_byte)
+
+As explained in this video
+
 ## Combining JTAG BS Chain and Pinmux (In Progress)
 [[!img io_mux_bank_planning.JPG size="600x"]]