mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-11-08 14:43:04 +08:00
再次修改源文件开头的license,清理网卡代码中的#if 0和#if 1
This commit is contained in:
1 parent
63d2ede1b3
commit
2da0eae89c
14 files changed
+412
-388
No files matched your search
@@ -1,17 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) chinesebear
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __DEBUG_H__
|
||||
#define __DEBUG_H__
|
||||
|
||||
//#define GMAC_DEBUG
|
||||
#include <rtthread.h>
|
||||
#ifdef GMAC_DEBUG
|
||||
#define DEBUG_MES rt_kprintf
|
||||
#else
|
||||
#define DEBUG_MES(...)
|
||||
#endif
|
||||
|
||||
#endif /*__DEBUG_H__*/
|
||||
@@ -1,5 +1,25 @@
|
||||
/*
|
||||
* Copyright (C) chinesebear
|
||||
* File : mii.c
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) chinesebear
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2017-08-24 chinesebear first version
|
||||
*/
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,25 @@
|
||||
/*
|
||||
* Copyright (C) chinesebear
|
||||
* File : mii.h
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) chinesebear
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2017-08-24 chinesebear first version
|
||||
*/
|
||||
|
||||
|
||||
@@ -7,7 +27,7 @@
|
||||
#define __MII_H__
|
||||
/* Generic MII registers. */
|
||||
|
||||
#include "types.h"
|
||||
#include "synopGMAC_types.h"
|
||||
|
||||
#define MII_BMCR 0x00 /* Basic mode control register */
|
||||
#define MII_BMSR 0x01 /* Basic mode status register */
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,5 +1,25 @@
|
||||
/*
|
||||
* Copyright (C) chinesebear
|
||||
* File : synopGMAC.h
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) chinesebear
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2017-08-24 chinesebear first version
|
||||
*/
|
||||
|
||||
#ifndef __SYNOPGMAC__H
|
||||
@@ -10,7 +30,7 @@
|
||||
#include "synopGMAC_Dev.h"
|
||||
#include "synopGMAC_plat.h"
|
||||
#include "mii.h"
|
||||
#include "types.h"
|
||||
#include "synopGMAC_types.h"
|
||||
|
||||
void rt_hw_eth_init(void);
|
||||
|
||||
|
||||
@@ -9,6 +9,32 @@
|
||||
* ------------------------REVISION HISTORY---------------------------------
|
||||
* Synopsys 01/Aug/2007 Created
|
||||
*/
|
||||
|
||||
/*
|
||||
* File : synopGMAC_Dev.c
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) chinesebear
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2017-08-24 chinesebear first version
|
||||
*/
|
||||
|
||||
|
||||
#include "synopGMAC_Dev.h"
|
||||
#include <rthw.h>
|
||||
#include <rtthread.h>
|
||||
@@ -100,32 +126,32 @@ s32 synopGMAC_read_phy_reg(u32 RegBase,u32 PhyBase, u32 RegOffset, u16 * data )
|
||||
*/
|
||||
s32 synopGMAC_write_phy_reg(u32 RegBase, u32 PhyBase, u32 RegOffset, u16 data)
|
||||
{
|
||||
u32 addr;
|
||||
u32 loop_variable;
|
||||
u32 addr;
|
||||
u32 loop_variable;
|
||||
|
||||
synopGMACWriteReg(RegBase,GmacGmiiData,data); // write the data in to GmacGmiiData register of synopGMAC ip
|
||||
synopGMACWriteReg(RegBase,GmacGmiiData,data); // write the data in to GmacGmiiData register of synopGMAC ip
|
||||
|
||||
addr = ((PhyBase << GmiiDevShift) & GmiiDevMask) | ((RegOffset << GmiiRegShift) & GmiiRegMask) | GmiiWrite | GmiiCsrClk3; //sw: add GmiiCsrclk
|
||||
addr = ((PhyBase << GmiiDevShift) & GmiiDevMask) | ((RegOffset << GmiiRegShift) & GmiiRegMask) | GmiiWrite | GmiiCsrClk3; //sw: add GmiiCsrclk
|
||||
|
||||
addr = addr | GmiiBusy ; //set Gmii clk to 20-35 Mhz and Gmii busy bit
|
||||
|
||||
synopGMACWriteReg(RegBase,GmacGmiiAddr,addr);
|
||||
for(loop_variable = 0; loop_variable < DEFAULT_LOOP_VARIABLE; loop_variable++){
|
||||
if (!(synopGMACReadReg(RegBase,GmacGmiiAddr) & GmiiBusy)){
|
||||
break;
|
||||
}
|
||||
addr = addr | GmiiBusy ; //set Gmii clk to 20-35 Mhz and Gmii busy bit
|
||||
|
||||
synopGMACWriteReg(RegBase,GmacGmiiAddr,addr);
|
||||
for(loop_variable = 0; loop_variable < DEFAULT_LOOP_VARIABLE; loop_variable++){
|
||||
if (!(synopGMACReadReg(RegBase,GmacGmiiAddr) & GmiiBusy)){
|
||||
break;
|
||||
}
|
||||
plat_delay(DEFAULT_DELAY_VARIABLE);
|
||||
}
|
||||
}
|
||||
|
||||
if(loop_variable < DEFAULT_LOOP_VARIABLE){
|
||||
return -ESYNOPGMACNOERR;
|
||||
}
|
||||
else{
|
||||
if(loop_variable < DEFAULT_LOOP_VARIABLE){
|
||||
return -ESYNOPGMACNOERR;
|
||||
}
|
||||
else{
|
||||
TR("Error::: PHY not responding Busy bit didnot get cleared !!!!!!\n");
|
||||
return -ESYNOPGMACPHYERR;
|
||||
}
|
||||
return -ESYNOPGMACPHYERR;
|
||||
}
|
||||
#if SYNOP_REG_DEBUG
|
||||
printf("write phy reg: offset = 0x%x\tdata = 0x%x",RegOffset,data);
|
||||
printf("write phy reg: offset = 0x%x\tdata = 0x%x",RegOffset,data);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1850,44 +1876,13 @@ s32 synopGMAC_get_tx_qptr(synopGMACdevice * gmacdev, u32 * Status, u32 * Buffer1
|
||||
printf("\n==%02d %08x %08x %08x %08x %08x %08x %08x\n",txover,(u32)txdesc,txdesc->status,txdesc->length,txdesc->buffer1,txdesc->buffer2,txdesc->data1,txdesc->data2);
|
||||
#endif
|
||||
if(synopGMAC_is_desc_owned_by_dma(txdesc))
|
||||
{
|
||||
#if 0
|
||||
printf("synopGMAC_get_tx_qptr:TX desc is owned by dma!\n");
|
||||
#endif
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
#if 0
|
||||
for(i=0;i<500000;i++)
|
||||
{
|
||||
if(synopGMAC_is_desc_empty(txdesc))
|
||||
{
|
||||
#if SYNOP_TX_DEBUG
|
||||
// printf("==desc owned by dma\n");
|
||||
#endif
|
||||
// return -1;
|
||||
continue;
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
if(i>=500000)
|
||||
{
|
||||
printf("i=%d\n",i);
|
||||
return -1;
|
||||
}
|
||||
do
|
||||
{
|
||||
;
|
||||
}while(synopGMAC_is_desc_empty(txdesc));
|
||||
#endif
|
||||
// gmacdev->TxBusy = synopGMAC_is_last_tx_desc(gmacdev,txdesc) ? 0 : txover + 1;
|
||||
// gmacdev->TxBusyDesc = synopGMAC_is_last_tx_desc(gmacdev,txdesc) ? gmacdev->TxDesc : (txdesc + 1);
|
||||
if(synopGMAC_is_desc_empty(txdesc))
|
||||
{
|
||||
#if 0
|
||||
printf("synopGMAC_get_tx_qptr:Tx Desc Empty!\n");
|
||||
#endif
|
||||
return -1;
|
||||
}
|
||||
(gmacdev->BusyTxDesc)--; //busy tx descriptor is reduced by one as it will be handed over to Processor now
|
||||
@@ -2025,10 +2020,8 @@ s32 synopGMAC_set_tx_qptr(synopGMACdevice * gmacdev, u32 Buffer1, u32 Length1, u
|
||||
txdesc->status = DescOwnByDma;
|
||||
#endif
|
||||
|
||||
#if 1
|
||||
gmacdev->TxNext = synopGMAC_is_last_tx_desc(gmacdev,txdesc) ? 0 : txnext + 1;
|
||||
gmacdev->TxNextDesc = synopGMAC_is_last_tx_desc(gmacdev,txdesc) ? gmacdev->TxDesc : (txdesc + 1);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -8,6 +8,32 @@
|
||||
* -----------------------------REVISION HISTORY------------------------------------
|
||||
* Synopsys 01/Aug/2007 Created
|
||||
*/
|
||||
|
||||
/*
|
||||
* File : synopGMAC_Dev.h
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) chinesebear
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2017-08-24 chinesebear first version
|
||||
*/
|
||||
|
||||
|
||||
#define UNUSED 1
|
||||
|
||||
#ifndef SYNOP_GMAC_DEV_H
|
||||
@@ -28,7 +54,7 @@
|
||||
/*******************************************************************/
|
||||
|
||||
#include "synopGMAC_plat.h"
|
||||
#include "types.h"
|
||||
#include "synopGMAC_types.h"
|
||||
|
||||
//sw: typedef are included in synopGMAC_plat.h
|
||||
// it is strange that we should add it here again!!
|
||||
|
||||
@@ -1,5 +1,25 @@
|
||||
/*
|
||||
* Copyright (C) chinesebear
|
||||
* File : synopGMAC_Host.h
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) chinesebear
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2017-08-24 chinesebear first version
|
||||
*/
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* File : synopGMAC_debug.h
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) chinesebear
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2017-08-24 chinesebear first version
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __DEBUG_H__
|
||||
#define __DEBUG_H__
|
||||
|
||||
//#define GMAC_DEBUG
|
||||
#include <rtthread.h>
|
||||
#ifdef GMAC_DEBUG
|
||||
#define DEBUG_MES rt_kprintf
|
||||
#else
|
||||
#define DEBUG_MES(...)
|
||||
#endif
|
||||
|
||||
#endif /*__DEBUG_H__*/
|
||||
@@ -6,6 +6,31 @@
|
||||
* ---------------------------REVISION HISTORY-------------------
|
||||
* Synopsys 01/Aug/2007 Created
|
||||
*/
|
||||
|
||||
/*
|
||||
* File : synopGMAC_network_interface.h
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) chinesebear
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2017-08-24 chinesebear first version
|
||||
*/
|
||||
|
||||
|
||||
#ifndef SYNOP_GMAC_NETWORK_INTERFACE_H
|
||||
#define SYNOP_GMAC_NETWORK_INTERFACE_H 1
|
||||
|
||||
@@ -9,6 +9,32 @@
|
||||
* ----------------------------REVISION HISTORY-----------------------------
|
||||
* Synopsys 01/Aug/2007 Created
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* File : synopGMAC_plat.c
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) chinesebear
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2017-08-24 chinesebear first version
|
||||
*/
|
||||
|
||||
|
||||
#include "synopGMAC_plat.h"
|
||||
#include "synopGMAC_Dev.h"
|
||||
|
||||
@@ -9,6 +9,31 @@
|
||||
* -------------------------------------REVISION HISTORY---------------------------
|
||||
* Synopsys 01/Aug/2007 Created
|
||||
*/
|
||||
|
||||
/*
|
||||
* File : synopGMAC_plat.h
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) chinesebear
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2017-08-24 chinesebear first version
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifndef SYNOP_GMAC_PLAT_H
|
||||
@@ -21,8 +46,8 @@
|
||||
#include <linux/slab.h>
|
||||
#include <linux/pci.h>
|
||||
*/
|
||||
#include "types.h"
|
||||
#include "debug.h"
|
||||
#include "synopGMAC_types.h"
|
||||
#include "synopGMAC_debug.h"
|
||||
//#include "mii.h"
|
||||
//#include "GMAC_Pmon.h"
|
||||
//#include "synopGMAC_Host.h"
|
||||
@@ -151,35 +176,17 @@ void plat_delay(u32);
|
||||
*/
|
||||
static u32 synopGMACReadReg(u32 RegBase, u32 RegOffset)
|
||||
{
|
||||
u32 addr;
|
||||
u32 data;
|
||||
|
||||
u32 addr;
|
||||
u32 data;
|
||||
|
||||
addr = RegBase + (u32)RegOffset;
|
||||
|
||||
#if 0 //__mips >= 3 && __mips != 32
|
||||
__asm __volatile(
|
||||
".set\tnoreorder\n\t"
|
||||
".set\tmips3\n\t"
|
||||
"ld $8,%1\n\t"
|
||||
"lw $9,0x0($8)\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t"
|
||||
"sw $9,%0\n\t"
|
||||
".set\tmips0\n\t"
|
||||
:"=m"(data)
|
||||
:"m"(addr)
|
||||
:"memory","$8","$9"
|
||||
);
|
||||
#else
|
||||
data = *(volatile u32 *)addr;
|
||||
#endif
|
||||
addr = RegBase + (u32)RegOffset;
|
||||
data = *(volatile u32 *)addr;
|
||||
|
||||
#if SYNOP_REG_DEBUG
|
||||
TR("%s RegBase = 0x%08x RegOffset = 0x%08x RegData = 0x%08x\n", __FUNCTION__, (u32)RegBase, RegOffset, data );
|
||||
TR("%s RegBase = 0x%08x RegOffset = 0x%08x RegData = 0x%08x\n", __FUNCTION__, (u32)RegBase, RegOffset, data );
|
||||
#endif
|
||||
// rt_kprintf("%s RegBase = 0x%08x RegOffset = 0x%08x RegData = 0x%08x\n", __FUNCTION__, (u32)RegBase, RegOffset, data );
|
||||
return data;
|
||||
// rt_kprintf("%s RegBase = 0x%08x RegOffset = 0x%08x RegData = 0x%08x\n", __FUNCTION__, (u32)RegBase, RegOffset, data );
|
||||
return data;
|
||||
|
||||
}
|
||||
|
||||
@@ -201,23 +208,8 @@ static void synopGMACWriteReg(u32 RegBase, u32 RegOffset, u32 RegData )
|
||||
#if SYNOP_REG_DEBUG
|
||||
TR("%s RegBase = 0x%08x RegOffset = 0x%08x RegData = 0x%08x\n", __FUNCTION__,(u32) RegBase, RegOffset, RegData );
|
||||
#endif
|
||||
// writel(RegData,(void *)addr);
|
||||
//printf("GMAC addr = 0x%lx \n",addr);
|
||||
#if 0 //__mips >= 3 && __mips != 32
|
||||
__asm __volatile(
|
||||
".set\tnoreorder\n\t"
|
||||
".set\tmips3\n\t"
|
||||
"lw $9,%0\n\t"
|
||||
"ld $8,%1\n\t"
|
||||
"sw $9,0x0($8)\n\t"
|
||||
".set\tmips0\n\t"
|
||||
:
|
||||
:"m"(RegData),"m"(addr)
|
||||
:"memory","$8","$9"
|
||||
);
|
||||
#else
|
||||
*(volatile u32 *)addr = RegData;
|
||||
#endif
|
||||
|
||||
if(addr == 0xbfe1100c)
|
||||
DEBUG_MES("regdata = %08x\n", RegData);
|
||||
return;
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* File : synopGMAC_types.h
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) chinesebear
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2017-08-24 chinesebear first version
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifndef __TYPES__H
|
||||
#define __TYPES__H
|
||||
|
||||
typedef unsigned char uint8_t;
|
||||
typedef unsigned long long u64;
|
||||
typedef unsigned int u32;
|
||||
typedef unsigned short u16;
|
||||
typedef unsigned char u8;
|
||||
typedef signed int s32;
|
||||
|
||||
typedef u32 dma_addr_t;
|
||||
|
||||
#endif /*__TYPES__H*/
|
||||
@@ -1,18 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) chinesebear
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __TYPES__H
|
||||
#define __TYPES__H
|
||||
|
||||
typedef unsigned char uint8_t;
|
||||
typedef unsigned long long u64;
|
||||
typedef unsigned int u32;
|
||||
typedef unsigned short u16;
|
||||
typedef unsigned char u8;
|
||||
typedef signed int s32;
|
||||
|
||||
typedef u32 dma_addr_t;
|
||||
|
||||
#endif /*__TYPES__H*/
|
||||
Reference in new issue
Block a user