RetroBSD

2.11BSD operating system for microcontrollers
It is currently Tue Oct 15, 2019 11:20 am

All times are UTC




Post new topic Reply to topic  [ 1 post ] 
Author Message
PostPosted: Sat Apr 04, 2015 4:52 am 
Committer
User avatar

Joined: Wed Oct 10, 2012 11:01 pm
Posts: 1081
Location: Sunnyvale, CA
A new driver for general purpose i/o ports has been implemented for LiteBSD. You can find a description on wiki page: https://github.com/sergev/LiteBSD/wiki/ ... -IO-Driver

The driver has mostly the same features as in RetroBSD, with a few minor differences. The first version was developed by Jaume, and later I extended it to a full scale driver. Link to the sources: https://github.com/sergev/LiteBSD/blob/ ... dev/gpio.c

The driver has been tested on chipKIT WiFire board. Boot messages:
Code:
Copyright (c) 1982, 1986, 1989, 1991, 1993
   The Regents of the University of California.  All rights reserved.

4.4BSD-Lite build 3 compiled 2015-04-03
    sergev@ubuntu-sergev:LiteBSD/sys/compile/WIFIRE.pic32
cpu: PIC32MZ2048ECG100 rev A4, 200 MHz
...
gpio0 at portA, pins -i---ii-iiiiiiii
gpio1 at portB, pins i---i-iiiiiiiiii
gpio2 at portC, pins iiii---------i--
gpio3 at portD, pins --ii------iiii-i
gpio4 at portE, pins ------iiiiiiiiii
gpio5 at portF, pins --ii--------i---
gpio6 at portG, pins iiii--iii-------
...

Display a configuration and status of all pins:
Code:
# cat /dev/conf?
-i---ii-iiiiiiii
i---i-iiiiiiiiii
iiii---------i--
--ii------iiii-i
------iiiiiiiiii
--ii--------i---
oiii--iii-------
# cat /dev/port?
-1---10-11001101
0---0-0000000000
1000---------0--
--11------1011-1
------0000001111
--00--------0---
0111--000-------

Buttons 1 and 2 are connected to pins RA5 and RA4. Testing them:
Code:
# cat /dev/porta
-1---10-11001101        -- no buttons pressed
# cat /dev/porta
-1---10-11011101        -- button 2 pressed
# cat /dev/porta
-1---10-11101101        -- button 1 pressed

Signals RD4 and RB11 are connected to LED2 and LED3 - let's configure them as outputs.
Code:
# portio -o d4 b11

Now run a loop toggling LED2 and LED3:
Code:
# while sleep 1; do portio -r d4 b11; done

There is still no support for LOL interface - to be added later.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
cron




Powered by phpBB® Forum Software © phpBB Group

BSD Daemon used with permission