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

Merge pull request #26 from ecdr/MiscUpdates

Misc small updates
This commit is contained in:
Bogdan Marinescu 2013-08-18 23:57:28 -07:00
commit a2e1c78d87
7 changed files with 46 additions and 20 deletions

View File

@ -59,6 +59,7 @@ An example that uses the above concepts and knows how to handle two different in
[subs="quotes"]
-------------------------------
local vtmrid = tmr.VIRT0
local uartid = 0
local to = 1500000
local prev_tmr, new_prev_tmr, prev_gpio
@ -83,6 +84,8 @@ end
if prev_gpio then prev_gpio( resnum ) end
end
pio.pin.setdir( pio.INPUT, pio.P0_0 )
-- Set timer interrupt handler
[bblue]*prev_tmr = cpu.set_int_handler( cpu.INT_TMR_MATCH, tmr_handler )*
-- Set GPIO interrupt on change (negative edge) interrupt handler

View File

@ -92,6 +92,7 @@ int platform_uart_recv( unsigned id, unsigned timer_id, timer_data_type timeout
}
}
#ifdef BUF_ENABLE_UART
static void cmn_rx_handler( int usart_id, u8 data )
{
#ifdef BUILD_SERMUX
@ -131,6 +132,7 @@ static void cmn_rx_handler( int usart_id, u8 data )
#endif // #ifdef BUILD_SERMUX
buf_write( BUF_ID_UART, usart_id, ( t_buf_data* )&data );
}
#endif // #ifdef BUF_ENABLE_UART
// Send: version with and without mux
void platform_uart_send( unsigned id, u8 data )

View File

@ -90,7 +90,11 @@
//## Modified for eLua
//## Defaults search modules path to our ROM File System
#ifndef LUA_RPC
#define LUA_PATH_DEFAULT "/rfs/?.lua;/rfs/?.lc;/mmc/?.lua;/mmc/?.lc;/rom/?.lua;/rom/?.lc"
#ifndef LUA_PATH_DEFAULT
#define LUA_PATH_DEFAULT "/rfs/?.lua;/rfs/?.lc;/mmc/?.lua;/mmc/?.lc;/wo/?.lua;/wo/?.lc;/rom/?.lua;/rom/?.lc"
#endif
#define LUA_CPATH_DEFAULT ""
#else // #ifndef LUA_RPC
#define LUA_PATH_DEFAULT \
@ -107,7 +111,9 @@
#define LUA_CDIR LUA_ROOT "lib/lua/5.1/"
#ifndef LUA_RPC
#define LUA_PATH_DEFAULT "/mmc/?.lua;/mmc/?.lc;/rom/?.lua;/rom/?.lc"
#ifndef LUA_PATH_DEFAULT
#define LUA_PATH_DEFAULT "/mmc/?.lua;/mmc/?.lc;/wo/?.lua;/wo/?.lc;/rom/?.lua;/rom/?.lc"
#endif
#define LUA_CPATH_DEFAULT ""
#else // #ifndef LUA_RPC
#define LUA_PATH_DEFAULT \

View File

@ -47,7 +47,7 @@ static int can_recv( lua_State* L )
u8 len;
int id;
u32 canid;
u8 idtype, data[ 8 ];
u8 idtype, data[ PLATFORM_CAN_MAXLEN ];
id = luaL_checkinteger( L, 1 );
MOD_CHECK_ID( can, id );

View File

@ -2,10 +2,12 @@
addi( sf( 'src/platform/%s/inc', platform ) )
addi( sf( 'src/platform/%s/driverlib', platform ) )
local cpu = comp.board:upper()
local cpu = comp.cpu:upper()
local board = comp.board:upper()
-- Only include USB headers/paths for boards which support it
if cpu == 'LM3S9B92' or board == 'LM3S9D92' then
if cpu == 'LM3S9B92' or cpu == 'LM3S9D92' then
addi( sf( 'src/platform/%s/usblib', platform ) )
addi( sf( 'src/platform/%s/usblib/device', platform ) )
end
@ -14,7 +16,6 @@ specific_files = "startup_gcc.c platform.c platform_int.c lm3s_pio.c"
local fwlib_files = utils.get_files( "src/platform/" .. platform .. "/driverlib", ".*%.c$" )
local board = comp.board:upper()
if board == 'EK-LM3S1968' or board == 'EK-LM3S6965' or board == 'EK-LM3S8962' then
specific_files = specific_files .. " rit128x96x4.c disp.c"
end

View File

@ -245,10 +245,21 @@ pio_type platform_pio_op( unsigned port, pio_type pinmask, int op )
#if defined( BUILD_CAN )
volatile u32 can_rx_flag = 0;
volatile u32 can_tx_flag = 0;
volatile u32 can_err_flag = 0;
char can_tx_buf[8];
// Speed used in INIT
#ifndef CAN_INIT_SPEED
#define CAN_INIT_SPEED 500000
#endif
// Message object for receiving
#define CAN_MSG_OBJ_RX 1
// Message object for transmitting
#define CAN_MSG_OBJ_TX 2
volatile u8 can_rx_flag = 0;
volatile u8 can_tx_flag = 0;
volatile u8 can_err_flag = 0;
char can_tx_buf[PLATFORM_CAN_MAXLEN];
tCANMsgObject can_msg_rx;
// LM3S9Bxx MCU CAN seems to run off of system clock, LM3S8962 has 8 MHz clock
@ -268,15 +279,15 @@ void CANIntHandler(void)
can_err_flag = 1;
can_tx_flag = 0;
}
else if( status == 1 ) // Message receive
else if( status == CAN_MSG_OBJ_RX ) // Message receive
{
CANIntClear(CAN0_BASE, 1);
CANIntClear(CAN0_BASE, CAN_MSG_OBJ_RX);
can_rx_flag = 1;
can_err_flag = 0;
}
else if( status == 2 ) // Message send
else if( status == CAN_MSG_OBJ_TX ) // Message send
{
CANIntClear(CAN0_BASE, 2);
CANIntClear(CAN0_BASE, CAN_MSG_OBJ_TX);
can_tx_flag = 0;
can_err_flag = 0;
}
@ -289,7 +300,7 @@ void cans_init( void )
{
MAP_SysCtlPeripheralEnable( SYSCTL_PERIPH_CAN0 );
MAP_CANInit( CAN0_BASE );
CANBitRateSet(CAN0_BASE, LM3S_CAN_CLOCK, 500000);
CANBitRateSet(CAN0_BASE, LM3S_CAN_CLOCK, CAN_INIT_SPEED);
MAP_CANIntEnable( CAN0_BASE, CAN_INT_MASTER | CAN_INT_ERROR | CAN_INT_STATUS );
MAP_IntEnable(INT_CAN0);
MAP_CANEnable(CAN0_BASE);
@ -298,8 +309,8 @@ void cans_init( void )
can_msg_rx.ulMsgID = 0;
can_msg_rx.ulMsgIDMask = 0;
can_msg_rx.ulFlags = MSG_OBJ_RX_INT_ENABLE | MSG_OBJ_USE_ID_FILTER;
can_msg_rx.ulMsgLen = 8;
MAP_CANMessageSet(CAN0_BASE, 1, &can_msg_rx, MSG_OBJ_TYPE_RX);
can_msg_rx.ulMsgLen = PLATFORM_CAN_MAXLEN;
MAP_CANMessageSet(CAN0_BASE, CAN_MSG_OBJ_RX, &can_msg_rx, MSG_OBJ_TYPE_RX);
}
@ -338,7 +349,7 @@ void platform_can_send( unsigned id, u32 canid, u8 idtype, u8 len, const u8 *dat
DUFF_DEVICE_8( len, *d++ = *s++ );
can_tx_flag = 1;
CANMessageSet(CAN0_BASE, 2, &msg_tx, MSG_OBJ_TYPE_TX);
CANMessageSet(CAN0_BASE, CAN_MSG_OBJ_TX, &msg_tx, MSG_OBJ_TYPE_TX);
}
int platform_can_recv( unsigned id, u32 *canid, u8 *idtype, u8 *len, u8 *data )
@ -347,7 +358,7 @@ int platform_can_recv( unsigned id, u32 *canid, u8 *idtype, u8 *len, u8 *data )
if( can_rx_flag != 0 )
{
can_msg_rx.pucMsgData = data;
CANMessageGet(CAN0_BASE, 1, &can_msg_rx, 0);
CANMessageGet(CAN0_BASE, CAN_MSG_OBJ_RX, &can_msg_rx, 0);
can_rx_flag = 0;
*canid = ( u32 )can_msg_rx.ulMsgID;
@ -359,7 +370,8 @@ int platform_can_recv( unsigned id, u32 *canid, u8 *idtype, u8 *len, u8 *data )
return PLATFORM_UNDERFLOW;
}
#endif
#endif // BUILD_CAN
// ****************************************************************************
// SPI

View File

@ -368,7 +368,9 @@ void shell_start()
{
char cmd[ SHELL_MAXSIZE + 1 ];
const SHELL_COMMAND *pcmd;
#ifdef BUILD_UIP
int i;
#endif
printf( SHELL_WELCOMEMSG, ELUA_STR_VERSION );
while( 1 )