mirror of
https://github.com/oliverschmidt/contiki.git
synced 2024-12-22 10:30:13 +00:00
status has been added for polling function.
This commit is contained in:
parent
8d7bb2119c
commit
c99b7dc827
@ -27,7 +27,7 @@
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: rs232.c,v 1.2 2007/09/11 12:03:20 matsutsuka Exp $
|
||||
* $Id: rs232.c,v 1.3 2007/09/19 12:47:55 matsutsuka Exp $
|
||||
*
|
||||
*/
|
||||
/*
|
||||
@ -48,7 +48,7 @@ PROCESS_THREAD(rs232_process, ev, data)
|
||||
{
|
||||
static struct etimer timer;
|
||||
char ch;
|
||||
unsigned char i;
|
||||
unsigned char i, stat;
|
||||
PROCESS_BEGIN();
|
||||
|
||||
rs232_arch_init(RS232_BAUD_RATE);
|
||||
@ -59,8 +59,8 @@ PROCESS_THREAD(rs232_process, ev, data)
|
||||
|
||||
if (etimer_expired(&timer)) {
|
||||
for (i = 0; i < RS232_BUFSIZE; i++) {
|
||||
ch = rs232_arch_poll();
|
||||
if (ch == 0) {
|
||||
ch = rs232_arch_poll(&stat);
|
||||
if (stat == 0) {
|
||||
break;
|
||||
}
|
||||
/* We have an input data */
|
||||
|
@ -27,7 +27,7 @@
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: rs232.h,v 1.2 2007/09/11 12:03:20 matsutsuka Exp $
|
||||
* $Id: rs232.h,v 1.3 2007/09/19 12:47:55 matsutsuka Exp $
|
||||
*
|
||||
*/
|
||||
/*
|
||||
@ -51,9 +51,9 @@ void rs232_arch_init(unsigned long ubr);
|
||||
|
||||
/*
|
||||
* An architecture-depend implementation of RS-232C polling.
|
||||
* @return character, zero if no input.
|
||||
* @return character, stat == zero if no input.
|
||||
*/
|
||||
unsigned char rs232_arch_poll(void);
|
||||
unsigned char rs232_arch_poll(unsigned char* stat);
|
||||
|
||||
/*
|
||||
* An architecture-depend implementation of RS-232C writing a byte.
|
||||
|
@ -7,7 +7,7 @@
|
||||
;;;
|
||||
;;; @author Takahide Matsutsuka <markn@markn.org>
|
||||
;;;
|
||||
;;; $Id: rs232-asm.S,v 1.1 2007/09/11 12:12:59 matsutsuka Exp $
|
||||
;;; $Id: rs232-asm.S,v 1.2 2007/09/19 12:47:19 matsutsuka Exp $
|
||||
;;;
|
||||
|
||||
;; definitions of PC-6001 BIOS routines
|
||||
@ -37,18 +37,25 @@ _rs232_arch_writeb:
|
||||
ret
|
||||
|
||||
;; ---------------------------------
|
||||
;; unsigned char rs232_arch_poll();
|
||||
;; Stack; retl reth
|
||||
;; AFBC__HL____
|
||||
;; return input byte (zero if no input)
|
||||
;; unsigned char rs232_arch_poll(unsigned char *stat);
|
||||
;; Stack; retl reth statl stath
|
||||
;; AFBCDEHL____
|
||||
;; return input byte (*stat == 0 if no input)
|
||||
;; ---------------------------------
|
||||
_rs232_arch_poll:
|
||||
ld a,#0x01
|
||||
ld hl, #2
|
||||
add hl, sp
|
||||
ld e, (hl)
|
||||
inc hl
|
||||
ld d, (hl)
|
||||
ld a, #0x01
|
||||
ld (de), a
|
||||
di
|
||||
call #_char_input_sub ; read from buffer
|
||||
ei
|
||||
jr nz, _rs232_arch_poll_ret
|
||||
xor a ; we have no data in the buffer
|
||||
ld (de), a
|
||||
_rs232_arch_poll_ret:
|
||||
ld l, a
|
||||
ret
|
||||
|
Loading…
Reference in New Issue
Block a user