diff options
| author | Keith Packard <keithp@keithp.com> | 2012-10-25 11:25:42 -0700 | 
|---|---|---|
| committer | Keith Packard <keithp@keithp.com> | 2012-10-25 11:25:42 -0700 | 
| commit | f221c78e6237e0a118ebe85c25e433fe16a7735d (patch) | |
| tree | 52e5e0dd555b3b0e5eef86e5f3d879304b4d9594 /src/stm/ao_serial_stm.c | |
| parent | 963f7715be6c67056bbd8bbe898639adac64fc29 (diff) | |
altos: Switch drivers to ao_arch_block/release_interrupts
Stop using cli/sei, which are avr-specific
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'src/stm/ao_serial_stm.c')
| -rw-r--r-- | src/stm/ao_serial_stm.c | 32 | 
1 files changed, 16 insertions, 16 deletions
diff --git a/src/stm/ao_serial_stm.c b/src/stm/ao_serial_stm.c index 406da9fb..00409f4a 100644 --- a/src/stm/ao_serial_stm.c +++ b/src/stm/ao_serial_stm.c @@ -34,7 +34,7 @@ ao_debug_out(char c)  }  static void -ao_usart_tx_start(struct ao_stm_usart *usart) +_ao_usart_tx_start(struct ao_stm_usart *usart)  {  	if (!ao_fifo_empty(usart->tx_fifo) && !usart->tx_started)  	{ @@ -61,7 +61,7 @@ ao_usart_isr(struct ao_stm_usart *usart, int stdin)  	}  	if (sr & (1 << STM_USART_SR_TC)) {  		usart->tx_started = 0; -		ao_usart_tx_start(usart); +		_ao_usart_tx_start(usart);  		ao_wakeup(&usart->tx_fifo);  	}  } @@ -70,11 +70,11 @@ char  ao_usart_getchar(struct ao_stm_usart *usart)  {  	char c; -	cli(); +	ao_arch_block_interrupts();  	while (ao_fifo_empty(usart->rx_fifo))  		ao_sleep(&usart->rx_fifo);  	ao_fifo_remove(usart->rx_fifo, c); -	sei(); +	ao_arch_release_interrupts();  	return c;  } @@ -82,34 +82,34 @@ char  ao_usart_pollchar(struct ao_stm_usart *usart)  {  	char	c; -	cli(); -	if (ao_fifo_empty(usart->rx_fifo)) { -		sei(); -		return AO_READ_AGAIN; -	} -	ao_fifo_remove(usart->rx_fifo,c); -	sei(); +	 +	ao_arch_block_interrupts(); +	if (ao_fifo_empty(usart->rx_fifo)) +		c = AO_READ_AGAIN; +	else +		ao_fifo_remove(usart->rx_fifo,c); +	ao_arch_release_interrupts();  	return c;  }  void  ao_usart_putchar(struct ao_stm_usart *usart, char c)  { -	cli(); +	ao_arch_block_interrupts();  	while (ao_fifo_full(usart->tx_fifo))  		ao_sleep(&usart->tx_fifo);  	ao_fifo_insert(usart->tx_fifo, c); -	ao_usart_tx_start(usart); -	sei(); +	_ao_usart_tx_start(usart); +	ao_arch_release_interrupts();  }  void  ao_usart_drain(struct ao_stm_usart *usart)  { -	cli(); +	ao_arch_block_interrupts();  	while (!ao_fifo_empty(usart->tx_fifo))  		ao_sleep(&usart->tx_fifo); -	sei(); +	ao_arch_release_interrupts();  }  static const struct {  | 
