1
0
mirror of git://projects.qi-hardware.com/nn-usb-fpga.git synced 2025-04-21 12:27:27 +03:00

First functional example, ADC an Framebuffer Test

This commit is contained in:
Juan64Bits
2010-12-04 15:12:02 -05:00
parent 62d0edf217
commit 8d95564253
138 changed files with 14826 additions and 538 deletions

View File

@@ -0,0 +1,63 @@
TOOLCHAIN_BASE= /home/juan64bits/ebd/ECB/openwrt-xburst/staging_dir/toolchain-mipsel_gcc-4.3.3+cs_uClibc-0.9.32/usr/bin/mipsel-openwrt-linux
CC = ${TOOLCHAIN_BASE}-gcc
CXX = ${TOOLCHAIN_BASE}-g++
INCPATH = -I.
CFLAGS = ${INCPATH} -pipe -O2 -mips32 -mtune=mips32 -Wall
CXXFLAGS = ${INCPATH} -pipe -O2 -mips32 -mtune=mips32 -Wall
LINK = ${TOOLCHAIN_BASE}-g++
LFLAGS = -Wl,-O1
LIBS = -lstdc++
AR = ${TOOLCHAIN_BASE}-ar cqs
RANLIB = ${TOOLCHAIN_BASE}-ranlib
DEL_FILE = rm -f
SYMLINK = ln -f -s
DEL_DIR = rmdir
MOVE = mv -f
MKDIR = mkdir -p
TARGET = SIE_APP
OBJECTS = main.o \
jz_adc_peripheral.o \
jz_fpga_init.o \
jz47xx_gpio.o \
jz47xx_mmap.o \
fbutils.o
#BUILD RULES
all: $(TARGET)
$(TARGET): $(OBJECTS)
$(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(LIBS)
fbutils.o: fbutils.c fbutils.h
$(CC) $(CFLAGS) $(INCPATH) -c $< -o $@
jz47xx_gpio.o: jz47xx_gpio.cpp \
jz47xx_mmap.h
$(CXX) $(CXXFLAGS) $(INCPATH) -c $< -o $@
jz47xx_mmap.o: jz47xx_mmap.cpp \
jz47xx_gpio.h
$(CXX) $(CXXFLAGS) $(INCPATH) -c $< -o $@
jz_adc_peripheral.o: jz_adc_peripheral.cpp \
jz_fpga_init.h \
jz47xx_gpio.h \
jz47xx_mmap.h
$(CXX) $(CXXFLAGS) $(INCPATH) -c $< -o $@
jz_fpga_init.o: jz_fpga_init.cpp \
jz47xx_gpio.h \
jz47xx_mmap.h
$(CXX) $(CXXFLAGS) $(INCPATH) -c $< -o $@
main.o: main.cpp \
jz_adc_peripheral.h \
jz_fpga_init.h
$(CXX) $(CXXFLAGS) $(INCPATH) -c $< -o $@
clean:
$(DEL_FILE) *.o $(TARGET)

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,63 @@
/*
* fbutils.h
*
* Headers for utility routines for framebuffer interaction
*
* Copyright 2002 Russell King and Doug Lowder
*
* This file is placed under the GPL. Please see the
* file COPYING for details.
*
*/
#ifndef _FBUTILS_H
#define _FBUTILS_H
#include <asm/types.h>
#include <linux/types.h>
/* This constant, being ORed with the color index tells the library
* to draw in exclusive-or mode (that is, drawing the same second time
* in the same place will remove the element leaving the background intact).
*/
#define XORMODE 0x80000000
extern __u32 xres, yres;
int open_framebuffer(void);
void close_framebuffer(void);
void setcolor(unsigned colidx, unsigned value);
void put_cross(int x, int y, unsigned colidx);
void put_string(int x, int y, char *s, unsigned colidx);
void put_string_center(int x, int y, char *s, unsigned colidx);
void pixel (int x, int y, unsigned colidx);
void line (int x1, int y1, int x2, int y2, unsigned colidx);
void rect (int x1, int y1, int x2, int y2, unsigned colidx);
void fillrect (int x1, int y1, int x2, int y2, unsigned colidx);
void setColorsFromDefaultPallet();
void put_int(int x, int y, int c, int colidx);
/*
*FONT
*/
struct fbcon_font_desc {
int idx;
const char *name;
int width, height;
unsigned char *data;
int pref;
};
#define VGA8x8_IDX 0
#define PEARL8x8_IDX 2
#define VGA6x11_IDX 3
#define SUN8x16_IDX 4
#define SUN12x22_IDX 5
#define ACORN8x8_IDX 6
/* Max. length for the name of a predefined font */
#define MAX_FONT_NAME 32
#define FONTDATAMAX 2048
#endif /* _FBUTILS_H */

Binary file not shown.

View File

@@ -0,0 +1,108 @@
/*
JZ47xx GPIO at userspace
Copyright (C) 2010 Andres Calderon andres.calderon@emqbit.com
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 <stdlib.h>
#include <unistd.h>
#include <jz47xx_gpio.h>
#include <jz47xx_mmap.h>
#define JZ_GPIO_BASE 0x10010000
void
jz_gpio_as_output (JZ_PIO * pio, unsigned int o)
{
pio->PXFUNC = (1 << (o));
pio->PXSELC = (1 << (o));
pio->PXDIRS = (1 << (o));
}
void
jz_gpio_as_input (JZ_PIO * pio, unsigned int o)
{
pio->PXFUNC = (1 << (o));
pio->PXSELC = (1 << (o));
pio->PXDIRC = (1 << (o));
}
void
jz_gpio_set_pin (JZ_PIO * pio, unsigned int o)
{
pio->PXDATS = (1 << (o));
}
void
jz_gpio_clear_pin (JZ_PIO * pio, unsigned int o)
{
pio->PXDATC = (1 << (o));
}
void
jz_gpio_out (JZ_PIO * pio, unsigned int o, unsigned int val)
{
if (val == 0)
pio->PXDATC = (1 << (o));
else
pio->PXDATS = (1 << (o));
}
unsigned int
jz_gpio_get_pin (JZ_PIO * pio, unsigned int o)
{
return (pio->PXPIN & (1 << o)) ? 1 : 0;
}
int
jz_gpio_as_func (JZ_PIO * pio, unsigned int o, int func)
{
switch (func)
{
case 0:
pio->PXFUNS = (1 << o);
pio->PXTRGC = (1 << o);
pio->PXSELC = (1 << o);
return 1;
case 1:
pio->PXFUNS = (1 << o);
pio->PXTRGC = (1 << o);
pio->PXSELS = (1 << o);
return 1;
case 2:
pio->PXFUNS = (1 << o);
pio->PXTRGS = (1 << o);
pio->PXSELC = (1 << o);
return 1;
}
return 0;
}
JZ_PIO *
jz_gpio_map (int port)
{
JZ_PIO *pio;
pio = (JZ_PIO *) jz_mmap (JZ_GPIO_BASE);
pio = (JZ_PIO *) ((unsigned int) pio + port * 0x100);
return pio;
}

View File

@@ -0,0 +1,84 @@
/*
JZ47xx GPIO at userspace
Copyright (C) 2010 Andres Calderon andres.calderon@emqbit.com
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 */
#ifndef __jz47xx_gpio_h__
#define __jz47xx_gpio_h__
#define JZ_GPIO_PORT_A 0
#define JZ_GPIO_PORT_B 1
#define JZ_GPIO_PORT_C 2
#define JZ_GPIO_PORT_D 3
typedef volatile unsigned int JZ_REG; /* Hardware register definition */
typedef struct _JZ_PIO
{
JZ_REG PXPIN; /* PIN Level Register */
JZ_REG Reserved0;
JZ_REG Reserved1;
JZ_REG Reserved2;
JZ_REG PXDAT; /* Port Data Register */
JZ_REG PXDATS; /* Port Data Set Register */
JZ_REG PXDATC; /* Port Data Clear Register */
JZ_REG Reserved3;
JZ_REG PXIM; /* Interrupt Mask Register */
JZ_REG PXIMS; /* Interrupt Mask Set Reg */
JZ_REG PXIMC; /* Interrupt Mask Clear Reg */
JZ_REG Reserved4;
JZ_REG PXPE; /* Pull Enable Register */
JZ_REG PXPES; /* Pull Enable Set Reg. */
JZ_REG PXPEC; /* Pull Enable Clear Reg. */
JZ_REG Reserved5;
JZ_REG PXFUN; /* Function Register */
JZ_REG PXFUNS; /* Function Set Register */
JZ_REG PXFUNC; /* Function Clear Register */
JZ_REG Reserved6;
JZ_REG PXSEL; /* Select Register */
JZ_REG PXSELS; /* Select Set Register */
JZ_REG PXSELC; /* Select Clear Register */
JZ_REG Reserved7;
JZ_REG PXDIR; /* Direction Register */
JZ_REG PXDIRS; /* Direction Set Register */
JZ_REG PXDIRC; /* Direction Clear Register */
JZ_REG Reserved8;
JZ_REG PXTRG; /* Trigger Register */
JZ_REG PXTRGS; /* Trigger Set Register */
JZ_REG PXTRGC; /* Trigger Set Register */
JZ_REG Reserved9;
JZ_REG PXFLG; /* Port Flag Register */
JZ_REG PXFLGC; /* Port Flag clear Register */
} JZ_PIO, *PJZ_PIO;
void jz_gpio_as_output (JZ_PIO * pio, unsigned int o);
void jz_gpio_as_input (JZ_PIO * pio, unsigned int o);
void jz_gpio_set_pin (JZ_PIO * pio, unsigned int o);
void jz_gpio_clear_pin (JZ_PIO * pio, unsigned int o);
void jz_gpio_out (JZ_PIO * pio, unsigned int o, unsigned int val);
unsigned int jz_gpio_get_pin (JZ_PIO * pio, unsigned int o);
int jz_gpio_as_func (JZ_PIO * pio, unsigned int o, int func);
JZ_PIO *jz_gpio_map (int port);
#endif

Binary file not shown.

View File

@@ -0,0 +1,32 @@
/*
* JZ47xx GPIO lines
*
* Written 2010 by Andres Calderon andres.calderon@emqbit.com
*/
#include "jz47xx_mmap.h"
unsigned int *
jz_mmap (off_t address)
{
int fd;
unsigned int *pio;
if ((fd = open ("/dev/mem", O_RDWR | O_SYNC)) == -1)
{
fprintf (stderr, "Cannot open /dev/mem.\n");
return 0;
}
pio = (unsigned int *) mmap (0, getpagesize (), PROT_READ | PROT_WRITE, MAP_SHARED, fd, address);
if (pio == (unsigned int *) -1)
{
fprintf (stderr, "Cannot mmap.\n");
return 0;
}
return pio;
}

View File

@@ -0,0 +1,22 @@
/*
* JZ47xx GPIO lines
*
* Written 2010 by Andres Calderon andres.calderon@emqbit.com
*/
#ifndef __jz47xx_mmap_h__
#define __jz47xx_mmap_h__
#include <sys/mman.h>
#include <stdio.h>
#include <sys/mman.h>
#include <fcntl.h>
#include <stdlib.h>
#include <termios.h>
#include <unistd.h>
#include "jz47xx_gpio.h"
unsigned int * jz_mmap (off_t address);
#endif

Binary file not shown.

View File

@@ -0,0 +1,78 @@
/* ADC Peripheral.c
Copyright (C) 2010
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 "jz_adc_peripheral.h"
void ADCTest(JZ_REG * ADCBuffer)
{
if(ADCBuffer!=0)
{
int aggregate=0; float errorT=0;
/******************************* TEST 1 ***********************************/
printf("\nINIT TEST1: Autoselft {(Vref+) - (Vref-)}/2 -> Return 0x0200 \n");
ADCConfig(ADCBuffer,ADC_CMD_SET_AUTOSELFT_1);
ADCConfig(ADCBuffer,ADC_CMD_READ_AUTOSELFT_1);
for(int i=ADC_BUFFER_OFFSET; i< ADC_BUFFER_LEN/2+ADC_BUFFER_OFFSET; i++)
{
aggregate += (ADCBuffer[i]&0xFFFF + ((ADCBuffer[i]>>16)&0x0FFF));
printf("[%08X]", ADCBuffer[i]);
}
errorT=(aggregate/16)*100/0x200;
if((errorT<95)||(errorT>105))
printf("\n**WARNING** Test FAILED.\n\n");
else
printf("\nTest OK\n\n");
fflush (stdout);
}
}
void ADCPowerDown(JZ_REG * ADCBuffer)
{
ADCConfig(ADCBuffer,ADC_CMD_SET_POWER_DOWN);
}
JZ_REG * ADCTakeSamples(JZ_REG * ADCBuffer,int CHANNEL)
{
ADCConfig(ADCBuffer,ADC_CMD_SET_CHANNEL0+CHANNEL);
ADCConfig(ADCBuffer,ADC_CMD_READ_CHANNEL0+CHANNEL);
return (JZ_REG*)(ADCBuffer+ADC_BUFFER_OFFSET);
}
void ADCConfig(JZ_REG * ADCBuffer,uchar CMD)
{
if(ADCBuffer!=0)
{
ADCBuffer[0] = (((ADC_MUX_CHANNELS<<6) + CMD)<<24) + \
((ADC_BUFFER_LEN+ADC_BUFFER_OFFSET*2) << 8) + \
(ADC_SPI_CLKDIV);
while(ADCCheckBufferFull(ADCBuffer)) usleep (10);
}
}
int ADCCheckBufferFull(JZ_REG * ADCBuffer)
{
if(ADCBuffer!=0)
{
return ADCBuffer[0]&0x20000000;
}
return 0;
}

View File

@@ -0,0 +1,86 @@
/* ADC Peripheral.h
Copyright (C) 2010 Carlos Camargo cicamargoba@unal.edu.co
Andres Calderon andres.calderon@emqbit.com
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 */
#ifndef __adc_peripheral_h__
#define __adc_peripheral_h__
#define ADC_CMD_NONE 0x00 /* Nothing to do */
#define ADC_CMD_SET_SPI_CLKDIV 0x00 /* Set clock divider for ADC sclk */
#define ADC_CMD_SET_BUFFER_SIZE 0x00 /* Set clock divider for ADC sclk */
#define ADC_CMD_SET_CHANNEL0 0x30 /* Set channel 0 */
#define ADC_CMD_READ_CHANNEL0 0x20 /* Read channel 0 */
#define ADC_CMD_SET_CHANNEL1 0x31 /* Set channel 1 */
#define ADC_CMD_READ_CHANNEL1 0x21 /* Read channel 1 */
#define ADC_CMD_SET_CHANNEL2 0x32 /* Set channel 2 */
#define ADC_CMD_READ_CHANNEL2 0x22 /* Read channel 2 */
#define ADC_CMD_SET_CHANNEL3 0x33 /* Set channel 3 */
#define ADC_CMD_READ_CHANNEL3 0x23 /* Read channel 3 */
#define ADC_CMD_SET_CHANNEL4 0x34 /* Set channel 4 */
#define ADC_CMD_READ_CHANNEL4 0x24 /* Read channel 4 */
#define ADC_CMD_SET_CHANNEL5 0x35 /* Set channel 5 */
#define ADC_CMD_READ_CHANNEL5 0x25 /* Read channel 5 */
#define ADC_CMD_SET_CHANNEL6 0x36 /* Set channel 6 */
#define ADC_CMD_READ_CHANNEL6 0x26 /* Read channel 6 */
#define ADC_CMD_SET_CHANNEL7 0x37 /* Set channel 7 */
#define ADC_CMD_READ_CHANNEL7 0x27 /* Read channel 8 */
#define ADC_CMD_SET_POWER_DOWN 0X38 /* Set ADC power down mode (1uA) */
#define ADC_CMD_SET_FAST_CONV 0X39 /* Initialize ADC Fast Convertion(<10us)*/
#define ADC_CMD_SET_LOW_CONV 0X3A /* Initialize ADC Slow Convertion(<40us)*/
#define ADC_CMD_SET_AUTOSELFT_1 0x3B /* Set Autoselft ADC {(Vref+)-(Vref-)}/2*/
#define ADC_CMD_READ_AUTOSELFT_1 0x2B /* Read Autoselft ADC 1 (0x0200) */
#define ADC_CMD_SET_AUTOSELFT_2 0x3C /* Set Autoselft ADC (Vref-) */
#define ADC_CMD_READ_AUTOSELFT_2 0x2C /* Read Autoselft ADC 2 (0x0000) */
#define ADC_CMD_SET_AUTOSELFT_3 0x3D /* Set Autoselft ADC (Vref+) */
#define ADC_CMD_READ_AUTOSELFT_3 0x2D /* Read Autoselft ADC 3 (0x03FF) */
#define ADC_SPI_CLKDIV_MIN 0x08 /* 50/(2*9) -> 2.78MHz (MAX=2.8MHz) */
#define ADC_SPI_CLKDIV_MAX 0xFF /* 50/(2*256) -> 97.65KHz */
#define ADC_MAX_BUFFER 0x3FE/* 1022 reads/commands */
typedef unsigned char uchar;
typedef volatile unsigned int JZ_REG;
static uchar ADC_SPI_CLKDIV=ADC_SPI_CLKDIV_MAX; //Set clock to minimum speed
static int ADC_BUFFER_LEN=16;
static int ADC_BUFFER_OFFSET= 8; //Ignore first 16 samples
static uchar ADC_MUX_CHANNELS=0;
void ADCTest(JZ_REG * ADCBuffer);
void ADCPowerDown(JZ_REG * ADCBuffer);
JZ_REG * ADCTakeSamples(JZ_REG * ADCBuffer,int CHANNEL);
void ADCConfig(JZ_REG * ADCBuffer,uchar CMD);
int ADCCheckBufferFull(JZ_REG * ADCBuffer);
#endif

Binary file not shown.

View File

@@ -0,0 +1,29 @@
/*
* SIE FPGA init
*
*/
#include "jz_fpga_init.h"
JZ_REG *
jz_cs2_init()
{
JZ_PIO *pio;
JZ_REG *virt_addr;
pio = jz_gpio_map (CS2_PORT);
jz_gpio_as_func (pio, CS2_PIN, 0);
virt_addr = (JZ_REG *) (jz_mmap(0x13010000) + 0x18);
if (*virt_addr != 0x0FFF7700)
{
*virt_addr = 0x0FFF7700;
printf ("ADC: Configuring CS2 8 bits and 0 WS.\n");
}
else
printf ("ADC: CS2, already configured.\n");
virt_addr = (JZ_REG *) jz_mmap (0x14000000);
return virt_addr;
}

View File

@@ -0,0 +1,12 @@
/*
* SIE FPGA init
*
*/
#include "jz47xx_gpio.h"
#include "jz47xx_mmap.h"
#define CS2_PORT JZ_GPIO_PORT_B
#define CS2_PIN 26
JZ_REG * jz_cs2_init();

Binary file not shown.

View File

@@ -0,0 +1,616 @@
#include "jz_adc_peripheral.h"
#include "jz_fpga_init.h"
#include <stdio.h>
#include <unistd.h>
extern "C"
{
#include "fbutils.h"
}
JZ_REG * FPGA_ADDR;
JZ_REG * ADCBuffer;
bool frameBufferOpened = 0;
bool firstLoop = 1;
void FB_Print_Line38 ()
{
if(1)
{
put_string_center (160,210,"By Juan64Bits", 1);
}
else
{
put_string (160,210,"By Juan64Bits", 1%5);
}
}
void FB_Print_Line37 ()
{
if(1)
{
put_string_center (160,200,"Segundo Semestre de 2010", 1);
}
else
{
put_string (160,200,"Segundo Semestre de 2010", 1%5);
}
}
void FB_Print_Line36 ()
{
if(1)
{
put_string_center (160,190,"Universidad Nacional de Colombia", 1);
}
else
{
put_string (160,190,"Universidad Nacional de Colombia", 1%5);
}
}
void FB_Print_Line35 ()
{
if(0)
{
put_string_center (0,156,"CHA [7]", 4);
}
else
{
put_string (0,156,"CHA [7]", 4%5);
}
}
void FB_Print_Line10 ()
{
if(0)
{
put_string_center (0,16,"CHA [0]", 4);
}
else
{
put_string (0,16,"CHA [0]", 4%5);
}
}
void Constant_Bool1 ( bool &out_3)
{
out_3=1;
}
void FB_Print_Line2 ()
{
if(1)
{
put_string_center (160,0,"Wellcome to SIE {Executing Code...}", 1);
}
else
{
put_string (160,0,"Wellcome to SIE {Executing Code...}", 1%5);
}
}
void ADC_Eight7 ( unsigned short int &out_8, unsigned short int &out_7, unsigned short int &out_6, unsigned short int &out_5, unsigned short int &out_4, unsigned short int &out_3, unsigned short int &out_2, unsigned short int &out_1)
{
JZ_REG * ADC_DATA = ADCTakeSamples(ADCBuffer,0);
unsigned int sampleData = ADC_DATA[0];
out_1 = (sampleData>>16)&0xFFFF;
out_2 = sampleData&0xFFFF;
sampleData = ADC_DATA[1];
out_3 = (sampleData>>16)&0xFFFF;
out_4 = sampleData&0xFFFF;
sampleData = ADC_DATA[2];
out_5 = (sampleData>>16)&0xFFFF;
out_6 = sampleData&0xFFFF;
sampleData = ADC_DATA[3];
out_7 = (sampleData>>16)&0xFFFF;
out_8 = sampleData&0xFFFF;
}
void Right_Shift25 ( int in_0, int &out_1)
{
out_1 = in_0 >> 2;
}
void FB_Draw_HLine11 ( unsigned short int in_3)
{
if(!firstLoop) // do nothing in first loop
{
fillrect(64,96,64+255,96+16,0); //Black Rect
rect(64,96,64+255,96+16,3); //Extern Rect
fillrect(64,96,64+(in_3%(255+1)),96+16,3);
}
}
void FB_Put_Int18 ( int in_1)
{
put_int(16,104,in_1,2);
}
void Right_Shift24 ( int in_0, int &out_1)
{
out_1 = in_0 >> 2;
}
void FB_Draw_HLine6 ( unsigned short int in_3)
{
if(!firstLoop) // do nothing in first loop
{
fillrect(64,76,64+255,76+16,0); //Black Rect
rect(64,76,64+255,76+16,3); //Extern Rect
fillrect(64,76,64+(in_3%(255+1)),76+16,3);
}
}
void FB_Put_Int17 ( int in_1)
{
put_int(16,84,in_1,2);
}
void Right_Shift23 ( int in_0, int &out_1)
{
out_1 = in_0 >> 2;
}
void FB_Draw_HLine4 ( unsigned short int in_3)
{
if(!firstLoop) // do nothing in first loop
{
fillrect(64,56,64+255,56+16,0); //Black Rect
rect(64,56,64+255,56+16,3); //Extern Rect
fillrect(64,56,64+(in_3%(255+1)),56+16,3);
}
}
void FB_Put_Int16 ( int in_1)
{
put_int(16,64,in_1,2);
}
void Right_Shift22 ( int in_0, int &out_1)
{
out_1 = in_0 >> 2;
}
void FB_Draw_HLine0 ( unsigned short int in_3)
{
if(!firstLoop) // do nothing in first loop
{
fillrect(64,36,64+255,36+16,0); //Black Rect
rect(64,36,64+255,36+16,3); //Extern Rect
fillrect(64,36,64+(in_3%(255+1)),36+16,3);
}
}
void FB_Put_Int15 ( int in_1)
{
put_int(16,44,in_1,2);
}
void Right_Shift8 ( int in_0, int &out_1)
{
out_1 = in_0 >> 2;
}
void FB_Draw_HLine3 ( unsigned short int in_3)
{
if(!firstLoop) // do nothing in first loop
{
fillrect(64,16,64+255,16+16,0); //Black Rect
rect(64,16,64+255,16+16,3); //Extern Rect
fillrect(64,16,64+(in_3%(255+1)),16+16,3);
}
}
void FB_Put_Int9 ( int in_1)
{
put_int(16,24,in_1,2);
}
void FB_Put_Int19 ( int in_1)
{
put_int(16,124,in_1,2);
}
void Right_Shift26 ( int in_0, int &out_1)
{
out_1 = in_0 >> 2;
}
void FB_Draw_HLine12 ( unsigned short int in_3)
{
if(!firstLoop) // do nothing in first loop
{
fillrect(64,116,64+255,116+16,0); //Black Rect
rect(64,116,64+255,116+16,3); //Extern Rect
fillrect(64,116,64+(in_3%(255+1)),116+16,3);
}
}
void FB_Put_Int20 ( int in_1)
{
put_int(16,144,in_1,2);
}
void Right_Shift27 ( int in_0, int &out_1)
{
out_1 = in_0 >> 2;
}
void FB_Draw_HLine13 ( unsigned short int in_3)
{
if(!firstLoop) // do nothing in first loop
{
fillrect(64,136,64+255,136+16,0); //Black Rect
rect(64,136,64+255,136+16,3); //Extern Rect
fillrect(64,136,64+(in_3%(255+1)),136+16,3);
}
}
void FB_Put_Int21 ( int in_1)
{
put_int(16,164,in_1,2);
}
void Right_Shift28 ( int in_0, int &out_1)
{
out_1 = in_0 >> 2;
}
void FB_Draw_HLine14 ( unsigned short int in_3)
{
if(!firstLoop) // do nothing in first loop
{
fillrect(64,156,64+255,156+16,0); //Black Rect
rect(64,156,64+255,156+16,3); //Extern Rect
fillrect(64,156,64+(in_3%(255+1)),156+16,3);
}
}
void FB_Print_Line29 ()
{
if(0)
{
put_string_center (0,36,"CHA [1]", 4);
}
else
{
put_string (0,36,"CHA [1]", 4%5);
}
}
void FB_Print_Line30 ()
{
if(0)
{
put_string_center (0,56,"CHA [2]", 4);
}
else
{
put_string (0,56,"CHA [2]", 4%5);
}
}
void FB_Print_Line31 ()
{
if(0)
{
put_string_center (0,76,"CHA [3]", 4);
}
else
{
put_string (0,76,"CHA [3]", 4%5);
}
}
void FB_Print_Line32 ()
{
if(0)
{
put_string_center (0,96,"CHA [4]", 4);
}
else
{
put_string (0,96,"CHA [4]", 4%5);
}
}
void FB_Print_Line33 ()
{
if(0)
{
put_string_center (0,116,"CHA [5]", 4);
}
else
{
put_string (0,116,"CHA [5]", 4%5);
}
}
void FB_Print_Line34 ()
{
if(0)
{
put_string_center (0,136,"CHA [6]", 4);
}
else
{
put_string (0,136,"CHA [6]", 4%5);
}
}
int main()
{
/* OPEN FRAME BUFFER */
printf("Opening framebuffer...\n\n");
if (open_framebuffer()) {
close_framebuffer();
printf("Could not open framebuffer!!\n\n");
}
else
{
setColorsFromDefaultPallet();
rect(0,0,xres,yres,0); //Extern Rect
}
/* MAPING FPGA MEMORY */
FPGA_ADDR=jz_cs2_init();
ADCBuffer = FPGA_ADDR;
ADCTest(ADCBuffer);
ADC_SPI_CLKDIV=255;
ADC_BUFFER_LEN=8;
ADC_MUX_CHANNELS=7;
//Inputs/Outputs: Block: <FB Print Line> with ID[38]
//Inputs/Outputs: Block: <FB Print Line> with ID[37]
//Inputs/Outputs: Block: <FB Print Line> with ID[36]
//Inputs/Outputs: Block: <FB Print Line> with ID[35]
//Inputs/Outputs: Block: <FB Print Line> with ID[10]
//Inputs/Outputs: Block: <Constant Bool> with ID[1]
bool out_3_1=0;
//Inputs/Outputs: Block: <System While> with ID[5]
bool in_6_5=0;
//Inputs/Outputs: Block: <FB Print Line> with ID[2]
//Inputs/Outputs: Block: <ADC Eight> with ID[7]
unsigned short int out_8_7=0;
unsigned short int out_7_7=0;
unsigned short int out_6_7=0;
unsigned short int out_5_7=0;
unsigned short int out_4_7=0;
unsigned short int out_3_7=0;
unsigned short int out_2_7=0;
unsigned short int out_1_7=0;
//Inputs/Outputs: Block: <Right Shift> with ID[25]
int in_0_25=0;
int out_1_25=0;
//Inputs/Outputs: Block: <FB Draw HLine> with ID[11]
unsigned short int in_3_11=0;
//Inputs/Outputs: Block: <FB Put Int> with ID[18]
int in_1_18=0;
//Inputs/Outputs: Block: <Right Shift> with ID[24]
int in_0_24=0;
int out_1_24=0;
//Inputs/Outputs: Block: <FB Draw HLine> with ID[6]
unsigned short int in_3_6=0;
//Inputs/Outputs: Block: <FB Put Int> with ID[17]
int in_1_17=0;
//Inputs/Outputs: Block: <Right Shift> with ID[23]
int in_0_23=0;
int out_1_23=0;
//Inputs/Outputs: Block: <FB Draw HLine> with ID[4]
unsigned short int in_3_4=0;
//Inputs/Outputs: Block: <FB Put Int> with ID[16]
int in_1_16=0;
//Inputs/Outputs: Block: <Right Shift> with ID[22]
int in_0_22=0;
int out_1_22=0;
//Inputs/Outputs: Block: <FB Draw HLine> with ID[0]
unsigned short int in_3_0=0;
//Inputs/Outputs: Block: <FB Put Int> with ID[15]
int in_1_15=0;
//Inputs/Outputs: Block: <Right Shift> with ID[8]
int in_0_8=0;
int out_1_8=0;
//Inputs/Outputs: Block: <FB Draw HLine> with ID[3]
unsigned short int in_3_3=0;
//Inputs/Outputs: Block: <FB Put Int> with ID[9]
int in_1_9=0;
//Inputs/Outputs: Block: <FB Put Int> with ID[19]
int in_1_19=0;
//Inputs/Outputs: Block: <Right Shift> with ID[26]
int in_0_26=0;
int out_1_26=0;
//Inputs/Outputs: Block: <FB Draw HLine> with ID[12]
unsigned short int in_3_12=0;
//Inputs/Outputs: Block: <FB Put Int> with ID[20]
int in_1_20=0;
//Inputs/Outputs: Block: <Right Shift> with ID[27]
int in_0_27=0;
int out_1_27=0;
//Inputs/Outputs: Block: <FB Draw HLine> with ID[13]
unsigned short int in_3_13=0;
//Inputs/Outputs: Block: <FB Put Int> with ID[21]
int in_1_21=0;
//Inputs/Outputs: Block: <Right Shift> with ID[28]
int in_0_28=0;
int out_1_28=0;
//Inputs/Outputs: Block: <FB Draw HLine> with ID[14]
unsigned short int in_3_14=0;
//Inputs/Outputs: Block: <FB Print Line> with ID[29]
//Inputs/Outputs: Block: <FB Print Line> with ID[30]
//Inputs/Outputs: Block: <FB Print Line> with ID[31]
//Inputs/Outputs: Block: <FB Print Line> with ID[32]
//Inputs/Outputs: Block: <FB Print Line> with ID[33]
//Inputs/Outputs: Block: <FB Print Line> with ID[34]
do
{
FB_Print_Line38 ();
FB_Print_Line37 ();
FB_Print_Line36 ();
FB_Print_Line35 ();
FB_Print_Line10 ();
Constant_Bool1 ( out_3_1);
in_6_5 = out_3_1;
FB_Print_Line2 ();
ADC_Eight7 ( out_8_7, out_7_7, out_6_7, out_5_7, out_4_7, out_3_7, out_2_7, out_1_7);
in_0_25 = out_5_7;
Right_Shift25 ( in_0_25, out_1_25);
in_3_11 = out_1_25;
FB_Draw_HLine11 ( in_3_11);
in_1_18 = out_5_7;
FB_Put_Int18 ( in_1_18);
in_0_24 = out_4_7;
Right_Shift24 ( in_0_24, out_1_24);
in_3_6 = out_1_24;
FB_Draw_HLine6 ( in_3_6);
in_1_17 = out_4_7;
FB_Put_Int17 ( in_1_17);
in_0_23 = out_3_7;
Right_Shift23 ( in_0_23, out_1_23);
in_3_4 = out_1_23;
FB_Draw_HLine4 ( in_3_4);
in_1_16 = out_3_7;
FB_Put_Int16 ( in_1_16);
in_0_22 = out_2_7;
Right_Shift22 ( in_0_22, out_1_22);
in_3_0 = out_1_22;
FB_Draw_HLine0 ( in_3_0);
in_1_15 = out_2_7;
FB_Put_Int15 ( in_1_15);
in_0_8 = out_1_7;
Right_Shift8 ( in_0_8, out_1_8);
in_3_3 = out_1_8;
FB_Draw_HLine3 ( in_3_3);
in_1_9 = out_1_7;
FB_Put_Int9 ( in_1_9);
in_1_19 = out_6_7;
FB_Put_Int19 ( in_1_19);
in_0_26 = out_6_7;
Right_Shift26 ( in_0_26, out_1_26);
in_3_12 = out_1_26;
FB_Draw_HLine12 ( in_3_12);
in_1_20 = out_7_7;
FB_Put_Int20 ( in_1_20);
in_0_27 = out_7_7;
Right_Shift27 ( in_0_27, out_1_27);
in_3_13 = out_1_27;
FB_Draw_HLine13 ( in_3_13);
in_1_21 = out_8_7;
FB_Put_Int21 ( in_1_21);
in_0_28 = out_8_7;
Right_Shift28 ( in_0_28, out_1_28);
in_3_14 = out_1_28;
FB_Draw_HLine14 ( in_3_14);
FB_Print_Line29 ();
FB_Print_Line30 ();
FB_Print_Line31 ();
FB_Print_Line32 ();
FB_Print_Line33 ();
FB_Print_Line34 ();
firstLoop=0;
}while(in_6_5);
return 0;
}

Binary file not shown.