Merge branch 'master' of https://git.ugfx.io/uGFX/uGFX
This commit is contained in:
commit
bde1f0d2eb
8 changed files with 535 additions and 124 deletions
|
@ -17,7 +17,7 @@ FIX: Fixing and improving arc rendering functions
|
|||
FIX: Preventing possible crash when no valid GWIN default font has been set
|
||||
FIX: Updating Windows binaries of the font encoder to improve compatibility
|
||||
FIX: Fixed progressbar bounds checking and decrementing
|
||||
FEATURE: Added a dual circle with the same center drawing routine to GDISP
|
||||
FEATURE: Added gdispFillDualCircle()
|
||||
FIX: Fixed an issue in the filled polygon drawing function which caused irregularities
|
||||
FEATURE: Added high-level functions to modify image color palettes
|
||||
FIX: Improving gdispDrawThickLine()
|
||||
|
@ -25,6 +25,9 @@ FEATURE: Added gdispAddFont() for adding a dynamic font to the permanent font li
|
|||
FEATURE: Added gmiscHittestPoly() for checking whether a point is inside of a polygon
|
||||
FIX: Fixed strange multi-thread issues in GEVENT
|
||||
FEATURE: Added ILI9488 driver
|
||||
FEATURE: Added the ability to display the detected compiler
|
||||
FIX: Fixed an illegal instruction in the Cortex M0 task switcher
|
||||
FEATURE: Add support for the Keil compiler for RAW32 task switching for Cortex M0,1,3,4,7
|
||||
|
||||
|
||||
*** Release 2.6 ***
|
||||
|
|
|
@ -46,6 +46,7 @@
|
|||
// Options that (should where relevant) apply to all operating systems
|
||||
// #define GFX_NO_INLINE FALSE
|
||||
// #define GFX_COMPILER GFX_COMPILER_UNKNOWN
|
||||
// #define GFX_SHOW_COMPILER FALSE
|
||||
// #define GFX_CPU GFX_CPU_UNKNOWN
|
||||
// #define GFX_CPU_NO_ALIGNMENT_FAULTS FALSE
|
||||
// #define GFX_CPU_ENDIAN GFX_CPU_ENDIAN_UNKNOWN
|
||||
|
|
|
@ -38,6 +38,13 @@
|
|||
#define GFXINLINE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Show which compiler we detected as a compiler warning message
|
||||
*/
|
||||
#ifndef GFX_SHOW_COMPILER
|
||||
#define GFX_SHOW_COMPILER FALSE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Enable compiler specific code
|
||||
* @details Auto detected by default but it can be overridden in gfxconf.h
|
||||
|
@ -285,8 +292,14 @@
|
|||
#undef GFX_COMPILER_VERSION_PATCH
|
||||
#undef GFX_COMPILER_VERSION_BUILD
|
||||
#if GFX_COMPILER == GFX_COMPILER_ACC
|
||||
#if GFX_SHOW_COMPILER && GFX_DISPLAY_RULE_WARNINGS
|
||||
#warning "Compiler: ACC"
|
||||
#endif
|
||||
#define GFX_COMPILER_NAME "ACC"
|
||||
#elif GFX_COMPILER == GFX_COMPILER_ALTIUM
|
||||
#if GFX_SHOW_COMPILER && GFX_DISPLAY_RULE_WARNINGS
|
||||
#warning "Compiler: ALTIUM"
|
||||
#endif
|
||||
#define GFX_COMPILER_NAME "Altium MicroBlaze C"
|
||||
#ifdef __BUILD__
|
||||
#define GFX_COMPILER_VERSION_MAJOR ((__BUILD__)/1000000)
|
||||
|
@ -298,6 +311,9 @@
|
|||
#define GFX_COMPILER_VERSION_PATCH (__REVISION__)
|
||||
#endif
|
||||
#elif GFX_COMPILER == GFX_COMPILER_ALTIUMHW
|
||||
#if GFX_SHOW_COMPILER && GFX_DISPLAY_RULE_WARNINGS
|
||||
#warning "Compiler: ALTIUMHW"
|
||||
#endif
|
||||
#define GFX_COMPILER_NAME "Altium C-to-Hardware"
|
||||
#ifdef __BUILD__
|
||||
#define GFX_COMPILER_VERSION_MAJOR ((__BUILD__)/1000000)
|
||||
|
@ -309,8 +325,14 @@
|
|||
#define GFX_COMPILER_VERSION_PATCH (__REVISION__)
|
||||
#endif
|
||||
#elif GFX_COMPILER == GFX_COMPILER_AMSTERDAM
|
||||
#if GFX_SHOW_COMPILER && GFX_DISPLAY_RULE_WARNINGS
|
||||
#warning "Compiler: AMSTERDAM"
|
||||
#endif
|
||||
#define GFX_COMPILER_NAME "Amsterdam Compiler Kit"
|
||||
#elif GFX_COMPILER == GFX_COMPILER_ARMCC
|
||||
#if GFX_SHOW_COMPILER && GFX_DISPLAY_RULE_WARNINGS
|
||||
#warning "Compiler: ARMCC"
|
||||
#endif
|
||||
#define GFX_COMPILER_NAME "ARMCC"
|
||||
#define GFX_COMPILER_VERSION_MAJOR ((__ARMCC_VERSION)/100000)
|
||||
#define GFX_COMPILER_VERSION_MINOR (((__ARMCC_VERSION)/10000)%10)
|
||||
|
@ -318,19 +340,31 @@
|
|||
#define GFX_COMPILER_VERSION_BUILD ((__ARMCC_VERSION)%1000)
|
||||
#define __LITTLE_IF_NOT_BIG__ // Oops - Defines __BIG_ENDIAN but not __LITTLE_ENDIAN
|
||||
#elif GFX_COMPILER == GFX_COMPILER_AZTEC
|
||||
#if GFX_SHOW_COMPILER && GFX_DISPLAY_RULE_WARNINGS
|
||||
#warning "Compiler: AZTEC"
|
||||
#endif
|
||||
#define GFX_COMPILER_NAME "Aztec"
|
||||
#define GFX_COMPILER_VERSION_MAJOR ((__VERSION)/100)
|
||||
#define GFX_COMPILER_VERSION_MINOR ((__VERSION)%100)
|
||||
#elif GFX_COMPILER == GFX_COMPILER_BORLAND
|
||||
#if GFX_SHOW_COMPILER && GFX_DISPLAY_RULE_WARNINGS
|
||||
#warning "Compiler: BORLAND"
|
||||
#endif
|
||||
#define GFX_COMPILER_NAME "Borland C++"
|
||||
#define GFX_COMPILER_VERSION_MAJOR ((__BORLANDC__)/0x100)
|
||||
#define GFX_COMPILER_VERSION_MINOR (((((__BORLANDC__)%0x100)/0x10)*10) + ((__BORLANDC__)%0x10))
|
||||
#elif GFX_COMPILER == GFX_COMPILER_CC65
|
||||
#if GFX_SHOW_COMPILER && GFX_DISPLAY_RULE_WARNINGS
|
||||
#warning "Compiler: CC65"
|
||||
#endif
|
||||
#define GFX_COMPILER_NAME "CC65"
|
||||
#define GFX_COMPILER_VERSION_MAJOR ((__CC65__)/0x100)
|
||||
#define GFX_COMPILER_VERSION_MINOR (((__CC65__)/0x10)%0x10)
|
||||
#define GFX_COMPILER_VERSION_PATCH ((__CC65__)%0x10)
|
||||
#elif GFX_COMPILER == GFX_COMPILER_CLANG
|
||||
#if GFX_SHOW_COMPILER && GFX_DISPLAY_RULE_WARNINGS
|
||||
#warning "Compiler: CLANG"
|
||||
#endif
|
||||
#define GFX_COMPILER_NAME "CLang (LLVM)"
|
||||
#define GFX_COMPILER_TESTED TRUE
|
||||
#define GFX_COMPILER_VERSION_MAJOR (__clang_major__)
|
||||
|
@ -338,23 +372,41 @@
|
|||
#define GFX_COMPILER_VERSION_PATCH (__clang_patchlevel__)
|
||||
#define DEPRECATED(msg) __attribute__((deprecated(msg)))
|
||||
#elif GFX_COMPILER == GFX_COMPILER_COMEAU
|
||||
#if GFX_SHOW_COMPILER && GFX_DISPLAY_RULE_WARNINGS
|
||||
#warning "Compiler: COMEAU"
|
||||
#endif
|
||||
#define GFX_COMPILER_NAME "Comeau C++"
|
||||
#define GFX_COMPILER_VERSION_MAJOR ((__COMO_VERSION__)/100)
|
||||
#define GFX_COMPILER_VERSION_MINOR ((__COMO_VERSION__)%100)
|
||||
#elif GFX_COMPILER == GFX_COMPILER_COMPAQ
|
||||
#if GFX_SHOW_COMPILER && GFX_DISPLAY_RULE_WARNINGS
|
||||
#warning "Compiler: COMPAQ"
|
||||
#endif
|
||||
#define GFX_COMPILER_NAME "Compaq C"
|
||||
#define GFX_COMPILER_VERSION_MAJOR ((__DECC_VER)/10000000)
|
||||
#define GFX_COMPILER_VERSION_MINOR (((__DECC_VER)/100000)%100)
|
||||
#define GFX_COMPILER_VERSION_PATCH ((__DECC_VER)%10000)
|
||||
#elif GFX_COMPILER == GFX_COMPILER_COMPCERT
|
||||
#if GFX_SHOW_COMPILER && GFX_DISPLAY_RULE_WARNINGS
|
||||
#warning "Compiler: COMPCERT"
|
||||
#endif
|
||||
#define GFX_COMPILER_NAME "Compcert"
|
||||
#elif GFX_COMPILER == GFX_COMPILER_CONVEX
|
||||
#if GFX_SHOW_COMPILER && GFX_DISPLAY_RULE_WARNINGS
|
||||
#warning "Compiler: CONVEX"
|
||||
#endif
|
||||
#define GFX_COMPILER_NAME "Convex C"
|
||||
#elif GFX_COMPILER == GFX_COMPILER_CRAY
|
||||
#if GFX_SHOW_COMPILER && GFX_DISPLAY_RULE_WARNINGS
|
||||
#warning "Compiler: CRAY"
|
||||
#endif
|
||||
#define GFX_COMPILER_NAME "Cray C/C++"
|
||||
#define GFX_COMPILER_VERSION_MAJOR (_RELEASE)
|
||||
#define GFX_COMPILER_VERSION_MINOR (_RELEASE_MINOR)
|
||||
#elif GFX_COMPILER == GFX_COMPILER_CYGWIN
|
||||
#if GFX_SHOW_COMPILER && GFX_DISPLAY_RULE_WARNINGS
|
||||
#warning "Compiler: CYGWIN"
|
||||
#endif
|
||||
#define GFX_COMPILER_NAME "Cygwin"
|
||||
#define GFX_COMPILER_TESTED TRUE
|
||||
#define GFX_COMPILER_VERSION_MAJOR (__GNUC__)
|
||||
|
@ -364,20 +416,35 @@
|
|||
#endif
|
||||
#define DEPRECATED(msg) __attribute__((deprecated(msg)))
|
||||
#elif GFX_COMPILER == GFX_COMPILER_DAIB
|
||||
#if GFX_SHOW_COMPILER && GFX_DISPLAY_RULE_WARNINGS
|
||||
#warning "Compiler: DAIB"
|
||||
#endif
|
||||
#define GFX_COMPILER_NAME "Diab C/C++"
|
||||
#define GFX_COMPILER_VERSION_MAJOR ((__VERSION_NUMBER__)/1000)
|
||||
#define GFX_COMPILER_VERSION_MINOR (((__VERSION_NUMBER__)/100)%10)
|
||||
#define GFX_COMPILER_VERSION_PATCH ((__VERSION_NUMBER__)%100)
|
||||
#elif GFX_COMPILER == GFX_COMPILER_DEC
|
||||
#if GFX_SHOW_COMPILER && GFX_DISPLAY_RULE_WARNINGS
|
||||
#warning "Compiler: DEC"
|
||||
#endif
|
||||
#define GFX_COMPILER_NAME "DEC"
|
||||
#elif GFX_COMPILER == GFX_COMPILER_DICE
|
||||
#if GFX_SHOW_COMPILER && GFX_DISPLAY_RULE_WARNINGS
|
||||
#warning "Compiler: DICE"
|
||||
#endif
|
||||
#define GFX_COMPILER_NAME "DICE C"
|
||||
#elif GFX_COMPILER == GFX_COMPILER_DIGNUS
|
||||
#if GFX_SHOW_COMPILER && GFX_DISPLAY_RULE_WARNINGS
|
||||
#warning "Compiler: DIGNUS"
|
||||
#endif
|
||||
#define GFX_COMPILER_NAME "Dignus Systems C++"
|
||||
#define GFX_COMPILER_VERSION_MAJOR ((__SYSC_VER__)/10000)
|
||||
#define GFX_COMPILER_VERSION_MINOR (((__SYSC_VER__)/100)%100)
|
||||
#define GFX_COMPILER_VERSION_PATCH ((__SYSC_VER__)%100)
|
||||
#elif GFX_COMPILER == GFX_COMPILER_DJGPP
|
||||
#if GFX_SHOW_COMPILER && GFX_DISPLAY_RULE_WARNINGS
|
||||
#warning "Compiler: DJGPP"
|
||||
#endif
|
||||
#define GFX_COMPILER_NAME "DJGPP"
|
||||
#ifdef __DJGPP__
|
||||
#define GFX_COMPILER_VERSION_MAJOR (__DJGPP__)
|
||||
|
@ -386,11 +453,17 @@
|
|||
#define GFX_COMPILER_VERSION_MAJOR (1)
|
||||
#endif
|
||||
#elif GFX_COMPILER == GFX_COMPILER_DMARS
|
||||
#if GFX_SHOW_COMPILER && GFX_DISPLAY_RULE_WARNINGS
|
||||
#warning "Compiler: DMARS"
|
||||
#endif
|
||||
#define GFX_COMPILER_NAME "Digital Mars"
|
||||
#define GFX_COMPILER_VERSION_MAJOR ((__DMC__)/0x100)
|
||||
#define GFX_COMPILER_VERSION_MINOR (((__DMC__)/0x10)%0x10)
|
||||
#define GFX_COMPILER_VERSION_PATCH ((__DMC__)%0x10)
|
||||
#elif GFX_COMPILER == GFX_COMPILER_EDG
|
||||
#if GFX_SHOW_COMPILER && GFX_DISPLAY_RULE_WARNINGS
|
||||
#warning "Compiler: EDG"
|
||||
#endif
|
||||
#define GFX_COMPILER_NAME "EDG C++"
|
||||
#define GFX_COMPILER_TESTED TRUE
|
||||
#define GFX_COMPILER_VERSION_MAJOR ((__EDG_VERSION__)/100)
|
||||
|
@ -403,13 +476,22 @@
|
|||
#pragma diag_remark = Pe068
|
||||
#pragma diag_remark = Pa050
|
||||
#elif GFX_COMPILER == GFX_COMPILER_EKOPATH
|
||||
#if GFX_SHOW_COMPILER && GFX_DISPLAY_RULE_WARNINGS
|
||||
#warning "Compiler: EKOPATH"
|
||||
#endif
|
||||
#define GFX_COMPILER_NAME "EKOPath"
|
||||
#define GFX_COMPILER_VERSION_MAJOR (__PATHCC__)
|
||||
#define GFX_COMPILER_VERSION_MINOR (__PATHCC_MINOR__)
|
||||
#define GFX_COMPILER_VERSION_PATCH (__PATHCC_PATCHLEVEL__)
|
||||
#elif GFX_COMPILER == GFX_COMPILER_FUJITSU
|
||||
#if GFX_SHOW_COMPILER && GFX_DISPLAY_RULE_WARNINGS
|
||||
#warning "Compiler: FUJITSU"
|
||||
#endif
|
||||
#define GFX_COMPILER_NAME "Fujitsu C++"
|
||||
#elif GFX_COMPILER == GFX_COMPILER_GCC
|
||||
#if GFX_SHOW_COMPILER && GFX_DISPLAY_RULE_WARNINGS
|
||||
#warning "Compiler: GCC"
|
||||
#endif
|
||||
#define GFX_COMPILER_NAME "GCC"
|
||||
#define GFX_COMPILER_TESTED TRUE
|
||||
#define GFX_COMPILER_VERSION_MAJOR (__GNUC__)
|
||||
|
@ -419,13 +501,22 @@
|
|||
#endif
|
||||
#define DEPRECATED(msg) __attribute__((deprecated(msg)))
|
||||
#elif GFX_COMPILER == GFX_COMPILER_GREENHILL
|
||||
#if GFX_SHOW_COMPILER && GFX_DISPLAY_RULE_WARNINGS
|
||||
#warning "Compiler: GREENHILL"
|
||||
#endif
|
||||
#define GFX_COMPILER_NAME "Green Hill C/C++"
|
||||
#define GFX_COMPILER_VERSION_MAJOR ((__GHS_VERSION_NUMBER__)/100)
|
||||
#define GFX_COMPILER_VERSION_MINOR (((__GHS_VERSION_NUMBER__)/10)%10)
|
||||
#define GFX_COMPILER_VERSION_PATCH ((__GHS_VERSION_NUMBER__)%10)
|
||||
#elif GFX_COMPILER == GFX_COMPILER_HIGHC
|
||||
#if GFX_SHOW_COMPILER && GFX_DISPLAY_RULE_WARNINGS
|
||||
#warning "Compiler: HIGHC"
|
||||
#endif
|
||||
#define GFX_COMPILER_NAME "Metaware High C/C++"
|
||||
#elif GFX_COMPILER == GFX_COMPILER_HP
|
||||
#if GFX_SHOW_COMPILER && GFX_DISPLAY_RULE_WARNINGS
|
||||
#warning "Compiler: HP"
|
||||
#endif
|
||||
#define GFX_COMPILER_NAME "HP C/aC++"
|
||||
#ifdef __HP_aCC
|
||||
#if __HP_aCC == 1
|
||||
|
@ -438,6 +529,9 @@
|
|||
#endif
|
||||
#endif
|
||||
#elif GFX_COMPILER == GFX_COMPILER_IAR
|
||||
#if GFX_SHOW_COMPILER && GFX_DISPLAY_RULE_WARNINGS
|
||||
#warning "Compiler: IAR"
|
||||
#endif
|
||||
#define GFX_COMPILER_NAME "IAR C++"
|
||||
#define GFX_COMPILER_TESTED TRUE
|
||||
#define GFX_COMPILER_VERSION_MAJOR ((__VER__)/100)
|
||||
|
@ -450,6 +544,9 @@
|
|||
#pragma diag_remark = Pe068
|
||||
#pragma diag_remark = Pa050
|
||||
#elif GFX_COMPILER == GFX_COMPILER_IBMXL
|
||||
#if GFX_SHOW_COMPILER && GFX_DISPLAY_RULE_WARNINGS
|
||||
#warning "Compiler: IBMXL"
|
||||
#endif
|
||||
#define GFX_COMPILER_NAME "IBM XL C/C++"
|
||||
#ifdef __xlC__
|
||||
#define GFX_COMPILER_VERSION_MAJOR ((__xlC__)/0x100)
|
||||
|
@ -470,8 +567,14 @@
|
|||
#define GFX_COMPILER_VERSION_PATCH ((__IBMCPP__)%10)
|
||||
#endif
|
||||
#elif GFX_COMPILER == GFX_COMPILER_IMAGECRAFT
|
||||
#if GFX_SHOW_COMPILER && GFX_DISPLAY_RULE_WARNINGS
|
||||
#warning "Compiler: IMAGECRAFT"
|
||||
#endif
|
||||
#define GFX_COMPILER_NAME "Imagecraft C"
|
||||
#elif GFX_COMPILER == GFX_COMPILER_INTEL
|
||||
#if GFX_SHOW_COMPILER && GFX_DISPLAY_RULE_WARNINGS
|
||||
#warning "Compiler: INTEL"
|
||||
#endif
|
||||
#define GFX_COMPILER_NAME "Intel ICC/ICPC"
|
||||
#ifdef __INTEL_COMPILER
|
||||
#define GFX_COMPILER_VERSION_MAJOR ((__INTEL_COMPILER)/100)
|
||||
|
@ -482,11 +585,17 @@
|
|||
#endif
|
||||
#endif
|
||||
#elif GFX_COMPILER == GFX_COMPILER_KAI
|
||||
#if GFX_SHOW_COMPILER && GFX_DISPLAY_RULE_WARNINGS
|
||||
#warning "Compiler: KAI"
|
||||
#endif
|
||||
#define GFX_COMPILER_NAME "Kai C++"
|
||||
#define GFX_COMPILER_VERSION_MAJOR ((__KCC_VERSION)/0x1000)
|
||||
#define GFX_COMPILER_VERSION_MINOR (((__KCC_VERSION)/0x100)%0x10)
|
||||
#define GFX_COMPILER_VERSION_PATCH ((__KCC_VERSION)%0x100)
|
||||
#elif GFX_COMPILER == GFX_COMPILER_KEIL
|
||||
#if GFX_SHOW_COMPILER && GFX_DISPLAY_RULE_WARNINGS
|
||||
#warning "Compiler: KEIL"
|
||||
#endif
|
||||
#define GFX_COMPILER_NAME "Keil"
|
||||
#define GFX_COMPILER_TESTED TRUE
|
||||
#if defined(__ARMCC_VERSION)
|
||||
|
@ -515,22 +624,38 @@
|
|||
#pragma diag_remark 83 // Turn off warning: type qualifier specified more than once
|
||||
#pragma diag_remark 767 // Turn off warning: conversion from pointer to smaller integer
|
||||
#pragma diag_remark 188 // Turn off warning: enumerated type mixed with another type
|
||||
#pragma diag_remark 68 // Turn off warning: integer conversion resulted in a change of sign
|
||||
#ifndef GFXINLINE // Get the Keil definition for inline
|
||||
#define GFXINLINE __inline
|
||||
#endif
|
||||
#define __LITTLE_IF_NOT_BIG__ // Oops - Defines __BIG_ENDIAN but not __LITTLE_ENDIAN
|
||||
#elif GFX_COMPILER == GFX_COMPILER_LCC
|
||||
#if GFX_SHOW_COMPILER && GFX_DISPLAY_RULE_WARNINGS
|
||||
#warning "Compiler: LCC"
|
||||
#endif
|
||||
#define GFX_COMPILER_NAME "LCC"
|
||||
#elif GFX_COMPILER == GFX_COMPILER_METROWORKS
|
||||
#if GFX_SHOW_COMPILER && GFX_DISPLAY_RULE_WARNINGS
|
||||
#warning "Compiler: METROWORKS"
|
||||
#endif
|
||||
#define GFX_COMPILER_NAME "Metroworks CodeWarrior"
|
||||
#define GFX_COMPILER_VERSION_MAJOR ((__MWERKS__)/0x1000)
|
||||
#define GFX_COMPILER_VERSION_MINOR (((__MWERKS__)/0x100)%0x10)
|
||||
#define GFX_COMPILER_VERSION_PATCH ((__MWERKS__)%100)
|
||||
#elif GFX_COMPILER == GFX_COMPILER_MICROTEC
|
||||
#if GFX_SHOW_COMPILER && GFX_DISPLAY_RULE_WARNINGS
|
||||
#warning "Compiler: MICROTEC"
|
||||
#endif
|
||||
#define GFX_COMPILER_NAME "Microtec C/C++"
|
||||
#elif GFX_COMPILER == GFX_COMPILER_MICROWAY
|
||||
#if GFX_SHOW_COMPILER && GFX_DISPLAY_RULE_WARNINGS
|
||||
#warning "Compiler: MICROWAY"
|
||||
#endif
|
||||
#define GFX_COMPILER_NAME "Microway NDP C"
|
||||
#elif GFX_COMPILER == GFX_COMPILER_MINGW32
|
||||
#if GFX_SHOW_COMPILER && GFX_DISPLAY_RULE_WARNINGS
|
||||
#warning "Compiler: MINGW32"
|
||||
#endif
|
||||
#define GFX_COMPILER_NAME "MingW32"
|
||||
#define GFX_COMPILER_TESTED TRUE
|
||||
#define GFX_COMPILER_VERSION_MAJOR (__GNUC__)
|
||||
|
@ -540,6 +665,9 @@
|
|||
#endif
|
||||
#define DEPRECATED(msg) __attribute__((deprecated(msg)))
|
||||
#elif GFX_COMPILER == GFX_COMPILER_MINGW64
|
||||
#if GFX_SHOW_COMPILER && GFX_DISPLAY_RULE_WARNINGS
|
||||
#warning "Compiler: MINGW64"
|
||||
#endif
|
||||
#define GFX_COMPILER_NAME "MingW64"
|
||||
#define GFX_COMPILER_VERSION_MAJOR (__GNUC__)
|
||||
#define GFX_COMPILER_VERSION_MINOR (__GNUC_MINOR__)
|
||||
|
@ -548,6 +676,9 @@
|
|||
#endif
|
||||
#define DEPRECATED(msg) __attribute__((deprecated(msg)))
|
||||
#elif GFX_COMPILER == GFX_COMPILER_MIPSPRO
|
||||
#if GFX_SHOW_COMPILER && GFX_DISPLAY_RULE_WARNINGS
|
||||
#warning "Compiler: MIPSPRO"
|
||||
#endif
|
||||
#define GFX_COMPILER_NAME "MIPS Pro"
|
||||
#ifdef _SGI_COMPILER_VERSION
|
||||
#define GFX_COMPILER_VERSION_MAJOR ((_SGI_COMPILER_VERSION)/100)
|
||||
|
@ -559,20 +690,38 @@
|
|||
#define GFX_COMPILER_VERSION_PATCH ((_COMPILER_VERSION)%10)
|
||||
#endif
|
||||
#elif GFX_COMPILER == GFX_COMPILER_MIRACLE
|
||||
#if GFX_SHOW_COMPILER && GFX_DISPLAY_RULE_WARNINGS
|
||||
#warning "Compiler: MIRACLE"
|
||||
#endif
|
||||
#define GFX_COMPILER_NAME "Miracle C"
|
||||
#elif GFX_COMPILER == GFX_COMPILER_MPW
|
||||
#if GFX_SHOW_COMPILER && GFX_DISPLAY_RULE_WARNINGS
|
||||
#warning "Compiler: MPW"
|
||||
#endif
|
||||
#define GFX_COMPILER_NAME "MPW C++"
|
||||
#define GFX_COMPILER_VERSION_MAJOR ((__MRC__)/0x100)
|
||||
#define GFX_COMPILER_VERSION_MINOR ((__MRC__)%0x100)
|
||||
#elif GFX_COMPILER == GFX_COMPILER_NORCROFT
|
||||
#if GFX_SHOW_COMPILER && GFX_DISPLAY_RULE_WARNINGS
|
||||
#warning "Compiler: NORCROFT"
|
||||
#endif
|
||||
#define GFX_COMPILER_NAME "Norcroft C"
|
||||
#elif GFX_COMPILER == GFX_COMPILER_NWCC
|
||||
#if GFX_SHOW_COMPILER && GFX_DISPLAY_RULE_WARNINGS
|
||||
#warning "Compiler: NWCC"
|
||||
#endif
|
||||
#define GFX_COMPILER_NAME "NWCC"
|
||||
#elif GFX_COMPILER == GFX_COMPILER_OPEN64
|
||||
#if GFX_SHOW_COMPILER && GFX_DISPLAY_RULE_WARNINGS
|
||||
#warning "Compiler: OPEN64"
|
||||
#endif
|
||||
#define GFX_COMPILER_NAME "Open64"
|
||||
#define GFX_COMPILER_VERSION_MAJOR (__OPENCC__)
|
||||
#define GFX_COMPILER_VERSION_MINOR (__OPENCC_MINOR__)
|
||||
#elif GFX_COMPILER == GFX_COMPILER_OSS
|
||||
#if GFX_SHOW_COMPILER && GFX_DISPLAY_RULE_WARNINGS
|
||||
#warning "Compiler: OSS"
|
||||
#endif
|
||||
#define GFX_COMPILER_NAME "Oracle Solaris Studio"
|
||||
#ifdef __SUNPRO_C >= 0x1000
|
||||
#define GFX_COMPILER_VERSION_MAJOR ((__SUNPRO_C)/0x1000)
|
||||
|
@ -584,23 +733,38 @@
|
|||
#define GFX_COMPILER_VERSION_PATCH ((__SUNPRO_C)%0x10)
|
||||
#endif
|
||||
#elif GFX_COMPILER == GFX_COMPILER_PACIFIC
|
||||
#if GFX_SHOW_COMPILER && GFX_DISPLAY_RULE_WARNINGS
|
||||
#warning "Compiler: PACIFIC"
|
||||
#endif
|
||||
#define GFX_COMPILER_NAME "Pacific C"
|
||||
#elif GFX_COMPILER == GFX_COMPILER_PALM
|
||||
#if GFX_SHOW_COMPILER && GFX_DISPLAY_RULE_WARNINGS
|
||||
#warning "Compiler: PALM"
|
||||
#endif
|
||||
#define GFX_COMPILER_NAME "Palm C/C++"
|
||||
#define GFX_COMPILER_VERSION_MAJOR ((_PACC_VER)/0x10000000)
|
||||
#define GFX_COMPILER_VERSION_MINOR (((_PACC_VER)/0x100000)%0x100)
|
||||
#define GFX_COMPILER_VERSION_PATCH (((_PACC_VER)/0x1000)%0x100)
|
||||
#define GFX_COMPILER_VERSION_BUILD ((_PACC_VER)%0x1000)
|
||||
#elif GFX_COMPILER == GFX_COMPILER_PELLES
|
||||
#if GFX_SHOW_COMPILER && GFX_DISPLAY_RULE_WARNINGS
|
||||
#warning "Compiler: PELLES"
|
||||
#endif
|
||||
#define GFX_COMPILER_NAME "Pelles C"
|
||||
#define GFX_COMPILER_VERSION_MAJOR ((__POCC__)/100)
|
||||
#define GFX_COMPILER_VERSION_MINOR ((__POCC__)%100)
|
||||
#elif GFX_COMPILER == GFX_COMPILER_PGCC
|
||||
#if GFX_SHOW_COMPILER && GFX_DISPLAY_RULE_WARNINGS
|
||||
#warning "Compiler: PGCC"
|
||||
#endif
|
||||
#define GFX_COMPILER_NAME "Portland PGCC/PGCPP"
|
||||
#define GFX_COMPILER_VERSION_MAJOR (__PGIC__)
|
||||
#define GFX_COMPILER_VERSION_MINOR (__PGIC_MINOR__)
|
||||
#define GFX_COMPILER_VERSION_PATCH (__PGIC_PATCHLEVEL__)
|
||||
#elif GFX_COMPILER == GFX_COMPILER_RENESAS
|
||||
#if GFX_SHOW_COMPILER && GFX_DISPLAY_RULE_WARNINGS
|
||||
#warning "Compiler: RENESAS"
|
||||
#endif
|
||||
#define GFX_COMPILER_NAME "Renesas C/C++"
|
||||
#ifdef __HITACHI_VERSION__
|
||||
#define GFX_COMPILER_VERSION_MAJOR ((__HITACHI_VERSION__)/0x100)
|
||||
|
@ -615,6 +779,9 @@
|
|||
#define GFX_COMPILER_VERSION_BUILD ((__RENESAS_VERSION__)%0x100)
|
||||
#endif
|
||||
#elif GFX_COMPILER == GFX_COMPILER_SASC
|
||||
#if GFX_SHOW_COMPILER && GFX_DISPLAY_RULE_WARNINGS
|
||||
#warning "Compiler: SASC"
|
||||
#endif
|
||||
#define GFX_COMPILER_NAME "SAS/C"
|
||||
#ifdef __SASC__
|
||||
#define GFX_COMPILER_VERSION_MAJOR ((__SASC__)/100)
|
||||
|
@ -624,24 +791,45 @@
|
|||
#define GFX_COMPILER_VERSION_MINOR (__REVISION__)
|
||||
#endif
|
||||
#elif GFX_COMPILER == GFX_COMPILER_SCO
|
||||
#if GFX_SHOW_COMPILER && GFX_DISPLAY_RULE_WARNINGS
|
||||
#warning "Compiler: SCO"
|
||||
#endif
|
||||
#define GFX_COMPILER_NAME "SCO OpenServer"
|
||||
#elif GFX_COMPILER == GFX_COMPILER_SDCC
|
||||
#if GFX_SHOW_COMPILER && GFX_DISPLAY_RULE_WARNINGS
|
||||
#warning "Compiler: SDCC"
|
||||
#endif
|
||||
#define GFX_COMPILER_NAME "Small Device C"
|
||||
#define GFX_COMPILER_VERSION_MAJOR ((SDCC)/100)
|
||||
#define GFX_COMPILER_VERSION_MINOR (((SDCC)/10)%10)
|
||||
#define GFX_COMPILER_VERSION_PATCH ((SDCC)%10)
|
||||
#elif GFX_COMPILER == GFX_COMPILER_SN
|
||||
#if GFX_SHOW_COMPILER && GFX_DISPLAY_RULE_WARNINGS
|
||||
#warning "Compiler: SN"
|
||||
#endif
|
||||
#define GFX_COMPILER_NAME "SN"
|
||||
#elif GFX_COMPILER == GFX_COMPILER_STRATUS
|
||||
#if GFX_SHOW_COMPILER && GFX_DISPLAY_RULE_WARNINGS
|
||||
#warning "Compiler: STRATUS"
|
||||
#endif
|
||||
#define GFX_COMPILER_NAME "Stratus VOS C"
|
||||
#define GFX_COMPILER_VERSION_MAJOR (__VOSC__)
|
||||
#elif GFX_COMPILER == GFX_COMPILER_SYMANTEC
|
||||
#if GFX_SHOW_COMPILER && GFX_DISPLAY_RULE_WARNINGS
|
||||
#warning "Compiler: SYMANTEC"
|
||||
#endif
|
||||
#define GFX_COMPILER_NAME "Symantec C++"
|
||||
#define GFX_COMPILER_VERSION_MAJOR ((__SC__)/0x100)
|
||||
#define GFX_COMPILER_VERSION_MINOR ((__SC__)%0x100)
|
||||
#elif GFX_COMPILER == GFX_COMPILER_TENDRA
|
||||
#if GFX_SHOW_COMPILER && GFX_DISPLAY_RULE_WARNINGS
|
||||
#warning "Compiler: TENDRA"
|
||||
#endif
|
||||
#define GFX_COMPILER_NAME "TenDRA C/C++"
|
||||
#elif GFX_COMPILER == GFX_COMPILER_THINK
|
||||
#if GFX_SHOW_COMPILER && GFX_DISPLAY_RULE_WARNINGS
|
||||
#warning "Compiler: THINK"
|
||||
#endif
|
||||
#define GFX_COMPILER_NAME "Think C"
|
||||
#ifdef THINKC4
|
||||
#define GFX_COMPILER_VERSION_MAJOR (4)
|
||||
|
@ -649,14 +837,23 @@
|
|||
#define GFX_COMPILER_VERSION_MAJOR (3)
|
||||
#endif
|
||||
#elif GFX_COMPILER == GFX_COMPILER_TI
|
||||
#if GFX_SHOW_COMPILER && GFX_DISPLAY_RULE_WARNINGS
|
||||
#warning "Compiler: TI"
|
||||
#endif
|
||||
#define GFX_COMPILER_NAME "Texas Instruments C/C++"
|
||||
#define GFX_COMPILER_VERSION_MAJOR ((SDCC)/1000000)
|
||||
#define GFX_COMPILER_VERSION_MINOR (((SDCC)/1000)%1000)
|
||||
#define GFX_COMPILER_VERSION_PATCH ((SDCC)%1000)
|
||||
#elif GFX_COMPILER == GFX_COMPILER_TINYC
|
||||
#if GFX_SHOW_COMPILER && GFX_DISPLAY_RULE_WARNINGS
|
||||
#warning "Compiler: TINYC"
|
||||
#endif
|
||||
#define GFX_COMPILER_NAME "Tiny C"
|
||||
#define GFX_COMPILER_TESTED TRUE
|
||||
#elif GFX_COMPILER == GFX_COMPILER_TURBOC
|
||||
#if GFX_SHOW_COMPILER && GFX_DISPLAY_RULE_WARNINGS
|
||||
#warning "Compiler: TURBOC"
|
||||
#endif
|
||||
#define GFX_COMPILER_NAME "Borland Turbo C/C++"
|
||||
#if __TURBOC__ < 0x295 || __TURBOC__ >= 0x400
|
||||
#define GFX_COMPILER_VERSION_MAJOR ((__TURBOC__)/0x100)
|
||||
|
@ -672,17 +869,29 @@
|
|||
#define GFX_COMPILER_VERSION_MINOR (0)
|
||||
#endif
|
||||
#elif GFX_COMPILER == GFX_COMPILER_ULTIMATE
|
||||
#if GFX_SHOW_COMPILER && GFX_DISPLAY_RULE_WARNINGS
|
||||
#warning "Compiler: ULTIMATE"
|
||||
#endif
|
||||
#define GFX_COMPILER_NAME "Ultimate C/C++"
|
||||
#define GFX_COMPILER_VERSION_MAJOR (_MAJOR_REV)
|
||||
#define GFX_COMPILER_VERSION_MINOR (_MINOR_REV)
|
||||
#elif GFX_COMPILER == GFX_COMPILER_USL
|
||||
#if GFX_SHOW_COMPILER && GFX_DISPLAY_RULE_WARNINGS
|
||||
#warning "Compiler: USL"
|
||||
#endif
|
||||
#define GFX_COMPILER_NAME "USL C"
|
||||
#define GFX_COMPILER_VERSION_MAJOR ((__SCO_VERSION__)/100000000)
|
||||
#define GFX_COMPILER_VERSION_MINOR (((__SCO_VERSION__)/1000000)%100)
|
||||
#define GFX_COMPILER_VERSION_BUILD ((__SCO_VERSION__)%1000000)
|
||||
#elif GFX_COMPILER == GFX_COMPILER_VBCC
|
||||
#if GFX_SHOW_COMPILER && GFX_DISPLAY_RULE_WARNINGS
|
||||
#warning "Compiler: VBCC"
|
||||
#endif
|
||||
#define GFX_COMPILER_NAME "VBCC"
|
||||
#elif GFX_COMPILER == GFX_COMPILER_VS
|
||||
#if GFX_SHOW_COMPILER && GFX_DISPLAY_RULE_WARNINGS
|
||||
#warning "Compiler: VS"
|
||||
#endif
|
||||
#define GFX_COMPILER_NAME "Microsoft Visual Studio"
|
||||
#ifdef _MSC_FULL_VER
|
||||
#if _MSC_FULL_VER < 100000000
|
||||
|
@ -703,10 +912,16 @@
|
|||
#endif
|
||||
#define DEPRECATED(msg) __declspec(deprecated(msg))
|
||||
#elif GFX_COMPILER == GFX_COMPILER_WATCOM
|
||||
#if GFX_SHOW_COMPILER && GFX_DISPLAY_RULE_WARNINGS
|
||||
#warning "Compiler: WATCOM"
|
||||
#endif
|
||||
#define GFX_COMPILER_NAME "Watcom C"
|
||||
#define GFX_COMPILER_VERSION_MAJOR ((__WATCOMC__)/100)
|
||||
#define GFX_COMPILER_VERSION_MINOR ((__WATCOMC__)%100)
|
||||
#elif GFX_COMPILER == GFX_COMPILER_ZTC
|
||||
#if GFX_SHOW_COMPILER && GFX_DISPLAY_RULE_WARNINGS
|
||||
#warning "Compiler: ZTC"
|
||||
#endif
|
||||
#define GFX_COMPILER_NAME "Zortech C++"
|
||||
#define GFX_COMPILER_VERSION_MAJOR ((__ZTC__)/0x100)
|
||||
#define GFX_COMPILER_VERSION_MINOR (((__ZTC__)/0x10)%0x10)
|
||||
|
|
|
@ -122,7 +122,6 @@ void gfxSleepMilliseconds(delaytime_t ms) {
|
|||
case TIME_INFINITE:
|
||||
while(1)
|
||||
gfxYield();
|
||||
return;
|
||||
}
|
||||
|
||||
// Convert our delay to ticks
|
||||
|
@ -144,7 +143,6 @@ void gfxSleepMicroseconds(delaytime_t ms) {
|
|||
case TIME_INFINITE:
|
||||
while(1)
|
||||
gfxYield();
|
||||
return;
|
||||
}
|
||||
|
||||
// Convert our delay to ticks
|
||||
|
@ -188,121 +186,22 @@ typedef struct threadQ {
|
|||
|
||||
static threadQ readyQ; // The list of ready threads
|
||||
static threadQ deadQ; // Where we put threads waiting to be deallocated
|
||||
static thread * current; // The current running thread
|
||||
thread * _gfxCurrentThread; // The current running thread - unfortunately this has to be non-static for the keil compiler
|
||||
static thread mainthread; // The main thread context
|
||||
|
||||
#undef GFX_THREADS_DONE
|
||||
|
||||
#if GFX_CPU == GFX_CPU_CORTEX_M0 || GFX_CPU == GFX_CPU_CORTEX_M1
|
||||
|
||||
// Use the EABI calling standard (ARM's AAPCS) - Save r4 - r11
|
||||
// The context is saved at the current stack location and a pointer is maintained in the thread structure.
|
||||
|
||||
#define _gfxThreadsInit()
|
||||
|
||||
static __attribute__((pcs("aapcs"),naked)) void _gfxTaskSwitch(thread *oldt, thread *newt) {
|
||||
__asm__ volatile ( "push {r4, r5, r6, r7, lr} \n\t"
|
||||
"mov r4, r8 \n\t"
|
||||
"mov r5, r9 \n\t"
|
||||
"mov r6, r10 \n\t"
|
||||
"mov r7, r11 \n\t"
|
||||
"push {r4, r5, r6, r7} \n\t"
|
||||
"str sp, %[oldtcxt] \n\t"
|
||||
"ldr sp, %[newtcxt] \n\t"
|
||||
"pop {r4, r5, r6, r7} \n\t"
|
||||
"mov r8, r4 \n\t"
|
||||
"mov r9, r5 \n\t"
|
||||
"mov r10, r6 \n\t"
|
||||
"mov r11, r7 \n\t"
|
||||
"pop {r4, r5, r6, r7, pc} \n\t"
|
||||
: [newtcxt] "=m" (newt->cxt)
|
||||
: [oldtcxt] "m" (oldt->cxt)
|
||||
: "memory");
|
||||
}
|
||||
|
||||
static __attribute__((pcs("aapcs"),naked)) void _gfxStartThread(thread *oldt, thread *newt) {
|
||||
newt->cxt = (char *)newt + newt->size;
|
||||
__asm__ volatile ( "push {r4, r5, r6, r7, r8, r9, r10, r11, lr} \n\t" // save current context
|
||||
"str sp, %[oldtcxt] \n\t" // save context pointer
|
||||
"ldr sp, %[newtcxt] \n\t" // load new context pointer
|
||||
: [newtcxt] "=m" (newt->cxt)
|
||||
: [oldtcxt] "m" (oldt->cxt)
|
||||
: "memory");
|
||||
|
||||
// Run the users function
|
||||
gfxThreadExit(current->fn(current->param));
|
||||
}
|
||||
|
||||
#include "gos_x_threads_cortexm01.h"
|
||||
#elif GFX_CPU == GFX_CPU_CORTEX_M3 || GFX_CPU == GFX_CPU_CORTEX_M4 || GFX_CPU == GFX_CPU_CORTEX_M7
|
||||
|
||||
// Use the EABI calling standard (ARM's AAPCS) - Save r4 - r11
|
||||
// The context is saved at the current stack location and a pointer is maintained in the thread structure.
|
||||
|
||||
#if CORTEX_USE_FPU
|
||||
#warning "GOS Threads: You have specified GFX_CPU=GFX_CPU_CORTX_M? with no hardware floating point support but CORTEX_USE_FPU is TRUE. Try using GFX_CPU_GFX_CPU_CORTEX_M?_FP instead"
|
||||
#endif
|
||||
|
||||
#define _gfxThreadsInit()
|
||||
|
||||
static __attribute__((pcs("aapcs"),naked)) void _gfxTaskSwitch(thread *oldt, thread *newt) {
|
||||
__asm__ volatile ( "push {r4, r5, r6, r7, r8, r9, r10, r11, lr} \n\t"
|
||||
"str sp, %[oldtcxt] \n\t"
|
||||
"ldr sp, %[newtcxt] \n\t"
|
||||
"pop {r4, r5, r6, r7, r8, r9, r10, r11, pc} \n\t"
|
||||
: [newtcxt] "=m" (newt->cxt)
|
||||
: [oldtcxt] "m" (oldt->cxt)
|
||||
: "memory");
|
||||
}
|
||||
|
||||
static __attribute__((pcs("aapcs"),naked)) void _gfxStartThread(thread *oldt, thread *newt) {
|
||||
newt->cxt = (char *)newt + newt->size;
|
||||
__asm__ volatile ( "push {r4, r5, r6, r7, r8, r9, r10, r11, lr} \n\t"
|
||||
"str sp, %[oldtcxt] \n\t"
|
||||
"ldr sp, %[newtcxt] \n\t"
|
||||
: [newtcxt] "=m" (newt->cxt)
|
||||
: [oldtcxt] "m" (oldt->cxt)
|
||||
: "memory");
|
||||
|
||||
// Run the users function
|
||||
gfxThreadExit(current->fn(current->param));
|
||||
}
|
||||
|
||||
#include "gos_x_threads_cortexm347.h"
|
||||
#elif GFX_CPU == GFX_CPU_CORTEX_M4_FP || GFX_CPU == GFX_CPU_CORTEX_M7_FP
|
||||
#include "gos_x_threads_cortexm47fp.h"
|
||||
#endif
|
||||
|
||||
// Use the EABI calling standard (ARM's AAPCS) - Save r4 - r11 and floating point
|
||||
// The context is saved at the current stack location and a pointer is maintained in the thread structure.
|
||||
#ifndef GFX_THREADS_DONE
|
||||
#define GFX_THREADS_DONE
|
||||
|
||||
#if !CORTEX_USE_FPU
|
||||
#warning "GOS Threads: You have specified GFX_CPU=GFX_CPU_CORTX_M?_FP with hardware floating point support but CORTEX_USE_FPU is FALSE. Try using GFX_CPU_GFX_CPU_CORTEX_M? instead"
|
||||
#endif
|
||||
|
||||
#define _gfxThreadsInit()
|
||||
|
||||
static __attribute__((pcs("aapcs-vfp"),naked)) void _gfxTaskSwitch(thread *oldt, thread *newt) {
|
||||
__asm__ volatile ( "push {r4, r5, r6, r7, r8, r9, r10, r11, lr} \n\t"
|
||||
"vpush {s16-s31} \n\t"
|
||||
"str sp, %[oldtcxt] \n\t"
|
||||
"ldr sp, %[newtcxt] \n\t"
|
||||
"vpop {s16-s31} \n\t"
|
||||
"pop {r4, r5, r6, r7, r8, r9, r10, r11, pc} \n\t"
|
||||
: [newtcxt] "=m" (newt->cxt)
|
||||
: [oldtcxt] "m" (oldt->cxt)
|
||||
: "memory");
|
||||
}
|
||||
|
||||
static __attribute__((pcs("aapcs-vfp"),naked)) void _gfxStartThread(thread *oldt, thread *newt) {
|
||||
newt->cxt = (char *)newt + newt->size;
|
||||
__asm__ volatile ( "push {r4, r5, r6, r7, r8, r9, r10, r11, lr} \n\t"
|
||||
"vpush {s16-s31} \n\t"
|
||||
"str sp, %[oldtcxt] \n\t"
|
||||
"ldr sp, %[newtcxt] \n\t"
|
||||
: [newtcxt] "=m" (newt->cxt)
|
||||
: [oldtcxt] "m" (oldt->cxt)
|
||||
: "memory");
|
||||
|
||||
// Run the users function
|
||||
gfxThreadExit(current->fn(current->param));
|
||||
}
|
||||
|
||||
#else
|
||||
#include <string.h> // Prototype for memcpy()
|
||||
#include <setjmp.h>
|
||||
|
||||
|
@ -500,7 +399,7 @@ static thread mainthread; // The main thread context
|
|||
// as we are on a different stack.
|
||||
|
||||
// Run the users function.
|
||||
gfxThreadExit(current->fn(current->param));
|
||||
gfxThreadExit(_gfxCurrentThread->fn(_gfxCurrentThread->param));
|
||||
|
||||
// We never get here as gfxThreadExit() never returns
|
||||
}
|
||||
|
@ -516,6 +415,7 @@ static thread mainthread; // The main thread context
|
|||
#define _gfxTaskSwitch(oldt, newt) _gfxXSwitch(oldt, newt, FALSE)
|
||||
#define _gfxStartThread(oldt, newt) _gfxXSwitch(oldt, newt, TRUE)
|
||||
#endif
|
||||
#undef GFX_THREADS_DONE
|
||||
|
||||
static void Qinit(threadQ * q) {
|
||||
q->head = q->tail = 0;
|
||||
|
@ -551,11 +451,11 @@ void _gosThreadsInit(void) {
|
|||
|
||||
_gfxThreadsInit();
|
||||
|
||||
current = &mainthread;
|
||||
_gfxCurrentThread = &mainthread;
|
||||
}
|
||||
|
||||
gfxThreadHandle gfxThreadMe(void) {
|
||||
return (gfxThreadHandle)current;
|
||||
return (gfxThreadHandle)_gfxCurrentThread;
|
||||
}
|
||||
|
||||
// Check if there are dead processes to deallocate
|
||||
|
@ -576,9 +476,9 @@ void gfxYield(void) {
|
|||
if (!readyQ.head)
|
||||
return;
|
||||
|
||||
Qadd(&readyQ, me = current);
|
||||
current = Qpop(&readyQ);
|
||||
_gfxTaskSwitch(me, current);
|
||||
Qadd(&readyQ, me = _gfxCurrentThread);
|
||||
_gfxCurrentThread = Qpop(&readyQ);
|
||||
_gfxTaskSwitch(me, _gfxCurrentThread);
|
||||
}
|
||||
|
||||
// This routine is not currently public - but it could be.
|
||||
|
@ -586,7 +486,7 @@ void gfxThreadExit(threadreturn_t ret) {
|
|||
thread *me;
|
||||
|
||||
// Save the results in case someone is waiting
|
||||
me = current;
|
||||
me = _gfxCurrentThread;
|
||||
me->param = (void *)ret;
|
||||
me->flags |= FLG_THD_DEAD;
|
||||
|
||||
|
@ -596,11 +496,11 @@ void gfxThreadExit(threadreturn_t ret) {
|
|||
Qadd(&deadQ, me);
|
||||
|
||||
// Set the next thread. Exit if it was the last thread
|
||||
if (!(current = Qpop(&readyQ)))
|
||||
if (!(_gfxCurrentThread = Qpop(&readyQ)))
|
||||
gfxExit();
|
||||
|
||||
// Switch to the new thread
|
||||
_gfxTaskSwitch(me, current);
|
||||
_gfxTaskSwitch(me, _gfxCurrentThread);
|
||||
|
||||
// We never get back here as we didn't re-queue ourselves
|
||||
}
|
||||
|
@ -630,9 +530,9 @@ gfxThreadHandle gfxThreadCreate(void *stackarea, size_t stacksz, threadpriority_
|
|||
t->param = param;
|
||||
|
||||
// Add the current thread to the queue because we are starting a new thread.
|
||||
me = current;
|
||||
me = _gfxCurrentThread;
|
||||
Qadd(&readyQ, me);
|
||||
current = t;
|
||||
_gfxCurrentThread = t;
|
||||
|
||||
_gfxStartThread(me, t);
|
||||
|
||||
|
@ -644,7 +544,7 @@ threadreturn_t gfxThreadWait(gfxThreadHandle th) {
|
|||
thread * t;
|
||||
|
||||
t = th;
|
||||
if (t == current)
|
||||
if (t == _gfxCurrentThread)
|
||||
return -1;
|
||||
|
||||
// Mark that we are waiting
|
||||
|
|
115
src/gos/gos_x_threads_cortexm01.h
Normal file
115
src/gos/gos_x_threads_cortexm01.h
Normal file
|
@ -0,0 +1,115 @@
|
|||
/*
|
||||
* 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
|
||||
*/
|
||||
|
||||
/**
|
||||
* Thread Switching Functions for the Cortex M0 & M1
|
||||
*
|
||||
* Use the EABI calling standard (ARM's AAPCS) - Save r4 - r11
|
||||
* The context is saved at the current stack location and a pointer is maintained in the thread structure.
|
||||
*/
|
||||
|
||||
#if CORTEX_USE_FPU
|
||||
#warning "GOS Threads: You have specified GFX_CPU=GFX_CPU_CORTX_M? with no hardware floating point support but CORTEX_USE_FPU is TRUE. Try using GFX_CPU_GFX_CPU_CORTEX_M?_FP instead"
|
||||
#endif
|
||||
|
||||
#if GFX_COMPILER == GFX_COMPILER_GCC || GFX_COMPILER == GFX_COMPILER_CYGWIN || GFX_COMPILER == GFX_COMPILER_MINGW32 || GFX_COMPILER == GFX_COMPILER_MINGW64
|
||||
#define GFX_THREADS_DONE
|
||||
#define _gfxThreadsInit()
|
||||
|
||||
static __attribute__((pcs("aapcs"),naked)) void _gfxTaskSwitch(thread *oldt, thread *newt) {
|
||||
__asm__ volatile ( "push {r4, r5, r6, r7, lr} \n\t"
|
||||
"mov r4, r8 \n\t"
|
||||
"mov r5, r9 \n\t"
|
||||
"mov r6, r10 \n\t"
|
||||
"mov r7, r11 \n\t"
|
||||
"push {r4, r5, r6, r7} \n\t"
|
||||
"str sp, %[oldtcxt] \n\t"
|
||||
"ldr sp, %[newtcxt] \n\t"
|
||||
"pop {r4, r5, r6, r7} \n\t"
|
||||
"mov r8, r4 \n\t"
|
||||
"mov r9, r5 \n\t"
|
||||
"mov r10, r6 \n\t"
|
||||
"mov r11, r7 \n\t"
|
||||
"pop {r4, r5, r6, r7, pc} \n\t"
|
||||
: [newtcxt] "=m" (newt->cxt)
|
||||
: [oldtcxt] "m" (oldt->cxt)
|
||||
: "memory");
|
||||
}
|
||||
|
||||
static __attribute__((pcs("aapcs"),naked)) void _gfxStartThread(thread *oldt, thread *newt) {
|
||||
newt->cxt = (char *)newt + newt->size;
|
||||
__asm__ volatile ( "push {r4, r5, r6, r7, lr} \n\t"
|
||||
"mov r4, r8 \n\t"
|
||||
"mov r5, r9 \n\t"
|
||||
"mov r6, r10 \n\t"
|
||||
"mov r7, r11 \n\t"
|
||||
"push {r4, r5, r6, r7} \n\t"
|
||||
"str sp, %[oldtcxt] \n\t"
|
||||
"ldr sp, %[newtcxt] \n\t"
|
||||
: [newtcxt] "=m" (newt->cxt)
|
||||
: [oldtcxt] "m" (oldt->cxt)
|
||||
: "memory");
|
||||
|
||||
// Run the users function
|
||||
gfxThreadExit(_gfxCurrentThread->fn(_gfxCurrentThread->param));
|
||||
}
|
||||
|
||||
#elif GFX_COMPILER == GFX_COMPILER_KEIL || GFX_COMPILER == GFX_COMPILER_ARMCC
|
||||
|
||||
static __asm void _gfxTaskSwitch(thread *oldt, thread *newt) {
|
||||
// Save the old context
|
||||
push {r4, r5, r6, r7, lr}
|
||||
mov r4, r8
|
||||
mov r5, r9
|
||||
mov r6, r10
|
||||
mov r7, r11
|
||||
push {r4, r5, r6, r7}
|
||||
str sp, [r0,#__cpp(offsetof(thread,cxt))] // oldt->cxt
|
||||
|
||||
// Load the new context
|
||||
ldr sp, [r1,#__cpp(offsetof(thread,cxt))] // newt->cxt
|
||||
pop {r4, r5, r6, r7}
|
||||
mov r8, r4
|
||||
mov r9, r5
|
||||
mov r10, r6
|
||||
mov r11, r7
|
||||
pop {r4, r5, r6, r7, pc}
|
||||
}
|
||||
|
||||
static __asm void _gfxStartThread(thread *oldt, thread *newt) {
|
||||
// Calculate where to generate the new context
|
||||
// newt->cxt = (char *)newt + newt->size;
|
||||
ldr r2,[r1,#__cpp(offsetof(thread,size))]
|
||||
add r2,r2,r1
|
||||
str r2,[r1,#__cpp(offsetof(thread,cxt))]
|
||||
|
||||
// Save the old context
|
||||
push {r4, r5, r6, r7, lr}
|
||||
mov r4, r8
|
||||
mov r5, r9
|
||||
mov r6, r10
|
||||
mov r7, r11
|
||||
push {r4, r5, r6, r7}
|
||||
str sp, [r0,#__cpp(offsetof(thread,cxt))] // oldt->cxt
|
||||
|
||||
// Load the new (imcomplete) context
|
||||
ldr sp, [r1,#__cpp(offsetof(thread,cxt))] // newt->cxt
|
||||
|
||||
// Run the users function - we save some code because gfxThreadExit() never returns
|
||||
// gfxThreadExit(_gfxCurrentThread->fn(_gfxCurrentThread->param));
|
||||
LDR r2,__cpp(&_gfxCurrentThread)
|
||||
LDR r2,[r2,#0]
|
||||
LDR r0,[r2,#__cpp(offsetof(thread,param))]
|
||||
LDR r1,[r2,#__cpp(offsetof(thread,fn))]
|
||||
BLX r1
|
||||
MOV r4,r0
|
||||
BL gfxThreadExit
|
||||
}
|
||||
|
||||
#else
|
||||
#warning "GOS: Threads: You have specified a specific CPU but your compiler is not supported. Defaulting to CLIB switching"
|
||||
#endif
|
86
src/gos/gos_x_threads_cortexm347.h
Normal file
86
src/gos/gos_x_threads_cortexm347.h
Normal file
|
@ -0,0 +1,86 @@
|
|||
/*
|
||||
* 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
|
||||
*/
|
||||
|
||||
/**
|
||||
* Thread Switching Functions for the Cortex M3, M4 & M7 without hardware floating point
|
||||
*
|
||||
* Use the EABI calling standard (ARM's AAPCS) - Save r4 - r11
|
||||
* The context is saved at the current stack location and a pointer is maintained in the thread structure.
|
||||
*/
|
||||
|
||||
|
||||
#if CORTEX_USE_FPU
|
||||
#warning "GOS Threads: You have specified GFX_CPU=GFX_CPU_CORTX_M? with no hardware floating point support but CORTEX_USE_FPU is TRUE. Try using GFX_CPU_GFX_CPU_CORTEX_M?_FP instead"
|
||||
#endif
|
||||
|
||||
#if GFX_COMPILER == GFX_COMPILER_GCC || GFX_COMPILER == GFX_COMPILER_CYGWIN || GFX_COMPILER == GFX_COMPILER_MINGW32 || GFX_COMPILER == GFX_COMPILER_MINGW64
|
||||
#define GFX_THREADS_DONE
|
||||
#define _gfxThreadsInit()
|
||||
|
||||
static __attribute__((pcs("aapcs"),naked)) void _gfxTaskSwitch(thread *oldt, thread *newt) {
|
||||
__asm__ volatile ( "push {r4, r5, r6, r7, r8, r9, r10, r11, lr} \n\t"
|
||||
"str sp, %[oldtcxt] \n\t"
|
||||
"ldr sp, %[newtcxt] \n\t"
|
||||
"pop {r4, r5, r6, r7, r8, r9, r10, r11, pc} \n\t"
|
||||
: [newtcxt] "=m" (newt->cxt)
|
||||
: [oldtcxt] "m" (oldt->cxt)
|
||||
: "memory");
|
||||
}
|
||||
|
||||
static __attribute__((pcs("aapcs"),naked)) void _gfxStartThread(thread *oldt, thread *newt) {
|
||||
newt->cxt = (char *)newt + newt->size;
|
||||
__asm__ volatile ( "push {r4, r5, r6, r7, r8, r9, r10, r11, lr} \n\t"
|
||||
"str sp, %[oldtcxt] \n\t"
|
||||
"ldr sp, %[newtcxt] \n\t"
|
||||
: [newtcxt] "=m" (newt->cxt)
|
||||
: [oldtcxt] "m" (oldt->cxt)
|
||||
: "memory");
|
||||
|
||||
// Run the users function
|
||||
gfxThreadExit(_gfxCurrentThread->fn(_gfxCurrentThread->param));
|
||||
}
|
||||
|
||||
#elif GFX_COMPILER == GFX_COMPILER_KEIL || GFX_COMPILER == GFX_COMPILER_ARMCC
|
||||
|
||||
static __asm void _gfxTaskSwitch(thread *oldt, thread *newt) {
|
||||
// Save the old context
|
||||
push {r4, r5, r6, r7, r8, r9, r10, r11, lr}
|
||||
str sp, [r0,#__cpp(offsetof(thread,cxt))] // oldt->cxt
|
||||
|
||||
// Load the new context
|
||||
ldr sp, [r1,#__cpp(offsetof(thread,cxt))] // newt->cxt
|
||||
pop {r4, r5, r6, r7, r8, r9, r10, r11, pc}
|
||||
}
|
||||
|
||||
static __asm void _gfxStartThread(thread *oldt, thread *newt) {
|
||||
// Calculate where to generate the new context
|
||||
// newt->cxt = (char *)newt + newt->size;
|
||||
ldr r2,[r1,#__cpp(offsetof(thread,size))]
|
||||
add r2,r2,r1
|
||||
str r2,[r1,#__cpp(offsetof(thread,cxt))]
|
||||
|
||||
// Save the old context
|
||||
push {r4, r5, r6, r7, r8, r9, r10, r11, lr}
|
||||
str sp, [r0,#__cpp(offsetof(thread,cxt))] // oldt->cxt
|
||||
|
||||
// Load the new (imcomplete) context
|
||||
ldr sp, [r1,#__cpp(offsetof(thread,cxt))] // newt->cxt
|
||||
|
||||
// Run the users function - we save some code because gfxThreadExit() never returns
|
||||
// gfxThreadExit(_gfxCurrentThread->fn(_gfxCurrentThread->param));
|
||||
LDR r2,__cpp(&_gfxCurrentThread)
|
||||
LDR r2,[r2,#0]
|
||||
LDR r0,[r2,#__cpp(offsetof(thread,param))]
|
||||
LDR r1,[r2,#__cpp(offsetof(thread,fn))]
|
||||
BLX r1
|
||||
MOV r4,r0
|
||||
BL gfxThreadExit
|
||||
}
|
||||
|
||||
#else
|
||||
#warning "GOS: Threads: You have specified a specific CPU but your compiler is not supported. Defaulting to CLIB switching"
|
||||
#endif
|
91
src/gos/gos_x_threads_cortexm47fp.h
Normal file
91
src/gos/gos_x_threads_cortexm47fp.h
Normal file
|
@ -0,0 +1,91 @@
|
|||
/*
|
||||
* 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
|
||||
*/
|
||||
|
||||
/**
|
||||
* Thread Switching Functions for the Cortex M4 & M7 with hardware floating point
|
||||
*
|
||||
* Use the EABI calling standard (ARM's AAPCS) - Save r4 - r11 and floating point
|
||||
* The context is saved at the current stack location and a pointer is maintained in the thread structure.
|
||||
*/
|
||||
|
||||
#if !CORTEX_USE_FPU
|
||||
#warning "GOS Threads: You have specified GFX_CPU=GFX_CPU_CORTX_M?_FP with hardware floating point support but CORTEX_USE_FPU is FALSE. Try using GFX_CPU_GFX_CPU_CORTEX_M? instead"
|
||||
#endif
|
||||
|
||||
#if GFX_COMPILER == GFX_COMPILER_GCC || GFX_COMPILER == GFX_COMPILER_CYGWIN || GFX_COMPILER == GFX_COMPILER_MINGW32 || GFX_COMPILER == GFX_COMPILER_MINGW64
|
||||
#define GFX_THREADS_DONE
|
||||
#define _gfxThreadsInit()
|
||||
|
||||
static __attribute__((pcs("aapcs-vfp"),naked)) void _gfxTaskSwitch(thread *oldt, thread *newt) {
|
||||
__asm__ volatile ( "push {r4, r5, r6, r7, r8, r9, r10, r11, lr} \n\t"
|
||||
"vpush {s16-s31} \n\t"
|
||||
"str sp, %[oldtcxt] \n\t"
|
||||
"ldr sp, %[newtcxt] \n\t"
|
||||
"vpop {s16-s31} \n\t"
|
||||
"pop {r4, r5, r6, r7, r8, r9, r10, r11, pc} \n\t"
|
||||
: [newtcxt] "=m" (newt->cxt)
|
||||
: [oldtcxt] "m" (oldt->cxt)
|
||||
: "memory");
|
||||
}
|
||||
|
||||
static __attribute__((pcs("aapcs-vfp"),naked)) void _gfxStartThread(thread *oldt, thread *newt) {
|
||||
newt->cxt = (char *)newt + newt->size;
|
||||
__asm__ volatile ( "push {r4, r5, r6, r7, r8, r9, r10, r11, lr} \n\t"
|
||||
"vpush {s16-s31} \n\t"
|
||||
"str sp, %[oldtcxt] \n\t"
|
||||
"ldr sp, %[newtcxt] \n\t"
|
||||
: [newtcxt] "=m" (newt->cxt)
|
||||
: [oldtcxt] "m" (oldt->cxt)
|
||||
: "memory");
|
||||
|
||||
// Run the users function
|
||||
gfxThreadExit(_gfxCurrentThread->fn(_gfxCurrentThread->param));
|
||||
}
|
||||
|
||||
#elif GFX_COMPILER == GFX_COMPILER_KEIL || GFX_COMPILER == GFX_COMPILER_ARMCC
|
||||
|
||||
static __asm void _gfxTaskSwitch(thread *oldt, thread *newt) {
|
||||
// Save the old context
|
||||
push {r4, r5, r6, r7, r8, r9, r10, r11, lr}
|
||||
vpush {s16-s31}
|
||||
str sp, [r0,#__cpp(offsetof(thread,cxt))] // oldt->cxt
|
||||
|
||||
// Load the new context
|
||||
ldr sp, [r1,#__cpp(offsetof(thread,cxt))] // newt->cxt
|
||||
vpop {s16-s31}
|
||||
pop {r4, r5, r6, r7, r8, r9, r10, r11, pc}
|
||||
}
|
||||
|
||||
static __asm void _gfxStartThread(thread *oldt, thread *newt) {
|
||||
// Calculate where to generate the new context
|
||||
// newt->cxt = (char *)newt + newt->size;
|
||||
ldr r2,[r1,#__cpp(offsetof(thread,size))]
|
||||
add r2,r2,r1
|
||||
str r2,[r1,#__cpp(offsetof(thread,cxt))]
|
||||
|
||||
// Save the old context
|
||||
push {r4, r5, r6, r7, r8, r9, r10, r11, lr}
|
||||
vpush {s16-s31}
|
||||
str sp, [r0,#__cpp(offsetof(thread,cxt))] // oldt->cxt
|
||||
|
||||
// Load the new (imcomplete) context
|
||||
ldr sp, [r1,#__cpp(offsetof(thread,cxt))] // newt->cxt
|
||||
|
||||
// Run the users function - we save some code because gfxThreadExit() never returns
|
||||
// gfxThreadExit(_gfxCurrentThread->fn(_gfxCurrentThread->param));
|
||||
LDR r2,__cpp(&_gfxCurrentThread)
|
||||
LDR r2,[r2,#0]
|
||||
LDR r0,[r2,#__cpp(offsetof(thread,param))]
|
||||
LDR r1,[r2,#__cpp(offsetof(thread,fn))]
|
||||
BLX r1
|
||||
MOV r4,r0
|
||||
BL gfxThreadExit
|
||||
}
|
||||
|
||||
#else
|
||||
#warning "GOS: Threads: You have specified a specific CPU but your compiler is not supported. Defaulting to CLIB switching"
|
||||
#endif
|
|
@ -109,7 +109,7 @@ static DECLARE_THREAD_FUNCTION(GTimerThreadHandler, arg) {
|
|||
lastTime = tm;
|
||||
gfxMutexExit(&mutex);
|
||||
}
|
||||
THREAD_RETURN(0);
|
||||
// THREAD_RETURN(0);
|
||||
}
|
||||
|
||||
void _gtimerInit(void)
|
||||
|
|
Loading…
Add table
Reference in a new issue