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

patch for EK-LM3S1968 from Tiziano Trevisan

This commit is contained in:
Bogdan Marinescu 2010-09-05 18:20:27 +00:00
parent 297048b2a8
commit 76e79329f4
10 changed files with 47 additions and 16 deletions

View File

@ -68,7 +68,7 @@ toolchain_list['devkitarm'] = toolchain_list['arm-eabi-gcc']
# (the one that will be used if none is specified)
platform_list = {
'at91sam7x' : { 'cpus' : [ 'AT91SAM7X256', 'AT91SAM7X512' ], 'toolchains' : [ 'arm-gcc', 'codesourcery', 'devkitarm', 'arm-eabi-gcc' ] },
'lm3s' : { 'cpus' : [ 'LM3S8962', 'LM3S6965', 'LM3S6918', 'LM3S9B92' ], 'toolchains' : [ 'arm-gcc', 'codesourcery', 'devkitarm', 'arm-eabi-gcc' ] },
'lm3s' : { 'cpus' : [ 'LM3S1968', 'LM3S8962', 'LM3S6965', 'LM3S6918', 'LM3S9B92' ], 'toolchains' : [ 'arm-gcc', 'codesourcery', 'devkitarm', 'arm-eabi-gcc' ] },
'str9' : { 'cpus' : [ 'STR912FAW44' ], 'toolchains' : [ 'arm-gcc', 'codesourcery', 'devkitarm', 'arm-eabi-gcc' ] },
'i386' : { 'cpus' : [ 'I386' ], 'toolchains' : [ 'i686-gcc' ] },
'sim' : { 'cpus' : [ 'LINUX' ], 'toolchains' : [ 'i686-gcc' ] },
@ -82,6 +82,7 @@ platform_list = {
# List of board/CPU combinations
board_list = { 'SAM7-EX256' : [ 'AT91SAM7X256', 'AT91SAM7X512' ],
'EK-LM3S1968' : [ 'LM3S1968' ],
'EK-LM3S8962' : [ 'LM3S8962' ],
'EK-LM3S6965' : [ 'LM3S6965' ],
'EK-LM3S9B92' : [ 'LM3S9B92' ],
@ -132,6 +133,7 @@ romfs = { 'bisect' : [ 'bisect.lua' ],
# List of board/romfs data combinations
file_list = { 'SAM7-EX256' : [ 'bisect', 'hangman' , 'led', 'piano', 'hello', 'info', 'morse' ],
'EK-LM3S1968' : [ 'bisect', 'hangman', 'pong', 'led', 'piano', 'pwmled', 'hello', 'info', 'morse', 'adcscope', 'adcpoll', 'logo', 'spaceship', 'tetrives', 'snake' ],
'EK-LM3S8962' : [ 'lhttpd','bisect', 'led', 'pachube' ],
'EK-LM3S6965' : [ 'bisect', 'hangman', 'pong', 'led', 'piano', 'pwmled', 'hello', 'info', 'morse', 'adcscope', 'adcpoll', 'logo', 'tetrives' ],
'EK-LM3S9B92' : [ 'bisect', 'hangman', 'led', 'pwmled', 'hello', 'info', 'adcscope','adcpoll', 'life' ],

View File

@ -3,6 +3,8 @@
local uartid, invert, ledpin = 0, false
if pd.board() == "SAM7-EX256" then
ledpin = pio.PB_20
elseif pd.board() == "EK-LM3S1968" then
ledpin = pio.PG_2
elseif pd.board() == "EK-LM3S8962" or pd.board() == "EK-LM3S6965" then
ledpin = pio.PF_0
elseif pd.board() == "EAGLE-100" then

View File

@ -5,7 +5,9 @@
-------------------------------------------------------------------------------
local pwmid, tmrid, ledpin
if pd.board() == "EK-LM3S8962" or pd.board() == "EK-LM3S6965" then
if pd.board() == "EK-LM3S1968" then
pwmid, tmrid, ledpin = 2, 1, pio.PG_2
elseif pd.board() == "EK-LM3S8962" or pd.board() == "EK-LM3S6965" then
pwmid, tmrid, ledpin = 1, 1, pio.PF_0
elseif pd.board() == "EAGLE-100" then
wmid, tmrid, ledpin = 1, 1, pio.PE_1

View File

@ -9,6 +9,8 @@ end
if pd.board() == "EK-LM3S8962" or pd.board() == "EK-LM3S6965" or pd.board() == "EAGLE-100" then
pwmid, tmrid = 1, 1
elseif pd.board() == "EK-LM3S1968" then
pwmid, tmrid = 2, 1
elseif pd.board() == "SAM7-EX256" then
pwmid, tmrid = 0, 1
tmr.setclock( 1, 1000000 )

View File

@ -1,7 +1,7 @@
-- Control LED intensity with PWM
local pwmid, tmrid, ledpin
if pd.board() == 'EK-LM3S8962' or pd.board() == 'EK-LM3S6965' or pd.board() == 'ET-STM32' or pd.board() == 'EAGLE-100' then
if pd.board() == 'EK-LM3S1968' or pd.board() == 'EK-LM3S8962' or pd.board() == 'EK-LM3S6965' or pd.board() == 'ET-STM32' or pd.board() == 'EAGLE-100' then
pwmid, tmrid = 0, 1
pwm.setclock( pwmid, 25000000 )
elseif pd.board() == 'ELUA-PUC' then

View File

@ -29,6 +29,13 @@ for i = 1, Vmax, 1 do
game_map[ i ] = {}
end
local pwmid
if pd.board() == "EK-LM3S1968" then
pwmid = 2
else
pwmid = 1
end
-- Initial information
local platform = require( pd.board() )
lm3s.disp.init( 1000000 )
@ -84,9 +91,9 @@ function draw_walls() -- This function draws the walls and the
end
function sound() -- This function beeps
pwm.start( 1 )
pwm.start( pwmid )
tmr.delay( 0, 20000 )
pwm.stop( 1 )
pwm.stop( pwmid )
end
function print_data() -- This function writes the score and level on screen
@ -331,8 +338,8 @@ repeat
end
level = 1 -- This statements sets the level and score from the beginning
score = 0
pwm.setclock( 1, 25000000 ) -- This statements sets the PWM for the sound function
pwm.setup( 1, 1000, 70 )
pwm.setclock( pwmid, 25000000 ) -- This statements sets the PWM for the sound function
pwm.setup( pwmid, 1000, 70 )
draw_walls()
next_piece = math.random(7)
scan_piece ( next_piece )

View File

@ -1,7 +1,7 @@
# Configuration file for the LM3S microcontroller
specific_files = "startup_gcc.c platform.c uart.c sysctl.c gpio.c ssi.c timer.c pwm.c ethernet.c systick.c flash.c interrupt.c cpu.c adc.c"
if comp[ 'board' ] == 'EK-LM3S6965' or comp[ 'board' ] == 'EK-LM3S8962':
if comp[ 'board' ] == 'EK-LM3S1968' or comp[ 'board' ] == 'EK-LM3S6965' or comp[ 'board' ] == 'EK-LM3S8962':
specific_files = specific_files + " rit128x96x4.c disp.c"
comp.Append(CPPDEFINES = 'ENABLE_DISP')

View File

@ -446,15 +446,20 @@ u32 platform_s_timer_op( unsigned id, int op, u32 data )
const static u32 pwm_div_ctl[] = { SYSCTL_PWMDIV_1, SYSCTL_PWMDIV_2, SYSCTL_PWMDIV_4, SYSCTL_PWMDIV_8, SYSCTL_PWMDIV_16, SYSCTL_PWMDIV_32, SYSCTL_PWMDIV_64 };
const static u8 pwm_div_data[] = { 1, 2, 4, 8, 16, 32, 64 };
// Port/pin information for all channels
#ifdef FORLM3S6965
#if defined(FORLM3S1968)
const static u32 pwm_ports[] = { GPIO_PORTG_BASE, GPIO_PORTD_BASE, GPIO_PORTH_BASE, GPIO_PORTH_BASE, GPIO_PORTF_BASE, GPIO_PORTF_BASE };
const static u8 pwm_pins[] = { GPIO_PIN_2, GPIO_PIN_1, GPIO_PIN_0, GPIO_PIN_1, GPIO_PIN_2, GPIO_PIN_3 };
#elif defined(FORLM3S6965)
const static u32 pwm_ports[] = { GPIO_PORTF_BASE, GPIO_PORTD_BASE, GPIO_PORTB_BASE, GPIO_PORTB_BASE, GPIO_PORTE_BASE, GPIO_PORTE_BASE };
#elif FORLM3S9B92
const static u8 pwm_pins[] = { GPIO_PIN_0, GPIO_PIN_1, GPIO_PIN_0, GPIO_PIN_1, GPIO_PIN_0, GPIO_PIN_1 };
#elif defined(FORLM3S9B92)
const static u32 pwm_ports[] = { GPIO_PORTD_BASE, GPIO_PORTD_BASE, GPIO_PORTB_BASE, GPIO_PORTB_BASE, GPIO_PORTE_BASE, GPIO_PORTE_BASE };
const static u8 pwm_pins[] = { GPIO_PIN_0, GPIO_PIN_1, GPIO_PIN_0, GPIO_PIN_1, GPIO_PIN_0, GPIO_PIN_1 };
// GPIOPCTL probably needs modification to do PWM for 2&3, Digital Function 2
#else
const static u32 pwm_ports[] = { GPIO_PORTF_BASE, GPIO_PORTG_BASE, GPIO_PORTB_BASE, GPIO_PORTB_BASE, GPIO_PORTE_BASE, GPIO_PORTE_BASE };
const static u8 pwm_pins[] = { GPIO_PIN_0, GPIO_PIN_1, GPIO_PIN_0, GPIO_PIN_1, GPIO_PIN_0, GPIO_PIN_1 };
#endif
const static u8 pwm_pins[] = { GPIO_PIN_0, GPIO_PIN_1, GPIO_PIN_0, GPIO_PIN_1, GPIO_PIN_0, GPIO_PIN_1 };
// PWM generators
#ifdef FORLM3S9B92

View File

@ -17,9 +17,11 @@
#define BUILD_ROMFS
#define BUILD_MMCFS
#define BUILD_TERM
#define BUILD_UIP
#ifndef FORLM3S1968
#define BUILD_UIP
//#define BUILD_DHCPC
#define BUILD_DNS
#define BUILD_DNS
#endif
#define BUILD_CON_GENERIC
#define BUILD_ADC
#define BUILD_RPC
@ -127,7 +129,9 @@
#define VTMR_FREQ_HZ 4
// Number of resources (0 if not available/not implemented)
#ifdef FORLM3S9B92
#if defined(FORLM3S1968)
#define NUM_PIO 8
#elif defined(FORLM3S9B92)
#define NUM_PIO 7
#else
#define NUM_PIO 7
@ -201,7 +205,9 @@
// #define PIO_PINS_PER_PORT (n) if each port has the same number of pins, or
// #define PIO_PIN_ARRAY { n1, n2, ... } to define pins per port in an array
// Use #define PIO_PINS_PER_PORT 0 if this isn't needed
#ifdef FORLM3S9B92
#if defined(FORLM3S1968)
#define PIO_PIN_ARRAY { 8, 8, 8, 4, 4, 8, 8, 4}
#elif defined(FORLM3S9B92)
#define PIO_PIN_ARRAY { 8, 8, 8, 8, 8, 6, 8, 8, 8 }
#else
#define PIO_PIN_ARRAY { 8, 8, 8, 8, 4, 4, 2 }

View File

@ -49,7 +49,12 @@
//
//*****************************************************************************
#ifdef FORLM3S6965
#if defined(FORLM3S1968)
#define SYSCTL_PERIPH_GPIO_OLEDDC SYSCTL_PERIPH_GPIOH
#define GPIO_OLEDDC_BASE GPIO_PORTH_BASE
#define GPIO_OLEDDC_PIN GPIO_PIN_2
#define GPIO_OLEDEN_PIN GPIO_PIN_3
#elif defined(FORLM3S6965)
#define SYSCTL_PERIPH_GPIO_OLEDDC SYSCTL_PERIPH_GPIOC
#define GPIO_OLEDDC_BASE GPIO_PORTC_BASE
#define GPIO_OLEDDC_PIN GPIO_PIN_7