- refactored libsys

- added critical section
- added interrupt global enable/disable
- added console::getInstanveByName



git-svn-id: http://moon:8086/svn/mips@76 a8ebac50-d88d-4704-bea3-6648445a41b3
This commit is contained in:
2017-01-12 16:25:20 +00:00
parent 0f4b7e015f
commit 5c9c50ebeb
21 changed files with 129 additions and 307 deletions
+20 -5
View File
@@ -11,7 +11,7 @@
extern con_if_t con_if;
// Funcs
con_if_entry_t const* con_getPort(int file)
con_if_entry_t const* con_getInterface(int file)
{
con_if_entry_t const *result = NULL;
int i;
@@ -26,6 +26,21 @@ con_if_entry_t const* con_getPort(int file)
return result;
}
void const* con_getInstanceByName(char const *pName)
{
void const *result = NULL;
int i;
for (i=0; i < con_if.length; i++)
{
if (!strcmp(pName, con_if.con_if_entry[i].pName))
{
result = con_if.con_if_entry[i].pInst;
break;
}
}
return result;
}
int con_open(char const *pName)
{
int i;
@@ -53,7 +68,7 @@ int con_close(int fd)
void con_flush(int fd)
{
int c;
con_if_entry_t const *pIF = con_getPort(fd);
con_if_entry_t const *pIF = con_getInterface(fd);
do
{
@@ -66,7 +81,7 @@ void con_flush(int fd)
int readchar(int fd)
{
int c;
con_if_entry_t const *pIF = con_getPort(fd);
con_if_entry_t const *pIF = con_getInterface(fd);
assert(pIF);
@@ -82,7 +97,7 @@ int readchar(int fd)
void writechar(int fd, char c)
{
con_if_entry_t const *pIF = con_getPort(fd);
con_if_entry_t const *pIF = con_getInterface(fd);
assert(pIF);
@@ -92,7 +107,7 @@ void writechar(int fd, char c)
void _putchar(int fd, char c)
{
con_if_entry_t const *pIF = con_getPort(fd);
con_if_entry_t const *pIF = con_getInterface(fd);
assert(pIF);
if (c == 0x0A)