XINU
device
eth
ethcontrol.c
Go to the documentation of this file.
1
10
/* ethcontrol.c - ethcontrol */
11
12
#include <
xinu.h
>
13
14
/*------------------------------------------------------------------------
15
* ethcontrol - implement control function for a quark ethernet device
16
*------------------------------------------------------------------------
17
*/
18
devcall
ethcontrol
(
19
struct
dentry
*devptr,
/* entry in device switch table */
20
int32
func,
/* control function */
21
int32
arg1,
/* argument 1, if needed */
22
int32
arg2
/* argument 2, if needed */
23
)
24
{
25
struct
ethcblk
*ethptr;
/* Ethertab entry pointer */
26
int32
retval =
OK
;
/* Return value of cntl function*/
27
28
ethptr = &
ethertab
[devptr->
dvminor
];
29
30
switch
(func)
31
{
32
33
/* Get MAC address */
34
35
case
ETH_CTRL_GET_MAC
:
36
memcpy
((
byte
*)arg1, ethptr->
devAddress
,
37
ETH_ADDR_LEN
);
38
break
;
39
40
default
:
41
return
SYSERR
;
42
}
43
44
return
retval;
45
}
ethcontrol
devcall ethcontrol(struct dentry *devptr, int32 func, int32 arg1, int32 arg2)
Definition:
ethcontrol.c:18
byte
unsigned char byte
符号なし8ビット値(unsigned char)
Definition:
kernel.h:7
dentry::dvminor
int32 dvminor
Definition:
conf.h:8
xinu.h
全てのシステムヘッダファイルをインクルードする。
SYSERR
#define SYSERR
処理が失敗した場合
Definition:
kernel.h:79
ethcblk
Definition:
ether.h:68
OK
#define OK
処理が成功した場合
Definition:
kernel.h:77
ethcblk::devAddress
byte devAddress[ETH_ADDR_LEN]
Definition:
ether.h:96
ETH_CTRL_GET_MAC
#define ETH_CTRL_GET_MAC
Definition:
ether.h:45
dentry
Definition:
conf.h:6
ethertab
struct ethcblk ethertab[]
Definition:
ethinit.c:7
int32
int int32
符号あり32ビット整数(int)
Definition:
kernel.h:11
ETH_ADDR_LEN
#define ETH_ADDR_LEN
Definition:
ether.h:10
devcall
int32 devcall
デバイスコール関数 返り値の型
Definition:
kernel.h:49
memcpy
void * memcpy(void *, const void *, int32)
メモリAの領域(source)からメモリBの領域(Destination)にN Byteコピーする。
Definition:
memcpy.c:13
Generated by
1.8.13