SERIAL.C File Reference

Device-level routines for MSP430F149 usart (2). More...

#include <Environment.h>
#include <serial.h>

Include dependency graph for SERIAL.C:

Go to the source code of this file.

Defines

#define BAUD_115200(N)   { U##N##BR1 = 0x00; U##N##BR0 = 0x2A; U##N##MCTL = 0x08; }
#define IS_URX_BUF_EMPTY()   ( ! ( IFG1 & URXIFG0 ) )
#define IS_UTX_BUF_READY()   ( U0TCTL & TXEPT )
#define RXBUF   ( RXBUF0 )
#define TXBUF   ( TXBUF0 )

Functions

int serial_close (int file_descriptor)
 Closes the device associated with file_descriptor.
char serial_getchar (void)
 Reads the next byte.
void serial_init (void)
 Initializes the device.
int serial_kbhit (void)
 Do we have receive a character.
int serial_open (const char *path, unsigned flags, int file_descriptor)
 Opens the device and prepares it for input / output.
void serial_putchar (char c)
 Writes a character to the device.
void serial_puts (const char *string)
 Writes a string to the device.
int serial_read (char *buffer, unsigned count)
 Read the number of charactes specified by count to the buffer from the device.
int serial_write (int file_descriptor, const char *buffer, unsigned count)
 Writes the number of characters specified by count from the buffer to the device or file.


Detailed Description

Device-level routines for MSP430F149 usart (2).

Author:
BARRIEZ Fabrice
Version:
1.0
Date:
2005 / 09 / 01

Definition in file SERIAL.C.


Define Documentation

#define BAUD_115200 (  )     { U##N##BR1 = 0x00; U##N##BR0 = 0x2A; U##N##MCTL = 0x08; }

Definition at line 67 of file SERIAL.C.

Referenced by serial_init().

 
#define IS_URX_BUF_EMPTY (  )     ( ! ( IFG1 & URXIFG0 ) )

Definition at line 30 of file SERIAL.C.

Referenced by serial_getchar(), serial_kbhit(), and serial_read().

 
#define IS_UTX_BUF_READY (  )     ( U0TCTL & TXEPT )

Definition at line 29 of file SERIAL.C.

Referenced by serial_putchar(), and serial_write().

#define RXBUF   ( RXBUF0 )

Definition at line 28 of file SERIAL.C.

Referenced by serial_getchar(), and serial_read().

#define TXBUF   ( TXBUF0 )

Definition at line 27 of file SERIAL.C.

Referenced by serial_putchar(), and serial_write().


Function Documentation

int serial_close ( int  file_descriptor  ) 

Closes the device associated with file_descriptor.

Parameters:
[in] file_descriptor : Is the stream number assigned by the low-level routines.
Returns:
0 : If successful.

-1 : If fails.

Definition at line 121 of file SERIAL.C.

char serial_getchar ( void   ) 

Reads the next byte.

Returns:
Returns the next byte.

Definition at line 224 of file SERIAL.C.

References IS_URX_BUF_EMPTY, and RXBUF.

Referenced by PT_THREAD().

Here is the caller graph for this function:

void serial_init ( void   ) 

Initializes the device.

Definition at line 79 of file SERIAL.C.

References BAUD_115200.

Referenced by init(), and serial_open().

Here is the caller graph for this function:

int serial_kbhit ( void   ) 

Do we have receive a character.

Returns:
0 : No.

# : Yes.

Definition at line 240 of file SERIAL.C.

References IS_URX_BUF_EMPTY.

Referenced by PT_THREAD().

Here is the caller graph for this function:

int serial_open ( const char *  path,
unsigned  flags,
int  file_descriptor 
)

Opens the device and prepares it for input / output.

Parameters:
[in] path : Filename of the file to be opened, including path information.
[in] flags : Attributes that specify how the device is manipulated.
[in] file_descriptor : Is the stream number assigned by the low-level routines.
Returns:
-1 : If fails.

! -1 : If successful.

Definition at line 104 of file SERIAL.C.

References serial_init().

Here is the call graph for this function:

void serial_putchar ( char  c  ) 

Writes a character to the device.

Parameters:
[in] c : Specifies the byte to be written.

Definition at line 189 of file SERIAL.C.

References IS_UTX_BUF_READY, and TXBUF.

Referenced by build_req(), display_hexa(), display_number(), init(), PT_THREAD(), and serial_puts().

Here is the caller graph for this function:

void serial_puts ( const char *  string  ) 

Writes a string to the device.

Parameters:
[in] string : Points to a string to be written.

Definition at line 205 of file SERIAL.C.

References serial_putchar().

Referenced by build_req(), display_info(), init(), main(), PT_THREAD(), serveur_reprog(), switch_interrupt(), and vt100_init().

Here is the call graph for this function:

Here is the caller graph for this function:

int serial_read ( char *  buffer,
unsigned  count 
)

Read the number of charactes specified by count to the buffer from the device.

Parameters:
[in] file_descriptor : Is the stream number assigned by the low-level routines.
[out] buffer : Is the location of the buffer where the read characters are placed.
[in] count : Is the number of characters to read from the device.
Returns:
-1 : If fails.

0 : If EOF was encountered before the read was complete.

# : Number of characters read in every other instance.

Definition at line 140 of file SERIAL.C.

References IS_URX_BUF_EMPTY, and RXBUF.

Referenced by main().

Here is the caller graph for this function:

int serial_write ( int  file_descriptor,
const char *  buffer,
unsigned  count 
)

Writes the number of characters specified by count from the buffer to the device or file.

Parameters:
[in] file_descriptor : Is the stream number assigned by the low-level routines.
[in] buffer : Is the location of the buffer where the write characters are placed.
[in] count : Is the number of characters to write to the device.
Returns:
-1 : If fails.

# : Number of characters written if successful.

Definition at line 168 of file SERIAL.C.

References IS_UTX_BUF_READY, and TXBUF.


Generated on Wed Jun 3 12:06:03 2009 for PowWow v1.0 by  doxygen 1.5.6