Main Page | File List | Globals

serial.c File Reference

#include <msp430x16x.h>
#include <signal.h>
#include <stdio.h>
#include "vcsbsp.h"

Include dependency graph for serial.c:

Include dependency graph

Go to the source code of this file.

Functions

void init_serial_0 (void)
void init_serial_1 (void)
 interrupt (UART0RX_VECTOR)
 interrupt (UART0TX_VECTOR)
char getchar (void)
char getchar_nb (void)
int putchar (int in_char)
int flush_uart0 (void)
 interrupt (UART1RX_VECTOR)
 interrupt (UART1TX_VECTOR)
char getchar_gps (void)
char getchar_gps_nb (void)
int putchar_gps (int in_char)
int flush_uart1 (void)

Variables

queue_t uart0_rx_q
queue_t uart1_rx_q
queue_t uart0_tx_q
queue_t uart1_tx_q


Function Documentation

int flush_uart0 void   ) 
 

Definition at line 126 of file serial.c.

00126                       {
00127   int ret_val=0;
00128   if (!(IE1&UTXIE0)) {
00129     ret_val=1;
00130     IE1|=UTXIE0;          // Turn on the TX IRQ
00131     IFG1|=UTXIFG0;        // Set the Interrupt flag to start the TX                
00132   }
00133   return (ret_val);
00134 }

int flush_uart1 void   ) 
 

Definition at line 169 of file serial.c.

00169                       {
00170   int ret_val=0;
00171   if (!(IE2&UTXIE1)) {
00172     ret_val=1;
00173     IE2|=UTXIE1;          // Turn on the TX IRQ
00174     IFG2|=UTXIFG1;        // Set the Interrupt flag to start the TX                
00175   }
00176   return (ret_val);
00177 }

char getchar void   ) 
 

Definition at line 111 of file serial.c.

References uart0_rx_q.

00111                    {
00112   char ret_val = 0;
00113   while ((ret_val=dequeue(&uart0_rx_q))==0);
00114   return ret_val;
00115 }

char getchar_gps void   ) 
 

Definition at line 154 of file serial.c.

References uart1_rx_q.

00154                        {
00155   char ret_val = 0;
00156   while ((ret_val=dequeue(&uart1_rx_q))==0);
00157   return ret_val;
00158 }

char getchar_gps_nb void   ) 
 

Definition at line 160 of file serial.c.

References uart1_rx_q.

00160                           {
00161   return (dequeue(&uart1_rx_q));
00162 }

char getchar_nb void   ) 
 

Definition at line 117 of file serial.c.

References uart0_rx_q.

00117                       {
00118   return (dequeue(&uart0_rx_q));
00119 }

void init_serial_0 void   ) 
 

Definition at line 56 of file serial.c.

References uart0_rx_q, and uart0_tx_q.

Referenced by init_bsp().

00056                          {
00057   int temp;
00058 
00059   init_queue(&uart0_rx_q);
00060   init_queue(&uart0_tx_q);
00061   
00062   // 115200 baud (Connected to Host)
00063   UCTL0 = CHAR + SWRST;
00064   UTCTL0 = SSEL1 + SSEL0;
00065   UBR00=0x45; 
00066   UBR10=0x00; 
00067   UMCTL0=0xAA;
00068   ME1 = 0xC0;
00069   UCTL0 = CHAR;
00070   temp=RXBUF0;  // Flush the RX buffer 
00071   temp=RXBUF0;  
00072   IE1|=URXIE0;
00073 }

void init_serial_1 void   ) 
 

Definition at line 75 of file serial.c.

References uart1_rx_q, and uart1_tx_q.

Referenced by init_bsp().

00075                          {
00076   int temp;
00077 
00078   init_queue(&uart1_rx_q);
00079   init_queue(&uart1_tx_q);
00080 
00081   // 19200 Baud (GPS Receiver Channel) 
00082   UCTL1 = CHAR + SWRST;
00083   UTCTL1 = SSEL1 + SSEL0;
00084   UBR01=0xA0; 
00085   UBR11=0x01;
00086   UMCTL1=0x5B; 
00087   ME2 = 0x30;
00088   UCTL1 = CHAR;
00089   temp=RXBUF1;  // Flush the RX buffer 
00090   temp=RXBUF1;  
00091   IE2|=URXIE1;  // Turn on the RX interrupt 
00092 }

interrupt UART1TX_VECTOR   ) 
 

Definition at line 144 of file serial.c.

References uart1_tx_q.

00144                                                   {
00145   char temp;
00146   if ((temp=dequeue(&uart1_tx_q))==0) {
00147     IE2&=~UTXIE1;                       // Switch off the TX interrupt;
00148   }
00149   else {
00150     TXBUF1=temp;
00151   }
00152 }

interrupt UART1RX_VECTOR   ) 
 

Definition at line 139 of file serial.c.

References uart1_rx_q, and wiggler_p3().

00139                                                   {
00140   enqueue(&uart1_rx_q,RXBUF1);
00141   wiggler_p3();
00142 }

Here is the call graph for this function:

interrupt UART0TX_VECTOR   ) 
 

Definition at line 101 of file serial.c.

References uart0_tx_q.

00101                                                   {
00102   char temp;
00103   if ((temp=dequeue(&uart0_tx_q))==0) {
00104     IE1&=~UTXIE0;                       // Switch off the TX interrupt;
00105   }
00106   else {
00107     TXBUF0=temp;
00108   }
00109 }

interrupt UART0RX_VECTOR   ) 
 

Definition at line 97 of file serial.c.

References uart0_rx_q.

00097                                                   {
00098   enqueue(&uart0_rx_q,RXBUF0);
00099 }

int putchar int  in_char  ) 
 

Definition at line 121 of file serial.c.

References uart0_tx_q.

00121                          {
00122   enqueue(&uart0_tx_q,in_char);
00123   return (0);
00124 }

int putchar_gps int  in_char  ) 
 

Definition at line 164 of file serial.c.

References uart1_tx_q.

00164                              {
00165   enqueue(&uart1_tx_q,in_char);
00166   return (0);
00167 }


Variable Documentation

queue_t uart0_rx_q
 

Definition at line 50 of file serial.c.

Referenced by getchar(), getchar_nb(), init_serial_0(), and interrupt().

queue_t uart0_tx_q
 

Definition at line 53 of file serial.c.

Referenced by init_serial_0(), interrupt(), and putchar().

queue_t uart1_rx_q
 

Definition at line 51 of file serial.c.

Referenced by getchar_gps(), getchar_gps_nb(), init_serial_1(), and interrupt().

queue_t uart1_tx_q
 

Definition at line 54 of file serial.c.

Referenced by init_serial_1(), interrupt(), and putchar_gps().


Generated on Fri Nov 3 14:40:12 2006 for hwiflib by  doxygen 1.3.9.1