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

986 Commits

Author SHA1 Message Date
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
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
Martin Guy
005d783c14 Bug fix: Allow more than one call to uart.set_buffer()
Previously, every call except the first one to uart.set_buffer()
with a buffer size > 0 would fail, as platform_cpu_set_int() returns
whether it used to be enabled or not, which is 0 the first time
(which happens to == PLATFORM_INT_OK) but 1 every time after that.
This change makes 0 and 1 success; all failure values are negative
so that people can now change UART buffer sizes.
2012-02-01 21:19:27 +01:00
Martin Guy
fe8b1d8630 Rework Mizar32 config so that UART buffering is still available
The usb-cdc config removed UART buffering completely, whereas
it should still be available via uart.set_buffer().
2012-02-01 18:56:33 +01:00
Martin Guy
a2c22b0aac Make compilation of usb-cdc.c conditional on BUILD_USB_CDC
...instead of compiling it and having the linker drop the unused symbols.
2012-02-01 18:40:08 +01:00
Martin Guy
cd81e0d3dd avr32 usb-cdc cleanup: remove tabs and ^Ms and add Atmel copyright 2012-02-01 18:28:13 +01:00
Martin Guy
3e48d16846 AVR32 bugfix: pwm.setclock() used to stop the system timer.
Now that the system timer uses PWM clock B, the pwm setclock() code
needs to read-modify-write the mode register instead of just setting it.
The most obvious symptom was that after a call to pwm.setclock() you
needed to press enter twice to get a new Lua prompt instead of once.
2012-02-01 15:26:23 +01:00
Martin Guy
d19bb6537a Fix typo in commentary 2012-02-01 15:05:22 +01:00
Martin Guy
ca12cd69e3 Drop outdated commentary 2012-01-30 17:18:18 +01:00
James Snyder
f045668c61 Merge pull request #8 from elua/avr32_usbcdc
This patch adds support for the USB-CDC (UART on USB) for avr32.
2012-01-29 11:16:56 -08:00
Nuccio Raciti
4a67f9dd5c This patch adds support for the USB-CDC (UART on USB)
for avr32.
It was tested *only* on a Mizar32 board.

Signed-off-by: Nuccio Raciti <raciti.nuccio@gmail.com>
2012-01-27 21:34:05 +01:00
Martin Guy
ac7677284e Mizar32: Disable FOSC32 again, which doesn't work in the hardware 2012-01-23 14:29:26 +01:00
Martin Guy
3e1398e987 Add math.pow() to integer version of math library
An integer version of the power function exists anyway for the ^ operator,
so create a binding to its synonym in the math library when LUA_NUMBER_INTEGRAL
2012-01-23 13:22:06 +01:00
Martin Guy
b72f620aed Fix to previous commit: unsigned values never look negative! 2012-01-21 20:00:34 +01:00
Martin Guy
84a17973fb Merge branch 'master' of github.com:elua/elua 2012-01-21 19:32:37 +01:00
Martin Guy
0e09fd9006 Reject negative frequency values in adc.setclock() 2012-01-21 19:30:31 +01:00
Bogdan Marinescu
6f93ebdd29 Merge branch 'master' of github.com:elua/elua 2012-01-21 17:33:08 +02:00
Martin Guy
69eb5cc478 Put the order of timer parameters back to what it used to be
This patch undoes the change in the order of timer parameters for:
net.accept() net.recv() tmr.delay() tmr.setclock() tmr.set_match_int()
tmr.gettimediff()  and also changes the new tmr.getdiffnow() to have the
same parameter ordering as the others.
The default timer ID (the systimer), which previously was obtained with an
optional last parameter, is now obtained by supplying nil as the timer ID.
2012-01-21 17:30:38 +02:00
Martin Guy
b95ec14fa9 Reconfigure Mizar32 for product launch
The product launch configs are to have the eLua shell only in the
larger models and as many basic modules as will fit in the 128K version
2012-01-21 15:16:30 +01:00
Martin Guy
3f48d87780 Fix compiler warning about pointer signedness 2012-01-21 14:01:25 +01:00
Martin Guy
d0ac60c65b AVR32 config changes fot default CPU, allocator and memory use
Changes the default Mizar32 CPU to the 256K model,
the default allocator for the 128K Mizar32 to simple (the smallest)
the default allocator for other Mizar32s to multiple to avoid newlib's
  dlmalloc bug
and only use one memory region on AVR32 platforms when newlib or simple
  for the same newlib dlmalloc bug and because simple can only handle
  one region
2012-01-21 12:24:35 +01:00
Martin Guy
34c634dbf7 AVR32: Configure ADC within spec and at optimal values
The previous Atmel code didn't set the PRESCAL filend, so overclocked
the ADC at 7.5Mhz or 8.25Mhz (according to PBA_FREQ) instead of the
maximum of 5MHz for 10-bit conversions and 8MHz for 8-bit.
It also set the sample-hold and startup times to their maxima instead
of just within spec.

This change calculates the optimal in-spec values for these fields,
also improving the maximum sampling rate, from 64ks/sec to 71ks/sec
and is preparatory work for being able to set the sampling rate.

Tested on Mizar32 and EVK1100
2012-01-21 09:41:54 +01:00
James Snyder
d608453878 Apply strexh/strexb fix to lpc17xx as well 2012-01-20 17:20:51 -06:00
James Snyder
879642e1e1 Workaround for strexh/strexb same register error: http://lists.gnu.org/archive/html/bug-binutils/2011-12/msg00112.html 2012-01-18 19:01:43 -06:00
Martin Guy
a77fc80604 Tiny optimization in AVR32 UART code
The values for the stopbit defines happen to be the same in eLua
headers and avr32 headers, so check for this and when true replace
a no-op switch statement with an =
2012-01-17 11:58:04 +01:00
Martin Guy
c8a82fa8bf Include 32768Hz crystal on Mizar32 - now it will be there. 2012-01-16 10:14:16 +01:00
Martin Guy
98d85709a9 Mizar32 conf: enable DHCP client by default 2012-01-16 07:00:07 +01:00
Martin Guy
dbf721b0cd jaFix typo in previous commit 2012-01-15 14:01:21 +01:00
Martin Guy
4019718521 AVR32: Move virtual timer channel definition to platform conf file
Instead of defining the virtual timer channel twice in two .c files,
define it once in each board's platform_conf.h file. Although all the
currently-supported UC3 parts (A & B) have 3 timers, the UC3C parts have 6.
2012-01-15 08:00:19 +01:00
Martin Guy
a5a20783a9 Fix tmr.getmaxdelay() with virtual and system timers when LUA_NUMBER_INTEGRAL
tmr.getmaxdelay() used to return -1 for the system timer and -2 for
virtual timers in the integer build due to Lua integers being signed.
This makes them return 2147483647 and 2147483646 resectively.
2012-01-15 06:37:13 +01:00
Martin Guy
ffe0338b89 Fix commentary in previous commit
The new AVR32 delay code doesn't just handle up to 30 second delays;
it handles the whole range.
2012-01-02 14:26:29 +01:00
Martin Guy
89b78f288a Fix random 60-second pause bug in AVR32 I2C code
The I2C delay routine would very occasionally pause execution for
60 seconds then continue. This was due to an Atmel delay routine
that claimed to handle the 32-bit counter register overflowing
but didn't. Specifically, in the old code, when delay_end_cycle was
very close to 2^32, the counter register could wrap to 0 before it
was compared for being > delay_end_cycle, resulting in a 2^32-cycle
pause, about a minute.  If the end_cycle were exactly 2^32-1,
the delay might have takes several minute-long cycles to finish.

This commit also fixes the bug in the SDRAM init code where the
delay code was copied from. In that case the odds of the bug biting
were very small indeed, since it was immediately after system startup
and in SDRAM init code there are no interrupt routines running.
However, the correct code is also shorter.
2012-01-01 22:52:31 +01:00
Robert G. Jakabosky
6d26eed80f Update EGC to r6 from r4 2011-12-28 18:05:48 -06:00
Martin Guy
c9c4311f15 Apply fix to Lua 5.1.4 bug #11
See http://www.lua.org/bugs.html -> Lua 5.1.4 -> bug 11
"Parser may collect a prototype while building it."
2011-12-18 18:36:36 +01:00
Martin Guy
e7ec5a84fd Apply fix to Lua 5.1.4 bug #10
See http://www.lua.org/bugs.html -> Lua 5.1.4 -> bug 10
Repeat-by:
  meta={}
  setmetatable(meta, meta)
  meta.__newindex = function(t, key, value) print("set") end
  o = setmetatable({}, meta)
  o.x = 10    -- should print 'set'
Lua 5.1.4 fix adapted to eLua's rotable mods
2011-12-18 18:31:04 +01:00
Bogdan Marinescu
e823c8d3fc RFS server fix for serial connections
On Linux, the serial connection was not setup properly, which led to
weird errors in the RFS server. This fix disables any input processing
in the termios layer, thus fixing the problem. Thanks to Markus Korber
for reporting and fixing the issue.
2011-12-17 17:17:46 +02:00
Bogdan Marinescu
a0ecdc124b RFS server fix
Read from the UART file descriptor until no data can be read
anymore (POSIX only). This is needed because sometimes the
RFS server didn't read all the available data and signaled errors.
2011-12-15 23:35:17 +02:00
Martin Guy
3195763d16 Fix typo in tmr doc 2011-12-11 18:19:49 +01:00
Martin Guy
ddcec49ae1 Drop timer support in Mizar32 128k default build to that the image fits.
The default config for the 128K Mizar32 board no longer fitted into the
available 129KB of flash. This drops the timer modules so that it does.
2011-12-11 17:34:26 +01:00
Martin Guy
2f560fb16b Fix compilation error when optram=0
This commit fixes
src/modules/tmr.c:203: warning: implicit declaration of function 'LNUMVAL'
src/modules/tmr.c:203: error: initializer element is not constant
src/modules/tmr.c:203: error: (near initialization for 'tmr_map[11].func')
due to missing #if LUA_OPTIMIZE_MEMORY > 0
2011-12-11 17:19:24 +01:00
Martin Guy
bbd7c635b9 AVR32 platform: Replace literal constant with its symbolic name
Numer of hardware timer IDs is available as a symbolic constant
on AVR32. This uses it instead of a literal "3".
2011-12-11 14:38:52 +01:00
Martin Guy
3b5fd90fb2 Move saving of old LCD cursor position to after the arg checking. 2011-12-10 18:15:02 +01:00
Martin Guy
8e3e4a634b optimize LCD reset code, as it is now a single command 2011-12-10 18:03:42 +01:00
Martin Guy
fb1d9c464c For new LCD firmware, drop need to limit data to 31 bytes
The previous Mizar32 LCD firmware had a limit of 31 bytes per
data message, while the new has no limit. This commit drops the
code that used to split long data transfers into 31-byte chunks.
2011-12-10 17:51:03 +01:00