Browse Source

Adding support for NIOS-II platform

remotes/origin_old/ugfx_release_2.6
Joel Bodenmann 7 years ago
parent
commit
eaf0b19fb8
  1. 1
      docs/releases.txt
  2. 1
      gfxconf.example.h
  3. 2
      src/gos/gos.h
  4. 1
      src/gos/gos.mk
  5. 1
      src/gos/gos_mk.c
  6. 64
      src/gos/gos_nios.c
  7. 44
      src/gos/gos_nios.h
  8. 7
      src/gos/gos_options.h
  9. 4
      src/gos/gos_rules.h

1
docs/releases.txt

@ -26,6 +26,7 @@ FIX: Fixing issue in touchscreen calibration code
FEATURE: Added GFX_OS_PRE_INIT_FUNCTION for early hardware initialization
FIX: Fixing GTIMER for high clock rate devices
FEATURE: Added GFX_COMPILER_KEIL and GFX_COMPILER_ARMCC macros
FEATURE: Added support for NIOS-II platform
*** Release 2.3 ***

1
gfxconf.example.h

@ -38,6 +38,7 @@
//#define GFX_USE_OS_KEIL FALSE
//#define GFX_USE_OS_CMSIS FALSE
//#define GFX_USE_OS_RAW32 FALSE
//#define GFX_USE_OS_NIOS FALSE
// #define INTERRUPTS_OFF() optional_code
// #define INTERRUPTS_ON() optional_code

2
src/gos/gos.h

@ -478,6 +478,8 @@
#include "gos_cmsis.h"
#elif GFX_USE_OS_KEIL
#include "gos_keil.h"
#elif GFX_USE_OS_NIOS
#include "gos_nios.h"
#else
#error "Your operating system is not supported yet"
#endif

1
src/gos/gos.mk

@ -13,6 +13,7 @@ GFXSRC += $(GFXLIB)/src/gos/gos_chibios.c \
$(GFXLIB)/src/gos/gos_rawrtos.c \
$(GFXLIB)/src/gos/gos_arduino.c \
$(GFXLIB)/src/gos/gos_cmsis.c \
$(GFXLIB)/src/gos/gos_nios.c \
$(GFXLIB)/src/gos/gos_x_threads.c \
$(GFXLIB)/src/gos/gos_x_heap.c

1
src/gos/gos_mk.c

@ -15,5 +15,6 @@
#include "gos_rawrtos.c"
#include "gos_win32.c"
#include "gos_cmsis.c"
#include "gos_nios.c"
#include "gos_x_threads.c"
#include "gos_x_heap.c"

64
src/gos/gos_nios.c

@ -0,0 +1,64 @@
/*
* This file is subject to the terms of the GFX License. If a copy of
* the license was not distributed with this file, you can obtain one at:
*
* http://ugfx.org/license.html
*/
#include "../../gfx.h"
#if GFX_USE_OS_NIOS
void _gosHeapInit(void);
void _gosThreadsInit(void);
/*********************************************************
* Initialise
*********************************************************/
void _gosInit(void)
{
// Set up the heap allocator
_gosHeapInit();
// Start the scheduler
_gosThreadsInit();
}
void _gosDeinit(void)
{
}
void gfxHalt(const char *msg)
{
volatile uint32_t dummy;
(void)msg;
while(1) {
dummy++;
}
}
void gfxExit(void) {
volatile uint32_t dummy;
while(1) {
dummy++;
}
}
#include <stdio.h>
systemticks_t gfxSystemTicks(void)
{
volatile alt_u32 ticks = alt_nticks();
printf("Ticks: %d\r\n", ticks);
return ticks;
}
systemticks_t gfxMillisecondsToTicks(delaytime_t ms)
{
return ms;
}
#endif /* GFX_USE_OS_NIOS */

44
src/gos/gos_nios.h

@ -0,0 +1,44 @@
/*
* This file is subject to the terms of the GFX License. If a copy of
* the license was not distributed with this file, you can obtain one at:
*
* http://ugfx.org/license.html
*/
#ifndef _GOS_NIOS_H
#define _GOS_NIOS_H
#if GFX_USE_OS_NIOS
#include <stdint.h>
#include <stddef.h>
#include <stdbool.h>
#include <sys/alt_alarm.h>
typedef alt_u32 systemticks_t;
typedef alt_u32 delaytime_t;
typedef unsigned char bool_t;
#ifdef __cplusplus
extern "C" {
#endif
void gfxHalt(const char* msg);
void gfxExit(void);
systemticks_t gfxSystemTicks(void);
systemticks_t gfxMillisecondsToTicks(delaytime_t ms);
#ifdef __cplusplus
}
#endif
// Use the generic thread handling and heap handling
#define GOS_NEED_X_THREADS TRUE
#define GOS_NEED_X_HEAP TRUE
#include "gos_x_threads.h"
#include "gos_x_heap.h"
#endif /* GFX_USE_OS_NIOS */
#endif /* _GOS_NIOS_H */

7
src/gos/gos_options.h

@ -97,6 +97,13 @@
#ifndef GFX_USE_OS_KEIL
#define GFX_USE_OS_KEIL FALSE
#endif
/**
* @brief Use NIOS-II
* @details Defaults to FALSE
*/
#ifndef GFX_USE_OS_NIOS
#define GFX_USE_OS_NIOS FALSE
#endif
/**
* @}
*

4
src/gos/gos_rules.h

@ -16,7 +16,7 @@
#ifndef _GOS_RULES_H
#define _GOS_RULES_H
#if !GFX_USE_OS_CHIBIOS && !GFX_USE_OS_WIN32 && !GFX_USE_OS_LINUX && !GFX_USE_OS_OSX && !GFX_USE_OS_RAW32 && !GFX_USE_OS_FREERTOS && !GFX_USE_OS_ECOS && !GFX_USE_OS_RAWRTOS && !GFX_USE_OS_ARDUINO && !GFX_USE_OS_CMSIS && !GFX_USE_OS_KEIL
#if !GFX_USE_OS_CHIBIOS && !GFX_USE_OS_WIN32 && !GFX_USE_OS_LINUX && !GFX_USE_OS_OSX && !GFX_USE_OS_RAW32 && !GFX_USE_OS_FREERTOS && !GFX_USE_OS_ECOS && !GFX_USE_OS_RAWRTOS && !GFX_USE_OS_ARDUINO && !GFX_USE_OS_CMSIS && !GFX_USE_OS_KEIL && !GFX_USE_OS_NIOS
#if GFX_DISPLAY_RULE_WARNINGS
#warning "GOS: No Operating System has been defined. ChibiOS (GFX_USE_OS_CHIBIOS) has been turned on for you."
#endif
@ -24,7 +24,7 @@
#define GFX_USE_OS_CHIBIOS TRUE
#endif
#if GFX_USE_OS_CHIBIOS + GFX_USE_OS_WIN32 + GFX_USE_OS_LINUX + GFX_USE_OS_OSX + GFX_USE_OS_RAW32 + GFX_USE_OS_FREERTOS + GFX_USE_OS_ECOS + GFX_USE_OS_RAWRTOS + GFX_USE_OS_ARDUINO + GFX_USE_OS_CMSIS + GFX_USE_OS_KEIL != 1 * TRUE
#if GFX_USE_OS_CHIBIOS + GFX_USE_OS_WIN32 + GFX_USE_OS_LINUX + GFX_USE_OS_OSX + GFX_USE_OS_RAW32 + GFX_USE_OS_FREERTOS + GFX_USE_OS_ECOS + GFX_USE_OS_RAWRTOS + GFX_USE_OS_ARDUINO + GFX_USE_OS_CMSIS + GFX_USE_OS_KEIL + GFX_USE_OS_NIOS != 1 * TRUE
#error "GOS: More than one operation system has been defined as TRUE."
#endif

Loading…
Cancel
Save