1 // ---------------------------------------------------------------------------
2 // Hyper Operating System V4 コンフィギュレーター
5 // Copyright (C) 1998-2010 by Project HOS
6 // http://sourceforge.jp/projects/hos/
7 // ---------------------------------------------------------------------------
19 #define INTSTK_STKSZ 0
23 #define DEFAULT_SIZE "256"
24 #define DEFAULT_STACK "NULL"
28 CApiIntStack::CApiIntStack()
31 m_iParamSyntax[0] = 0; // 単独パラメーター
35 m_szStackPointer[0] = '\0';
40 CApiIntStack::~CApiIntStack()
46 int CApiIntStack::AutoId(void)
53 int CApiIntStack::AnalyzeApi(const char* pszApiName, const char* pszParams)
55 if ( strcmp(pszApiName, "KERNEL_INT_STK") == 0 )
59 return CFG_ERR_MULTIDEF;
62 if ( m_szStackPointer[0] != '\0' )
64 return CFG_ERR_DEF_CONFLICT;
67 return AddParams(pszParams);
70 return CFG_ERR_NOPROC;
75 void CApiIntStack::WriteCfgDef(FILE* fp)
83 pszSize = DEFAULT_SIZE;
84 pszStack = DEFAULT_STACK;
88 pszSize = m_pParamPacks[0]->GetParam(INTSTK_STKSZ);
89 pszStack = m_pParamPacks[0]->GetParam(INTSTK_STK);
96 "/* ------------------------------------------ */\n"
97 "/* interrupt stack */\n"
98 "/* ------------------------------------------ */\n\n"
101 if ( strcmp(pszStack, "NULL") == 0 )
105 "VP _kernel_int_stkblk[((%s) + sizeof(VP) - 1) / sizeof(VP)];\n"
106 "const VP _kernel_int_isp = &_kernel_int_stkblk[((%s) + sizeof(VP) - 1) / sizeof(VP)];\n",
113 "const VP _kernel_int_isp = (VP)((VB *)(%s) + (SIZE)(%s));\n",
120 void CApiIntStack::WriteCfgIni(FILE* fp)
123 const char* pszStack;
128 pszSize = DEFAULT_SIZE;
129 pszStack = DEFAULT_STACK;
133 pszSize = m_pParamPacks[0]->GetParam(INTSTK_STKSZ);
134 pszStack = m_pParamPacks[0]->GetParam(INTSTK_STK);
138 if ( strcmp(pszStack, "NULL") == 0 )
142 "\t_KERNEL_SYS_INI_INTSTK((SIZE)sizeof(_kernel_int_stkblk), (VP)(_kernel_int_stkblk));\n");
148 "\t_KERNEL_SYS_INI_INTSTK((SIZE)(%s), (VP)(%s));\n",
153 void CApiIntStack::WriteStackMemory(FILE* fp)
156 const char* pszStack;
161 pszSize = DEFAULT_SIZE;
162 pszStack = DEFAULT_STACK;
166 pszSize = m_pParamPacks[0]->GetParam(INTSTK_STKSZ);
167 pszStack = m_pParamPacks[0]->GetParam(INTSTK_STK);
170 if ( strcmp(pszStack, "NULL") == 0 )
172 fprintf(fp, "extern VP _kernel_int_stkblk[((%s) + sizeof(VP) - 1) / sizeof(VP)];\n", pszSize);
177 void CApiIntStack::WriteStackPointer(FILE* fp)
180 const char* pszStack;
185 pszSize = DEFAULT_SIZE;
186 pszStack = DEFAULT_STACK;
190 pszSize = m_pParamPacks[0]->GetParam(INTSTK_STKSZ);
191 pszStack = m_pParamPacks[0]->GetParam(INTSTK_STK);
194 if ( strcmp(pszStack, "NULL") == 0 )
196 fprintf(fp, "&_kernel_int_stkblk[((%s) + sizeof(VP) - 1) / sizeof(VP)]", pszSize);
200 fprintf(fp, "(VB *)(%s) + (SIZE)(%s)", pszStack, pszSize);
206 // ---------------------------------------------------------------------------
208 // ---------------------------------------------------------------------------