git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@1750 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo 2009-05-01 23:42:40 +00:00
parent a9ff87819b
commit 71f760c2d4
2 changed files with 64 additions and 12 deletions

View File

@ -57,6 +57,8 @@
* Definitions
****************************************************************************/
#error "Under construction -- do not use"
/* CONFIG_CS89x0_NINTERFACES determines the number of physical interfaces
* that will be supported.
*/
@ -192,24 +194,70 @@ static void cs89x0_putreg(struct cs89x0_driver_s *cs89x0, int offset, uint16 val
static uint16 cs89x0_getppreg(struct cs89x0_driver_s *cs89x0, int addr)
{
/* In memory mode, the CS89x0's internal registers and frame buffers are mapped
* into a contiguous 4kb block providing direct access to the internal registers
* and frame buffers.
*/
#ifdef CONFIG_CS89x0_MEMMODE
if (cs89x0->cs_memmode)
{
#ifdef CONFIG_CS89x0_ALIGN16
putreg16((uint16)addr, cs89x0->cs_base + CS89x0_PPTR_OFFSET);
return getreg16(s89x0->cs_base + CS89x0_PDATA_OFFSET);
return getreg16(s89x0->cs_ppbase + (CS89x0_PDATA_OFFSET << ??));
#else
putreg32((uint32)addr, cs89x0->cs_base + CS89x0_PPTR_OFFSET);
return (uint16)getreg32(s89x0->cs_base + CS89x0_PDATA_OFFSET);
return (uint16)getreg32(s89x0->cs_ppbase + (CS89x0_PDATA_OFFSET << ??));
#endif
}
/* When configured in I/O mode, the CS89x0 is accessed through eight, 16-bit
* I/O ports that in the host system's I/O space.
*/
else
#endif
{
#ifdef CONFIG_CS89x0_ALIGN16
putreg16((uint16)addr, cs89x0->cs_base + CS89x0_PPTR_OFFSET);
return getreg16(s89x0->cs_base + CS89x0_PDATA_OFFSET);
#else
putreg32((uint32)addr, cs89x0->cs_base + CS89x0_PPTR_OFFSET);
return (uint16)getreg32(s89x0->cs_base + CS89x0_PDATA_OFFSET);
#endif
}
}
static void cs89x0_putppreg(struct cs89x0_driver_s *cs89x0, int addr, uint16 value)
{
/* In memory mode, the CS89x0's internal registers and frame buffers are mapped
* into a contiguous 4kb block providing direct access to the internal registers
* and frame buffers.
*/
#ifdef CONFIG_CS89x0_MEMMODE
if (cs89x0->cs_memmode)
{
#ifdef CONFIG_CS89x0_ALIGN16
putreg16((uint16)addr, cs89x0->cs_base + CS89x0_PPTR_OFFSET);
putreg16(value), cs89x0->cs_base + CS89x0_PDATA_OFFSET);
putreg16(value), cs89x0->cs_ppbase + (CS89x0_PDATA_OFFSET << ??));
#else
putreg32((uint32)addr, cs89x0->cs_base + CS89x0_PPTR_OFFSET);
putreg32((uint32)value, cs89x0->cs_base + CS89x0_PDATA_OFFSET);
putreg32((uint32)value, cs89x0->cs_ppbase + (CS89x0_PDATA_OFFSET << ??));
#endif
}
/* When configured in I/O mode, the CS89x0 is accessed through eight, 16-bit
* I/O ports that in the host system's I/O space.
*/
else
#endif
{
#ifdef CONFIG_CS89x0_ALIGN16
putreg16((uint16)addr, cs89x0->cs_base + CS89x0_PPTR_OFFSET);
putreg16(value, cs89x0->cs_base + CS89x0_PDATA_OFFSET);
#else
putreg32((uint32)addr, cs89x0->cs_base + CS89x0_PPTR_OFFSET);
putreg32((uint32)value, cs89x0->cs_base + CS89x0_PDATA_OFFSET);
#endif
}
}
/****************************************************************************
@ -550,15 +598,14 @@ static int cs89x0_interrupt(int irq, FAR void *context)
{
ndbg("Transmit underrun\n");
#ifdef CONFIG_CS89x0_XMITEARLY
cd89x0->cs_txunderrun++;
if (cd89x0->cs_txunderrun == 3)
{
cd89x0->send_cmd = TX_AFTER_381;
cd89x0->cs_txstart = PPR_TXCMD_TXSTART381;
}
else if (cd89x0->cs_txunderrun == 6)
{
cd89x0->send_cmd = TX_AFTER_ALL;
cd89x0->cs_txstart = PPR_TXCMD_TXSTARTFULL;
}
#endif
}

View File

@ -88,13 +88,18 @@ struct cs89x0_driver_s
*/
FAR void *cs_base; /* CS89x0 region base address */
#ifdef CONFIG_CS89x0_MEMMODE
FAR void *cs_ppbase; /* CS89x0 page packet base address */
#endif
ubyte cs_irq; /* CS89x00 IRQ number */
/* Driver internal state fields. These must be zeroed by before the
* instance of this structure is passed to cs89x0_initialize
*/
#ifdef CONFIG_CS89x0_XMITEARLY
ubyte txstart; /* Bits 6-7 of TxCMD controls Tx race */
#endif
boolean cs_memmode; /* TRUE:memory mode FALSE: I/O mode */
boolean cs_bifup; /* TRUE:ifup FALSE:ifdown */
WDOG_ID cs_txpoll; /* TX poll timer */
WDOG_ID cs_txtimeout; /* TX timeout timer */