mirror of
git://projects.qi-hardware.com/nn-usb-fpga.git
synced 2025-04-21 12:27:27 +03:00
Adding lm32 demo to SAKC project
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
CC = mipsel-openwrt-linux-gcc
|
||||
|
||||
all: jz_init_sram jz_test_gpio
|
||||
all: jz_init_sram jz_test_gpio enable_rx
|
||||
|
||||
DEBUG = -O3 -g0
|
||||
|
||||
@@ -26,6 +26,9 @@ jz_init_sram: $(COMMON_OBJECTS)
|
||||
jz_test_gpio: $(COMMON_OBJECTS)
|
||||
$(CC) $(LDFLAGS) $(COMMON_OBJECTS) jz_test_gpio.c -o jz_test_gpio
|
||||
|
||||
enable_rx: $(COMMON_OBJECTS)
|
||||
$(CC) $(LDFLAGS) $(COMMON_OBJECTS) enable_rx.c -o enable_rx
|
||||
|
||||
.c.o:
|
||||
$(CC) -c $(CCFLAGS) $< -o $@
|
||||
|
||||
@@ -33,7 +36,7 @@ upload: jz_init_sram jz_test_gpio
|
||||
scp jz_test_gpio jz_init_sram root@$(NANO_IP):
|
||||
|
||||
clean:
|
||||
rm -f *.o jz_init_sram jz_test_gpio ${EXEC} *~
|
||||
rm -f *.o jz_init_sram jz_test_gpio enable_rx ${EXEC} *~
|
||||
|
||||
indent:
|
||||
indent -bad -bap -nbc -bl -nce -i2 --no-tabs --line-length120 $(COMMON_SOURCES) $(H_SOURCES)
|
||||
|
||||
40
Examples/sram/src/enable_rx.c
Normal file
40
Examples/sram/src/enable_rx.c
Normal file
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
JZ47xx test gpio
|
||||
|
||||
Copyright (C) 2010 Andres Calderon andres.calderon@emqbit.com
|
||||
Carlos Camargo cicamargoba@unal.edu.co
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "jz47xx_gpio.h"
|
||||
|
||||
#define RXD_PORT JZ_GPIO_PORT_D
|
||||
#define RXD_PIN 26
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
JZ_PIO *pio = jz_gpio_map (RXD_PORT);
|
||||
|
||||
if (!pio)
|
||||
return -1;
|
||||
|
||||
jz_gpio_as_func (pio, RXD_PIN, 1);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -79,18 +79,21 @@ jz_gpio_as_func (JZ_PIO * pio, unsigned int o, int func)
|
||||
pio->PXFUNS = (1 << o);
|
||||
pio->PXTRGC = (1 << o);
|
||||
pio->PXSELC = (1 << o);
|
||||
pio->PXPES = (1 << o);
|
||||
return 1;
|
||||
|
||||
case 1:
|
||||
pio->PXFUNS = (1 << o);
|
||||
pio->PXTRGC = (1 << o);
|
||||
pio->PXSELS = (1 << o);
|
||||
pio->PXPES = (1 << o);
|
||||
return 1;
|
||||
|
||||
case 2:
|
||||
pio->PXFUNS = (1 << o);
|
||||
pio->PXTRGS = (1 << o);
|
||||
pio->PXSELC = (1 << o);
|
||||
pio->PXPES = (1 << o);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user