A WHOLE 1.5 FPS!!
This commit is contained in:
1 parent
5567984cad
commit
9f6f0399e7
6 files changed
+24
-30
No files matched your search
+9
-5
@@ -48,19 +48,23 @@ set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -nostartfiles" )
|
||||
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -I src/includes/" )
|
||||
|
||||
# Set the linker flags so that we use our "custom" linker script
|
||||
set( CMAKE_EXE_LINKER_FLAGS "-Wl,-T,src/CMakeLinker.x" )
|
||||
set( CMAKE_EXE_LINKER_FLAGS " -Wl,-T,src/CMakeLinker.x" )
|
||||
|
||||
AUX_SOURCE_DIRECTORY(src source)
|
||||
AUX_SOURCE_DIRECTORY(src/includes/kernel kernelIncludes)
|
||||
AUX_SOURCE_DIRECTORY(src/includes/rpi rpiIncludes)
|
||||
file(GLOB source "src/*.[s|c]")
|
||||
file(GLOB kernelIncludes "src/includes/kernel/*")
|
||||
file(GLOB rpiIncludes "src/includes/rpi/*")
|
||||
|
||||
add_executable( ${TARGET_BUILD}
|
||||
src/armStart.S
|
||||
src/armStart.s
|
||||
${source}
|
||||
${kernelIncludes}
|
||||
${rpiIncludes}
|
||||
)
|
||||
|
||||
target_link_libraries( ${TARGET_BUILD}
|
||||
PUBLIC "m"
|
||||
)
|
||||
|
||||
set_target_properties( ${TARGET_BUILD}
|
||||
PROPERTIES
|
||||
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
|
||||
|
||||
+1
-1
@@ -138,7 +138,7 @@ _reset_:
|
||||
// The c-startup function which we never return from. This function will
|
||||
// initialise the ro data section (most things that have the const
|
||||
// declaration) and initialise the bss section variables to 0 (generally
|
||||
// known as automatics). It'll then call main, which should never return.
|
||||
// known as automatics). It willll then call main, which should never return.
|
||||
bl _cstartup
|
||||
|
||||
// If main does return for some reason, just catch it and stay here.
|
||||
|
||||
@@ -40,20 +40,6 @@ void setColor(volatile unsigned char* fb, colour_t pixel, long x, long y, long p
|
||||
}
|
||||
}
|
||||
|
||||
double sin(double x)
|
||||
{
|
||||
double x2 = x * x;
|
||||
if (x < PI)
|
||||
return (((((-0.0000000205342856289746600727*x2 + 0.00000270405218307799040084)*x2 - 0.000198125763417806681909)*x2 + 0.00833255814755188010464)*x2 - 0.166665772196961623983)*x2 + 0.999999707044156546685)*x;
|
||||
|
||||
else if (x <= PI * 2) return (-sin(x - PI));
|
||||
|
||||
while (x > PI * 2)
|
||||
x -= PI * 2;
|
||||
|
||||
return sin(x);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -6,9 +6,8 @@ arm-016-util.h
|
||||
#ifndef RPI_UTIL_H
|
||||
#define RPI_UTIL_H
|
||||
|
||||
#define PI 3.14159265359
|
||||
#define SCREEN_WIDTH 1920
|
||||
#define SCREEN_HEIGHT 1080
|
||||
#define SCREEN_WIDTH 640
|
||||
#define SCREEN_HEIGHT 480
|
||||
#define SCREEN_DEPTH 24 /* 16 or 32-bit */
|
||||
|
||||
#define COLOUR_DELTA 0.05 /* Float from 0 to 1 incremented by this amount */
|
||||
@@ -22,6 +21,5 @@ typedef struct {
|
||||
|
||||
|
||||
extern void setColor(volatile unsigned char* fb, colour_t pixel, long x, long y, long pitch);
|
||||
extern double sin(double in);
|
||||
|
||||
#endif
|
||||
@@ -47,7 +47,4 @@ typedef volatile uint64_t rpi_wreg_rw_t;
|
||||
typedef volatile const uint64_t rpi_wreg_ro_t;
|
||||
|
||||
|
||||
int GET32(int index);
|
||||
void PUT32(int index, int value);
|
||||
|
||||
#endif
|
||||
+12
-3
@@ -31,6 +31,7 @@
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
|
||||
#include "rpi/aux.h"
|
||||
#include "rpi/armtimer.h"
|
||||
@@ -186,13 +187,21 @@ void kernel_main( unsigned int r0, unsigned int r1, unsigned int atags )
|
||||
|
||||
while( 1 )
|
||||
{
|
||||
t += 0.014;
|
||||
t += 0.02;
|
||||
|
||||
/*
|
||||
y = 50;
|
||||
x = 0;
|
||||
|
||||
y = 5 * (cos(x) + sin(x))
|
||||
*/
|
||||
|
||||
/* Produce a colour spread across the screen */
|
||||
for( y = 0; y < height; y++ )
|
||||
{
|
||||
// current_colour.r += ( 1.0 / height );
|
||||
|
||||
if (y > 120 && y < 365)
|
||||
for( x = 0; x < width; x++ )
|
||||
{
|
||||
pixel_offset = ( x * ( bpp >> 3 ) ) + ( y * pitch );
|
||||
@@ -204,9 +213,9 @@ void kernel_main( unsigned int r0, unsigned int r1, unsigned int atags )
|
||||
|
||||
x_float = ((float)x)/(float)SCREEN_WIDTH;
|
||||
y_float = 1 - ((2 * (float)y) / (float)SCREEN_HEIGHT);
|
||||
sinTest = sin(x_float * 4 * 3.14159265 + t);
|
||||
sinTest = sin(x_float * 4 * M_PI + t);
|
||||
|
||||
if ( sinTest / 2 > y_float && ((sinTest - 0.014) / 2 < y_float)) {
|
||||
if ( sinTest / 2 > y_float && ((sinTest - 0.05) / 2 < y_float)) {
|
||||
fb[ pixel_offset++ ] = r;
|
||||
fb[ pixel_offset++ ] = g;
|
||||
fb[ pixel_offset++ ] = b;
|
||||
|
||||
Reference in new issue
Block a user