Comments (4)
for the GPFSEL1 register, bits 12-14 control gpio 14 and bits 15-17 control gpio 15. (7 << 12) is putting 111 in the bits 12-14 and &= ~ is clearing them, essentially. 2 << 12 is setting bits 12-14 as 010. Same goes for the 15-17 bits.
from raspberry-pi-os.
@rockytriton Thx for your answer. It's more clear for me. I've a last question how we choose 010 and 111 ?
According to
010 it's use to choose the 5th alternative function and 111 it's to choose the 3rd alternative function but according to
the 15th GPIO 3rd alternative function isn't RXD1. So I'm a little but confused.
for the GPFSEL1 register, bits 12-14 control gpio 14 and bits 15-17 control gpio 15. (7 << 12) is putting 111 in the bits 12-14 and &= ~ is clearing them, essentially. 2 << 12 is setting bits 12-14 as 010. Same goes for the 15-17 bits.
from raspberry-pi-os.
15th GPIO alt 5 = RXD1. From the table at the top 010 sets alt 5. The 111 is just to mask all 3 bits so we can clear them first before setting the values.
selector &= ~(7<<15);
That creates a mask with 15 to 17 bits set to 111, then ~ inverts the bits so all bits are set except for 15 to 17, then selector &= that to ensure that bits 15 to 17 are cleared (set to 0) but the remaining bits on selector are left as-is. Now that we clear those 3 bits, we can set the value to 010 by ORing it with this line:
selector |= 2<<15;
from raspberry-pi-os.
@rockytriton Okay thank you very much for your explanations :)
15th GPIO alt 5 = RXD1. From the table at the top 010 sets alt 5. The 111 is just to mask all 3 bits so we can clear them first before setting the values.
selector &= ~(7<<15);
That creates a mask with 15 to 17 bits set to 111, then ~ inverts the bits so all bits are set except for 15 to 17, then selector &= that to ensure that bits 15 to 17 are cleared (set to 0) but the remaining bits on selector are left as-is. Now that we clear those 3 bits, we can set the value to 010 by ORing it with this line:
selector |= 2<<15;
from raspberry-pi-os.
Related Issues (20)
- [Lesson 1.4] Typo in `raspberry-pi-os/docs/lesson01/linux/kernel-startup.md` "childern" > "children" HOT 1
- Can i debug the raspberry pi os on the qemu and gdb? if it does, please tell me how to use it, thanks! HOT 2
- Has anyone gotten the MMU code to work on raspberry pi 4?
- Okay
- I connected waveshare screen to raspberry pi zero w and thereโs no option to rotate screen to right or left. What to do?
- [lesson5] after sys_write syscall exe, el0_sync happen
- why not used c in utils.S HOT 1
- Exercice 1.1
- [exercises lesson06] after switch to user_process , it cannot response svc call HOT 1
- [Lesson04] Raspberry Pi 4 interrupts not working after first call to timer_tick() HOT 1
- How to find FUARTCLK in BCM2837 document HOT 1
- Filesyitem and drivers
- Possible missing of GPPUD control signal removal HOT 1
- Printf Long Support - issue in uli2a
- how does memzero works?
- PMU is periodically disabled HOT 1
- [Lesson 5] Erroneous extra save of registers in el0_sync.
- Usb flash issue
- O
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from raspberry-pi-os.