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

867 Commits

Author SHA1 Message Date
Bogdan Marinescu
cd530f9640 AVR32 INT_TMR_MATCH fix
Actually disable the timer match interrupt for the non-cyclic mode.
2011-11-10 13:03:57 +02:00
Bogdan Marinescu
d4f03efb96 timer interrupt support for AVR32 2011-11-10 02:27:44 +02:00
Bogdan Marinescu
b79a1d4ead fix invalid argument matching in tmr.set_match_int 2011-11-10 02:25:55 +02:00
James Snyder
8c0f82198f Fix CRLF 2011-10-24 19:11:35 -05:00
Martin Guy
6c655e6e57 Raise Mizar32 CPU freq from 60 to 66MHz and PBA from 15 to 16.5
All derived frequencies (sdram, USB, tmr, VTMRs, SPI, UARTs, PWM, MMC,
and ethernet) compensate correctly for the different PBA freq and
tmr.getmaxdelay() is still just over 0.5 sec (by a hair!).
This may work for EVK110X too - the reason they chose 60MHz is unknown.
2011-10-22 20:01:03 +02:00
Martin Guy
c36309d185 Remove unused variable 2011-10-22 19:38:37 +02:00
Martin Guy
024efa7485 Fix AVR32 SPI initialization
This fixes the following AVR32 SPI clock setting bugs:
- it used to set the SPI frequency at a quarter of what you asked for
  (by calculating it from the wrong clock)
- it did not report what actual frequency it had set
- spi.setup() always seemed to succeed even if it failed
- it used to set the nearest frequency instead of the next lowest available
  so half the time would drive devices at higher than their maximum speed.
  This was hidden by it always setting a quarter of what you asked for (!)
- it would set a junk frequency if you asked for a clock lower than its minimum
- asking for a baud rate of zero made it divide by zero, which went undetected
  and set a random baud rate instead of the minimum available
- Now, if you ask for an invalid number of data bits (< 8 or > 16),
  spi.setup() returns zero.
  This is still wrong and undocumented.
  It should give an error message in platform-independent spi_setup() and stop
  but unfortunately the current code structure does not allow this, since the
  possible numbers of data bits is platform-specific.
2011-10-22 19:20:19 +02:00
Martin Guy
ced77664e9 Revert "Pass the right clock to spi_initMaster() - PBA freq not CPU freq"
This reverts commit 3bdb0c9c93a9b54b29517be41e4c93538c45b40f.
which stopped the MMC card working on Mizar32.
2011-10-22 17:00:31 +02:00
James Snyder
b7b6a6e7eb Add build-time check for system timer for MMCFS 2011-10-21 18:15:14 -05:00
James Snyder
c4f7fe94c1 Adjust MMCFS to use the system timer 2011-10-21 18:08:43 -05:00
Bogdan Marinescu
4ddaf0ab77 merge newtimers into master 2011-10-21 21:30:23 +03:00
Bogdan Marinescu
1486c51508 started to update CHANGELOG for the new release 2011-10-21 21:22:16 +03:00
Bogdan Marinescu
c98474e357 added per platform information about system timer support 2011-10-21 21:17:55 +03:00
Martin Guy
854e4f5cfa aAdd commentary about second use of CPU_FREQUENCY macro 2011-10-21 16:12:23 +02:00
Martin Guy
3bdb0c9c93 Pass the right clock to spi_initMaster() - PBA freq not CPU freq
The AVR32 SPI setup code passed the wrong clock to the SDK's SPI
init function. The result should have been that it set one quarter
of the required frequency.
This change is "obvious" but untested, since the spi.*() module
interface seems not to work yet on AVR32. The MMC card on SPI1
continues to work as it did before, presumably at full speed
instead of quarter speed.
2011-10-21 16:04:15 +02:00
Bogdan Marinescu
43f0f2711e updated information about the new 'lualonglong' mode 2011-10-21 15:39:44 +03:00
Bogdan Marinescu
93fdf7b4a6 updated information about default timer IDs 2011-10-21 15:18:10 +03:00
Bogdan Marinescu
c193777755 fixed documentation of the UART platform interface 2011-10-21 11:55:00 +03:00
Bogdan Marinescu
0e9a3c3043 fixed documentation for 'uart' and 'net' 2011-10-19 22:58:40 +03:00
Bogdan Marinescu
43724385b3 finished documenting the timer platform interface and the 'tmr' module 2011-10-19 15:09:59 +03:00
Bogdan Marinescu
6525e39960 start to document the changes 2011-10-19 00:57:33 +03:00
Bogdan Marinescu
447c98a233 added more timeout related constants to the 'net' module 2011-10-19 00:57:20 +03:00
Bogdan Marinescu
f17b2a3bb2 Lua long long preliminary support 2011-10-18 15:52:37 +03:00
Martin Guy
66798da84b Fix PWM clock select commentary 2011-10-14 13:28:12 +02:00
Bogdan Marinescu
c9127c8893 another timeout type fix 2011-10-14 14:21:16 +03:00
Bogdan Marinescu
537cf8da51 added the system timer as an explicit constant in a few modules 2011-10-14 00:07:16 +03:00
Bogdan Marinescu
b12ba2194e added new convenience function to the timer module 2011-10-13 14:22:27 +03:00
Bogdan Marinescu
a46cc203c8 fix timeout data type in the RFS implementation 2011-10-13 14:12:05 +03:00
Bogdan Marinescu
1a1ae155c9 RFS_TIMER_ID now defaults to the system timer on supported platforms 2011-10-13 13:42:49 +03:00
Bogdan Marinescu
55e0b9ec9e RPC_TIMER_ID now defaults to the system timer on supported platforms 2011-10-13 13:37:46 +03:00
Bogdan Marinescu
77d543c53a fixed STR9 systimer implementation (tested) 2011-10-12 01:31:29 +03:00
Bogdan Marinescu
cc99b2d7a2 added missing operations for some platforms 2011-10-11 17:31:59 +03:00
Bogdan Marinescu
72080c34fc system timer support for STR9 (not yet tested) 2011-10-11 17:28:41 +03:00
Bogdan Marinescu
17684b1da2 Fix compilation errors for platform that won't get a system timer
There are some platform that will not get a system timer implementation
(mainly because they don't really have a user base). These are i386,
lpc288x and str7. They will continue to work without a system timer.
2011-10-11 15:45:56 +03:00
Bogdan Marinescu
026f72dd46 System timer support is now optional
Since the system timer might be too demanding for some platforms
(although this isn't currently the case for any eLua plarform) it
is now optional. Any platform that implements it must define the
PLATFORM_HAS_SYSTIMER macro in its platform_conf.h
2011-10-11 13:59:02 +03:00
Bogdan Marinescu
acba13b16f systimer support for LPC24xx 2011-10-11 01:41:14 +03:00
Bogdan Marinescu
b1b82b127e Change systimer overflow handling from timer stop to interrupt disable
When a systimer timer overflow is detected, handle it by temporarily disabling
the systimer interrupt rather than disabling the systimer completely. It gives
better accuracy and fixes some hardware-related issues on some platforms.
2011-10-11 00:44:06 +03:00
Martin Guy
8fe7d5ca9a Fix bug in AVR32 ADC code: reading write-only register adc->chdr 2011-10-10 04:23:19 +02:00
James Snyder
eea769be29 Initial fix for AVR32 ADC sequencer issues 2011-10-09 19:06:59 -05:00
Bogdan Marinescu
94cd84a5b6 added systimer support for AT91SAM7X 2011-10-10 01:24:29 +03:00
Bogdan Marinescu
7f94e898e1 Added a function to directly specify the interrupt period 2011-10-10 01:22:56 +03:00
Martin Guy
25a517d66a Fix two bugs in AVR32 PWM code
- Very low frequencies with very high clock rates (ratio > 1048576)
  selected random requencies (overflow of 20-bit period register was
  not checked

- initialization of prescaler selector to 0 was missing.
  It just happened to get 0 off the stack every time by chance (!).
2011-10-09 21:14:13 +02:00
Martin Guy
06f73e485c Add checks for invalid parameters in Lua i2c.*() and pwm.*() functions
Instead of "correcting" or ignoring bad parameter values in i2c and pwm
(see commit e6b20231b4eea4054070b1f6a4e36216e80d2d1d)
apply the eLua policy of signalling the error on the console and aborting.

All "clock" and "frequency" errors here use the same message ("frequency")
so as to reduce the firmware bloat from extra message strings.
2011-10-09 19:45:45 +02:00
Bogdan Marinescu
bed235ccdd AVR32 system timer implementation 2011-10-09 20:42:03 +03:00
Bogdan Marinescu
356e683e3a fixed invalid platform_timer_read call 2011-10-09 19:48:37 +03:00
Bogdan Marinescu
720d62909e new timer convenience function 2011-10-09 19:41:30 +03:00
Bogdan Marinescu
a9e69c72d4 Update net module with the new timer infrastructure
- change timeouts in elua_uip.c to the timer data type
- make all timer IDs in the net module default to the system timer
2011-10-08 23:24:19 +03:00
Bogdan Marinescu
57b27d05fb System timer support - WIP
1. System timer support for MBED using the Cortex M3 SysTick interrupt
2. Bugfix in the generic system timer implementation
2011-10-08 22:02:41 +03:00
Bogdan Marinescu
9ded6db852 Implementing system timer capabilities
- the infinite timeout value is again represented by a special value
  (not a special timer ID), but this time it's a non-negative value
- all timers in the UART module default to the system timer
- all timers in the TMR module default to the system timer
- implemented a generic system timer mechanism that can be used in
  conjunction with a timer interrupt.
- implemented system timers on LM3S (tested) and STM32 (not tested).
  Both are based on the Cortex M3 SysTick timer.
2011-10-08 20:07:14 +03:00
Martin Guy
b3db818b97 Fix AVR32 PWM rturning -1 for very large values of frequency
Previously, if you set a frequency value ten times the PWM clock
frequency, it would calculate a period of 0 and return foo/0, which
gives -1 on AVR32.  With this change, everything > pwmclk sets and
returns a frequency of pwmclk.
2011-10-08 03:17:10 +02:00