XINU
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  */
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 }
devcall ethcontrol(struct dentry *devptr, int32 func, int32 arg1, int32 arg2)
Definition: ethcontrol.c:18
unsigned char byte
符号なし8ビット値(unsigned char)
Definition: kernel.h:7
int32 dvminor
Definition: conf.h:8
全てのシステムヘッダファイルをインクルードする。
#define SYSERR
処理が失敗した場合
Definition: kernel.h:79
Definition: ether.h:68
#define OK
処理が成功した場合
Definition: kernel.h:77
byte devAddress[ETH_ADDR_LEN]
Definition: ether.h:96
#define ETH_CTRL_GET_MAC
Definition: ether.h:45
Definition: conf.h:6
struct ethcblk ethertab[]
Definition: ethinit.c:7
int int32
符号あり32ビット整数(int)
Definition: kernel.h:11
#define ETH_ADDR_LEN
Definition: ether.h:10
int32 devcall
デバイスコール関数 返り値の型
Definition: kernel.h:49
void * memcpy(void *, const void *, int32)
メモリAの領域(source)からメモリBの領域(Destination)にN Byteコピーする。
Definition: memcpy.c:13