gbasys
diff src/comm.h @ 2:e3dc7705ad9c
communications stuff
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Wed, 07 Mar 2012 06:11:51 +0200 |
parents | |
children | 06726f0b8cd3 |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/comm.h Wed Mar 07 06:11:51 2012 +0200 1.3 @@ -0,0 +1,48 @@ 1.4 +/* 1.5 +gbasys - a gameboy advance hardware abstraction library 1.6 +Copyright (C) 2005-2012 John Tsiombikas <nuclear@member.fsf.org> 1.7 + 1.8 +This program is free software: you can redistribute it and/or modify 1.9 +it under the terms of the GNU General Public License as published by 1.10 +the Free Software Foundation, either version 3 of the License, or 1.11 +(at your option) any later version. 1.12 + 1.13 +This program is distributed in the hope that it will be useful, 1.14 +but WITHOUT ANY WARRANTY; without even the implied warranty of 1.15 +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1.16 +GNU General Public License for more details. 1.17 + 1.18 +You should have received a copy of the GNU General Public License 1.19 +along with this program. If not, see <http://www.gnu.org/licenses/>. 1.20 +*/ 1.21 +#ifndef COMM_H_ 1.22 +#define COMM_H_ 1.23 + 1.24 +enum { 1.25 + COMM_SIO8_MASTER, 1.26 + COMM_SIO8_SLAVE, 1.27 + COMM_SIO32_MASTER, 1.28 + COMM_SIO32_SLAVE, 1.29 + COMM_UART, 1.30 + COMM_GPIO 1.31 +}; 1.32 + 1.33 +void comm_setup(int mode); 1.34 + 1.35 +/* synchronous transfer, blocks until complete */ 1.36 +void sio_transfer(void *in, const void *out); 1.37 + 1.38 +/* async transfer, returns immediately, raises SIGIO when complete */ 1.39 +void sio_transfer_async(void *in, const void *out); 1.40 + 1.41 + 1.42 +/* GPIO functions */ 1.43 +enum { GPIO_DIR_IN, GPIO_DIR_OUT }; 1.44 + 1.45 +void gpio_dir(int dir_so, int dir_si, int dir_sd, int dir_sc); 1.46 +void gpio_dir_mask(unsigned char dir); 1.47 + 1.48 +void gpio_set(unsigned char val); 1.49 +unsigned char gpio_get(void); 1.50 + 1.51 +#endif /* COMM_H_ */