write32( address, data ) : write the 32-bit data at the specified address
write16( address, data ) : write the 16-bit data at the specified address
write8( address, data ) : write the
8-bit data at the specified address
Data = read16( address ) : reads 16-bit data from the specified address
Data = read8( address ) : reads 8-bit data from the specified address
[cpu.disableinterrupts()] cli(): disable CPU interrupts
[cpu.enableinterrupts()] sei(): enable CPU interrupts
[cpu.clockfrequency()] Clock = clock(): returns the CPU frequency
Also, you can expose as many CPU constants (for example memory mapped registers)
as you want to this module. You might want to use this feature to access some
CPU memory areas (as defined in the CPU header files from the CPU support
package) directly from Lua. To do this, you'll need to define the
PLATFORM_CPU_CONSTANTS macro in the platform's platform_conf.h file
(src/platform/<platform name>/platform_conf.h). Include all your constants in a
_C( <constant name> ) definition, and then build your project.
For example, let's suppose that your CPU's interrupt controler has 3 memory
mapped registers: INT_REG_ENABLE, INT_REG_DISABLE and INT_REG_MASK. If you want
to access them from Lua, locate the header that defines the values of these
registers (I'll assume its name is "cpu.h") and add these lines to the
platform_conf.h:
#include "cpu.h"
#define PLATFORM_CPU_CONSTANTS\
_C( INT_REG_ENABLE ),\
_C( INT_REG_DISABLE ),\
_C( INT_REG_MASK )
After this you'll be able to access the regs directly from Lua, like this:
data = cpu.r32( cpu.INT_REG_ENABLE )
cpu.w32( cpu.INT_REG_ENABLE, data )
For a "real-life" example, see the src/platform/lm3s/platform_conf.h file.
[uart.sendstring] uart.sendstr( id, str1, str2, ... ): this is similar to "uart.send", but its parameters are string.