forked from 86Box/86Box
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e61c620
commit 89ecdd6
Showing
7 changed files
with
364 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#include <stdint.h> | ||
#include <stdbool.h> | ||
|
||
struct pcmcia_socket_t; | ||
typedef struct pcmcia_socket_t pcmcia_socket_t; | ||
|
||
struct pcmcia_socket_t { | ||
/* Socket number (zero-based) */ | ||
uint8_t socket_num; | ||
|
||
/* Card I/O Read and Write functions. */ | ||
uint8_t (*io_read)(uint16_t port, void* priv); | ||
uint16_t (*io_readw)(uint16_t port, void* priv); | ||
void (*io_write)(uint16_t port, uint8_t val, void* priv); | ||
void (*io_writew)(uint16_t port, uint16_t val, void* priv); | ||
|
||
/* Card Memory Read and Write functions. */ | ||
/* REG = 0: Access Attribute Memory. */ | ||
/* REG = 1: Access Common Memory. */ | ||
uint8_t (*mem_read)(uint32_t addr, int reg, void* priv); | ||
uint16_t (*mem_readw)(uint32_t addr, int reg, void* priv); | ||
void (*mem_write)(uint32_t addr, uint8_t val, int reg, void* priv); | ||
void (*mem_writew)(uint32_t addr, uint16_t val, int reg, void* priv); | ||
|
||
/* Signals power status change to the card. */ | ||
void (*power_status_change)(pcmcia_socket_t* socket); | ||
|
||
/* Signals card insertion/removal to the socket. */ | ||
void (*card_inserted)(bool inserted, pcmcia_socket_t* socket); | ||
|
||
/* Opaque pointer to card-specific information. */ | ||
void *card_priv; | ||
|
||
/* Opaque pointer to socket-specific information. */ | ||
void *socket_priv; | ||
|
||
/* Card power status. */ | ||
bool powered_on; | ||
}; | ||
|
||
typedef struct pcmcia_socket_t pcmcia_socket_t; | ||
|
||
bool pcmcia_socket_is_free(pcmcia_socket_t* socket); | ||
pcmcia_socket_t* pcmcia_search_for_slots(void); | ||
void pcmcia_socket_insert_card(pcmcia_socket_t* socket); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#include <stdarg.h> | ||
#include <stdio.h> | ||
#include <stdbool.h> | ||
#include <stdint.h> | ||
#include <stdlib.h> | ||
#include <string.h> | ||
#include <wchar.h> | ||
#define HAVE_STDARG_H | ||
#include <86box/86box.h> | ||
#include <86box/io.h> | ||
#include <86box/timer.h> | ||
#include <86box/pcmcia.h> | ||
|
||
static pcmcia_socket_t pcmcia_sockets[4]; | ||
static uint8_t pcmcia_registered_sockets_num = 0; | ||
|
||
bool pcmcia_socket_is_free(pcmcia_socket_t *socket) | ||
{ | ||
return !socket->card_priv; | ||
} | ||
|
||
pcmcia_socket_t* pcmcia_search_for_slots(void) | ||
{ | ||
for (int i = 0; i < pcmcia_registered_sockets_num; i++) { | ||
if (!pcmcia_sockets[i].card_priv) | ||
return &pcmcia_sockets[i]; | ||
} | ||
return NULL; | ||
} | ||
|
||
void pcmcia_socket_insert_card(pcmcia_socket_t* socket) | ||
{ | ||
if (!socket->card_inserted) | ||
fatal("No PCMCIA socket insertion function!\n"); | ||
|
||
socket->card_priv = socket->card_priv; | ||
socket->card_inserted(true, socket); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
add_library(pcmcia pcmcia_socket_pd6710.c) |
Oops, something went wrong.