Home Engineering Publications
DACS: SCI Serial Driver Header, SCIserial.h
  next up previous contents
Next: SCI Serial Driver Code, Up: Firmware Library, dacslib Previous: Firmware Library, dacslib   Contents

SCI Serial Driver Header, SCIserial.h

The following header file provides function prototypes for the 68HC11 SCI serial driver, structure definitions for data frames, payload size definitions, and data link control byte definitions.
 * DACS : Distributed Audio Control System
 *         File: SCIserial.h
 *       Author: Stephen S. Richardson
 * Date Created: 04.14.97
 *  Environment: ICC11 v4.0, 68HC11 target
 *        Build: library
 * The code, executables, documentation, firmware images, and all related
 * material of DACS are  
 * Copyright (C) 1997 Stephen S. Richardson - ALL RIGHTS RESERVED
 * Source code control:
 * $Id: SCIserial.h,v 1.1 1997/07/12 18:02:00 prefect Exp prefect $

#ifndef _SCIserial
#define _SCIserial

/* frame markers */
#define DLE 0x10     /* data link escape */
#define STX 0x02     /* start transmit */
#define ETX 0x03     /* end transmit */

/* buffers and lengths */

#define MAXPAYLOAD 128                     /* maximum length of the payload */
#define MAXFRLEN MAXPAYLOAD+MAXPAYLOAD+4   /* max frame length */
#define INBUFLEN MAXFRLEN+1                /* size of input buffer */
#define OUTBUFLEN MAXFRLEN+1               /* size of output buffer */

/* errors */

#define ERRTOOBIG  10         /* frame done; was too big! */

/* structures */

struct cooked_frame {          /* character stuffed frame */
  unsigned int len;
  unsigned int cur;
  unsigned char done;
  unsigned char data[MAXFRLEN];

struct raw_frame {             /* unstuffed frame */
  unsigned int len;
  unsigned int cur;
  unsigned char done;
  unsigned char dleflag;
  unsigned char stflag;
  unsigned char data[MAXPAYLOAD];

int SCI_poll_in (unsigned char *c);
char SCI_block_in (void);
void SCI_chout (unsigned char ch);
void SCI_out (char *s);
void SCI_init (void);
void SCI_prep_raw (struct raw_frame *raw);
void SCI_prep_cooked (struct cooked_frame *cooked);
void SCI_data_to_cooked (char *data, int len, struct cooked_frame *cooked);
int SCI_service (struct raw_frame *inraw, struct cooked_frame *outfr);


Steve Richardson 2000-07-06
Table of Contents

[PDF] [Whole document in PDF 1.9MB]

[more photos and information]

Page last modified:
Copyright © 1993-2000 prefect - All Rights Reserved.