I am writing to the management interface of an ethernet phy (MDIO and MDC - data and clock respectively).
This is my first time working with Freescale. I just wanted to see how fast I could get this to work. Didn't know if I should change the board before it is built and have the Phy management bus go to the FPGA instead of the MCF52233. I know I can get the FPGA to run at this speed but it is so much easier doing this in the software because it is quicker to change.
I couldn't right click and get dissasembly but I could go to data-view mixed and get the following:
{
20000900: 4E560000 link a6,#0
20000904: 2F07 move.l d7,-(a7)
20000906: 2F06 move.l d6,-(a7)
20000908: 2C2E0008 move.l 8(a6),d6
2000090C: 2E2E000C move.l 12(a6),d7
20000910: 242E0010 move.l 16(a6),d2
unsigned int i,data1,j,bit;
data1 = 0x50000000;
20000914: 203C50000000 move.l #1342177280,d0
data1 = data1 + (phy << 23);
2000091A: 7217 moveq #23,d1
2000091C: E3AE lsl.l d1,d6
2000091E: D086 add.l d6,d0
data1 = data1 + (reg << 18);
20000920: 7212 moveq #18,d1
20000922: E3AF lsl.l d1,d7
20000924: D087 add.l d7,d0
data1 = data1 + 0x00020000;
20000926: 068000020000 addi.l #131072,d0
data1 = data1 + data;
2000092C: D082 add.l d2,d0
// send 32 1s
for(i=0;i<32;i=i+1)
2000092E: 7E00 moveq #0,d7
{
MCF_GPIO_PORTTC = 0x02;
20000930: 7402 moveq #2,d2
MCF_GPIO_PORTTC = 0x03;
20000932: 7203 moveq #3,d1
20000934: 13C24010000F move.b d2,0x4010000F (0x4010000f)
2000093A: 5887 addq.l #4,d7
2000093C: 13C14010000F move.b d1,0x4010000F (0x4010000f)
20000942: 13C24010000F move.b d2,0x4010000F (0x4010000f)
20000948: 13C14010000F move.b d1,0x4010000F (0x4010000f)
2000094E: 13C24010000F move.b d2,0x4010000F (0x4010000f)
20000954: 13C14010000F move.b d1,0x4010000F (0x4010000f)
2000095A: 13C24010000F move.b d2,0x4010000F (0x4010000f)
20000960: 13C14010000F move.b d1,0x4010000F (0x4010000f)
20000966: 0C8700000020 cmpi.l #32,d7
2000096C: 65C6 bcs.s phy_write+0x34 (0x20000934); 0x20000934
}
// send data
bit = data1;
for(j=0;j<=31;j=j+1)
2000096E: 7E00 moveq #0,d7
{
// if(+( (data1 << j) & 0x80000000)) // try 1
if(bit&0x80000000) // try 2
{
MCF_GPIO_PORTTC = 0x02;
20000970: 7402 moveq #2,d2
}
else
{
MCF_GPIO_PORTTC = 0x00;
}
bit <<=1; // try 2
MCF_GPIO_SETTC = 0x01; // rising edge of clock
20000972: 7201 moveq #1,d1
20000974: 0800001F btst #31,d0
20000978: 6708 beq.s phy_write+0x82 (0x20000982); 0x20000982
2000097A: 13C24010000F move.b d2,0x4010000F (0x4010000f)
20000980: 6006 bra.s phy_write+0x88 (0x20000988); 0x20000988
20000982: 42394010000F clr.b 0x4010000F (0x4010000f)
20000988: E388 lsl.l #1,d0
2000098A: 13C14010003F move.b d1,0x4010003F (0x4010003f)
}
20000990: 5287 addq.l #1,d7
20000992: 0C870000001F cmpi.l #31,d7
20000998: 63DA bls.s phy_write+0x74 (0x20000974); 0x20000974
}
2000099A: 2C1F move.l (a7)+,d6
2000099C: 2E1F move.l (a7)+,d7
2000099E: 4E5E unlk a6
200009A0: 4E75 rts
200009A2: 51FC trapf