/*****************************************************
* NAME : message_out
*
* DESCRIPTION:
* waits for a message in the message out queue,
* when one appears it assembles it then sends it.
*****************************************************/
#include "que.h"
extern struct g_queue out_que;
unsigned char buf[32];
void message_out()
{
unsigned char no_msg_out,length;
int i;
while (true)
{
length = remove_one(&out_que);
buf[0] = length;
for(i=1; i<=length; i++)
buf[i] = remove_one(&out_que);
format_msg();
send_msg();
}
}
/******************************************************
* NAME: format_msg
*
* DESCRIPTION: takes a message in the buffer and
* formats it for the serial port.
*******************************************************/
format_msg()
{
/* prepare a buffer for crc generation */
/* now calculate the CRC */
/* insert the crc bytes into the buffer */
/* now add the DLE characters */
/* add the stop flag */
/* now check the CRC characters to see if we should add DLE's */
/* finally - put in the length of total buffer */
}
**********************************************************************
*
* NAME : send_msg
*
* */
send_msg()
{
/* send the first character to the serial port to kick off the
serial transmission. turn on the interupts and let the interrupts
finish the rest of the transmission */
/* now turn on the serial transmit buffer */
/* send the first character to the serial transmit buffer */
/* enable the interrupt for serial transmit data register empty */
/* wait for the last character to be completely transmitted */
}