sst96: mingw inline asm for _inp, _outp, and _outpw.

This commit is contained in:
sezero
2018-08-12 20:55:02 +03:00
parent b35c0478be
commit 542a45b6e9
3 changed files with 40 additions and 0 deletions

View File

@@ -49,7 +49,19 @@
#ifdef _WIN32
#define _WIN32_LEAN_AND_MEAN_
#include <windows.h>
#ifdef __MINGW32__
static inline unsigned char _inp_asm (unsigned short _port) {
unsigned char rc;
__asm__ __volatile__ ("inb %w1,%b0" : "=a" (rc) : "Nd" (_port));
return rc;
}
static inline void _outp_asm (unsigned short _port, unsigned char _data) {
__asm__ __volatile__ ("outb %b0,%w1" : : "a" (_data), "Nd" (_port));
}
#define _inp _inp_asm
#define _outp _outp_asm
#endif
#endif /* _WIN32 */
#include <fxpci.h>
#include <gdebug.h>

View File

@@ -39,6 +39,18 @@
#ifdef __WIN32__
#include <windows.h>
#ifdef __MINGW32__
static inline unsigned char _inp_asm (unsigned short _port) {
unsigned char rc;
__asm__ __volatile__ ("inb %w1,%b0" : "=a" (rc) : "Nd" (_port));
return rc;
}
static inline void _outp_asm (unsigned short _port, unsigned char _data) {
__asm__ __volatile__ ("outb %b0,%w1" : : "a" (_data), "Nd" (_port));
}
#define _inp _inp_asm
#define _outp _outp_asm
#endif
#endif /* __WIN32__ */
#if defined(__WATCOMC__)

View File

@@ -48,6 +48,22 @@
#ifdef __WIN32__
#include <windows.h>
#ifdef __MINGW32__
static inline unsigned char _inp_asm (unsigned short _port) {
unsigned char rc;
__asm__ __volatile__ ("inb %w1,%b0" : "=a" (rc) : "Nd" (_port));
return rc;
}
static inline void _outp_asm (unsigned short _port, unsigned char _data) {
__asm__ __volatile__ ("outb %b0,%w1" : : "a" (_data), "Nd" (_port));
}
static inline void _outpw_asm (unsigned short _port, unsigned short _data) {
__asm__ __volatile__ ("outw %w0,%w1" : : "a" (_data), "Nd" (_port));
}
#define _outpw _outpw_asm
#define _inp _inp_asm
#define _outp _outp_asm
#endif
#endif /* __WIN32__ */
#define INIT_MCRX_LIB