📄 h2ioutil.c
字号:
/*
Copyright (c) 2003-2004 Vitesse Semiconductor Corporation "Vitesse".
All Rights Reserved. Unpublished rights reserved under the copyright laws
of the United States of America, other countries and international treaties.
The software is provided without a fee. Permission to use, copy, store and
modify, the software and its source code is granted. Permission to integrate
into other products, disclose, transmit and distribute the software in an
absolute machine readable format (e.g. HEX file) is also granted.
The source code of the software may not be disclosed, transmitted or
distributed without the written permission of Vitesse. The software and its
source code may only be used in products utilizing a Vitesse VSC73xx product.
This copyright notice must appear in any copy, modification, disclosure,
transmission or distribution of the software. Vitesse retains all ownership,
copyright, trade secret and proprietary rights in the software.
THIS SOFTWARE HAS BEEN PROVIDED "AS IS," WITHOUT EXPRESS OR IMPLIED WARRANTY
INCLUDING, WITHOUT LIMITATION, IMPLIED WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR USE AND NON-INFRINGEMENT.
*/
#include "common.h"
#include "h2reg.h"
#include "hwconf.h"
#include "h2io.h"
#include "misc2.h"
/* ************************************************************************ **
*
*
* Defines
*
*
*
* ************************************************************************ */
/* ************************************************************************ **
*
*
* Typedefs and enums
*
*
*
* ************************************************************************ */
/* ************************************************************************ **
*
*
* Prototypes for local functions
*
*
*
* ************************************************************************ */
/* ************************************************************************ **
*
*
* Local data
*
*
*
* ************************************************************************ */
/* ************************************************************************ */
void h2_write_masked (uchar block, uchar subblock, uchar addr, ulong value, ulong mask)
/* ------------------------------------------------------------------------ --
* Purpose : Update specified bit(s) of a switch chip register.
* Remarks : block: H2 block, see h2reg.h.
* subblock: H2 subblock, (0-15 for PORT, 0-1 for MIIM).
* addr: H2 register address, see h2reg.h.
* value: Holds bits (in right positions) to be written.
* mask: Bit mask specifying the bits to be updated.
* Restrictions:
* See also :
* Example : To set Tx_en and Rx_en bits and reset Seed Load bit in MACCONF
* register of port 1, write:
* h2_write_masked(PORT, 1, PORT_MACCONF, 0x10010000, 0x18010000);
* ************************************************************************ */
{
value &= mask;
value |= (h2_read(block, subblock, addr) & ~mask);
h2_write(block, subblock, addr, value);
}
/* ************************************************************************ */
void h2_write_bit (uchar block, uchar subblock, uchar addr, uchar bit_no, uchar status)
/* ------------------------------------------------------------------------ --
* Purpose : Set or clear a single bit in a switch chip register by doing
* read-modify_write.
* Remarks : block: H2 block, see h2reg.h.
* subblock: H2 subblock, (0-15 for PORT, 0-1 for MIIM).
* addr: H2 register address, see h2reg.h.
* bit_no: bit to be set or cleared.
* status: 0 for clear, 1 for set
* Restrictions:
* See also :
* Example :
* ************************************************************************ */
{
ulong value;
value = h2_read(block, subblock, addr);
write_bit_32(bit_no, status, &value);
h2_write(block, subblock, addr, value);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -