Rama Krishna
|
Re: RE: RE: How to access mpc85xx_dev_t structure.
|
Rama Krishna
03/22/2010 3:22 AM
post50083
|
Re: RE: RE: How to access mpc85xx_dev_t structure.
Hi Aboyd,
I have extended the ioctl support for MDI read & write in mpc85xx driver. It is working fine and able to manage the
device via MDIO bus.
Please comment on the following 3 steps for the approcah taken to experiment this.
Basically, we wanted to avoid the steps 1 & 2 below completely and interface name hard coding (tsec0) in step 3 when we
upgrade QNX version from 6.4.1 to higher.
So that client software will just open socket and invoke ioctl command with required data.
Please suggest if any the steps given below are wrong or can be improved.
1) Currently, I have defined MACROs for MDIO read and write ioctl commands as follows.
#define SIOCG_MDI_READ _IOWR('i', 61, struct ifreq) /* Read mii */
#define SIOCS_MDI_WRITE _IOW('i', 62, struct ifreq) /* write mii */
2) I have declared a new data structure as follows and used it in MDIO read and write ioctls.
typedef struct {
uint8_t phy_addr;
uint8_t reg_addr;
uint16_t value;
} test_data_t;
typedef struct {
char ifr_name[IFNAMSIZ];
union {
test_data_t mdio_data;
} data;
} interface_data_t;
3) Now I am filling the data structure (interface_data_t) based on MDIO read or write call and invoking the
corresponding ioctl.
code snippet:
{
interface_data_t itf_data;
fd = socket(AF_INET, SOCK_DGRAM, 0);
strcpy(itf_data.ifr_name, "tsec0");
itf_data.data.mdio_data.phy_addr = 0x03;
itf_data.data.mdio_data.reg_addr = 0x00;
ioctl(fd, SIOCG_MDI_READ, &itf_data)
}
I am new to create a PR in QNX forum, Please let me how to create a PR.
Sorry for the big mail and thanks for your time.
Regards,
Ramakrishna
|
|
|