kopia lustrzana https://github.com/Jean-MarcHarvengt/MCUME
138 wiersze
3.3 KiB
C
Executable File
138 wiersze
3.3 KiB
C
Executable File
|
|
// ****************************************************************************
|
|
//
|
|
// Global common definitions
|
|
//
|
|
// file derived from the PicoVGA project
|
|
// https://github.com/Panda381/PicoVGA
|
|
// by Miroslav Nemecek
|
|
//
|
|
// ****************************************************************************
|
|
|
|
// ----------------------------------------------------------------------------
|
|
// Base data types
|
|
// ----------------------------------------------------------------------------
|
|
|
|
typedef signed char s8;
|
|
typedef unsigned char u8;
|
|
typedef signed short s16;
|
|
typedef unsigned short u16;
|
|
typedef signed long int s32;
|
|
typedef unsigned long int u32;
|
|
typedef signed long long int s64;
|
|
typedef unsigned long long int u64;
|
|
|
|
typedef unsigned int uint;
|
|
|
|
typedef unsigned char Bool;
|
|
#define True 1
|
|
#define False 0
|
|
|
|
// NULL
|
|
#ifndef NULL
|
|
#ifdef __cplusplus
|
|
#define NULL 0
|
|
#else
|
|
#define NULL ((void*)0)
|
|
#endif
|
|
#endif
|
|
|
|
// I/O port prefix
|
|
#define __IO volatile
|
|
|
|
// request to use inline
|
|
#define INLINE __attribute__((always_inline)) inline
|
|
|
|
// avoid to use inline
|
|
#define NOINLINE __attribute__((noinline))
|
|
|
|
// weak function
|
|
#define WEAK __attribute__((weak))
|
|
|
|
// align array to 4-bytes
|
|
#define ALIGNED __attribute__((aligned(4)))
|
|
#define ALIGN4(x) ((x) & ~3)
|
|
|
|
// swap bytes of command
|
|
#define BYTESWAP(n) ((((n)&0xff)<<24)|(((n)&0xff00)<<8)|(((n)&0xff0000)>>8)|(((n)&0xff000000)>>24))
|
|
|
|
// ----------------------------------------------------------------------------
|
|
// Constants
|
|
// ----------------------------------------------------------------------------
|
|
#define B0 (1<<0)
|
|
/*
|
|
#define B1 (1<<1)
|
|
#define B2 (1<<2)
|
|
#define B3 (1<<3)
|
|
#define B4 (1<<4)
|
|
#define B5 (1<<5)
|
|
#define B6 (1<<6)
|
|
#define B7 (1<<7)
|
|
#define B8 (1U<<8)
|
|
#define B9 (1U<<9)
|
|
#define B10 (1U<<10)
|
|
#define B11 (1U<<11)
|
|
#define B12 (1U<<12)
|
|
#define B13 (1U<<13)
|
|
#define B14 (1U<<14)
|
|
#define B15 (1U<<15)
|
|
#define B16 (1UL<<16)
|
|
#define B17 (1UL<<17)
|
|
#define B18 (1UL<<18)
|
|
#define B19 (1UL<<19)
|
|
#define B20 (1UL<<20)
|
|
#define B21 (1UL<<21)
|
|
#define B22 (1UL<<22)
|
|
#define B23 (1UL<<23)
|
|
#define B24 (1UL<<24)
|
|
#define B25 (1UL<<25)
|
|
#define B26 (1UL<<26)
|
|
#define B27 (1UL<<27)
|
|
#define B28 (1UL<<28)
|
|
#define B29 (1UL<<29)
|
|
#define B30 (1UL<<30)
|
|
#define B31 (1UL<<31)
|
|
*/
|
|
|
|
#define BIT(pos) (1UL<<(pos))
|
|
|
|
#define BIGINT 0x40000000 // big int value
|
|
|
|
#define _T(a) a
|
|
|
|
#define PI 3.14159265358979324
|
|
#define PI2 (3.14159265358979324*2)
|
|
|
|
//#define VGA_RGB(r,g,b) ( (((r>>5)&0x07)<<5) | (((g>>5)&0x07)<<2) | (((b>>6)&0x3)<<0) )
|
|
|
|
|
|
// system includes
|
|
#include <string.h>
|
|
|
|
// SDK includes
|
|
#include "pico.h"
|
|
#include "pico/stdlib.h"
|
|
#include "pico/multicore.h"
|
|
#include "pico/sync.h"
|
|
#include "pico/platform.h"
|
|
#include "pico/sem.h"
|
|
#include "hardware/clocks.h"
|
|
#include "hardware/dma.h"
|
|
#include "hardware/gpio.h"
|
|
#include "hardware/pio.h"
|
|
#include "hardware/irq.h"
|
|
#include "hardware/divider.h"
|
|
#include "hardware/structs/bus_ctrl.h"
|
|
#include "pico/binary_info.h"
|
|
#include "pico/printf.h"
|
|
#include "pico/float.h"
|
|
#include "pico/int64_ops.h"
|
|
|
|
|
|
// PicoVGA includes
|
|
#include "vga_config.h" // VGA configuration
|
|
#include "vga_vmode.h" // VGA videomodes
|
|
#include "vga.h" // VGA output
|
|
#include "picovga.pio.h" // PIO
|
|
|