mirror of
https://github.com/elua/elua.git
synced 2025-01-08 20:56:17 +08:00
bd1465ca50
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
199 lines
6.3 KiB
Lua
199 lines
6.3 KiB
Lua
-- eLua reference manual - CPU module
|
|
|
|
data_en =
|
|
{
|
|
|
|
-- Title
|
|
title = "eLua reference manual - CPU module",
|
|
|
|
-- Menu name
|
|
menu_name = "cpu",
|
|
|
|
-- Overview
|
|
overview = [[This module deals with low-level access to CPU (and related modules) functionality, such as reading and writing memory, or
|
|
enabling and disabling interrupts. It also offers access to platform specific CPU-related constants using a special macro defined in the
|
|
platform's $platform_conf.h$ file, as exaplained @#cpu_constants@here@.]],
|
|
|
|
-- Data structures, constants and types
|
|
structures =
|
|
{
|
|
{ text = [[cpu.INT_GPIOA
|
|
cpu.INT_GPIOB
|
|
.............
|
|
cpu.INT_UDMA]],
|
|
name = "CPU constants",
|
|
desc = [[eLua has a mechanism that lets the user export an unlimited number of constants to the $cpu$ module. Although in theory any kind of constant can be exposed by this module,
|
|
one should only use constants related to the CPU and its subsystems (as shown above, where a number of CPU specific interrupt masks are exposed to Lua using this mechanism). To use this
|
|
mechanism, just declare the $PLATFORM_CPU_CONSTANTS$ macro in your platform's $platform_conf.h$ file and list all your constants as part of this macro, each enclosed in a special macro called
|
|
$_C$. For example, to get the constants listed above declare your $PLATFORM_CPU_CONSTANTS$ macro like this:</p>
|
|
~#define PLATFORM_CPU_CONSTANTS\
|
|
_C( INT_GPIOA ),\
|
|
_C( INT_GPIOB ),\
|
|
.................
|
|
_C( INT_UDMA )~
|
|
<p>It's worth to note that adding more constants does not increas RAM usage, only Flash usage, so you can expose as much constants as you need without worrying about RAM consumption.]]
|
|
},
|
|
},
|
|
|
|
-- Functions
|
|
funcs =
|
|
{
|
|
{ sig = "#cpu.w32#( address, data )",
|
|
desc = "Writes a 32-bit word to memory.",
|
|
args =
|
|
{
|
|
"$address$ - the memory address.",
|
|
"$data$ - the 32-bit data to write."
|
|
},
|
|
},
|
|
|
|
{ sig = "data = #cpu.r32#( address )",
|
|
desc = "Read a 32-bit word from memory.",
|
|
args = "$address$ - the memory address.",
|
|
ret = "$data$ - the 32-bit word read from memory."
|
|
},
|
|
|
|
{ sig = "#cpu.w16#( address, data )",
|
|
desc = "Writes a 16-bit word to memory.",
|
|
args =
|
|
{
|
|
"$address$ - the memory address.",
|
|
"$data$ - the 16-bit data to write."
|
|
},
|
|
},
|
|
|
|
{ sig = "data = #cpu.r16#( address )",
|
|
desc = "Reads a 16-bit word from memory.",
|
|
args = "$address$ - the memory address.",
|
|
ret = "$data$ - the 16-bit word read from memory."
|
|
},
|
|
|
|
{ sig = "#cpu.w8#( address, data )",
|
|
desc = "Writes a byte to memory.",
|
|
args =
|
|
{
|
|
"$address$ - the memory address.",
|
|
"$data$ - the byte to write."
|
|
}
|
|
},
|
|
|
|
{ sig = "data = #cpu.r8#( address )",
|
|
desc = "Reads a byte from memory.",
|
|
args = "$address$ - the memory address",
|
|
ret = "$data$ - the byte read from memory."
|
|
},
|
|
|
|
{ sig = "#cpu.cli#()",
|
|
desc = "Disable CPU interrupts."
|
|
},
|
|
|
|
{ sig = "#cpu.sei#()",
|
|
desc = "Enable CPU interrupts."
|
|
},
|
|
|
|
{ sig = "clock = #cpu.clock#()",
|
|
desc = "Get the CPU core frequency.",
|
|
ret = "$clock$ - the CPU clock (in Hertz)."
|
|
}
|
|
},
|
|
}
|
|
|
|
data_pt =
|
|
{
|
|
|
|
-- Title
|
|
title = "eLua reference manual - CPU module",
|
|
|
|
-- Menu name
|
|
menu_name = "cpu",
|
|
|
|
-- Overview
|
|
overview = [[This module deals with low-level access to CPU (and related modules) functionality, such as reading and writing memory, or
|
|
enabling and disabling interrupts. It also offers access to platform specific CPU-related constants using a special macro defined in the
|
|
platform's $platform_conf.h$ file, as exaplained @#cpu_constants@here@.]],
|
|
|
|
-- Data structures, constants and types
|
|
structures =
|
|
{
|
|
{ text = [[cpu.INT_GPIOA
|
|
cpu.INT_GPIOB
|
|
.............
|
|
cpu.INT_UDMA]],
|
|
name = "CPU constants",
|
|
desc = [[eLua has a mechanism that lets the user export an unlimited number of constants to the $cpu$ module. Although in theory any kind of constant can be exposed by this module,
|
|
one should only use constants related to the CPU and its subsystems (as shown above, where a number of CPU specific interrupt masks are exposed to Lua using this mechanism). To use this
|
|
mechanism, just declare the $PLATFORM_CPU_CONSTANTS$ macro in your platform's $platform_conf.h$ file and list all your constants as part of this macro, each enclosed in a special macro called
|
|
$_C$. For example, to get the constants listed above declare your $PLATFORM_CPU_CONSTANTS$ macro like this:</p>
|
|
~#define PLATFORM_CPU_CONSTANTS\
|
|
_C( INT_GPIOA ),\
|
|
_C( INT_GPIOB ),\
|
|
.................
|
|
_C( INT_UDMA )~
|
|
<p>It's worth to note that adding more constants does not increas RAM usage, only Flash usage, so you can expose as much constants as you need without worrying about RAM consumption.]]
|
|
},
|
|
},
|
|
|
|
-- Functions
|
|
funcs =
|
|
{
|
|
{ sig = "#cpu.w32#( address, data )",
|
|
desc = "Writes a 32-bit word to memory.",
|
|
args =
|
|
{
|
|
"$address$ - the memory address.",
|
|
"$data$ - the 32-bit data to write."
|
|
},
|
|
},
|
|
|
|
{ sig = "data = #cpu.r32#( address )",
|
|
desc = "Read a 32-bit word from memory.",
|
|
args = "$address$ - the memory address.",
|
|
ret = "$data$ - the 32-bit word read from memory."
|
|
},
|
|
|
|
{ sig = "#cpu.w16#( address, data )",
|
|
desc = "Writes a 16-bit word to memory.",
|
|
args =
|
|
{
|
|
"$address$ - the memory address.",
|
|
"$data$ - the 16-bit data to write."
|
|
},
|
|
},
|
|
|
|
{ sig = "data = #cpu.r16#( address )",
|
|
desc = "Reads a 16-bit word from memory.",
|
|
args = "$address$ - the memory address.",
|
|
ret = "$data$ - the 16-bit word read from memory."
|
|
},
|
|
|
|
{ sig = "#cpu.w8#( address, data )",
|
|
desc = "Writes a byte to memory.",
|
|
args =
|
|
{
|
|
"$address$ - the memory address.",
|
|
"$data$ - the byte to write."
|
|
}
|
|
},
|
|
|
|
{ sig = "data = #cpu.r8#( address )",
|
|
desc = "Reads a byte from memory.",
|
|
args = "$address$ - the memory address",
|
|
ret = "$data$ - the byte read from memory."
|
|
},
|
|
|
|
{ sig = "#cpu.cli#()",
|
|
desc = "Disable CPU interrupts."
|
|
},
|
|
|
|
{ sig = "#cpu.sei#()",
|
|
desc = "Enable CPU interrupts."
|
|
},
|
|
|
|
{ sig = "clock = #cpu.clock#()",
|
|
desc = "Get the CPU core frequency.",
|
|
ret = "$clock$ - the CPU clock (in Hertz)."
|
|
}
|
|
},
|
|
}
|
|
|