Atmel Software Framework

avr32/applications/evk1100-control-panel/serial/serial.h File Reference

Typedefs

typedef void * xComPortHandle
 

Enumerations

enum  eBaud {
  ser50,
  ser75,
  ser110,
  ser134,
  ser150,
  ser200,
  ser300,
  ser600,
  ser1200,
  ser1800,
  ser2400,
  ser4800,
  ser9600,
  ser19200,
  ser38400,
  ser57600,
  ser115200,
  ser50,
  ser75,
  ser110,
  ser134,
  ser150,
  ser200,
  ser300,
  ser600,
  ser1200,
  ser1800,
  ser2400,
  ser4800,
  ser9600,
  ser19200,
  ser38400,
  ser57600,
  ser115200
}
 
enum  eCOMPort {
  serCOM1,
  serCOM2,
  serCOM3,
  serCOM4,
  serCOM5,
  serCOM6,
  serCOM7,
  serCOM8,
  serCOM1,
  serCOM2,
  serCOM3,
  serCOM4,
  serCOM5,
  serCOM6,
  serCOM7,
  serCOM8
}
 
enum  eDataBits {
  serBITS_5,
  serBITS_6,
  serBITS_7,
  serBITS_8,
  serBITS_5,
  serBITS_6,
  serBITS_7,
  serBITS_8
}
 
enum  eParity {
  serNO_PARITY,
  serODD_PARITY,
  serEVEN_PARITY,
  serMARK_PARITY,
  serSPACE_PARITY,
  serNO_PARITY,
  serODD_PARITY,
  serEVEN_PARITY,
  serMARK_PARITY,
  serSPACE_PARITY
}
 
enum  eStopBits {
  serSTOP_1,
  serSTOP_2,
  serSTOP_1,
  serSTOP_2
}
 

Functions

unsigned portSHORT usUsartPutString (xComPortHandle pxPort, const signed portCHAR *const pcString, unsigned portSHORT usStringLength)
 Put a string to Usart. More...
 
void vSerialClose (xComPortHandle xPort)
 Close the serial port. More...
 
void vUSART0_ISR (void)
 
signed portBASE_TYPE xUsartGetChar (xComPortHandle pxPort, signed portCHAR *pcRxedChar, portTickType xBlockTime)
 Get char from Usart. More...
 
xComPortHandle xUsartInit (eCOMPort UsartId, unsigned portLONG ulWantedBaud, unsigned portBASE_TYPE uxRxQueueLength, unsigned portBASE_TYPE uxTxQueueLength)
 Init the serial port. More...
 
signed portBASE_TYPE xUsartPutChar (xComPortHandle pxPort, signed portCHAR cOutChar, portTickType xBlockTime)
 Put char to Usart. More...
 

typedef void* xComPortHandle

enum eBaud
Enumerator
ser50 
ser75 
ser110 
ser134 
ser150 
ser200 
ser300 
ser600 
ser1200 
ser1800 
ser2400 
ser4800 
ser9600 
ser19200 
ser38400 
ser57600 
ser115200 
ser50 
ser75 
ser110 
ser134 
ser150 
ser200 
ser300 
ser600 
ser1200 
ser1800 
ser2400 
ser4800 
ser9600 
ser19200 
ser38400 
ser57600 
ser115200 
enum eCOMPort
Enumerator
serCOM1 
serCOM2 
serCOM3 
serCOM4 
serCOM5 
serCOM6 
serCOM7 
serCOM8 
serCOM1 
serCOM2 
serCOM3 
serCOM4 
serCOM5 
serCOM6 
serCOM7 
serCOM8 
enum eDataBits
Enumerator
serBITS_5 
serBITS_6 
serBITS_7 
serBITS_8 
serBITS_5 
serBITS_6 
serBITS_7 
serBITS_8 
enum eParity
Enumerator
serNO_PARITY 
serODD_PARITY 
serEVEN_PARITY 
serMARK_PARITY 
serSPACE_PARITY 
serNO_PARITY 
serODD_PARITY 
serEVEN_PARITY 
serMARK_PARITY 
serSPACE_PARITY 
enum eStopBits
Enumerator
serSTOP_1 
serSTOP_2 
serSTOP_1 
serSTOP_2 

unsigned portSHORT usUsartPutString ( xComPortHandle  pxPort,
const signed portCHAR *const  pcString,
unsigned portSHORT  usStringLength 
)

Put a string to Usart.

Parameters
pxPortThe Usart handle to put the string to
pcStringThe string to transmit
usStringLengthThe number of char to transmit.

References pdPASS, serNO_BLOCK, and xUsartPutChar().

Referenced by ustracedump_Print(), vcom1shell_PrintMsg(), and vtracedump_PrintBlocking().

void vSerialClose ( xComPortHandle  xPort)

Close the serial port.

Parameters
xPortThe handle of the usart to close

References usartPrivateData::usart.

void vUSART0_ISR ( void  )
signed portBASE_TYPE xUsartGetChar ( xComPortHandle  pxPort,
signed portCHAR *  pcRxedChar,
portTickType  xBlockTime 
)

Get char from Usart.

Parameters
pxPortThe Usart handle to get the char from
pcRxedCharThe rxed char(output)
xBlockTimeThe max time to wait for a rxed char

References pdFALSE, pdTRUE, xQueueReceive, and usartPrivateData::xRxedChars.

Referenced by com1shell_GetChar(), and prvGetChar().

xComPortHandle xUsartInit ( eCOMPort  UsartId,
unsigned portLONG  ulWantedBaud,
unsigned portBASE_TYPE  uxRxQueueLength,
unsigned portBASE_TYPE  uxTxQueueLength 
)

Init the serial port.

Parameters
UsartIdThe identifier of the Usart to init.
ulWantedBaudThe required baudrate.
uxRxQueueLengthThe length of the Rx buffer (if 0, rx is not supported).
uxTxQueueLengthThe length of the Tx buffer (if 0, tx is not supported).
Returns
xComPortHandle Handler on the COM port.

Configure USART.

References usart_options_t::baudrate, CP_PBA_SPEED, gpio_enable_module_pin(), INTC_register_interrupt(), iprvSerialCreateQueues(), pdFAIL, portENTER_CRITICAL, portEXIT_CRITICAL, serCOM1, serINVALID_COMPORT_HANDLER, usartPrivateData::usart, USART_1_STOPBIT, usart_init_rs232(), USART_NO_PARITY, USART_NORMAL_CHMODE, USART_OPTIONS, vUSART0_ISR(), vUSART1_ISR(), usartPrivateData::xCharsForTx, usartPrivateData::xRxedChars, and xUsart1.

Referenced by itracedump_Init(), and portTASK_FUNCTION().

signed portBASE_TYPE xUsartPutChar ( xComPortHandle  pxPort,
signed portCHAR  cOutChar,
portTickType  xBlockTime 
)

Put char to Usart.

Parameters
pxPortThe Usart handle to put the char to
cOutCharThe char to transmit
xBlockTimeThe max time to wait for getting the right to transmit the char.

References pdFAIL, pdPASS, usartPrivateData::usart, usartPrivateData::xCharsForTx, and xQueueSend.

Referenced by usUsartPutString(), vcom1shell_PutChar(), vtracedump_Putchar(), and vtracedump_Putchar_Block().