LPCtarget/plc_LPC_main.c
author Edouard Tisserant
Wed, 20 Mar 2013 11:28:38 +0900
changeset 31 a9c9d1fc97d3
parent 30 9cd6bc93ed89
permissions -rwxr-xr-x
Made better ctypes unpacking of PLC data
0
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
     1
/**
29
86fb7dc2b54e Untested support for logging
Drauoude Tnaressit
parents: 0
diff changeset
     2
 * LPC specific code
0
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
     3
 **/
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
     4
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
     5
#include <string.h>
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
     6
#include <app_glue.h>
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
     7
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
     8
extern unsigned long idLen;
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
     9
extern unsigned char *idBuf;
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
    10
29
86fb7dc2b54e Untested support for logging
Drauoude Tnaressit
parents: 0
diff changeset
    11
static unsigned char RetainedIdBuf[128] NONVOLATILE;
86fb7dc2b54e Untested support for logging
Drauoude Tnaressit
parents: 0
diff changeset
    12
static unsigned char retain_buffer[RETAIN_BUFFER_SIZE] NONVOLATILE;
86fb7dc2b54e Untested support for logging
Drauoude Tnaressit
parents: 0
diff changeset
    13
86fb7dc2b54e Untested support for logging
Drauoude Tnaressit
parents: 0
diff changeset
    14
#define LOG_BUFFER_SIZE (1<<10) /*1Ko*/
86fb7dc2b54e Untested support for logging
Drauoude Tnaressit
parents: 0
diff changeset
    15
#define LOG_BUFFER_ATTRS NONVOLATILE
0
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
    16
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
    17
static int debug_locked = 0;
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
    18
static int _DebugDataAvailable = 0;
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
    19
static unsigned long __debug_tick;
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
    20
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
    21
void LPC_GetTime(IEC_TIME*);
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
    22
void LPC_SetTimer(unsigned long long next, unsigned long long period);
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
    23
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
    24
long AtomicCompareExchange(long* atomicvar,long compared, long exchange)
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
    25
{
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
    26
	/* No need for real atomic op on LPC,
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
    27
	 * no possible preemption between debug and PLC */
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
    28
	long res = *atomicvar;
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
    29
	if(res == compared){
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
    30
		*atomicvar = exchange;
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
    31
	}
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
    32
	return res;
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
    33
}
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
    34
31
a9c9d1fc97d3 Made better ctypes unpacking of PLC data
Edouard Tisserant
parents: 30
diff changeset
    35
long long AtomicCompareExchange64(long long* atomicvar,long long compared, long long exchange)
30
9cd6bc93ed89 Fixed support for logging and simulation
Laurent Bessard
parents: 29
diff changeset
    36
{
9cd6bc93ed89 Fixed support for logging and simulation
Laurent Bessard
parents: 29
diff changeset
    37
	/* No need for real atomic op on LPC,
9cd6bc93ed89 Fixed support for logging and simulation
Laurent Bessard
parents: 29
diff changeset
    38
	 * no possible preemption between debug and PLC */
9cd6bc93ed89 Fixed support for logging and simulation
Laurent Bessard
parents: 29
diff changeset
    39
	long long res = *atomicvar;
9cd6bc93ed89 Fixed support for logging and simulation
Laurent Bessard
parents: 29
diff changeset
    40
	if(res == compared){
9cd6bc93ed89 Fixed support for logging and simulation
Laurent Bessard
parents: 29
diff changeset
    41
		*atomicvar = exchange;
9cd6bc93ed89 Fixed support for logging and simulation
Laurent Bessard
parents: 29
diff changeset
    42
	}
9cd6bc93ed89 Fixed support for logging and simulation
Laurent Bessard
parents: 29
diff changeset
    43
	return res;
9cd6bc93ed89 Fixed support for logging and simulation
Laurent Bessard
parents: 29
diff changeset
    44
}
9cd6bc93ed89 Fixed support for logging and simulation
Laurent Bessard
parents: 29
diff changeset
    45
9cd6bc93ed89 Fixed support for logging and simulation
Laurent Bessard
parents: 29
diff changeset
    46
0
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
    47
void PLC_GetTime(IEC_TIME *CURRENT_TIME)
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
    48
{
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
    49
	/* Call target GetTime function */
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
    50
	LPC_GetTime(CURRENT_TIME);
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
    51
}
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
    52
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
    53
void PLC_SetTimer(unsigned long long next, unsigned long long period)
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
    54
{
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
    55
	LPC_SetTimer(next, period);
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
    56
}
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
    57
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
    58
int startPLC(int argc,char **argv)
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
    59
{
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
    60
	if(__init(argc,argv) == 0){
29
86fb7dc2b54e Untested support for logging
Drauoude Tnaressit
parents: 0
diff changeset
    61
		PLC_SetTimer(0, Ttick);
0
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
    62
		return 0;
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
    63
	}else{
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
    64
		return 1;
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
    65
	}
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
    66
}
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
    67
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
    68
int TryEnterDebugSection(void)
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
    69
{
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
    70
    if(!debug_locked && __DEBUG){
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
    71
        debug_locked = 1;
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
    72
		return 1;
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
    73
    }
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
    74
    return 0;
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
    75
}
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
    76
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
    77
void LeaveDebugSection(void)
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
    78
{
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
    79
        debug_locked = 0;
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
    80
}
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
    81
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
    82
int stopPLC(void)
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
    83
{
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
    84
    __cleanup();
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
    85
    return 0;
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
    86
}
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
    87
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
    88
/* from plc_debugger.c */
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
    89
int WaitDebugData(unsigned long *tick)
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
    90
{
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
    91
    /* no blocking call on LPC */
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
    92
    if(_DebugDataAvailable && !debug_locked){
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
    93
        /* returns 0 on success */
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
    94
        *tick = __debug_tick;
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
    95
        _DebugDataAvailable = 0;
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
    96
        return 0;
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
    97
    }
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
    98
    return 1;
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
    99
}
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
   100
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
   101
/* Called by PLC thread when debug_publish finished
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
   102
 * This is supposed to unlock debugger thread in WaitDebugData*/
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
   103
void InitiateDebugTransfer(void)
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
   104
{
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
   105
    /* remember tick */
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
   106
    __debug_tick = __tick;
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
   107
    _DebugDataAvailable = 1;
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
   108
}
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
   109
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
   110
void suspendDebug(int disable)
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
   111
{
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
   112
    /* Prevent PLC to enter debug code */
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
   113
    __DEBUG = !disable;
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
   114
    debug_locked = !disable;
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
   115
}
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
   116
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
   117
void resumeDebug(void)
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
   118
{
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
   119
    /* Let PLC enter debug code */
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
   120
    __DEBUG = 1;
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
   121
    debug_locked = 0;
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
   122
}
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
   123
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
   124
void ValidateRetainBuffer(void)
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
   125
{
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
   126
        memcpy(RetainedIdBuf, idBuf, idLen);
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
   127
}
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
   128
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
   129
void InValidateRetainBuffer(void)
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
   130
{
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
   131
    /* invalidate that buffer */
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
   132
    RetainedIdBuf[0] = 0;
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
   133
}
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
   134
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
   135
int CheckRetainBuffer(void)
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
   136
{
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
   137
	/* compare RETAIN ID buffer with MD5 */
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
   138
    /* return true if identical */
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
   139
    int res = memcmp(RetainedIdBuf, idBuf, idLen) == 0;
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
   140
    return res;
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
   141
}
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
   142
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
   143
void Retain(unsigned int offset, unsigned int count, void *p)
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
   144
{
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
   145
    if(offset + count < RETAIN_BUFFER_SIZE)
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
   146
        /* write in RETAIN buffer at offset*/
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
   147
        memcpy(&retain_buffer[offset], p, count);
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
   148
}
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
   149
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
   150
void Remind(unsigned int offset, unsigned int count, void *p)
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
   151
{
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
   152
    if(offset + count < RETAIN_BUFFER_SIZE)
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
   153
        /* read at offset in RETAIN buffer */
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
   154
        memcpy(p, &retain_buffer[offset], count);
51f5a3138405 Initial commit, LPC files taken out of beremiz revision 915be999f3f0
Edouard Tisserant
parents:
diff changeset
   155
}