/*! * This function resets the two registers of the selected port. * * @param port the DAM port to reset */ void dam_reset_register(dam_port port) { if (port < 3) { ModifyRegister32(0xFFFFFFFF, dam_hpcr_default_value, _reg_DAM_HPCR(port)); } else { ModifyRegister32(0xFFFFFFFF, dam_ppcr_default_value, _reg_DAM_PPCR(port)); } return; }
/*! * This function controls Receive clock signal direction for the port. * * @param port the DAM port to configure * @param direction the Rx clock signal direction */ void dam_select_RxClk_direction(dam_port port, signal_direction direction) { if (port < 3) { ModifyRegister32(1 << dam_receive_clock_direction_shift, direction << dam_receive_clock_direction_shift, _reg_DAM_HPCR(port)); } else { ModifyRegister32(1 << dam_receive_clock_direction_shift, direction << dam_receive_clock_direction_shift, _reg_DAM_PPCR(port)); } return; }
/*! * This function swaps the transmit and receive signals from (Da-TxD, Db-RxD) * to (Da-RxD, Db-TxD). * This default signal configuration is Da-TxD, Db-RxD. * * @param port the DAM port to configure * @param value the switch state */ void dam_switch_Tx_Rx(dam_port port, bool value) { if (port < 3) { ModifyRegister32(1 << dam_transmit_receive_switch_shift, value << dam_transmit_receive_switch_shift, _reg_DAM_HPCR(port)); } else { ModifyRegister32(1 << dam_transmit_receive_switch_shift, value << dam_transmit_receive_switch_shift, _reg_DAM_PPCR(port)); } return; }
/*! * This function controls whether or not the port is in synchronous mode. * When the synchronous mode is selected, the receive and the transmit sections * use common clock and frame sync signals. * When the synchronous mode is not selected, separate clock and frame sync * signals are used for the transmit and the receive sections. * The defaut value is the synchronous mode selected. * * @param port the DAM port to configure * @param synchronous the state to assign */ void dam_set_synchronous(dam_port port, bool synchronous) { if (port < 3) { ModifyRegister32(1 << dam_synchronous_mode_shift, synchronous << dam_synchronous_mode_shift, _reg_DAM_HPCR(port)); } else { ModifyRegister32(1 << dam_synchronous_mode_shift, synchronous << dam_synchronous_mode_shift, _reg_DAM_PPCR(port)); } return; }
/*! * This function controls Transmit Frame Sync signal direction for the port. * * @param port the DAM port to configure * @param direction the Tx Frame Sync signal direction */ void dam_select_TxFS_direction(dam_port port, signal_direction direction) { if (port < 3) { ModifyRegister32(1 << dam_transmit_frame_sync_direction_shift, direction << dam_transmit_frame_sync_direction_shift, _reg_DAM_HPCR(port)); } else { ModifyRegister32(1 << dam_transmit_frame_sync_direction_shift, direction << dam_transmit_frame_sync_direction_shift, _reg_DAM_HPCR(port)); } return; }
/*! * This function selects the source port for the RxD data. * * @param p_config the DAM port to configure * @param p_source the source port */ void dam_select_RxD_source(dam_port p_config, dam_port p_source) { if (p_config < 3) { ModifyRegister32(dam_dat_selection_mask << dam_receive_data_select_shift, p_source << dam_receive_data_select_shift, _reg_DAM_HPCR(p_config)); } else { ModifyRegister32(dam_dat_selection_mask << dam_receive_data_select_shift, p_source << dam_receive_data_select_shift, _reg_DAM_PPCR(p_config)); } return; }
/*! * This function controls Transmit clock signal source for the port. * * @param p_config the DAM port to configure * @param from_RxClk the signal comes from RxClk or TxClk of * the source port * @param p_source the source port */ void dam_select_TxClk_source(dam_port p_config, bool from_RxClk, dam_port p_source) { ModifyRegister32(dam_selection_mask << dam_transmit_clock_select_shift, ((from_RxClk << 3) | p_source) << dam_transmit_clock_select_shift, _reg_DAM_PTCR(p_config)); }
/*! * This function controls Transmit Frame Sync signal source for the port. * * @param p_config the DAM port to configure * @param from_RxFS the signal comes from RxFS or TxFS of * the source port * @param p_source the source port */ void dam_select_TxFS_source(dam_port p_config, bool from_RxFS, dam_port p_source) { ModifyRegister32(dam_selection_mask << dam_transmit_frame_sync_select_shift, ((from_RxFS << 3) | p_source) << dam_transmit_frame_sync_select_shift, _reg_DAM_PTCR(p_config)); }
/*! * This function controls Receive Frame Sync signal source for the port. * * @param p_config the DAM port to configure * @param from_RxFS the signal comes from RxFS or TxFS of * the source port * @param p_source the source port */ void dam_select_RxFS_source(dam_port p_config, bool from_RxFS, dam_port p_source) { if (p_config < 3) { ModifyRegister32(dam_fs_selection_mask << dam_receive_frame_sync_select_shift, ((from_RxFS << 3) | p_source) << dam_receive_frame_sync_select_shift, _reg_DAM_HPCR(p_config)); } else { ModifyRegister32(dam_fs_selection_mask << dam_receive_frame_sync_select_shift, ((from_RxFS << 3) | p_source) << dam_receive_frame_sync_select_shift, _reg_DAM_PPCR(p_config)); } return; }
/*! * This function controls Receive clock signal source for the port. * * @param p_config the DAM port to configure * @param from_RxClk the signal comes from RxClk or TxClk of * the source port * @param p_source the source port */ void dam_select_RxClk_source(dam_port p_config, bool from_RxClk, dam_port p_source) { if (p_config < 3) { ModifyRegister32(dam_clk_selection_mask << dam_receive_clock_select_shift, ((from_RxClk << 3) | p_source) << dam_receive_clock_select_shift, _reg_DAM_HPCR(p_config)); } else { ModifyRegister32(dam_clk_selection_mask << dam_receive_clock_select_shift, ((from_RxClk << 3) | p_source) << dam_receive_clock_select_shift, _reg_DAM_PPCR(p_config)); } return; }
/*! * This function selects the operation mode of the port. * * @param port the DAM port to configure * @param the_mode the operation mode of the port * * @return This function returns the result of the operation * (0 if successful, -1 otherwise). */ int dam_select_mode(dam_port port, dam_mode the_mode) { int result; result = 0; ModifyRegister32(dam_mode_masq << dam_mode_shift, the_mode << dam_mode_shift, _reg_DAM_PDCR(port)); return result; }
/*! * This function sets a bit mask that selects the port from which of the RxD * signals are to be ANDed together for internal network mode. * Bit 6 represents RxD from Port7 and bit0 represents RxD from Port1. * 1 excludes RxDn from ANDing. 0 includes RxDn for ANDing. * * @param port the DAM port to configure * @param bit_mask the bit mask * * @return This function returns the result of the operation * (0 if successful, -1 otherwise). */ int dam_set_internal_network_mode_mask(dam_port port, unsigned char bit_mask) { int result; result = 0; ModifyRegister32(dam_internal_network_mode_mask << dam_internal_network_mode_shift, bit_mask << dam_internal_network_mode_shift, _reg_DAM_HPCR(port)); return result; }
/*! * This function selects the operation mode of the port. * * @param port the DAM port to configure * @param the_mode the operation mode of the port * * @return This function returns the result of the operation * (0 if successful, -1 otherwise). */ int dam_select_mode(dam_port port, dam_mode the_mode) { int result; result = 0; if (port >= 3) the_mode = normal_mode; ModifyRegister32(1 << dam_mode_shift, the_mode << dam_mode_shift, _reg_DAM_HPCR(port)); return result; }
/*! * This function resets the two registers of the selected port. * * @param port the DAM port to reset */ void dam_reset_register(dam_port port) { ModifyRegister32(0xFFFFFFFF, 0x00000000, _reg_DAM_PTCR(port)); ModifyRegister32(0xFFFFFFFF, 0x00000000, _reg_DAM_PDCR(port)); }
/*! * This function swaps the transmit and receive signals from (Da-TxD, Db-RxD) * to (Da-RxD, Db-TxD). * This default signal configuration is Da-TxD, Db-RxD. * * @param port the DAM port to configure * @param value the switch state */ void dam_switch_Tx_Rx(dam_port port, bool value) { ModifyRegister32(1 << dam_transmit_receive_switch_shift, value << dam_transmit_receive_switch_shift, _reg_DAM_PDCR(port)); }
/*! * This function controls whether or not the port is in synchronous mode. * When the synchronous mode is selected, the receive and the transmit sections * use common clock and frame sync signals. * When the synchronous mode is not selected, separate clock and frame sync * signals are used for the transmit and the receive sections. * The defaut value is the synchronous mode selected. * * @param port the DAM port to configure * @param synchronous the state to assign */ void dam_set_synchronous(dam_port port, bool synchronous) { ModifyRegister32(1 << dam_synchronous_mode_shift, synchronous << dam_synchronous_mode_shift, _reg_DAM_PTCR(port)); }
/*! * This function selects the source port for the RxD data. * * @param p_config the DAM port to configure * @param p_source the source port */ void dam_select_RxD_source(dam_port p_config, dam_port p_source) { ModifyRegister32(dam_selection_mask << dam_receive_data_select_shift, p_source << dam_receive_data_select_shift, _reg_DAM_PDCR(p_config)); }
/*! * This function controls Transmit Frame Sync signal direction for the port. * * @param port the DAM port to configure * @param direction the Tx Frame Sync signal direction */ void dam_select_TxFS_direction(dam_port port, signal_direction direction) { ModifyRegister32(1 << dam_transmit_frame_sync_direction_shift, direction << dam_transmit_frame_sync_direction_shift, _reg_DAM_PTCR(port)); }
/*! * This function controls Transmit clock signal direction for the port. * * @param port the DAM port to configure * @param direction the Tx clock signal direction */ void dam_select_TxClk_direction(dam_port port, signal_direction direction) { ModifyRegister32(1 << dam_transmit_clock_direction_shift, direction << dam_transmit_clock_direction_shift, _reg_DAM_PTCR(port)); }