mirror of
https://github.com/apache/nuttx.git
synced 2025-12-12 05:34:38 +08:00
Compare commits
133 Commits
nuttx-3.9
...
nuttx-3.13
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7730a9d058 | ||
|
|
029d82031f | ||
|
|
6dad5e248b | ||
|
|
ad1e5e145b | ||
|
|
462becfbbb | ||
|
|
84a75fdeab | ||
|
|
80ccfdfd5e | ||
|
|
af1a31d5c6 | ||
|
|
d27e2d61b2 | ||
|
|
895bff0617 | ||
|
|
67814a8f49 | ||
|
|
ccad2235f2 | ||
|
|
5ef8388030 | ||
|
|
de9e12ea7c | ||
|
|
be959127fb | ||
|
|
6c555c56e0 | ||
|
|
1b43a324d7 | ||
|
|
693b648288 | ||
|
|
b0bbd8c7c2 | ||
|
|
4b57c3bad4 | ||
|
|
3f2dfbb298 | ||
|
|
c7419e57d3 | ||
|
|
3afb380432 | ||
|
|
e716896a18 | ||
|
|
709263b6d8 | ||
|
|
7ccda13225 | ||
|
|
2d4f0c6f53 | ||
|
|
0aac853ed5 | ||
|
|
2fd13e9de7 | ||
|
|
07c715e09c | ||
|
|
cab9dbe225 | ||
|
|
ffaed10379 | ||
|
|
3d991a3d9f | ||
|
|
7615eabcf9 | ||
|
|
6adab3df7c | ||
|
|
0ef52f153e | ||
|
|
2878532acb | ||
|
|
161898863a | ||
|
|
266c90f8b1 | ||
|
|
62d29ea215 | ||
|
|
d72dd985c1 | ||
|
|
7c18bfddad | ||
|
|
e62ecda064 | ||
|
|
57cb16a605 | ||
|
|
f9f5454c2b | ||
|
|
4b40c96323 | ||
|
|
2b2b7f7f0b | ||
|
|
bf2786f7d7 | ||
|
|
03c3094d99 | ||
|
|
ffbd312fe1 | ||
|
|
75ec13c73e | ||
|
|
2cee73f956 | ||
|
|
03f04075c9 | ||
|
|
5e49d8063a | ||
|
|
e2dd36627a | ||
|
|
871a684fc6 | ||
|
|
dd7f63b94a | ||
|
|
c6ad3e0d22 | ||
|
|
a88a6ecb67 | ||
|
|
8a30c6b64a | ||
|
|
9e1d3f8984 | ||
|
|
7089a04067 | ||
|
|
360cc0a648 | ||
|
|
0e44d93cd7 | ||
|
|
08d439fefb | ||
|
|
a5916b8df8 | ||
|
|
5972a086d2 | ||
|
|
ab815f91f9 | ||
|
|
2d52cdfac7 | ||
|
|
6b1891dc83 | ||
|
|
faf168d93c | ||
|
|
378b050ffa | ||
|
|
1c9cadf1c3 | ||
|
|
3043b0d5a1 | ||
|
|
4c89703789 | ||
|
|
3aaad0504c | ||
|
|
7a555278f0 | ||
|
|
33e6d3e45d | ||
|
|
e2f289a52c | ||
|
|
4bd085848c | ||
|
|
28db0e083a | ||
|
|
759ba256e8 | ||
|
|
b918dac0c3 | ||
|
|
048d0bd45e | ||
|
|
2296bfca96 | ||
|
|
6b0ef9f1cc | ||
|
|
106f18b460 | ||
|
|
0b22d6a034 | ||
|
|
d05f4750cb | ||
|
|
de003eb9d6 | ||
|
|
c6839b479b | ||
|
|
1f1e6f30a3 | ||
|
|
e14188b4a1 | ||
|
|
9ccfde456f | ||
|
|
d9112fa8b1 | ||
|
|
46c160af8b | ||
|
|
714c61c361 | ||
|
|
15926d2f9e | ||
|
|
e8339c2aba | ||
|
|
a9b64a7469 | ||
|
|
b5d6002463 | ||
|
|
397ac05b87 | ||
|
|
7b52111997 | ||
|
|
bdf74c42f2 | ||
|
|
be2a62af5a | ||
|
|
ae5cc87281 | ||
|
|
9a18c880a1 | ||
|
|
62d058a834 | ||
|
|
b08da21f90 | ||
|
|
7bbfd7880d | ||
|
|
07475ddcaf | ||
|
|
4daf380c0c | ||
|
|
52ca776537 | ||
|
|
c93316bf89 | ||
|
|
ab876969dd | ||
|
|
536a458525 | ||
|
|
7caf0ae3b6 | ||
|
|
0125c5989f | ||
|
|
ec531944df | ||
|
|
5b5b6af723 | ||
|
|
cc67653244 | ||
|
|
8b84d88550 | ||
|
|
7984beaa4b | ||
|
|
976ff7a822 | ||
|
|
6cf70e0e2a | ||
|
|
71105edc9f | ||
|
|
7b5c4e515b | ||
|
|
8d31154e34 | ||
|
|
bb2a525bac | ||
|
|
990820d579 | ||
|
|
12dea795b3 | ||
|
|
460aa35bb4 | ||
|
|
b1234a6bda |
44
COPYING
Executable file
44
COPYING
Executable file
@@ -0,0 +1,44 @@
|
||||
/*************************************************************************
|
||||
* *
|
||||
* COPYING -- Describes the terms under which Nuttx is distributed. A *
|
||||
* copy of the BSD-style licensing is included in this file. In my *
|
||||
* words -- I believe that you should free to use NuttX in any *
|
||||
* environmnet, private, private, commercial, open, closed, etc. *
|
||||
* provided only that you repect the modest copyright notices as *
|
||||
* described in license (below). Please feel free to contact me if you *
|
||||
* have any licensing concerns. *
|
||||
* *
|
||||
*************************************************************************
|
||||
* *
|
||||
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved. *
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr> *
|
||||
* *
|
||||
* Redistribution and use in source and binary forms, with or without *
|
||||
* modification, are permitted provided that the following conditions *
|
||||
* are met: *
|
||||
* *
|
||||
* 1. Redistributions of source code must retain the above copyright *
|
||||
* notice, this list of conditions and the following disclaimer. *
|
||||
* 2. Redistributions in binary form must reproduce the above copyright *
|
||||
* notice, this list of conditions and the following disclaimer in *
|
||||
* the documentation and/or other materials provided with the *
|
||||
* distribution. *
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be *
|
||||
* used to endorse or promote products derived from this software *
|
||||
* without specific prior written permission. *
|
||||
* *
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT *
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS *
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE *
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, *
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, *
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS *
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED *
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT *
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN *
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE *
|
||||
* POSSIBILITY OF SUCH DAMAGE. *
|
||||
* *
|
||||
*************************************************************************/
|
||||
|
||||
87
ChangeLog
87
ChangeLog
@@ -347,6 +347,91 @@
|
||||
Ubuntu where /bin/sh is a link to dash.
|
||||
* Z8Encore! port verified on ZDS-II instruction set/chip simulator.
|
||||
|
||||
0.3.10 2008-xx-xx Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
0.3.10 2008-05-15 Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
|
||||
* Add support for the ZiLOG EZ80Acclaim microcontrooler (EZ80F91 chip).
|
||||
* Add configuration for the ZiLOG z8f64200100kit development kit, Z8F6423 part.
|
||||
* Add configuration for the ZiLOG ez80f0910200kitg development kit, EZ80F091 part.
|
||||
* Correct critical list handling errors in task shutdown logic: One in timer
|
||||
deletion logic (timer_delete.c) and one in stream logic (lib_init.c) reported
|
||||
by kwonsk.
|
||||
|
||||
0.3.11 2008-06-01 Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
|
||||
* Add support for recursive mutexes.
|
||||
* Eliminate a memory leak -- contained watchdog instance was not being
|
||||
deleted with a POSIX timer was deleted reported by kwonsk.
|
||||
* Eliminate a deadlock condition in opendir() reported by kwonsk.
|
||||
* Fix several FAT filesystem problems reported by kwonsk (Changes not yet
|
||||
verified).
|
||||
* Host simulator no longer uses Linux system calls directly; Now works with Cygwin.
|
||||
* Fix an error that occurs when a POSIX timer is deleted by the timer signal handler.
|
||||
* Add logic to allow the examples/ostest to be run repetitively as an endurance test.
|
||||
* Add a ramdisk block driver
|
||||
|
||||
0.3.12 2008-08-10 Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
|
||||
* Improved solution to POSIX timer lifetime controls bug fixed in 0.3.11.
|
||||
* Add test for recursive mutexes
|
||||
* Correct bug in recursive mutex logic
|
||||
* Add mkfifo()
|
||||
* Add pipe() and test for both pipes and fifos
|
||||
* Attempts to open a FIFO will now block until there is at least one writer
|
||||
* Add test/Fixed errors in FIFO reader/writer interlocks
|
||||
* Removed limitation: task_create() was only dup'ing 3 file descriptors (now
|
||||
dups all open file descriptors).
|
||||
* Added a test for redirection of stdio through pipes
|
||||
* Fixed error in dup and dup2: Must call open/close methods in fs/driver so that
|
||||
driver can correctly maintain open reference counts.
|
||||
* Same issue on closing file descriptors in exit()
|
||||
* Fixed in error in stdio flush logic. Needed ssize_t vs size_t for error
|
||||
check.
|
||||
* Moved all FAT related files from fs to fs/fat
|
||||
* Implemented mkfatfs(), a non-standard API to create a FAT filesystem on a
|
||||
block device (not yet tested).
|
||||
* Added a test for mkfatfs() on a RAM disk in examples/mount and verified
|
||||
basic mkfatfs functionality for FAT12.
|
||||
|
||||
0.3.13 2008-09-01 Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
|
||||
* NSH: Added mkfatfs, mkfifo, sleep, usleep and nice commands
|
||||
* Fixed problem with console input in Cygwin-based simulator; NSH now works
|
||||
with simulator.
|
||||
* NSH will now execute commands in background
|
||||
* sched_get_priority_max/min returned error on SCHED_RR
|
||||
* Removed duplicate getenv() implementation in /lib
|
||||
* Correct detection of End-of-File in fgets
|
||||
* NSH: Implemented sh and crude script handler
|
||||
* Fix prototype of read() and write(). Need to use ssize_t and size_t, not
|
||||
int and unsigned int.
|
||||
* NSH now supports redirection of command output
|
||||
* NSH can now use both telnet and serial front ends together
|
||||
* NSH: $variable can be used for any command value
|
||||
* Fixed an error in opendir() that could cause an assertion to fail
|
||||
inappropriately.
|
||||
* Correct an error in the FAT that caused files opened for writing with
|
||||
O_APPEND to fail. The file was not being properly positioned to the
|
||||
end of the file in that case.
|
||||
* NSH now supports last exit status $?
|
||||
* NSH now supports if-then[-else]-fi construct
|
||||
* NSH now supports comments beginning with '#'
|
||||
* NSH now supports commands to inspect and modify memory
|
||||
* NSH cat command now supports multiple files on command line
|
||||
* Add chdir() and getcwd()
|
||||
* Fix error in getopt() when called with argc==1
|
||||
* Fix error in stat() when used on the root directory
|
||||
* NSH: Add cd and pwd commands and current working directory to all NSH
|
||||
commands that refer to paths.
|
||||
* Fix errors and warnings introduced into Linux sim build because of recent
|
||||
Cygwin-based sim changes
|
||||
* NSH: Add mem command to display heap usage
|
||||
* Added telnet NSH configuration for Neuros OSD.
|
||||
* Basic integration of concurrent telnet/serial NSH functional on Neuros
|
||||
OSD.
|
||||
* Fixed a critical bug that effects the way that environment variables are
|
||||
shared amongst pthreads.
|
||||
* uIP port enhance to support multi-threaded, concurrent socket access. So,
|
||||
for example, one thread can be reading from a socket while another is
|
||||
writing to the socket.
|
||||
|
||||
0.3.14 2008-xx-xx Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<tr align="center" bgcolor="#e4e4e4">
|
||||
<td>
|
||||
<h1><big><font color="#3c34ec"><i>NuttX RTOS</i></font></big></h1>
|
||||
<p>Last Updated: March 9, 2008</p>
|
||||
<p>Last Updated: September 1, 2008</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
@@ -456,7 +456,7 @@
|
||||
</table>
|
||||
|
||||
<p>
|
||||
The 21st release of NuttX (nuttx-0.3.9) is available for download
|
||||
The 2tth release of NuttX (nuttx-0.3.13) is available for download
|
||||
from the <a href="http://sourceforge.net/project/showfiles.php?group_id=189573">SourceForge</a>
|
||||
website.
|
||||
The change log associated with the release is available <a href="#currentrelease">here</a>.
|
||||
@@ -464,13 +464,39 @@
|
||||
These unreleased changes are listed <a href="#pendingchanges">here</a>.
|
||||
</p>
|
||||
<p>
|
||||
nuttx-0.3.8 is a minor feature enhancement release.
|
||||
This release includes support for the ZiLOG Z8Encore! microcontroller.
|
||||
Also included is the initial framework for support for the Z80,
|
||||
<a href="http://www.tim-mann.org/xtrs.html">XTRS</a> platform.
|
||||
The nuttx-0.3.13 release includes some important bug fixes as well as a few new features.
|
||||
Bugs fixed include:
|
||||
<ul>
|
||||
<li>Fixed problems with Cygwin-based console input. NSH now works with the Cygwin simulator.</li>
|
||||
<li>sched_get_priority_max/min returned error on SCHED_RR.</li>
|
||||
<li>Corrected detection of End-of-File in fgets().</li>
|
||||
<li>Fixed an error in opendir() that could cause an assertion to fail inappropriately.</li>
|
||||
<li>Corrected an error in the FAT that caused files opened for writing with O_APPEND to fail.</li>
|
||||
<li>Fix error in getopt() when called with argc==1.</li>
|
||||
<li>Fix error in stat() when used on the root directory.</li>
|
||||
<li>Fixed a critical bug that effects the way that environment variables are shared amongst
|
||||
pthreads.</li>
|
||||
<li>uIP port now supports multi-threaded, concurrent socket access. So, for example, one
|
||||
thread can be reading from a socket while another is writing to the socket.</li>
|
||||
</ul>
|
||||
</p>
|
||||
<p>
|
||||
New features were also added:
|
||||
<ul>
|
||||
|
||||
<li>New OS APIs: chdir() and getcwd().</li>
|
||||
<li>The Nuttx shell (NSH) has been extended in many ways:
|
||||
<ul>
|
||||
<li>New commands: mkfatfs, mkfifo, sleep, usleep, nice, sh, cd, and pwd commands
|
||||
<li>New memory inspection commands and heap usage commands
|
||||
<li>New capabilities: Execution of commands in background, execution of simple scripts,
|
||||
redirection of command output, last command status ($?)
|
||||
<li>Now supports if-then[-else]-fi construct
|
||||
<li>and other features as noted in the ChangeLog.
|
||||
</ul></li>
|
||||
</ul>
|
||||
</p>
|
||||
<p>
|
||||
This released has been verified only on the ZiLOG ZDS-II Z8Encore! chip simulation.
|
||||
As usual, any feedback about bugs or suggestions for improvement would be greatly appreciated.
|
||||
</p>
|
||||
|
||||
@@ -605,6 +631,27 @@
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top"><img src="favicon.ico"></td>
|
||||
<td bgcolor="#5eaee1">
|
||||
<b>Zilog eZ80Acclaim!</b>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><br></td>
|
||||
<td>
|
||||
<p>
|
||||
<b>Zilog eZ80Acclaim! Microncontroller</b>.
|
||||
This port uses the ZiLOG ez80f0910200kitg development kit, eZ80F091 part
|
||||
and the Zilog ZDS-II Windows command line tools.
|
||||
The development environment is Cygwin under WinXP.
|
||||
</p>
|
||||
<p>
|
||||
<b>STATUS:</b>
|
||||
This is a work in progress. Verified ez80 support will be announced in a future NuttX release.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top"><img src="favicon.ico"></td>
|
||||
<td bgcolor="#5eaee1">
|
||||
@@ -616,13 +663,20 @@
|
||||
<td>
|
||||
<p>
|
||||
<b>Zilog Z8Encore! Microncontroller</b>.
|
||||
This port use the Zilog z8encore000zco development kit, Z8F6403 part, and the Zilog
|
||||
ZDS-II Windows command line tools.
|
||||
This port uses the either:
|
||||
</p>
|
||||
<ul>
|
||||
<li>Zilog z8encore000zco development kit, Z8F6403 part, or</li>
|
||||
<li>Zilog z8f64200100kit development kit, Z8F6423 part</li>
|
||||
</ul>
|
||||
<p>
|
||||
and the Zilog ZDS-II Windows command line tools.
|
||||
The development environment is Cygwin under WinXP.
|
||||
</p>
|
||||
<p>
|
||||
<b>STATUS:</b>
|
||||
This released has been verified only on the ZiLOG ZDS-II Z8Encore! chip simulation.
|
||||
This release has been verified only on the ZiLOG ZDS-II Z8Encore! chip simulation
|
||||
as of nuttx-0.3.9.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -941,18 +995,47 @@ Other memory:
|
||||
</table>
|
||||
|
||||
<pre><ul>
|
||||
nuttx-0.3.9 2008-03-09 Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
nuttx-0.3.13 2008-09-01 Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
|
||||
* Began adding support for the ZiLOG Z8Encore! microcontroller for the Z8Encore000ZCO
|
||||
development board and the Z8F6403 part.
|
||||
* Fix broken 'clean' target on z80sim configurations
|
||||
* Re-structure arch/z80 to provide support for all ZiLOG 8-bit microcontrollers (ez8
|
||||
in particular for now).
|
||||
* Add support for TRS80-Model 3 based on the xtrs emulation (http://www.tim-mann.org/xtrs.html)
|
||||
Per patch from Jacques Pelletier.
|
||||
* In all shell scripts, change #!/bin/sh to #!/bin/bash to resolve problems in
|
||||
Ubuntu where /bin/sh is a link to dash.
|
||||
* Z8Encore! port verified on ZDS-II instruction set/chip simulator.
|
||||
* NSH: Added mkfatfs, mkfifo, sleep, usleep and nice commands
|
||||
* Fixed problem with console input in Cygwin-based simulator; NSH now works
|
||||
with simulator.
|
||||
* NSH will now execute commands in background
|
||||
* sched_get_priority_max/min returned error on SCHED_RR
|
||||
* Removed duplicate getenv() implementation in /lib
|
||||
* Correct detection of End-of-File in fgets
|
||||
* NSH: Implemented sh and crude script handler
|
||||
* Fix prototype of read() and write(). Need to use ssize_t and size_t, not
|
||||
int and unsigned int.
|
||||
* NSH now supports redirection of command output
|
||||
* NSH can now use both telnet and serial front ends together
|
||||
* NSH: $variable can be used for any command value
|
||||
* Fixed an error in opendir() that could cause an assertion to fail
|
||||
inappropriately.
|
||||
* Correct an error in the FAT that caused files opened for writing with
|
||||
O_APPEND to fail. The file was not being properly positioned to the
|
||||
end of the file in that case.
|
||||
* NSH now supports last exit status $?
|
||||
* NSH now supports if-then[-else]-fi construct
|
||||
* NSH now supports comments beginning with '#'
|
||||
* NSH now supports commands to inspect and modify memory
|
||||
* NSH cat command now supports multiple files on command line
|
||||
* Add chdir() and getcwd()
|
||||
* Fix error in getopt() when called with argc==1
|
||||
* Fix error in stat() when used on the root directory
|
||||
* NSH: Add cd and pwd commands and current working directory to all NSH
|
||||
commands that refer to paths.
|
||||
* Fix errors and warnings introduced into Linux sim build because of recent
|
||||
Cygwin-based sim changes
|
||||
* NSH: Add mem command to display heap usage
|
||||
* Added telnet NSH configuration for Neuros OSD.
|
||||
* Basic integration of concurrent telnet/serial NSH functional on Neuros
|
||||
OSD.
|
||||
* Fixed a critical bug that effects the way that environment variables are
|
||||
shared amongst pthreads.
|
||||
* uIP port enhance to support multi-threaded, concurrent socket access. So,
|
||||
for example, one thread can be reading from a socket while another is
|
||||
writing to the socket.
|
||||
|
||||
pascal-0.1.2 2008-02-10 Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
|
||||
@@ -978,13 +1061,13 @@ buildroot-0.1.0 2007-03-09 <spudmonkey@racsa.co.cr>
|
||||
</table>
|
||||
|
||||
<pre><ul>
|
||||
nuttx-0.3.10 2008-xx-xx Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
nuttx-0.3.14 2008-xx-xx Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
|
||||
pascal-0.1.3 2008-xx-xx Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
|
||||
buildroot-0.1.1 2007-xx-xx <spudmonkey@racsa.co.cr>
|
||||
buildroot-0.1.1 2008-xx-xx <spudmonkey@racsa.co.cr>
|
||||
|
||||
* Support for m68k-elf and m68hc11 toolchain
|
||||
* Support for m68k-elf and m68hc11 toolchain
|
||||
</pre></ul>
|
||||
|
||||
<table width ="100%">
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
</b></big></h1>
|
||||
<p><small>by</small></p>
|
||||
<p>Gregory Nutt</p>
|
||||
<p><small>Last Update: February 15, 2008</small></p>
|
||||
<p><small>Last Update: September 1, 2008</small></p>
|
||||
</center>
|
||||
|
||||
<center><h1>Table of Contents</h1></center>
|
||||
@@ -431,7 +431,7 @@
|
||||
|
||||
<li><code>arch/z80</code>:
|
||||
This directory holds 8-bit ZiLOG architectures. At present, this includes the
|
||||
Zilog z80 and z8Encore! Microcontrollers.
|
||||
Zilog z80, ez80Acclaim! and z8Encore! Microcontrollers.
|
||||
<ul>
|
||||
<li><code>arch/z80/include</code> and <code>arch/z80/src/common</code>:
|
||||
Common logic.
|
||||
@@ -446,11 +446,18 @@
|
||||
(verified with version 2.6.0 and 2.7.0).
|
||||
</li>
|
||||
|
||||
<li><code>arch/z80/include/ez80</code> and <code>arch/z80/src/ez80</code>:
|
||||
The ez80Acclaim! port uses the ZiLOG ez80f0910200kitg development kit, eZ80F091 part,
|
||||
with the Zilog ZDS-II Windows command line tools.
|
||||
The development environment is Cygwin under WinXP.
|
||||
This is a work in progress. Verified ez80 support will be announced in a future NuttX release.
|
||||
</li>
|
||||
|
||||
<li><code>arch/z80/include/z8</code> and <code>arch/z80/src/z8</code>:
|
||||
The Z8Encore! port use the Zilog z8encore000zco
|
||||
development kit, Z8F6403 part, and the Zilog ZDS-II Windows command line
|
||||
The Z8Encore! port uses either the ZiLOG z8encore000zco development kit, Z8F6403 part,
|
||||
or the z8f64200100kit development kit, Z8F6423 part with the Zilog ZDS-II Windows command line
|
||||
tools. The development environment is Cygwin under WinXP.
|
||||
This port is in progress and will be released in a future NuttX release.
|
||||
The initial release, verified only on the ZDS-II ez8 simulator, was released in nuttx-0.3.9.
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
@@ -650,12 +657,24 @@
|
||||
The development environment is Cygwin under WinXP.
|
||||
</li>
|
||||
|
||||
<li><code>configs/ez80f0910200kitg</code>
|
||||
ez80Acclaim! Microcontroller. This port use the Zilog ez80f0910200kitg
|
||||
development kit, eZ80F091 part, and the Zilog ZDS-II Windows command line
|
||||
tools. The development environment is Cygwin under WinXP.
|
||||
</li>
|
||||
|
||||
<li><code>configs/z8encore000zco</code>
|
||||
z8Encore! Microcontroller. This port use the Zilog z8encore000zco
|
||||
development kit, Z8F6403 part, and the Zilog ZDS-II Windows command line
|
||||
tools. The development environment is Cygwin under WinXP.
|
||||
</li>
|
||||
|
||||
<li><code>configs/z8encore000zco</code>
|
||||
z8Encore! Microcontroller. This port use the Zilog z8f64200100kit
|
||||
development kit, Z8F6423 part, and the Zilog ZDS-II Windows command line
|
||||
tools. The development environment is Cygwin under WinXP.
|
||||
</li>
|
||||
|
||||
<li><code>configs/z80sim</code>:
|
||||
z80 Microcontroller. This port uses a Z80 instruction set simulator.
|
||||
That simulator can be found in the NuttX CVS
|
||||
@@ -1389,6 +1408,9 @@ The system can be re-made subsequently by just typing <code>make</code>.
|
||||
<code>CONFIG_DEV_CONSOLE</code>: Set if architecture-specific logic
|
||||
provides /dev/console. Enables stdout, stderr, stdin.
|
||||
</li>
|
||||
<li>
|
||||
<code>CONFIG_MUTEX_TYPES</code>: Set to enabled support for recursive and
|
||||
errorcheck mutexes. Enables <code>pthread_mutexattr_settype()</code>.
|
||||
</ul>
|
||||
|
||||
<p>
|
||||
@@ -1487,6 +1509,10 @@ The system can be re-made subsequently by just typing <code>make</code>.
|
||||
structures. The system manages a pool of preallocated
|
||||
watchdog structures to minimize dynamic allocations
|
||||
</li>
|
||||
<li>
|
||||
<code>CONFIG_DEV_PIPE_SIZE</code>: Size, in bytes, of the buffer to allocated
|
||||
for pipe and FIFO support (default is 1024).
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h2>Network Support</h2>
|
||||
@@ -1501,6 +1527,10 @@ The system can be re-made subsequently by just typing <code>make</code>.
|
||||
<li>
|
||||
<code>CONFIG_NSOCKET_DESCRIPTORS</code>: Maximum number of socket descriptors per task/thread.
|
||||
</li>
|
||||
<li>
|
||||
<code>CONFIG_NET_NACTIVESOCKETS</code>: Maximum number of concurrent socket operations (recv, send, etc.).
|
||||
Default: <code>CONFIG_NET_TCP_CONNS</code>+<code>CONFIG_NET_UDP_CONNS</code>.
|
||||
</li>
|
||||
<li>
|
||||
<code>CONFIG_NET_SOCKOPTS</code>: Enable or disable support for socket options.
|
||||
</li>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
88
ReleaseNotes
88
ReleaseNotes
@@ -441,3 +441,91 @@ This released has been verified only on the ZiLOG ZDS-II Z8Encore!
|
||||
chip simulation.
|
||||
|
||||
This tarball contains a complete CVS snapshot from March 9, 2008.
|
||||
|
||||
nuttx-0.3.10
|
||||
^^^^^^^^^^^^
|
||||
|
||||
This is the 22nd release of NuttX. This is an important bug fix release.
|
||||
This release incorporates fixes to correct critical list handling errors
|
||||
in task shutdown logic: One in timer deletion logic (timer_delete.c) and one
|
||||
in stream logic (lib_init.c). This release also includes support to ZiLOG EZ80Acclaim
|
||||
microcontrooler (EZ80F91 chip) and configurations fot the ZiLOG z8f64200100kit (Z8F6423)
|
||||
and ez80f0910200kitg (EZ80F091) development kit.
|
||||
|
||||
nuttx-0.3.11
|
||||
^^^^^^^^^^^^
|
||||
|
||||
This is the 23rd release of NuttX. This is another important bugfix release.
|
||||
This releases fixes several bugs:
|
||||
|
||||
* Two POSIX timer bugs: a memory leak as well a fatal sequencing error.
|
||||
* Several FAT filesystem errors.
|
||||
* A deadlock that can occur in opendir()
|
||||
|
||||
A few new features were also added:
|
||||
|
||||
* Support for recursive mutexes
|
||||
* Added a RAM disk block driver
|
||||
* The host simulator no longer uses direct Linux system calls and now also works on Cygwin.
|
||||
* The OS test was strengthen and now runs as an endurance test
|
||||
|
||||
These changes were verified only on the Host simulator under Cygwin. Please report
|
||||
any errors to me.
|
||||
|
||||
This tarball contains a complete CVS snapshot from June 1, 2008.
|
||||
|
||||
nuttx-0.3.12
|
||||
^^^^^^^^^^^^
|
||||
|
||||
This is the 24th release of NuttX. This release includes some minor bugfixes as well
|
||||
as a few new features. Bugs fixed include:
|
||||
|
||||
* Corrected an error in recursive mutex implementation.
|
||||
* task_create() was only dup'in the first three file descriptors.
|
||||
* Fixed driver open reference counting errors in dup(), dup2(), and exit().
|
||||
* Fixed error handling logic in fflush().
|
||||
|
||||
New features were also added:
|
||||
|
||||
* Pipes and pipe() API
|
||||
* FIFOs and mkfifo() API
|
||||
* mkfatfs() API can be used to format FAT file systems.
|
||||
|
||||
These changes were verified only on the Host simulator under Cygwin. Please report
|
||||
any errors to me.
|
||||
|
||||
This tarball contains a complete CVS snapshot from August 10, 2008.
|
||||
|
||||
nuttx-0.3.13
|
||||
^^^^^^^^^^^^
|
||||
|
||||
This is the 25th release of NuttX. This release includes some important bugfixes as well
|
||||
as a few new features. Bugs fixed include:
|
||||
|
||||
* Fixed problems with Cygwin-based console input. NSH now works with the Cygwin simulator.
|
||||
* sched_get_priority_max/min returned error on SCHED_RR
|
||||
* Corrected detection of End-of-File in fgets()
|
||||
* Fixed an error in opendir() that could cause an assertion to fail inappropriately.
|
||||
* Corrected an error in the FAT that caused files opened for writing with O_APPEND to fail.
|
||||
* Fix error in getopt() when called with argc==1
|
||||
* Fix error in stat() when used on the root directory
|
||||
* Fixed a critical bug that effects the way that environment variables are shared amongst
|
||||
pthreads.
|
||||
* uIP port now supports multi-threaded, concurrent socket access. So, for example, one
|
||||
thread can be reading from a socket while another is writing to the socket.
|
||||
|
||||
New features were also added:
|
||||
|
||||
* New OS APIs: chdir() and getcwd()
|
||||
* The Nuttx shell (NSH) has been extended in many ways.
|
||||
- New commands: mkfatfs, mkfifo, sleep, usleep, nice, sh, cd, and pwd commands
|
||||
- New memory inspection commands and heap usage commands
|
||||
- New capabilities: Execution of commands in background, execution of simple scripts,
|
||||
redirection of command output, last command status ($?)
|
||||
- Now supports if-then[-else]-fi construct
|
||||
- and other features as noted in the ChangeLog.
|
||||
|
||||
These changes were verified only on the Host simulator under Cygwin and under Linux and
|
||||
also on the Neuros OSD (ARM9). Please report any errors to me.
|
||||
|
||||
This tarball contains a complete CVS snapshot from September 1, 2008.
|
||||
|
||||
39
TODO
39
TODO
@@ -1,16 +1,16 @@
|
||||
NuttX TODO List (Last updated February 13, 2008)
|
||||
NuttX TODO List (Last updated July 31, 2008)
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
(6) Task/Scheduler (sched/)
|
||||
(7) Task/Scheduler (sched/)
|
||||
(1) Dynamic loader (N/A)
|
||||
(2) Memory Managment (mm/)
|
||||
(1) Signals (sched/, arch/)
|
||||
(1) pthreads (sched/)
|
||||
(1) C++ Support
|
||||
(11) Network (net/, netutils/)
|
||||
(10) Network (net/, netutils/)
|
||||
(2) USB (drivers/usbdev)
|
||||
(3) Libraries (lib/)
|
||||
(3) File system/Generic drivers (fs/, drivers/)
|
||||
(4) File system/Generic drivers (fs/, drivers/)
|
||||
(1) Pascal add-on (pcode/)
|
||||
(2) Documentation (Documentation/)
|
||||
(3) Build system
|
||||
@@ -56,6 +56,11 @@ o Task/Scheduler (sched/)
|
||||
Priority: Medium, required for standard compliance (but makes the
|
||||
code bigger)
|
||||
|
||||
Description: socket descriptors are not cloned as are file descriptors
|
||||
by task_create().
|
||||
Status: Open
|
||||
Priority: Medium-to-High
|
||||
|
||||
o Dynamic Loader
|
||||
^^^^^^^^^^^^^^
|
||||
|
||||
@@ -143,16 +148,6 @@ o Network (net/, netutils/)
|
||||
Priority: Medium, The feature is not important, but it is important
|
||||
for NuttX to resolve the architectural issues.
|
||||
|
||||
Description: uIP/Socket callback logic is not thread safe. This means that
|
||||
a socket cannot be used concurrently by two threads. Minimal
|
||||
fix: Add mutex to support exclusion for protection.
|
||||
Status: Open
|
||||
Priority: Low. The currently socket design cannot be use concurrently
|
||||
by threads with out a major redesign. The feature is not
|
||||
of great value since the use model for multi-thread sockets
|
||||
is not common. Adding mutex support would only mask the
|
||||
underlying issue.
|
||||
|
||||
Description: IPv6 support is incomplete
|
||||
Status: Open
|
||||
Priority: Medium
|
||||
@@ -213,15 +208,10 @@ o Libraries (lib/)
|
||||
Status: Open
|
||||
Priority: Medium
|
||||
|
||||
Description: There are two different copies of getenv(): One in
|
||||
sched/env_getenv.c and one in lib/lib_getenv(). Keep one.
|
||||
Status: Open
|
||||
Priority: Low
|
||||
|
||||
o File system / Generic drivers (fs/, drivers/)
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Description: Add chmod(), truncate().
|
||||
Description: Implement chmod(), truncate().
|
||||
Status: Open
|
||||
Priority: Low
|
||||
|
||||
@@ -233,6 +223,15 @@ o File system / Generic drivers (fs/, drivers/)
|
||||
Status: Open
|
||||
Priority: Medium
|
||||
|
||||
Description: There is no way to remove a FIFO or PIPE created in the
|
||||
psuedo filesystem. Once created, they persist indefinitely
|
||||
and cannot be unlinked. This is actually a more generic
|
||||
issue: unlink does not work for anything in the psuedo-
|
||||
filesystem.
|
||||
Status: Open, but partially resolved: pipe buffer is at least freed
|
||||
when there are not open references to the pipe/FIFO.
|
||||
Priority: Medium
|
||||
|
||||
o Pascal Add-On (pcode/)
|
||||
^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
|
||||
@@ -189,7 +189,7 @@ static void _up_assert(int errorcode) /* __attribute__ ((noreturn)) */
|
||||
|
||||
void up_assert(const ubyte *filename, int lineno)
|
||||
{
|
||||
#if CONFIG_TASK_NAME_SIZE > 0
|
||||
#if CONFIG_TASK_NAME_SIZE > 0 && defined(CONFIG_DEBUG)
|
||||
_TCB *rtcb = (_TCB*)g_readytorun.head;
|
||||
#endif
|
||||
|
||||
@@ -211,7 +211,7 @@ void up_assert(const ubyte *filename, int lineno)
|
||||
|
||||
void up_assert_code(const ubyte *filename, int lineno, int errorcode)
|
||||
{
|
||||
#if CONFIG_TASK_NAME_SIZE > 0
|
||||
#if CONFIG_TASK_NAME_SIZE > 0 && defined(CONFIG_DEBUG)
|
||||
_TCB *rtcb = (_TCB*)g_readytorun.head;
|
||||
#endif
|
||||
|
||||
|
||||
@@ -45,24 +45,27 @@ CSRCS = up_initialize.c up_idle.c up_interruptcontext.c \
|
||||
up_releasepending.c up_reprioritizertr.c \
|
||||
up_exit.c up_schedulesigaction.c up_allocateheap.c \
|
||||
up_devconsole.c
|
||||
HOSTSRCS = up_stdio.c
|
||||
ifeq ($(CONFIG_FS_FAT),y)
|
||||
CSRCS += up_blockdevice.c up_deviceimage.c
|
||||
endif
|
||||
ifeq ($(CONFIG_NET),y)
|
||||
CSRCS += up_uipdriver.c
|
||||
SPECSRCS += up_tapdev.c
|
||||
HOSTSRCS += up_tapdev.c
|
||||
endif
|
||||
|
||||
COBJS = $(CSRCS:.c=$(OBJEXT))
|
||||
SPECOBJS = $(SPECSRCS:.c=$(OBJEXT))
|
||||
|
||||
SRCS = $(ASRCS) $(CSRCS) $(SPECSRCS)
|
||||
OBJS = $(AOBJS) $(COBJS) $(SPECOBJS)
|
||||
NXOBJS = $(AOBJS) $(COBJS)
|
||||
HOSTOBJS = $(HOSTSRCS:.c=$(OBJEXT))
|
||||
|
||||
SRCS = $(ASRCS) $(CSRCS) $(HOSTSRCS)
|
||||
OBJS = $(AOBJS) $(COBJS) $(HOSTOBJS)
|
||||
|
||||
LDFLAGS = $(ARCHSCRIPT)
|
||||
STDLIBS = -lc
|
||||
STDLIBS = -lc
|
||||
ifeq ($(CONFIG_FS_FAT),y)
|
||||
STDLIBS += -lz
|
||||
STDLIBS += -lz
|
||||
endif
|
||||
|
||||
LINKOBJS = up_head$(OBJEXT)
|
||||
@@ -78,21 +81,43 @@ $(AOBJS): %$(OBJEXT): %.S
|
||||
$(COBJS) $(LINKOBJS): %$(OBJEXT): %.c
|
||||
$(call COMPILE, $<, $@)
|
||||
|
||||
$(SPECOBJS): %$(OBJEXT): %.c
|
||||
$(CC) -c $(HOSTCFLAGS) $< -o $@
|
||||
$(HOSTOBJS): %$(OBJEXT): %.c
|
||||
@echo "CC: $<"
|
||||
@$(CC) -c $(HOSTCFLAGS) $< -o $@
|
||||
|
||||
libarch$(LIBEXT): $(OBJS)
|
||||
@( for obj in $(OBJS) ; do \
|
||||
# The architecture-specific library
|
||||
libarch$(LIBEXT): $(NXOBJS)
|
||||
@( for obj in $(NXOBJS) ; do \
|
||||
$(call ARCHIVE, $@, $${obj}); \
|
||||
done ; )
|
||||
|
||||
nuttx$(EXEEXT): $(LINKOBJS)
|
||||
# A partially linked object containing only NuttX code (no interface to host OS)
|
||||
# Change the names of most symbols that conflict with libc symbols.
|
||||
|
||||
GNU:
|
||||
@mkdir ./GNU
|
||||
|
||||
GNU/Linux-names.dat: GNU nuttx-names.dat
|
||||
@cp nuttx-names.dat $@
|
||||
|
||||
Cygwin-names.dat: nuttx-names.dat
|
||||
@cat $^ | sed -e "s/^/_/g" >$@
|
||||
|
||||
nuttx.rel : libarch$(LIBEXT) $(HOSTOS)-names.dat $(LINKOBJS)
|
||||
@echo "LD: nuttx.rel"
|
||||
@$(LD) -r $(LDFLAGS) $(LDPATHES) -o $@ $(LINKOBJS) --start-group $(LDLIBS) --end-group $(EXTRA_LIBS)
|
||||
@$(OBJCOPY) --redefine-syms=$(HOSTOS)-names.dat $@
|
||||
|
||||
# Generate the final NuttX binary by linking the host-specific objects with the NuttX
|
||||
# specific objects (with munged names)
|
||||
|
||||
nuttx$(EXEEXT): nuttx.rel $(HOSTOBJS)
|
||||
@echo "LD: nuttx$(EXEEXT)"
|
||||
@$(CC) $(LDFLAGS) $(LDPATHES) -o $(TOPDIR)/$@ $(LINKOBJS) \
|
||||
-Wl,--start-group $(LDLIBS) -Wl,--end-group $(STDLIBS) $(EXTRA_LIBS)
|
||||
@$(CC) $(LDFLAGS) $(LDPATHES) -o $(TOPDIR)/$@ nuttx.rel $(HOSTOBJS) $(STDLIBS)
|
||||
@$(NM) $(TOPDIR)/$@ | \
|
||||
grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | \
|
||||
sort > $(TOPDIR)/System.map
|
||||
@rm -f nuttx.rel
|
||||
|
||||
.depend: Makefile $(SRCS)
|
||||
@$(MKDEP) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
|
||||
@@ -101,10 +126,12 @@ nuttx$(EXEEXT): $(LINKOBJS)
|
||||
depend: .depend
|
||||
|
||||
clean:
|
||||
@rm -f libarch$(LIBEXT) *~ .*.swp
|
||||
@rm -f nuttx.rel libarch$(LIBEXT) *~ .*.swp
|
||||
@rm -f nuttx.rel GNU/Linux-names.dat Cygwin-names.dat
|
||||
$(call CLEAN)
|
||||
|
||||
distclean: clean
|
||||
@rm -f Make.dep .depend
|
||||
@rm -rf GNU
|
||||
|
||||
-include Make.dep
|
||||
|
||||
34
arch/sim/src/nuttx-names.dat
Normal file
34
arch/sim/src/nuttx-names.dat
Normal file
@@ -0,0 +1,34 @@
|
||||
calloc NXcalloc
|
||||
close NXclose
|
||||
closedir NXclosedir
|
||||
dup NXdup
|
||||
free NXfree
|
||||
fclose NXfclose
|
||||
fopen NXfopen
|
||||
fputc NXfputc
|
||||
fread NXfread
|
||||
fwrite NXfwrite
|
||||
fsync NXfsync
|
||||
gettimeofday NXgettimeofday
|
||||
ioctl NXioctl
|
||||
lseek NXlseek
|
||||
malloc NXmalloc
|
||||
malloc_init NXmalloc_init
|
||||
mkdir NXmkdir
|
||||
mount NXmount
|
||||
open NXopen
|
||||
opendir NXopendir
|
||||
read NXread
|
||||
realloc NXrealloc
|
||||
rewinddir NXrewinddir
|
||||
rmdir NXrmdir
|
||||
seekdir NXseekdir
|
||||
select NXselect
|
||||
socket NXsocket
|
||||
stat NXstat
|
||||
statfs NXstatfs
|
||||
system NXsystem
|
||||
umount NXumount
|
||||
unlink NXunlink
|
||||
write NXwrite
|
||||
zmalloc NXzmalloc
|
||||
@@ -1,7 +1,7 @@
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* up_allocateheap.c
|
||||
*
|
||||
* Copyright (C) 2007 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -14,7 +14,7 @@
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name Gregory Nutt nor the names of its contributors may be
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
@@ -31,11 +31,11 @@
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <sys/types.h>
|
||||
@@ -45,25 +45,25 @@
|
||||
#include "os_internal.h"
|
||||
#include "up_internal.h"
|
||||
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* Private Definitions
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
static ubyte sim_heap[SIM_HEAP_SIZE];
|
||||
|
||||
/************************************************************
|
||||
* Private Funtions
|
||||
************************************************************/
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/************************************************************
|
||||
* Public Funtions
|
||||
************************************************************/
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* Name: up_allocate_heap
|
||||
*
|
||||
* Description:
|
||||
@@ -72,7 +72,7 @@ static ubyte sim_heap[SIM_HEAP_SIZE];
|
||||
* are not defined, then this function will be called to
|
||||
* dynamically set aside the heap region.
|
||||
*
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
void up_allocate_heap(void **heap_start, size_t *heap_size)
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* up_blockdevice.c
|
||||
*
|
||||
* Copyright (C) 2007 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -38,11 +38,13 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <string.h>
|
||||
#include <nuttx/fs.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <nuttx/ramdisk.h>
|
||||
|
||||
#include "up_internal.h"
|
||||
|
||||
/****************************************************************************
|
||||
@@ -60,128 +62,14 @@
|
||||
* Private Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
static int up_open(FAR struct inode *inode);
|
||||
static int up_close(FAR struct inode *inode);
|
||||
static ssize_t up_read(FAR struct inode *inode, unsigned char *buffer,
|
||||
size_t start_sector, unsigned int nsectors);
|
||||
static ssize_t up_write(FAR struct inode *inode, const unsigned char *buffer,
|
||||
size_t start_sector, unsigned int nsectors);
|
||||
static int up_geometry(FAR struct inode *inode, struct geometry *geometry);
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
static const struct block_operations g_bops =
|
||||
{
|
||||
.open = up_open,
|
||||
.close = up_close,
|
||||
.read = up_read,
|
||||
.write = up_write,
|
||||
.geometry = up_geometry,
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_open
|
||||
*
|
||||
* Description: Open the block device
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static int up_open(FAR struct inode *inode)
|
||||
{
|
||||
return OK;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_closel
|
||||
*
|
||||
* Description: close the block device
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static int up_close(FAR struct inode *inode)
|
||||
{
|
||||
return OK;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_read
|
||||
*
|
||||
* Description: Read the specified numer of sectors
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static ssize_t up_read(FAR struct inode *inode, unsigned char *buffer,
|
||||
size_t start_sector, unsigned int nsectors)
|
||||
{
|
||||
if (inode)
|
||||
{
|
||||
char *src = inode->i_private;
|
||||
if (src &&
|
||||
start_sector < NSECTORS &&
|
||||
start_sector + nsectors < NSECTORS)
|
||||
{
|
||||
memcpy(buffer,
|
||||
&src[start_sector*LOGICAL_SECTOR_SIZE],
|
||||
nsectors*LOGICAL_SECTOR_SIZE);
|
||||
return nsectors;
|
||||
}
|
||||
}
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_write
|
||||
*
|
||||
* Description: Write the specified number of sectors
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static ssize_t up_write(FAR struct inode *inode, const unsigned char *buffer,
|
||||
size_t start_sector, unsigned int nsectors)
|
||||
{
|
||||
if (inode)
|
||||
{
|
||||
char *dest = inode->i_private;
|
||||
if (dest &&
|
||||
start_sector < NSECTORS &&
|
||||
start_sector + nsectors < NSECTORS)
|
||||
{
|
||||
memcpy(&dest[start_sector*LOGICAL_SECTOR_SIZE],
|
||||
buffer,
|
||||
nsectors*LOGICAL_SECTOR_SIZE);
|
||||
return nsectors;
|
||||
}
|
||||
}
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_geometry
|
||||
*
|
||||
* Description: Return device geometry
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static int up_geometry(FAR struct inode *inode, struct geometry *geometry)
|
||||
{
|
||||
if (geometry)
|
||||
{
|
||||
geometry->geo_available = (inode->i_private != NULL);
|
||||
geometry->geo_mediachanged = FALSE;
|
||||
geometry->geo_writeenabled = TRUE;
|
||||
geometry->geo_nsectors = NSECTORS;
|
||||
geometry->geo_sectorsize = LOGICAL_SECTOR_SIZE;
|
||||
return OK;
|
||||
}
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
@@ -189,13 +77,11 @@ static int up_geometry(FAR struct inode *inode, struct geometry *geometry)
|
||||
/****************************************************************************
|
||||
* Name: up_registerblockdevice
|
||||
*
|
||||
* Description: Register the simulated block device
|
||||
|
||||
* Description: Register the FAT ramdisk
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void up_registerblockdevice(void)
|
||||
{
|
||||
/* Inode private data is a filesystem image */
|
||||
void *priv = (void*)up_deviceimage();
|
||||
(void)register_blockdriver("/dev/blkdev", &g_bops, 0, priv);
|
||||
rd_register(0, (ubyte*)up_deviceimage(), NSECTORS, LOGICAL_SECTOR_SIZE, TRUE);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* up_blocktask.c
|
||||
*
|
||||
* Copyright (C) 2007 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -14,7 +14,7 @@
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name Gregory Nutt nor the names of its contributors may be
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
@@ -31,11 +31,11 @@
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <sys/types.h>
|
||||
@@ -45,23 +45,23 @@
|
||||
#include "os_internal.h"
|
||||
#include "up_internal.h"
|
||||
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* Private Definitions
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/************************************************************
|
||||
* Private Funtions
|
||||
************************************************************/
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/************************************************************
|
||||
* Public Funtions
|
||||
************************************************************/
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* Name: up_block_task
|
||||
*
|
||||
* Description:
|
||||
@@ -79,7 +79,7 @@
|
||||
* task_state: Specifies which waiting task list should be
|
||||
* hold the blocked task TCB.
|
||||
*
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
void up_block_task(_TCB *tcb, tstate_t task_state)
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* up_createstack.c
|
||||
*
|
||||
* Copyright (C) 2007 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -14,7 +14,7 @@
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name Gregory Nutt nor the names of its contributors may be
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
@@ -31,11 +31,11 @@
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <sys/types.h>
|
||||
@@ -43,23 +43,23 @@
|
||||
#include <nuttx/kmalloc.h>
|
||||
#include "up_internal.h"
|
||||
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* Private Definitions
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/************************************************************
|
||||
* Private Funtions
|
||||
************************************************************/
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/************************************************************
|
||||
* Public Funtions
|
||||
************************************************************/
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* Name: up_create_stack
|
||||
*
|
||||
* Description:
|
||||
@@ -79,7 +79,7 @@
|
||||
* stack_size: The requested stack size. At least this much
|
||||
* must be allocated.
|
||||
*
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
STATUS up_create_stack(_TCB *tcb, size_t stack_size)
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* up_devconsole.c
|
||||
*
|
||||
* Copyright (C) 2007 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -14,7 +14,7 @@
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name Gregory Nutt nor the names of its contributors may be
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
@@ -31,43 +31,32 @@
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
#if !defined(linux) && !defined(__CYGWIN__)
|
||||
# error "Sorry, this will only work with Linux"
|
||||
#else
|
||||
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <nuttx/fs.h>
|
||||
|
||||
#include "up_internal.h"
|
||||
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* Definitions
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
#define READ 3
|
||||
#define WRITE 4
|
||||
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* Private Function Prototypes
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
static ssize_t devconsole_read(struct file *, char *, size_t);
|
||||
static ssize_t devconsole_write(struct file *, const char *, size_t);
|
||||
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
static struct file_operations devconsole_fops =
|
||||
{
|
||||
@@ -75,69 +64,26 @@ static struct file_operations devconsole_fops =
|
||||
.write = devconsole_write,
|
||||
};
|
||||
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
static inline int up_read(int fd, void* buf, size_t count)
|
||||
|
||||
static ssize_t devconsole_read(struct file *filp, char *buffer, size_t len)
|
||||
{
|
||||
uint32 result;
|
||||
|
||||
__asm__ volatile ("int $0x80" \
|
||||
: "=a" (result) \
|
||||
: "0" (READ), "b" ((uint32)(fd)), "c" ((uint32)(buf)), "d" ((uint32)(count)) \
|
||||
: "memory");
|
||||
|
||||
return (int)result;
|
||||
}
|
||||
|
||||
static inline int up_write(int fd, const void* buf, size_t count)
|
||||
{
|
||||
uint32 result;
|
||||
|
||||
__asm__ volatile ("int $0x80" \
|
||||
: "=a" (result) \
|
||||
: "0" (WRITE), "b" ((uint32)(fd)), "c" ((uint32)(buf)), "d" ((uint32)(count)) \
|
||||
: "memory");
|
||||
|
||||
return (int)result;
|
||||
}
|
||||
|
||||
static inline int up_check_result(int result)
|
||||
{
|
||||
if (result >= (uint32)(-(128 + 1)))
|
||||
{
|
||||
*get_errno_ptr() = -result;
|
||||
result = ERROR;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
static ssize_t devconsole_read(struct file *filp, char *buffer, size_t len)
|
||||
{
|
||||
return up_check_result(up_read(1, buffer, len));
|
||||
return up_hostread(buffer, len);
|
||||
}
|
||||
|
||||
static ssize_t devconsole_write(struct file *filp, const char *buffer, size_t len)
|
||||
{
|
||||
return up_check_result(up_write(1, buffer, len));
|
||||
return up_hostwrite(buffer, len);
|
||||
}
|
||||
|
||||
/************************************************************
|
||||
* Public Funtions
|
||||
************************************************************/
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
void up_devconsole(void)
|
||||
{
|
||||
(void)register_driver("/dev/console", &devconsole_fops, 0666, NULL);
|
||||
}
|
||||
|
||||
int up_putc(int ch)
|
||||
{
|
||||
char b = ch;
|
||||
(void)up_write(1, &b, 1);
|
||||
return ch;
|
||||
}
|
||||
|
||||
#endif /* linux */
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* up_head.c
|
||||
*
|
||||
* Copyright (C) 2007 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -14,7 +14,7 @@
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name Gregory Nutt nor the names of its contributors may be
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
@@ -31,11 +31,11 @@
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdio.h>
|
||||
@@ -45,15 +45,15 @@
|
||||
#include <nuttx/init.h>
|
||||
#include <nuttx/arch.h>
|
||||
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
static jmp_buf sim_abort;
|
||||
|
||||
/************************************************************
|
||||
* Global Funtions
|
||||
************************************************************/
|
||||
/****************************************************************************
|
||||
* Global Functions
|
||||
****************************************************************************/
|
||||
|
||||
int main(int argc, char **argv, char **envp)
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* up_idle.c
|
||||
*
|
||||
* Copyright (C) 2007 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -31,34 +31,34 @@
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <sys/types.h>
|
||||
#include <nuttx/arch.h>
|
||||
#include "up_internal.h"
|
||||
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* Private Definitions
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/************************************************************
|
||||
* Private Funtions
|
||||
************************************************************/
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/************************************************************
|
||||
* Public Funtions
|
||||
************************************************************/
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* Name: up_idle
|
||||
*
|
||||
* Description:
|
||||
@@ -71,7 +71,7 @@
|
||||
* this is where power management operations might be
|
||||
* performed.
|
||||
*
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
void up_idle(void)
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* up_initialize.c
|
||||
*
|
||||
* Copyright (C) 2007 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -14,7 +14,7 @@
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name Gregory Nutt nor the names of its contributors may be
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
@@ -31,35 +31,36 @@
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <sys/types.h>
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/fs.h>
|
||||
#include <debug.h>
|
||||
#include "up_internal.h"
|
||||
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* Private Definitions
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/************************************************************
|
||||
* Private Funtions
|
||||
************************************************************/
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/************************************************************
|
||||
* Public Funtions
|
||||
************************************************************/
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* Name: up_initialize
|
||||
*
|
||||
* Description:
|
||||
@@ -77,15 +78,24 @@
|
||||
* libraries have been initialized. OS services and driver
|
||||
* services are available.
|
||||
*
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
void up_initialize(void)
|
||||
{
|
||||
/* The real purpose of the following is to make sure that lib_rawprintf
|
||||
* is drawn into the link. It is needed by up_tapdev which is linked
|
||||
* separately.
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_NET
|
||||
lib_rawprintf("SIM: Initializing");
|
||||
#endif
|
||||
|
||||
/* Register devices */
|
||||
|
||||
devnull_register(); /* Standard /dev/null */
|
||||
up_devconsole(); /* Our private /dev/console */
|
||||
up_registerblockdevice(); /* Our simulated block device /dev/blkdev */
|
||||
up_registerblockdevice(); /* Our FAT ramdisk at /dev/ram0 */
|
||||
#if defined(CONFIG_NET) && defined(linux)
|
||||
uipdriver_init(); /* Our "real" netwok driver */
|
||||
#endif
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* up_initialstate.c
|
||||
*
|
||||
* Copyright (C) 2007 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -14,7 +14,7 @@
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name Gregory Nutt nor the names of its contributors may be
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
@@ -31,11 +31,11 @@
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <sys/types.h>
|
||||
@@ -43,23 +43,23 @@
|
||||
#include <nuttx/arch.h>
|
||||
#include "up_internal.h"
|
||||
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* Private Definitions
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/************************************************************
|
||||
* Private Funtions
|
||||
************************************************************/
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/************************************************************
|
||||
* Public Funtions
|
||||
************************************************************/
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* Name: up_initial_state
|
||||
*
|
||||
* Description:
|
||||
@@ -71,7 +71,7 @@
|
||||
* and/or stack so that execution will begin at tcb->start
|
||||
* on the next context switch.
|
||||
*
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
void up_initial_state(_TCB *tcb)
|
||||
{
|
||||
|
||||
@@ -107,6 +107,11 @@ extern void up_registerblockdevice(void);
|
||||
|
||||
extern char *up_deviceimage(void);
|
||||
|
||||
/* up_stdio.c *************************************************************/
|
||||
|
||||
extern size_t up_hostread(void *buffer, size_t len);
|
||||
extern size_t up_hostwrite(const void *buffer, size_t len);
|
||||
|
||||
/* up_tapdev.c ************************************************************/
|
||||
|
||||
#ifdef CONFIG_NET
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* up_interruptcontext.c
|
||||
*
|
||||
* Copyright (C) 2007 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -14,7 +14,7 @@
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name Gregory Nutt nor the names of its contributors may be
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
@@ -31,40 +31,40 @@
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <sys/types.h>
|
||||
#include <nuttx/arch.h>
|
||||
#include "up_internal.h"
|
||||
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* Private Definitions
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/************************************************************
|
||||
* Private Funtions
|
||||
************************************************************/
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/************************************************************
|
||||
* Public Funtions
|
||||
************************************************************/
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* Name: up_interrupt_context
|
||||
*
|
||||
* Description:
|
||||
* Return TRUE is we are currently executing in
|
||||
* the interrupt handler context.
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
boolean up_interrupt_context(void)
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* up_releasepending.c
|
||||
*
|
||||
* Copyright (C) 2007 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -14,7 +14,7 @@
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name Gregory Nutt nor the names of its contributors may be
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
@@ -31,11 +31,11 @@
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <sys/types.h>
|
||||
@@ -45,23 +45,23 @@
|
||||
#include "os_internal.h"
|
||||
#include "up_internal.h"
|
||||
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* Private Definitions
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/************************************************************
|
||||
* Private Funtions
|
||||
************************************************************/
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/************************************************************
|
||||
* Public Funtions
|
||||
************************************************************/
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* Name: up_release_pending
|
||||
*
|
||||
* Description:
|
||||
@@ -70,7 +70,7 @@
|
||||
* context switch if a new task is placed at the head of
|
||||
* the ready to run list.
|
||||
*
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
void up_release_pending(void)
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* up_releasestack.c
|
||||
*
|
||||
* Copyright (C) 2007 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -14,7 +14,7 @@
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name Gregory Nutt nor the names of its contributors may be
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
@@ -31,11 +31,11 @@
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <sys/types.h>
|
||||
@@ -43,30 +43,30 @@
|
||||
#include <nuttx/arch.h>
|
||||
#include "up_internal.h"
|
||||
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* Private Definitions
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/************************************************************
|
||||
* Private Funtions
|
||||
************************************************************/
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/************************************************************
|
||||
* Public Funtions
|
||||
************************************************************/
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* Name: up_release_stack
|
||||
*
|
||||
* Description:
|
||||
* A task has been stopped. Free all stack
|
||||
* related resources retained int the defunct TCB.
|
||||
*
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
void up_release_stack(_TCB *dtcb)
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* up_reprioritizertr.c
|
||||
*
|
||||
* Copyright (C) 2007 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -14,7 +14,7 @@
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name Gregory Nutt nor the names of its contributors may be
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
@@ -31,11 +31,11 @@
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <sys/types.h>
|
||||
@@ -45,23 +45,23 @@
|
||||
#include "os_internal.h"
|
||||
#include "up_internal.h"
|
||||
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* Private Definitions
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/************************************************************
|
||||
* Private Funtions
|
||||
************************************************************/
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/************************************************************
|
||||
* Public Funtions
|
||||
************************************************************/
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* Name: up_reprioritize_rtr
|
||||
*
|
||||
* Description:
|
||||
@@ -79,7 +79,7 @@
|
||||
* tcb: The TCB of the task that has been reprioritized
|
||||
* priority: The new task priority
|
||||
*
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
void up_reprioritize_rtr(_TCB *tcb, ubyte priority)
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* up_schedulesigaction.c
|
||||
*
|
||||
* Copyright (C) 2007 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -14,7 +14,7 @@
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name Gregory Nutt nor the names of its contributors may be
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
@@ -31,11 +31,11 @@
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <sys/types.h>
|
||||
@@ -45,23 +45,23 @@
|
||||
#include "os_internal.h"
|
||||
#include "up_internal.h"
|
||||
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* Private Definitions
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/************************************************************
|
||||
* Private Funtions
|
||||
************************************************************/
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/************************************************************
|
||||
* Public Funtions
|
||||
************************************************************/
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* Name: up_schedule_sigaction
|
||||
*
|
||||
* Description:
|
||||
@@ -92,7 +92,7 @@
|
||||
* currently executing task -- just call the signal
|
||||
* handler now.
|
||||
*
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
void up_schedule_sigaction(_TCB *tcb, sig_deliver_t sigdeliver)
|
||||
{
|
||||
|
||||
82
arch/sim/src/up_stdio.c
Normal file
82
arch/sim/src/up_stdio.c
Normal file
@@ -0,0 +1,82 @@
|
||||
/****************************************************************************
|
||||
* up_stdio.c
|
||||
*
|
||||
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
size_t up_hostread(void *buffer, size_t len)
|
||||
{
|
||||
/* Just map to the host fread() */
|
||||
|
||||
return fread(buffer, 1, len, stdin);
|
||||
}
|
||||
|
||||
size_t up_hostwrite(const void *buffer, size_t len)
|
||||
{
|
||||
/* Just map to the host fwrite() */
|
||||
|
||||
return fwrite(buffer, 1, len, stdout);
|
||||
}
|
||||
|
||||
int up_putc(int ch)
|
||||
{
|
||||
/* Just map to the host fputc routine */
|
||||
|
||||
return fputc(ch, stdout);
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/****************************************************************************
|
||||
* up_tapdev.c
|
||||
*
|
||||
* Copyright (C) 2007 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
*
|
||||
* Based on code from uIP which also has a BSD-like license:
|
||||
@@ -84,13 +84,6 @@ extern int lib_rawprintf(const char *format, ...);
|
||||
# define UIP_IPADDR3 0
|
||||
#endif
|
||||
|
||||
#define READ 3
|
||||
#define WRITE 4
|
||||
#define OPEN 5
|
||||
#define IOCTL 54
|
||||
#define SELECT 82
|
||||
#define SOCKETCALL 102
|
||||
|
||||
/****************************************************************************
|
||||
* Private Types
|
||||
****************************************************************************/
|
||||
@@ -123,93 +116,6 @@ static int gtapdevfd;
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/* This is REALLY awkward.. we need to compile using the system header files,
|
||||
* but we can't use any of the libc calls because all of the symbols are
|
||||
* defined for NuttX (read, write, etc)! So we do hand rolled syscalls
|
||||
* to get to the Linux functions.
|
||||
*/
|
||||
|
||||
static inline int up_open(const char *filename, int flags, int mode)
|
||||
{
|
||||
int result;
|
||||
|
||||
__asm__ volatile ("int $0x80" \
|
||||
: "=a" (result) \
|
||||
: "0" (OPEN), "b" ((int)(filename)), "c" ((int)(flags)), "d" ((int)(mode)) \
|
||||
: "memory");
|
||||
|
||||
return (int)result;
|
||||
}
|
||||
|
||||
static inline int up_socketcall(int call, unsigned long *args)
|
||||
{
|
||||
int result;
|
||||
|
||||
__asm__ volatile ("int $0x80" \
|
||||
: "=a" (result) \
|
||||
: "0" (SOCKETCALL), "b" (call), "c" ((int)args) \
|
||||
: "memory");
|
||||
|
||||
return (int)result;
|
||||
}
|
||||
|
||||
static inline int up_socket(int domain, int type, int protocol)
|
||||
{
|
||||
unsigned long args[3];
|
||||
args[0] = domain;
|
||||
args[1] = type;
|
||||
args[2] = protocol;
|
||||
return up_socketcall(SYS_SOCKET, args);
|
||||
}
|
||||
|
||||
static inline int up_read(int fd, void* buf, size_t count)
|
||||
{
|
||||
ssize_t result;
|
||||
|
||||
__asm__ volatile ("int $0x80" \
|
||||
: "=a" (result) \
|
||||
: "0" (READ), "b" ((int)(fd)), "c" ((int)(buf)), "d" ((int)(count)) \
|
||||
: "memory");
|
||||
|
||||
return (int)result;
|
||||
}
|
||||
|
||||
static inline int up_write(int fd, const void* buf, size_t count)
|
||||
{
|
||||
ssize_t result;
|
||||
|
||||
__asm__ volatile ("int $0x80" \
|
||||
: "=a" (result) \
|
||||
: "0" (WRITE), "b" ((int)(fd)), "c" ((int)(buf)), "d" ((int)(count)) \
|
||||
: "memory");
|
||||
|
||||
return (int)result;
|
||||
}
|
||||
|
||||
static inline int up_ioctl(int fd, unsigned int cmd, unsigned long arg)
|
||||
{
|
||||
ssize_t result;
|
||||
|
||||
__asm__ volatile ("int $0x80" \
|
||||
: "=a" (result) \
|
||||
: "0" (IOCTL), "b" ((int)(fd)), "c" ((int)(cmd)), "d" ((long)(arg)) \
|
||||
: "memory");
|
||||
|
||||
return (int)result;
|
||||
}
|
||||
|
||||
static inline int up_select(struct sel_arg_struct *arg)
|
||||
{
|
||||
ssize_t result;
|
||||
|
||||
__asm__ volatile ("int $0x80" \
|
||||
: "=a" (result) \
|
||||
: "0" (SELECT),"b" ((struct sel_arg_struct *)(arg))
|
||||
: "memory");
|
||||
|
||||
return (int)result;
|
||||
}
|
||||
|
||||
#ifdef TAPDEV_DEBUG
|
||||
static inline void dump_ethhdr(const char *msg, unsigned char *buf, int buflen)
|
||||
{
|
||||
@@ -246,7 +152,7 @@ void tapdev_init(void)
|
||||
|
||||
/* Open the tap device */
|
||||
|
||||
gtapdevfd = up_open(DEVTAP, O_RDWR, 0644);
|
||||
gtapdevfd = open(DEVTAP, O_RDWR, 0644);
|
||||
if (gtapdevfd < 0)
|
||||
{
|
||||
lib_rawprintf("TAPDEV: open failed: %d\n", -gtapdevfd );
|
||||
@@ -257,7 +163,7 @@ void tapdev_init(void)
|
||||
|
||||
memset(&ifr, 0, sizeof(ifr));
|
||||
ifr.ifr_flags = IFF_TAP|IFF_NO_PI;
|
||||
ret = up_ioctl(gtapdevfd, TUNSETIFF, (unsigned long) &ifr);
|
||||
ret = ioctl(gtapdevfd, TUNSETIFF, (unsigned long) &ifr);
|
||||
if (ret < 0)
|
||||
{
|
||||
lib_rawprintf("TAPDEV: ioctl failed: %d\n", -ret );
|
||||
@@ -278,7 +184,7 @@ int tapdev_getmacaddr(unsigned char *macaddr)
|
||||
{
|
||||
/* Get a socket (only so that we get access to the INET subsystem) */
|
||||
|
||||
int sockfd = up_socket(PF_INET, SOCK_DGRAM, 0);
|
||||
int sockfd = socket(PF_INET, SOCK_DGRAM, 0);
|
||||
if (sockfd >= 0)
|
||||
{
|
||||
struct ifreq req;
|
||||
@@ -290,7 +196,7 @@ int tapdev_getmacaddr(unsigned char *macaddr)
|
||||
|
||||
/* Perform the ioctl to get the MAC address */
|
||||
|
||||
ret = up_ioctl(sockfd, SIOCGIFHWADDR, (unsigned long)&req);
|
||||
ret = ioctl(sockfd, SIOCGIFHWADDR, (unsigned long)&req);
|
||||
if (!ret)
|
||||
{
|
||||
/* Return the MAC address */
|
||||
@@ -304,7 +210,6 @@ int tapdev_getmacaddr(unsigned char *macaddr)
|
||||
|
||||
unsigned int tapdev_read(unsigned char *buf, unsigned int buflen)
|
||||
{
|
||||
struct sel_arg_struct arg;
|
||||
fd_set fdset;
|
||||
struct timeval tv;
|
||||
int ret;
|
||||
@@ -324,19 +229,13 @@ unsigned int tapdev_read(unsigned char *buf, unsigned int buflen)
|
||||
FD_ZERO(&fdset);
|
||||
FD_SET(gtapdevfd, &fdset);
|
||||
|
||||
arg.n = gtapdevfd + 1;
|
||||
arg.inp = &fdset;
|
||||
arg.outp = NULL;
|
||||
arg.exp = NULL;
|
||||
arg.tvp = &tv;
|
||||
|
||||
ret = up_select(&arg);
|
||||
ret = select(gtapdevfd + 1, &fdset, NULL, NULL, &tv);
|
||||
if(ret == 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
ret = up_read(gtapdevfd, buf, buflen);
|
||||
ret = read(gtapdevfd, buf, buflen);
|
||||
if (ret < 0)
|
||||
{
|
||||
lib_rawprintf("TAPDEV: read failed: %d\n", -ret);
|
||||
@@ -361,7 +260,7 @@ void tapdev_send(unsigned char *buf, unsigned int buflen)
|
||||
}
|
||||
#endif
|
||||
|
||||
ret = up_write(gtapdevfd, buf, buflen);
|
||||
ret = write(gtapdevfd, buf, buflen);
|
||||
if (ret < 0)
|
||||
{
|
||||
lib_rawprintf("TAPDEV: write failed: %d", -ret);
|
||||
|
||||
@@ -138,8 +138,6 @@ static int sim_uiptxpoll(struct uip_driver_s *dev)
|
||||
|
||||
void uipdriver_loop(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
/* tapdev_read will return 0 on a timeout event and >0 on a data received event */
|
||||
|
||||
g_sim_dev.d_len = tapdev_read((unsigned char*)g_sim_dev.d_buf, CONFIG_NET_BUFSIZE);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* up_unblocktask.c
|
||||
*
|
||||
* Copyright (C) 2007 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -14,7 +14,7 @@
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name Gregory Nutt nor the names of its contributors may be
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
@@ -31,11 +31,11 @@
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <sys/types.h>
|
||||
@@ -46,23 +46,23 @@
|
||||
#include "os_internal.h"
|
||||
#include "up_internal.h"
|
||||
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* Private Definitions
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/************************************************************
|
||||
* Private Funtions
|
||||
************************************************************/
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/************************************************************
|
||||
* Public Funtions
|
||||
************************************************************/
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* Name: up_unblock_task
|
||||
*
|
||||
* Description:
|
||||
@@ -76,7 +76,7 @@
|
||||
* the ready-to-run list and, if it is the highest priority
|
||||
* ready to run taks, executed.
|
||||
*
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
void up_unblock_task(_TCB *tcb)
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* up_usestack.c
|
||||
*
|
||||
* Copyright (C) 2007 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -14,7 +14,7 @@
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name Gregory Nutt nor the names of its contributors may be
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
@@ -31,11 +31,11 @@
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <sys/types.h>
|
||||
@@ -44,23 +44,23 @@
|
||||
#include "os_internal.h"
|
||||
#include "up_internal.h"
|
||||
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* Private Definitions
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/************************************************************
|
||||
* Private Funtions
|
||||
************************************************************/
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/************************************************************
|
||||
* Public Funtions
|
||||
************************************************************/
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* Name: up_use_stack
|
||||
*
|
||||
* Description:
|
||||
@@ -79,7 +79,7 @@
|
||||
* tcb: The TCB of new task
|
||||
* stack_size: The allocated stack size.
|
||||
*
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
STATUS up_use_stack(_TCB *tcb, void *stack, size_t stack_size)
|
||||
{
|
||||
|
||||
77
arch/z80/include/ez80/arch.h
Normal file
77
arch/z80/include/ez80/arch.h
Normal file
@@ -0,0 +1,77 @@
|
||||
/****************************************************************************
|
||||
* arch/ez80/arch.h
|
||||
* arch/chip/arch.h
|
||||
*
|
||||
* Copyright (C) 2008 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/* This file should never be included directed but, rather,
|
||||
* only indirectly through nuttx/arch.h (via arch/arch.h)
|
||||
*/
|
||||
|
||||
#ifndef __ARCH_EZ80_ARCH_H
|
||||
#define __ARCH_EZ80_ARCH_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Variables
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define EXTERN extern "C"
|
||||
extern "C" {
|
||||
#else
|
||||
#define EXTERN extern
|
||||
#endif
|
||||
|
||||
#undef EXTERN
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ARCH_EZ80_ARCH_H */
|
||||
|
||||
87
arch/z80/include/ez80/io.h
Normal file
87
arch/z80/include/ez80/io.h
Normal file
@@ -0,0 +1,87 @@
|
||||
/****************************************************************************
|
||||
* arch/z80/include/ez80/io.h
|
||||
* arch/chip/io.h
|
||||
*
|
||||
* Copyright (C) 2008 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/* This file should never be included directed but, rather, only indirectly
|
||||
* through arch/io.h
|
||||
*/
|
||||
|
||||
#ifndef __ARCH_EZ80_IO_H
|
||||
#define __ARCH_EZ80_IO_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Inline functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Variables
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
#ifdef __cplusplus
|
||||
#define EXTERN extern "C"
|
||||
extern "C" {
|
||||
#else
|
||||
#define EXTERN extern
|
||||
#endif
|
||||
|
||||
EXTERN void outp(uint16 p, ubyte c);
|
||||
EXTERN ubyte inp(uint16 p);
|
||||
|
||||
#undef EXTERN
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif /* __ARCH_EZ80_IO_H */
|
||||
258
arch/z80/include/ez80/irq.h
Normal file
258
arch/z80/include/ez80/irq.h
Normal file
@@ -0,0 +1,258 @@
|
||||
/****************************************************************************
|
||||
* arch/ez80/include/ez80/irq.h
|
||||
* arch/chip/irq.h
|
||||
*
|
||||
* Copyright (C) 2008 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/* This file should never be included directed but, rather,
|
||||
* only indirectly through nuttx/irq.h (via arch/irq.h)
|
||||
*/
|
||||
|
||||
#ifndef __ARCH_EZ80_IRQ_H
|
||||
#define __ARCH_EZ80_IRQ_H
|
||||
|
||||
#ifndef _EZ80F91
|
||||
# error "Only the EZ80F91 is currently supported"
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* ez80 Interrupt Numbers ***************************************************/
|
||||
|
||||
#define EZ80_EMACRX_IRQ (0) /* Vector 0x40 */
|
||||
#define EZ80_EMACTX_IRQ (1) /* Vector 0x44 */
|
||||
#define EZ80_EMACSYS_IRQ (2) /* Vector 0x48 */
|
||||
#define EZ80_PLL_IRQ (3) /* Vector 0x4c */
|
||||
#define EZ80_FLASH_IRQ (4) /* Vector 0x50 */
|
||||
|
||||
#define EZ80_TIMER0_IRQ (5) /* Vector Ox54 */
|
||||
#define EZ80_TIMER1_IRQ (6) /* Vector Ox58 */
|
||||
#define EZ80_TIMER2_IRQ (7) /* Vector Ox5c */
|
||||
#define EZ80_TIMER3_IRQ (8) /* Vector Ox60 */
|
||||
|
||||
#define EZ80_RTC_IRQ (9) /* Vector Ox6C */
|
||||
#define EZ80_UART0_IRQ (10) /* Vector Ox70 */
|
||||
#define EZ80_UART1_IRQ (11) /* Vector Ox74 */
|
||||
|
||||
#define EZ80_I2C_IRQ (12) /* Vector Ox78 */
|
||||
#define EZ80_SPI_IRQ (13) /* Vector Ox7c */
|
||||
|
||||
#define EZ80_PORTA0_IRQ (14) /* Vector Ox80 */
|
||||
#define EZ80_PORTA1_IRQ (15) /* Vector Ox84 */
|
||||
#define EZ80_PORTA2_IRQ (16) /* Vector Ox88 */
|
||||
#define EZ80_PORTA3_IRQ (17) /* Vector Ox8c */
|
||||
#define EZ80_PORTA4_IRQ (18) /* Vector Ox90 */
|
||||
#define EZ80_PORTA5_IRQ (19) /* Vector Ox94 */
|
||||
#define EZ80_PORTA6_IRQ (20) /* Vector Ox98 */
|
||||
#define EZ80_PORTA7_IRQ (21) /* Vector Ox9c */
|
||||
|
||||
#define EZ80_PORTB0_IRQ (22) /* Vector Oxa0 */
|
||||
#define EZ80_PORTB1_IRQ (23) /* Vector Oxa4 */
|
||||
#define EZ80_PORTB2_IRQ (24) /* Vector Oxa8 */
|
||||
#define EZ80_PORTB3_IRQ (25) /* Vector Oxac */
|
||||
#define EZ80_PORTB4_IRQ (26) /* Vector Oxb0 */
|
||||
#define EZ80_PORTB5_IRQ (27) /* Vector Oxb4 */
|
||||
#define EZ80_PORTB6_IRQ (28) /* Vector Oxb8 */
|
||||
#define EZ80_PORTB7_IRQ (29) /* Vector Oxbc */
|
||||
|
||||
#define EZ80_PORTC0_IRQ (30) /* Vector Oxc0 */
|
||||
#define EZ80_PORTC1_IRQ (31) /* Vector Oxc4 */
|
||||
#define EZ80_PORTC2_IRQ (32) /* Vector Oxc8 */
|
||||
#define EZ80_PORTC3_IRQ (33) /* Vector Oxcc */
|
||||
#define EZ80_PORTC4_IRQ (34) /* Vector Oxd0 */
|
||||
#define EZ80_PORTC5_IRQ (35) /* Vector Oxd4 */
|
||||
#define EZ80_PORTC6_IRQ (36) /* Vector Oxd8 */
|
||||
#define EZ80_PORTC7_IRQ (37) /* Vector Oxdc */
|
||||
|
||||
#define EZ80_PORTD0_IRQ (38) /* Vector Oxe0 */
|
||||
#define EZ80_PORTD1_IRQ (39) /* Vector Oxe4 */
|
||||
#define EZ80_PORTD2_IRQ (40) /* Vector Oxe8 */
|
||||
#define EZ80_PORTD3_IRQ (41) /* Vector Oxec */
|
||||
#define EZ80_PORTD4_IRQ (42) /* Vector Oxf0 */
|
||||
#define EZ80_PORTD5_IRQ (43) /* Vector Oxf4 */
|
||||
#define EZ80_PORTD6_IRQ (44) /* Vector Oxf8 */
|
||||
#define EZ80_PORTD7_IRQ (45) /* Vector Oxfc */
|
||||
|
||||
#define NR_IRQS (46)
|
||||
#define EZ80_IRQ_SYSTIMER EZ80_TIMER0_IRQ
|
||||
|
||||
/* IRQ Management Macros ****************************************************/
|
||||
|
||||
/* IRQ State Save Format ****************************************************
|
||||
*
|
||||
* These indices describe how the ez8 context is save in the state save array
|
||||
*
|
||||
* Byte offsets:
|
||||
*/
|
||||
|
||||
/* IRQ Stack Frame Format
|
||||
*
|
||||
* This stack frame is created on each interrupt. These registers are stored
|
||||
* in the TCB to many context switches.
|
||||
*/
|
||||
|
||||
/* chipreg_t indices */
|
||||
|
||||
#define XCPT_I (0) /* Index 0: 16-bit interrupt vector register */
|
||||
#define XCPT_BC (1) /* Index 1: Saved 16-bit BC register */
|
||||
#define XCPT_DE (2) /* Index 2: Saved 16-bit DE register */
|
||||
#define XCPT_IX (3) /* Index 3: Saved 16-bit IX register */
|
||||
#define XCPT_IY (4) /* Index 4: Saved 16-bit IY register */
|
||||
#define XCPT_SP (5) /* Index 5: Saved 16-bit SP at time of interrupt */
|
||||
#define XCPT_HL (6) /* Index 6: Saved 16-bit HL register */
|
||||
#define XCPT_AF (7) /* Index 7: Saved 16-bit AF register */
|
||||
#define XCPT_PC (8) /* Index 8: Offset to 16-bit PC at time of interrupt */
|
||||
#define XCPTCONTEXT_REGS (9)
|
||||
|
||||
#ifdef CONFIG_EZ80_Z80MODE
|
||||
/* Byte offsets */
|
||||
|
||||
# define XCPT_I_OFFSET (2*XCPT_I) /* Offset 0: 16-bit interrupt vector register */
|
||||
# define XCPT_IF_OFFSET (2*XCPT_I+0) /* Offset 1: Saved flags. P set if interrupts enabled */
|
||||
# define XCPT_IA_OFFSET (2*XCPT_I+1) /* Offset 2: Saved lower 8-bits of interrupt vector register */
|
||||
# define XCPT_BC_OFFSET (2*XCPT_BC) /* Offset 2: Saved 16-bit BC register */
|
||||
# define XCPT_C_OFFSET (2*XCPT_BC+0) /* Offset 2: Saved 8-bit C register */
|
||||
# define XCPT_B_OFFSET (2*XCPT_BC+1) /* Offset 3: Saved 8-bit D register */
|
||||
# define XCPT_DE_OFFSET (2*XCPT_DE) /* Offset 4: Saved 16-bit DE register */
|
||||
# define XCPT_E_OFFSET (2*XCPT_DE+0) /* Offset 4: Saved 8-bit E register */
|
||||
# define XCPT_D_OFFSET (2*XCPT_DE+1) /* Offset 5: Saved 8-bit D register */
|
||||
# define XCPT_IX_OFFSET (2*XCPT_IX) /* Offset 6: Saved 16-bit IX register */
|
||||
# define XCPT_IY_OFFSET (2*XCPT_IY) /* Offset 8: Saved 16-bit IY register */
|
||||
# define XCPT_SP_OFFSET (2*XCPT_SP) /* Offset 10: Saved 16-bit SP at time of interrupt */
|
||||
# define XCPT_HL_OFFSET (2*XCPT_HL) /* Offset 12: Saved 16-bit HL register */
|
||||
# define XCPT_L_OFFSET (2*XCPT_HL+0) /* Offset 12: Saved 8-bit L register */
|
||||
# define XCPT_H_OFFSET (2*XCPT_HL+1) /* Offset 13: Saved 8-bit H register */
|
||||
# define XCPT_AF_OFFSET (2*XCPT_AF) /* Offset 14: Saved 16-bit AF register */
|
||||
# define XCPT_F_OFFSET (2*XCPT_AF+0) /* Offset 14: Saved flags */
|
||||
# define XCPT_A_OFFSET (2*XCPT_AF+1) /* Offset 15: Saved 8-bit A register */
|
||||
# define XCPT_PC_OFFSET (2*XCPT_PC) /* Offset 16: Offset to 16-bit PC at time of interrupt */
|
||||
# define XCPTCONTEXT_SIZE (2*XCPTCONTEXT_REGS)
|
||||
#else
|
||||
/* Byte offsets */
|
||||
|
||||
# define XCPT_I_OFFSET (3*XCPT_I) /* Offset 0: Saved 24-bit interrupt vector register */
|
||||
# define XCPT_IF_OFFSET (2*XCPT_I+1) /* Offset 1: Saved flags. P set if interrupts enabled */
|
||||
# define XCPT_IA_OFFSET (2*XCPT_I+2) /* Offset 2: Saved lower 8-bits of interrupt vector register */
|
||||
# define XCPT_BC_OFFSET (3*XCPT_BC) /* Offset 3: Saved 24-bit BC register */
|
||||
# define XCPT_C_OFFSET (3*XCPT_BC+1) /* Offset 4: Saved 8-bit C register */
|
||||
# define XCPT_B_OFFSET (3*XCPT_BC+2) /* Offset 5: Saved 8-bit D register */
|
||||
# define XCPT_DE_OFFSET (3*XCPT_DE) /* Offset 6: Saved 24-bit DE register */
|
||||
# define XCPT_E_OFFSET (3*XCPT_DE+1) /* Offset 7: Saved 8-bit E register */
|
||||
# define XCPT_D_OFFSET (3*XCPT_DE+2) /* Offset 8: Saved 8-bit D register */
|
||||
# define XCPT_IX_OFFSET (3*XCPT_IX) /* Offset 9: Saved 24-bit IX register */
|
||||
# define XCPT_IY_OFFSET (3*XCPT_IY) /* Offset 12: Saved 24-bit IY register */
|
||||
# define XCPT_SP_OFFSET (3*XCPT_SP) /* Offset 15: Saved 24-bit SP at time of interrupt */
|
||||
# define XCPT_HL_OFFSET (3*XCPT_HL) /* Offset 18: Saved 24-bit HL register */
|
||||
# define XCPT_L_OFFSET (3*XCPT_HL+1) /* Offset 19: Saved 8-bit L register */
|
||||
# define XCPT_H_OFFSET (3*XCPT_HL+2) /* Offset 20: Saved 8-bit H register */
|
||||
# define XCPT_AF_OFFSET (3*XCPT_AF) /* Offset 21: Saved AF register */
|
||||
# define XCPT_F_OFFSET (3*XCPT_AF+1) /* Offset 22: Saved AF register */
|
||||
# define XCPT_A_OFFSET (3*XCPT_AF+2) /* Offset 23: Saved 8-bit A register */
|
||||
# define XCPT_PC_OFFSET (3*XCPT_PC) /* Offset 24: Offset to 24-bit PC at time of interrupt */
|
||||
# define XCPTCONTEXT_SIZE (3*XCPTCONTEXT_REGS)
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
/* This is the type of the register save array */
|
||||
|
||||
#ifdef CONFIG_EZ80_Z80MODE
|
||||
typedef uint16 chipreg_t;
|
||||
#else
|
||||
typedef uint24 chipreg_t;
|
||||
#endif
|
||||
|
||||
/* This struct defines the way the registers are stored. */
|
||||
|
||||
struct xcptcontext
|
||||
{
|
||||
/* Register save area */
|
||||
|
||||
chipreg_t regs[XCPTCONTEXT_REGS];
|
||||
|
||||
/* The following function pointer is non-zero if there
|
||||
* are pending signals to be processed.
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_DISABLE_SIGNALS
|
||||
CODE void *sigdeliver; /* Actual type is sig_deliver_t */
|
||||
|
||||
/* The following retains that state during signal execution */
|
||||
|
||||
chipreg_t saved_pc; /* Saved return address */
|
||||
chipreg_t saved_irqctl; /* Saved interrupt state */
|
||||
#endif
|
||||
};
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Inline functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Variables
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
#ifdef __cplusplus
|
||||
#define EXTERN extern "C"
|
||||
extern "C" {
|
||||
#else
|
||||
#define EXTERN extern
|
||||
#endif
|
||||
|
||||
EXTERN irqstate_t irqsave(void);
|
||||
EXTERN void irqrestore(irqstate_t flags);
|
||||
|
||||
#undef EXTERN
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif /* __ARCH_EZ80_IRQ_H */
|
||||
|
||||
95
arch/z80/include/ez80/types.h
Normal file
95
arch/z80/include/ez80/types.h
Normal file
@@ -0,0 +1,95 @@
|
||||
/****************************************************************************
|
||||
* arch/z80/include/ez80/types.h
|
||||
* include/arch/chip/types.h
|
||||
*
|
||||
* Copyright (C) 2008 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name Gregory Nutt nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/* This file should never be included directed but, rather, only indirectly
|
||||
* through sys/types.h
|
||||
*/
|
||||
|
||||
#ifndef __ARCH_CHIP_TYPES_H
|
||||
#define __ARCH_CHIP_TYPES_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Type Declarations
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
/* These are the sizes of the types supported by the ZiLOG Z8Encore! compiler:
|
||||
*
|
||||
* int - 24-bits
|
||||
* short - 16-bits
|
||||
* long - 32-bits
|
||||
* char - 8-bits
|
||||
* float - 32-bits
|
||||
*
|
||||
* Pointers:
|
||||
*
|
||||
* Z80 mode - 16 bits
|
||||
* ADL mode - 24 bits
|
||||
*/
|
||||
|
||||
typedef char sbyte;
|
||||
typedef unsigned char ubyte;
|
||||
typedef unsigned char uint8;
|
||||
typedef unsigned char boolean;
|
||||
typedef short sint16;
|
||||
typedef unsigned short uint16;
|
||||
typedef int sint24;
|
||||
typedef unsigned int uint24;
|
||||
typedef long sint32;
|
||||
typedef unsigned long uint32;
|
||||
|
||||
/* This is the size of the interrupt state save returned by irqsave().
|
||||
* It holds the AF regiser pair + a zero pad byte
|
||||
*/
|
||||
|
||||
typedef uint24 irqstate_t;
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
|
||||
/****************************************************************************
|
||||
* Global Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
#endif /* __ARCH_CHIP_TYPES_H */
|
||||
@@ -208,9 +208,9 @@ endif
|
||||
nuttx$(EXEEXT): pass1.ihx nuttx.ihx
|
||||
@rm -f pass1.*
|
||||
@cp -f nuttx.map $(TOPDIR)/.
|
||||
ifeq ($(EXEEXT),.CMD)
|
||||
ifeq ($(EXEEXT),.cmd)
|
||||
sed s/:00000001FF/:00520001AD/ nuttx.ihx | \
|
||||
hex2cmd > $(TOPDIR)/NUTTX.CMD
|
||||
hex2cmd > $(TOPDIR)/nuttx.cmd
|
||||
else
|
||||
@packihx nuttx.ihx > $(TOPDIR)/nuttx$(EXEEXT)
|
||||
endif
|
||||
|
||||
@@ -45,12 +45,17 @@ LDFLAGS = @"${shell cygpath -w $(ARCHSRCDIR)/nuttx.linkcmd}"
|
||||
|
||||
############################################################################
|
||||
# Files and directories
|
||||
HEAD_ASRC = $(HEAD_SSRC:.S=$(ASMEXT))
|
||||
ifneq ($(HEAD_SSRC),)
|
||||
HEAD_GENSRC = $(HEAD_SSRC:.S=$(ASMEXT))
|
||||
HEAD_AOBJ = $(HEAD_SSRC:.S=$(OBJEXT))
|
||||
else
|
||||
HEAD_AOBJ = $(HEAD_ASRC:$(ASMEXT)=$(OBJEXT))
|
||||
endif
|
||||
|
||||
SSRCS = $(CHIP_SSRCS) $(CMN_SSRCS)
|
||||
ASRCS = $(SSRCS:.S=$(ASMEXT))
|
||||
AOBJS = $(SSRCS:.S=$(OBJEXT))
|
||||
ASRCS = $(CHIP_ASRCS) $(CMN_ASRCS)
|
||||
GENSRCS = $(SSRCS:.S=$(ASMEXT))
|
||||
AOBJS = $(SSRCS:.S=$(OBJEXT)) $(ASRCS:$(ASMEXT)=$(OBJEXT))
|
||||
|
||||
CSRCS = $(CHIP_CSRCS) $(CMN_CSRCS)
|
||||
COBJS = $(CSRCS:.c=$(OBJEXT))
|
||||
@@ -66,13 +71,13 @@ VPATH = chip:common
|
||||
# Targets
|
||||
all: $(HEAD_OBJ) libarch$(LIBEXT)
|
||||
|
||||
$(ASRCS) $(HEAD_ASRC): %$(ASMEXT): %.S
|
||||
$(HEAD_GENSRC) $(GENSRCS) : %$(ASMEXT): %.S
|
||||
@$(CPP) $(CPPFLAGS) $< -o $@.tmp
|
||||
@cat $@.tmp | sed -e "s/^#/;/g" > $@
|
||||
@rm $@.tmp
|
||||
|
||||
$(AOBJS) $(HEAD_AOBJ): %$(OBJEXT): %$(ASMEXT)
|
||||
$(call ASSEMBLE, $<, $@)
|
||||
$(call ASSEMBLE, `cygpath -w $<`, $@)
|
||||
|
||||
$(COBJS): %$(OBJEXT): %.c
|
||||
$(call COMPILE, `cygpath -w $<`, $@)
|
||||
@@ -101,10 +106,18 @@ ifeq ($(CONFIG_ARCH_CHIP_Z8F640X),y)
|
||||
@echo " \"${shell cygpath -w $(ZDSZILOGLIBDIR)/zsldevinitdummy$(LIBEXT)}\"" >>nuttx.linkcmd
|
||||
endif
|
||||
ifeq ($(CONFIG_ARCH_CHIP_Z8F642X),y)
|
||||
@echo " \"${shell cygpath -w $(ZDSSTDLIBDIR)/fpdumyLD$(LIBEXT)}\", \\" >>nuttx.linkcmd
|
||||
@echo " \"${shell cygpath -w $(ZDSSTDLIBDIR)/chelpD$(LIBEXT)}\", \\" >>nuttx.linkcmd
|
||||
@echo " \"${shell cygpath -w $(ZDSSTDLIBDIR)/csioLDD$(LIBEXT)}\", \\" >>nuttx.linkcmd
|
||||
@echo " \"${shell cygpath -w $(ZDSSTDLIBDIR)/zsldevinitdummy.lib$(LIBEXT)}\" \\" >>nuttx.linkcmd
|
||||
@echo " \"${shell cygpath -w $(ZDSSTDLIBDIR)/crtLDD$(LIBEXT)}\", \\" >>nuttx.linkcmd
|
||||
@echo " \"${shell cygpath -w $(ZDSSTDLIBDIR)/fpdumyLD$(LIBEXT)}\", \\" >>nuttx.linkcmd
|
||||
@echo " \"${shell cygpath -w $(ZDSZILOGLIBDIR)/csioLDD$(LIBEXT)}\", \\" >>nuttx.linkcmd
|
||||
@echo " \"${shell cygpath -w $(ZDSZILOGLIBDIR)/zsldevinitdummy$(LIBEXT)}\"" >>nuttx.linkcmd
|
||||
endif
|
||||
ifeq ($(CONFIG_ARCH_CHIP_EZ80F91),y)
|
||||
@echo " \"${shell cygpath -w $(ZDSSTDLIBDIR)/chelp$(LIBEXT)}\", \\" >>nuttx.linkcmd
|
||||
@echo " \"${shell cygpath -w $(ZDSSTDLIBDIR)/crt$(LIBEXT)}\", \\" >>nuttx.linkcmd
|
||||
@echo " \"${shell cygpath -w $(ZDSSTDLIBDIR)/fplib$(LIBEXT)}\", \\" >>nuttx.linkcmd
|
||||
@echo " \"${shell cygpath -w $(ZDSZILOGLIBDIR)/gpio$(LIBEXT)}\", \\" >>nuttx.linkcmd
|
||||
@echo " \"${shell cygpath -w $(ZDSZILOGLIBDIR)/uartf91$(LIBEXT)}\"" >>nuttx.linkcmd
|
||||
endif
|
||||
|
||||
nuttx$(EXEEXT): $(HEAD_AOBJ) board/libboard$(LIBEXT) nuttx.linkcmd
|
||||
|
||||
@@ -47,40 +47,27 @@
|
||||
#include "up_arch.h"
|
||||
#include "up_internal.h"
|
||||
|
||||
#ifdef SDCC
|
||||
/* For the SDCC toolchain, the arch/z80/src/Makefile will parse the map file
|
||||
* to determin how much memory is available for the heap. This parsed data
|
||||
* to determine how much memory is available for the heap. This parsed data
|
||||
* is provided via the auto-generated file up_mem.h
|
||||
*/
|
||||
|
||||
#ifdef SDCC
|
||||
# include "up_mem.h"
|
||||
|
||||
#else
|
||||
/* For other toolchains, the architecture must provide a header file in the
|
||||
* chip subdirectory to provide the heap parameters (if they are not defined
|
||||
* in the configuration file )
|
||||
*/
|
||||
|
||||
# include "chip/up_mem.h"
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* For the ZiLOG ZDS-II toolchain(s), the heap will be set using linker-
|
||||
* defined values:
|
||||
*
|
||||
* far_heapbot : set to the offset to the first unused value in EDATA
|
||||
* far_stacktop : set to the highest address in EDATA
|
||||
*
|
||||
* The top of the heap is then determined by the amount of stack setaside
|
||||
* in the NuttX configuration file
|
||||
*/
|
||||
|
||||
#ifdef __ZILOG__
|
||||
# ifndef CONFIG_HEAP1_BASE
|
||||
extern far unsigned long far_heapbot;
|
||||
# define CONFIG_HEAP1_BASE ((uint16)&far_heapbot)
|
||||
# endif
|
||||
# ifndef CONFIG_HEAP1_END
|
||||
extern far unsigned long far_stacktop;
|
||||
# define CONFIG_HEAP1_END (((uint16)&far_stacktop) - CONFIG_PROC_STACK_SIZE + 1)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
54
arch/z80/src/ez80/Make.defs
Normal file
54
arch/z80/src/ez80/Make.defs
Normal file
@@ -0,0 +1,54 @@
|
||||
############################################################################
|
||||
# arch/z80/src/ez80/Make.defs
|
||||
#
|
||||
# Copyright (C) 2008 Gregory Nutt. All rights reserved.
|
||||
# Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in
|
||||
# the documentation and/or other materials provided with the
|
||||
# distribution.
|
||||
# 3. Neither the name NuttX nor the names of its contributors may be
|
||||
# used to endorse or promote products derived from this software
|
||||
# without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
############################################################################
|
||||
|
||||
HEAD_ASRC = ez80_vectors.asm
|
||||
HEAD_SSRC =
|
||||
|
||||
CMN_SSRCS =
|
||||
CMN_CSRCS = up_initialize.c up_allocateheap.c up_createstack.c \
|
||||
up_releasestack.c up_interruptcontext.c up_blocktask.c \
|
||||
up_unblocktask.c up_exit.c up_releasepending.c \
|
||||
up_reprioritizertr.c up_idle.c up_assert.c up_doirq.c \
|
||||
up_mdelay.c up_udelay.c up_usestack.c
|
||||
|
||||
CHIP_ASRCS = ez80_startup.asm ez80_io.asm ez80_irqsave.asm \
|
||||
ez80_saveusercontext.asm ez80_restorecontext.asm
|
||||
ifeq ($(CONFIG_ARCH_CHIP_EZ80F91),y)
|
||||
CHIP_ASRCS += ez80f91_init.asm
|
||||
endif
|
||||
CHIP_SSRCS =
|
||||
CHIP_CSRCS = ez80_initialstate.c ez80_irq.c ez80_copystate.c \
|
||||
ez80_schedulesigaction.c ez80_sigdeliver.c ez80_timerisr.c \
|
||||
ez80_lowuart.c ez80_serial.c ez80_registerdump.c
|
||||
272
arch/z80/src/ez80/chip.h
Normal file
272
arch/z80/src/ez80/chip.h
Normal file
@@ -0,0 +1,272 @@
|
||||
/************************************************************************************
|
||||
* arch/z80/src/ez80/chip.h
|
||||
* arch/z80/src/chip/chip.h
|
||||
*
|
||||
* Copyright (C) 2008 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
#ifndef __EZ80_CHIP_H
|
||||
#define __EZ80_CHIP_H
|
||||
|
||||
/************************************************************************************
|
||||
* Included Files
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Definitions
|
||||
************************************************************************************/
|
||||
|
||||
/* Bits in the Z80 FLAGS register ***************************************************/
|
||||
|
||||
#define EZ80_C_FLAG 0x01 /* Bit 0: Carry flag */
|
||||
#define EZ80_N_FLAG 0x02 /* Bit 1: Add/Subtract flag */
|
||||
#define EZ80_PV_FLAG 0x04 /* Bit 2: Parity/Overflow flag */
|
||||
#define EZ80_H_FLAG 0x10 /* Bit 4: Half carry flag */
|
||||
#define EZ80_Z_FLAG 0x40 /* Bit 5: Zero flag */
|
||||
#define EZ80_S_FLAG 0x80 /* Bit 7: Sign flag */
|
||||
|
||||
/* Timer Registers *****************************************************************/
|
||||
|
||||
#define EZ80_TMR0_CTL 0x60 /* RW: Timer 0 control register */
|
||||
#define EZ80_TMR0_IER 0x61 /* RW: Timer 0 interrupt enable register */
|
||||
#define EZ80_TMR0_IIR 0x62 /* R : Timer 0 interrupt ID register */
|
||||
#define EZ80_TMR0_DRL 0x63 /* R : Timer 0 data register (low) */
|
||||
#define EZ80_TMR0_DRH 0x64 /* R : Timer 0 data register (high) */
|
||||
#define EZ80_TMR0_RRL 0x63 /* W: Timer 0 reload register (low) */
|
||||
#define EZ80_TMR0_RRH 0x64 /* W: Timer 0 reload register (high) */
|
||||
|
||||
#define EZ80_TMR1_CTL 0x65 /* RW: Timer 1 control register */
|
||||
#define EZ80_TMR1_IER 0x66 /* RW: Timer 1 interrupt enable register */
|
||||
#define EZ80_TMR1_IIR 0x67 /* R : Timer 1 interrupt ID register */
|
||||
#define EZ80_TMR1_DRL 0x68 /* R : Timer 1 data register (low) */
|
||||
#define EZ80_TMR1_DRH 0x69 /* R : Timer 1 data register (high) */
|
||||
#define EZ80_TMR1_RRL 0x68 /* W: Timer 1 reload register (low) */
|
||||
#define EZ80_TMR1_RRH 0x69 /* W: Timer 1 reload register (high) */
|
||||
#define EZ80_TMR1_CAPCTL 0x6a /* RW: Timer 1 input capture control register */
|
||||
#define EZ80_TMR1_CAPAL 0x6b /* R : Timer 1 capture input value A (low) */
|
||||
#define EZ80_TMR1_CAPAH 0x6c /* R : Timer 1 capture input value A (high) */
|
||||
#define EZ80_TMR1_CAPBL 0x6d /* R : Timer 1 capture input value B (low) */
|
||||
#define EZ80_TMR1_CAPBH 0x6e
|
||||
|
||||
#define EZ80_TMR2_CTL 0x6f /* RW: Timer 2 control register */
|
||||
#define EZ80_TMR2_IER 0x70 /* RW: Timer 2 interrupt enable register */
|
||||
#define EZ80_TMR2_IIR 0x71 /* R : Timer 2 interrupt ID register */
|
||||
#define EZ80_TMR2_DRL 0x72 /* R : Timer 2 data register (low) */
|
||||
#define EZ80_TMR2_DRH 0x73 /* R : Timer 2 data register (high) */
|
||||
#define EZ80_TMR2_RRL 0x72 /* W: Timer 2 reload register (low) */
|
||||
#define EZ80_TMR2_RRH 0x73 /* W: Timer 2 reload register (high) */
|
||||
|
||||
#define EZ80_TMR3_CTL 0x74 /* RW: Timer 3 control register */
|
||||
#define EZ80_TMR3_IER 0x75 /* RW: Timer 3 interrupt enable register */
|
||||
#define EZ80_TMR3_IIR 0x76 /* R : Timer 3 interrupt ID register */
|
||||
#define EZ80_TMR3_DRL 0x77 /* R : Timer 3 data register (low) */
|
||||
#define EZ80_TMR3_DRH 0x78 /* R : Timer 3 data register (high) */
|
||||
#define EZ80_TMR3_RRL 0x77 /* W: Timer 3 reload register (low) */
|
||||
#define EZ80_TMR3_RRH 0x78 /* W: Timer 3 reload register (high) */
|
||||
#define EZ80_TMR3_CAPCTL 0x7b /* RW: Timer 3 input capture control register */
|
||||
#define EZ80_TMR3_CAPAL 0x7c /* R : Timer 3 capture input value A (low) */
|
||||
#define EZ80_TMR3_CAPAH 0x7d /* R : Timer 3 capture input value A (high) */
|
||||
#define EZ80_TMR3_CAPBL 0x7e /* R : Timer 3 capture input value B (low) */
|
||||
#define EZ80_TMR3_CAPBH 0x7f /* R : Timer 3 capture input value B (high) */
|
||||
#define EZ80_TMR3_OCCTL1 0x80 /* RW: Timer 3 output compare control register1 */
|
||||
#define EZ80_TMR3_OCCTL2 0x81 /* RW: Timer 3 output compare control register2 */
|
||||
#define EZ80_TMR3_OC0L 0x82 /* RW: Timer 3 output compare value 0 (low) */
|
||||
#define EZ80_TMR3_OC0H 0x83 /* RW: Timer 3 output compare value 0 (high) */
|
||||
#define EZ80_TMR3_OC1L 0x84 /* RW: Timer 3 output compare value 1 (low) */
|
||||
#define EZ80_TMR3_OC1H 0x85 /* RW: Timer 3 output compare value 1 (high) */
|
||||
#define EZ80_TMR3_OC2L 0x86 /* RW: Timer 3 output compare value 2 (low) */
|
||||
#define EZ80_TMR3_OC2H 0x87 /* RW: Timer 3 output compare value 2 (high) */
|
||||
#define EZ80_TMR3_OC3L 0x88 /* RW: Timer 3 output compare value 3 (low) */
|
||||
#define EZ80_TMR3_OC3H 0x89 /* RW: Timer 3 output compare value 3 (high) */
|
||||
|
||||
/* TMR0/1/2/3 CTL Register Bit Definitions *******************************************/
|
||||
|
||||
#define EZ80_TMRCTL_BRKSTOP 0x80 /* Bit 7: Stop timer for debug operation */
|
||||
#define EZ80_TMRCTL_CLKSEL 0x60 /* Bits 6-5: Timer source */
|
||||
# define EZ80_TMRCLKSEL_SYSCLK 0x00 /* 00: System clock divided by prescaler */
|
||||
# define EZ80_TMRCLKSEL_RTC 0x20 /* 01: Real time clock input */
|
||||
# define EZ80_TMRCLKSEL_ECF 0x40 /* 10: Event count input, falling edge */
|
||||
# define EZ80_TMRCLKSEL_ECR 0x60 /* 11: Event count input, rising edge */
|
||||
#define EZ80_TMRCTL_CLKDIV 0x18 /* Bits 3-4: Sysem clock divider */
|
||||
# define EZ80_TMRCLKDIV_4 0x00 /* 00: 4 */
|
||||
# define EZ80_TMRCLKDIV_16 0x08 /* 01: 16 */
|
||||
# define EZ80_TMRCLKDIV_64 0x10 /* 10: 64 */
|
||||
# define EZ80_TMRCLKDIV_256 0x18 /* 11: 256 */
|
||||
#define EZ80_TMRCTL_TIMCONT 0x04 /* Bit 2: Continusous mode */
|
||||
#define EZ80_TMRCTL_RLD 0x02 /* Bit 1: Force reload */
|
||||
#define EZ80_TMRCTL_TIMEN 0x01 /* Bit 0: Programmable reload timer enabled */
|
||||
|
||||
/* TMR0/1/2/3 IER Register Bit Definitions *******************************************/
|
||||
/* Bit 7: Reserved */
|
||||
#define EZ80_TMRIER_OC3EN 0x40 /* Bit 6: TMR3 OC3 enabled */
|
||||
#define EZ80_TMRIER_OC2EN 0x20 /* Bit 5: TMR3 OC2 enabled */
|
||||
#define EZ80_TMRIER_OC1EN 0x10 /* Bit 4: TMR3 OC1 enabled */
|
||||
#define EZ80_TMRIER_OC0EN 0x08 /* Bit 3: TMR3 OC0 enabled */
|
||||
#define EZ80_TMRIER_ICBEN 0x04 /* Bit 2: TMR1/3 capture pin enabled */
|
||||
#define EZ80_TMRIER_ICAEN 0x02 /* Bit 1: TMR1/3 capture pin enabled */
|
||||
#define EZ80_TMRIER_EOCEN 0x01 /* Bit 0: End of count interrupt enabled */
|
||||
|
||||
/* TMR0/1/2/3 IER Register Bit Definitions *******************************************/
|
||||
/* Bit 7: Reserved */
|
||||
#define EZ80_TMRIIR_OC3 0x40 /* Bit 6: TMR3 OC3 */
|
||||
#define EZ80_TMRIIR_OC2 0x20 /* Bit 5: TMR3 OC2 */
|
||||
#define EZ80_TMRIIR_OC1 0x10 /* Bit 4: TMR3 OC1 */
|
||||
#define EZ80_TMRIIR_OC0 0x08 /* Bit 3: TMR3 OC0 */
|
||||
#define EZ80_TMRIIR_ICB 0x04 /* Bit 2: TMR1/3 capture pin */
|
||||
#define EZ80_TMRIIR_ICA 0x02 /* Bit 1: TMR1/3 capture pin */
|
||||
#define EZ80_TMRIIR_EOC 0x01 /* Bit 0: End of count interrupt */
|
||||
|
||||
/* UART Register Offsets *************************************************************/
|
||||
/* DLAB=0: */
|
||||
#define EZ80_UART_THR 0x00 /* W: UART Transmit holding register */
|
||||
#define EZ80_UART_RBR 0x00 /* R : UART Receive buffer register */
|
||||
#define EZ80_UART_IER 0x01 /* RW: UART Interrupt enable register */
|
||||
/* DLAB=1: */
|
||||
#define EZ80_UART_BRG 0x00 /* RW: UART Baud rate generator register */
|
||||
#define EZ80_UART_BRGL 0x00 /* RW: UART Baud rate generator register (low) */
|
||||
#define EZ80_UART_BRGH 0x01 /* RW: UART Baud rate generator register (high) */
|
||||
/* DLAB=N/A: */
|
||||
#define EZ80_UART_IIR 0x02 /* R : UART Interrupt identification register */
|
||||
#define EZ80_UART_FCTL 0x02 /* W: UART FIFO control register */
|
||||
#define EZ80_UART_LCTL 0x03 /* RW: UART Line control register */
|
||||
#define EZ80_UART_MCTL 0x04 /* RW: UART Modem control register */
|
||||
#define EZ80_UART_LSR 0x05 /* R : UART Line status register */
|
||||
#define EZ80_UART_MSR 0x06 /* R : UART Modem status register */
|
||||
#define EZ80_UART_SPR 0x07 /* RW: UART Scratchpad register */
|
||||
|
||||
/* UART0/1 Base Register Addresses **************************************************/
|
||||
|
||||
#define EZ80_UART0_BASE 0xc0
|
||||
#define EZ80_UART1_BASE 0xd0
|
||||
|
||||
/* UART0/1 IER register bits ********************************************************/
|
||||
|
||||
#define EZ80_UARTEIR_INTMASK 0x1f /* Bits 5-7: Reserved */
|
||||
#define EZ80_UARTEIR_TCIE 0x10 /* Bit 4: Transmission complete interrupt */
|
||||
#define EZ80_UARTEIR_MIIE 0x08 /* Bit 3: Modem status input interrupt */
|
||||
#define EZ80_UARTEIR_LSIE 0x04 /* Bit 2: Line status interrupt */
|
||||
#define EZ80_UARTEIR_TIE 0x02 /* Bit 1: Transmit interrupt */
|
||||
#define EZ80_UARTEIR_RIE 0x01 /* Bit 0: Receive interrupt */
|
||||
|
||||
/* UART0/1 IIR register bits ********************************************************/
|
||||
|
||||
#define EZ80_UARTIIR_FSTS 0x80 /* Bit 7: FIFO enable */
|
||||
/* Bits 4-6: Reserved */
|
||||
#define EZ80_UARTIIR_INSTS 0x0e /* Bits 1-3: Interrupt status code */
|
||||
# define EZ80_UARTINSTS_CTO 0x0c /* 110: Character timeout */
|
||||
# define EZ80_UARTINSTS_TC 0x0a /* 101: Transmission complete */
|
||||
# define EZ80_UARTINSTS_RLS 0x06 /* 011: Receiver line status */
|
||||
# define EZ80_UARTINSTS_RDR 0x04 /* 010: Receive data ready or trigger level */
|
||||
# define EZ80_UARTINSTS_TBE 0x02 /* 001: Transmisson buffer empty */
|
||||
# define EZ80_UARTINSTS_MS 0x00 /* 000: Modem status */
|
||||
#define EZ80_UARTIIR_INTBIT 0x01 /* Bit 0: Active interrupt source */
|
||||
#define EZ80_UARTIIR_CAUSEMASK 0x0f
|
||||
|
||||
/* UART0/1 FCTL register bits *******************************************************/
|
||||
|
||||
#define EZ80_UARTFCTL_TRIG 0xc0 /* Bits 6-7: UART recieve FIFO trigger level */
|
||||
# define EZ80_UARTTRIG_1 0x00 /* 00: Receive FIFO trigger level=1 */
|
||||
# define EZ80_UARTTRIG_4 0x40 /* 01: Receive FIFO trigger level=4 */
|
||||
# define EZ80_UARTTRIG_8 0x80 /* 10: Receive FIFO trigger level=8 */
|
||||
# define EZ80_UARTTRIG_14 0xc0 /* 11: Receive FIFO trigger level=14 */
|
||||
/* Bit 3-5: Reserved */
|
||||
#define EZ80_UARTFCTL_CLRTxF 0x04 /* Bit 2: Transmit enable */
|
||||
#define EZ80_UARTFCTL_CLRRxF 0x02 /* Bit 1: Receive enable */
|
||||
#define EZ80_UARTFCTL_FIFOEN 0x01 /* Bit 0: Enable receive/transmit FIFOs */
|
||||
|
||||
/* UART0/1 LCTL register bits *******************************************************/
|
||||
|
||||
#define EZ80_UARTLCTL_DLAB 0x80 /* Bit 7: Enable access to baud rate generator */
|
||||
#define EZ80_UARTLCTL_SB 0x40 /* Bit 6: Send break */
|
||||
#define EZ80_UARTLCTL_FPE 0x20 /* Bit 5: Force parity error */
|
||||
#define EZ80_UARTLCTL_EPS 0x10 /* Bit 4: Even parity select */
|
||||
#define EZ80_UARTLCTL_PEN 0x08 /* Bit 3: Parity enable */
|
||||
#define EZ80_UARTLCTl_2STOP 0x04 /* Bit 2: 2 stop bits */
|
||||
#define EZ80_UARTLCTL_CHAR 0x03 /* Bits 0-2: Number of data bits */
|
||||
# define EZ80_UARTCHAR_5BITS 0x00 /* 00: 5 data bits */
|
||||
# define EZ80_UARTCHAR_6BITS 0x01 /* 01: 6 data bits */
|
||||
# define EZ80_UARTCHAR_7BITS 0x02 /* 10: 7 data bits */
|
||||
# define EZ80_UARTCHAR_8BITS 0x03 /* 11: 8 data bits */
|
||||
|
||||
#define EZ80_UARTLCTL_MASK 0x3f
|
||||
|
||||
/* UART0/1 MCTL register bits *******************************************************/
|
||||
/* Bit 7: Reserved */
|
||||
#define EZ80_UARTMCTL_POLARITY 0x40 /* Bit 6: Invert polarity of RxD and TxD */
|
||||
#define EZ80_UARTMCTL_MDM 0x20 /* Bit 5: Multi-drop mode enable */
|
||||
#define EZ80_UARTMCTL_LOOP 0x10 /* Bit 4: Loopback mode enable */
|
||||
#define EZ80_UARTMCTL_OUT2 0x08 /* Bit 3: (loopback mode only) */
|
||||
#define EZ80_UARTMCTL_OUT1 0x04 /* Bit 2: (loopback mode only) */
|
||||
#define EZ80_UARTMCTL_RTS 0x02 /* Bit 1: Request to send */
|
||||
#define EZ80_UARTMCTL_DTR 0x01 /* Bit 0: Data termnal read */
|
||||
|
||||
/* UART0/1 LSR register bits ********************************************************/
|
||||
|
||||
#define EZ80_UARTLSR_ERR 0x80 /* Bit 7: Error detected in FIFO */
|
||||
#define EZ80_UARTLSR_TEMT 0x40 /* Bit 6: Transmit FIFO empty and idle */
|
||||
#define EZ80_UARTLSR_THRE 0x20 /* Bit 5: Transmit FIFO empty */
|
||||
#define EZ80_UARTLSR_BI 0x10 /* Bit 4: Break on input */
|
||||
#define EZ80_UARTLSR_FE 0x08 /* Bit 3: Framing error */
|
||||
#define EZ80_UARTLSR_PE 0x04 /* Bit 2: Parity error */
|
||||
#define EZ80_UARTLSR_OE 0x02 /* Bit 1: Overrun error */
|
||||
#define EZ80_UARTLSR_DR 0x01 /* Bit 0: Data ready */
|
||||
|
||||
/* UART0/1 MSR register bits ********************************************************/
|
||||
|
||||
#define EZ80_UARTMSR_DCD 0x80 /* Bit 7: Data carrier detect */
|
||||
#define EZ80_UARTMSR_RI 0x40 /* Bit 6: Ring indicator */
|
||||
#define EZ80_UARTMSR_DSR 0x20 /* Bit 5: Data set ready */
|
||||
#define EZ80_UARTMSR_CTS 0x10 /* Bit 4: Clear to send */
|
||||
#define EZ80_UARTMSR_DDCD 0x08 /* Bit 3: Delta on DCD input */
|
||||
#define EZ80_UARTMSR_TERI 0x04 /* Bit 2: Trailing edge change on RI */
|
||||
#define EZ80_UARTMSR_DDSR 0x02 /* Bit 1: Delta on DSR input */
|
||||
#define EZ80_UARTMSR_DCTS 0x01 /* Bit 0: Delta on CTS input */
|
||||
|
||||
/************************************************************************************
|
||||
* Public Function Prototypes
|
||||
************************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
#ifdef __cplusplus
|
||||
#define EXTERN extern "C"
|
||||
extern "C" {
|
||||
#else
|
||||
#define EXTERN extern
|
||||
#endif
|
||||
|
||||
#undef EXTERN
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif /* __EZ80_CHIP_H */
|
||||
79
arch/z80/src/ez80/ez80_copystate.c
Normal file
79
arch/z80/src/ez80/ez80_copystate.c
Normal file
@@ -0,0 +1,79 @@
|
||||
/****************************************************************************
|
||||
* arch/z80/src/ez80/ez80_copystate.c
|
||||
*
|
||||
* Copyright (C) 2008 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <arch/irq.h>
|
||||
|
||||
#include "chip/switch.h"
|
||||
#include "os_internal.h"
|
||||
#include "up_internal.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: ez80_copystate
|
||||
****************************************************************************/
|
||||
|
||||
/* Maybe a little faster than most memcpy's */
|
||||
|
||||
void ez80_copystate(chipreg_t *dest, const chipreg_t *src)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < XCPTCONTEXT_REGS; i++)
|
||||
{
|
||||
*dest++ = *src++;
|
||||
}
|
||||
}
|
||||
|
||||
92
arch/z80/src/ez80/ez80_initialstate.c
Normal file
92
arch/z80/src/ez80/ez80_initialstate.c
Normal file
@@ -0,0 +1,92 @@
|
||||
/****************************************************************************
|
||||
* arch/z80/src/ez80/ez80_initialstate.c
|
||||
*
|
||||
* Copyright (C) 2008 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <string.h>
|
||||
#include <nuttx/arch.h>
|
||||
|
||||
#include "chip/chip.h"
|
||||
#include "up_internal.h"
|
||||
#include "up_arch.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Private Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_initial_state
|
||||
*
|
||||
* Description:
|
||||
* A new thread is being started and a new TCB
|
||||
* has been created. This function is called to initialize
|
||||
* the processor specific portions of the new TCB.
|
||||
*
|
||||
* This function must setup the intial architecture registers
|
||||
* and/or stack so that execution will begin at tcb->start
|
||||
* on the next context switch.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void up_initial_state(_TCB *tcb)
|
||||
{
|
||||
struct xcptcontext *xcp = &tcb->xcp;
|
||||
|
||||
/* Initialize the initial exception register context structure */
|
||||
|
||||
memset(xcp, 0, sizeof(struct xcptcontext));
|
||||
#ifndef CONFIG_SUPPRESS_INTERRUPTS
|
||||
((ubyte*)xcp->regs)[XCPT_IF_OFFSET] = EZ80_PV_FLAG; /* Parity/Overflow flag will enable interrupts */
|
||||
#endif
|
||||
xcp->regs[XCPT_SP] = (chipreg_t)tcb->adj_stack_ptr;
|
||||
xcp->regs[XCPT_PC] = (chipreg_t)tcb->start;
|
||||
}
|
||||
154
arch/z80/src/ez80/ez80_io.asm
Normal file
154
arch/z80/src/ez80/ez80_io.asm
Normal file
@@ -0,0 +1,154 @@
|
||||
;**************************************************************************
|
||||
; arch/z80/src/ze80/ez80_io.c
|
||||
;
|
||||
; Copyright (C) 2008 Gregory Nutt. All rights reserved.
|
||||
; Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
;
|
||||
; Redistribution and use in source and binary forms, with or without
|
||||
; modification, are permitted provided that the following conditions
|
||||
; are met:
|
||||
;
|
||||
; 1. Redistributions of source code must retain the above copyright
|
||||
; notice, this list of conditions and the following disclaimer.
|
||||
; 2. Redistributions in binary form must reproduce the above copyright
|
||||
; notice, this list of conditions and the following disclaimer in
|
||||
; the documentation and/or other materials provided with the
|
||||
; distribution.
|
||||
; 3. Neither the name NuttX nor the names of its contributors may be
|
||||
; used to endorse or promote products derived from this software
|
||||
; without specific prior written permission.
|
||||
;
|
||||
; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
; "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
; LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
; FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
; COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
; INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
; BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
; OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
; AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
; LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
; ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
; POSSIBILITY OF SUCH DAMAGE.
|
||||
;
|
||||
;**************************************************************************
|
||||
|
||||
;**************************************************************************
|
||||
; Global Symbols Imported
|
||||
;**************************************************************************
|
||||
|
||||
;**************************************************************************
|
||||
; Global Symbols Expported
|
||||
;**************************************************************************
|
||||
|
||||
xdef _outp
|
||||
xdef _inp
|
||||
|
||||
;**************************************************************************
|
||||
; Global Symbols Expported
|
||||
;**************************************************************************
|
||||
|
||||
CONFIG_EZ80_Z80MODE equ 0
|
||||
|
||||
;**************************************************************************
|
||||
; Code
|
||||
;**************************************************************************
|
||||
|
||||
segment CODE
|
||||
.assume ADL=1
|
||||
|
||||
;**************************************************************************
|
||||
; Name: void outp(uint16 p, ubyte c)
|
||||
;
|
||||
; Description:
|
||||
; Output byte c on port p
|
||||
;
|
||||
;**************************************************************************
|
||||
|
||||
_outp:
|
||||
; Create a stack frame
|
||||
|
||||
push ix
|
||||
ld ix, #0
|
||||
add ix, sp
|
||||
|
||||
; Get the arguments from the stack
|
||||
|
||||
.if CONFIG_EZ80_Z80MODE
|
||||
; Stack looks like:
|
||||
;
|
||||
; 7-8 Unused
|
||||
; 6 Value
|
||||
; 4-5 Port
|
||||
; 2-3 Return address
|
||||
; SP: 0-1 Caller's fame pointer
|
||||
|
||||
ld bc, (ix + 4) ; Port
|
||||
ld a, (ix + 6) ; Value
|
||||
|
||||
.else
|
||||
; Stack looks like:
|
||||
;
|
||||
; 10-11 Unused
|
||||
; 9 Value
|
||||
; 8 Unused
|
||||
; 6-7 Port
|
||||
; 3-5 Return address
|
||||
; SP: 0-2 Caller's frame pointer
|
||||
|
||||
ld bc, (ix + 6) ; Port (upper 8 bits not used)
|
||||
ld a, (ix + 9) ; Value
|
||||
|
||||
.endif
|
||||
|
||||
; Output the specified by to the specified 8-bit I/O address
|
||||
|
||||
out (bc), a
|
||||
pop ix
|
||||
ret
|
||||
|
||||
;**************************************************************************
|
||||
; Name: ubyte inp(uint16 p)
|
||||
;
|
||||
; Description:
|
||||
; Input byte from port p
|
||||
;
|
||||
;**************************************************************************
|
||||
|
||||
_inp:
|
||||
; Create a stack frame
|
||||
|
||||
push ix
|
||||
ld ix, #0
|
||||
add ix, sp
|
||||
|
||||
; Get the arguments from the stack
|
||||
|
||||
.if CONFIG_EZ80_Z80MODE
|
||||
; Stack looks like:
|
||||
;
|
||||
; 4-5 Port
|
||||
; 2-3 Return address
|
||||
; SP: 0-1 Caller's fame pointer
|
||||
|
||||
ld bc, (ix + 4) ; Port
|
||||
|
||||
.else
|
||||
; Stack looks like:
|
||||
;
|
||||
; 8 Unused
|
||||
; 6-7 Port
|
||||
; 3-5 Return address
|
||||
; SP: 0-2 Caller's frame pointer
|
||||
|
||||
ld bc, (ix + 6) ; Port (upper 8 bits not used)
|
||||
|
||||
.endif
|
||||
|
||||
; Return port value in A
|
||||
|
||||
in a, (bc)
|
||||
pop ix
|
||||
ret
|
||||
|
||||
end
|
||||
125
arch/z80/src/ez80/ez80_irq.c
Normal file
125
arch/z80/src/ez80/ez80_irq.c
Normal file
@@ -0,0 +1,125 @@
|
||||
/****************************************************************************
|
||||
* arch/z80/src/ez80/ez80_irq.c
|
||||
*
|
||||
* Copyright (C) 2008 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/irq.h>
|
||||
|
||||
#include "chip/switch.h"
|
||||
#include "up_internal.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Private Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
/* This holds a references to the current interrupt level register storage
|
||||
* structure. If is non-NULL only during interrupt processing.
|
||||
*/
|
||||
|
||||
chipreg_t *current_regs;
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_irqinitialize
|
||||
****************************************************************************/
|
||||
|
||||
void up_irqinitialize(void)
|
||||
{
|
||||
current_regs = NULL;
|
||||
|
||||
/* And finally, enable interrupts */
|
||||
|
||||
#ifndef CONFIG_SUPPRESS_INTERRUPTS
|
||||
asm("ei");
|
||||
#endif
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_disable_irq
|
||||
*
|
||||
* Description:
|
||||
* On many architectures, there are three levels of interrupt enabling: (1)
|
||||
* at the global level, (2) at the level of the interrupt controller,
|
||||
* and (3) at the device level. In order to receive interrupts, they
|
||||
* must be enabled at all three levels.
|
||||
*
|
||||
* This function implements disabling of the device specified by 'irq'
|
||||
* at the interrupt controller level if supported by the architecture
|
||||
* (irqsave() supports the global level, the device level is hardware
|
||||
* specific).
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void up_disable_irq(int irq)
|
||||
{
|
||||
/* There are no ez80 interrupt controller settings to disable IRQs */
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_enable_irq
|
||||
*
|
||||
* Description:
|
||||
* This function implements enabling of the device specified by 'irq'
|
||||
* at the interrupt controller level if supported by the architecture
|
||||
* (irqsave() supports the global level, the device level is hardware
|
||||
* specific).
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void up_enable_irq(int irq)
|
||||
{
|
||||
/* There are no ez80 interrupt controller settings to enable IRQs */
|
||||
}
|
||||
88
arch/z80/src/ez80/ez80_irqsave.asm
Normal file
88
arch/z80/src/ez80/ez80_irqsave.asm
Normal file
@@ -0,0 +1,88 @@
|
||||
;**************************************************************************
|
||||
; arch/z80/src/ez80/ez80_irqsave.asm
|
||||
;
|
||||
; Copyright (C) 2008 Gregory Nutt. All rights reserved.
|
||||
; Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
;
|
||||
; Redistribution and use in source and binary forms, with or without
|
||||
; modification, are permitted provided that the following conditions
|
||||
; are met:
|
||||
;
|
||||
; 1. Redistributions of source code must retain the above copyright
|
||||
; notice, this list of conditions and the following disclaimer.
|
||||
; 2. Redistributions in binary form must reproduce the above copyright
|
||||
; notice, this list of conditions and the following disclaimer in
|
||||
; the documentation and/or other materials provided with the
|
||||
; distribution.
|
||||
; 3. Neither the name NuttX nor the names of its contributors may be
|
||||
; used to endorse or promote products derived from this software
|
||||
; without specific prior written permission.
|
||||
;
|
||||
; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
; "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
; LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
; FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
; COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
; INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
; BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
; OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
; AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
; LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
; ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
; POSSIBILITY OF SUCH DAMAGE.
|
||||
;
|
||||
;**************************************************************************
|
||||
|
||||
;**************************************************************************
|
||||
; Global Symbols Imported
|
||||
;**************************************************************************
|
||||
|
||||
;**************************************************************************
|
||||
; Global Symbols Expported
|
||||
;**************************************************************************
|
||||
|
||||
xdef _irqsave
|
||||
xdef _irqrestore
|
||||
|
||||
;**************************************************************************
|
||||
; Code
|
||||
;**************************************************************************
|
||||
|
||||
segment CODE
|
||||
.assume ADL=1
|
||||
|
||||
;**************************************************************************
|
||||
;* Name: irqstate_t irqsave(void)
|
||||
;*
|
||||
;* Description:
|
||||
;* Disable all interrupts; return previous interrupt state
|
||||
;*
|
||||
;**************************************************************************
|
||||
|
||||
_irqsave:
|
||||
ld a, i ; AF = interrupt state
|
||||
di ; Interrupts are disabled (does not affect F)
|
||||
push af ; Transfer to HL via the stack
|
||||
pop hl ;
|
||||
ret ; And return
|
||||
|
||||
;**************************************************************************
|
||||
;* Name: void irqrestore(irqstate_t flags)
|
||||
;*
|
||||
;* Description:
|
||||
;* Restore previous interrupt state
|
||||
;*
|
||||
;**************************************************************************
|
||||
|
||||
_irqrestore:
|
||||
di ; Assume disabled
|
||||
pop hl ; HL = return address
|
||||
pop af ; AF Parity bit holds interrupt state
|
||||
jp po, _disabled ; Skip over re-enable if Parity odd
|
||||
ei ; Re-enable interrupts
|
||||
_disabled:
|
||||
push af ; Restore stack
|
||||
push hl ;
|
||||
ret ; and return
|
||||
|
||||
end
|
||||
191
arch/z80/src/ez80/ez80_lowuart.c
Normal file
191
arch/z80/src/ez80/ez80_lowuart.c
Normal file
@@ -0,0 +1,191 @@
|
||||
/****************************************************************************
|
||||
* arch/z80/src/ez80/ez80_loweruart.c
|
||||
*
|
||||
* Copyright (C) 2008 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <arch/io.h>
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/sched.h>
|
||||
|
||||
#include "chip/chip.h"
|
||||
#include "common/up_internal.h"
|
||||
|
||||
#ifdef CONFIG_USE_LOWUARTINIT
|
||||
|
||||
/****************************************************************************
|
||||
* Private Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* The system clock frequency is defined in the linkcmd file */
|
||||
|
||||
extern unsigned long SYS_CLK_FREQ;
|
||||
#define _DEFCLK ((unsigned long)&SYS_CLK_FREQ)
|
||||
|
||||
#ifdef CONFIG_UART0_SERIAL_CONSOLE
|
||||
# define ez80_inp(offs) inp((EZ80_UART0_BASE+(offs)))
|
||||
# define ez80_outp(offs,val) outp((EZ80_UART0_BASE+(offs)), (val))
|
||||
# define CONFIG_UART_BAUD CONFIG_UART0_BAUD
|
||||
# if CONFIG_UART0_BITS == 7
|
||||
# define CONFIG_UART_BITS EZ80_UARTCHAR_7BITS
|
||||
# else
|
||||
# define CONFIG_UART_BITS EZ80_UARTCHAR_8BITS
|
||||
# endif
|
||||
# if CONFIG_UART0_2STOP != 0
|
||||
# define CONFIG_UART_2STOP EZ80_UARTLCTl_2STOP
|
||||
# else
|
||||
# define CONFIG_UART_2STOP 0
|
||||
# endif
|
||||
# if CONFIG_UART0_PARITY == 1 /* Odd parity */
|
||||
# define CONFIG_UART_PARITY EZ80_UARTLCTL_PEN
|
||||
# elif CONFIG_UART0_PARITY == 2 /* Even parity */
|
||||
# define CONFIG_UART_PARITY (EZ80_UARTLCTL_PEN|EZ80_UARTLCTL_EPS)
|
||||
# else
|
||||
# define CONFIG_UART_PARITY 0
|
||||
# endif
|
||||
#else
|
||||
# define ez80_inp(offs) inp((EZ80_UART1_BASE+(offs)))
|
||||
# define ez80_outp(offs.val) outp((EZ80_UART1_BASE+(offs)), (val))
|
||||
# define CONFIG_UART_BAUD CONFIG_UART1_BAUD
|
||||
# if CONFIG_UART1_BITS == 7
|
||||
# define CONFIG_UART_BITS EZ80_UARTCHAR_7BITS
|
||||
# else
|
||||
# define CONFIG_UART_BITS EZ80_UARTCHAR_8BITS
|
||||
# endif
|
||||
# if CONFIG_UART1_2STOP != 0
|
||||
# define CONFIG_UART_2STOP EZ80_UARTLCTl_2STOP
|
||||
# else
|
||||
# define CONFIG_UART_2STOP 0
|
||||
# endif
|
||||
# if CONFIG_UART1_PARITY == 1 /* Odd parity */
|
||||
# define CONFIG_UART_PARITY EZ80_UARTLCTL_PEN
|
||||
# elif CONFIG_UART1_PARITY == 2 /* Even parity */
|
||||
# define CONFIG_UART_PARITY (EZ80_UARTLCTL_PEN|EZ80_UARTLCTL_EPS)
|
||||
# else
|
||||
# define CONFIG_UART_PARITY 0
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef CONFIG_SUPPRESS_UART_CONFIG
|
||||
static void ez80_setbaud(void)
|
||||
{
|
||||
uint24 brg_divisor;
|
||||
ubyte lctl;
|
||||
|
||||
/* The resulting BAUD and depends on the system clock frequency and the
|
||||
* BRG divisor as follows:
|
||||
*
|
||||
* BAUD = SYSTEM_CLOCK_FREQUENCY / (16 * BRG_Divisor)
|
||||
*
|
||||
* Or
|
||||
*
|
||||
* BRG_Divisor = SYSTEM_CLOCK_FREQUENCY / 16 / BAUD
|
||||
*/
|
||||
|
||||
brg_divisor = ( _DEFCLK + (CONFIG_UART_BAUD << 3)) / (CONFIG_UART_BAUD << 4);
|
||||
|
||||
/* Set the DLAB bit to enable access to the BRG registers */
|
||||
|
||||
lctl = ez80_inp(EZ80_UART_LCTL);
|
||||
lctl |= EZ80_UARTLCTL_DLAB;
|
||||
ez80_outp(EZ80_UART_LCTL, lctl);
|
||||
|
||||
ez80_outp(EZ80_UART_BRGL, (ubyte)(brg_divisor & 0xff));
|
||||
ez80_outp(EZ80_UART_BRGH, (ubyte)(brg_divisor >> 8));
|
||||
|
||||
lctl &= ~EZ80_UARTLCTL_DLAB;
|
||||
ez80_outp(EZ80_UART_LCTL, lctl);
|
||||
}
|
||||
#endif /* CONFIG_SUPPRESS_UART_CONFIG */
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_lowuartinit
|
||||
****************************************************************************/
|
||||
|
||||
void up_lowuartinit(void)
|
||||
{
|
||||
#ifndef CONFIG_SUPPRESS_UART_CONFIG
|
||||
ubyte reg;
|
||||
|
||||
/* Disable interrupts from the UART */
|
||||
|
||||
reg = ez80_inp(EZ80_UART_IER);
|
||||
reg &= ~EZ80_UARTEIR_INTMASK;
|
||||
ez80_outp(EZ80_UART_IER, reg);
|
||||
|
||||
/* Set the baud rate */
|
||||
|
||||
ez80_setbaud();
|
||||
ez80_outp(EZ80_UART_MCTL, 0);
|
||||
|
||||
/* Set the character properties */
|
||||
|
||||
reg = ez80_inp(EZ80_UART_LCTL);
|
||||
reg &= ~EZ80_UARTLCTL_MASK;
|
||||
reg |= (CONFIG_UART_BITS | CONFIG_UART_2STOP | CONFIG_UART_PARITY);
|
||||
ez80_outp(EZ80_UART_LCTL, reg);
|
||||
|
||||
/* Enable and flush the receive FIFO */
|
||||
|
||||
reg = EZ80_UARTFCTL_FIFOEN;
|
||||
ez80_outp(EZ80_UART_FCTL, reg);
|
||||
reg |= (EZ80_UARTFCTL_CLRTxF|EZ80_UARTFCTL_CLRRxF);
|
||||
ez80_outp(EZ80_UART_FCTL, reg);
|
||||
|
||||
/* Set the receive trigger level to 1 */
|
||||
|
||||
reg |= EZ80_UARTTRIG_1;
|
||||
ez80_outp(EZ80_UART_FCTL, reg);
|
||||
#endif /* CONFIG_SUPPRESS_UART_CONFIG */
|
||||
}
|
||||
#endif /* CONFIG_USE_LOWUARTINIT */
|
||||
103
arch/z80/src/ez80/ez80_registerdump.c
Normal file
103
arch/z80/src/ez80/ez80_registerdump.c
Normal file
@@ -0,0 +1,103 @@
|
||||
/****************************************************************************
|
||||
* arch/z80/src/ez80/ez80_registerdump.c
|
||||
*
|
||||
* Copyright (C) 2008 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/irq.h>
|
||||
#include <nuttx/arch.h>
|
||||
|
||||
#include "chip/switch.h"
|
||||
#include "os_internal.h"
|
||||
#include "up_internal.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* Output debug info if stack dump is selected -- even if
|
||||
* debug is not selected.
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_ARCH_STACKDUMP
|
||||
# undef lldbg
|
||||
# define lldbg lib_lowprintf
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: z80_registerdump
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_ARCH_STACKDUMP
|
||||
static void ez80_registerdump(void)
|
||||
{
|
||||
if (current_regs)
|
||||
{
|
||||
#ifdef CONFIG_EZ80_Z80MODE
|
||||
lldbg("AF: %04x I: %04x\n",
|
||||
current_regs[XCPT_AF], current_regs[XCPT_I]);
|
||||
lldbg("BC: %04x DE: %04x HL: %04x\n",
|
||||
current_regs[XCPT_BC], current_regs[XCPT_DE], current_regs[XCPT_HL]);
|
||||
lldbg("IX: %04x IY: %04x\n",
|
||||
current_regs[XCPT_IX], current_regs[XCPT_IY]);
|
||||
lldbg("SP: %04x PC: %04x\n"
|
||||
current_regs[XCPT_SP], current_regs[XCPT_PC]);
|
||||
#else
|
||||
lldbg("AF: %06x I: %06x\n",
|
||||
current_regs[XCPT_AF], current_regs[XCPT_I]);
|
||||
lldbg("BC: %06x DE: %06x HL: %06x\n",
|
||||
current_regs[XCPT_BC], current_regs[XCPT_DE], current_regs[XCPT_HL]);
|
||||
lldbg("IX: %06x IY: %06x\n",
|
||||
current_regs[XCPT_IX], current_regs[XCPT_IY]);
|
||||
lldbg("SP: %06x PC: %06x\n"
|
||||
current_regs[XCPT_SP], current_regs[XCPT_PC]);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#endif
|
||||
110
arch/z80/src/ez80/ez80_restorecontext.asm
Normal file
110
arch/z80/src/ez80/ez80_restorecontext.asm
Normal file
@@ -0,0 +1,110 @@
|
||||
;**************************************************************************
|
||||
; arch/z80/src/ez80/ez80_restorcontext.asm
|
||||
;
|
||||
; Copyright (C) 2008 Gregory Nutt. All rights reserved.
|
||||
; Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
;
|
||||
; Redistribution and use in source and binary forms, with or without
|
||||
; modification, are permitted provided that the following conditions
|
||||
; are met:
|
||||
;
|
||||
; 1. Redistributions of source code must retain the above copyright
|
||||
; notice, this list of conditions and the following disclaimer.
|
||||
; 2. Redistributions in binary form must reproduce the above copyright
|
||||
; notice, this list of conditions and the following disclaimer in
|
||||
; the documentation and/or other materials provided with the
|
||||
; distribution.
|
||||
; 3. Neither the name NuttX nor the names of its contributors may be
|
||||
; used to endorse or promote products derived from this software
|
||||
; without specific prior written permission.
|
||||
;
|
||||
; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
; "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
; LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
; FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
; COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
; INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
; BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
; OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
; AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
; LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
; ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
; POSSIBILITY OF SUCH DAMAGE.
|
||||
;
|
||||
;**************************************************************************
|
||||
|
||||
;**************************************************************************
|
||||
; Global Symbols Imported
|
||||
;**************************************************************************
|
||||
|
||||
;**************************************************************************
|
||||
; Global Symbols Expported
|
||||
;**************************************************************************
|
||||
|
||||
xdef _ez80_restorecontext
|
||||
|
||||
;**************************************************************************
|
||||
; Code
|
||||
;**************************************************************************
|
||||
|
||||
segment CODE
|
||||
.assume ADL=1
|
||||
|
||||
;**************************************************************************
|
||||
; ez80_restorecontext
|
||||
;**************************************************************************
|
||||
|
||||
_ez80_restorecontext:
|
||||
; On entry, stack contains return address (not used), then address
|
||||
; of the register save structure
|
||||
|
||||
; Discard the return address, we won't be returning
|
||||
|
||||
pop hl
|
||||
|
||||
; Get the address of the beginning of the state save area. Each
|
||||
; pop will increment to the next element of the structure
|
||||
|
||||
pop hl ; BC = Address of save structure
|
||||
ld sp, hl ; SP points to top of storage area
|
||||
|
||||
; Disable interrupts while we muck with the alternative registers. The
|
||||
; Correct interrupt state will be restore below
|
||||
|
||||
di
|
||||
|
||||
; Restore registers. HL points to the beginning of the reg structure to restore
|
||||
|
||||
ex af, af' ; Select alternate AF
|
||||
pop af ; Offset 0: AF' = I with interrupt state in carry
|
||||
ex af, af' ; Restore original AF
|
||||
pop bc ; Offset 1: BC
|
||||
pop de ; Offset 2: DE
|
||||
pop ix ; Offset 3: IX
|
||||
pop iy ; Offset 4: IY
|
||||
exx ; Use alternate BC/DE/HL
|
||||
pop hl ; Offset 5: HL' = Stack pointer after return
|
||||
exx ; Restore original BC/DE/HL
|
||||
pop hl ; Offset 6: HL
|
||||
pop af ; Offset 7: AF
|
||||
|
||||
; Restore the stack pointer
|
||||
|
||||
exx ; Use alternate BC/DE/HL
|
||||
pop de ; DE' = return address
|
||||
ld sp, hl ; Set SP = saved stack pointer value before return
|
||||
push de ; Save return address for ret instruction
|
||||
exx ; Restore original BC/DE/HL
|
||||
|
||||
; Restore interrupt state
|
||||
|
||||
ex af, af' ; Recover interrupt state
|
||||
jp po, noinrestore ; No parity, IFF2=0, means disabled
|
||||
ex af, af' ; Restore AF (before enabling interrupts)
|
||||
ei ; yes.. Enable interrupts
|
||||
ret ; and return
|
||||
noinrestore:
|
||||
ex af, af' ; Restore AF
|
||||
ret ; Return with interrupts disabled
|
||||
end
|
||||
|
||||
172
arch/z80/src/ez80/ez80_saveusercontext.asm
Normal file
172
arch/z80/src/ez80/ez80_saveusercontext.asm
Normal file
@@ -0,0 +1,172 @@
|
||||
;*************************************************************************
|
||||
; arch/z80/src/ez80/ez80_saveusercontext.asm
|
||||
;
|
||||
; Copyright (C) 2008 Gregory Nutt. All rights reserved.
|
||||
; Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
;
|
||||
; Redistribution and use in source and binary forms, with or without
|
||||
; modification, are permitted provided that the following conditions
|
||||
; are met:
|
||||
;
|
||||
; 1. Redistributions of source code must retain the above copyright
|
||||
; notice, this list of conditions and the following disclaimer.
|
||||
; 2. Redistributions in binary form must reproduce the above copyright
|
||||
; notice, this list of conditions and the following disclaimer in
|
||||
; the documentation and/or other materials provided with the
|
||||
; distribution.
|
||||
; 3. Neither the name NuttX nor the names of its contributors may be
|
||||
; used to endorse or promote products derived from this software
|
||||
; without specific prior written permission.
|
||||
;
|
||||
; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
; "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
; LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
; FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
; COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
; INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
; BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
; OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
; AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
; LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
; ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
; POSSIBILITY OF SUCH DAMAGE.
|
||||
;
|
||||
;*************************************************************************
|
||||
|
||||
;**************************************************************************
|
||||
; Global Symbols Imported
|
||||
;**************************************************************************
|
||||
|
||||
;**************************************************************************
|
||||
; Global Symbols Expported
|
||||
;**************************************************************************
|
||||
|
||||
xdef _ez80_saveusercontext
|
||||
|
||||
;*************************************************************************
|
||||
; Constants
|
||||
;*************************************************************************
|
||||
|
||||
CONFIG_EZ80_Z80MODE equ 0
|
||||
|
||||
.if CONFIG_EZ80_Z80MODE
|
||||
; Register save area layout
|
||||
|
||||
XCPT_I equ 2*0 ; Offset 0: Saved I w/interrupt state in carry
|
||||
XCPT_BC equ 2*1 ; Offset 1: Saved BC register
|
||||
XCPT_DE equ 2*2 ; Offset 2: Saved DE register
|
||||
XCPT_IX equ 2*3 ; Offset 3: Saved IX register
|
||||
XCPT_IY equ 2*4 ; Offset 4: Saved IY register
|
||||
XCPT_SP equ 2*5 ; Offset 5: Offset to SP at time of interrupt
|
||||
XCPT_HL equ 2*6 ; Offset 6: Saved HL register
|
||||
XCPT_AF equ 2*7 ; Offset 7: Saved AF register
|
||||
XCPT_PC equ 2*8 ; Offset 8: Offset to PC at time of interrupt
|
||||
|
||||
; Stack frame
|
||||
|
||||
FRAME_IY equ 2*0 ; Location of IY on the stack
|
||||
FRAME_IX equ 2*1 ; Location of IX on the stack
|
||||
FRAME_RET equ 2*2 ; Location of return address on the stack
|
||||
FRAME_REGS equ 2*3 ; Location of reg save area on stack
|
||||
|
||||
SP_OFFSET equ 2*3
|
||||
.else
|
||||
; Register save area layout
|
||||
|
||||
XCPT_I equ 3*0 ; Offset 0: Saved I w/interrupt state in carry
|
||||
XCPT_BC equ 3*1 ; Offset 1: Saved BC register
|
||||
XCPT_DE equ 3*2 ; Offset 2: Saved DE register
|
||||
XCPT_IX equ 3*3 ; Offset 3: Saved IX register
|
||||
XCPT_IY equ 3*4 ; Offset 4: Saved IY register
|
||||
XCPT_SP equ 3*5 ; Offset 5: Offset to SP at time of interrupt
|
||||
XCPT_HL equ 3*6 ; Offset 6: Saved HL register
|
||||
XCPT_AF equ 3*7 ; Offset 7: Saved AF register
|
||||
XCPT_PC equ 3*8 ; Offset 8: Offset to PC at time of interrupt .endif
|
||||
|
||||
; Stack frame
|
||||
|
||||
FRAME_IY equ 3*0 ; Location of IY on the stack
|
||||
FRAME_IX equ 3*1 ; Location of IX on the stack
|
||||
FRAME_RET equ 3*2 ; Location of return address on the stack
|
||||
FRAME_REGS equ 3*3 ; Location of reg save area on stack
|
||||
|
||||
SP_OFFSET equ 3*3
|
||||
.endif
|
||||
|
||||
;**************************************************************************
|
||||
; Code
|
||||
;**************************************************************************
|
||||
|
||||
segment CODE
|
||||
.assume ADL=1
|
||||
|
||||
;*************************************************************************
|
||||
; Name: z80_saveusercontext
|
||||
;*************************************************************************
|
||||
|
||||
_ez80_saveusercontext:
|
||||
; Set up a stack frame
|
||||
|
||||
push ix ; Save IX and IY
|
||||
push iy
|
||||
ld ix, #0
|
||||
add ix, sp ; IX = stack frame
|
||||
|
||||
; Fetch the address of the save area
|
||||
|
||||
ld de, (ix + FRAME_REGS) ; DE = save area address
|
||||
ld iy, #0
|
||||
add iy, de ; IY = save area address
|
||||
|
||||
; Then save the registers
|
||||
|
||||
; Save the current interrupt state at offset 0
|
||||
|
||||
ld a, i ; Get interrupt state
|
||||
push af
|
||||
pop hl
|
||||
ld (iy + XCPT_I), hl ; Index 0: I w/interrupt state in parity/overflow
|
||||
|
||||
; Save BC at offset 1
|
||||
|
||||
ld (iy + XCPT_BC), bc ; Index 1: BC
|
||||
|
||||
; DE is not preserved (Index 2)
|
||||
|
||||
; Save IX at offset 3
|
||||
|
||||
ld hl, (ix + FRAME_IX) ; HL = Saved alue of IX
|
||||
ld (iy + XCPT_IX), hl ; Index 3: IX
|
||||
|
||||
; Save IY at index 4
|
||||
|
||||
ld hl, (ix + FRAME_IY) ; HL = Saved value of IY
|
||||
ld (iy + XCPT_IY), hl ; Index 4: IY
|
||||
|
||||
; Save that stack pointer as it would be upon return in offset 5
|
||||
|
||||
ld hl, #SP_OFFSET ; Value of stack pointer on return
|
||||
add hl, sp
|
||||
ld (iy + XCPT_SP), hl ; Index 5 SP
|
||||
|
||||
; HL is saved as the value 1 at offset 6
|
||||
|
||||
ld hl, #1
|
||||
ld (iy + XCPT_HL), hl ; Index 2: HL on return (=1)
|
||||
|
||||
; AF is not preserved (offset 7)
|
||||
|
||||
; Save the return address at index 8
|
||||
|
||||
ld hl, (ix + FRAME_RET) ; HL = Saved return address
|
||||
ld (iy + XCPT_PC), hl ; Index 8: PC
|
||||
|
||||
; Return the value 0
|
||||
|
||||
ld hl, #0
|
||||
|
||||
pop iy
|
||||
pop ix
|
||||
ret
|
||||
end
|
||||
|
||||
192
arch/z80/src/ez80/ez80_schedulesigaction.c
Normal file
192
arch/z80/src/ez80/ez80_schedulesigaction.c
Normal file
@@ -0,0 +1,192 @@
|
||||
/****************************************************************************
|
||||
* arch/z80/src/ez80/ez80_schedulesigaction.c
|
||||
*
|
||||
* Copyright (C) 2008 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sched.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/arch.h>
|
||||
#include <arch/irq.h>
|
||||
|
||||
#include "chip/switch.h"
|
||||
#include "os_internal.h"
|
||||
#include "up_internal.h"
|
||||
|
||||
#ifndef CONFIG_DISABLE_SIGNALS
|
||||
|
||||
/****************************************************************************
|
||||
* Private Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: ez80_sigsetup
|
||||
****************************************************************************/
|
||||
|
||||
static void ez80_sigsetup(FAR _TCB *tcb, sig_deliver_t sigdeliver, FAR chipreg_t *regs)
|
||||
{
|
||||
/* Save the return address and interrupt state. These will be restored by
|
||||
* the signal trampoline after the signals have been delivered.
|
||||
*/
|
||||
|
||||
tcb->xcp.sigdeliver = sigdeliver;
|
||||
tcb->xcp.saved_pc = regs[XCPT_PC];
|
||||
tcb->xcp.saved_i = regs[XCPT_I];
|
||||
|
||||
/* Then set up to vector to the trampoline with interrupts disabled */
|
||||
|
||||
regs[XCPT_PC] = (chipreg_t)up_sigdeliver;
|
||||
regs[XCPT_I] = 0;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_schedule_sigaction
|
||||
*
|
||||
* Description:
|
||||
* This function is called by the OS when one or more
|
||||
* signal handling actions have been queued for execution.
|
||||
* The architecture specific code must configure things so
|
||||
* that the 'igdeliver' callback is executed on the thread
|
||||
* specified by 'tcb' as soon as possible.
|
||||
*
|
||||
* This function may be called from interrupt handling logic.
|
||||
*
|
||||
* This operation should not cause the task to be unblocked
|
||||
* nor should it cause any immediate execution of sigdeliver.
|
||||
* Typically, a few cases need to be considered:
|
||||
*
|
||||
* (1) This function may be called from an interrupt handler
|
||||
* During interrupt processing, all xcptcontext structures
|
||||
* should be valid for all tasks. That structure should
|
||||
* be modified to invoke sigdeliver() either on return
|
||||
* from (this) interrupt or on some subsequent context
|
||||
* switch to the recipient task.
|
||||
* (2) If not in an interrupt handler and the tcb is NOT
|
||||
* the currently executing task, then again just modify
|
||||
* the saved xcptcontext structure for the recipient
|
||||
* task so it will invoke sigdeliver when that task is
|
||||
* later resumed.
|
||||
* (3) If not in an interrupt handler and the tcb IS the
|
||||
* currently executing task -- just call the signal
|
||||
* handler now.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void up_schedule_sigaction(FAR _TCB *tcb, sig_deliver_t sigdeliver)
|
||||
{
|
||||
dbg("tcb=0x%p sigdeliver=0x%04x\n", tcb, (uint16)sigdeliver);
|
||||
|
||||
/* Refuse to handle nested signal actions */
|
||||
|
||||
if (tcb->xcp.sigdeliver == NULL)
|
||||
{
|
||||
irqstate_t flags;
|
||||
|
||||
/* Make sure that interrupts are disabled */
|
||||
|
||||
flags = irqsave();
|
||||
|
||||
/* First, handle some special cases when the signal is being delivered
|
||||
* to the currently executing task.
|
||||
*/
|
||||
|
||||
if (tcb == (FAR _TCB*)g_readytorun.head)
|
||||
{
|
||||
/* CASE 1: We are not in an interrupt handler and a task is
|
||||
* signalling itself for some reason.
|
||||
*/
|
||||
|
||||
if (!IN_INTERRUPT())
|
||||
{
|
||||
/* In this case just deliver the signal now. */
|
||||
|
||||
sigdeliver(tcb);
|
||||
}
|
||||
|
||||
/* CASE 2: We are in an interrupt handler AND the interrupted task
|
||||
* is the same as the one that must receive the signal, then we
|
||||
* will have to modify the return state as well as the state in
|
||||
* the TCB.
|
||||
*/
|
||||
|
||||
else
|
||||
{
|
||||
/* Set up to vector to the trampoline with interrupts disabled. */
|
||||
|
||||
ez80_sigsetup(tcb, sigdeliver, IRQ_STATE());
|
||||
|
||||
/* And make sure that the saved context in the TCB
|
||||
* is the same as the interrupt return context.
|
||||
*/
|
||||
|
||||
SAVE_IRQCONTEXT(tcb);
|
||||
}
|
||||
}
|
||||
|
||||
/* Otherwise, we are (1) signaling a task is not running from an interrupt
|
||||
* handler or (2) we are not in an interrupt handler and the running task
|
||||
* is signalling some non-running task.
|
||||
*/
|
||||
|
||||
else
|
||||
{
|
||||
/* Set up to vector to the trampoline with interrupts disabled. */
|
||||
|
||||
ez80_sigsetup(tcb, sigdeliver, tcb->xcp.regs);
|
||||
}
|
||||
|
||||
irqrestore(flags);
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* CONFIG_DISABLE_SIGNALS */
|
||||
|
||||
778
arch/z80/src/ez80/ez80_serial.c
Normal file
778
arch/z80/src/ez80/ez80_serial.c
Normal file
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user