You need to check the status of the physical layer, theMAC layer only can send messages to the physical layer when the status is idle. The physical layer send a notification every time that his status changes, your mac layer must capture this notification and to synchronize his actions with the physical layer, if the physical layer is transmitting or receiving the MAC layer must delay the transmission of the current packet until the physical layer change to idle.