1
0
mirror of https://github.com/elua/elua.git synced 2025-01-08 20:56:17 +08:00

105 Commits

Author SHA1 Message Date
Martin Guy
1c1a59851d Split platform_pwm_op(id, op[, data]) into four distinct functions
platform_pwm_op( id, op, data ) did four unrelated tasks, switching on the
"op" parameter:
op==PLATFORM_PWM_OP_SET_CLOCK took a frequency and returned a frequency
op==PLATFORM_PWM_OP_GET_CLOCK took nothing returned a frequency
op==PLATFORM_PWM_OP_START and _STOP both took nothing and returned nothing

this patch replaces it with:
clock = platform_pwm_set_clock( id, clock)
clock = platform_pwm_get_clock( id )
platform_pwm_start( id ) and
platform_pwm_stop( id )

with resulting clarity in the documentation and smaller, faster code.

This does not affect the Lau interface.
2011-08-02 16:15:59 +02:00
James Snyder
06fa255251 add os module for desktop builds of Lua including LuaRPC binary 2011-07-25 19:31:29 -05:00
Martin Guy
158ce167ca Split platform_adc_op() into six separate functions
Previously, you called platform_adc_op(id, OPERATION, u32 arg) to achieve
six unrelated functions with different arg types and return values:

GET_MAXVAL takes nothing and returns an ADC conversion value
SET_SMOOTHING takes a power-of-two filter length and returns nothing
SET_BLOCKING takes a boolean and returns nothing
IS_DONE takes nothing and returns a boolean
SET_TIMER takes a timer ID and returns nothing
SET_CLOCK takes a frequency in Hz and returns a frequency in Hz.

This changes these to six independent functions, each with the right
parameters and return values.

This also makes the documentation more comprehensible, saves 26 bytes of
executable code and should be very slightly faster.
2011-07-23 20:04:32 +02:00
Martin Guy
a04fcd854e MMCFS_TICK_HZ needs to be the same as VTMR_FREQ_HZ
elua_mmc.c uses the virtual timer tick to implement its timeout delays,
and needs MMCFS_TICK_HZ to have the same value as VTMR_FREQ_HZ.
This corrects the mismatch on AVR32 platforms and adds a check to
validate.h to ensure that it remains so.
2011-07-13 23:02:33 +02:00
Martin Guy
2a6131ffe6 Eliminate all TAB characters in elua-specific code files.
Tabs have been creeping in to eLua's source files, sometimes representing
2 characters, sometimes 8.  This patch replaces them all with the appropriate
number of spaces, according to the context.
This only fixes files that were written specifically for eLua, not the
manufacturers' SDK source files that were simply imported into the tree.
2011-07-05 17:17:45 +02:00
James Snyder
ef1f485db6 Use linenoise instead of readline on POSIX platforms for desktop LuaRPC 2011-06-20 18:04:53 -05:00
James Snyder
ae856ae163 add bitarray, bit and pack modules to desktop luarpc build 2011-05-02 16:46:53 -05:00
Martin Guy
c0119c0908 Revert "Allow enabling/disabling of console buffer bu changing only BUF_ENABLE_CON"
This reverts commit a836ebeaaee9b3a84096f6f72213fa4a9d9f725a.

As requested by Bogdan
2011-04-25 13:52:10 +02:00
Martin Guy
a836ebeaae Allow enabling/disabling of console buffer bu changing only BUF_ENABLE_CON
(before, you had to change BUF_ENABLE_CON and CON_BUF_SIZE in parallel).
2011-04-23 18:05:50 +02:00
Dado Sutter
8dbeb972a3 - Changing .org to .net on the Copyright notice (at least until we start using www.eluaprojec.org domain) 2011-02-07 22:45:16 +00:00
Dado Sutter
3b14f52f52 - Copyright notice on shell prompt updated to 2011
- Community page changes irrelevant here, as this content will migrate to a CMS soon
2011-02-07 20:47:11 +00:00
Bogdan Marinescu
81e7f040fc merged remotefs_int branch on trunk, not fully tested yet 2011-01-16 00:23:19 +00:00
Bogdan Marinescu
cbd00c7a20 INT_TMR_MATCH support for STR9 platforms, so far tested ONLY on virtual timers. Note that if a physical timer is allocated to virtual timers it can't be the target of INT_TMR_MATCH 2011-01-05 20:32:26 +00:00
James Snyder
a4ae2bf4fb Apply misc fixes to LuaRPC:
- prevent premature helper gc
 - replace some MYASSERT statements with standard Lua functions for arg checking
2010-12-14 01:05:52 +00:00
Dado Sutter
a148d3956e Changing eLua version for the next release (v0.8) 2010-12-11 00:24:17 +00:00
James Snyder
1059c69245 Adjust CAN module to not block when receiving messages. recv
returns nothing (3 params will be nil) if no messages are waiting.
2010-12-06 23:26:29 +00:00
Bogdan Marinescu
ebfd94eb01 linenoise support extended to the eLua shell (it can be enabled separately in platform_conf.h). Documentation updated 2010-11-17 20:21:36 +00:00
Bogdan Marinescu
772b33c975 linenoise support for eLua. linenoise is a readline replacement which makes using the Lua interpreter much easier and also adds support for saving the 'history' of lines types in the interpreter. Documentation updated. Thanks go to James for suggesting this in the first place. 2010-11-16 22:53:06 +00:00
Bogdan Marinescu
aa228cfc7c added const to elua_int_table; added hw_cli/hw_sei in cpu module; various other fixes 2010-11-13 22:36:09 +00:00
Bogdan Marinescu
6302c1524e STR9 backend modified for the new interrupt structure, the STR9 port can now be compiled fine (but the interrupts were not tested on this particular platform) 2010-11-04 22:40:09 +00:00
Bogdan Marinescu
5978c7b680 - Changed interrupt support infrastructure. No docs yet (will be added later), but check src/platform/lpc24xx/platform_int.c for a quick glimpse of the concept.
- Added direct access to interrupt flags; an interrupt doesn't have to trigger a handler anymore, its flag(s) can be checked instead (platform_cpu_get_interrupt_flag).
- Added experimental C interrupt handlers support (NOT TESTED). It can be compiled and used separately from the Lua interrupt support implementation. Hint: src/elua_int.c, elua_int_set_c_handler and elua_int_get_c_handler, also BUILD_C_INT_HANDLERS (as opposed to BUILD_LUA_INT_HANDLERS).
- Added tmr.set_match_int function that sets a match interrupt on a timer (one-shot or cyclic). Also works on virtual timers. In fact, it currently works only on virtual timers, as none of the platforms have support for this operation with hardware timers.
-Added more interrupt support functions in the CPU module.

All of the above were implemented and tested on the ELUA-PUC board, and nothing else. As a side effect, THIS COMMIT BRAKES THE STR912 PORT! The port will be modified to take advantage of the new interrupt structure soon; until then, please don't update it.
2010-11-03 23:57:27 +00:00
Bogdan Marinescu
78cab3b3ad - interrupt support in Lua
- ASM interrupt support for ARM targets which eliminates the need for buggy GCC __attribute__ ((interrupt ("IRQ"))) functions
- code refactoring
2010-09-26 18:54:18 +00:00
Bogdan Marinescu
ae54bffb5d further fix to romfs=compile under Win32 2010-09-15 17:15:43 +00:00
Bogdan Marinescu
6b3f038db3 added support for the I2C interface. UNTESTED, for now enabled only for the STR9 platform. Documentation will follow shortly 2010-07-21 20:21:55 +00:00
James Snyder
851f7c16ba ADC for MBED/LPC1768.
Note: MBED P15->P20 == adc dev ids 0->5
2010-07-12 20:56:54 +00:00
Dado Sutter
68bd22b9f7 - Minor doc editing
- Minor version string format change
- Version string changed "trunk pos0.7"
2010-06-25 18:51:24 +00:00
James Snyder
1667c477cf Basic support for opendir/readdir on mbed to do directory listing. 2010-03-28 04:15:19 +00:00
James Snyder
5f5e01fd3b Add support for Semihosting filesystem operations
- enable file creation, reading, writing on mbed for the built-in filesystem
- implementation currently lacks support for directory listings, this will be
  added when mbed implementation details are available.

Note: this should work with other ARM arm ports that are connected to a JTAG
debugger that implements semihosting, though I have not tested it.
2010-03-08 20:08:07 +00:00
Dado Sutter
a38076bb91 - Added copyright years to shell welcome message
- Project's reference changed to www.eluaproject.org on the same msg
2010-02-23 17:18:06 +00:00
Dado Sutter
15daebf98e - Added a Lua-like first-prompt welcome message to the eLua shell
- Main menu refactored to reduce info levels. Old "tutorials" are now part
of the "More Information" (which already contained tutorials) on eLua
Internals
- Shell help command adapted to rw filesystems addition (ls lists all files
of all filesystems)
- Minor order and name changes on main menu sub-items
- Minor refinements in some doc pages
2010-02-22 20:18:21 +00:00
Bogdan Marinescu
e7702bb0e2 Manual merge of remotefs/ into trunk. Tested with the simulator and (partially) on a ET-STM32 board. Other changes:
- FAT changed to support the new opendir/readdir/closedir mechanism, and to use lseek directly instead of ioctl (also fixed a bug in FAT's lseek that always returned 0 instead of file position).
- ET-STM32 console moved to UART2@19200bps (to allow RFS to run on UART0). If UART0 is needee for console, remember to disable RFS.
- freed 700+ bytes of RAM by changing the devman implementation to keep pointers instead of actual DM_DEVICE structures
- other minor code changes and fixes
2010-02-01 18:47:41 +00:00
James Snyder
0bb6552c73 Additional missing header. 2010-01-27 00:58:08 +00:00
James Snyder
47f9d97079 Missing platform_conf.h. 2010-01-27 00:56:17 +00:00
James Snyder
125af9f8b8 Desktop Builds Get platform_conf.h
luarpc & cross compiler builds now have a platform_conf.h which should help in
keeping ifdefs down in common source files.
2010-01-26 00:23:57 +00:00
James Snyder
8b58611c6b Merge branch 'post07' 2010-01-25 23:44:40 +00:00
James Snyder
51221f8b4c Merge 0.7 changes to trunk. 2010-01-25 23:43:05 +00:00
Bogdan Marinescu
42ec61613b pio.port.setval bugfix (thanks, Teo! :)) 2009-12-16 19:43:34 +00:00
James Snyder
c85e3a1d2d Starting Cleanup of LuaRPC for 0.7 release.
- added some more documentation (not yet done)
- alternate uarts can be selected (boot mode defaults to console uarts)
- renamed "remote" references to "rpc" (may as well keep the original name)
- switch default error handler to luaL_error (presumably wasn't available for
  old 4.x LuaRPC)
- tweaks to exception handling to make things more consistent (hopefully)
2009-12-04 01:46:47 +00:00
James Snyder
d04fb2b2bb Add initial refman entry for can module. 2009-11-14 22:56:23 +00:00
James Snyder
bd1465ca50 Merge 0.6 branch to trunk.
Conflicts:
	SConstruct
	doc/en/arch_platform.html
	doc/en/comunity.html
	doc/en/overview.html
	doc/en/refman.html
	doc/en/refman_gen.html
	doc/en/status.html
	doc/en/tut_bootstick.html
	doc/images/lng_pt.png
	doc/images/minusnode.png
	doc/images/next.png
	doc/images/node.png
	doc/images/nodelast.png
	doc/images/plusnode.png
	doc/images/plusnodelast.png
	doc/images/previous.png
	doc/images/showall.png
	doc/images/sync.png
	doc/images/vertline.png
	doc/pt/arch.html
	doc/pt/arch_coding.html
	doc/pt/arch_con_term.html
	doc/pt/arch_newport.html
	doc/pt/arch_overview.html
	doc/pt/arch_platform.html
	doc/pt/arch_tcpip.html
	doc/pt/building.html
	doc/pt/comunity.html
	doc/pt/dl_binaries.html
	doc/pt/dl_old.html
	doc/pt/dl_sources.html
	doc/pt/downloads.html
	doc/pt/examples.html
	doc/pt/faq.html
	doc/pt/installing_i386.html
	doc/pt/installing_lm3s.html
	doc/pt/news.html
	doc/pt/overview.html
	doc/pt/refman_dep.html
	doc/pt/refman_gen.html
	doc/pt/status.html
	doc/pt/tc_386.html
	doc/pt/toolchains.html
	doc/pt/tut_openocd.html
	doc/pt/using.html
	romfs/LM3S.lua
	romfs/led.lua
	romfs/morse.lua
	romfs/pong.lua
	src/lua/linit.c
	src/modules/auxmods.h
	src/platform/lm3s/platform.c
	src/platform/lm3s/platform_conf.h
	src/platform/sim/platform_conf.h
2009-10-13 02:14:27 +00:00
James Snyder
b1c0df120a Style adjustments, switch some types to be more explicit, common error string
stored once.
2009-09-15 17:44:48 +00:00
James Snyder
9b3db70e72 Fixes:
- anonymous unions aren't part of C99, luaR_key's uinion of key ids is now in
  a union called id
- silence some other compiler complaints
2009-09-06 23:41:31 +00:00
James Snyder
3248f45307 Some cleanup of unused/unnecessary code thanks to Clang/LLVM's static analyzer. 2009-09-06 23:41:21 +00:00
James Snyder
9b2eac34aa Shorten some error messages, slightly tighter memory usage. 2009-08-27 01:13:37 +00:00
James Snyder
907de5b818 Working CAN support for STM32. 2009-06-26 23:38:02 +00:00
James Snyder
8939b99545 Commit of initial working RPC.
- disabled by default (enable on a target-by-target basis) so it shouldn't
  cause much breakage for non-rpc users
- some modifications to the binary chunk reader which should allow reading of
  chunks encoded on various platforms (with certain limitations like lualong
can't read float lua bytecode, one must generate lualong bytecode from a float
lua)
- other misc changes.
2009-06-22 23:49:21 +00:00
James Snyder
bd2e819368 ADC Updated
- adc_wait_samples now returns the actual number of samples available at the
  time it returns.  this simplifies a pattern where one would wait on samples
  if blocking and then subsequently check the number of available samples.
- adc.insertsamples(id, table, idx, count) function now available to take
  samples and insert them into a table.  this is slightly slower than
  assignment for single values in a table, but can avoid having to use
  getsamples (returning new tables) for certain situations
  idx: starting index in table where values will be inserted
  count: number of samples to get from channel id
2009-04-22 15:36:50 +00:00
James Snyder
709399a324 System buffer-free version of ADC should now work. Doing so, saves about 1kb
of flash space.

NOTE: getsamples function is disabled since this is dependant on having a
buffer to get more than one sample.

Side note: single sampling without the buffer is faster by about 5-10
us/channel.  It should be possible to sidestep the buffer in certain
situations for buffer enabled mode and get a similar benefit at the cost of
some additional complexity.
2009-03-25 22:56:39 +00:00
Bogdan Marinescu
9c15d2e4fc - XMODEM and term code moved from main.c to common.c
- added full term support to the i386 platform (I was bored with all the docs ... :) )
- documentation updated
2009-03-23 21:07:49 +00:00
James Snyder
94438ff64b ADC for STM32 + Misc Fixes & Build Adjustments
- ADC adjusted to work with sequenced acquisition setups.  It should now
  accomodate both sequenced and non-sequenced approaches on the backend.
  A few more adjustments should be made to handle multiple sequencers
  but right now neither LM3S or STM32 platforms use more than one sequencer.

- Added adcpoll.lua to demonstrate a simple approach for using clocked
  acquisition and displaying results as they become available.

- ADC now works for STM32 (all 16 channels!). This should receive more
  extensive testing, but everything should be working at this stage.

- the build system now pays attention to changes in header files meaning that
  if any headers change or if the romfs changes (since it is generated as a
  header) these changes will get recompiled without having to do a clean.
2009-03-21 19:59:49 +00:00