int32_t
This commit is contained in:
parent
80700af624
commit
07484c2674
|
@ -0,0 +1,39 @@
|
||||||
|
#include <ofw.h>
|
||||||
|
|
||||||
|
extern void (*ofw)();
|
||||||
|
|
||||||
|
ihandle open(char* device_specifier)
|
||||||
|
{
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
char* service;
|
||||||
|
int32_t n_args;
|
||||||
|
int32_t n_rets;
|
||||||
|
char* arg;
|
||||||
|
ihandle ret;
|
||||||
|
} ofw_arg;
|
||||||
|
|
||||||
|
SERVICE("open", 5, 1, 1);
|
||||||
|
|
||||||
|
ofw_arg.arg = device_specifier;
|
||||||
|
|
||||||
|
ofw(&ofw_arg);
|
||||||
|
return ofw_arg.ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
void close(ihandle instance)
|
||||||
|
{
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
char* service;
|
||||||
|
int32_t n_args;
|
||||||
|
int32_t n_rets;
|
||||||
|
ihandle arg;
|
||||||
|
} ofw_arg;
|
||||||
|
|
||||||
|
SERVICE("close", 6, 1, 0);
|
||||||
|
|
||||||
|
ofw_arg.arg = instance;
|
||||||
|
|
||||||
|
ofw(&ofw_arg);
|
||||||
|
}
|
|
@ -2,15 +2,15 @@
|
||||||
|
|
||||||
extern void (*ofw)();
|
extern void (*ofw)();
|
||||||
|
|
||||||
int ofw_test(char* name)
|
int32_t ofw_test(char* name)
|
||||||
{
|
{
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
char* service;
|
char* service;
|
||||||
int n_args;
|
int32_t n_args;
|
||||||
int n_rets;
|
int32_t n_rets;
|
||||||
char* arg;
|
char* arg;
|
||||||
int ret;
|
int32_t ret;
|
||||||
} ofw_arg;
|
} ofw_arg;
|
||||||
|
|
||||||
SERVICE("test", 5, 1, 1);
|
SERVICE("test", 5, 1, 1);
|
||||||
|
|
84
entry/tree.c
84
entry/tree.c
|
@ -7,8 +7,8 @@ phandle child(phandle _child)
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
char* service;
|
char* service;
|
||||||
int n_args;
|
int32_t n_args;
|
||||||
int n_rets;
|
int32_t n_rets;
|
||||||
phandle arg;
|
phandle arg;
|
||||||
phandle ret;
|
phandle ret;
|
||||||
} ofw_arg;
|
} ofw_arg;
|
||||||
|
@ -26,8 +26,8 @@ phandle parent(phandle _parent)
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
char* service;
|
char* service;
|
||||||
int n_args;
|
int32_t n_args;
|
||||||
int n_rets;
|
int32_t n_rets;
|
||||||
phandle arg;
|
phandle arg;
|
||||||
phandle ret;
|
phandle ret;
|
||||||
} ofw_arg;
|
} ofw_arg;
|
||||||
|
@ -45,8 +45,8 @@ phandle instance_to_package(ihandle instance)
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
char* service;
|
char* service;
|
||||||
int n_args;
|
int32_t n_args;
|
||||||
int n_rets;
|
int32_t n_rets;
|
||||||
ihandle arg;
|
ihandle arg;
|
||||||
phandle ret;
|
phandle ret;
|
||||||
} ofw_arg;
|
} ofw_arg;
|
||||||
|
@ -59,16 +59,16 @@ phandle instance_to_package(ihandle instance)
|
||||||
return ofw_arg.ret;
|
return ofw_arg.ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int getproplen(phandle node, char* name)
|
int32_t getproplen(phandle node, char* name)
|
||||||
{
|
{
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
char* service;
|
char* service;
|
||||||
int n_args;
|
int32_t n_args;
|
||||||
int n_rets;
|
int32_t n_rets;
|
||||||
phandle arg1;
|
phandle arg1;
|
||||||
char* arg2;
|
char* arg2;
|
||||||
int ret;
|
int32_t ret;
|
||||||
} ofw_arg;
|
} ofw_arg;
|
||||||
|
|
||||||
SERVICE("getproplen", 11, 2, 1);
|
SERVICE("getproplen", 11, 2, 1);
|
||||||
|
@ -80,18 +80,18 @@ int getproplen(phandle node, char* name)
|
||||||
return ofw_arg.ret;
|
return ofw_arg.ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int getprop(phandle node, char* name, uint8_t* buf, int buflen)
|
int32_t getprop(phandle node, char* name, uint8_t* buf, int32_t buflen)
|
||||||
{
|
{
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
char* service;
|
char* service;
|
||||||
int n_args;
|
int32_t n_args;
|
||||||
int n_rets;
|
int32_t n_rets;
|
||||||
phandle arg1;
|
phandle arg1;
|
||||||
char* arg2;
|
char* arg2;
|
||||||
uint8_t* arg3;
|
uint8_t* arg3;
|
||||||
int arg4;
|
int32_t arg4;
|
||||||
int ret;
|
int32_t ret;
|
||||||
} ofw_arg;
|
} ofw_arg;
|
||||||
|
|
||||||
SERVICE("getprop", 8, 4, 1);
|
SERVICE("getprop", 8, 4, 1);
|
||||||
|
@ -105,17 +105,17 @@ int getprop(phandle node, char* name, uint8_t* buf, int buflen)
|
||||||
return ofw_arg.ret;
|
return ofw_arg.ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int nextprop(phandle node, char* previous, uint8_t* buf)
|
int32_t nextprop(phandle node, char* previous, uint8_t* buf)
|
||||||
{
|
{
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
char* service;
|
char* service;
|
||||||
int n_args;
|
int32_t n_args;
|
||||||
int n_rets;
|
int32_t n_rets;
|
||||||
phandle arg1;
|
phandle arg1;
|
||||||
char* arg2;
|
char* arg2;
|
||||||
uint8_t* arg3;
|
uint8_t* arg3;
|
||||||
int ret;
|
int32_t ret;
|
||||||
} ofw_arg;
|
} ofw_arg;
|
||||||
|
|
||||||
SERVICE("nextprop", 9, 3, 1);
|
SERVICE("nextprop", 9, 3, 1);
|
||||||
|
@ -128,18 +128,18 @@ int nextprop(phandle node, char* previous, uint8_t* buf)
|
||||||
return ofw_arg.ret;
|
return ofw_arg.ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int setprop(phandle node, char* name, uint8_t* buf, int len)
|
int32_t setprop(phandle node, char* name, uint8_t* buf, int32_t len)
|
||||||
{
|
{
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
char* service;
|
char* service;
|
||||||
int n_args;
|
int32_t n_args;
|
||||||
int n_rets;
|
int32_t n_rets;
|
||||||
phandle arg1;
|
phandle arg1;
|
||||||
char* arg2;
|
char* arg2;
|
||||||
uint8_t* arg3;
|
uint8_t* arg3;
|
||||||
int arg4;
|
int32_t arg4;
|
||||||
int ret;
|
int32_t ret;
|
||||||
} ofw_arg;
|
} ofw_arg;
|
||||||
|
|
||||||
char _service[8] = "setprop";
|
char _service[8] = "setprop";
|
||||||
|
@ -156,17 +156,17 @@ int setprop(phandle node, char* name, uint8_t* buf, int len)
|
||||||
return ofw_arg.ret;
|
return ofw_arg.ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int canon(char* device, uint8_t* buf, int buflen)
|
int32_t canon(char* device, uint8_t* buf, int32_t buflen)
|
||||||
{
|
{
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
char* service;
|
char* service;
|
||||||
int n_args;
|
int32_t n_args;
|
||||||
int n_rets;
|
int32_t n_rets;
|
||||||
char* arg1;
|
char* arg1;
|
||||||
uint8_t* arg2;
|
uint8_t* arg2;
|
||||||
int arg3;
|
int32_t arg3;
|
||||||
int ret;
|
int32_t ret;
|
||||||
} ofw_arg;
|
} ofw_arg;
|
||||||
|
|
||||||
SERVICE("canon", 6, 3, 1);
|
SERVICE("canon", 6, 3, 1);
|
||||||
|
@ -184,10 +184,10 @@ phandle finddevice(char* device)
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
char* service;
|
char* service;
|
||||||
int n_args;
|
int32_t n_args;
|
||||||
int n_rets;
|
int32_t n_rets;
|
||||||
char* arg1;
|
char* arg1;
|
||||||
int ret;
|
int32_t ret;
|
||||||
} ofw_arg;
|
} ofw_arg;
|
||||||
|
|
||||||
SERVICE("finddevice", 11, 1, 1);
|
SERVICE("finddevice", 11, 1, 1);
|
||||||
|
@ -198,17 +198,17 @@ phandle finddevice(char* device)
|
||||||
return ofw_arg.ret;
|
return ofw_arg.ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int instance_to_path(ihandle instance, uint8_t* buf, int buflen)
|
int32_t instance_to_path(ihandle instance, uint8_t* buf, int32_t buflen)
|
||||||
{
|
{
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
char* service;
|
char* service;
|
||||||
int n_args;
|
int32_t n_args;
|
||||||
int n_rets;
|
int32_t n_rets;
|
||||||
ihandle arg1;
|
ihandle arg1;
|
||||||
uint8_t* arg2;
|
uint8_t* arg2;
|
||||||
int arg3;
|
int32_t arg3;
|
||||||
int ret;
|
int32_t ret;
|
||||||
} ofw_arg;
|
} ofw_arg;
|
||||||
|
|
||||||
SERVICE("instance-to-path", 17, 3, 1);
|
SERVICE("instance-to-path", 17, 3, 1);
|
||||||
|
@ -222,17 +222,17 @@ int instance_to_path(ihandle instance, uint8_t* buf, int buflen)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int package_to_path(phandle package, uint8_t* buf, int buflen)
|
int32_t package_to_path(phandle package, uint8_t* buf, int32_t buflen)
|
||||||
{
|
{
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
char* service;
|
char* service;
|
||||||
int n_args;
|
int32_t n_args;
|
||||||
int n_rets;
|
int32_t n_rets;
|
||||||
ihandle arg1;
|
ihandle arg1;
|
||||||
uint8_t* arg2;
|
uint8_t* arg2;
|
||||||
int arg3;
|
int32_t arg3;
|
||||||
int ret;
|
int32_t ret;
|
||||||
} ofw_arg;
|
} ofw_arg;
|
||||||
|
|
||||||
SERVICE("package-to-path", 16, 3, 1);
|
SERVICE("package-to-path", 16, 3, 1);
|
||||||
|
|
Loading…
Reference in New Issue