summaryrefslogtreecommitdiff
path: root/support/regression/tests/bug3381400.c
blob: 569391432bb54cc048f627e720ef2aed2195cb0a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/*
   bug3381400.c
*/

#include <testfwk.h>

#pragma disable_warning  85 //no warning about unreferenced variables (W_NO_REFERENCE)

#ifndef __SDCC_pdk14 // Lack of memory

#define UCHAR	unsigned char
#define USHORT	unsigned short
#define PCHAR	unsigned char *

#ifdef __SDCC_z80
__sfr __at 0x05 rSRAM_Page;
#endif

#define FILE_FLAG_PAGE_SIZE		0xffd0

#define BUF_PAGE_NUM	4

#define DEFAULT_MEMORY_PAGE		0x07
void ReadFlashData(USHORT sDstAddr, USHORT sSrcAddr, USHORT sLen, UCHAR iPage);

UCHAR Sys_iSystemPage;

#define DSP_INFO_LEN	0x40
#define DM_START_POS	0x0e

#define PAGE_EDGE	(FILE_FLAG_PAGE_SIZE >> 1)

typedef struct _dsp_page
{
	UCHAR iPage;
	USHORT sPageOffset;
} DSP_PAGE;

void ReadFlashData(USHORT sDstAddr, USHORT sSrcAddr, USHORT sLen, UCHAR iPage)
{
	ASSERT(iPage == 42);
}

void _DspLoadFile(DSP_PAGE * pDspPage, USHORT sDMOffset)
{
	UCHAR i, iPage;
	USHORT sDMAddr;
	UCHAR pInfo[DSP_INFO_LEN];

	iPage = pDspPage->iPage + Sys_iSystemPage;
	ReadFlashData((USHORT)pInfo, (pDspPage->sPageOffset << 1), DSP_INFO_LEN, iPage);	// get dsp info

	for (i = 0; i < BUF_PAGE_NUM+2; i ++)
	{
	}
#ifdef __SDCC_z80
	rSRAM_Page = DEFAULT_MEMORY_PAGE;
#endif
}
#endif

void testBug(void)
{

#ifndef __SDCC_pdk14 // Lack of memory
	DSP_PAGE p;
	p.iPage = 23;
	Sys_iSystemPage = 42 - 23;
	_DspLoadFile(&p, 0);
#endif
}