1
0
mirror of https://github.com/elua/elua.git synced 2025-01-25 01:02:54 +08:00

1033 Commits

Author SHA1 Message Date
Thiago Naves
53f2267475 Added missing mbed_power.c file 2012-06-28 19:29:56 -03:00
Thiago Naves
87c1a0769f Added Power module to mbed 2012-06-28 19:27:12 -03:00
Thiago Naves
40bc1f52f9 Added formating (strftime) to mbed.rtc.get 2012-06-26 19:45:23 -03:00
Thiago Naves
31f545ae8d Fixed mbed.rtc.set function.
mbed.rtc.setalarm can now receive a partial table too.
2012-06-26 17:05:15 -03:00
Thiago Naves
df14539731 mbed.rtc.set function refactor 2012-06-26 16:40:47 -03:00
Thiago Naves
c3962b30e2 mbed.rtc.set function no longer requires all fields on the table parameter 2012-06-25 21:08:09 -03:00
Thiago Naves
dc52bee359 Fix alarmed and setalarm functions on mbed rtc 2012-06-22 19:00:20 -03:00
Thiago Naves
47e7507cce RTC API changes on MBED 2012-06-22 18:48:14 -03:00
Thiago Naves
5072efc04b Fix RTC alarm on MBED 2012-06-22 18:11:14 -03:00
Thiago Naves
bb5619ba68 Undo accidental changes to lpc17xx timer lib 2012-06-22 18:10:23 -03:00
Thiago Naves
5a89993ceb RTC API refactor (alarm broken) 2012-06-14 19:56:50 -03:00
Thiago Naves
a7b3e3a7c7 Timer Match interrupts now working on MBED 2012-06-14 17:22:40 -03:00
Thiago Naves
ed9085549b First MBED timer match implementation (not done yet) 2012-06-12 19:10:02 -03:00
Thiago Naves
5e8dd874ad Added RTC module to MBED.
Added RTC alarm interrupt to MBED.
2012-06-05 18:21:28 -03:00
Thiago Naves
b1d5bbae36 Merge branch 'master' of https://github.com/elua/elua 2012-06-01 19:11:06 -03:00
Bogdan Marinescu
2658f7cf77 Fixed timer counting direction on all platforms
On some platforms, the hardware timers were counting down instead
of up, which broke the assumptions of the new timer implementation.
Fixed by inverting the timer value (relative to its maximum value).
2012-05-26 00:45:18 +03:00
Bogdan Marinescu
d54659b572 RAM optimizations: pseudo RO strings, functions in Flash
This patch adds more RAM optimizations to eLua:

- direct file memory mapping: files in ROMFS will be read directly from Flash,
  without allocating any additional buffers. This doesn't help with RAM
  consumption in itself, but enables the set of optimizations below.

- pseudo read-only strings. These are still TStrings, but the actual string
  content can point directly to Flash. Original Lua strings are kept in
  TStrings structures (lobject.h):

  typedef union TString {
    L_Umaxalign dummy;  /* ensures maximum alignment for strings */
    struct {
      CommonHeader;
      lu_byte reserved;
      unsigned int hash;
      size_t len;
    } tsv;
  } TString;

  The actual string content comes right after the union TString above.
  Pseudo RO strings have the same header, but instead of having the string
  content after TString, they have a pointer that points to the actual
  string content (which should exist in a RO memory (Flash) that is directly
  accesbile from the MCU bus (like its internal Flash memory)). lua_newlstr
  detects automatically if it should create a regular string or a pseudo RO
  string by checking if the string pointer comes from the Flash region of the
  MCU. This optimization works for both precompiled (.lc) files that exist in
  ROMFS and for internal Lua strings (C code).

- functions in Flash: for precompiled (.lc) files that exist in ROMFS, the code
  of the functions and a part of the debug information will be read directly
  from Flash.

- ROMFS was changed to support files that are larger than 2**16 bytes and it
  aligns all its files to an offset which is a multiple of 4 in order to prevent
  data alignment issues with precompiled Lua code.

- the Lua bytecode dumper was changed to align all the instructions in a Lua
  function and a part of the debug information to an offset which is a multiple
  of 4. This might slightly increase the size of the precompiled Lua file.

These changes were succesfully checked against the Lua 5.1 test suite.
These changes were tested in eLua on LM3S and AVR32.
2012-05-10 00:39:42 +03:00
Sokolov Yura
1a5b04e2c3 NaN packing for TValues
From the Lua Power Patches page:

"Use NaN packing for TValue on x86 to reduce memory usage
and tiny performance gain (same as in LuaJIT i2).
It's fully ABI compatible with standard Lua libraries.
On one test script memory consumption reduced from 28Mb
to 21Mb and performance improved about 3.5-5%"

Added support for big endian architectures and LTR compatibility.
2012-04-19 00:04:10 +03:00
Yuki Tamura
c8b89a46d9 Fix possible Lua stack corruption issue
luaD_checkstack could damage the stack, possibly making further
references to 'func' invalid. Fix this by using the information
inside the CallInfo structure instead of 'func'.
2012-04-19 00:01:47 +03:00
James Snyder
fbebb2949e Correct issues with remote indexing and catch incorrect calls for LuaRPC
helper_remote_index() contained an error which allowed for incorrect
calculation of the string length to be sent. This should now be
fixed. Additionally, read_cmd_call() did not check whether indexing
was successful at each step, we now check whether the indexed result
is callable or a table and attempt to provide an indication of the
type of error made by the user.
2012-03-26 20:56:12 -05:00
James Snyder
7771e05fb2 clean up trailing whitespace 2012-03-26 19:17:40 -05:00
Martin Guy
59f9a2616b Added documentation file for mizar32 rtc module
Forgot to git-add it in the previous commit. Oops.
2012-03-25 13:43:53 +02:00
Thiago Naves
edf5b7a5ff Merge pull request #10 from mwilbur/rpc-client
Fix CR->NL and NL->CR transations on linux
2012-03-22 12:11:59 -07:00
Matt Wilbur
800a94db16 Fix CR->NL and NL->CR transations on linux 2012-03-22 10:12:51 -04:00
Martin Guy
6dd64a0dc6 New mizar32.rtc platform module
Methods: mizar32.rtc.get() returns a table like Lua's os.date()
and os.time() with fields year, monthm day, wday, hour min, sec
and mizar32.rtc.set() takes a similar table, only changing the
fields that are present in the table.
Works with DS1337 and PCF8563 clock chips.
2012-03-19 23:49:39 +01:00
Martin Guy
939cdbc3fd Convert AVR32 i2c_{send,recv} to take 7-bit addresses 2012-03-19 15:01:59 +01:00
Martin Guy
42af821686 AVR32 bugfix: Include usb-cdc.c in the Lua build system too. 2012-03-19 14:16:58 +01:00
Martin Guy
976d0f5111 Refactor AVR32 I2C code to have I2C packet-level send() and recv() routines
This introduces i2c_send() and i2c_recv in the AVR32 code that send/receive
whole I2C messages from start to optional stop.
2012-03-19 12:45:59 +01:00
Martin Guy
8b0bb4bbb9 Ensure Mizar32 i2c pins are initialized if i2c.setup() is not called 2012-03-19 12:12:29 +01:00
Martin Guy
374a21f15e Bug fix: always return 0 from Lua functions
Many mizar32.lcd() Lua functions used to tail-call the i2c_send_command()
functions, whereas they should explicitly return 0, the number of return
values from the Lua function. OK, i2c_send_command did return 0 but this
will change in future when it can detect slave presence and collisions.
2012-03-19 11:45:00 +01:00
Martin Guy
49ab7be03e Fix typo in docs 2012-03-15 09:20:57 +01:00
Martin Guy
5b141dd63b .gitignore: Ignore auto-generated file inc/git_version.h 2012-03-15 09:19:44 +01:00
Martin Guy
27da495151 Document pio.decode() 2012-03-08 21:23:13 +01:00
Martin Guy
ff2ba18585 Fix typos in PIO refman 2012-03-08 20:47:26 +01:00
Martin Guy
f9c3f2bf1c AVR32: In pio.decode(), reverse the mapping of hardware pins to PX names
On AVR32UC3A0 parts, the GPIO pins are named PA0-31, PB0-31, PC0-5 and
PX0-39. There is no port X: these pins map to five backwards ranges of
bits in the third and fourth sets of GPIO registers (where PC0-5 are
the first six of the third register set).
Already we map pio.PX_nn names to these values, and this commit puts the
reverse mapping into place in pio.decode().

Test program to verify correct mapping:

function eval(s)
  return( loadstring( "return(" .. s .. ")" ) )()
end

for i=0,39 do
  name = "pio.PX_" .. tostring(i)
  gpio = eval(name)
  print( name, gpio, pio.decode(gpio) )
end
2012-03-08 20:36:35 +01:00
James Snyder
f3e0620c98 Merge branch 'include_git_rev' 2012-03-08 12:07:56 -06:00
Martin Guy
90897d2d02 Save 4 bytes RAM per structure by reordering struct members
Structure size is 12 byte instead of 16 with GCC on x86,
probably also on others.
2012-02-26 04:14:53 +01:00
Martin Guy
55b78b50ac Build system changes to allow building with UIP_CONF_IPV6
These changes allow you to "#define UIP_CONF_IPV6 1" in uip-conf.h
for an IPV6-capable network layer.
This also removes a pointless inclusion in avr32/uip-conf.h
The changes to the other three .c files (from "build.h" to "platform_conf.h")
are just orthogonal future-proofing.
2012-02-19 18:25:37 +01:00
Martin Guy
35861a2d3d Restore original licence on uip-conf.h
Luminary Micros replaced the original permissive Swedish Institute
of Computer Science licence with their own one restricting it to
use on LM devices only. This put the original license back.
See http://uip-stack.cvs.sourceforge.net/viewvc/uip-stack/uip/unix/uip-conf.h
2012-02-19 18:05:52 +01:00
Martin Guy
37bc042bda Fix indentation 2012-02-19 11:35:59 +01:00
Martin Guy
406cfac9c9 AVR32: Defer SPI clock setup to when platform_spi_setup() is called
This change defers enabling the SPI clocks to platform_spi_setup()
so that, if SPI ports are not used and BUILD_MMCFS is disabled,
power consumption is reduced.
2012-02-19 10:35:11 +01:00
Martin Guy
1f94b2fab4 Remove unused declaration for a nonexistent function 2012-02-19 09:19:31 +01:00
Martin Guy
d2f5032d63 Remove uart.SYS_TIMER and net.SYS_TIMER (use tmr.SYS_TIMER)
This change removes the extra undocumented uart.SYS_TIMER and
net.SYS_TIMER constants, which are equal to tmr.SYS_TIMER.
The documentation says to use tmr.SYS_TIMER and in the rare case
of uart or net being compiled in but not tmr, the system timer
can be had by using nil or omitting the parameter.
2012-02-18 14:40:50 +01:00
Thiago Naves
c071c3c62b Code cleanup 2012-02-10 18:21:09 -02:00
Thiago Naves
43d31b99ae Started working on RTC module for str9 ( alarm interrupt not working yet ) 2012-02-10 17:03:17 -02:00
James Snyder
28d44765c3 Merge branch 'master' into newsite 2012-02-07 15:01:54 -06:00
Martin Guy
6ed4b5208e Another fix in the CRLF handler: don't drop the second one of repeated
newline characters.

The console used to drop the second one of repeated \r or \n characters
because it would stash the second one in std_prev_char, then at the start
of the next call to std_read(), would poke the \r into the start of the
line buffer, returning a line that began with \r or \n.
This change processes the lookahead character the same as regular ones.
2012-02-07 12:55:14 +01:00
Martin Guy
640f9b970e Echo the lookahead character on console input
Previously, when pasting multiple lines into the console, the first
character of half the lines would not be echoed.  This was due to it being
slurped up by the CRLF lookahead detector, but not being echoed when it was
regurgitated. This change fixes that.
2012-02-07 12:34:05 +01:00
Martin Guy
c819565ebb Add missing constant uart.FLOW_NONE when optram==0
and reorder the optram=0 constants to match the optram>0 ones so that
it is more obvious to the eye whether they correspond or not.
2012-02-05 10:24:45 +01:00
Martin Guy
be9c9e46a7 Fix removal of UART buffer with uart.set_buffer(id, 0)
Previously, if you removed a buffer from e uart, the buffer was
removed but the interrupt routine was left intalled, which made
the interpreter hang if you typed a character on the serial port.
Now you can enable and disable UART buffers.

This also changes the order of interrupt handler to
- install the handler
- enable the interrupt
instead of the other way round, so there is no window of time with the
interrupt enabled but no handler installed.
2012-02-01 21:33:22 +01:00