Compare commits

...

396 Commits

Author SHA1 Message Date
patacongo
e3035d2dff Prep for 0.3.7 release
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@601 42af7a65-404d-4744-a932-0658087f49c3
2008-01-31 23:15:03 +00:00
patacongo
2134001f0f *** empty log message ***
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@600 42af7a65-404d-4744-a932-0658087f49c3
2008-01-31 22:44:19 +00:00
patacongo
aa7ecab89c Function did not match prototype
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@599 42af7a65-404d-4744-a932-0658087f49c3
2008-01-31 22:28:47 +00:00
patacongo
ce50defd4c Fixes for SDCC
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@598 42af7a65-404d-4744-a932-0658087f49c3
2008-01-31 22:25:31 +00:00
patacongo
3dc0fee9ba *** empty log message ***
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@597 42af7a65-404d-4744-a932-0658087f49c3
2008-01-31 22:19:53 +00:00
patacongo
94ef1222d8 ostest result
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@596 42af7a65-404d-4744-a932-0658087f49c3
2008-01-31 22:19:09 +00:00
patacongo
40f92a9da4 Z16F integration changes
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@595 42af7a65-404d-4744-a932-0658087f49c3
2008-01-31 17:59:22 +00:00
patacongo
cb79ddc9a0 fix conditional compilation
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@594 42af7a65-404d-4744-a932-0658087f49c3
2008-01-30 22:33:54 +00:00
patacongo
0a07af9fc7 Recalibrate delay loop
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@593 42af7a65-404d-4744-a932-0658087f49c3
2008-01-30 22:33:00 +00:00
patacongo
1358cc1911 Fix z16f addressing issues
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@592 42af7a65-404d-4744-a932-0658087f49c3
2008-01-30 21:59:12 +00:00
patacongo
9654e2d4b4 errno was clobbered by mm_trysemaphore when task exists
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@591 42af7a65-404d-4744-a932-0658087f49c3
2008-01-30 18:49:31 +00:00
patacongo
c773c4e139 Fix comments
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@590 42af7a65-404d-4744-a932-0658087f49c3
2008-01-30 14:02:16 +00:00
patacongo
59451ae6c0 Cosmetic
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@589 42af7a65-404d-4744-a932-0658087f49c3
2008-01-30 14:01:22 +00:00
patacongo
715cc89148 Cosmetic
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@588 42af7a65-404d-4744-a932-0658087f49c3
2008-01-30 13:21:08 +00:00
patacongo
4a7a565ef3 Typo
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@587 42af7a65-404d-4744-a932-0658087f49c3
2008-01-30 13:08:36 +00:00
patacongo
c55f4a3783 Use mdelay vs inaccurate udelay
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@586 42af7a65-404d-4744-a932-0658087f49c3
2008-01-30 12:55:11 +00:00
patacongo
89c63fc635 Added low-level console driver
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@585 42af7a65-404d-4744-a932-0658087f49c3
2008-01-30 00:59:17 +00:00
patacongo
675205a5de Misc fixes
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@584 42af7a65-404d-4744-a932-0658087f49c3
2008-01-29 23:58:39 +00:00
patacongo
3ae27c3c9e Typo in unused #else
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@583 42af7a65-404d-4744-a932-0658087f49c3
2008-01-29 22:17:06 +00:00
patacongo
8aa92af787 Fix some Z16F serial bugs
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@582 42af7a65-404d-4744-a932-0658087f49c3
2008-01-29 20:13:18 +00:00
patacongo
46f139066c Fix backward conditional compilation
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@581 42af7a65-404d-4744-a932-0658087f49c3
2008-01-29 13:13:04 +00:00
patacongo
b4557a830a Fix bad conditional compilation
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@580 42af7a65-404d-4744-a932-0658087f49c3
2008-01-29 13:08:25 +00:00
patacongo
37d20db817 Z16F Debug
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@579 42af7a65-404d-4744-a932-0658087f49c3
2008-01-29 00:50:16 +00:00
patacongo
5db8af3015 UART config is untested
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@578 42af7a65-404d-4744-a932-0658087f49c3
2008-01-28 22:32:40 +00:00
patacongo
16aff5292e Basic Z16F serial driver functionality
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@577 42af7a65-404d-4744-a932-0658087f49c3
2008-01-28 22:03:49 +00:00
patacongo
4b07e6ffa4 Fix printf-related warnings
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@576 42af7a65-404d-4744-a932-0658087f49c3
2008-01-28 19:09:02 +00:00
patacongo
d15ab7811c Eliminate some Z16F compilation warnings.
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@575 42af7a65-404d-4744-a932-0658087f49c3
2008-01-28 15:45:39 +00:00
patacongo
6e5c4b2316 Z16F compile/link with all OS features enabled
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@574 42af7a65-404d-4744-a932-0658087f49c3
2008-01-28 14:59:21 +00:00
patacongo
4ad0370f60 Add task
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@573 42af7a65-404d-4744-a932-0658087f49c3
2008-01-28 14:10:46 +00:00
patacongo
b65bbad338 Code complete
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@572 42af7a65-404d-4744-a932-0658087f49c3
2008-01-28 02:07:33 +00:00
patacongo
3616465288 Structure serial driver interface to support different interrupt architectures
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@571 42af7a65-404d-4744-a932-0658087f49c3
2008-01-26 23:46:09 +00:00
patacongo
c4ddb4980f Basic NuttX port functional
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@570 42af7a65-404d-4744-a932-0658087f49c3
2008-01-26 16:54:53 +00:00
patacongo
948c8bd2d4 Clock system was missing
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@569 42af7a65-404d-4744-a932-0658087f49c3
2008-01-26 16:21:09 +00:00
patacongo
76d4673969 Fix a16f serial bugs
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@568 42af7a65-404d-4744-a932-0658087f49c3
2008-01-26 14:35:25 +00:00
patacongo
299dc971dd Same fixes as for interrupt return
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@567 42af7a65-404d-4744-a932-0658087f49c3
2008-01-25 23:14:49 +00:00
patacongo
62f7d251ae minor updates
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@566 42af7a65-404d-4744-a932-0658087f49c3
2008-01-25 22:31:08 +00:00
patacongo
e1f5aeaf51 Initial Z61F debug
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@565 42af7a65-404d-4744-a932-0658087f49c3
2008-01-25 22:28:46 +00:00
patacongo
fb4253bfb2 Add z16f system exception handling logic.
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@564 42af7a65-404d-4744-a932-0658087f49c3
2008-01-25 17:49:43 +00:00
patacongo
30984a7eed Add z16f LED logic
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@563 42af7a65-404d-4744-a932-0658087f49c3
2008-01-24 23:23:49 +00:00
patacongo
6bf63d8d35 Add Z16f context switching logic
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@562 42af7a65-404d-4744-a932-0658087f49c3
2008-01-24 22:43:38 +00:00
patacongo
ee1d841569 Adding context switching logic
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@561 42af7a65-404d-4744-a932-0658087f49c3
2008-01-23 22:11:59 +00:00
patacongo
bf27d79c0d Add preliminary support for Z16F serial port
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@560 42af7a65-404d-4744-a932-0658087f49c3
2008-01-23 20:38:12 +00:00
patacongo
ad12689460 *** empty log message ***
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@559 42af7a65-404d-4744-a932-0658087f49c3
2008-01-23 16:16:34 +00:00
patacongo
dfca90057b Fixes for clean(er) compilation
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@558 42af7a65-404d-4744-a932-0658087f49c3
2008-01-23 15:48:26 +00:00
patacongo
9291ec957f Missed cloing comment
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@557 42af7a65-404d-4744-a932-0658087f49c3
2008-01-21 14:03:36 +00:00
patacongo
1f115108e6 Fix Z16F context structure
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@556 42af7a65-404d-4744-a932-0658087f49c3
2008-01-13 15:31:26 +00:00
patacongo
9108a01f1d Fixes for compile
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@555 42af7a65-404d-4744-a932-0658087f49c3
2008-01-12 17:37:22 +00:00
patacongo
b07eb44e4e Fix some ZDS-II compile errors
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@554 42af7a65-404d-4744-a932-0658087f49c3
2008-01-11 22:40:09 +00:00
patacongo
0d102fa42e untest z16f code
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@553 42af7a65-404d-4744-a932-0658087f49c3
2008-01-11 18:19:09 +00:00
patacongo
1b853a92bb Add Z16F interrupts
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@552 42af7a65-404d-4744-a932-0658087f49c3
2008-01-11 13:59:38 +00:00
patacongo
0dd2134fa8 Add board init
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@551 42af7a65-404d-4744-a932-0658087f49c3
2008-01-11 13:56:58 +00:00
patacongo
9dbc6e1c2f z16f common directory
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@550 42af7a65-404d-4744-a932-0658087f49c3
2008-01-11 13:20:53 +00:00
patacongo
517d951c67 Add low-level UART support
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@549 42af7a65-404d-4744-a932-0658087f49c3
2008-01-11 00:02:55 +00:00
patacongo
8f3ef9954e Add Z16F head assembly
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@548 42af7a65-404d-4744-a932-0658087f49c3
2008-01-10 21:10:30 +00:00
patacongo
0a32f4d20b Passing union parms as const upsets ZDS-II compiler
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@547 42af7a65-404d-4744-a932-0658087f49c3
2008-01-10 19:16:50 +00:00
patacongo
544a21b80c Fix Windows path conversions
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@546 42af7a65-404d-4744-a932-0658087f49c3
2008-01-10 18:40:16 +00:00
patacongo
291270beb5 Using tool-specific clean
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@545 42af7a65-404d-4744-a932-0658087f49c3
2008-01-10 18:23:08 +00:00
patacongo
af73c158f2 First cut at ZDS-II link command
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@544 42af7a65-404d-4744-a932-0658087f49c3
2008-01-10 18:16:20 +00:00
patacongo
d387191f04 z16f ostest config
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@543 42af7a65-404d-4744-a932-0658087f49c3
2008-01-10 18:13:27 +00:00
patacongo
0e4924079a Clean operations are now toolchain specific
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@542 42af7a65-404d-4744-a932-0658087f49c3
2008-01-10 13:38:13 +00:00
patacongo
435528e7a0 Add control reg defs
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@541 42af7a65-404d-4744-a932-0658087f49c3
2008-01-10 01:41:58 +00:00
patacongo
e881da738c Compiles with ZDS-II
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@540 42af7a65-404d-4744-a932-0658087f49c3
2008-01-09 22:53:52 +00:00
patacongo
83f36eac7d Changes for ZNeo compile
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@539 42af7a65-404d-4744-a932-0658087f49c3
2008-01-09 14:20:31 +00:00
patacongo
748bcdbe11 cosmetic
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@537 42af7a65-404d-4744-a932-0658087f49c3
2008-01-09 02:03:14 +00:00
patacongo
e59f302e50 Fix ZNeo compile errors
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@536 42af7a65-404d-4744-a932-0658087f49c3
2008-01-09 01:22:06 +00:00
patacongo
817b284a13 Support C pre-processors without variable-arg macros
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@535 42af7a65-404d-4744-a932-0658087f49c3
2008-01-09 01:13:24 +00:00
patacongo
3dffab3aca Need absolute paths for 'fake' links
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@534 42af7a65-404d-4744-a932-0658087f49c3
2008-01-09 00:13:13 +00:00
patacongo
0156bc785f Turn off script debug
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@533 42af7a65-404d-4744-a932-0658087f49c3
2008-01-09 00:07:03 +00:00
patacongo
32c3e79ece Need to handle paths with spaces in them
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@532 42af7a65-404d-4744-a932-0658087f49c3
2008-01-08 23:55:02 +00:00
patacongo
03d8c867cf Spell checked
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@531 42af7a65-404d-4744-a932-0658087f49c3
2008-01-08 22:19:32 +00:00
patacongo
3f1c7dc771 Add logic for environments that can't use soft links
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@530 42af7a65-404d-4744-a932-0658087f49c3
2008-01-08 22:11:00 +00:00
patacongo
c691f1db9d Cygwin path craziness
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@529 42af7a65-404d-4744-a932-0658087f49c3
2008-01-08 19:45:13 +00:00
patacongo
d8b91b19e5 Make logic reorganized for non-GNU toolchain
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@528 42af7a65-404d-4744-a932-0658087f49c3
2008-01-08 17:06:21 +00:00
patacongo
8216d763a6 Fix some compile options
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@527 42af7a65-404d-4744-a932-0658087f49c3
2008-01-08 14:26:17 +00:00
patacongo
131931c877 Reduce make output
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@526 42af7a65-404d-4744-a932-0658087f49c3
2008-01-08 13:41:00 +00:00
patacongo
71f2d3d25d ZNeo compiler now works
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@525 42af7a65-404d-4744-a932-0658087f49c3
2008-01-08 13:02:47 +00:00
patacongo
11e06742c2 Fix dates
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@524 42af7a65-404d-4744-a932-0658087f49c3
2008-01-08 04:52:50 +00:00
patacongo
eda24c6c3a Document 0.3.6.1 release
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@523 42af7a65-404d-4744-a932-0658087f49c3
2008-01-08 04:48:36 +00:00
patacongo
c5a589f25b Add support for tools that can't make dependencies
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@522 42af7a65-404d-4744-a932-0658087f49c3
2008-01-08 00:19:24 +00:00
patacongo
7a9bfd3ccb Adding support for Z16F
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@521 42af7a65-404d-4744-a932-0658087f49c3
2008-01-07 23:19:24 +00:00
patacongo
93dd5f44cb Adding support for the z16f
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@520 42af7a65-404d-4744-a932-0658087f49c3
2008-01-07 23:13:12 +00:00
patacongo
f14e8056ce Add TODO item
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@519 42af7a65-404d-4744-a932-0658087f49c3
2008-01-07 12:58:17 +00:00
patacongo
1fd8bd11af Prep for 0.3.6
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@518 42af7a65-404d-4744-a932-0658087f49c3
2008-01-06 21:03:42 +00:00
patacongo
dc5142224c Add configuration for toolchains without libm
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@517 42af7a65-404d-4744-a932-0658087f49c3
2008-01-06 20:46:45 +00:00
patacongo
662d64f8e0 Add float types needed by pcode runtime
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@516 42af7a65-404d-4744-a932-0658087f49c3
2008-01-06 15:50:20 +00:00
patacongo
731e425116 Add support for Pascal P-Code interpreter
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@511 42af7a65-404d-4744-a932-0658087f49c3
2008-01-05 19:05:31 +00:00
patacongo
d586fa633b Fix html errors
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@484 42af7a65-404d-4744-a932-0658087f49c3
2008-01-04 13:11:45 +00:00
patacongo
eda17b05f7 update
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@483 42af7a65-404d-4744-a932-0658087f49c3
2008-01-04 01:06:27 +00:00
patacongo
7202b1b19d update
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@479 42af7a65-404d-4744-a932-0658087f49c3
2008-01-02 14:17:02 +00:00
patacongo
d54f596884 joininfo field not used if PTHREADS suppressed
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@478 42af7a65-404d-4744-a932-0658087f49c3
2008-01-02 14:15:07 +00:00
patacongo
424eae4cfb Debug z80sim NSH (still doesn't work)
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@476 42af7a65-404d-4744-a932-0658087f49c3
2008-01-01 14:54:10 +00:00
patacongo
db57264e1f Fix deadlock cases
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@475 42af7a65-404d-4744-a932-0658087f49c3
2008-01-01 14:53:16 +00:00
patacongo
d9080fb256 Debug NSH on z80sim
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@474 42af7a65-404d-4744-a932-0658087f49c3
2007-12-31 23:52:53 +00:00
patacongo
c2c6b55515 Add logic to init global data on bootup
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@473 42af7a65-404d-4744-a932-0658087f49c3
2007-12-31 19:05:45 +00:00
patacongo
b6f43e7144 Add z80 signals
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@472 42af7a65-404d-4744-a932-0658087f49c3
2007-12-31 15:45:58 +00:00
patacongo
ab44069b4b update
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@470 42af7a65-404d-4744-a932-0658087f49c3
2007-12-31 00:51:20 +00:00
patacongo
c690cf8df5 update
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@469 42af7a65-404d-4744-a932-0658087f49c3
2007-12-31 00:50:09 +00:00
patacongo
8403a62cdf More SDCC compilation fixes
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@468 42af7a65-404d-4744-a932-0658087f49c3
2007-12-30 23:34:20 +00:00
patacongo
f038ce79e9 Additional corrections to state restore logic
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@466 42af7a65-404d-4744-a932-0658087f49c3
2007-12-30 21:54:55 +00:00
patacongo
821975f7bd Needs same fixes as for up_head.asm
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@465 42af7a65-404d-4744-a932-0658087f49c3
2007-12-30 21:21:19 +00:00
patacongo
c61ade4480 Add support of other resets
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@464 42af7a65-404d-4744-a932-0658087f49c3
2007-12-30 21:08:23 +00:00
patacongo
772ad744e0 Integrating z80
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@463 42af7a65-404d-4744-a932-0658087f49c3
2007-12-30 18:13:22 +00:00
patacongo
c2f88659b5 Assembly errors
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@461 42af7a65-404d-4744-a932-0658087f49c3
2007-12-30 00:05:47 +00:00
patacongo
b516dfa9b6 Fix comments and reg frame offsets
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@460 42af7a65-404d-4744-a932-0658087f49c3
2007-12-29 23:47:22 +00:00
patacongo
62062f5873 Fix size calculation error
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@459 42af7a65-404d-4744-a932-0658087f49c3
2007-12-29 20:18:34 +00:00
patacongo
36c2c9800f Fix dynamic heap sizing logic
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@458 42af7a65-404d-4744-a932-0658087f49c3
2007-12-29 19:51:39 +00:00
patacongo
0a98dad76d First successful z80 compile & link
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@457 42af7a65-404d-4744-a932-0658087f49c3
2007-12-29 16:31:25 +00:00
patacongo
e5cb54d8d5 Add z80 target
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@456 42af7a65-404d-4744-a932-0658087f49c3
2007-12-29 01:06:06 +00:00
patacongo
b1ac023250 Import of z80 target
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@455 42af7a65-404d-4744-a932-0658087f49c3
2007-12-29 01:05:26 +00:00
patacongo
98c638416d Fixed for 8051 w/SDCC compiler
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@454 42af7a65-404d-4744-a932-0658087f49c3
2007-12-28 22:10:14 +00:00
patacongo
932463210f Changes for SDCC compiler
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@453 42af7a65-404d-4744-a932-0658087f49c3
2007-12-28 01:44:34 +00:00
patacongo
26a0534734 Updated for 0.3.5
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@452 42af7a65-404d-4744-a932-0658087f49c3
2007-12-18 20:03:03 +00:00
patacongo
48a5b245df update
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@451 42af7a65-404d-4744-a932-0658087f49c3
2007-12-13 16:52:37 +00:00
patacongo
28b8f4a2e6 ifconfig shows uIP stats
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@450 42af7a65-404d-4744-a932-0658087f49c3
2007-12-12 14:41:36 +00:00
patacongo
cd2decaedb Need to preserve IP address from spurious OFFERs as well
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@449 42af7a65-404d-4744-a932-0658087f49c3
2007-12-11 23:10:47 +00:00
patacongo
bacff222e1 Fix typos/ommissions in file header
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@448 42af7a65-404d-4744-a932-0658087f49c3
2007-12-11 22:58:16 +00:00
patacongo
e0bee0e36b update
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@447 42af7a65-404d-4744-a932-0658087f49c3
2007-12-11 22:08:57 +00:00
patacongo
8027ff2a0e DHCPC logic changes - should now handle case with multiple DHCP servers
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@446 42af7a65-404d-4744-a932-0658087f49c3
2007-12-11 22:07:18 +00:00
patacongo
0800757e00 Need to tell examples/uip tht the C5471 has no MAC
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@445 42af7a65-404d-4744-a932-0658087f49c3
2007-12-11 22:04:35 +00:00
patacongo
a9a9fb489e Fix compilation errors
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@444 42af7a65-404d-4744-a932-0658087f49c3
2007-12-11 14:49:02 +00:00
patacongo
23e67efbbd Moved MAC and ethernet definitions to include/net/ethernet.h
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@443 42af7a65-404d-4744-a932-0658087f49c3
2007-12-11 14:28:16 +00:00
patacongo
ea50c50b47 eliminate some warnings
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@442 42af7a65-404d-4744-a932-0658087f49c3
2007-12-11 14:27:11 +00:00
patacongo
8ff7a809b4 Add ifconfig command to NSH
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@441 42af7a65-404d-4744-a932-0658087f49c3
2007-12-11 14:24:49 +00:00
patacongo
84ff909d06 Add ether_ntoa() and inet_ntoa()
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@440 42af7a65-404d-4744-a932-0658087f49c3
2007-12-11 14:23:58 +00:00
patacongo
15c9ab962a Add netdev_foreach()
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@439 42af7a65-404d-4744-a932-0658087f49c3
2007-12-11 14:23:16 +00:00
patacongo
4bd249117a Verified DHCPC on the C5471 EVM
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@438 42af7a65-404d-4744-a932-0658087f49c3
2007-12-10 19:39:26 +00:00
patacongo
69303fea5f Updates
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@437 42af7a65-404d-4744-a932-0658087f49c3
2007-12-10 17:41:40 +00:00
patacongo
a13244eeaf Release 0.3.4
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@436 42af7a65-404d-4744-a932-0658087f49c3
2007-12-10 17:15:11 +00:00
patacongo
32b30abf8f Workaround for ARM optimization bug: Use memcmp/memcpy when working with arrays
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@435 42af7a65-404d-4744-a932-0658087f49c3
2007-12-10 16:28:08 +00:00
patacongo
1a98fe8a63 Debugging TELNET NSH (still problems)
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@434 42af7a65-404d-4744-a932-0658087f49c3
2007-12-10 13:28:01 +00:00
patacongo
f09cdabc0d Clean compile with stats enabled
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@433 42af7a65-404d-4744-a932-0658087f49c3
2007-12-07 16:13:50 +00:00
patacongo
977d4d8779 C5471 ethernet driver functional (but sensitive)
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@432 42af7a65-404d-4744-a932-0658087f49c3
2007-12-07 15:19:00 +00:00
patacongo
47b3a226af C5471 ethernet debug
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@431 42af7a65-404d-4744-a932-0658087f49c3
2007-12-06 23:12:48 +00:00
patacongo
a932e62067 Improved read-ahead buffer management
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@430 42af7a65-404d-4744-a932-0658087f49c3
2007-12-06 23:10:31 +00:00
patacongo
cba8fa9596 Debug fixes
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@429 42af7a65-404d-4744-a932-0658087f49c3
2007-12-05 23:51:41 +00:00
patacongo
98f35925e5 Cosmetic
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@428 42af7a65-404d-4744-a932-0658087f49c3
2007-12-05 15:12:38 +00:00
patacongo
3988e65c46 Clarifications
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@427 42af7a65-404d-4744-a932-0658087f49c3
2007-12-05 01:27:17 +00:00
patacongo
1557e9befc Add feature set, trademarks
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@426 42af7a65-404d-4744-a932-0658087f49c3
2007-12-05 01:02:45 +00:00
patacongo
13505c52fc Add C5471 ethernet driver debug instrumentation
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@425 42af7a65-404d-4744-a932-0658087f49c3
2007-12-04 23:24:26 +00:00
patacongo
c3b6c26c1b First clean C5471 Ethernet compile
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@424 42af7a65-404d-4744-a932-0658087f49c3
2007-12-04 20:23:43 +00:00
patacongo
5efd8589a7 Add c5471 Ethernet driver
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@423 42af7a65-404d-4744-a932-0658087f49c3
2007-12-04 17:11:55 +00:00
patacongo
55358e04c8 Add skeleton ethernet driver
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@422 42af7a65-404d-4744-a932-0658087f49c3
2007-12-02 23:11:54 +00:00
patacongo
3e64d53637 Add TELNET front end to NSH
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@421 42af7a65-404d-4744-a932-0658087f49c3
2007-12-02 18:18:59 +00:00
patacongo
4c54d7d07e Add send() timeout logic
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@420 42af7a65-404d-4744-a932-0658087f49c3
2007-12-02 15:11:32 +00:00
patacongo
929a52b3e0 Basic DHPC client functionality
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@419 42af7a65-404d-4744-a932-0658087f49c3
2007-11-30 23:15:06 +00:00
patacongo
fedadd3064 correct handling of UDP broadcast
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@418 42af7a65-404d-4744-a932-0658087f49c3
2007-11-30 23:12:11 +00:00
patacongo
c3669a3104 Fix UDP recvfrom timeout logic
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@417 42af7a65-404d-4744-a932-0658087f49c3
2007-11-30 21:45:41 +00:00
patacongo
4ca632d1e6 Fix error in BROADCAST=y compilation
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@416 42af7a65-404d-4744-a932-0658087f49c3
2007-11-30 21:08:29 +00:00
patacongo
3dc55ecc72 Oops checked in debug version
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@415 42af7a65-404d-4744-a932-0658087f49c3
2007-11-30 20:50:48 +00:00
patacongo
6f89e7df29 Add netutils/dhcpd
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@414 42af7a65-404d-4744-a932-0658087f49c3
2007-11-30 20:47:42 +00:00
patacongo
5fe8b2974d Add examples/dhcpd
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@413 42af7a65-404d-4744-a932-0658087f49c3
2007-11-30 20:46:29 +00:00
patacongo
14dd3e6265 Prep for 0.3.3 release
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@412 42af7a65-404d-4744-a932-0658087f49c3
2007-11-28 18:31:33 +00:00
patacongo
77aca3e58f Remove commented out logic
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@411 42af7a65-404d-4744-a932-0658087f49c3
2007-11-28 18:17:04 +00:00
patacongo
a89062967e Improve send/close performance
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@410 42af7a65-404d-4744-a932-0658087f49c3
2007-11-28 15:25:09 +00:00
patacongo
34e4d846a6 Fixed missing logic in readahead buffer logic
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@409 42af7a65-404d-4744-a932-0658087f49c3
2007-11-27 19:19:30 +00:00
patacongo
c3a7c92677 Integrated uIP's TELNETD
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@408 42af7a65-404d-4744-a932-0658087f49c3
2007-11-25 16:50:16 +00:00
patacongo
a019c26daa Add vsnprintf
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@407 42af7a65-404d-4744-a932-0658087f49c3
2007-11-25 16:49:08 +00:00
patacongo
18e3cfd272 fs/ and lib/ debug can be selectively enabled
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@406 42af7a65-404d-4744-a932-0658087f49c3
2007-11-24 13:59:57 +00:00
patacongo
9a0b25efcd Must disconnect TCP socket on close()
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@405 42af7a65-404d-4744-a932-0658087f49c3
2007-11-24 13:02:03 +00:00
patacongo
b72a7ab50b Debug can now be selectively enabled by subystem
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@404 42af7a65-404d-4744-a932-0658087f49c3
2007-11-23 22:32:52 +00:00
patacongo
2d9b57758b Removed unused uIP files
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@403 42af7a65-404d-4744-a932-0658087f49c3
2007-11-23 21:16:43 +00:00
patacongo
2ce5085cc8 Verified recvfrom()
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@402 42af7a65-404d-4744-a932-0658087f49c3
2007-11-23 19:25:39 +00:00
patacongo
ef651cc6bc Debug UDP send logic
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@401 42af7a65-404d-4744-a932-0658087f49c3
2007-11-23 13:31:28 +00:00
patacongo
961336e574 Added UDP test/example
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@400 42af7a65-404d-4744-a932-0658087f49c3
2007-11-22 21:59:30 +00:00
patacongo
276e2880bd UDP test/example
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@399 42af7a65-404d-4744-a932-0658087f49c3
2007-11-22 21:57:38 +00:00
patacongo
5a508351e4 TCP and ICMP protocols may now be disabled
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@398 42af7a65-404d-4744-a932-0658087f49c3
2007-11-22 18:36:46 +00:00
patacongo
99c94d9cbe Add TX data notification
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@397 42af7a65-404d-4744-a932-0658087f49c3
2007-11-22 14:42:52 +00:00
patacongo
5c0768fb0d Use normal C strings
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@396 42af7a65-404d-4744-a932-0658087f49c3
2007-11-22 12:48:40 +00:00
patacongo
21c9f463a2 Fix confusion in listening socket vs accepted sockets
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@395 42af7a65-404d-4744-a932-0658087f49c3
2007-11-21 23:30:24 +00:00
patacongo
7d1031cc71 Fix leak in socket close
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@394 42af7a65-404d-4744-a932-0658087f49c3
2007-11-21 23:29:14 +00:00
patacongo
b54499d254 Fix parsing of URL
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@393 42af7a65-404d-4744-a932-0658087f49c3
2007-11-21 23:28:00 +00:00
patacongo
295bf51f3f Fix TCP list managment bug
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@392 42af7a65-404d-4744-a932-0658087f49c3
2007-11-20 21:55:06 +00:00
patacongo
ea2ca7bfc3 Several webserver bugs fixed
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@391 42af7a65-404d-4744-a932-0658087f49c3
2007-11-20 20:32:33 +00:00
patacongo
26c91f4733 Add strcat() and strncat()
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@390 42af7a65-404d-4744-a932-0658087f49c3
2007-11-20 15:42:11 +00:00
patacongo
27192d3a00 Prep for 0.3.1 release
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@389 42af7a65-404d-4744-a932-0658087f49c3
2007-11-20 01:26:34 +00:00
patacongo
ab1f88c3b8 Need to free any readahead buffers
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@388 42af7a65-404d-4744-a932-0658087f49c3
2007-11-19 23:35:42 +00:00
patacongo
0e1b8b8b11 Add TCP readahead logic
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@387 42af7a65-404d-4744-a932-0658087f49c3
2007-11-19 23:09:39 +00:00
patacongo
ca5e8b5998 uIP webserver now uses listen/accept
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@386 42af7a65-404d-4744-a932-0658087f49c3
2007-11-19 18:17:23 +00:00
patacongo
5698f351b1 Add strncmp()
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@385 42af7a65-404d-4744-a932-0658087f49c3
2007-11-18 14:32:06 +00:00
patacongo
dd0e40bbed Fix DM90x0 driver problem that caused TX overruns
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@384 42af7a65-404d-4744-a932-0658087f49c3
2007-11-17 14:28:10 +00:00
patacongo
8c0dd44a5e With DEBUG on, it may require some looping to read all data
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@383 42af7a65-404d-4744-a932-0658087f49c3
2007-11-16 23:14:35 +00:00
patacongo
5d7b5add5d Basic server functionality: listen(), accept()
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@382 42af7a65-404d-4744-a932-0658087f49c3
2007-11-16 18:48:39 +00:00
patacongo
5ea5c4cf09 Fix probably where packets dropped because there was no recv() in place were being ACKed
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@381 42af7a65-404d-4744-a932-0658087f49c3
2007-11-15 22:38:32 +00:00
patacongo
9b0f9f10d6 Doc/comments update
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@380 42af7a65-404d-4744-a932-0658087f49c3
2007-11-08 17:12:12 +00:00
patacongo
a2affa9a9c Fix handling of callback result
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@379 42af7a65-404d-4744-a932-0658087f49c3
2007-11-08 16:43:06 +00:00
patacongo
69cbd66244 Eliminate most uIP globals
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@378 42af7a65-404d-4744-a932-0658087f49c3
2007-11-08 16:01:18 +00:00
patacongo
f6547ca194 Remove uIP logging
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@377 42af7a65-404d-4744-a932-0658087f49c3
2007-11-07 23:26:29 +00:00
patacongo
d622214165 Handle varialble length polling intervals; fix bug of last checkin
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@376 42af7a65-404d-4744-a932-0658087f49c3
2007-11-07 22:54:51 +00:00
patacongo
22cd175fd7 Finished partitioning uip.c (now system is broken)
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@375 42af7a65-404d-4744-a932-0658087f49c3
2007-11-07 18:54:35 +00:00
patacongo
81d093e29e Breaking uip.c into smaller functions/files
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@374 42af7a65-404d-4744-a932-0658087f49c3
2007-11-06 23:38:14 +00:00
patacongo
db8aff6778 Verified basic client-side network functionality
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@373 42af7a65-404d-4744-a932-0658087f49c3
2007-11-06 19:58:14 +00:00
patacongo
ddeb703501 Reduce debug output; calibrate DM320 timer
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@372 42af7a65-404d-4744-a932-0658087f49c3
2007-11-06 16:17:50 +00:00
patacongo
44778c69bd Basic TCP send functional
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@371 42af7a65-404d-4744-a932-0658087f49c3
2007-11-05 23:04:16 +00:00
patacongo
77119d8359 More length-related fixes
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@370 42af7a65-404d-4744-a932-0658087f49c3
2007-11-05 01:06:28 +00:00
patacongo
c48d0935a1 Fix problem with ARP request message length
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@369 42af7a65-404d-4744-a932-0658087f49c3
2007-11-05 00:14:42 +00:00
patacongo
5fe0d01775 Integrating with DM320
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@368 42af7a65-404d-4744-a932-0658087f49c3
2007-11-04 22:59:30 +00:00
patacongo
643c8d6401 DM90x0 driver hooked into DM320
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@367 42af7a65-404d-4744-a932-0658087f49c3
2007-11-04 16:31:24 +00:00
patacongo
da7b0d1d90 Finish TX timeout logic
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@366 42af7a65-404d-4744-a932-0658087f49c3
2007-11-02 23:22:48 +00:00
patacongo
03e6e759a6 Changes for clean compile of DM90x0 driver on Neuros OSD
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@365 42af7a65-404d-4744-a932-0658087f49c3
2007-11-02 23:05:53 +00:00
patacongo
f3209435ab Add settings for DM90x0 driver (disabled)
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@364 42af7a65-404d-4744-a932-0658087f49c3
2007-11-02 20:36:43 +00:00
patacongo
6f8dae2964 Missed in last commit
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@363 42af7a65-404d-4744-a932-0658087f49c3
2007-11-02 20:33:42 +00:00
patacongo
d7d1145863 Add DM90x0 driver
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@362 42af7a65-404d-4744-a932-0658087f49c3
2007-11-02 20:20:34 +00:00
patacongo
b91d6d3b2f DM90x0 Driver
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@361 42af7a65-404d-4744-a932-0658087f49c3
2007-11-02 20:10:33 +00:00
patacongo
5b9425f1b6 in progress update
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@360 42af7a65-404d-4744-a932-0658087f49c3
2007-10-31 23:27:55 +00:00
patacongo
c869e421e9 Add simple network test
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@358 42af7a65-404d-4744-a932-0658087f49c3
2007-10-31 23:26:24 +00:00
patacongo
105aa81d1f dhcpc debug
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@357 42af7a65-404d-4744-a932-0658087f49c3
2007-10-31 00:13:07 +00:00
patacongo
00093c0a08 Fixes found in smtp testing
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@356 42af7a65-404d-4744-a932-0658087f49c3
2007-10-27 18:56:04 +00:00
patacongo
f43ffa05aa Correct some issues with IP/MAC address handling
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@355 42af7a65-404d-4744-a932-0658087f49c3
2007-10-26 21:21:34 +00:00
patacongo
69ec9510a0 Partial implementation of accept() and listen()
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@354 42af7a65-404d-4744-a932-0658087f49c3
2007-09-23 20:45:30 +00:00
patacongo
b85008dc63 Add framework for listen() and connect() -- still missing logic
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@353 42af7a65-404d-4744-a932-0658087f49c3
2007-09-23 16:58:09 +00:00
patacongo
04eac6d18a Fixed for clean Cygwin link; move netutils strings into common library
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@352 42af7a65-404d-4744-a932-0658087f49c3
2007-09-22 19:56:13 +00:00
patacongo
24dc336781 Refactoring netutils strings
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@351 42af7a65-404d-4744-a932-0658087f49c3
2007-09-22 18:44:53 +00:00
patacongo
7bc52e9ea1 CYGWIN caveat
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@350 42af7a65-404d-4744-a932-0658087f49c3
2007-09-21 00:43:20 +00:00
patacongo
30ad777538 If toolchain doesn't have weak symbols, must provide user_initialize()
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@349 42af7a65-404d-4744-a932-0658087f49c3
2007-09-21 00:37:49 +00:00
patacongo
b1bc346305 Fixes for CYGWIN
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@348 42af7a65-404d-4744-a932-0658087f49c3
2007-09-21 00:28:48 +00:00
patacongo
a0318797d7 Repair bad checkin
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@347 42af7a65-404d-4744-a932-0658087f49c3
2007-09-20 23:57:56 +00:00
patacongo
aa8343178b Fixed for CYGWIN build
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@346 42af7a65-404d-4744-a932-0658087f49c3
2007-09-18 03:00:26 +00:00
patacongo
d69acf31de Associate address with network driver; implement ioctl calls to set addresses
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@345 42af7a65-404d-4744-a932-0658087f49c3
2007-09-16 22:12:04 +00:00
patacongo
87743cdc8e Add basic structure to support netdevice ioctls
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@344 42af7a65-404d-4744-a932-0658087f49c3
2007-09-16 17:46:25 +00:00
patacongo
23dcda6743 Add basic structure to support multiple network interfaces
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@343 42af7a65-404d-4744-a932-0658087f49c3
2007-09-15 22:45:45 +00:00
patacongo
d63a0352a5 Fix tapdev
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@342 42af7a65-404d-4744-a932-0658087f49c3
2007-09-14 23:53:29 +00:00
patacongo
ec8c6ffb23 Remove unused flag bit
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@341 42af7a65-404d-4744-a932-0658087f49c3
2007-09-09 23:48:31 +00:00
patacongo
a401a91d03 Implment TCP recv()
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@340 42af7a65-404d-4744-a932-0658087f49c3
2007-09-09 19:47:52 +00:00
patacongo
dcf7c7c365 Implement TCP send; remove uIP proto-sockets
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@339 42af7a65-404d-4744-a932-0658087f49c3
2007-09-09 17:20:56 +00:00
patacongo
01207cc66e Added network init; refactored some header files
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@338 42af7a65-404d-4744-a932-0658087f49c3
2007-09-09 11:58:50 +00:00
patacongo
4283c46855 Cleanup and fix problems introduce in last commit
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@337 42af7a65-404d-4744-a932-0658087f49c3
2007-09-08 22:41:00 +00:00
patacongo
952db3328f Added receive timeout via setsockopt(SO_RCVTIMEO)
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@336 42af7a65-404d-4744-a932-0658087f49c3
2007-09-08 21:54:43 +00:00
patacongo
09d6450ab3 Make file name convention consistent
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@335 42af7a65-404d-4744-a932-0658087f49c3
2007-09-08 19:57:25 +00:00
patacongo
a3d199f7ac Implemented several options in set/getsockopts
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@334 42af7a65-404d-4744-a932-0658087f49c3
2007-09-08 19:50:59 +00:00
patacongo
cdfb48dac6 Documentation update
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@333 42af7a65-404d-4744-a932-0658087f49c3
2007-09-08 15:26:55 +00:00
patacongo
535038c5cc Added framework for getsockopt() setsockopt()
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@332 42af7a65-404d-4744-a932-0658087f49c3
2007-09-07 00:10:10 +00:00
patacongo
d265632c82 Add socket options
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@331 42af7a65-404d-4744-a932-0658087f49c3
2007-09-05 23:52:08 +00:00
patacongo
8c0ce78863 sendto needs to return EINTR error; dccpc uses sendto
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@330 42af7a65-404d-4744-a932-0658087f49c3
2007-09-05 00:13:18 +00:00
patacongo
4f3ecdd85a cleanup
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@329 42af7a65-404d-4744-a932-0658087f49c3
2007-09-03 23:35:18 +00:00
patacongo
cae9bad97b Add send, sendto, rec, recvfrom
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@328 42af7a65-404d-4744-a932-0658087f49c3
2007-09-03 20:34:44 +00:00
patacongo
f72d286d19 Refactoring to provide socket support for UDP
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@327 42af7a65-404d-4744-a932-0658087f49c3
2007-09-02 23:11:10 +00:00
patacongo
f47c8cb529 Implements basic TCP connection logic
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@326 42af7a65-404d-4744-a932-0658087f49c3
2007-09-02 21:58:35 +00:00
patacongo
7015014104 Added snprintf
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@325 42af7a65-404d-4744-a932-0658087f49c3
2007-09-02 19:43:16 +00:00
patacongo
d82d41387b Add ntohs&l() and htons&l
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@324 42af7a65-404d-4744-a932-0658087f49c3
2007-09-02 15:32:03 +00:00
patacongo
800afcd04d Initial include/arpa directory
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@322 42af7a65-404d-4744-a932-0658087f49c3
2007-09-02 15:26:51 +00:00
patacongo
287e032069 Initial include/netinet directory
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@320 42af7a65-404d-4744-a932-0658087f49c3
2007-09-01 21:09:03 +00:00
patacongo
6119aa0943 Adding socket(), bind() logic
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@319 42af7a65-404d-4744-a932-0658087f49c3
2007-09-01 20:56:19 +00:00
patacongo
29aeec7b8a Added support for socket descriptors
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@318 42af7a65-404d-4744-a932-0658087f49c3
2007-09-01 18:06:15 +00:00
patacongo
c60f939f91 smtp now compiles
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@317 42af7a65-404d-4744-a932-0658087f49c3
2007-08-30 23:57:58 +00:00
patacongo
1344768825 Basic infrastructure for socket() and bind()
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@316 42af7a65-404d-4744-a932-0658087f49c3
2007-08-28 23:38:15 +00:00
patacongo
f5afe99329 Can't call system open(), read(), etc.
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@315 42af7a65-404d-4744-a932-0658087f49c3
2007-08-28 01:30:19 +00:00
patacongo
09e2a0cc1e Corrects UIP driver build
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@314 42af7a65-404d-4744-a932-0658087f49c3
2007-08-28 00:18:50 +00:00
patacongo
f5f4000981 Bad file checkin
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@313 42af7a65-404d-4744-a932-0658087f49c3
2007-08-27 00:01:38 +00:00
patacongo
454fededc8 Fix timeslice calculation
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@312 42af7a65-404d-4744-a932-0658087f49c3
2007-08-26 23:48:11 +00:00
patacongo
e8c4bbf98e Fix timeslice calculation
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@311 42af7a65-404d-4744-a932-0658087f49c3
2007-08-26 23:39:06 +00:00
patacongo
f33928ef6a Adding uIP 1.0
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@310 42af7a65-404d-4744-a932-0658087f49c3
2007-08-26 23:18:13 +00:00
patacongo
6f1e5c74ef Import of uIP 1.0
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@308 42af7a65-404d-4744-a932-0658087f49c3
2007-08-26 23:12:17 +00:00
patacongo
e260ea2fa8 Prep for 0.2.8 release
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@307 42af7a65-404d-4744-a932-0658087f49c3
2007-07-02 13:02:56 +00:00
patacongo
fff3a9d265 add set and unset
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@306 42af7a65-404d-4744-a932-0658087f49c3
2007-07-01 20:05:11 +00:00
patacongo
d8cdca20f5 Add rm and rmdir commands
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@305 42af7a65-404d-4744-a932-0658087f49c3
2007-07-01 19:23:34 +00:00
patacongo
4a0697786a Add rm and rmdir commandsChangeLog
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@304 42af7a65-404d-4744-a932-0658087f49c3
2007-07-01 19:22:54 +00:00
patacongo
f0c085abec Added cp command
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@303 42af7a65-404d-4744-a932-0658087f49c3
2007-07-01 18:23:03 +00:00
patacongo
7e5a954d79 Add dirname and basename
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@302 42af7a65-404d-4744-a932-0658087f49c3
2007-07-01 18:09:35 +00:00
patacongo
fb5466800f Add basename, dirname, strrchr
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@301 42af7a65-404d-4744-a932-0658087f49c3
2007-07-01 17:37:11 +00:00
patacongo
96c7f2422e Break into several files
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@300 42af7a65-404d-4744-a932-0658087f49c3
2007-07-01 15:35:32 +00:00
patacongo
e155bf66df document environment variables
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@299 42af7a65-404d-4744-a932-0658087f49c3
2007-06-30 23:42:46 +00:00
patacongo
cdd8fe239a Add environment variable test; fix several detected bugs
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@298 42af7a65-404d-4744-a932-0658087f49c3
2007-06-30 22:39:20 +00:00
patacongo
c418e219ac Add a test of environment variables
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@297 42af7a65-404d-4744-a932-0658087f49c3
2007-06-30 22:35:23 +00:00
patacongo
14c19aa3d1 Fixed several more realloc errors
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@296 42af7a65-404d-4744-a932-0658087f49c3
2007-06-30 22:24:19 +00:00
patacongo
3237757a86 Fix error in realloc when memory is extended downward
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@295 42af7a65-404d-4744-a932-0658087f49c3
2007-06-30 20:38:16 +00:00
patacongo
475e731751 Add environment variable function
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@294 42af7a65-404d-4744-a932-0658087f49c3
2007-06-30 19:39:17 +00:00
patacongo
0466636a01 eliminated a warning
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@293 42af7a65-404d-4744-a932-0658087f49c3
2007-06-30 19:37:47 +00:00
patacongo
d4ccda1bae script debug was left on
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@292 42af7a65-404d-4744-a932-0658087f49c3
2007-06-30 19:37:28 +00:00
patacongo
09a3864fd5 Add basic tasking support for environment variables
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@291 42af7a65-404d-4744-a932-0658087f49c3
2007-06-30 17:05:44 +00:00
patacongo
445da7f795 +2 not ++ twice
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@290 42af7a65-404d-4744-a932-0658087f49c3
2007-06-11 22:47:43 +00:00
patacongo
13bd9989b2 EINTR is not an error
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@289 42af7a65-404d-4744-a932-0658087f49c3
2007-06-11 22:47:21 +00:00
patacongo
576c4f55c2 NSH: Add cat; add -l, -s, -R to ls
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@288 42af7a65-404d-4744-a932-0658087f49c3
2007-06-10 20:40:25 +00:00
patacongo
4e52b5e11c Add mount, umount, and mkdir commands
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@287 42af7a65-404d-4744-a932-0658087f49c3
2007-06-10 18:13:26 +00:00
patacongo
00d1800b76 Add getopt
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@286 42af7a65-404d-4744-a932-0658087f49c3
2007-06-10 18:13:03 +00:00
patacongo
eff35dc99f Correct opendir semaphore hanlding -- was causing deadlock
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@285 42af7a65-404d-4744-a932-0658087f49c3
2007-06-10 17:50:16 +00:00
patacongo
729fad8b7d Force directory name to be nuttx-xx.yy.zz
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@284 42af7a65-404d-4744-a932-0658087f49c3
2007-06-10 02:24:53 +00:00
patacongo
d583be7062 Fixed a problem with arch/arm/src dependencies
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@282 42af7a65-404d-4744-a932-0658087f49c3
2007-06-10 00:18:40 +00:00
patacongo
9a4b84349d Under Cygwin, executable has a different name
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@281 42af7a65-404d-4744-a932-0658087f49c3
2007-06-09 23:09:15 +00:00
patacongo
c013dc876f Oops ChangeLog not updated in last release
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@280 42af7a65-404d-4744-a932-0658087f49c3
2007-06-09 21:26:27 +00:00
patacongo
1479e0d35d Prepare for release 0.2.7
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@279 42af7a65-404d-4744-a932-0658087f49c3
2007-06-09 21:01:26 +00:00
patacongo
7ac971d7ee Don't call usleep if signals are disabled
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@278 42af7a65-404d-4744-a932-0658087f49c3
2007-06-09 20:39:21 +00:00
patacongo
bece513004 SDCC specific changes. Z80 support; re-enable __FILE__ and __LINE__ in assert -- might have broken the 8051/2
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@277 42af7a65-404d-4744-a932-0658087f49c3
2007-06-09 20:31:09 +00:00
patacongo
40513d77ab No longer uses _GNU_SOURCE-specific asprintf()
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@276 42af7a65-404d-4744-a932-0658087f49c3
2007-06-09 19:45:33 +00:00
patacongo
9ab11697a8 Simply conditional build; fix conditional compilation
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@275 42af7a65-404d-4744-a932-0658087f49c3
2007-06-09 19:11:00 +00:00
patacongo
aca030153f Add support for custom system timer frequency
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@274 42af7a65-404d-4744-a932-0658087f49c3
2007-06-09 15:49:44 +00:00
patacongo
da19e798e6 updates
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@273 42af7a65-404d-4744-a932-0658087f49c3
2007-06-07 00:53:33 +00:00
patacongo
79457a04ab Don't call fflush if streams are disabled
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@272 42af7a65-404d-4744-a932-0658087f49c3
2007-06-07 00:29:46 +00:00
patacongo
cfdfa7b3c9 Error in memcpy arguments for SDCC platforms
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@271 42af7a65-404d-4744-a932-0658087f49c3
2007-06-07 00:24:57 +00:00
patacongo
a48fe435f8 Function incorrectly named
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@270 42af7a65-404d-4744-a932-0658087f49c3
2007-06-07 00:20:35 +00:00
patacongo
c574123ca4 Fixed nsec calculation
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@269 42af7a65-404d-4744-a932-0658087f49c3
2007-06-07 00:14:35 +00:00
patacongo
637618e8bb Removed redundant interrupt disable
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@268 42af7a65-404d-4744-a932-0658087f49c3
2007-06-07 00:08:40 +00:00
patacongo
a54e55c432 Don't build sleep() or usleep() if signals are disabled
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@267 42af7a65-404d-4744-a932-0658087f49c3
2007-06-07 00:03:36 +00:00
patacongo
5abe9f896c bash if should end with 'fi' not 'if'
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@266 42af7a65-404d-4744-a932-0658087f49c3
2007-06-06 23:56:56 +00:00
patacongo
826ae7f951 file extension should be .gz not .bz2
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@265 42af7a65-404d-4744-a932-0658087f49c3
2007-06-06 23:51:21 +00:00
patacongo
c3ed839a4e updated
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@264 42af7a65-404d-4744-a932-0658087f49c3
2007-06-06 10:25:20 +00:00
patacongo
4a18d1f253 Add a test of statfs
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@263 42af7a65-404d-4744-a932-0658087f49c3
2007-05-30 00:00:04 +00:00
patacongo
f1170204c5 allocation unit is cluster, not sector
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@262 42af7a65-404d-4744-a932-0658087f49c3
2007-05-29 01:00:48 +00:00
patacongo
cf935803a0 Added statfs()
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@261 42af7a65-404d-4744-a932-0658087f49c3
2007-05-29 00:31:17 +00:00
patacongo
9dd25d7965 Remove duplicate definition of struct statfs
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@260 42af7a65-404d-4744-a932-0658087f49c3
2007-05-27 23:09:23 +00:00
patacongo
5bdefbb8a0 Added fat_getattrib.c and fat_setattrib.c
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@259 42af7a65-404d-4744-a932-0658087f49c3
2007-05-27 20:40:01 +00:00
patacongo
3f5d4be4a9 Fix reference count problem
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@258 42af7a65-404d-4744-a932-0658087f49c3
2007-05-27 19:10:40 +00:00
patacongo
a0153a1ed2 Add stat()
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@257 42af7a65-404d-4744-a932-0658087f49c3
2007-05-27 18:08:18 +00:00
patacongo
0c8bb6aac5 Missing closing quote
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@256 42af7a65-404d-4744-a932-0658087f49c3
2007-05-26 23:56:25 +00:00
patacongo
1d82a44d73 prepare for 0.2.6 release
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@255 42af7a65-404d-4744-a932-0658087f49c3
2007-05-26 22:46:13 +00:00
patacongo
955bf72f06 Fat dir operations seem to work
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@254 42af7a65-404d-4744-a932-0658087f49c3
2007-05-26 22:37:57 +00:00
patacongo
49e73e6d62 typos
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@253 42af7a65-404d-4744-a932-0658087f49c3
2007-05-26 19:31:38 +00:00
patacongo
84e1cf94cf Finish FAT directory operations; add option to disable mountpoints; fix ARM compile errors
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@252 42af7a65-404d-4744-a932-0658087f49c3
2007-05-26 19:22:34 +00:00
patacongo
48b2897974 Add readdir() on mountpoints
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@251 42af7a65-404d-4744-a932-0658087f49c3
2007-05-26 16:37:37 +00:00
patacongo
0528705d81 Setting up for mountpoint support
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@250 42af7a65-404d-4744-a932-0658087f49c3
2007-05-26 16:05:59 +00:00
patacongo
2a7e55b1fc Add FAT rename()
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@249 42af7a65-404d-4744-a932-0658087f49c3
2007-05-21 21:04:03 +00:00
patacongo
f0634f5588 Add FAT mkdir()
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@248 42af7a65-404d-4744-a932-0658087f49c3
2007-05-21 19:24:30 +00:00
patacongo
d7b254d2e6 Add FAT rmdir and unlink
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@247 42af7a65-404d-4744-a932-0658087f49c3
2007-05-21 17:17:42 +00:00
patacongo
0cb1595215 Add unlink(), mkdir(), rmdir(), and rename()
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@246 42af7a65-404d-4744-a932-0658087f49c3
2007-05-21 14:36:00 +00:00
patacongo
982949fd81 Add lseek; prep for 0.2.5
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@245 42af7a65-404d-4744-a932-0658087f49c3
2007-05-21 00:42:06 +00:00
patacongo
60f48b9ab9 Implemented FAT write
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@244 42af7a65-404d-4744-a932-0658087f49c3
2007-05-20 23:22:56 +00:00
patacongo
c9bc5c5c0e Add strspn() and strcspn()
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@243 42af7a65-404d-4744-a932-0658087f49c3
2007-05-20 19:27:02 +00:00
patacongo
624b98e244 Add support for close and fsync
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@242 42af7a65-404d-4744-a932-0658087f49c3
2007-05-20 19:25:58 +00:00
patacongo
c567505d21 Added fsync()
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@241 42af7a65-404d-4744-a932-0658087f49c3
2007-05-20 19:03:01 +00:00
patacongo
f9de27c80b Add fsync()
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@240 42af7a65-404d-4744-a932-0658087f49c3
2007-05-20 19:01:57 +00:00
patacongo
17e98b8602 Updated Changelist
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@239 42af7a65-404d-4744-a932-0658087f49c3
2007-05-20 17:00:02 +00:00
patacongo
341cf6f778 Did not re-enable interrupts
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@238 42af7a65-404d-4744-a932-0658087f49c3
2007-05-20 16:59:40 +00:00
patacongo
4074b03ff7 FAT read logic integrated
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@237 42af7a65-404d-4744-a932-0658087f49c3
2007-05-20 16:58:37 +00:00
patacongo
505f5bd35c fixes
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@236 42af7a65-404d-4744-a932-0658087f49c3
2007-05-20 16:54:09 +00:00
patacongo
36e02def6b fix last change
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@235 42af7a65-404d-4744-a932-0658087f49c3
2007-05-20 16:38:49 +00:00
patacongo
b22c9a9ab7 updates
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@234 42af7a65-404d-4744-a932-0658087f49c3
2007-05-20 16:25:08 +00:00
patacongo
fa44e6e8a9 close() did not close driver
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@233 42af7a65-404d-4744-a932-0658087f49c3
2007-05-20 16:24:40 +00:00
patacongo
28c3d07135 Fix timeslice calculation
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@232 42af7a65-404d-4744-a932-0658087f49c3
2007-05-20 15:43:53 +00:00
patacongo
c02b8b1e8b Cleaned up table of contents
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@231 42af7a65-404d-4744-a932-0658087f49c3
2007-05-20 15:31:02 +00:00
patacongo
e85f4186a4 Support for open of FAT fs
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@230 42af7a65-404d-4744-a932-0658087f49c3
2007-05-19 21:30:57 +00:00
patacongo
007667f845 Bad return value
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@229 42af7a65-404d-4744-a932-0658087f49c3
2007-05-19 21:10:23 +00:00
patacongo
2e86454b82 fix isupper()
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@228 42af7a65-404d-4744-a932-0658087f49c3
2007-05-19 00:21:22 +00:00
patacongo
b94766ca8f umount and fat fixes
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@227 42af7a65-404d-4744-a932-0658087f49c3
2007-05-14 11:12:09 +00:00
patacongo
11073f798f Improved FS test
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@226 42af7a65-404d-4744-a932-0658087f49c3
2007-05-14 02:13:27 +00:00
patacongo
d1a0415da7 Improved test FAT file
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@225 42af7a65-404d-4744-a932-0658087f49c3
2007-05-14 01:45:12 +00:00
patacongo
183f658b9d Debug output
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@224 42af7a65-404d-4744-a932-0658087f49c3
2007-05-13 23:36:37 +00:00
patacongo
b2aa745708 Support FAT12/16
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@223 42af7a65-404d-4744-a932-0658087f49c3
2007-05-13 23:13:42 +00:00
patacongo
a27c0911f4 Initial mount integration
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@222 42af7a65-404d-4744-a932-0658087f49c3
2007-05-13 21:47:36 +00:00
patacongo
01b3f1c982 Mount Test
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@221 42af7a65-404d-4744-a932-0658087f49c3
2007-05-13 21:45:27 +00:00
patacongo
4b420b12fe Add FAT32 unmount; mountpoint open needs oflags+mode
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@220 42af7a65-404d-4744-a932-0658087f49c3
2007-05-13 20:56:16 +00:00
patacongo
b6335e8ef7 Misc. changes to support FAT32 fileysystem
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@219 42af7a65-404d-4744-a932-0658087f49c3
2007-05-13 20:20:07 +00:00
patacongo
d8df31f3d8 Add framework for FAT32 support
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@218 42af7a65-404d-4744-a932-0658087f49c3
2007-05-13 20:13:10 +00:00
patacongo
336ba8e4ed Add configuration option to select VFAT
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@217 42af7a65-404d-4744-a932-0658087f49c3
2007-05-12 20:11:20 +00:00
patacongo
0790fcfae0 updated
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@216 42af7a65-404d-4744-a932-0658087f49c3
2007-05-12 20:10:04 +00:00
patacongo
55480ff1b4 driver private data should be retained in inode, not file
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@215 42af7a65-404d-4744-a932-0658087f49c3
2007-05-12 20:09:37 +00:00
patacongo
1f9a015bcf Add mount and umount
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@214 42af7a65-404d-4744-a932-0658087f49c3
2007-05-12 20:08:39 +00:00
patacongo
f6ad8c9fea Add mount() and umount()
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@213 42af7a65-404d-4744-a932-0658087f49c3
2007-05-12 20:07:51 +00:00
patacongo
3f61b374dd simulated block device now contains a VFAT formated disk image
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@212 42af7a65-404d-4744-a932-0658087f49c3
2007-05-12 16:21:19 +00:00
patacongo
7b6b0aaf21 Reflect changes due to fs structures
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@211 42af7a65-404d-4744-a932-0658087f49c3
2007-05-09 00:08:54 +00:00
patacongo
81686eaf79 Reflect changes to fs structures
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@210 42af7a65-404d-4744-a932-0658087f49c3
2007-05-09 00:08:26 +00:00
patacongo
d005c70e79 update
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@209 42af7a65-404d-4744-a932-0658087f49c3
2007-05-09 00:06:22 +00:00
patacongo
886acfaf54 Add simulated block device
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@208 42af7a65-404d-4744-a932-0658087f49c3
2007-05-09 00:06:00 +00:00
patacongo
8bdcd7c208 Add structures to manage block drivers
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@207 42af7a65-404d-4744-a932-0658087f49c3
2007-05-09 00:05:15 +00:00
patacongo
6a2863c3fd Add support for block drivers
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@206 42af7a65-404d-4744-a932-0658087f49c3
2007-05-09 00:04:03 +00:00
patacongo
d96a6e609e Another thing to do
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@205 42af7a65-404d-4744-a932-0658087f49c3
2007-05-06 23:00:14 +00:00
patacongo
ef2d434ca9 Add logic for system timer
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@204 42af7a65-404d-4744-a932-0658087f49c3
2007-05-05 22:35:07 +00:00
patacongo
57cea6a5d6 Add more register definitions
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@203 42af7a65-404d-4744-a932-0658087f49c3
2007-05-05 16:44:46 +00:00
patacongo
29abaf9ea8 Add A/D register definitions
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@202 42af7a65-404d-4744-a932-0658087f49c3
2007-05-05 01:55:07 +00:00
patacongo
f6ba15a866 Added serial driver
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@201 42af7a65-404d-4744-a932-0658087f49c3
2007-05-04 01:30:48 +00:00
patacongo
28728db69c Cosmetic
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@200 42af7a65-404d-4744-a932-0658087f49c3
2007-05-03 10:42:13 +00:00
patacongo
8e19dbc9a5 Completes coding of basic interrupt handling logic
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@199 42af7a65-404d-4744-a932-0658087f49c3
2007-05-03 00:29:56 +00:00
patacongo
eca2c452c4 Added some interrupt definitions
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@198 42af7a65-404d-4744-a932-0658087f49c3
2007-05-02 01:14:06 +00:00
patacongo
ac23f2bd09 Added chip info
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@197 42af7a65-404d-4744-a932-0658087f49c3
2007-05-01 01:06:38 +00:00
patacongo
8f5fcc8b2f Low level UART support
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@196 42af7a65-404d-4744-a932-0658087f49c3
2007-05-01 00:28:53 +00:00
patacongo
5f8cde796c Fix several typos.
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@195 42af7a65-404d-4744-a932-0658087f49c3
2007-04-29 22:17:11 +00:00
patacongo
ed794c7b66 Changes to resulting previous merge of arch/c5471 and arch/dm320 into arch/arm and
also to adding lpc214x to arch/arm.


git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@194 42af7a65-404d-4744-a932-0658087f49c3
2007-04-29 21:50:53 +00:00
patacongo
fe9ddc4b1c Initial lpc214x support
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@193 42af7a65-404d-4744-a932-0658087f49c3
2007-04-29 21:29:30 +00:00
patacongo
0638763b62 Updated for 0.2.4 release
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@192 42af7a65-404d-4744-a932-0658087f49c3
2007-04-28 22:38:28 +00:00
patacongo
65629a1fcc Bad import
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@191 42af7a65-404d-4744-a932-0658087f49c3
2007-04-28 22:35:55 +00:00
patacongo
162614915f Initial Release
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@190 42af7a65-404d-4744-a932-0658087f49c3
2007-04-28 22:19:52 +00:00
patacongo
3d61428c57 Documents new arch/arm directory
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@189 42af7a65-404d-4744-a932-0658087f49c3
2007-04-28 20:07:05 +00:00
patacongo
e5a89d6cf4 Changes to use the common ARM directory under arch/arm
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@188 42af7a65-404d-4744-a932-0658087f49c3
2007-04-28 20:05:36 +00:00
patacongo
d6aadaf77c Common ARM support
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@187 42af7a65-404d-4744-a932-0658087f49c3
2007-04-28 19:39:18 +00:00
patacongo
f0d12c1db3 arch/c5471/include and arch/dm320/include are not identical. This is in preparation to replace arch/c5471 and arch/dm320 with arch/arm
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@186 42af7a65-404d-4744-a932-0658087f49c3
2007-04-26 00:44:27 +00:00
patacongo
8f7dc2bb9f Initial version
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@185 42af7a65-404d-4744-a932-0658087f49c3
2007-04-26 00:42:03 +00:00
patacongo
58cf518670 Makesystem changes to better support different SoCs
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@184 42af7a65-404d-4744-a932-0658087f49c3
2007-04-25 00:09:44 +00:00
patacongo
c241fb2128 Misc changes to good c5471 build on Cygwin
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@183 42af7a65-404d-4744-a932-0658087f49c3
2007-04-22 20:40:10 +00:00
patacongo
13f01b4cf3 update
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@182 42af7a65-404d-4744-a932-0658087f49c3
2007-03-30 13:21:20 +00:00
patacongo
d2410c93c6 Fix another potential pthread_join race condition
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@181 42af7a65-404d-4744-a932-0658087f49c3
2007-03-30 13:11:19 +00:00
patacongo
f29250c671 Correct a race condition in the pthread join logic. Sometimes the join structure was being deallocated while it was still needed.
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@180 42af7a65-404d-4744-a932-0658087f49c3
2007-03-30 00:49:11 +00:00
patacongo
2a929796b9 Add timed mqueue test.
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@179 42af7a65-404d-4744-a932-0658087f49c3
2007-03-29 23:44:55 +00:00
patacongo
b1127822ed Fix bugs detected by timed mqueue test.
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@178 42af7a65-404d-4744-a932-0658087f49c3
2007-03-29 23:43:54 +00:00
patacongo
448c7f4618 Container being deallocated before buffers in container. Caused memory leak.
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@177 42af7a65-404d-4744-a932-0658087f49c3
2007-03-29 16:53:03 +00:00
patacongo
ed4fe71b96 Updated test results
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@176 42af7a65-404d-4744-a932-0658087f49c3
2007-03-29 14:27:23 +00:00
patacongo
63f134f988 Wrong task state
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@175 42af7a65-404d-4744-a932-0658087f49c3
2007-03-29 14:22:29 +00:00
patacongo
8b9fcf354e Moved exclusion logic to a higher level so that printf output is more readable when the same stdout FILE* is shared
by many pthreads (tasks did not have this probablem because they have separate stdout streams).


git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@174 42af7a65-404d-4744-a932-0658087f49c3
2007-03-29 14:21:31 +00:00
patacongo
b1d5b6899a Signal mask is now inherited by both child tasks and threads; this has the side-effect of changing the initia
l state of all signals from blocked to unblocked.


git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@173 42af7a65-404d-4744-a932-0658087f49c3
2007-03-29 13:34:37 +00:00
patacongo
2aab4d3c3a Unmatched sched_lock()/sched_unlock()
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@172 42af7a65-404d-4744-a932-0658087f49c3
2007-03-29 13:32:13 +00:00
patacongo
b765d17818 Don't allow signals to wake up blocked task if the signal is blocked.
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@171 42af7a65-404d-4744-a932-0658087f49c3
2007-03-29 13:31:08 +00:00
patacongo
54339607da Block signals while pthread exits.
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@170 42af7a65-404d-4744-a932-0658087f49c3
2007-03-29 13:29:29 +00:00
patacongo
0c2ff4a47c typo
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@169 42af7a65-404d-4744-a932-0658087f49c3
2007-03-29 13:28:27 +00:00
patacongo
23dffb8f23 Eliminate warnings
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@168 42af7a65-404d-4744-a932-0658087f49c3
2007-03-29 13:27:43 +00:00
patacongo
0db3f5c256 task_delete() calls sched_unlock(); _exit must keep pre-emption disabled until pending queue emptied.
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@167 42af7a65-404d-4744-a932-0658087f49c3
2007-03-29 13:26:24 +00:00
patacongo
56f7399200 Added mq_timedsend() and mq_timedreceive()
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@166 42af7a65-404d-4744-a932-0658087f49c3
2007-03-29 13:25:18 +00:00
patacongo
5f5d5496d9 Update mq_send() and mq_receive() description
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@165 42af7a65-404d-4744-a932-0658087f49c3
2007-03-28 16:00:57 +00:00
patacongo
3e352ca10b mq_receive/send: Return appropriate errnos and stop waiting if signal received.
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@164 42af7a65-404d-4744-a932-0658087f49c3
2007-03-28 14:48:42 +00:00
patacongo
c5971231da updates
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@163 42af7a65-404d-4744-a932-0658087f49c3
2007-03-27 21:27:41 +00:00
714 changed files with 97551 additions and 8494 deletions

221
ChangeLog
View File

@@ -89,8 +89,225 @@
* Added directories to hold board-specific header files
* Added directories to hold board-specific drivers
0.2.3 2007-xx-xx Gregory Nutt <spudmonkey@racsa.co.cr>
0.2.3 2007-03-29 Gregory Nutt <spudmonkey@racsa.co.cr>
* Started m68322
* mq_receive and mq_send now return errno's appropriately
* mq_receive and mq_send are now correctly awakened by signals.
* Fixed an unmatched sched_lock/unlock pair in task_delete().
* sched_lock must be called in _exit() because operation of
task_delete() can cause pending tasks to be merged and a
context switch to occur.
* Added mq_timedreceive() and mq_timedsend()
* signal mask is now inherited by both child tasks and threads.
* Improved sharebility of stdout among pthreads (only). Nothing
was broken, but by moving the mutual exclusion logic to a
higher level, the printf output is more readable.
* Fixed a bug in file system cleanup: A list was being deleted
before the buffers contained in the list.
* Fixed a bug in the wait-for-message-queue-not-empty logic.
* Added a test of timed mqueue operations; detected and corrected
some mqueue errors.
* Identified and corrected a race condition associated with
pthread_join. In the failure condition, memory was being
deallocated while still in use.
0.2.4 2007-04-28 Gregory Nutt <spudmonkey@racsa.co.cr>
* Verfied c5471 build under Cygwin on WinXP
* Makesystem changes to better support different SoCs.
* Made arch/c5471/include and arch/dm320/include identical in
preparation for merging into arch/arm
* Logic from arch/c5471 and arch/dm320 combined into arch/arm.
arch/c5471 and arch/dm320 are deprecated and will be removed
when the new c5471 and dm320 logic is verified.
0.2.5 2007-05-19 Gregory Nutt <spudmonkey@racsa.co.cr>
* Corrected some build/configuration issues introduced with the
last release.
* Added support for the NXP 214x processor on the mcu123.com lpc214x
development board (untested)
* Added support for block devices.
* Simulated target now exports a VFAT filesystem
* Begin support for VFAT filesystem (missing functionalit)
* Added mount() and umount()
* Fix bug in memcmp return value
* Fix errors in timeslice calculation (several places)
* Added missing irqrestore() in timer_deletall().
* close() was not closing the underlying device.
* Added fsync()
* Added strspn() and strcspn()
0.2.6 2007-05-26 Gregory Nutt <spudmonkey@racsa.co.cr>
* Added unlink(), mkdir(), rmdir(), and rename()
* Fixed several serious FAT errors with oflags handling (&& instead of &)
* Added FAT support for unlink(), mkdir(), rmdir(), and rename
* Added FAT support for opendir(), closedir(), readdir(), seekdir(),
telldir(), rewindir().
* Fixed ARM compilation errors introduced in 0.2.5 (that is what I get
for only testing on the simulation).
0.2.7 2007-06-09 Gregory Nutt <spudmonkey@racsa.co.cr>
* Added stat() to fs layer and to FAT
* Fixed reference counting errors associated with mounted filesystems
* Added fat_getattrib() and fat_setattrib()
* Added statfs() to fs layer and to FAT
* Correct file name extension in tools/zipme.sh
* Fix error in dependencies in 8051/2 Makefile
* sched/Makefile: Don't build sleep() or usleep() if signals are disabled
* sched/sched_setparam.c: Remove redundant disabling of interrupts
* sched/usleep.c: Fixed nsec calculation
* lib/lib_strcspn.c: Function incorrectly named strspn().
* examples/ostest/main.c: Errors in SDCC version of a memcpy() call
* examples/ostest/sighand.c: Don't call fflush() if streams are disabled
* include/limits.h, include/time.h, sched/clock_internal.h: A support for
using selectable system timer frequency.
* Fixed error in mountpoint related conditional compilation introduced
in 0.2.5
* Restructured some Makefiles to better handle enabling and disabling
NuttX features without having so much conditional compilation in the
source files.
* tools/mkconfig.c: No longer depends on asprintf() and _GNU_SOURCE and
so should now build in non-GNU, non-GLIBC environments.
* include/nuttx/compiler.h: Fix for using SDCC with the Z80.
* include/assert.h & arch/pjrc-8051/src/up_assert.c: SDCC does support
__FILE__and __LINE__ (not tested)
* examples/ostest/barrier.c: Don't call usleep() when signals are
disabled.
0.2.8 2007-07-02 Gregory Nutt <spudmonkey@racsa.co.cr>
* tools/Makefile.mkconfig: Under Cygwin, executable has a different name
* tools/mkdeps.sh & arch/arm/src/Makefile: Corrected a problem makeing dependencies
* tools/zipme.sh: Force directory name to be nuttx-xx.yy.zz
* fs/fs_opendir.c: Correct errors in semaphore usage that can cause deadlock.
* lib/lib_getopt.c: Added getopt() support
* examples/nsh/: NSH now supports cat, mount, umount, and mkdir. ls supports
-l -s, and -R
* Added basic OS support to manage environment variables: environment
storage, cloning on task creation, sharing on pthread creation, destruction
on thread/task exit.
* Add environment variables APIs: environ, getenv, putenv, clearenv, setenv,
unsetenv
* Correct an error in realloc() when the block is extended "down" in memory.
In this case, the old memory contents need to be copied to the new location
and an allocated bit was not being set.
* examples/ostest/: Added an environment variable test.
* examples/nsh/: Break into several files.
* lib/: Added strrchr, basename, dirname
* examples/nsh/: Add cp, rm, rmdir, set, unset commands. echo will now print
environment variables.
0.3.0 2007-11-06 Gregory Nutt <spudmonkey@racsa.co.cr>
* Imported uIP into the tree (see
http://www.sics.se/~adam/uip/index.php/Main_Page)
* Adding socket(), bind(), connect()
* Added snprintf()
* Added send() and sendto(); integrate write() and close() with socket descriptors.
* Added recv() and recvfrom().
* Added getsockopt() and setsockopt()
* Documentation updated to address socket interfaces.
* Implemented receive timeouts via setsockopt(SO_RCVTIMEO).
* Provide support for multiple network devices
* Implement socket ioctl() calls to set addresses
* Added listen() and accept()
* Added DM90x0 ethernet driver
* ARP timer is now built into the network layer
* Basic client functionality verified: TCP socket(), bind(), connect(), recv(), send().
0.3.1 2007-11-19 Gregory Nutt <spudmonkey@racsa.co.cr>
* Separated net/uip/uip.c into several functions in several files.
* Corrected a TCP problem where packets were dropped because there was no
recv() in place but the packet was being ACKed. There are still TCP
recv buffering issues, but this is part of a larger buffering issue.
* Basic server functionality verified: TCP listen(), accept()
* Fix DM90x0 driver problem that caused TX overruns
* Add strncmp()
* Added TCP/IP read-ahead buffer to minimize failed ACKs and packet loss.
0.3.2 2007-11-23 Gregory Nutt <spudmonkey@racsa.co.cr>
* Add strcat() and strncat()
* Integrated uIP micro webserver
* Corrected a serious bug in TCP queue management
* Fix leak in socket close logic
* Add TX notification to driver so that it can respond faster to
the availability of TX data.
* Moved urgent data info into device structure.
* TCP and ICMP protocols can now be disabled.
* Added UDP test in examples/udp
* Verified/debugged UDP socket(), bind(), sendto() and recvfrom() logic
using examples/udp
* recvfrom() and accept() now correctly return the remote address.
* Fixed computation error in ntohl().
0.3.3 2007-11-28 Gregory Nutt <spudmonkey@racsa.co.cr>
* Removed unused uIP files
* sched/, mm/, and net/ subystem debug can not be selectively enabled/disabled
* Correct socket close logic -- needs to disconnect TCP socket on close
* uIP webserver now seems to be fully functional
* fs/ and lib/ subystem debug can not be selectively enabled/disabled
* Added vsnprintf
* Integrated uIP telnetd
* Add missing logic to readahead buffer logic
* examples/nettest uses larger buffers
* Improved ACK handling in send() to better hander deferred acknowledgements
and polling intervals. Greatly improves send performance.
0.3.4 2007-12-10 Gregory Nutt <spudmonkey@racsa.co.cr>
* Added and partially verified DHCP server logic (netutils/dhcpd)
* Fix BROADCAST=y compilation problems
* Fix UDP recvfrom timeout bug
* Correct processing of input UDP broadcast packets.
* Verfied basic DHCP client functionality (netutils/dhcpc)
* Implemented send() timeout logic
* Added and verifed a TELNETD front end to NSH (examples/nsh)
* Add a skeleton Ethernet device driver (drivers/net/skeleton.c)
* Added C5471 Ethernet device driver (arch/arm/src/c5471/c5471_ethernet.c)
* Found and fixed several problems in uIP when compiled for ARM with optimization.
0.3.5 2007-12-18 Gregory Nutt <spudmonkey@racsa.co.cr>
* Added inet_ntoa() and ether_ntoa()
* Added netdev_foreach() to support traversal of registered network devices
* Added support for 'ifconfig' command to NSH (examples/nsh)
* Moved MAC and ethernet definitions to net/ethernet.h
* Fix sim and DM90x0 compilation errors introduced in 0.3.4
* Fixed errors in C5471 configuration files for examples/uip
* Modified DHCPC (netutils/dhcpc) so that it should work in environments where
there are more than one DHCPD server.
* NSH ifconfig command now shows uIP status was well (examples/nsh)
0.3.6 2008-01-06 Gregory Nutt <spudmonkey@racsa.co.cr>
* Changes for use with SDCC compiler
* Added a simulated z80 target
* Fix deadlock errors when using stdio but with no buffering
* Add support for Pascal P-Code interpreter
0.3.6.1 2008-01-07 Gregory Nutt <spudmonkey@racsa.co.cr>
* The initial 0.3.6 release including an error that prevented
building successfully if the Pascal add-on was
was not present.
0.3.7 2008-01-31 Gregory Nutt <spudmonkey@racsa.co.cr>
* Added support for the Zilog Z16F using the Zilog Z16F2800100ZCOG
Development Kit.
* Add support toolchains that do not support making of dependencies
* Fix Cygwin build with spaces in directory names
* Name make system changes to deal with non-GNU toolchains (i.e., Zilog)
* Add support for Windows native toolchains that cannot follow Cygwin soft links
* Modified serial driver interface to handle hardware with non-16550A-like
interrupt architecture (like the Z16F)
* Added a "dumb" serial console driver to simplify OS bringup
* Corrected a bug that caused the errno value of one task to be clobbered
when a different task exits. Effects all architectures.
0.3.7 2008-xx-xx Gregory Nutt <spudmonkey@racsa.co.cr>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

190
Makefile
View File

@@ -1,7 +1,7 @@
############################################################
############################################################################
# Makefile
#
# 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,71 +31,136 @@
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
############################################################
############################################################################
TOPDIR = ${shell pwd}
TOPDIR := ${shell pwd | sed -e 's/ /\\ /g'}
-include ${TOPDIR}/.config
-include ${TOPDIR}/Make.defs
# Default tools
ifeq ($(DIRLINK),)
DIRLINK = $(TOPDIR)/tools/link.sh
DIRUNLINK = $(TOPDIR)/tools/unlink.sh
endif
# Process architecture and board-specific directories
ARCH_DIR = arch/$(CONFIG_ARCH)
ARCH_SRC = $(ARCH_DIR)/src
ARCH_INC = $(ARCH_DIR)/include
BOARD_DIR = configs/$(CONFIG_BOARD)
BOARD_DIR = configs/$(CONFIG_ARCH_BOARD)
SUBDIRS = sched lib $(ARCH_SRC) mm fs drivers examples/$(CONFIG_EXAMPLE)
# Add-on directories. These may or may not be in place in the
# NuttX source tree (they must be specifically installed)
PCODE_DIR := ${shell if [ -r pcode/Makefile ]; then echo "pcode"; fi}
# FSDIRS depend on file descriptor support; NONFSDIRS do not
# (except for parts of FSDIRS). We will exclude FSDIRS
# from the build if file descriptor support is disabled
NONFSDIRS = sched lib $(ARCH_SRC) mm examples/$(CONFIG_EXAMPLE) $(PCODE_DIR)
FSDIRS = fs drivers
ifeq ($(CONFIG_NET),y)
NONFSDIRS += net netutils
endif
# CLEANDIRS are the directories that will clean in. These are
# all directories that we know about.
# MAKEDIRS are the directories in which we will build targets
CLEANDIRS = $(NONFSDIRS) $(FSDIRS)
MAKEDIRS = $(NONFSDIRS)
ifeq ($(CONFIG_NFILE_DESCRIPTORS),0)
ifneq ($(CONFIG_NSOCKET_DESCRIPTORS),0)
MAKEDIRS += fs
endif
ifeq ($(CONFIG_NET),y)
MAKEDIRS += drivers
endif
else
MAKEDIRS += $(FSDIRS)
endif
# LINKLIBS is the list of NuttX libraries that is passed to the
# processor-specific Makefile to build the final target.
# Libraries in FSDIRS are excluded if file descriptor support
# is disabled.
LINKLIBS = sched/libsched$(LIBEXT) $(ARCH_SRC)/libarch$(LIBEXT) mm/libmm$(LIBEXT) \
fs/libfs$(LIBEXT) drivers/libdrivers$(LIBEXT) lib/liblib$(LIBEXT) \
examples/$(CONFIG_EXAMPLE)/lib$(CONFIG_EXAMPLE)$(LIBEXT)
lib/liblib$(LIBEXT) examples/$(CONFIG_EXAMPLE)/lib$(CONFIG_EXAMPLE)$(LIBEXT)
ifeq ($(CONFIG_NET),y)
LINKLIBS += net/libnet$(LIBEXT) netutils/libnetutils$(LIBEXT)
endif
ifeq ($(CONFIG_NFILE_DESCRIPTORS),0)
ifneq ($(CONFIG_NSOCKET_DESCRIPTORS),0)
LINKLIBS += fs/libfs$(LIBEXT)
endif
ifeq ($(CONFIG_NET),y)
LINKLIBS += drivers/libdrivers$(LIBEXT)
endif
else
LINKLIBS += fs/libfs$(LIBEXT) drivers/libdrivers$(LIBEXT)
endif
ifneq ($(PCODE_DIR),)
LINKLIBS += pcode/libpcode$(LIBEXT)
endif
# This is the name of the final target
BIN = nuttx$(EXEEXT)
all: $(BIN)
.PHONY: clean context clean_context distclean
# Build the mkconfig tool used to create include/nuttx/config.h
tools/mkconfig:
$(MAKE) -C tools -f Makefile.mkconfig TOPDIR=$(TOPDIR) mkconfig
@$(MAKE) -C tools -f Makefile.mkconfig TOPDIR="$(TOPDIR)" mkconfig
# Create the include/nuttx/config.h file
include/nuttx/config.h: $(TOPDIR)/.config tools/mkconfig
tools/mkconfig $(TOPDIR) > include/nuttx/config.h
# link the arch/<arch-name>/include dir to include/arch
include/arch: Make.defs
@if [ -e include/arch ]; then \
if [ -h include/arch ]; then \
rm -f include/arch ; \
else \
echo "include/arch exists but is not a symbolic link" ; \
exit 1 ; \
fi ; \
fi
@ln -s $(TOPDIR)/$(ARCH_DIR)/include include/arch
@$(DIRLINK) $(TOPDIR)/$(ARCH_DIR)/include include/arch
include/arch/board: Make.defs include/arch
@if [ -e include/arch/board ]; then \
if [ -h include/arch/board ]; then \
rm -f include/arch/board ; \
else \
echo "include/arch/board exists but is not a symbolic link" ; \
exit 1 ; \
fi ; \
fi
@ln -s $(TOPDIR)/$(BOARD_DIR)/include include/arch/board
# Link the configs/<board-name>/include dir to include/arch/board
include/arch/board: include/arch Make.defs include/arch
@$(DIRLINK) $(TOPDIR)/$(BOARD_DIR)/include include/arch/board
# Link the configs/<board-name>/src dir to arch/<arch-name>/src/board
$(ARCH_SRC)/board: Make.defs
@if [ -e $(ARCH_SRC)/board ]; then \
if [ -h $(ARCH_SRC)/board ]; then \
rm -f $(ARCH_SRC)/board ; \
else \
echo "$(ARCH_SRC)/board exists but is not a symbolic link" ; \
exit 1 ; \
fi ; \
fi
@ln -s $(TOPDIR)/$(BOARD_DIR)/src $(ARCH_SRC)/board
@$(DIRLINK) $(TOPDIR)/$(BOARD_DIR)/src $(ARCH_SRC)/board
context: check_context include/nuttx/config.h include/arch include/arch/board $(ARCH_SRC)/board
# Link arch/<arch-name>/include/<chip-name> to arch/<arch-name>/include/chip
$(ARCH_SRC)/chip: Make.defs
ifneq ($(CONFIG_ARCH_CHIP),)
@$(DIRLINK) $(TOPDIR)/$(ARCH_SRC)/$(CONFIG_ARCH_CHIP) $(ARCH_SRC)/chip
endif
# Link arch/<arch-name>/src/<chip-name> to arch/<arch-name>/src/chip
include/arch/chip: include/arch Make.defs
ifneq ($(CONFIG_ARCH_CHIP),)
@$(DIRLINK) $(TOPDIR)/$(ARCH_INC)/$(CONFIG_ARCH_CHIP) include/arch/chip
endif
dirlinks: include/arch include/arch/board include/arch/chip $(ARCH_SRC)/board $(ARCH_SRC)/chip
context: check_context include/nuttx/config.h dirlinks
clean_context:
rm -f include/nuttx/config.h include/arch $(ARCH_INC)/board $(ARCH_SRC)/board
@rm -f include/nuttx/config.h
@$(DIRUNLINK) include/arch/board
@$(DIRUNLINK) include/arch/chip
@$(DIRUNLINK) include/arch
@$(DIRUNLINK) $(ARCH_SRC)/board
@$(DIRUNLINK) $(ARCH_SRC)/chip
check_context:
@if [ ! -e ${TOPDIR}/.config -o ! -e ${TOPDIR}/Make.defs ]; then \
@@ -105,54 +170,63 @@ check_context:
fi
sched/libsched$(LIBEXT): context
$(MAKE) -C sched TOPDIR=$(TOPDIR) libsched$(LIBEXT)
@$(MAKE) -C sched TOPDIR="$(TOPDIR)" libsched$(LIBEXT)
lib/liblib$(LIBEXT): context
$(MAKE) -C lib TOPDIR=$(TOPDIR) liblib$(LIBEXT)
@$(MAKE) -C lib TOPDIR="$(TOPDIR)" liblib$(LIBEXT)
$(ARCH_SRC)/libarch$(LIBEXT): context
$(MAKE) -C $(ARCH_SRC) TOPDIR=$(TOPDIR) libarch$(LIBEXT)
@$(MAKE) -C $(ARCH_SRC) TOPDIR="$(TOPDIR)" libarch$(LIBEXT)
mm/libmm$(LIBEXT): context
$(MAKE) -C mm TOPDIR=$(TOPDIR) libmm$(LIBEXT)
@$(MAKE) -C mm TOPDIR="$(TOPDIR)" libmm$(LIBEXT)
net/libnet$(LIBEXT): context
@$(MAKE) -C net TOPDIR="$(TOPDIR)" libnet$(LIBEXT)
netutils/libnetutils$(LIBEXT): context
@$(MAKE) -C netutils TOPDIR="$(TOPDIR)" libnetutils$(LIBEXT)
fs/libfs$(LIBEXT): context
$(MAKE) -C fs TOPDIR=$(TOPDIR) libfs$(LIBEXT)
@$(MAKE) -C fs TOPDIR="$(TOPDIR)" libfs$(LIBEXT)
drivers/libdrivers$(LIBEXT): context
$(MAKE) -C drivers TOPDIR=$(TOPDIR) libdrivers$(LIBEXT)
@$(MAKE) -C drivers TOPDIR="$(TOPDIR)" libdrivers$(LIBEXT)
pcode/libpcode$(LIBEXT): context
@$(MAKE) -C pcode TOPDIR="$(TOPDIR)" libpcode$(LIBEXT)
examples/$(CONFIG_EXAMPLE)/lib$(CONFIG_EXAMPLE)$(LIBEXT): context
$(MAKE) -C examples/$(CONFIG_EXAMPLE) TOPDIR=$(TOPDIR) lib$(CONFIG_EXAMPLE)$(LIBEXT)
@$(MAKE) -C examples/$(CONFIG_EXAMPLE) TOPDIR="$(TOPDIR)" lib$(CONFIG_EXAMPLE)$(LIBEXT)
$(BIN): context depend $(LINKLIBS)
$(MAKE) -C $(ARCH_SRC) TOPDIR=$(TOPDIR) LINKLIBS="$(LINKLIBS)" $(BIN)
@$(MAKE) -C $(ARCH_SRC) TOPDIR="$(TOPDIR)" LINKLIBS="$(LINKLIBS)" $(BIN)
depend:
@for dir in $(SUBDIRS) ; do \
$(MAKE) -C $$dir TOPDIR=$(TOPDIR) depend ; \
@for dir in $(MAKEDIRS) ; do \
$(MAKE) -C $$dir TOPDIR="$(TOPDIR)" depend ; \
done
subdir_clean:
@for dir in $(SUBDIRS) ; do \
@for dir in $(CLEANDIRS) ; do \
if [ -e $$dir/Makefile ]; then \
$(MAKE) -C $$dir TOPDIR=$(TOPDIR) clean ; \
$(MAKE) -C $$dir TOPDIR="$(TOPDIR)" clean ; \
fi \
done
$(MAKE) -C tools -f Makefile.mkconfig TOPDIR=$(TOPDIR) clean
$(MAKE) -C mm -f Makefile.test TOPDIR=$(TOPDIR) clean
@$(MAKE) -C tools -f Makefile.mkconfig TOPDIR="$(TOPDIR)" clean
@$(MAKE) -C mm -f Makefile.test TOPDIR="$(TOPDIR)" clean
clean: subdir_clean
rm -f $(BIN) $(BIN).* mm_test *.map *~
@rm -f $(BIN) $(BIN).* mm_test *.map *~
subdir_distclean:
@for dir in $(SUBDIRS) ; do \
@for dir in $(CLEANDIRS) ; do \
if [ -e $$dir/Makefile ]; then \
$(MAKE) -C $$dir TOPDIR=$(TOPDIR) distclean ; \
$(MAKE) -C $$dir TOPDIR="$(TOPDIR)" distclean ; \
fi \
done
distclean: clean subdir_distclean clean_context
rm -f Make.defs setenv.sh .config
@rm -f Make.defs setenv.sh .config

View File

@@ -1,18 +1,29 @@
Nuttx-0.2.2
^^^^^^^^^^^^
nuttx-0.3.7
^^^^^^^^^^^
This is the fifth release of NuttX. There is no major new
functionality in this release. This release adds support for
new pthread barrier APIs, changes the directory structure,
to better handle different board configuarations using the same
processor architecture, and corrects a defect defects.
This is the 19th release of NuttX. This release includes the
preliminary port of NuttX to the ZiLOG z16f 16-bit microcontroller.
This port was verified using the ZiLOG z16f2800100zcog Development
and the ZiLOG ZDS-II toolchain. See http://www.zilog.com for
further information.
See the ChangeLog for a complete list of changes.
I emphasize that this is a preliminary release of the z16f port and
is only alpha or, perhaps, pre-alpha quality as of this writing.
There are a list of known issues in the TODO file in the root of
the NuttX directory. The overall quality of NuttX (excluding the
z16f port) continues to improve beyond the late beta level.
This release has been verified on the Linux user-mode platform and
the Neuros OSD using the test program under examples/ostest.
There are no known, critical defects but the project development
status remains at 'beta' status pending further test and
evaluation.
The z16f port required numerous changes to NuttX to handle:
This tarball contains a complete CVS snapshot from March 26, 2007.
* NEAR and FAR addressing, and
* Use of a Windows native toolchain in a Cygwin build environment.
In addition to the z16f port, at least one very critical bug was
found and corrected in NuttX: The thread-specific errno value of one
task was being randomly trashed when a different thread exitted.
This release were verified on the ZiLOG z16f2800100zcog, Neuros OSD
(ARM9), and the simulation platforms. As usual, any feedback about bugs
or suggestions for improvement would be greatly appreciated.
This tarball contains a complete CVS snapshot from January 31, 2008.

446
TODO
View File

@@ -1,81 +1,395 @@
NuttX TODO List
^^^^^^^^^^^^^^^
NuttX TODO List (Last updated January 6, 2008)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Task/Scheduler
^^^^^^^^^^^^^^
(6) 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/)
(2) USB (drivers/usbdev)
(3) Libraries (lib/)
(2) File system (fs/, drivers/)
(1) Pascal add-on (pcode/)
(2) Documentation (Documentation/)
(3) Build system
(0) Applications & Tests (examples/)
(1) ARM (arch/arm/)
(1) ARM/C5471 (arch/arm/src/c5471/)
(2) ARM/DM320 (arch/arm/src/dm320/)
(2) ARM/LPC214x (arch/arm/src/lpc214x/)
(4) pjrc-8052 / MCS51 (arch/pjrc-8051/)
(2) z80 (arch/z80/)
(4) z16 (arch/z16/)
- When a tasks exits, shouldn't all of its child pthreads also be terminated?
- Should task_delete() cause atexit() function to be called?
- Implement sys/mman.h and functions
- Implement sys/wait.h and functions
- Implement priority inheritance
- Make the system timer frequency configurable via defconfig. See:
_POSIX_CLOCKRES_MIN in limits.h
CLK_TCK in time.h
MSEC_PER_TICK in sched/clock_internal.h
- Consider implementing wait, waitpid, waitid. At present, a parent has
no information about child tasks.
o Task/Scheduler (sched/)
^^^^^^^^^^^^^^^^^^^^^^^
o Memory Managment
- Add an option to free all memory allocated by a task when the task exits.
This is probably not be worth the overhead for a deeply embedded system.
Description: When a tasks exits, shouldn't all of its child pthreads also be
terminated?
Status: Open
Priority: Medium, required for good emulation of process/pthread model.
o Signals
- 'Standard' signals and signal actions are not supported.
Description: atexit() supports registration of one function called on exit().
Should task_delete() also cause atexit() function to be called?
Status: Open
Priority: Low, task_delete() is non-standard and its behavior is
unspecified.
o pthreads
- pthread_cancel(): Should implemenent cancellation points and pthread_testcancel()
Description: Implement sys/mman.h and functions
Status: Open
Priority: Low
o Libraries
- There seems to be some kind of failure in the mutual exclusion logic on
buffered, "standard," IO.
- If two threads try fflush-ing at the same time, there is corruption
of the output.
- Yhere is a failure in the examples/ostest POSIX timer
test when CONFIG_DEBUG is enabled. This is almost certainly yet
another case where printf (or its kin) are being called from a
sensitive area in the OS.
- I am now seeing the same thing with the dm320 barrier test.
Apparently printf has some thread safety issues.
Description: Implement sys/wait.h and functions. Consider implementing wait,
waitpid, waitid. At present, a parent has no information about
child tasks.
Status: Open
Priority: Low
o File system
- Add some concept like mount points to handle mounted "real" filesystems.
Description: Implement priority inheritance
Status: Open
Priority: Medium, this is a good feature for realtime systems.
o Console Output
Description: Several APIs do not set errno. Need to review all APIs.
Status: Open
Priority: Medium, required for standard compliance (but makes the
code bigger)
o Documentation
- Document fs & driver logic
- Document filesystem, library
o Dynamic Loader
^^^^^^^^^^^^^^
Description: At some point in the future, I intend to port the XFLAT
dynamic loader into NuttX (see http://xflat.sourceforge.net/).
That would allow NuttX to dynamically load and link
external code in a mounted filesystem.
Status: Open
Priority: Low, Nice feature and I might do it someday
o Memory Managment (mm/)
^^^^^^^^^^^^^^^^^^^^^^
Description: Add an option to free all memory allocated by a task when the
task exits. This is probably not be worth the overhead for a
deeply embedded system.
Status: Open
Priority: Medium/Low, a good feature to prevent memory leaks but would
have negative impact on memory usage and code size.
Description: Current logic adapts size_t for 16-bit address machines vs.
32-bit address machines. But a small memory option should also
be provided so that the small offset option can be used with
32-bit machines that have small RAM memories (like the lpc2148)
Status: Open
Priority: High, a good feature enhancement.
o Signals (sched/, arch/)
^^^^^^^^^^^^^^^^^^^^^^^
Description: 'Standard' signals and signal actions are not supported.
(e.g., SIGINT, SIGCHLD, SIGSEGV, etc).
Status: Open
Priority: Low, required by standards but not so critical for an
embedded system.
o pthreads (sched/)
^^^^^^^^^^^^^^^^^
Description: pthread_cancel(): Should implement cancellation points and
pthread_testcancel()
Status: Open
Priority: Low, probably not that useful
o C++ Support
^^^^^^^^^^^
Description: Need to call static constructors
Status: Open
Priority: Low, depends on toolchain. Call to gcc's built-in static
constructor logic will probably have to be performed by
user logic in user_start().
o Network (net/, netutils/)
^^^^^^^^^^^^^^^^^^^^^^^^^
Description: Several of the netutils/ apps are untested. These include
uIP's netutils/smtp, dhcpd, resolv, webclient. Only minimal
testing of the others has been performed.
Status: Open
Priority: Medium, Important but not core NuttX functionality
Description: Should implement SOCK_RAW, SOCK_PACKET
Status: Open
Priority: Low
Description: uIP polling issues / Multiple network interface support:
(1) Current logic will not support multiple ethernet drivers.
Each driver should poll on TCP connections connect on the
network supported by the driver; UDP polling should respond
with TX data only if the UDP packet is intended for the
the network supported by the driver.
(2) If there were multiple drivers, polling would occur at
double the rate. Fix by using bound IP address in TCP
connection (lipaddr) and verifying that it is in the subnet
served by the driver.
Status: Open
Priority: Medium, The feature is not important, but it is important
for NuttX to resolve the architectural issues.
Description: Sendoto() and multiple network interface support:
When polled, would have to assure that the destination IP
is on the subnet served by the polling driver.
Status: Open
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
Description: Incoming UDP broadcast should only be accepted if listening on
INADDR_ANY(?)
Status: Open
Priority: Low
Description: Read-ahead buffers capture incoming TCP data when no user
thread is recv-ing the data. Should add some driver call to
support throttling; when there is no listener for new data, the
driver should be throttled. Perhaps the driver should disable
RX interrupts when throttled and re-anable on each poll time.
recvfrom would, of course, have to un-throttle.
Status: Open
Priority: Medium
Description: Need to standardize collection of statistics from network
drivers. examples/nsh ifconfig command should present
statistics.
Status: Open
Priority: Low
Description: Outgoing packets are dropped and overwritten by ARP packets
if the destination IP has not been mapped to a MAC. Could
improve send() performance by explicitly performing ARP before
sending the packet.
Status: Open
Priority: Medium
Description: Port PPP support from http://contiki.cvs.sourceforge.net/contiki/contiki-2.x/backyard/core/net/ppp/
Status: Open
Priority: Low
o USB (drivers/usbdev)
^^^^^^^^^^^^^^^^^^^^
Description: Implement USB device support
Status: Open
Priority: High
Description: Implement USB bulk / serial device support
Status: Open
Priority: High
o Libraries (lib/)
^^^^^^^^^^^^^^^^
Description: sscanf() and lib_vsprintf() do not support floating point
values.
Status: Open
Priority: Low
Description: The definition of environ in stdlib.h is bogus and will not
work as it should. This is because the underlying
representation of the environment is not an arry of pointers.
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 (fs/, drivers/)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
Description: Add chmod(), truncate().
Status: Open
Priority: Low
Description: FAT32: long file names
Status: Open
Priority: Medium
o Pascal Add-On (pcode/)
^^^^^^^^^^^^^^^^^^^^^^
Description: Need a test to verify execution of P-Code from files.
Need APIs to verify execution of P-Code from memory buffer.
Status: Open
Priority: Medium
o Documentation (Documentation/)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Description: Document driver/ logic
Status: Open
Priority: Low
Description: Document C-library APIs
Status: Open
Priority: Low
o Build system
- Names under arch are incorrect. These should hold processor architectures.
c5471 should be arm7
dm320 should be arm9
pjrc-8051 should be 805x
- SoC-specific logic should be in subdirectories under arch/<processor-name>.
Eg. arm7/include/c5471 should hold c5471 specific header files
- configs/pjrc-8051 should be configs/pjrc-87c52
^^^^^^^^^^^^
o Applications & Tests
Description: Some names under arch are still incorrect. These should be
processor architecture names: pjrc-8051 should be 805x
Status: Open
Priority: Low
o C5471
Description: configs/pjrc-8051 should be configs/pjrc-87c52
Status: Open
Priority: Low
o DM320
Description: Dependencies do not work correctly under configs/<board>/src
(same as arch/<arch>/src/board). Seems to be worse using SDCC.
Status: Open
Priority: Medium (maybe higher for z80 target)
o pjrc-8052 / MCS51
* Current status:
- Basic OS task management seems OK
- Fails when interrupts enabled. The stack pointer is around 0x6e
before the failure occurs. It looks like some issue when the
stack pointer moves from the directly to indirectly addressable
region (0x80 boundary).
- Work on the 8052 is temporarily on hold
- Use timer 0 as system timer. Timer 2 is needed for second UART.
Logic is implemented, but there needs to be a system configuration
to change the ticks-per-second value to match the timer interrupt
rate
- During build, there are several integer overflows reported:
gmtime_r.c aroud lines 184 and 185
clock_initialize.c at line 107
pthread_create.c at 330
sighand.c at 225 and 244
o Applications & Tests (examples/)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
o ARM (arch/arm/)
^^^^^^^^^^^^^^^
Description: Add option to use a separate stack for interrupt handling. At
present, each interrupt executes on top of the user stack
allocation making each user stack allocation larger than needed.
Status: Open
Priority: Medium
o ARM/C5471 (arch/arm/src/c5471/)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Description: UART re-configuration is untested and conditionally compiled out.
Status: Open
Priority: Medium. ttyS1 is not configured, but not used; ttyS0 is configured
by the bootloader
o ARM/DM320 (arch/arm/src/dm320/)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Description: config/ntos-dm320: It seems that when a lot of debug statements
are added, the system no longer boots. This is suspected to be
a stack problem: Making the stack bigger or removing arrays on
the stack seems to fix the problem (might also be the
bootloader overwriting memory)
Status: Open
Priority: Medium
Description: UART re-configuration is untested and conditionally compiled out.
Status: Open
Priority: Medium. ttyS1 is not configured, but not used; ttyS0 is configured
by the bootloader
o ARM/LPC214x (arch/arm/src/lpc214x/)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Description: Finish bringup
Status: Open
Priority: High
Description: Add MMC and USB support
Status: Open
Priority: Mediam
o pjrc-8052 / MCS51 (arch/pjrc-8051/)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Description: Current status:
- Basic OS task management seems OK
- Fails when interrupts enabled. The stack pointer is around
0x6e before the failure occurs. It looks like some issue
when the stack pointer moves from the directly to indirectly
addressable region (0x80 boundary).
- Work on the 8052 is temporarily on hold
Status: Open
Priority: Low, 8051 is a tough platform because of the tiny stack.
Description: Use timer 0 as system timer. Timer 2 is needed for second UART.
Logic is implemented, but there needs to be a system
configuration to change the ticks-per-second value to match the
timer interrupt rate
Status: Open
Priority: Low
Description: During build, there are several integer overflows reported:
sched/gmtime_r.c aroud lines 184 and 185
sched/clock_initialize.c at line 107
sched/pthread_create.c at 330
examples/ostest/barrier.c around lines 53 and 74
examples/ostest/sighand.c at 225 and 244
driver/serial.c in usleep calls around 347 and 354
Status: Open
Priority: Medium
Description Global data is not being initialized. Logic like that of SDCCs
crt0*.s needs to be incorporated into the system boot logic
Status: Open
Priority: Low -- only because there as so many other issues with 8051
o z80 (arch/z80)
^^^^^^^^^^^^^^^
Description: The Has the same problems with interger overflow during compilation
as described for pjrc-8051. At typical cause is code like
usleep(500*1000) which exceeds the range of a 16-bit integer
Status: See pjrc-8051
Priority: See pjrc-8051
Description: The simulated serial console (configs/z80sim/src/z80_serial.c +
driver/serial.c) does not work. This is because there are
no interrupts in the simulation so there is never any serial
traffic.
Status: Open
Priority: Low -- the simulated console is not critical path and the designs
to solve the problem are complex.
o z16 (arch/z16)
^^^^^^^^^^^^^^^^
Description: ZDS-II Librarian complains that the source for the .obj file
is not in the library.
Status: Open
Priority: Low, thought to be cosmetic. I think this is a consequence of
replacing vs. inserting the library.
Description: When the interrupt-driven serial driver is used, the system
hangs. This is because of TX ready (TRDE) interrupts that
get lost while interrupts are disabled. The existing
serial driver appears to be limited to hardware with a
latching, level-sensitive TX ready interrupt.
Status: Open
Priority: Medium. A polled, write-only serial driver is used in the
interim for system testing.
Description: The system delays do not appear to be correct with the
examples/ostest/timedmqueue.c test.
Status: Open
Priority: Medium-High
Description: At present, the z16f port does not run properly when CONFIG_DEBUG
is disabled. I have not determined the cause for this -- it
may be an issue with optimization?? Or clock setup??
Status: Open
Priority: Medium-High

View File

@@ -11,8 +11,33 @@ Table of Contents
Architecture-Specific Code
^^^^^^^^^^^^^^^^^^^^^^^^^^
The file include/nuttx/arch.h identifies all of the APIs that must
be provided by the architecture specific logic. (It also includes
The NuttX configuration consists of:
o Processor architecture specific files. These are the files contained
in the arch/<arch-name>/ directory discussed in this README.
o Chip/SoC specific files. Each processor processor architecture
is embedded in chip or System-on-a-Chip (SoC) architecture. The
full chip architecture includes the processor architecture plus
chip-specific interrupt logic, general purpose I/O (GIO) logic, and
specialized, internal peripherals (such as UARTs, USB, etc.).
These chip-specific files are contained within chip-specific
sub-directories in the arch/<arch-name>/ directory and are selected
via the CONFIG_ARCH_name selection
o Board specific files. In order to be usable, the chip must be
contained in a board environment. The board configuration defines
additional properties of the board including such things as
peripheral LEDs, external peripherals (such as network, USB, etc.).
These board-specific configuration files can be found in the
configs/<board-name>/ sub-directories.
This README will address the processor architecture specific files
that are contained in the arch/<arch-name>/ directory. The file
include/nuttx/arch.h identifies all of the APIs that must
be provided by this architecture specific logic. (It also includes
arch/<arch-name>/arch.h as described below).
Directory Structure
@@ -25,18 +50,27 @@ subdirectory). Each architecture must provide a subdirectory <arch-name>
under arch/ with the following characteristics:
<arch-name>
|-- include
<arch-name>/
|-- include/
| |--<chip-name>/
| | `-- (chip-specific header files)
| |--<other-chips>/
| |-- arch.h
| |-- irq.h
| `-- types.h
`-- src
`-- src/
|--<chip-name>/
| `-- (chip-specific source files)
|--<other-chips>/
|-- Makefile
`-- (architecture-specific source files)
Summary of Files
^^^^^^^^^^^^^^^^
include/<chip-name>/
This sub-directory contains chip-specific header files.
include/arch.h
This is a hook for any architecture specific definitions that may
be needed by the system. It is included by include/nuttx/arch.h
@@ -76,6 +110,9 @@ include/irq.h
This file must also define NR_IRQS, the total number of IRQs supported
by the board.
src/<chip-name>/
This sub-directory contains chip-specific source files.
src/Makefile
This makefile will be executed to build the targets src/libup.a and
src/up_head.o. The up_head.o file holds the entry point into the system
@@ -92,22 +129,55 @@ arch/sim
This port does not support interrupts or a real timer (and hence no
round robin scheduler) Otherwise, it is complete.
arch/c5471
TI TMS320C5471 (also called TMS320DM180 or just C5471).
NuttX operates on the ARM7 of this dual core processor. This port
complete, verified, and included in the NuttX release 0.1.1.
arch/arm
This directory holds common ARM architectures. At present, this includes
the following subdirectories:
arch/dm320
TI TMS320DM320 (also called just DM320).
NuttX operates on the ARM9EJS of this dual core processor. This port
complete, verified, and included in the NuttX release 0.2.1.
arch/arm/include and arch/arm/common
Common ARM logic.
arch/arm/include/c5471 and arch/arm/src/c5471
TI TMS320C5471 (also called TMS320DM180 or just C5471).
NuttX operates on the ARM7 of this dual core processor. This port
complete, verified, and included in the NuttX release 0.1.1.
arch/arm/include/dm320 and arch/arm/src/dm320
TI TMS320DM320 (also called just DM320).
NuttX operates on the ARM9EJS of this dual core processor. This port
complete, verified, and included in the NuttX release 0.2.1.
arch/arm/include/lpc214x and arch/arm/src/lpc214x
These directories provide support for NXP LPC214x family of
processors.
STATUS: This port is in progress and should be available in the
nuttx-0.2.5 release.
arch/m68322
A work in progress.
STATUS: Stalled for the moment.
arch/pjrc-8051
8051 Microcontroller. This port is not quite ready for prime time.
arch/z16
ZiLog z16f Microcontroller.
STATUS: A work in progress
arch/z80
ZiLog z80 Microcontroller.
STATUS: Functional with no known defects. There are still several
OS features that have not yet been tested (e.g., networking).
The following architecture directories are deprecated. They have been
replaced by the logic in arm/arm and will deleted at some point in the
future.
arch/c5471
Replaced with arch/arm/include/c5471 and arch/arm/src/c5471
arch/dm320
Replaced with arch/arm/include/dm320 and arch/arm/src/dm320
Other ports for the for the TI TMS320DM270 and for MIPS are in various states
of progress

View File

@@ -1,5 +1,5 @@
/************************************************************
* os_external.h
* arch/arch.h
*
* Copyright (C) 2007 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
@@ -33,28 +33,35 @@
*
************************************************************/
#ifndef __OS_EXTERNAL_H
#define __OS_EXTERNAL_H
/* This file should never be included directed but, rather,
* only indirectly through nuttx/arch.h
*/
#ifndef __ARCH_ARCH_H
#define __ARCH_ARCH_H
/************************************************************
* Included Files
************************************************************/
#include <nuttx/config.h>
#include <pthread.h>
#include <sched.h>
#include <nuttx/compiler.h>
/************************************************************
* Definitions
************************************************************/
/************************************************************
* Global Function Prototypes
* Inline functions
************************************************************/
/************************************************************
* Global Function Prototypes
* Public Types
************************************************************/
/************************************************************
* Public Variables
************************************************************/
/************************************************************
* Public Function Prototypes
************************************************************/
#ifdef __cplusplus
@@ -64,28 +71,10 @@ extern "C" {
#define EXTERN extern
#endif
/* These are functions that must be supplied by the application */
EXTERN void weak_function user_initialize(void);
EXTERN int user_start(int argc, char *argv[]);
/* Functions contained in os_task.c *************************/
EXTERN void os_start(void); /* OS entry point called by boot logic */
/* Functions contained in mm_initialize.c *******************/
EXTERN void mm_initialize(FAR void *heap_start, size_t heap_size);
EXTERN void mm_addregion(FAR void *heapstart, size_t heapsize);
/* Functions contained in mm_sem.c **************************/
EXTERN int mm_trysemaphore(void);
EXTERN void mm_givesemaphore(void);
#undef EXTERN
#ifdef __cplusplus
}
#endif
#endif /* __OS_EXTERNAL_H */
#endif /* __ARCH_ARCH_H */

View File

@@ -0,0 +1,105 @@
/************************************************************
* arch/c5471/irq.h
*
* Copyright (C) 2007 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 nuttx/irq.h
*/
#ifndef __ARCH_C5471_IRQ_H
#define __ARCH_C5471_IRQ_H
/************************************************************
* Included Files
************************************************************/
/************************************************************
* Definitions
************************************************************/
/* C5471 Interrupts */
#define C5471_IRQ_TIMER0 0
#define C5471_IRQ_TIMER1 1
#define C5471_IRQ_TIMER2 2
#define C5471_IRQ_GPIO0 3
#define C5471_IRQ_ETHER 4
#define C5471_IRQ_KBGPIO_0_7 5
#define C5471_IRQ_UART 6
#define C5471_IRQ_UART_IRDA 7
#define C5471_IRQ_KBGPIO_8_15 8
#define C5471_IRQ_GPIO3 9
#define C5471_IRQ_GPIO2 10
#define C5471_IRQ_I2C 11
#define C5471_IRQ_GPIO1 12
#define C5471_IRQ_SPI 13
#define C5471_IRQ_GPIO_4_19 14
#define C5471_IRQ_API 15
#define C5471_IRQ_WATCHDOG C5471_IRQ_TIMER0
#define C5471_IRQ_SYSTIMER C5471_IRQ_TIMER2
#define NR_IRQS (C5471_IRQ_API+1)
/************************************************************
* Public Types
************************************************************/
/************************************************************
* Inline functions
************************************************************/
/************************************************************
* Public Variables
************************************************************/
/************************************************************
* 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 /* __ARCH_C5471_IRQ_H */

View File

@@ -0,0 +1,134 @@
/************************************************************
* arch/dm320/irq.h
*
* Copyright (C) 2007 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 nuttx/irq.h
*/
#ifndef __ARCH_DM320_IRQ_H
#define __ARCH_DM320_IRQ_H
/************************************************************
* Included Files
************************************************************/
/************************************************************
* Definitions
************************************************************/
/* DM320 Interrupts */
#define DM320_IRQ_TMR0 0 /* IRQ0: Timer 0 Interrupt */
#define DM320_IRQ_TMR1 1 /* IRQ1: Timer 1 Interrupt */
#define DM320_IRQ_TMR2 2 /* IRQ2: Timer 2 Interrupt (CCD timer 0) */
#define DM320_IRQ_TMR3 3 /* IRQ3: Timer 3 Interrupt (CCD timer 1) */
#define DM320_IRQ_CCDVD0 4 /* IRQ4: CCD VD Interrupt #0 */
#define DM320_IRQ_CCDVD1 5 /* IRQ5: CCD VD Interrupt #1 */
#define DM320_IRQ_CCDWEN 6 /* IRQ6: CCD WEN Interrupt */
#define DM320_IRQ_VENC 7 /* IRQ7: Video Encoder Interrupt */
#define DM320_IRQ_SP0 8 /* IRQ8: Serial Port 0 Interrupt (with DMA) */
#define DM320_IRQ_SP1 9 /* IRQ9: Serial Port 1 Interrupt */
#define DM320_IRQ_EXTHOST 10 /* IRQ10: External host interrupt */
#define DM320_IRQ_IMGBUF 11 /* IRQ11: Image Buffer */
#define DM320_IRQ_UART0 12 /* IRQ12: UART0 Interrupt */
#define DM320_IRQ_UART1 13 /* IRQ13: UART1 Interrupt */
#define DM320_IRQ_USB0 14 /* IRQ14: USB 0 Interrupt (DMA) */
#define DM320_IRQ_USB1 15 /* IRQ15: USB 1 Interrupt (Core) */
#define DM320_IRQ_VLYNQ 16 /* IRQ16: VLYNQ Interrupt */
#define DM320_IRQ_MTC0 17 /* IRQ17: Memory Traffic Controller 0 (DMA) */
#define DM320_IRQ_MTC1 18 /* IRQ18: Memory Traffic Controller 1 (CFC_RDY) */
#define DM320_IRQ_MMCSD0 19 /* IRQ19: MMC/SD or MS 0 Interrupt */
#define DM320_IRQ_MMCSD1 20 /* IRQ20: MMC/SD or MS 1 Interrupt */
#define DM320_IRQ_EXT0 21 /* IRQ21: External Interrupt #0 (GIO0) */
#define DM320_IRQ_EXT1 22 /* IRQ22: External Interrupt #1 (GIO1) */
#define DM320_IRQ_EXT2 23 /* IRQ23: External Interrupt #2 (GIO2) */
#define DM320_IRQ_EXT3 24 /* IRQ24: External Interrupt #3 (GIO3) */
#define DM320_IRQ_EXT4 25 /* IRQ25: External Interrupt #4 (GIO4) */
#define DM320_IRQ_EXT5 26 /* IRQ26: External Interrupt #5 (GIO5) */
#define DM320_IRQ_EXT6 27 /* IRQ27: External Interrupt #6 (GIO6) */
#define DM320_IRQ_EXT7 28 /* IRQ28: External Interrupt #7 (GIO7) */
#define DM320_IRQ_EXT8 29 /* IRQ29: External Interrupt #8 (GIO8) */
#define DM320_IRQ_EXT9 30 /* IRQ30: External Interrupt #9 (GIO9) */
#define DM320_IRQ_EXT10 31 /* IRQ31: External Interrupt #10 (GIO10) */
#define DM320_IRQ_EXT11 32 /* IRQ32: External Interrupt #11 (GIO11) */
#define DM320_IRQ_EXT12 33 /* IRQ33: External Interrupt #12 (GIO12) */
#define DM320_IRQ_EXT13 34 /* IRQ34: External Interrupt #13 (GIO13) */
#define DM320_IRQ_EXT14 35 /* IRQ35: External Interrupt #14 (GIO14) */
#define DM320_IRQ_EXT15 36 /* IRQ36: External Interrupt #15 (GIO15) */
#define DM320_IRQ_PREV0 37 /* IRQ37: Preview Engine 0 (Preview Over) */
#define DM320_IRQ_PREV1 38 /* IRQ38: Preview Engine 1 (Preview Historgram Over) */
#define DM320_IRQ_WDT 39 /* IRQ39: Watchdog Timer Interrupt */
#define DM320_IRQ_I2C 40 /* IRQ40: I2C Interrupt */
#define DM320_IRQ_CLKC 41 /* IRQ41: Clock controller Interrupt (wake up) */
#define DM320_IRQ_E2ICE 42 /* IRQ42: Embedded ICE Interrupt */
#define DM320_IRQ_ARMCOMRX 43 /* IRQ43: ARMCOMM Receive Interrupt */
#define DM320_IRQ_ARMCOMTX 44 /* IRQ44: ARMCOMM Transmit Interrupt */
#define DM320_IRQ_RSV 45 /* IRQ45: Reserved Interrupt */
#define DM320_IRQ_SYSTIMER DM320_IRQ_TMR0
#define NR_IRQS (DM320_IRQ_RSV+1)
/************************************************************
* Public Types
************************************************************/
/************************************************************
* Inline functions
************************************************************/
/************************************************************
* Public Variables
************************************************************/
/************************************************************
* 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 /* __ARCH_DM320_IRQ_H */

229
arch/arm/include/irq.h Normal file
View File

@@ -0,0 +1,229 @@
/************************************************************
* arch/irq.h
*
* Copyright (C) 2007 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 nuttx/irq.h
*/
#ifndef __ARCH_IRQ_H
#define __ARCH_IRQ_H
/************************************************************
* Included Files
************************************************************/
#include <nuttx/irq.h>
#include <arch/chip/irq.h>
/************************************************************
* Definitions
************************************************************/
/* IRQ Stack Frame Format:
*
* Context is always saved/restored in the same way:
*
* (1) stmia rx, {r0-r14}
* (2) then the PC and CPSR
*
* This results in the following set of indices that
* can be used to access individual registers in the
* xcp.regs array:
*/
#define REG_R0 (0)
#define REG_R1 (1)
#define REG_R2 (2)
#define REG_R3 (3)
#define REG_R4 (4)
#define REG_R5 (5)
#define REG_R6 (6)
#define REG_R7 (7)
#define REG_R8 (8)
#define REG_R9 (9)
#define REG_R10 (10)
#define REG_R11 (11)
#define REG_R12 (12)
#define REG_R13 (13)
#define REG_R14 (14)
#define REG_R15 (15)
#define REG_CPSR (16)
#define XCPTCONTEXT_REGS (17)
#define XCPTCONTEXT_SIZE (4 * XCPTCONTEXT_REGS)
#define REG_A1 REG_R0
#define REG_A2 REG_R1
#define REG_A3 REG_R2
#define REG_A4 REG_R3
#define REG_V1 REG_R4
#define REG_V2 REG_R5
#define REG_V3 REG_R6
#define REG_V4 REG_R7
#define REG_V5 REG_R8
#define REG_V6 REG_R9
#define REG_V7 REG_R10
#define REG_SB REG_R9
#define REG_SL REG_R10
#define REG_FP REG_R11
#define REG_IP REG_R12
#define REG_SP REG_R13
#define REG_LR REG_R14
#define REG_PC REG_R15
/************************************************************
* Public Types
************************************************************/
/* This struct defines the way the registers are stored. We
* need to save:
*
* 1 CPSR
* 7 Static registers, v1-v7 (aka r4-r10)
* 1 Frame pointer, fp (aka r11)
* 1 Stack pointer, sp (aka r13)
* 1 Return address, lr (aka r14)
* ---
* 11 (XCPTCONTEXT_USER_REG)
*
* On interrupts, we also need to save:
* 4 Volatile registers, a1-a4 (aka r0-r3)
* 1 Scratch Register, ip (aka r12)
*---
* 5 (XCPTCONTEXT_IRQ_REGS)
*
* For a total of 17 (XCPTCONTEXT_REGS)
*/
#ifndef __ASSEMBLY__
struct xcptcontext
{
/* The following function pointer is non-zero if there
* are pending signals to be processed.
*/
#ifndef CONFIG_DISABLE_SIGNALS
void *sigdeliver; /* Actual type is sig_deliver_t */
#endif
/* These are saved copies of LR and CPSR used during
* signal processing.
*/
uint32 saved_pc;
uint32 saved_cpsr;
/* Register save area */
uint32 regs[XCPTCONTEXT_REGS];
};
#endif
/************************************************************
* Inline functions
************************************************************/
#ifndef __ASSEMBLY__
/* Save the current interrupt enable state & disable IRQs */
static inline irqstate_t irqsave(void)
{
unsigned int flags;
unsigned int temp;
__asm__ __volatile__
(
"\tmrs %0, cpsr\n"
"\torr %1, %0, #128\n"
"\tmsr cpsr_c, %1"
: "=r" (flags), "=r" (temp)
:
: "memory");
return flags;
}
/* Restore saved IRQ & FIQ state */
static inline void irqrestore(irqstate_t flags)
{
__asm__ __volatile__
(
"msr cpsr_c, %0"
:
: "r" (flags)
: "memory");
}
static inline void system_call(swint_t func, int parm1,
int parm2, int parm3)
{
__asm__ __volatile__
(
"mov\tr0,%0\n\t"
"mov\tr1,%1\n\t"
"mov\tr2,%2\n\t"
"mov\tr3,%3\n\t"
"swi\t0x900001\n\t"
:
: "r" ((long)(func)), "r" ((long)(parm1)),
"r" ((long)(parm2)), "r" ((long)(parm3))
: "r0", "r1", "r2", "r3", "lr");
}
#endif
/************************************************************
* Public Variables
************************************************************/
/************************************************************
* 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 /* __ARCH_IRQ_H */

75
arch/arm/include/limits.h Normal file
View File

@@ -0,0 +1,75 @@
/************************************************************
* limits.h
*
* Copyright (C) 2007 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.
*
************************************************************/
#ifndef __ARCH_LIMITS_H
#define __ARCH_LIMITS_H
/************************************************************
* Included Files
************************************************************/
/************************************************************
* Definitions
************************************************************/
#define CHAR_BIT 8
#define SCHAR_MIN 0x80
#define SCHAR_MAX 0x7f
#define UCHAR_MAX 0xff
/* These could be different on machines where char is unsigned */
#define CHAR_MIN SCHAR_MIN
#define CHAR_MAX SCHAR_MAX
#define SHRT_MIN 0x8000
#define SHRT_MAX 0x7fff
#define USHRT_MAX 0xffff
#define INT_MIN 0x80000000
#define INT_MAX 0x7fffffff
#define UINT_MAX 0xffffffff
/* These change on 32-bit and 64-bit platforms */
#define LONG_MAX 0x80000000
#define LONG_MIN 0x7fffffff
#define ULONG_MAX 0xffffffff
#define LLONG_MAX 0x8000000000000000
#define LLONG_MIN 0x7fffffffffffffff
#define ULLONG_MAX 0xffffffffffffffff
#endif /* __ARCH_LIMITS_H */

View File

@@ -0,0 +1,126 @@
/****************************************************************************
* arch/lpc214x/irq.h
*
* Copyright (C) 2007 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 nuttx/irq.h
*/
#ifndef __ARCH_LPC214X_IRQ_H
#define __ARCH_LPC214X_IRQ_H
/****************************************************************************
* Included Files
****************************************************************************/
/****************************************************************************
* Definitions
****************************************************************************/
/* LPC214X Interrupts */
#define LPC214X_WDT_IRQ 0 /* Watchdog */
#define LPC214X_RESERVED_IRQ 1 /* SWI only */
#define LPC214X_DBGCOMMRX_IRQ 2 /* Embedded debug */
#define LPC214X_DBGCOMMTX_IRQ 3 /* Embedded debug */
#define LPC214X_TIMER0_IRQ 4 /* Timer 0 */
#define LPC214X_TIMER1_IRQ 5 /* Timer 1 */
#define LPC214X_UART0_IRQ 6 /* UART 0 */
#define LPC214X_UART1_IRQ 7 /* UART 1 */
#define LPC214X_PWM0_IRQ 8 /* PWM 0 */
#define LPC214X_I2C0_IRQ 9 /* I2C 0 */
#define LPC214X_SPI0_IRQ 10 /* SPI 0 */
#define LPC214X_SPI1_IRQ 11 /* SPI 1 */
#define LPC214X_PLL_IRQ 12 /* PLL Lock IRQ */
#define LPC214X_RTC_IRQ 13 /* Real Time Clock */
#define LPC214X_EINT0_IRQ 14 /* External interrupt 0 */
#define LPC214X_EINT1_IRQ 15 /* External interrupt 1 */
#define LPC214X_EINT2_IRQ 16 /* External interrupt 2 */
#define LPC214X_EINT3_IRQ 17 /* External interrupt 3 */
#define LPC214X_ADC0_IRQ 18 /* ADC 0 */
#define LPC214X_I2C1_IRQ 19 /* I2C 1 */
#define LPC214X_BOD_IRQ 20 /* Brown Out Detect */
#define LPC214X_ADC1_IRQ 21 /* ADC 1 */
#define LPC214X_USB_IRQ 22 /* USB */
#define LPC214X_IRQ_SYSTIMER LPC214X_TIMER0_IRQ
#define NR_IRQS 23
/* There are 16 vectored interrupts. If vectored interrupts are enabled, the
* following will be used by the system.
*/
#define LPC214X_SYSTEMER_VEC 0 /* System timer */
/****************************************************************************
* Public Types
****************************************************************************/
#ifndef __ASSEMBLY__
typedef void (*vic_vector_t)(uint32 *regs);
#endif
/****************************************************************************
* Inline functions
****************************************************************************/
/****************************************************************************
* Public Variables
****************************************************************************/
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
#ifndef __ASSEMBLY__
#ifdef __cplusplus
#define EXTERN extern "C"
extern "C" {
#else
#define EXTERN extern
#endif
#ifndef CONFIG_VECTORED_INTERRUPTS
EXTERN void up_attach_vector(int irq, int vector, vic_vector_t handler);
EXTERN void up_detach_vector(int vector);
#endif
#undef EXTERN
#ifdef __cplusplus
}
#endif
#endif
#endif /* __ARCH_LPC214X_IRQ_H */

61
arch/arm/include/serial.h Normal file
View File

@@ -0,0 +1,61 @@
/************************************************************
* arch/serial.h
*
* Copyright (C) 2007 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.
*
************************************************************/
#ifndef __ARCH_SERIAL_H
#define __ARCH_SERIAL_H
/************************************************************
* Included Files
************************************************************/
/************************************************************
* Definitions
************************************************************/
/* IOCTL commands supported by the ARM serial driver */
#define TIOCSBRK 0x5401 /* BSD compatibility */
#define TIOCCBRK 0x5402 /* " " " " */
#define TIOCSERGSTRUCT 0x5403 /* Get up_dev_t for port */
/************************************************************
* Public Data
************************************************************/
/************************************************************
* Public Functions
************************************************************/
#endif /* __ARCH_SERIAL_H */

82
arch/arm/include/types.h Normal file
View File

@@ -0,0 +1,82 @@
/************************************************************
* arch/types.h
*
* Copyright (C) 2007 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_TYPES_H
#define __ARCH_TYPES_H
/************************************************************
* Included Files
************************************************************/
/************************************************************
* Definitions
************************************************************/
/************************************************************
* Type Declarations
************************************************************/
#ifndef __ASSEMBLY__
/* These are the sizes of the standard GNU types */
typedef char sbyte;
typedef unsigned char ubyte;
typedef unsigned char uint8;
typedef unsigned char boolean;
typedef short sint16;
typedef unsigned short uint16;
typedef int sint32;
typedef unsigned int uint32;
typedef long long sint64;
typedef unsigned long long uint64;
/* This is the size of the interrupt state save returned by
* irqsave()
*/
typedef unsigned int irqstate_t;
#endif /* __ASSEMBLY__ */
/************************************************************
* Global Function Prototypes
************************************************************/
#endif /* __ARCH_TYPES_H */

View File

@@ -0,0 +1,63 @@
/************************************************************
* watchdog.h
*
* Copyright (C) 2007 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.
*
************************************************************/
#ifndef __ARCH_WATCHDOG_H
#define __ARCH_WATCHDOG_H
/************************************************************
* Included Files
************************************************************/
/************************************************************
* Definitions
************************************************************/
/* IOCTL commands supported by the C5471 watchdog driver */
#define WDIOC_KEEPALIVE 0x5701 /* Restart the watchdog timer */
/************************************************************
* Private Data
************************************************************/
/************************************************************
* Private Functions
************************************************************/
/************************************************************
* Public Functions
************************************************************/
#endif /* __ARCH_WATCHDOG_H */

123
arch/arm/src/Makefile Normal file
View File

@@ -0,0 +1,123 @@
############################################################################
# arch/arm/src/Makefile
#
# 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.
#
############################################################################
-include $(TOPDIR)/Make.defs
-include chip/Make.defs
ARCH_SRCDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src
CFLAGS += -I$(ARCH_SRCDIR)/chip -I$(ARCH_SRCDIR)/common -I$(TOPDIR)/sched
HEAD_AOBJ = $(HEAD_ASRC:.S=$(OBJEXT))
ASRCS = $(CHIP_ASRCS) $(CMN_ASRCS)
AOBJS = $(ASRCS:.S=$(OBJEXT))
CSRCS = $(CHIP_CSRCS) $(CMN_CSRCS)
COBJS = $(CSRCS:.c=$(OBJEXT))
SRCS = $(ASRCS) $(CSRCS)
OBJS = $(AOBJS) $(COBJS)
LDFLAGS = $(ARCHSCRIPT)
EXTRA_LIBS =
LINKLIBS =
LDPATHES = $(addprefix -L$(TOPDIR)/,$(dir $(LINKLIBS)))
LDLIBS = $(patsubst lib%,-l%,$(basename $(notdir $(LINKLIBS))))
BOARDDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src/board
LIBGCC = ${shell $(CC) -print-libgcc-file-name}
VPATH = chip:common
all: $(HEAD_OBJ) libarch$(LIBEXT)
$(AOBJS) $(HEAD_AOBJ): %$(OBJEXT): %.S
$(call ASSEMBLE, $<, $@)
$(COBJS): %$(OBJEXT): %.c
$(call COMPILE, $<, $@)
libarch$(LIBEXT): $(OBJS)
@( for obj in $(OBJS) ; do \
$(call ARCHIVE, $@, $${obj}); \
done ; )
board/libboard$(LIBEXT):
$(MAKE) -C board TOPDIR="$(TOPDIR)" libboard$(LIBEXT)
nuttx: $(HEAD_AOBJ) board/libboard$(LIBEXT)
@echo "LD: nuttx"
@$(LD) --entry=__start $(LDFLAGS) $(LDPATHES) -L$(BOARDDIR) -o $(TOPDIR)/$@ $(HEAD_AOBJ) \
--start-group $(LDLIBS) -lboard --end-group $(EXTRA_LIBS) $(LIBGCC)
@$(NM) $(TOPDIR)/$@ | \
grep -v '\(compiled\)\|\(\$(OBJEXT)$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | \
sort > $(TOPDIR)/System.map
@export vflashstart=`$(OBJDUMP) --all-headers $(TOPDIR)/$@ | grep _vflashstart | cut -d' ' -f1`; \
if [ ! -z "$$vflashstart" ]; then \
$(OBJCOPY) --adjust-section-vma=.vector=0x$$vflashstart $(TOPDIR)/$@ $(TOPDIR)/$@.flashimage; \
mv $(TOPDIR)/$@.flashimage $(TOPDIR)/$@; \
fi
ifeq ($(CONFIG_RRLOAD_BINARY),y)
@$(TOPDIR)/tools/mkimage.sh --Prefix $(CROSSDEV) $(TOPDIR)/$@ $(TOPDIR)/$@.rr
@if [ -w /tftpboot ] ; then \
cp -f $(TOPDIR)/$@.rr /tftpboot/$@.rr.${CONFIG_ARCH}; \
fi
endif
.depend: Makefile chip/Make.defs $(SRCS)
@if [ -e board/Makefile ]; then \
$(MAKE) -C board TOPDIR="$(TOPDIR)" depend ; \
fi
@$(MKDEP) --dep-path chip --dep-path common $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
@touch $@
depend: .depend
clean:
@if [ -e board/Makefile ]; then \
$(MAKE) -C board TOPDIR="$(TOPDIR)" clean ; \
fi
@rm -f libarch$(LIBEXT) *~ .*.swp
$(call CLEAN)
distclean: clean
@if [ -e board/Makefile ]; then \
$(MAKE) -C board TOPDIR="$(TOPDIR)" distclean ; \
fi
@rm -f Make.dep .depend
-include Make.dep

View File

@@ -0,0 +1,49 @@
############################################################################
# c5471/Make.defs
#
# Copyright (C) 2007 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.
#
############################################################################
HEAD_ASRC = up_nommuhead.S
CMN_ASRCS = up_saveusercontext.S up_fullcontextrestore.S
CMN_CSRCS = up_allocateheap.c up_assert.c up_blocktask.c up_copystate.c \
up_createstack.c up_dataabort.c up_mdelay.c up_udelay.c up_doirq.c \
up_exit.c up_idle.c up_initialize.c up_initialstate.c \
up_interruptcontext.c up_prefetchabort.c up_releasepending.c \
up_releasestack.c up_reprioritizertr.c up_schedulesigaction.c \
up_sigdeliver.c up_syscall.c up_unblocktask.c \
up_undefinedinsn.c up_usestack.c
CHIP_ASRCS = c5471_lowputc.S c5471_vectors.S
CHIP_CSRCS = c5471_irq.c c5471_serial.c c5471_timerisr.c c5471_watchdog.c \
c5471_ethernet.c

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,242 @@
/************************************************************
* c5471/c5471_irq.c
*
* Copyright (C) 2007 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.
*
************************************************************/
/************************************************************
* Included Files
************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <nuttx/irq.h>
#include "up_arch.h"
#include "os_internal.h"
#include "up_internal.h"
/************************************************************
* Definitions
************************************************************/
#define ILR_EDGESENSITIVE 0x00000020
#define ILR_PRIORITY 0x0000001E
/************************************************************
* Public Data
************************************************************/
uint32 *current_regs;
/************************************************************
* Private Data
************************************************************/
/* The value of _vflashstart is defined in ld.script. It
* could be hard-coded because we know that correct IRAM
* area is 0xffc00000.
*/
extern int _svectors; /* Type does not matter */
/* The C5471 has FLASH at the low end of memory. The
* rrload bootloaer will catch all interrupts and re-vector
* them to vectors stored in IRAM. The following table is
* used to initialize those vectors.
*/
static up_vector_t g_vectorinittab[] =
{
(up_vector_t)NULL,
up_vectorundefinsn,
up_vectorswi,
up_vectorprefetch,
up_vectordata,
up_vectoraddrexcptn,
up_vectorirq,
up_vectorfiq
};
#define NVECTORS ((sizeof(g_vectorinittab)) / sizeof(up_vector_t))
/************************************************************
* Private Functions
************************************************************/
/************************************************************
* Name: up_ackirq
*
* Description:
* Acknowlede the IRQ.Bit 0 of the Interrupt Control
* Register == New IRQ agreement (NEW_IRQ_AGR). Reset IRQ
* output. Clear source IRQ register. Enables a new IRQ
* generation. Reset by internal logic.
*
************************************************************/
static inline void up_ackirq(unsigned int irq)
{
uint32 reg;
reg = getreg32(SRC_IRQ_REG); /* Insure appropriate IT_REG bit clears */
putreg32(reg | 0x00000001, INT_CTRL_REG); /* write the NEW_IRQ_AGR bit. */
}
/************************************************************
* Name: up_ackfiq
*
* Description:
* Acknowledge the FIQ. Bit 1 of the Interrupt Control
* Register == New FIQ agreement (NEW_FIQ_AGR). Reset FIQ
* output. Clear source FIQ register. Enables a new FIQ
* generation. Reset by internal logic.
*
************************************************************/
static inline void up_ackfiq(unsigned int irq)
{
uint32 reg;
reg = getreg32(SRC_FIQ_REG); /* Insure appropriate IT_REG bit clears */
putreg32(reg | 0x00000002, INT_CTRL_REG); /* write the NEW_FIQ_AGR bit. */
}
/************************************************************
* Name: up_vectorinitialize
************************************************************/
static inline void up_vectorinitialize(void)
{
up_vector_t *src = g_vectorinittab;
up_vector_t *dest = (up_vector_t*)&_svectors;
int i;
for (i = 0; i < NVECTORS; i++)
{
*dest++ = *src++;
}
}
/************************************************************
* Public Funtions
************************************************************/
/************************************************************
* Name: up_irqinitialize
************************************************************/
void up_irqinitialize(void)
{
/* Disable all interrupts. */
putreg32(0x0000ffff, MASK_IT_REG);
/* Clear any pending interrupts */
up_ackirq(0);
up_ackfiq(0);
putreg32(0x00000000, IT_REG);
/* Override hardware defaults */
putreg32(ILR_EDGESENSITIVE | ILR_PRIORITY, ILR_IRQ2_REG);
putreg32(ILR_EDGESENSITIVE | ILR_PRIORITY, ILR_IRQ4_REG);
putreg32(ILR_PRIORITY, ILR_IRQ6_REG);
putreg32(ILR_EDGESENSITIVE | ILR_PRIORITY, ILR_IRQ15_REG);
/* Initialize hardware interrupt vectors */
up_vectorinitialize();
current_regs = NULL;
/* And finally, enable interrupts */
#ifndef CONFIG_SUPPRESS_INTERRUPTS
irqrestore(SVC_MODE | PSR_F_BIT);
#endif
}
/************************************************************
* Name: up_disable_irq
*
* Description:
* Disable the IRQ specified by 'irq'
*
************************************************************/
void up_disable_irq(int irq)
{
if ((unsigned)irq < NR_IRQS)
{
uint32 reg = getreg32(MASK_IT_REG);
putreg32(reg | (1 << irq), MASK_IT_REG);
}
}
/************************************************************
* Name: up_enable_irq
*
* Description:
* Enable the IRQ specified by 'irq'
*
************************************************************/
void up_enable_irq(int irq)
{
if ((unsigned)irq < NR_IRQS)
{
uint32 reg = getreg32(MASK_IT_REG);
putreg32(reg & ~(1 << irq), MASK_IT_REG);
}
}
/************************************************************
* Name: up_maskack_irq
*
* Description:
* Mask the IRQ and acknowledge it
*
************************************************************/
void up_maskack_irq(int irq)
{
uint32 reg = getreg32(INT_CTRL_REG);
/* Mask the interrupt */
reg = getreg32(MASK_IT_REG);
putreg32(reg | (1 << irq), MASK_IT_REG);
/* Set the NEW_IRQ_AGR bit. This clears the IRQ src register
* enables generation of a new IRQ.
*/
reg = getreg32(INT_CTRL_REG);
putreg32(reg | 0x00000001, INT_CTRL_REG); /* write the NEW_IRQ_AGR bit. */
}

View File

@@ -0,0 +1,127 @@
/**************************************************************************
* c5471/c5471_lowputc.S
*
* Copyright (C) 2007 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.
*
**************************************************************************/
/**************************************************************************
* Included Files
**************************************************************************/
#include <nuttx/config.h>
#include "up_internal.h"
#include "up_arch.h"
/**************************************************************************
* Private Definitions
**************************************************************************/
/**************************************************************************
* Private Types
**************************************************************************/
/**************************************************************************
* Private Function Prototypes
**************************************************************************/
/**************************************************************************
* Global Variables
**************************************************************************/
/**************************************************************************
* Private Variables
**************************************************************************/
/**************************************************************************
* Private Functions
**************************************************************************/
/**************************************************************************
* Public Functions
**************************************************************************/
/**************************************************************************
* Name: up_lowputc
**************************************************************************/
/* This assembly language version has the advantage that it can does not
* require a C stack and uses only r0-r1. Hence it can be used during
* early boot phases.
*/
.text
.global up_lowputc
.type up_lowputc, function
up_lowputc:
/* On entry, r0 holds the character to be printed */
#ifdef CONFIG_SERIAL_IRDA_CONSOLE
ldr r2, =UART_IRDA_BASE /* r2=IRDA UART base */
#else
ldr r2, =UART_MODEM_BASE /* r2=Modem UART base */
#endif
/* Poll bit 0 of the UART_SSR register. When the bit
* is clear, the TX FIFO is no longer full
*/
1: ldr r1, [r2, #UART_SSR_OFFS]
tst r1, #UART_SSR_TXFULL
bne 1b
/* Send the character by writing it into the UART_THR
* register.
*/
str r0, [r2, #UART_THR_OFFS]
/* Wait for the tranmsit holding regiser (THR) to be
* emptied. This is detemined when bit 6 of the LSR
* is set.
*/
2: ldr r1, [r2, #UART_LSR_OFFS]
tst r1, #0x00000020
beq 2b
/* If the character that we just sent was a linefeed,
* then send a carriage return as well.
*/
teq r0, #'\n'
moveq r0, #'\r'
beq 1b
/* And return */
mov pc, lr

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,125 @@
/************************************************************
* c5471/c5471_timerisr.c
*
* Copyright (C) 2007 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.
*
************************************************************/
/************************************************************
* Included Files
************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <debug.h>
#include <nuttx/arch.h>
#include "clock_internal.h"
#include "up_internal.h"
#include "up_arch.h"
/************************************************************
* Definitions
************************************************************/
/* We want the general purpose timer running at the rate
* MSEC_PER_TICK. The C5471 clock is 47.5MHz and we're using
* a timer PTV value of 3 (3 == divide incoming frequency by
* 16) which then yields a 16 bitCLKS_PER_INT value
* of 29687.
*
* 47500000 / 16 = 2968750 clocks/sec
* 2968750 / 100 = 29687 clocks/ 100Hz interrupt
*
*/
#define CLKS_PER_INT 29687
#define CLKS_PER_INT_SHIFT 5
#define AR 0x00000010
#define ST 0x00000008
#define PTV 0x00000003
/************************************************************
* Private Types
************************************************************/
/************************************************************
* Private Function Prototypes
************************************************************/
/************************************************************
* Global Functions
************************************************************/
/************************************************************
* Function: up_timerisr
*
* Description:
* The timer ISR will perform a variety of services for
* various portions of the systems.
*
************************************************************/
int up_timerisr(int irq, uint32 *regs)
{
/* Process timer interrupt */
sched_process_timer();
return 0;
}
/************************************************************
* Function: up_timerinit
*
* Description:
* This function is called during start-up to initialize
* the timer interrupt.
*
************************************************************/
void up_timerinit(void)
{
uint32 val;
up_disable_irq(C5471_IRQ_SYSTIMER);
/* Start the general purpose timer running in auto-reload mode
* so that an interrupt is generated at the rate MSEC_PER_TICK.
*/
val = ((CLKS_PER_INT-1) << CLKS_PER_INT_SHIFT) | AR | ST | PTV;
putreg32(val, C5471_TIMER2_CTRL);
/* Attach and enable the timer interrupt */
irq_attach(C5471_IRQ_SYSTIMER, (xcpt_t)up_timerisr);
up_enable_irq(C5471_IRQ_SYSTIMER);
}

View File

@@ -0,0 +1,449 @@
/********************************************************************
* c5471/c5471_vectors.S
*
* Copyright (C) 2007 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.
*
********************************************************************/
/********************************************************************
* Included Files
********************************************************************/
#include <nuttx/config.h>
#include <nuttx/irq.h>
#include "up_arch.h"
/********************************************************************
* Definitions
********************************************************************/
/********************************************************************
* Global Data
********************************************************************/
.data
g_irqtmp:
.word 0 /* Saved lr */
.word 0 /* Saved spsr */
g_undeftmp:
.word 0 /* Saved lr */
.word 0 /* Saved spsr */
g_aborttmp:
.word 0 /* Saved lr */
.word 0 /* Saved spsr */
/********************************************************************
* Assembly Macros
********************************************************************/
/********************************************************************
* Private Functions
********************************************************************/
.text
/********************************************************************
* Public Functions
********************************************************************/
.text
/********************************************************************
* Name: up_vectorirq
*
* Description:
* Interrupt excetpion. Entered in IRQ mode with spsr = SVC
* CPSR, lr = SVC PC
********************************************************************/
.globl up_vectorirq
.type up_vectorirq, %function
up_vectorirq:
/* On entry, we are in IRQ mode. We are free to use
* the IRQ mode r13 and r14.
*
*/
ldr r13, .Lirqtmp
sub lr, lr, #4
str lr, [r13] @ save lr_IRQ
mrs lr, spsr
str lr, [r13, #4] @ save spsr_IRQ
/* Then switch back to SVC mode */
bic lr, lr, #MODE_MASK /* Keep F and T bits */
orr lr, lr, #(SVC_MODE | PSR_I_BIT)
msr cpsr_c, lr /* Switch to SVC mode */
/* Create a context structure. First set aside a stack frame
* and store r0-r12 into the frame.
*/
sub sp, sp, #XCPTCONTEXT_SIZE
stmia sp, {r0-r12} /* Save the SVC mode regs */
/* Get the correct values of r13(sp) and r14(lr) in r1 and r2 */
add r1, sp, #XCPTCONTEXT_SIZE
mov r2, r14
/* Get the values for r15(pc) and CPSR in r3 and r4 */
ldr r0, .Lirqtmp /* Points to temp storage */
ldmia r0, {r3, r4} /* Recover r1=lr_IRQ, r2=spsr_IRQ */
add r0, sp, #(4*REG_SP) /* Offset to pc, cpsr storage */
stmia r0, {r1-r4}
/* Now decode the interrupt */
#if 0
ldr lr, =SRC_IRQ_BIN_REG /* Fetch encoded IRQ */
ldr r0, [lr]
and r0, r0, #0x0f /* Valid range is 0..15 */
/* Problems here... cannot read SRC_IRQ_BIN_REQ (and/or
* SRC_IRQ_REQ because this will clear edge triggered
* interrupts. Plus, no way to validate spurious
* interrupt.
*/
#else
ldr r6, =SRC_IRQ_REG
ldr r6, [r6] /* Get source IRQ reg */
mov r0, #0 /* Assume IRQ0_IRQ set */
.Lmorebits:
tst r6, #1 /* Is IRQ set? */
bne .Lhaveirq /* Yes... we have the IRQ */
add r0, r0, #1 /* Setup next IRQ */
mov r6, r6, lsr #1 /* Shift right one */
cmp r0, #16 /* Only 16 valid bits */
bcc .Lmorebits /* Keep until we have looked
* at all bits */
b .Lnoirqset /* If we get here, there is
* no pending interrupt */
.Lhaveirq:
#endif
/* Then call the IRQ handler with interrupt disabled. */
mov fp, #0 /* Init frame pointer */
mov r1, sp /* Get r1=xcp */
bl up_doirq /* Call the handler */
/* Restore the CPSR, SVC modr registers and return */
.Lnoirqset:
ldr r0, [sp, #(4*REG_CPSR)] /* Setup the SVC mode SPSR */
msr spsr, r0
ldmia sp, {r0-r15}^ /* Return */
.Lirqtmp:
.word g_irqtmp
.align 5
/********************************************************************
* Function: up_vectorswi
*
* Description:
* SWI interrupt. We enter the SWI in SVC mode
********************************************************************/
.globl up_vectorswi
.type up_vectorswi, %function
up_vectorswi:
/* The c547x rrload bootloader intemediates all
* interrupts. For the* case of the SWI, it mucked
* with the stack to create some temporary registers.
* We'll have to recover from this mucking here.
*/
ldr r14, [sp,#-0x4] /* rrload workaround */
/* Create a context structure. First set aside a stack frame
* and store r0-r12 into the frame.
*/
sub sp, sp, #XCPTCONTEXT_SIZE
stmia sp, {r0-r12} /* Save the SVC mode regs */
/* Get the correct values of r13(sp), r14(lr), r15(pc)
* and CPSR in r1-r4 */
add r1, sp, #XCPTCONTEXT_SIZE
mov r2, r14 /* R14 is altered on return from SWI */
mov r3, r14 /* Save r14 as the PC as well */
mrs r4, spsr /* Get the saved CPSR */
add r0, sp, #(4*REG_SP) /* Offset to pc, cpsr storage */
stmia r0, {r1-r4}
/* Then call the SWI handler with interrupt disabled.
* void up_syscall(struct xcptcontext *xcp)
*/
mov fp, #0 /* Init frame pointer */
mov r0, sp /* Get r0=xcp */
bl up_syscall /* Call the handler */
/* Restore the CPSR, SVC modr registers and return */
ldr r0, [sp, #(4*REG_CPSR)] /* Setup the SVC mode SPSR */
msr spsr, r0
ldmia sp, {r0-r15}^ /* Return */
.align 5
/********************************************************************
* Name: up_vectordata
*
* Description:
* Data abort Exception dispatcher. Give control to data
* abort handler. This function is entered in ABORT mode
* with spsr = SVC CPSR, lr = SVC PC
*
********************************************************************/
.globl up_vectordata
.type up_vectordata, %function
up_vectordata:
/* On entry we are free to use the ABORT mode registers
* r13 and r14
*/
ldr r13, .Ldaborttmp /* Points to temp storage */
sub lr, lr, #8 /* Fixup return */
str lr, [r13] /* Save in temp storage */
mrs lr, spsr /* Get SPSR */
str lr, [r13, #4] /* Save in temp storage */
/* Then switch back to SVC mode */
bic lr, lr, #MODE_MASK /* Keep F and T bits */
orr lr, lr, #(SVC_MODE | PSR_I_BIT)
msr cpsr_c, lr /* Switch to SVC mode */
/* Create a context structure. First set aside a stack frame
* and store r0-r12 into the frame.
*/
sub sp, sp, #XCPTCONTEXT_SIZE
stmia sp, {r0-r12} /* Save the SVC mode regs */
/* Get the correct values of r13(sp) and r14(lr) in r1 and r2 */
add r1, sp, #XCPTCONTEXT_SIZE
mov r2, r14
/* Get the values for r15(pc) and CPSR in r3 and r4 */
ldr r0, .Ldaborttmp /* Points to temp storage */
ldmia r0, {r3, r4} /* Recover r1=lr_IRQ, r2=spsr_IRQ */
add r0, sp, #(4*REG_SP) /* Offset to pc, cpsr storage */
stmia r0, {r1-r4}
/* Then call the data abort handler with interrupt disabled.
* void up_dataabort(struct xcptcontext *xcp)
*/
mov fp, #0 /* Init frame pointer */
mov r0, sp /* Get r0=xcp */
bl up_dataabort /* Call the handler */
/* Restore the CPSR, SVC modr registers and return */
ldr r0, [sp, #(4*REG_CPSR)] /* Setup the SVC mode SPSR */
msr spsr_cxsf, r0
ldmia sp, {r0-r15}^ /* Return */
.Ldaborttmp:
.word g_aborttmp
.align 5
/********************************************************************
* Name: up_vectorprefetch
*
* Description:
* Prefetch abort exception. Entered in ABT mode with
* spsr = SVC CPSR, lr = SVC PC
********************************************************************/
.globl up_vectorprefetch
.type up_vectorprefetch, %function
up_vectorprefetch:
/* On entry we are free to use the ABORT mode registers
* r13 and r14
*/
ldr r13, .Lpaborttmp /* Points to temp storage */
sub lr, lr, #4 /* Fixup return */
str lr, [r13] /* Save in temp storage */
mrs lr, spsr /* Get SPSR */
str lr, [r13, #4] /* Save in temp storage */
/* Then switch back to SVC mode */
bic lr, lr, #MODE_MASK /* Keep F and T bits */
orr lr, lr, #(SVC_MODE | PSR_I_BIT)
msr cpsr_c, lr /* Switch to SVC mode */
/* Create a context structure. First set aside a stack frame
* and store r0-r12 into the frame.
*/
sub sp, sp, #XCPTCONTEXT_SIZE
stmia sp, {r0-r12} /* Save the SVC mode regs */
/* Get the correct values of r13(sp) and r14(lr) in r1 and r2 */
add r1, sp, #XCPTCONTEXT_SIZE
mov r2, r14
/* Get the values for r15(pc) and CPSR in r3 and r4 */
ldr r0, .Lpaborttmp /* Points to temp storage */
ldmia r0, {r3, r4} /* Recover r1=lr_IRQ, r2=spsr_IRQ */
add r0, sp, #(4*REG_SP) /* Offset to pc, cpsr storage */
stmia r0, {r1-r4}
/* Then call the prefetch abort handler with interrupt disabled.
* void up_prefetchabort(struct xcptcontext *xcp)
*/
mov fp, #0 /* Init frame pointer */
mov r0, sp /* Get r0=xcp */
bl up_prefetchabort /* Call the handler */
/* Restore the CPSR, SVC modr registers and return */
ldr r0, [sp, #(4*REG_CPSR)] /* Setup the SVC mode SPSR */
msr spsr_cxsf, r0
ldmia sp, {r0-r15}^ /* Return */
.Lpaborttmp:
.word g_aborttmp
.align 5
/********************************************************************
* Name: up_vectorundefinsn
*
* Description:
* Undefined instruction entry exception. Entered in
* UND mode, spsr = SVC CPSR, lr = SVC PC
*
********************************************************************/
.globl up_vectorundefinsn
.type up_vectorundefinsn, %function
up_vectorundefinsn:
/* On entry we are free to use the UND mode registers
* r13 and r14
*/
ldr r13, .Lundeftmp /* Points to temp storage */
str lr, [r13] /* Save in temp storage */
mrs lr, spsr /* Get SPSR */
str lr, [r13, #4] /* Save in temp storage */
/* Then switch back to SVC mode */
bic lr, lr, #MODE_MASK /* Keep F and T bits */
orr lr, lr, #(SVC_MODE | PSR_I_BIT)
msr cpsr_c, lr /* Switch to SVC mode */
/* Create a context structure. First set aside a stack frame
* and store r0-r12 into the frame.
*/
sub sp, sp, #XCPTCONTEXT_SIZE
stmia sp, {r0-r12} /* Save the SVC mode regs */
/* Get the correct values of r13(sp) and r14(lr) in r1 and r2 */
add r1, sp, #XCPTCONTEXT_SIZE
mov r2, r14
/* Get the values for r15(pc) and CPSR in r3 and r4 */
ldr r0, .Lundeftmp /* Points to temp storage */
ldmia r0, {r3, r4} /* Recover r1=lr_IRQ, r2=spsr_IRQ */
add r0, sp, #(4*REG_SP) /* Offset to pc, cpsr storage */
stmia r0, {r1-r4}
/* Then call the undef insn handler with interrupt disabled.
* void up_undefinedinsn(struct xcptcontext *xcp)
*/
mov fp, #0 /* Init frame pointer */
mov r0, sp /* Get r0=xcp */
bl up_undefinedinsn /* Call the handler */
/* Restore the CPSR, SVC modr registers and return */
ldr r0, [sp, #(4*REG_CPSR)] /* Setup the SVC mode SPSR */
msr spsr_cxsf, r0
ldmia sp, {r0-r15}^ /* Return */
.Lundeftmp:
.word g_undeftmp
.align 5
/********************************************************************
* Name: up_vectorfiq
*
* Description:
* Shouldn't happen
********************************************************************/
.globl up_vectorfiq
.type up_vectorfiq, %function
up_vectorfiq:
subs pc, lr, #4
/********************************************************************
* Name: up_vectoraddrexcption
*
* Description:
* Shouldn't happen
*
********************************************************************/
.globl up_vectoraddrexcptn
.type up_vectoraddrexcptn, %function
up_vectoraddrexcptn:
b up_vectoraddrexcptn
.end

View File

@@ -0,0 +1,392 @@
/**************************************************************************
* c5471/c5471_watchdog.c
*
* Copyright (C) 2007 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.
*
**************************************************************************/
/**************************************************************************
* Included Files
**************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <stdio.h>
#include <debug.h>
#include <errno.h>
#include <nuttx/fs.h>
#include <nuttx/irq.h>
#include <arch/watchdog.h>
#include "up_arch.h"
/**************************************************************************
* Definitions
**************************************************************************/
#undef CONFIG_SOFTWARE_TEST
#undef CONFIG_SOFTWARE_REBOOT
#undef CONFIG_WATCHDOG_STRICT
#define MAX_WDT_USEC 353200
#define MAX_PRESCALER 256
#define C5471_TIMER_STOP 0
#define C5471_TIMER_PRESCALER 0x07 /* Bits 0-2: Prescale value */
#define C5471_TIMER_STARTBIT (1 << 3) /* Bit 3: Start timer bit */
#define C5471_TIMER_AUTORELOAD (1 << 4) /* Bit 4: Auto-reload timer */
#define C5471_TIMER_LOADTIM (0xffff << 5) /* Bits 20-5: Load timer value */
#define C5471_TIMER_MODE (1 << 21) /* Bit 21: Timer mode */
#define C5471_DISABLE_VALUE1 (0xf5 << 22) /* Bits 29-22: WD disable */
#define C5471_DISABLE_VALUE2 (0xa0 << 22)
#define CLOCK_KHZ 47500
#define CLOCK_MHZx2 95
/* Macros to manage access to to watchdog timer macros */
#define c5471_wdt_cntl (*(volatile uint32*)C5471_TIMER0_CTRL)
#define c5471_wdt_count (*(volatile uint32*)C5471_TIMER0_CNT)
/**************************************************************************
* Private Types
**************************************************************************/
/**************************************************************************
* Private Function Prototypes
**************************************************************************/
/* Local implementation of timer interface */
static inline unsigned int wdt_prescaletoptv(unsigned int prescale);
static int wdt_setusec(uint32 usec);
static int wdt_interrupt(int irq, void *context);
static int wdt_open(struct file *filep);
static int wdt_close(struct file *filep);
static ssize_t wdt_read(struct file *filep, char *buffer, size_t buflen);
static ssize_t wdt_write(struct file *filep, const char *buffer, size_t buflen);
static int wdt_ioctl(struct file *filep, int cmd, uint32 arg);
/**************************************************************************
* Private Data
**************************************************************************/
static boolean g_wdtopen;
struct file_operations g_wdtops =
{
.open = wdt_open,
.close = wdt_close,
.read = wdt_read,
.write = wdt_write,
.ioctl = wdt_ioctl,
};
/**************************************************************************
* Private Functions
**************************************************************************/
/**************************************************************************
* Name: wdt_prescaletoptv
**************************************************************************/
static inline unsigned int wdt_prescaletoptv(unsigned int prescale)
{
unsigned int ptv = 0;
if (prescale > 255)
{
ptv = 7;
}
else
{
unsigned int value = prescale >> 1;
/* 0: 0-2
* 1: 3-4
* 2: 5-8
* 3: 9-16
* 4: 17-32
* 5: 33-64
* 6: 65-128
* 7: 129-
*/
while (value > 1)
{
value >>= 1;
ptv++;
}
}
dbg("prescale=%d -> ptv=%d\n", prescale, ptv);
return ptv;
}
/**************************************************************************
* Name: wdt_setusec
**************************************************************************/
static int wdt_setusec(uint32 usec)
{
/* prescaler: clock / prescaler = #clock ticks per counter in ptv
* divisor: #counts until the interrupt comes.
*/
uint32 prescaler = MAX_PRESCALER;
uint32 divisor = 1;
uint32 mode;
dbg("usec=%d\n", usec);
/* Calculate a value of prescaler and divisor that will be able
* to count to the usec. It may not be exact or the best
* possible set, but it's a quick and simple algorithm.
*
* divisor max = 0x10000
* prescaler max = MAX_PRESCALER
*/
do
{
divisor = (CLOCK_MHZx2 * usec) / (prescaler * 2);
dbg("divisor=0x%x prescaler=0x%x\n", divisor, prescaler);
if (divisor >= 0x10000)
{
if (prescaler == MAX_PRESCALER)
{
/* This is the max possible ~2.5 seconds. */
dbg("prescaler=0x%x too big!\n", prescaler);
return ERROR;
}
prescaler <<= 1;
if (prescaler > MAX_PRESCALER)
{
prescaler = MAX_PRESCALER;
}
}
}
while (divisor >= 0x10000);
dbg("prescaler=0x%x divisor=0x%x\n", prescaler, divisor);
mode = wdt_prescaletoptv(prescaler);
mode &= ~C5471_TIMER_AUTORELOAD; /* One shot mode. */
mode |= divisor << 5;
dbg("mode=0x%x\n", mode);
c5471_wdt_cntl = mode;
/* Now start the watchdog */
c5471_wdt_cntl |= C5471_TIMER_STARTBIT;
dbg("cntl_timer=0x%x\n", c5471_wdt_cntl);
return 0;
}
/**************************************************************************
* Private Functions
**************************************************************************/
/**************************************************************************
* Name: wdt_interrupt
**************************************************************************/
static int wdt_interrupt(int irq, void *context)
{
dbg("expired\n");
#if defined(CONFIG_SOFTWARE_REBOOT)
# if defined(CONFIG_SOFTWARE_TEST)
dbg(" Test only\n");
# else
dbg(" Re-booting\n");
# warning "Add logic to reset CPU here"
# endif
#else
dbg(" No reboot\n");
#endif
return OK;
}
/**************************************************************************
* Name: wdt_read
**************************************************************************/
static ssize_t wdt_read(struct file *filep, char *buffer, size_t buflen)
{
/* We are going to return "NNNNNNNN NNNNNNNN." The followig logic will
* not work if the user provides a buffer smaller than 18 bytes.
*/
dbg("buflen=%d\n", buflen);
if (buflen >= 18)
{
sprintf(buffer, "#08x %08x\n", c5471_wdt_cntl, c5471_wdt_count);
return 18;
}
return 0;
}
/**************************************************************************
* Name: wdt_write
**************************************************************************/
static ssize_t wdt_write(struct file *filep, const char *buffer, size_t buflen)
{
dbg("buflen=%d\n", buflen);
if (buflen)
{
/* Reset the timer to the maximum delay */
wdt_setusec(MAX_WDT_USEC);
return 1;
}
return 0;
}
/**************************************************************************
* Name: wdt_ioctl
**************************************************************************/
static int wdt_ioctl(struct file *filep, int cmd, uint32 arg)
{
dbg("ioctl Call: cmd=0x%x arg=0x%x", cmd, arg);
/* Process the the IOCTL command (see arch/watchdog.h) */
switch(cmd)
{
case WDIOC_KEEPALIVE:
wdt_setusec(MAX_WDT_USEC);
break;
default:
*get_errno_ptr() = ENOTTY;
return ERROR;
}
return OK;
}
/**************************************************************************
* Name: wdt_open
**************************************************************************/
static int wdt_open(struct file *filep)
{
dbg("");
if (g_wdtopen)
{
*get_errno_ptr() = EBUSY;
}
/* This will automatically load the timer with its max
* count and start it running.
*/
c5471_wdt_cntl = C5471_DISABLE_VALUE1;
c5471_wdt_cntl = C5471_DISABLE_VALUE2;
g_wdtopen = TRUE;
return OK;
}
/**************************************************************************
* Name: wdt_close
**************************************************************************/
static int wdt_close(struct file *filep)
{
dbg("");
/* The task controlling the watchdog has terminated. Take the timer
* the
* watchdog in interrupt mode -- we are going to reset unless the
* reopened again soon.
*/
#ifndef CONFIG_WATCHDOG_STRICT
c5471_wdt_cntl = C5471_TIMER_MODE;
#endif
g_wdtopen = FALSE;
return 0;
}
/**************************************************************************
* Public Functions
**************************************************************************/
/**************************************************************************
* Name: up_wdtinit
**************************************************************************/
int up_wdtinit(void)
{
int ret;
dbg("C547x Watchdog Driver\n");
/* Register as /dev/wdt */
ret = register_driver("/dev/wdt", &g_wdtops, 0666, NULL);
if (ret)
{
return ERROR;
}
/* Register for an interrupt level callback through wdt_interrupt */
dbg("Attach to IRQ=%d\n", C5471_IRQ_WATCHDOG);
/* Make sure that the timer is stopped */
c5471_wdt_cntl = C5471_TIMER_STOP;
/* Request the interrupt. */
ret = irq_attach(C5471_IRQ_WATCHDOG, wdt_interrupt);
if (ret)
{
unregister_driver("/dev/wdt");
return ERROR;
}
return OK;
}

371
arch/arm/src/c5471/chip.h Normal file
View File

@@ -0,0 +1,371 @@
/****************************************************************************
* c5471/chip.h
*
* Copyright (C) 2007 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.
*
****************************************************************************/
#ifndef __C5471_CHIP_H
#define __C5471_CHIP_H
/****************************************************************************
* Included Files
****************************************************************************/
/****************************************************************************
* Definitions
****************************************************************************/
#define EIM_RAM_START 0xffd00000
/* Ethernet Interface Module (EIM) ******************************************/
#define EIM_CTRL 0xffff0000 /* ESM control register */
#define EIM_STATUS 0xffff0004 /* ESM status register */
#define EIM_CPU_TXBA 0xffff0008 /* CPU TX descriptors base address */
#define EIM_CPU_RXBA 0xffff000c /* CPU RX descriptors base address */
#define EIM_BUFSIZE 0xffff0010 /* Packet buffer size register */
#define EIM_CPU_FILTER 0xffff0014 /* CPU filtering contol registers */
#define EIM_CPU_DAHI 0xffff0018 /* CPU destination address (HI) */
#define EIM_CPU_DALO 0xffff001c /* CPU destination address (LO) */
#define EIM_MFVHI 0xffff0020 /* Multicast filter valid (HI) */
#define EIM_MFVLO 0xffff0024 /* Multicast filter valid (LO) */
#define EIM_MFMHI 0xffff0028 /* Multicast filter mask (HI) */
#define EIM_MFMLO 0xffff002c /* Multicast filter mask (LO) */
#define EIM_RXTH 0xffff0030 /* RX threshold register */
#define EIM_CPU_RXREADY 0xffff0034 /* CPU RX ready register */
#define EIM_INTEN 0xffff0038 /* ESM interrupt enable register */
#define EIM_ENET0_TXDESC 0xffff0040 /* ENET0 TX Queue pointer */
#define EIM_ENET0_RXDESC 0xffff0044 /* ENET0 RX Queue pointer */
#define EIM_CPU_TXDESC 0xffff0050 /* CPU TX Queue pointer */
#define EIM_CPU_RXDESC 0xffff0054 /* CPU RX Queue pointer */
#define ENET0_MODE 0xffff0100 /* Mode register */
#define ENET0_BOFFSEED 0xffff0104 /* Backoff seed register */
#define ENET0_BCOUNT 0xffff0108 /* Backoff count register */
#define ENET0_FLWPAUSE 0xffff010c /* TX flow pause count register */
#define ENET0_FLWCONTROL 0xffff0110 /* Flow control register */
#define ENET0_VTYPE 0xffff0114 /* VTYPE tag register */
#define ENET0_SEISR 0xffff0118 /* System error int status register */
#define ENET0_TXBUFRDY 0xffff011c /* TX descripter buffer ready */
#define ENET0_TDBA 0xffff0120 /* TX descriptor base address */
#define ENET0_RDBA 0xffff0124 /* RX descriptor base address */
#define ENET0_PARHI 0xffff0128 /* Dest phys address match (HI) */
#define ENET0_PARLO 0xffff012c /* Dest phys address match (LO) */
#define ENET0_LARHI 0xffff0130 /* Log address hash filter (HI) */
#define ENET0_LARLO 0xffff0134 /* Log address hash filter (LO) */
#define ENET0_ADRMODE_EN 0xffff0138 /* Address mode enable register */
#define ENET0_DRP 0xffff013c /* Desc ring poll interval count */
/* UARTs ********************************************************************/
#define UART_IRDA_BASE 0xffff0800
#define UART_MODEM_BASE 0xffff1000
#define UARTn_IO_RANGE 0x00000800
/* Common UART Registers. Expressed as offsets from the BASE address */
#define UART_RHR_OFFS 0x00000000 /* Rcv Holding Register */
#define UART_THR_OFFS 0x00000004 /* Xmit Holding Register */
#define UART_FCR_OFFS 0x00000008 /* FIFO Control Register */
#define UART_RFCR_OFFS 0x00000008 /* Rcv FIFO Control Register */
#define UART_TFCR_OFFS 0x00000008 /* Xmit FIFO Control Register */
#define UART_SCR_OFFS 0x0000000c /* Status Control Register */
#define UART_LCR_OFFS 0x00000010 /* Line Control Register */
#define UART_LSR_OFFS 0x00000014 /* Line Status Register */
#define UART_SSR_OFFS 0x00000018 /* Supplementary Status Register */
#define UART_MCR_OFFS 0x0000001c /* Modem Control Register */
#define UART_MSR_OFFS 0x00000020 /* Modem Status Register */
#define UART_IER_OFFS 0x00000024 /* Interrupt Enable Register */
#define UART_ISR_OFFS 0x00000028 /* Interrupt Status Register */
#define UART_EFR_OFFS 0x0000002c /* Enhanced Feature Register */
#define UART_XON1_OFFS 0x00000030 /* XON1 Character Register */
#define UART_XON2_OFFS 0x00000034 /* XON2 Character Register */
#define UART_XOFF1_OFFS 0x00000038 /* XOFF1 Character Register */
#define UART_XOFF2_OFFS 0x0000003c /* XOFF2 Character Register */
#define UART_SPR_OFFS 0x00000040 /* Scratch-pad Register */
#define UART_DIV_115K_OFFS 0x00000044 /* Divisor for baud generation */
#define UART_DIV_BIT_RATE_OFFS 0x00000048 /* For baud rate generation */
#define UART_TCR_OFFS 0x0000004c /* Transmission Control Register */
#define UART_TLR_OFFS 0x00000050 /* Trigger Level Register */
#define UART_MDR_OFFS 0x00000054 /* Mode Definition Register */
/* Registers available only for the IrDA UART (absolute address). */
#define UART_IRDA_MDR1 0xffff0854 /* Mode Definition Register 1 */
#define UART_IRDA_MDR2 0xffff0858 /* Mode Definition Register 2 */
#define UART_IRDA_TXFLL 0xffff085c /* LS Xmit Frame Length Register */
#define UART_IRDA_TXFLH 0xffff0860 /* MS Xmit Frame Length Register */
#define UART_IRDA_RXFLL 0xffff0864 /* LS Rcvd Frame Length Register */
#define UART_IRDA_RXFLH 0xffff0868 /* MS Rcvd Frame Length Register */
#define UART_IRDA_SFLSR 0xffff086c /* Status FIFO Line Status Reg */
#define UART_IRDA_SFREGL 0xffff0870 /* LS Status FIFO Register */
#define UART_IRDA_SFREGH 0xffff0874 /* MS Status FIFO Register */
#define UART_IRDA_BLR 0xffff0878 /* Begin of File Length Register */
#define UART_IRDA_PULSE_WIDTH 0xffff087c /* Pulse Width Register */
#define UART_IRDA_ACREG 0xffff0880 /* Auxiliary Control Register */
#define UART_IRDA_PULSE_START 0xffff0884 /* Start time of pulse */
#define UART_IRDA_RX_W_PTR 0xffff0888 /* RX FIFO write pointer */
#define UART_IRDA_RX_R_PTR 0xffff088c /* RX FIFO read pointer */
#define UART_IRDA_TX_W_PTR 0xffff0890 /* TX FIFO write pointer */
#define UART_IRDA_TX_R_PTR 0xffff0894 /* TX FIFO read pointer */
#define UART_IRDA_STATUS_W_PTR 0xffff0898 /* Write pointer of status FIFO */
#define UART_IRDA_STATUS_R_PTR 0xffff089c /* Read pointer of status FIFO */
#define UART_IRDA_RESUME 0xffff08a0 /* Resume register */
#define UART_IRDA_MUX 0xffff08a4 /* Selects UART_IRDA output mux */
/* Registers available for the Modem UART (absolute addresses) */
#define UART_MODEM_MDR 0xffff1054 /* Mode Definition Register */
#define UART_MODEM_UASR 0xffff1058 /* UART Auto-baud Status Register */
#define UART_MODEM_RDPTR_URX 0xffff105c /* RX FIFO Read Pointer Register */
#define UART_MODEM_WRPTR_URX 0xffff1060 /* RX FIFO Write Pointer Register */
#define UART_MODEM_RDPTR_UTX 0xffff1064 /* TX FIFO Read Pointer Register */
#define UART_MODEM_WRPTR_UTX 0xffff1068 /* TX FIFO Write Pointer Register */
/* UART Settings ************************************************************/
/* Miscellaneous UART settings. */
#define UART_RX_FIFO_NOEMPTY 0x00000001
#define UART_SSR_TXFULL 0x00000001
#define UART_LSR_TREF 0x00000020
#define UART_XMIT_FIFO_SIZE 64
#define UART_IRDA_XMIT_FIFO_SIZE 64
/* UART_LCR Register */
/* Bits 31-7: Reserved */
#define UART_LCR_BOC 0x00000040 /* Bit 6: Break Control */
/* Bit 5: Parity Type 2 */
#define UART_LCR_PAREVEN 0x00000010 /* Bit 4: Parity Type 1 */
#define UART_LCR_PARODD 0x00000000
#define UART_LCR_PAREN 0x00000008 /* Bit 3: Paity Enable */
#define UART_LCR_PARDIS 0x00000000
#define UART_LCR_2STOP 0x00000004 /* Bit 2: Number of stop bits */
#define UART_LCR_1STOP 0x00000000
#define UART_LCR_5BITS 0x00000000 /* Bits 0-1: Word-length */
#define UART_LCR_6BITS 0x00000001
#define UART_LCR_7BITS 0x00000002
#define UART_LCR_8BITS 0x00000003
#define UART_FCR_FTL 0x00000000
#define UART_FCR_FIFO_EN 0x00000001
#define UART_FCR_TX_CLR 0x00000002
#define UART_FCR_RX_CLR 0x00000004
#define UART_IER_RECVINT 0x00000001
#define UART_IER_XMITINT 0x00000002
#define UART_IER_LINESTSINT 0x00000004
#define UART_IER_MODEMSTSINT 0x00000008 /* IrDA UART only */
#define UART_IER_XOFFINT 0x00000020
#define UART_IER_RTSINT 0x00000040 /* IrDA UART only */
#define UART_IER_CTSINT 0x00000080 /* IrDA UART only */
#define UART_IER_INTMASK 0x000000ff
#define BAUD_115200 0x00000001
#define BAUD_57600 0x00000002
#define BAUD_38400 0x00000003
#define BAUD_19200 0x00000006
#define BAUD_9600 0x0000000C
#define BAUD_4800 0x00000018
#define BAUD_2400 0x00000030
#define BAUD_1200 0x00000060
#define MDR_UART_MODE 0x00000000 /* Both IrDA and Modem UARTs */
#define MDR_SIR_MODE 0x00000001 /* IrDA UART only */
#define MDR_AUTOBAUDING_MODE 0x00000002 /* Modem UART only */
#define MDR_RESET_MODE 0x00000007 /* Both IrDA and Modem UARTs */
/* SPI **********************************************************************/
#define MAX_SPI 3
#define SPI_REGISTER_BASE 0xffff2000
/* GIO **********************************************************************/
#define MAX_GIO (35)
#define GIO_REGISTER_BASE 0xffff2800
#define GPIO_IO 0xffff2800 /* Writeable when I/O is configured
* as an output; reads value on I/O
* pin when I/O is configured as an
* input */
#define GPIO_CIO 0xffff2804 /* GPIO configuration register */
#define GPIO_IRQA 0xffff2808 /* In conjunction with GPIO_IRQB
* determines the behavior when GPIO
* pins configured as input IRQ */
#define GPIO_IRQB 0xffff280c /* Determines the behavior when GPIO
* pins configured as input IRQ */
#define GPIO_DDIO 0xffff2810 /* Delta Detect Register
* (detects changes in the I/O pins) */
#define GPIO_EN 0xffff2814 /* Selects register for muxed GPIOs */
#define KGIO_REGISTER_BASE 0xffff2900
#define KBGPIO_IO 0xffff2900 /* Keyboard I/O bits: Writeable
* when KBGPIO is configured as an
* output; reads value on I/O pin
* when KBGPIO is configured as an
* input */
#define KBGPIO_CIO 0xffff2904 /* KBGPIO configuration register */
#define KBGPIO_IRQA 0xffff2908 /* In conjunction with KBGPIO_IRQB
* determines the behavior when
* KBGPIO pins configured as input
* IRQ */
#define KBGPIO_IRQB 0xffff290c /* In conjunction with KBGPIO_IRQA
* determines the behavior when
* KBGPIO pins configured as input
* IRQ */
#define KBGPIO_DDIO 0xffff2910 /* Delta Detect Register (detects
* changes in the KBGPIO pins) */
#define KBGPIO_EN 0xffff2914 /* Selects register for muxed
* KBGPIOs */
/* Timers *******************************************************************/
#define C5471_TIMER0_CTRL 0xffff2a00
#define C5471_TIMER0_CNT 0xffff2a04
#define C5471_TIMER1_CTRL 0xffff2b00
#define C5471_TIMER1_CNT 0xffff2b04
#define C5471_TIMER2_CTRL 0xffff2c00
#define C5471_TIMER2_CNT 0xffff2c04
/* Interrupts */
#define HAVE_SRC_IRQ_BIN_REG 0
#define INT_FIRST_IO 0xffff2d00
#define INT_IO_RANGE 0x5C
#define IT_REG 0xffff2d00
#define MASK_IT_REG 0xffff2d04
#define SRC_IRQ_REG 0xffff2d08
#define SRC_FIQ_REG 0xffff2d0c
#define SRC_IRQ_BIN_REG 0xffff2d10
#define INT_CTRL_REG 0xffff2d18
#define ILR_IRQ0_REG 0xffff2d1C /* 0-Timer 0 */
#define ILR_IRQ1_REG 0xffff2d20 /* 1-Timer 1 */
#define ILR_IRQ2_REG 0xffff2d24 /* 2-Timer 2 */
#define ILR_IRQ3_REG 0xffff2d28 /* 3-GPIO0 */
#define ILR_IRQ4_REG 0xffff2d2c /* 4-Ethernet */
#define ILR_IRQ5_REG 0xffff2d30 /* 5-KBGPIO[7:0] */
#define ILR_IRQ6_REG 0xffff2d34 /* 6-Uart serial */
#define ILR_IRQ7_REG 0xffff2d38 /* 7-Uart IRDA */
#define ILR_IRQ8_REG 0xffff2d3c /* 8-KBGPIO[15:8] */
#define ILR_IRQ9_REG 0xffff2d40 /* 9-GPIO3 */
#define ILR_IRQ10_REG 0xffff2d44 /* 10-GPIO2 */
#define ILR_IRQ11_REG 0xffff2d48 /* 11-I2C */
#define ILR_IRQ12_REG 0xffff2d4c /* 12-GPIO1 */
#define ILR_IRQ13_REG 0xffff2d50 /* 13-SPI */
#define ILR_IRQ14_REG 0xffff2d54 /* 14-GPIO[19:4] */
#define ILR_IRQ15_REG 0xffff2d58 /* 15-API */
/* CLKM *********************************************************************/
#define CLKM 0xffff2f00
#define CLKM_CTL_RST 0xffff2f10
#define CLKM_RESET 0xffff2f18
#define CLKM_RESET_EIM 0x00000008
#define CLKM_EIM_CLK_STOP 0x00000010
#define CLKM_CTL_RST_LEAD_RESET 0x00000000
#define CLKM_CTL_RST_EXT_RESET 0x00000002
/* I2C **********************************************************************/
#define MAX_I2C 1
/* API **********************************************************************/
#define DSPRAM_BASE 0xffe00000 /* DSPRAM base address */
#define DSPRAM_END 0xffe03fff
/* This is the API address range in the DSP address space. */
#define DSPMEM_DSP_START 0x2000
#define DSPMEM_DSP_END 0x3fff
/* This is the API address range in the ARM address space. */
#define DSPMEM_ARM_START DSPRAM_BASE /* Defined in hardware.h */
#define DSPMEM_ARM_END DSPRAM_END
/* DSPMEM_IN_RANGE is a generic macro to test is a value is within
* a range of values.
*/
#define DSPMEM_IN_RANGE(addr, start, end) \
((((__u32)(addr)) >= (start)) && (((__u32)(addr)) <= (end)))
/* DSPMEM_ADDR_ALIGNED verifies that a potential DSP address is
* properly word aligned.
*/
#define DSPMEM_ADDR_ALIGNED(addr, cpu) ((((__u32)(addr)) & 1) == 0)
/* DSPMEM_DSP_ADDR checks if a DSP address lies in within the
* DSP's API address range.
*/
#define DSPMEM_DSP_ADDR(addr, cpu) \
DSPMEM_IN_RANGE(addr, DSPMEM_DSP_START, DSPMEM_DSP_END)
/* DSPMEM_ARM_ADDR checks if a ARM address lies in within the
* ARM's API address range.
*/
#define DSPMEM_ARM_ADDR(addr) \
DSPMEM_IN_RANGE(addr, DSPMEM_ARM_START, DSPMEM_ARM_END)
/* DSPMEM_DSP_TO_ARM maps a DSP API address into an ARM API address */
#define DSPMEM_DSP_TO_ARM(addr, cpu) \
((((__u32)(addr) - DSPMEM_DSP_START) << 1) + DSPMEM_ARM_START)
/* DSPMEM_ARM_TO_DSP maps an ARM API address into a DSP API address */
#define DSPMEM_ARM_TO_DSP(addr) \
((((__u32)(addr) - DSPMEM_ARM_START) >> 1) + DSPMEM_DSP_START)
/****************************************************************************
* Inline Functions
****************************************************************************/
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
#endif /* __C5471_CHIP_H */

254
arch/arm/src/common/arm.h Normal file
View File

@@ -0,0 +1,254 @@
/************************************************************************************
* common/arm.h
*
* Copyright (C) 2007 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.
*
************************************************************************************/
#ifndef __ARM_H
#define __ARM_H
/************************************************************************************
* Included Files
************************************************************************************/
#ifndef __ASSEMBLY__
# include <sys/types.h>
#endif
/**************************************************************************
* Conditional Compilation
**************************************************************************/
#undef CONFIG_ALIGNMENT_TRAP
#undef CONFIG_DCACHE_WRITETHROUGH
#undef CONFIG_CACHE_ROUND_ROBIN
#undef CONFIG_DCACHE_DISABLE
#undef CONFIG_ICACHE_DISABLE
/************************************************************************************
* Definitions
************************************************************************************/
/* ARM9EJS **************************************************************************/
/* PSR bits */
#define MODE_MASK 0x0000001f
#define USR26_MODE 0x00000000
#define FIQ26_MODE 0x00000001
#define IRQ26_MODE 0x00000002
#define SVC26_MODE 0x00000003
#define USR_MODE 0x00000010
#define FIQ_MODE 0x00000011
#define IRQ_MODE 0x00000012
#define SVC_MODE 0x00000013
#define ABT_MODE 0x00000017
#define UND_MODE 0x0000001b
#define MODE32_BIT 0x00000010
#define SYSTEM_MODE 0x0000001f
#define PSR_T_BIT 0x00000020
#define PSR_F_BIT 0x00000040
#define PSR_I_BIT 0x00000080
#define PSR_J_BIT 0x01000000
#define PSR_Q_BIT 0x08000000
#define PSR_V_BIT 0x10000000
#define PSR_C_BIT 0x20000000
#define PSR_Z_BIT 0x40000000
#define PSR_N_BIT 0x80000000
/* CR1 bits (CP#15 CR1) */
#define CR_M 0x00000001 /* MMU enable */
#define CR_A 0x00000002 /* Alignment abort enable */
#define CR_C 0x00000004 /* Dcache enable */
#define CR_W 0x00000008 /* Write buffer enable */
#define CR_P 0x00000010 /* 32-bit exception handler */
#define CR_D 0x00000020 /* 32-bit data address range */
#define CR_L 0x00000040 /* Implementation defined */
#define CR_B 0x00000080 /* Big endian */
#define CR_S 0x00000100 /* System MMU protection */
#define CR_R 0x00000200 /* ROM MMU protection */
#define CR_F 0x00000400 /* Implementation defined */
#define CR_Z 0x00000800 /* Implementation defined */
#define CR_I 0x00001000 /* Icache enable */
#define CR_V 0x00002000 /* Vectors relocated to 0xffff0000 */
#define CR_RR 0x00004000 /* Round Robin cache replacement */
#define CR_L4 0x00008000 /* LDR pc can set T bit */
#define CR_DT 0x00010000
#define CR_IT 0x00040000
#define CR_ST 0x00080000
#define CR_FI 0x00200000 /* Fast interrupt (lower latency mode) */
#define CR_U 0x00400000 /* Unaligned access operation */
#define CR_XP 0x00800000 /* Extended page tables */
#define CR_VE 0x01000000 /* Vectored interrupts */
/* Hardware page table definitions.
*
* Level 1 Descriptor (PMD)
*
* Common definitions.
*/
#define PMD_TYPE_MASK 0x00000003 /* Bits 1:0: Type of descriptor */
#define PMD_TYPE_FAULT 0x00000000
#define PMD_TYPE_COARSE 0x00000001
#define PMD_TYPE_SECT 0x00000002
#define PMD_TYPE_FINE 0x00000003
/* Bits 3:2: Depends on descriptor */
#define PMD_BIT4 0x00000010 /* Bit 4: Must be one */
#define PMD_DOMAIN_MASK 0x000001e0 /* Bits 8:5: Domain control bits */
#define PMD_DOMAIN(x) ((x) << 5)
#define PMD_PROTECTION 0x00000200 /* Bit 9: v5 only */
/* Bits 31:10: Depend on descriptor */
/* Level 1 Section Descriptor. Section descriptors allow fast, single
* level mapping between 1Mb address regions.
*/
/* Bits 1:0: Type of mapping */
#define PMD_SECT_BUFFERABLE 0x00000004 /* Bit 2: 1=bufferable */
#define PMD_SECT_CACHEABLE 0x00000008 /* Bit 3: 1=cacheable */
/* Bit 4: Common, must be one */
/* Bits 8:5: Common domain control */
/* Bit 9: Common protection */
#define PMD_SECT_AP_MASK 0x00000c00 /* Bits 11:10: Access permission */
#define PMD_SECT_AP_WRITE 0x00000400
#define PMD_SECT_AP_READ 0x00000800
/* Bits 19:20: Should be zero */
#define PMD_SECT_TEX_MASK 0xfff00000 /* Bits 31:20: v5, Physical page */
#define PMD_SECT_APX 0x00008000 /* Bit 15: v6 only */
#define PMD_SECT_S 0x00010000 /* Bit 16: v6 only */
#define PMD_SECT_nG 0x00020000 /* Bit 17: v6 only */
#define PMD_SECT_UNCACHED (0)
#define PMD_SECT_BUFFERED (PMD_SECT_BUFFERABLE)
#define PMD_SECT_WT (PMD_SECT_CACHEABLE)
#define PMD_SECT_WB (PMD_SECT_CACHEABLE|PMD_SECT_BUFFERABLE)
#define PMD_SECT_MINICACHE (PMD_SECT_TEX(1)|PMD_SECT_CACHEABLE)
#define PMD_SECT_WBWA (PMD_SECT_TEX(1)|PMD_SECT_CACHEABLE|PMD_SECT_BUFFERABLE)
/* Level 1 Coarse Table Descriptor. Coarse Table Descriptors support
* two level mapping between 16Kb memory regions.
*/
/* Bits 1:0: Type of mapping */
/* Bits 3:2: Should be zero */
/* Bit 4: Common, must be one */
/* Bits 8:5: Common domain control */
/* Bits 9: Should be zero */
#define PMD_COARSE_TEX_MASK 0xfffffc00 /* Bits 31:10: v5, Physical page */
/* Level 1 Fine Table Descriptor. Coarse Table Descriptors support
* two level mapping between 4Kb memory regions.
*/
/* Bits 1:0: Type of mapping */
/* Bits 3:2: Should be zero */
/* Bit 4: Common, must be one */
/* Bits 8:5: Common domain control */
/* Bits 11:9: Should be zero */
#define PMD_FINE_TEX_MASK 0xfffff000 /* Bits 31:12: v5, Physical page */
/* Level 2 Table Descriptor (PTE). -- All tables */
#define PTE_TYPE_MASK (3 << 0) /* Bits: 1:0: Type of mapping */
#define PTE_TYPE_FAULT (0 << 0) /* None */
#define PTE_TYPE_LARGE (1 << 0) /* 64Kb of memory */
#define PTE_TYPE_SMALL (2 << 0) /* 4Kb of memory */
#define PTE_TYPE_TINY (3 << 0) /* 1Kb of memory (v5)*/
#define PTE_BUFFERABLE (1 << 2) /* Bit 2: 1=bufferable */
#define PTE_CACHEABLE (1 << 3) /* Bit 3: 1=cacheable */
/* Bits 31:4: Depend on type */
/* Large page -- 64Kb */
/* Bits: 1:0: Type of mapping */
/* Bits: 3:2: Bufferable/cacheable */
#define PTE_LARGE_AP_MASK (0xff << 4) /* Bits 11:4 Access permissions */
#define PTE_LARGE_AP_UNO_SRO (0x00 << 4)
#define PTE_LARGE_AP_UNO_SRW (0x55 << 4)
#define PTE_LARGE_AP_URO_SRW (0xaa << 4)
#define PTE_LARGE_AP_URW_SRW (0xff << 4)
/* Bits 15:12: Should be zero */
#define PTE_LARGE_TEX_MASK 0xffff0000 /* Bits 31:16: v5, Physical page */
/* Small page -- 4Kb */
/* Bits: 1:0: Type of mapping */
/* Bits: 3:2: Bufferable/cacheable */
#define PTE_SMALL_AP_MASK (0xff << 4) /* Bits: 11:4: Access permissions */
#define PTE_SMALL_AP_UNO_SRO (0x00 << 4)
#define PTE_SMALL_AP_UNO_SRW (0x55 << 4)
#define PTE_SMALL_AP_URO_SRW (0xaa << 4)
#define PTE_SMALL_AP_URW_SRW (0xff << 4)
#define PTE_SMALL_TEX_MASK 0xfffff000 /* Bits: 31:12: Physical page */
/* Tiny page -- 1Kb */
/* Bits: 1:0: Type of mapping */
/* Bits: 3:2: Bufferable/cacheable */
#define PTE_EXT_AP_MASK (3 << 4) /* Bits: 5:4: Access persions */
#define PTE_EXT_AP_UNO_SRO (0 << 4)
#define PTE_EXT_AP_UNO_SRW (1 << 4)
#define PTE_EXT_AP_URO_SRW (2 << 4)
#define PTE_EXT_AP_URW_SRW (3 << 4)
/* Bits: 9:6: Should be zero */
#define PTE_TINY_TEX_MASK 0xfffffc00 /* Bits: 31:10: Physical page */
/* Default MMU flags for memory and IO */
#define MMU_MEMFLAGS \
(PMD_TYPE_SECT|PMD_SECT_WB|PMD_BIT4|PMD_SECT_AP_WRITE|PMD_SECT_AP_READ)
#define MMU_IOFLAGS \
(PMD_TYPE_SECT|PMD_BIT4|PMD_SECT_AP_WRITE|PMD_SECT_AP_READ)
#define MMU_L1_VECTORFLAGS (PMD_TYPE_COARSE|PMD_BIT4)
#define MMU_L2_VECTORFLAGS (PTE_TYPE_SMALL|PTE_SMALL_AP_UNO_SRW)
/* Mapped section size */
#define SECTION_SIZE (1 << 20) /* 1Mb */
/* We place the page tables 16K below the beginning of .text. The
* following value is assume to be the (virtual) start address of
* .text.
*/
#define PGTABLE_SIZE 0x00004000
/************************************************************************************
* Inline Functions
************************************************************************************/
#ifndef __ASSEMBLY__
#endif
#endif /* __ARM_H */

View File

@@ -0,0 +1,79 @@
/************************************************************
* common/up_allocateheap.c
*
* Copyright (C) 2007 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.
*
************************************************************/
/************************************************************
* Included Files
************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <debug.h>
#include <nuttx/arch.h>
#include "up_arch.h"
#include "up_internal.h"
/************************************************************
* Private Definitions
************************************************************/
/************************************************************
* Private Data
************************************************************/
/************************************************************
* Private Functions
************************************************************/
/************************************************************
* Public Functions
************************************************************/
/************************************************************
* Name: up_allocate_heap
*
* Description:
* The heap may be statically allocated by
* defining CONFIG_HEAP_BASE and CONFIG_HEAP_SIZE. If these
* are not defined, then this function will be called to
* dynamically set aside the heap region.
*
************************************************************/
void up_allocate_heap(FAR void **heap_start, size_t *heap_size)
{
up_ledon(LED_HEAPALLOCATE);
*heap_start = (FAR void*)g_heapbase;
*heap_size = CONFIG_DRAM_END - g_heapbase;
}

View File

@@ -0,0 +1,92 @@
/************************************************************************************
* common/up_arch.h
*
* Copyright (C) 2007 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.
*
************************************************************************************/
#ifndef __UP_ARCH_H
#define __UP_ARCH_H
/************************************************************************************
* Included Files
************************************************************************************/
#include <nuttx/config.h>
#ifndef __ASSEMBLY__
# include <sys/types.h>
#endif
#include "arm.h"
#include <arch/board/board.h>
#include "chip.h"
/************************************************************************************
* Definitions
************************************************************************************/
/************************************************************************************
* Inline Functions
************************************************************************************/
#ifndef __ASSEMBLY__
# define getreg8(a) (*(volatile ubyte *)(a))
# define putreg8(v,a) (*(volatile ubyte *)(a) = (v))
# define getreg32(a) (*(volatile uint32 *)(a))
# define putreg32(v,a) (*(volatile uint32 *)(a) = (v))
/* Some compiler options will convert short loads and stores into byte loads
* and stores. We don't want this to happen for IO reads and writes!
*/
/* # define getreg16(a) (*(volatile uint16 *)(a)) */
static inline uint16 getreg16(unsigned int addr)
{
uint16 retval;
__asm__ __volatile__("\tldrh %0, [%1]\n\t" : "=r"(retval) : "r"(addr));
return retval;
}
/* define putreg16(v,a) (*(volatile uint16 *)(a) = (v)) */
static inline void putreg16(uint16 val, unsigned int addr)
{
__asm__ __volatile__("\tstrh %0, [%1]\n\t": : "r"(val), "r"(addr));
}
/* Most DM320 registers are 16-bits wide */
#define getreg(a) getreg16(a)
#define putreg(v,a) putreg16(v,a)
#endif
#endif /* __UP_ARCH_H */

View File

@@ -0,0 +1,228 @@
/****************************************************************************
* common/up_assert.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 <nuttx/config.h>
#include <sys/types.h>
#include <stdlib.h>
#include <assert.h>
#include <debug.h>
#include <nuttx/irq.h>
#include <nuttx/arch.h>
#include "up_arch.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: up_getsp
****************************************************************************/
/* I don't know if the builtin to get SP is enabled */
static inline uint32 up_getsp(void)
{
uint32 sp;
__asm__
(
"\tmov %0, sp\n\t"
: "=r"(sp)
);
return sp;
}
/****************************************************************************
* Name: up_stackdump
****************************************************************************/
#ifdef CONFIG_ARCH_STACKDUMP
static void up_stackdump(void)
{
_TCB *rtcb = (_TCB*)g_readytorun.head;
uint32 sp = up_getsp();
uint32 stack_base;
uint32 stack_size;
if (rtcb->pid == 0)
{
stack_base = g_heapbase - 4;
stack_size = CONFIG_PROC_STACK_SIZE;
}
else
{
stack_base = (uint32)rtcb->adj_stack_ptr;
stack_size = (uint32)rtcb->adj_stack_size;
}
lldbg("stack_base: %08x\n", stack_base);
lldbg("stack_size: %08x\n", stack_size);
lldbg("sp: %08x\n", sp);
if (sp >= stack_base || sp < stack_base - stack_size)
{
lldbg("ERROR: Stack pointer is not within allocated stack\n");
return;
}
else
{
uint32 stack = sp & ~0x1f;
for (stack = sp & ~0x1f; stack < stack_base; stack += 32)
{
uint32 *ptr = (uint32*)stack;
lldbg("%08x: %08x %08x %08x %08x %08x %08x %08x %08x\n",
stack, ptr[0], ptr[1], ptr[2], ptr[3],
ptr[4], ptr[5], ptr[6], ptr[7]);
}
}
if (current_regs)
{
int regs;
for (regs = REG_R0; regs <= REG_R15; regs += 8)
{
uint32 *ptr = (uint32*)&current_regs[regs];
lldbg("R%d: %08x %08x %08x %08x %08x %08x %08x %08x\n",
regs, ptr[0], ptr[1], ptr[2], ptr[3],
ptr[4], ptr[5], ptr[6], ptr[7]);
}
lldbg("CPSR: %08x\n", current_regs[REG_CPSR]);
}
}
#else
# define up_stackdump()
#endif
/****************************************************************************
* Name: _up_assert
****************************************************************************/
static void _up_assert(int errorcode) /* __attribute__ ((noreturn)) */
{
/* Are we in an interrupt handler or the idle task? */
if (current_regs || ((_TCB*)g_readytorun.head)->pid == 0)
{
(void)irqsave();
for(;;)
{
#ifdef CONFIG_ARCH_LEDS
up_ledon(LED_PANIC);
up_mdelay(250);
up_ledoff(LED_PANIC);
up_mdelay(250);
#endif
}
}
else
{
exit(errorcode);
}
}
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: up_assert
****************************************************************************/
void up_assert(const ubyte *filename, int lineno)
{
#if CONFIG_TASK_NAME_SIZE > 0
_TCB *rtcb = (_TCB*)g_readytorun.head;
#endif
up_ledon(LED_ASSERTION);
#if CONFIG_TASK_NAME_SIZE > 0
lldbg("Assertion failed at file:%s line: %d task: %s\n",
filename, lineno, rtcb->name);
#else
lldbg("Assertion failed at file:%s line: %d\n",
filename, lineno);
#endif
up_stackdump();
_up_assert(EXIT_FAILURE);
}
/****************************************************************************
* Name: up_assert_code
****************************************************************************/
void up_assert_code(const ubyte *filename, int lineno, int errorcode)
{
#if CONFIG_TASK_NAME_SIZE > 0
_TCB *rtcb = (_TCB*)g_readytorun.head;
#endif
up_ledon(LED_ASSERTION);
#if CONFIG_TASK_NAME_SIZE > 0
lldbg("Assertion failed at file:%s line: %d task: %s error code: %d\n",
filename, lineno, rtcb->name, errorcode);
#else
lldbg("Assertion failed at file:%s line: %d error code: %d\n",
filename, lineno, errorcode);
#endif
up_stackdump();
_up_assert(errorcode);
}

View File

@@ -0,0 +1,164 @@
/************************************************************
* common/up_blocktask.c
*
* Copyright (C) 2007 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.
*
************************************************************/
/************************************************************
* Included Files
************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <sched.h>
#include <debug.h>
#include <nuttx/arch.h>
#include "os_internal.h"
#include "up_internal.h"
/************************************************************
* Private Definitions
************************************************************/
/************************************************************
* Private Data
************************************************************/
/************************************************************
* Private Funtions
************************************************************/
/************************************************************
* Public Funtions
************************************************************/
/************************************************************
* Name: up_block_task
*
* Description:
* The currently executing task at the head of
* the ready to run list must be stopped. Save its context
* and move it to the inactive list specified by task_state.
*
* Inputs:
* tcb: Refers to a task in the ready-to-run list (normally
* the task at the the head of the list). It most be
* stopped, its context saved and moved into one of the
* waiting task lists. It it was the task at the head
* of the ready-to-run list, then a context to the new
* ready to run task must be performed.
* task_state: Specifies which waiting task list should be
* hold the blocked task TCB.
*
************************************************************/
void up_block_task(_TCB *tcb, tstate_t task_state)
{
/* Verify that the context switch can be performed */
if ((tcb->task_state < FIRST_READY_TO_RUN_STATE) ||
(tcb->task_state > LAST_READY_TO_RUN_STATE))
{
PANIC(OSERR_BADBLOCKSTATE);
}
else
{
_TCB *rtcb = (_TCB*)g_readytorun.head;
boolean switch_needed;
/* Remove the tcb task from the ready-to-run list. If we
* are blocking the task at the head of the task list (the
* most likely case), then a context switch to the next
* ready-to-run task is needed. In this case, it should
* also be true that rtcb == tcb.
*/
switch_needed = sched_removereadytorun(tcb);
/* Add the task to the specified blocked task list */
sched_addblocked(tcb, (tstate_t)task_state);
/* If there are any pending tasks, then add them to the g_readytorun
* task list now
*/
if (g_pendingtasks.head)
{
switch_needed |= sched_mergepending();
}
/* Now, perform the context switch if one is needed */
if (switch_needed)
{
/* Are we in an interrupt handler? */
if (current_regs)
{
/* Yes, then we have to do things differently.
* Just copy the current_regs into the OLD rtcb.
*/
up_copystate(rtcb->xcp.regs, current_regs);
/* Restore the exception context of the rtcb at the (new) head
* of the g_readytorun task list.
*/
rtcb = (_TCB*)g_readytorun.head;
/* Then switch contexts */
up_copystate(current_regs, rtcb->xcp.regs);
}
/* Copy the user C context into the TCB at the (old) head of the
* g_readytorun Task list. if up_saveusercontext returns a non-zero
* value, then this is really the previously running task restarting!
*/
else if (!up_saveusercontext(rtcb->xcp.regs))
{
/* Restore the exception context of the rtcb at the (new) head
* of the g_readytorun task list.
*/
rtcb = (_TCB*)g_readytorun.head;
/* Then switch contexts */
up_fullcontextrestore(rtcb->xcp.regs);
}
}
}
}

View File

@@ -0,0 +1,74 @@
/********************************************************************
* common/up_cache.S
*
* Copyright (C) 2007 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.
*
********************************************************************/
/********************************************************************
* Included Files
********************************************************************/
#include <nuttx/config.h>
#include "up_internal.h"
#include "up_arch.h"
/********************************************************************
* Definitions
********************************************************************/
#define CACHE_DLINESIZE 32
/********************************************************************
* Assembly Macros
********************************************************************/
/**************************************************************************
* Name: up_flushicache
**************************************************************************/
/* Esure coherency between the Icache and the Dcache in the region described
* by r0=start and r1=end.
*/
.globl up_flushicache
.type up_flushicache,%function
up_flushicache:
bic r0, r0, #CACHE_DLINESIZE - 1
1: mcr p15, 0, r0, c7, c10, 1 /* Clean D entry */
mcr p15, 0, r0, c7, c5, 1 /* Invalidate I entry */
add r0, r0, #CACHE_DLINESIZE
cmp r0, r1
blo 1b
mcr p15, 0, r0, c7, c10, 4 /* Drain WB */
mov pc, lr
.size up_flushicache, .-up_flushicache
.end

View File

@@ -0,0 +1,75 @@
/************************************************************
* common/up_copystate.c
*
* Copyright (C) 2007 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.
*
************************************************************/
/************************************************************
* Included Files
************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include "os_internal.h"
#include "up_internal.h"
/************************************************************
* Definitions
************************************************************/
/************************************************************
* Private Data
************************************************************/
/************************************************************
* Private Functions
************************************************************/
/************************************************************
* Public Funtions
************************************************************/
/************************************************************
* Name: up_undefinedinsn
************************************************************/
/* A little faster than most memcpy's */
void up_copystate(uint32 *dest, uint32 *src)
{
int i;
for (i = 0; i < XCPTCONTEXT_REGS; i++)
{
*dest++ = *src++;
}
}

View File

@@ -0,0 +1,128 @@
/************************************************************
* common/up_createstack.c
*
* Copyright (C) 2007 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.
*
************************************************************/
/************************************************************
* Included Files
************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <sched.h>
#include <debug.h>
#include <nuttx/kmalloc.h>
#include <nuttx/arch.h>
#include "up_arch.h"
#include "up_internal.h"
/************************************************************
* Private Types
************************************************************/
/************************************************************
* Private Function Prototypes
************************************************************/
/************************************************************
* Global Functions
************************************************************/
/************************************************************
* Name: up_create_stack
*
* Description:
* Allocate a stack for a new thread and setup
* up stack-related information in the TCB.
*
* The following TCB fields must be initialized:
* adj_stack_size: Stack size after adjustment for hardware,
* processor, etc. This value is retained only for debug
* purposes.
* stack_alloc_ptr: Pointer to allocated stack
* adj_stack_ptr: Adjusted stack_alloc_ptr for HW. The
* initial value of the stack pointer.
*
* Inputs:
* tcb: The TCB of new task
* stack_size: The requested stack size. At least this much
* must be allocated.
************************************************************/
STATUS up_create_stack(_TCB *tcb, size_t stack_size)
{
if (tcb->stack_alloc_ptr &&
tcb->adj_stack_size != stack_size)
{
sched_free(tcb->stack_alloc_ptr);
tcb->stack_alloc_ptr = NULL;
}
if (!tcb->stack_alloc_ptr)
{
tcb->stack_alloc_ptr = (uint32 *)kzmalloc(stack_size);
}
if (tcb->stack_alloc_ptr)
{
size_t top_of_stack;
size_t size_of_stack;
/* The Arm7Tdmi uses a push-down stack: the stack grows
* toward loweraddresses in memory. The stack pointer
* register, points to the lowest, valid work address
* (the "top" of the stack). Items on the stack are
* referenced as positive word offsets from sp.
*/
top_of_stack = (uint32)tcb->stack_alloc_ptr + stack_size - 4;
/* The Arm7Tdmi stack must be aligned at word (4 byte)
* boundaries. If necessary top_of_stack must be rounded
* down to the next boundary
*/
top_of_stack &= ~3;
size_of_stack = top_of_stack - (uint32)tcb->stack_alloc_ptr + 4;
/* Save the adjusted stack values in the _TCB */
tcb->adj_stack_ptr = (uint32*)top_of_stack;
tcb->adj_stack_size = size_of_stack;
up_ledon(LED_STACKCREATED);
return OK;
}
return ERROR;
}

View File

@@ -0,0 +1,81 @@
/************************************************************
* common/up_dataabort.c
*
* Copyright (C) 2007 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.
*
************************************************************/
/************************************************************
* Included Files
************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <debug.h>
#include <nuttx/irq.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
************************************************************/
/************************************************************
* Public Funtions
************************************************************/
/************************************************************
* Name: up_dataabort
************************************************************/
void up_dataabort(uint32 *regs)
{
lldbg("Data abort at 0x%x\n", regs[REG_PC]);
current_regs = regs;
PANIC(OSERR_ERREXCEPTION);
}

View File

@@ -0,0 +1,104 @@
/************************************************************
* common/up_doirq.c
*
* Copyright (C) 2007 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.
*
************************************************************/
/************************************************************
* Included Files
************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <nuttx/irq.h>
#include <nuttx/arch.h>
#include <assert.h>
#include "up_arch.h"
#include "os_internal.h"
#include "up_internal.h"
/************************************************************
* Definitions
************************************************************/
/************************************************************
* Public Data
************************************************************/
/************************************************************
* Private Data
************************************************************/
/************************************************************
* Private Functions
************************************************************/
/************************************************************
* Public Funtions
************************************************************/
void up_doirq(int irq, uint32* regs)
{
up_ledon(LED_INIRQ);
#ifdef CONFIG_SUPPRESS_INTERRUPTS
PANIC(OSERR_ERREXCEPTION);
#else
if ((unsigned)irq < NR_IRQS)
{
/* Current regs non-zero indicates that we are processing
* an interrupt; current_regs is also used to manage
* interrupt level context switches.
*/
current_regs = regs;
/* Mask and acknowledge the interrupt */
up_maskack_irq(irq);
/* Deliver the IRQ */
irq_dispatch(irq, regs);
/* Indicate that we are no long in an interrupt handler */
current_regs = NULL;
/* Unmask the last interrupt (global interrupts are still
* disabled.
*/
up_enable_irq(irq);
}
up_ledoff(LED_INIRQ);
#endif
}

View File

@@ -0,0 +1,173 @@
/****************************************************************************
* common/up_exit.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 <nuttx/config.h>
#include <sys/types.h>
#include <sched.h>
#include <debug.h>
#include <nuttx/arch.h>
#include "os_internal.h"
#include "up_internal.h"
#ifdef CONFIG_DUMP_ON_EXIT
#include <nuttx/fs.h>
#endif
/****************************************************************************
* Private Definitions
****************************************************************************/
/****************************************************************************
* Private Data
****************************************************************************/
/****************************************************************************
* Private Functions
****************************************************************************/
/****************************************************************************
* Name: _up_dumponexit
*
* Description:
* Dump the state of all tasks whenever on task exits. This is debug
* instrumentation that was added to check file-related reference counting
* but could be useful again sometime in the future.
*
****************************************************************************/
#if defined(CONFIG_DUMP_ON_EXIT) && defined(CONFIG_DEBUG)
static void _up_dumponexit(FAR _TCB *tcb, FAR void *arg)
{
#if CONFIG_NFILE_DESCRIPTORS > 0 || CONFIG_NFILE_STREAMS > 0
int i;
#endif
dbg(" TCB=%p name=%s\n", tcb, tcb->argv[0]);
#if CONFIG_NFILE_DESCRIPTORS > 0
if (tcb->filelist)
{
dbg(" filelist refcount=%d\n",
tcb->filelist->fl_crefs);
for (i = 0; i < CONFIG_NFILE_DESCRIPTORS; i++)
{
struct inode *inode = tcb->filelist->fl_files[i].f_inode;
if (inode)
{
dbg(" fd=%d refcount=%d\n",
i, inode->i_crefs);
}
}
}
#endif
#if CONFIG_NFILE_STREAMS > 0
if (tcb->streams)
{
dbg(" streamlist refcount=%d\n",
tcb->streams->sl_crefs);
for (i = 0; i < CONFIG_NFILE_STREAMS; i++)
{
struct file_struct *filep = &tcb->streams->sl_streams[i];
if (filep->fs_filedes >= 0)
{
#if CONFIG_STDIO_BUFFER_SIZE > 0
dbg(" fd=%d nbytes=%d\n",
filep->fs_filedes,
filep->fs_bufpos - filep->fs_bufstart);
#else
dbg(" fd=%d\n", filep->fs_filedes);
#endif
}
}
}
#endif
}
#endif
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: _exit
*
* Description:
* This function causes the currently executing task to cease
* to exist. This is a special case of task_delete() where the task to
* be deleted is the currently executing task. It is more complex because
* a context switch must be perform to the the next ready to run task.
*
****************************************************************************/
void _exit(int status)
{
_TCB* tcb;
/* Disable interrupts. They will be restored when the next
* task is started.
*/
(void)irqsave();
lldbg("TCB=%p exitting\n", tcb);
#if defined(CONFIG_DUMP_ON_EXIT) && defined(CONFIG_DEBUG)
lldbg("Other tasks:\n");
sched_foreach(_up_dumponexit, NULL);
#endif
/* Destroy the task at the head of the ready to run list. */
(void)task_deletecurrent();
/* Now, perform the context switch to the new ready-to-run task at the
* head of the list.
*/
tcb = (_TCB*)g_readytorun.head;
lldbg("New Active Task TCB=%p\n", tcb);
/* Then switch contexts */
up_fullcontextrestore(tcb->xcp.regs);
}

View File

@@ -0,0 +1,117 @@
/**************************************************************************
* common/up_fullcontextrestore.S
*
* Copyright (C) 2007 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.
*
**************************************************************************/
/**************************************************************************
* Included Files
**************************************************************************/
#include <nuttx/irq.h>
#include "up_internal.h"
/**************************************************************************
* Private Definitions
**************************************************************************/
/**************************************************************************
* Private Types
**************************************************************************/
/**************************************************************************
* Private Function Prototypes
**************************************************************************/
/**************************************************************************
* Global Variables
**************************************************************************/
/**************************************************************************
* Private Variables
**************************************************************************/
/**************************************************************************
* Private Functions
**************************************************************************/
/**************************************************************************
* Public Functions
**************************************************************************/
/**************************************************************************
* Name: up_fullcontextrestore
**************************************************************************/
.globl up_fullcontextrestore
.type up_fullcontextrestore, function
up_fullcontextrestore:
/* On entry, a1 (r0) holds address of the register save area */
/* Recover all registers except for r0, r1, R15, and CPSR */
add r1, r0, #(4*REG_R2) /* Offset to REG_R2 storage */
ldmia r1, {r2-r14} /* Recover registers */
/* Create a stack frame to hold the PC */
sub sp, sp, #(3*4) /* Frame for three registers */
ldr r1, [r0, #(4*REG_R0)] /* Fetch the stored r0 value */
str r1, [sp] /* Save it at the top of the stack */
ldr r1, [r0, #(4*REG_R1)] /* Fetch the stored r1 value */
str r1, [sp, #4] /* Save it in the stack */
ldr r1, [r0, #(4*REG_PC)] /* Fetch the stored pc value */
str r1, [sp, #8] /* Save it at the bottom of the frame */
/* Now we can restore the CPSR. We wait until we are completely
* finished with the context save data to do this. Restore the CPSR
* may re-enable and interrupts and we couldt be in a context
* where save structure is only protected by interrupts being disabled.
*/
ldr r1, [r0, #(4*REG_CPSR)] /* Fetch the stored CPSR value */
msr cpsr, r1 /* Set the CPSR */
/* Now recover r0 and r1 */
ldr r0, [sp]
ldr r1, [sp, #4]
add sp, sp, #(2*4)
/* Then return to the address at the stop of the stack,
* destroying the stack frame
*/
ldr pc, [sp], #4
.size up_fullcontextrestore, . - up_fullcontextrestore

View File

@@ -0,0 +1,324 @@
/********************************************************************
* common/up_head.S
*
* Copyright (C) 2007 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.
*
********************************************************************/
/********************************************************************
* Included Files
********************************************************************/
#include <nuttx/config.h>
#include "up_internal.h"
#include "up_arch.h"
/**************************************************************************
* Conditional Compilation
**************************************************************************/
#undef ALIGNMENT_TRAP
#undef CPU_DCACHE_WRITETHROUGH
#undef CPU_CACHE_ROUND_ROBIN
#undef CPU_DCACHE_DISABLE
#undef CPU_ICACHE_DISABLE
/********************************************************************
* Definitions
********************************************************************/
/* The physical address of the beginning of SDRAM is provided by
* CONFIG_DRAM_START. The size of installed SDRAM is provided by
* CONFIG_DRAM_SIZE. The virtual address of SDRAM is provided by
* CONFIG_DRAM_VSTART.
*/
#define NSDRAM_SECTIONS (CONFIG_DRAM_SIZE >> 20)
/********************************************************************
* Assembly Macros
********************************************************************/
/* Since the page table is closely related to the NuttX base
* address, we can convert the page table base address to the
* base address of the section containing both.
*/
.macro mksection, section, pgtable
bic \section, \pgtable, #0x000ff000
.endm
/* This macro will modify r0, r1, r2 and r14 */
#ifdef CONFIG_DEBUG
.macro showprogress, code
mov r0, #\code
bl up_lowputc
.endm
#else
.macro showprogress, code
.endm
#endif
/********************************************************************
* Name: __start
********************************************************************/
/* We assume the bootloader has already initialized most of the h/w for
* us and that only leaves us having to do some os specific things
* below.
*/
.text
.global __start
.type __start, #function
__start:
/* Make sure that we are in SVC mode with all IRQs disabled */
mov r0, #(SVC_MODE | PSR_I_BIT | PSR_F_BIT)
msr cpsr_c, r0
/* Clear the 16K level 1 page table */
ldr r4, .LCppgtable /* r4=phys. page table */
mov r0, r4
mov r1, #0
add r2, r0, #PGTABLE_SIZE
.Lpgtableclear:
str r1, [r0], #4
str r1, [r0], #4
str r1, [r0], #4
str r1, [r0], #4
teq r0, r2
bne .Lpgtableclear
/* Create identity mapping for first MB section to support
* this startup logic executing out of the physical address
* space. This identity mapping will be removed by .Lvstart
* (see below).
*/
mksection r0, r4 /* r0=phys. base section */
ldr r1, .LCmmuflags /* FLGS=MMU_MEMFLAGS */
add r3, r1, r0 /* r3=flags + base */
str r3, [r4, r0, lsr #18] /* identity mapping */
/* Create a "normal" single section mapping for the first
* MB of memory. Now, we have the first 1MB mapping to
* both phyical and virtual addresses. The reset of the
* SDRAM mapping will be completed in .Lvstart once we have
* moved the physical mapping out of the way.
*/
ldr r2, .LCvpgtable /* r2=virt. page table */
mksection r0, r2 /* r0=virt. base section */
str r3, [r4, r0, lsr #18] /* identity mapping */
/* The following logic will set up the ARM926 for normal operation */
mov r0, #0
mcr p15, 0, r0, c7, c7 /* Invalidate I,D caches */
mcr p15, 0, r0, c7, c10, 4 /* Drain write buffer */
mcr p15, 0, r0, c8, c7 /* Invalidate I,D TLBs */
mcr p15, 0, r4, c2, c0 /* Load page table pointer */
#ifdef CPU_DCACHE_WRITETHROUGH
mov r0, #4 /* Disable write-back on caches explicitly */
mcr p15, 7, r0, c15, c0, 0
#endif
/* Enable the MMU and caches
* lr = Resume at .Lvstart with the MMU enabled
*/
ldr lr, .LCvstart /* Abs. virtual address */
mov r0, #0x1f /* Domains 0, 1 = client */
mcr p15, 0, r0, c3, c0 /* Load domain access register */
mrc p15, 0, r0, c1, c0 /* Get control register */
/* Clear bits (see start.h) */
bic r0, r0, #(CR_R|CR_F|CR_Z)
bic r0, r0, #(CR_A|CR_C|CR_W)
bic r0, r0, #(CR_I)
/* Set bits (see start.h) */
orr r0, r0, #(CR_M|CR_P|CR_D)
orr r0, r0, #(CR_S|CR_V)
#ifdef CPU_CACHE_ROUND_ROBIN
orr r0, r0, #(CR_RR)
#endif
#ifndef CPU_DCACHE_DISABLE
orr r0, r0, #(CR_C)
#endif
#ifndef CPU_ICACHE_DISABLE
orr r0, r0, #(CR_I)
#endif
#ifdef ALIGNMENT_TRAP
orr r0, r0, #(CR_A)
#endif
mcr p15, 0, r0, c1, c0, 0 /* write control reg */
/* Get TMP=2 Processor ID register */
mrc p15, 0, r1, c0, c0, 0 /* read id reg */
mov r1, r1
mov r1, r1
mov pc, lr
/**************************************************************************
* PC_Relative Data
**************************************************************************/
/* These addresses are all virtual address */
.type .LCvstart, %object
.LCvstart:
.long .Lvstart
.type .LCmmuflags, %object
.LCmmuflags:
.long MMU_MEMFLAGS
.type .LCppagetable, %object
.LCppgtable:
.long CONFIG_DRAM_START /* Physical start of DRAM */
.type .LCvpagetable, %object
.LCvpgtable:
.long CONFIG_DRAM_VSTART /* Virtual start of DRAM */
.size _start, .-_start
/**************************************************************************
* Name: .Lvstart
**************************************************************************/
/* The following is executed after the MMU has been enabled. This uses
* absolute addresses; this is not position independent.
*/
.align 5
.local .Lvstart
.type .Lvstart, %function
.Lvstart:
/* Remove the temporary null mapping */
ldr r4, .LCvpgtable /* r4=virtual page table */
ldr r1, .LCppgtable /* r1=phys. page table */
mksection r3, r1 /* r2=phys. base addr */
mov r0, #0 /* flags + base = 0 */
str r0, [r4, r3, lsr #18] /* Undo identity mapping */
/* Now setup the pagetables for our normal SDRAM mappings
* mapped region. We round NUTTX_START_VADDR down to the
* nearest megabyte boundary.
*/
ldr r1, .LCmmuflags /* FLGS=MMU_MEMFLAGS */
add r3, r3, r1 /* r3=flags + base */
add r0, r4, #(NUTTX_START_VADDR & 0xff000000) >> 18
bic r2, r3, #0x00f00000
str r2, [r0]
add r0, r0, #(NUTTX_START_VADDR & 0x00f00000) >> 18
str r3, [r0], #4
/* Now map the remaining NSDRAM_SECTIONS-1 SDRAM sections */
.rept NSDRAM_SECTIONS-1
add r3, r3, #SECTION_SIZE
str r3, [r0], #4
.endr
/* Zero BSS and set up the stack pointer */
adr r0, .Linitparms
ldmia r0, {r0, r1, sp}
/* Clear the frame pointer and .bss */
mov fp, #0
.Lbssinit:
cmp r0, r1 /* Clear up to _bss_end_ */
strcc fp, [r0],#4
bcc .Lbssinit
/* Perform early C-level initialization */
bl up_boot
/* Set up the LEDs */
#ifdef CONFIG_ARCH_LEDS
bl up_ledinit
#endif
/* Perform early serial initialization */
#if defined(CONFIG_DEV_CONSOLE) && CONFIG_NFILE_DESCRIPTORS > 0
bl up_earlyserialinit
#endif
/* Finally branch to the OS entry point */
mov lr, #0
b os_start
/* Variables:
* _sbss is the start of the BSS region (see ld.script)
* _ebss is the end of the BSS regsion (see ld.script)
* The idle task stack starts at the end of BSS and is
* of size CONFIG_PROC_STACK_SIZE. The heap continues
* from there until the end of memory. See g_heapbase
* below.
*/
.Linitparms:
.long _sbss
.long _ebss
.long _ebss+CONFIG_PROC_STACK_SIZE-4
.size .Lvstart, .-.Lvstart
/* This global variable is unsigned long g_heapbase and is
* exported from here only because of its coupling to .Linitparms
* above.
*/
.data
.align 4
.globl g_heapbase
.type g_heapbase, object
g_heapbase:
.long _ebss+CONFIG_PROC_STACK_SIZE
.size g_heapbase, .-g_heapbase
.end

View File

@@ -0,0 +1,87 @@
/************************************************************
* common/up_idle.c
*
* Copyright (C) 2007 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.
*
************************************************************/
/************************************************************
* Included Files
************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <nuttx/arch.h>
#include "up_internal.h"
/************************************************************
* Private Definitions
************************************************************/
/************************************************************
* Private Data
************************************************************/
/************************************************************
* Private Funtions
************************************************************/
/************************************************************
* Public Funtions
************************************************************/
/************************************************************
* Name: up_idle
*
* Description:
* up_idle() is the logic that will be executed when their
* is no other ready-to-run task. This is processor idle
* time and will continue until some interrupt occurs to
* cause a context switch from the idle task.
*
* Processing in this state may be processor-specific. e.g.,
* this is where power management operations might be
* performed.
*
************************************************************/
void up_idle(void)
{
#if defined(CONFIG_SUPPRESS_INTERRUPTS) || defined(CONFIG_SUPPRESS_TIMER_INTS)
/* If the system is idle and there are no timer interrupts,
* then process "fake" timer interrupts. Hopefully, something
* will wake up.
*/
sched_process_timer();
#endif
}

View File

@@ -0,0 +1,144 @@
/****************************************************************************
* common/up_initialize.c
*
* Copyright (C) 2007 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.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <debug.h>
#include <nuttx/arch.h>
#include <nuttx/fs.h>
#include "up_arch.h"
#include "up_internal.h"
/****************************************************************************
* Definitions
****************************************************************************/
/* Define to enable timing loop calibration */
#undef CONFIG_ARM_CALIBRATION
/****************************************************************************
* Private Types
****************************************************************************/
/****************************************************************************
* Private Functions
****************************************************************************/
/****************************************************************************
* Name: up_calibratedelay
*
* Description:
* Delay loops are provided for short timing loops. This function, if
* enabled, will just wait for 100 seconds. Using a stopwatch, you can
* can then determine if the timing loops are properly calibrated.
*
****************************************************************************/
#if defined(CONFIG_ARM_CALIBRATION) & defined(CONFIG_DEBUG)
static void up_calibratedelay(void)
{
int i;
lldbg("Beginning 100s delay\n");
for (i = 0; i < 100; i++)
{
up_mdelay(1000);
}
lldbg("End 100s delay\n");
}
#else
# define up_calibratedelay()
#endif
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: up_initialize
*
* Description:
* up_initialize will be called once during OS initialization after the
* basic OS services have been initialized. The architecture specific
* details of initializing the OS will be handled here. Such things as
* setting up interrupt service routines, starting the clock, and
* registering device drivers are some of the things that are different
* for each processor and hardware platform.
*
* up_initialize is called after the OS initialized but before the user
* initialization logic has been started and before the libraries have
* been initialized. OS services and driver services are available.
*
****************************************************************************/
void up_initialize(void)
{
/* Initialize global variables */
current_regs = NULL;
/* Calibrate the timing loop */
up_calibratedelay();
/* Initialize the interrupt subsystem */
up_irqinitialize();
/* Initialize the system timer interrupt */
#if !defined(CONFIG_SUPPRESS_INTERRUPTS) && !defined(CONFIG_SUPPRESS_TIMER_INTS)
up_timerinit();
#endif
/* Register devices */
#if CONFIG_NFILE_DESCRIPTORS > 0
devnull_register(); /* Standard /dev/null */
#endif
/* Initialize the serial device driver */
up_serialinit();
/* Initialize the netwok */
up_netinitialize();
up_ledon(LED_IRQSENABLED);
}

View File

@@ -0,0 +1,91 @@
/************************************************************
* common/up_initialstate.c
*
* Copyright (C) 2007 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.
*
************************************************************/
/************************************************************
* Included Files
************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <string.h>
#include <nuttx/arch.h>
#include "up_internal.h"
#include "up_arch.h"
/************************************************************
* Private Definitions
************************************************************/
/************************************************************
* Private Data
************************************************************/
/************************************************************
* Private Funtions
************************************************************/
/************************************************************
* Public Funtions
************************************************************/
/************************************************************
* 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));
xcp->regs[REG_SP] = (uint32)tcb->adj_stack_ptr;
xcp->regs[REG_PC] = (uint32)tcb->start;
#ifdef CONFIG_SUPPRESS_INTERRUPTS
xcp->regs[REG_CPSR] = SVC_MODE | PSR_I_BIT | PSR_F_BIT;
#else
xcp->regs[REG_CPSR] = SVC_MODE | PSR_F_BIT;
#endif
}

View File

@@ -0,0 +1,173 @@
/****************************************************************************
* common/up_internal.h
*
* 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.
*
****************************************************************************/
#ifndef __UP_INTERNAL_H
#define __UP_INTERNAL_H
/****************************************************************************
* Included Files
****************************************************************************/
/****************************************************************************
* Definitions
****************************************************************************/
/* Bring-up debug configurations. These are here (vs defconfig)
* because these should only be controlled during low level
* board bring-up and not part of normal platform configuration.
*/
#undef CONFIG_SUPPRESS_INTERRUPTS /* Do not enable interrupts */
#undef CONFIG_SUPPRESS_TIMER_INTS /* No timer */
#undef CONFIG_SUPPRESS_SERIAL_INTS /* Console will poll */
#define CONFIG_SUPPRESS_UART_CONFIG 1 /* Do not reconfig UART */
#undef CONFIG_DUMP_ON_EXIT /* Dump task state on exit */
/****************************************************************************
* Public Types
****************************************************************************/
#ifndef __ASSEMBLY__
typedef void (*up_vector_t)(void);
#endif
/****************************************************************************
* Public Variables
****************************************************************************/
#ifndef __ASSEMBLY__
/* This holds a references to the current interrupt level
* register storage structure. If is non-NULL only during
* interrupt processing.
*/
extern uint32 *current_regs;
/* This is the beginning of heap as provided from up_head.S.
* This is the first address in DRAM after the loaded
* program+bss+idle stack. The end of the heap is
* CONFIG_DRAM_END
*/
extern uint32 g_heapbase;
#endif
/****************************************************************************
* Inline Functions
****************************************************************************/
/****************************************************************************
* Public Functions
****************************************************************************/
#ifndef __ASSEMBLY__
/* Defined in files with the same name as the function */
extern void up_boot(void);
extern void up_copystate(uint32 *dest, uint32 *src);
extern void up_dataabort(uint32 *regs);
extern void up_decodeirq(uint32 *regs);
extern void up_doirq(int irq, uint32 *regs);
extern void up_fullcontextrestore(uint32 *regs) __attribute__ ((noreturn));
extern void up_irqinitialize(void);
extern void up_prefetchabort(uint32 *regs);
extern int up_saveusercontext(uint32 *regs);
extern void up_sigdeliver(void);
extern void up_syscall(uint32 *regs);
extern int up_timerisr(int irq, uint32 *regs);
extern void up_undefinedinsn(uint32 *regs);
#ifdef CONFIG_DEBUG
extern void up_lowputc(char ch);
#else
# define up_lowputc(ch)
#endif
/* Defined in up_vectors.S */
extern void up_vectorundefinsn(void);
extern void up_vectorswi(void);
extern void up_vectorprefetch(void);
extern void up_vectordata(void);
extern void up_vectoraddrexcptn(void);
extern void up_vectorirq(void);
extern void up_vectorfiq(void);
/* Defined in up_serial.c */
#if CONFIG_NFILE_DESCRIPTORS > 0
extern void up_earlyserialinit(void);
extern void up_serialinit(void);
#else
# define up_earlyserialinit()
# define up_serialinit()
#endif
/* Defined in up_watchdog.c */
extern void up_wdtinit(void);
/* Defined in up_timerisr.c */
extern void up_timerinit(void);
/* Defined in up_irq.c */
extern void up_maskack_irq(int irq);
/* Defined in board/up_leds.c */
#ifdef CONFIG_ARCH_LEDS
extern void up_ledinit(void);
extern void up_ledon(int led);
extern void up_ledoff(int led);
#else
# define up_ledinit()
# define up_ledon(led)
# define up_ledoff(led)
#endif
/* Defined in board/up_network.c */
#ifdef CONFIG_NET
extern void up_netinitialize(void);
#else
# define up_netinitialize()
#endif
#endif /* __ASSEMBLY__ */
#endif /* __UP_INTERNAL_H */

View File

@@ -0,0 +1,68 @@
/************************************************************
* common/up_interruptcontext.c
*
* Copyright (C) 2007 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.
*
************************************************************/
/************************************************************
* Included Files
************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <nuttx/arch.h>
#include <nuttx/irq.h>
#include "up_internal.h"
/************************************************************
* Private Types
************************************************************/
/************************************************************
* Private Function Prototypes
************************************************************/
/************************************************************
* Global Functions
************************************************************/
/************************************************************
* Name: up_interrupt_context
*
* Description: Return TRUE is we are currently executing in
* the interrupt handler context.
************************************************************/
boolean up_interrupt_context(void)
{
return current_regs != NULL;
}

View File

@@ -0,0 +1,90 @@
/****************************************************************************
* common/up_mdelay.c
*
* Copyright (C) 2007 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.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <nuttx/arch.h>
/****************************************************************************
* Definitions
****************************************************************************/
/****************************************************************************
* Private Types
****************************************************************************/
/****************************************************************************
* Private Function Prototypes
****************************************************************************/
/****************************************************************************
* Private Variables
****************************************************************************/
/****************************************************************************
* Private Functions
****************************************************************************/
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: up_mdelay
*
* Description:
* Delay inline for the requested number of milliseconds.
* *** NOT multi-tasking friendly ***
*
* ASSUMPTIONS:
* The setting CONFIG_BOARD_LOOPSPERMSEC has been calibrated
*
****************************************************************************/
void up_mdelay(unsigned int milliseconds)
{
volatile int i;
volatile int j;
for (i = 0; i < milliseconds; i++)
{
for (j = 0; j < CONFIG_BOARD_LOOPSPERMSEC; j++)
{
}
}
}

View File

@@ -0,0 +1,165 @@
/********************************************************************
* common/up_nommuhead.S
*
* Copyright (C) 2007 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.
*
********************************************************************/
/********************************************************************
* Included Files
********************************************************************/
#include <nuttx/config.h>
#include "up_internal.h"
#include "up_arch.h"
/********************************************************************
* Macros
********************************************************************/
/* This macro will modify r0, r1, r2 and r14 */
#ifdef CONFIG_DEBUG
.macro showprogress, code
mov r0, #\code
bl up_lowputc
.endm
#else
.macro showprogress, code
.endm
#endif
/********************************************************************
* OS Entry Point
********************************************************************/
/* We assume the bootloader has already initialized most of the h/w for
* us and that only leaves us having to do some os specific things
* below.
*/
.text
.global __start
.type __start, #function
__start:
/* First, setup initial processor mode */
mov r0, #(SVC_MODE | PSR_I_BIT | PSR_F_BIT )
msr cpsr, r0
showprogress 'A'
/* Setup system stack (and get the BSS range) */
adr r0, LC0
ldmia r0, {r4, r5, sp}
/* Clear system BSS section */
mov r0, #0
1: cmp r4, r5
strcc r0, [r4], #4
bcc 1b
showprogress 'B'
/* Copy system .data sections to new home in RAM. */
#ifdef CONFIG_BOOT_FROM_FLASH
adr r3, LC2
ldmia r3, {r0, r1, r2}
1: ldmia r0!, {r3 - r10}
stmia r1!, {r3 - r10}
cmp r1, r2
blt 1b
#endif
#if defined(CONFIG_DEV_CONSOLE) && CONFIG_NFILE_DESCRIPTORS >0
/* Perform early serial initialization */
mov fp, #0
bl up_earlyserialinit
#endif
#ifdef CONFIG_DEBUG
mov r0, #'C'
bl up_putc
mov r0, #'\n'
bl up_putc
#endif
/* Initialize onboard LEDs */
#ifdef CONFIG_ARCH_LEDS
bl up_ledinit
#endif
/* Then jump to OS entry */
b os_start
/* Variables:
* _sbss is the start of the BSS region (see ld.script)
* _ebss is the end of the BSS regsion (see ld.script)
* The idle task stack starts at the end of BSS and is
* of size CONFIG_PROC_STACK_SIZE. The heap continues
* from there until the end of memory. See g_heapbase
* below.
*/
LC0: .long _sbss
.long _ebss
.long _ebss+CONFIG_PROC_STACK_SIZE-4
#ifdef CONFIG_BOOT_FROM_FLASH
LC2: .long _eronly /* Where .data defaults are stored in FLASH */
.long _sdata /* Where .data needs to reside in SDRAM */
.long _edata
#endif
.size __start, .-__start
/* This global variable is unsigned long g_heapbase and is
* exported from here only because of its coupling to LCO
* above.
*/
.data
.align 4
.globl g_heapbase
.type g_heapbase, object
g_heapbase:
.long _ebss+CONFIG_PROC_STACK_SIZE
.size g_heapbase, .-g_heapbase
.end

View File

@@ -0,0 +1,81 @@
/************************************************************
* common/up_prefetchabort.c
*
* Copyright (C) 2007 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.
*
************************************************************/
/************************************************************
* Included Files
************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <debug.h>
#include <nuttx/irq.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
************************************************************/
/************************************************************
* Public Funtions
************************************************************/
/************************************************************
* Name: up_prefetchabort
************************************************************/
void up_prefetchabort(uint32 *regs)
{
lldbg("Prefetch abort at 0x%x\n", regs[REG_PC]);
current_regs = regs;
PANIC(OSERR_ERREXCEPTION);
}

View File

@@ -0,0 +1,131 @@
/************************************************************
* common/up_releasepending.c
*
* Copyright (C) 2007 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.
*
************************************************************/
/************************************************************
* Included Files
************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <sched.h>
#include <debug.h>
#include <nuttx/arch.h>
#include "os_internal.h"
#include "up_internal.h"
/************************************************************
* Private Definitions
************************************************************/
/************************************************************
* Private Data
************************************************************/
/************************************************************
* Private Funtions
************************************************************/
/************************************************************
* Public Funtions
************************************************************/
/************************************************************
* Name: up_release_pending
*
* Description:
* Release and ready-to-run tasks that have
* collected in the pending task list. This can call a
* context switch if a new task is placed at the head of
* the ready to run list.
*
************************************************************/
void up_release_pending(void)
{
_TCB *rtcb = (_TCB*)g_readytorun.head;
lldbg("From TCB=%p\n", rtcb);
/* Merge the g_pendingtasks list into the g_readytorun task list */
/* sched_lock(); */
if (sched_mergepending())
{
/* The currently active task has changed! We will need to
* switch contexts. First check if we are operating in
* interrupt context:
*/
if (current_regs)
{
/* Yes, then we have to do things differently.
* Just copy the current_regs into the OLD rtcb.
*/
up_copystate(rtcb->xcp.regs, current_regs);
/* Restore the exception context of the rtcb at the (new) head
* of the g_readytorun task list.
*/
rtcb = (_TCB*)g_readytorun.head;
lldbg("New Active Task TCB=%p\n", rtcb);
/* Then switch contexts */
up_copystate(current_regs, rtcb->xcp.regs);
}
/* Copy the exception context into the TCB of the task that
* was currently active. if up_saveusercontext returns a non-zero
* value, then this is really the previously running task
* restarting!
*/
else if (!up_saveusercontext(rtcb->xcp.regs))
{
/* Restore the exception context of the rtcb at the (new) head
* of the g_readytorun task list.
*/
rtcb = (_TCB*)g_readytorun.head;
lldbg("New Active Task TCB=%p\n", rtcb);
/* Then switch contexts */
up_fullcontextrestore(rtcb->xcp.regs);
}
}
}

View File

@@ -0,0 +1,78 @@
/************************************************************
* common/up_releasestack.c
*
* Copyright (C) 2007 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.
*
************************************************************/
/************************************************************
* Included Files
************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <sched.h>
#include <debug.h>
#include <nuttx/arch.h>
#include "os_internal.h"
#include "up_internal.h"
/************************************************************
* Private Types
************************************************************/
/************************************************************
* Private Function Prototypes
************************************************************/
/************************************************************
* Global 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)
{
if (dtcb->stack_alloc_ptr)
{
sched_free(dtcb->stack_alloc_ptr);
dtcb->stack_alloc_ptr = NULL;
}
dtcb->adj_stack_size = 0;
}

Some files were not shown because too many files have changed in this diff Show More