Details | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 9 | f9daq | 1 | //------------------------------------------------------------------------------------------- |
| 2 | // mbuffer.c - some functions to do a simple message buffering |
||
| 3 | // |
||
| 4 | // (c) 1999 ARW Elektronik |
||
| 5 | // |
||
| 6 | // this source code is published under GPL (Open Source). You can use, redistrubute and |
||
| 7 | // modify it unless this header is not modified or deleted. No warranty is given that |
||
| 8 | // this software will work like expected. |
||
| 9 | // This product is not authorized for use as critical component in life support systems |
||
| 10 | // wihout the express written approval of ARW Elektronik Germany. |
||
| 11 | // |
||
| 12 | // Please announce changes and hints to ARW Elektronik |
||
| 13 | // |
||
| 14 | // $Log: mbuffer.c,v $ |
||
| 15 | // Revision 1.3 2002/10/20 11:49:33 klaus |
||
| 16 | // first parts working |
||
| 17 | // |
||
| 18 | // Revision 1.2 2002/10/19 09:47:30 klaus |
||
| 19 | // first success compiling project |
||
| 20 | // |
||
| 21 | // Revision 1.1.1.1 2002/10/18 22:14:29 klaus |
||
| 22 | // |
||
| 23 | |||
| 24 | //------------------------------------------------------------------------------------------- |
||
| 25 | // DEFINES |
||
| 26 | // |
||
| 27 | #define LOCAL_BUFFERLENGTH 250 |
||
| 28 | |||
| 29 | //------------------------------------------------------------------------------------------- |
||
| 30 | // INCLUDES |
||
| 31 | // |
||
| 32 | #include <stdio.h> |
||
| 33 | #include <mbuffer.h> |
||
| 34 | |||
| 35 | //------------------------------------------------------------------------------------------- |
||
| 36 | // LOCALS |
||
| 37 | // |
||
| 38 | static char MBuffer[LOCAL_BUFFERLENGTH]; |
||
| 39 | |||
| 40 | //------------------------------------------------------------ |
||
| 41 | // add unsolicited interrupt message to buffer |
||
| 42 | // |
||
| 43 | void AddIRQtoBuffer(short level, short vector) |
||
| 44 | { |
||
| 45 | sprintf(MBuffer, "Interrupt @ level %d with vector %d signaled.", level, vector); |
||
| 46 | } |
||
| 47 | |||
| 48 | //------------------------------------------------------------ |
||
| 49 | // add unsolicited error message to buffer |
||
| 50 | // |
||
| 51 | void AddMsgtoBuffer(int where, unsigned long Error) |
||
| 52 | { |
||
| 53 | sprintf(MBuffer, "Error %d occured (%d)!", Error, where); |
||
| 54 | } |
||
| 55 | |||
| 56 | //------------------------------------------------------------ |
||
| 57 | // add unsolicited error message as string to buffer |
||
| 58 | // |
||
| 59 | void AddMsgAsStringtoBuffer(char *strn) |
||
| 60 | { |
||
| 61 | sprintf(MBuffer,"%s", strn); |
||
| 62 | } |
||
| 63 | |||
| 64 | //------------------------------------------------------------ |
||
| 65 | // get back a message from the buffer |
||
| 66 | // |
||
| 67 | char *ReadMessageBuffer(void) |
||
| 68 | { |
||
| 69 | return MBuffer; |
||
| 70 | } |
||
| 71 | |||
| 72 | //------------------------------------------------------------ |
||
| 73 | // initilaize the buffer |
||
| 74 | // |
||
| 75 | void InitMessageBuffer(void) |
||
| 76 | { |
||
| 77 | MBuffer[0] = 0; |
||
| 78 | } |
||
| 79 | |||
| 80 | //------------------------------------------------------------------------------------------- |
||
| 81 | //------------------------------------------------------------------------------------------- |
||
| 82 | //------------------------------------------------------------------------------------------- |