This commit is contained in:
Richard Barry 2006-06-08 09:16:29 +00:00
parent 946da76519
commit 05023971cb
389 changed files with 11479 additions and 464 deletions

View file

@ -1,5 +1,5 @@
/*
FreeRTOS.org V4.0.2 - Copyright (C) 2003-2006 Richard Barry.
FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.
This file is part of the FreeRTOS.org distribution.

View file

@ -0,0 +1,213 @@
/*****************************************************************************
* Copyright (c) 2001, 2002 Rowley Associates Limited. *
* *
* This file may be distributed under the terms of the License Agreement *
* provided with this software. *
* *
* THIS FILE IS PROVIDED AS IS WITH NO WARRANTY OF ANY KIND, INCLUDING THE *
* WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. *
*****************************************************************************/
/*****************************************************************************
* Preprocessor Definitions
* ------------------------
*
* VECTORED_IRQ_INTERRUPTS
*
* Enable vectored IRQ interrupts. If defined, the PC register will be loaded
* with the contents of the VICVectAddr register on an IRQ exception.
*
* USE_PLL
*
* If defined, connect PLL as processor clock source. If undefined, the
* oscillator clock will be used.
*
* PLLCFG_VAL
*
* Override the default PLL configuration (multiplier = 5, divider = 2)
* by defining PLLCFG_VAL.
*
* USE_MAM
*
* If defined then the memory accelerator module (MAM) will be enabled.
*
* MAMCR_VAL & MAMTIM_VAL
*
* Override the default MAM configuration (fully enabled, 3 fetch cycles)
* by defining MAMCR_VAL and MAMTIM_VAL.
*
* VPBDIV_VAL
*
* If defined then this value will be used to configure the VPB divider.
*
* SRAM_EXCEPTIONS
*
* If defined, enable copying and re-mapping of interrupt vectors from User
* FLASH to SRAM. If undefined, interrupt vectors will be mapped in User
* FLASH.
*
*****************************************************************************/
#ifndef PLLCFG_VAL
#define PLLCFG_VAL 0x24
#endif
#ifndef MAMCR_VAL
#define MAMCR_VAL 2
#endif
#ifndef MAMTIM_VAL
#define MAMTIM_VAL 3
#endif
#define MAMCR_OFFS 0x000
#define MAMTIM_OFFS 0x004
#define PLLCON_OFFS 0x080
#define PLLCFG_OFFS 0x084
#define PLLSTAT_OFFS 0x088
#define PLLFEED_OFFS 0x08C
#define VPBDIV_OFFS 0x100
.section .vectors, "ax"
.code 32
.align 0
/*****************************************************************************
* Exception Vectors *
*****************************************************************************/
_vectors:
ldr pc, [pc, #reset_handler_address - . - 8] /* reset */
ldr pc, [pc, #undef_handler_address - . - 8] /* undefined instruction */
ldr pc, [pc, #swi_handler_address - . - 8] /* swi handler */
ldr pc, [pc, #pabort_handler_address - . - 8] /* abort prefetch */
ldr pc, [pc, #dabort_handler_address - . - 8] /* abort data */
#ifdef VECTORED_IRQ_INTERRUPTS
.word 0xB9205F84 /* boot loader checksum */
ldr pc, [pc, #-0xFF0] /* irq handler */
#else
.word 0xB8A06F60 /* boot loader checksum */
ldr pc, [pc, #irq_handler_address - . - 8] /* irq handler */
#endif
ldr pc, [pc, #fiq_handler_address - . - 8] /* fiq handler */
reset_handler_address:
.word reset_handler
undef_handler_address:
.word undef_handler
swi_handler_address:
.word swi_handler
pabort_handler_address:
.word pabort_handler
dabort_handler_address:
.word dabort_handler
irq_handler_address:
.word irq_handler
fiq_handler_address:
.word fiq_handler
.section .init, "ax"
.code 32
.align 0
/******************************************************************************
* *
* Default exception handlers *
* *
******************************************************************************/
reset_handler:
#if defined(USE_PLL) || defined(USE_MAM) || defined(VPBDIV_VAL)
ldr r0, =0xE01FC000
#endif
#if defined(USE_PLL)
/* Configure PLL Multiplier/Divider */
ldr r1, =PLLCFG_VAL
str r1, [r0, #PLLCFG_OFFS]
/* Enable PLL */
mov r1, #0x1
str r1, [r0, #PLLCON_OFFS]
mov r1, #0xAA
str r1, [r0, #PLLFEED_OFFS]
mov r1, #0x55
str r1, [r0, #PLLFEED_OFFS]
/* Wait for PLL to lock */
pll_lock_loop:
ldr r1, [r0, #PLLSTAT_OFFS]
tst r1, #0x400
beq pll_lock_loop
/* PLL Locked, connect PLL as clock source */
mov r1, #0x3
str r1, [r0, #PLLCON_OFFS]
mov r1, #0xAA
str r1, [r0, #PLLFEED_OFFS]
mov r1, #0x55
str r1, [r0, #PLLFEED_OFFS]
#endif
#if defined(USE_MAM)
mov r1, #0
str r1, [r0, #MAMCR_OFFS]
ldr r1, =MAMTIM_VAL
str r1, [r0, #MAMTIM_OFFS]
ldr r1, =MAMCR_VAL
str r1, [r0, #MAMCR_OFFS]
#endif
#if defined(VPBDIV_VAL)
ldr r1, =VPBDIV_VAL
str r1, [r0, #VPBDIV_OFFS]
#endif
#if defined(SRAM_EXCEPTIONS)
/* Copy exception vectors into SRAM */
mov r8, #0x40000000
ldr r9, =_vectors
ldmia r9!, {r0-r7}
stmia r8!, {r0-r7}
ldmia r9!, {r0-r6}
stmia r8!, {r0-r6}
/* Re-map interrupt vectors from SRAM */
ldr r0, MEMMAP
mov r1, #2 /* User RAM Mode. Interrupt vectors are re-mapped from SRAM */
str r1, [r0]
#endif /* SRAM_EXCEPTIONS */
b _start
#ifdef SRAM_EXCEPTIONS
MEMMAP:
.word 0xE01FC040
#endif
/******************************************************************************
* *
* Default exception handlers *
* These are declared weak symbols so they can be redefined in user code. *
* *
******************************************************************************/
undef_handler:
b undef_handler
swi_handler:
b swi_handler
pabort_handler:
b pabort_handler
dabort_handler:
b dabort_handler
irq_handler:
b irq_handler
fiq_handler:
b fiq_handler
.weak undef_handler, swi_handler, pabort_handler, dabort_handler, irq_handler, fiq_handler

View file

@ -1,5 +1,5 @@
/*
FreeRTOS.org V4.0.2 - copyright (C) 2003-2006 Richard Barry.
FreeRTOS.org V4.0.3 - copyright (C) 2003-2006 Richard Barry.
This file is part of the FreeRTOS.org distribution.

View file

@ -1,7 +1,7 @@
<!DOCTYPE CrossStudio_Project_File>
<solution version="1" Name="rtosdemo" >
<project Name="rtosdemo" >
<configuration Target="LPC2124" property_groups_file_path="$(StudioDir)/targets/Philips_LPC210X/propertyGroups.xml" linker_memory_map_file="$(StudioDir)/targets/Philips_LPC210X/Philips_LPC2124_MemoryMap.xml" c_preprocessor_definitions="OSCILLATOR_CLOCK_FREQUENCY=14745600;THUMB_INTERWORK;SUPERVISOR_START;VECTORED_IRQ_INTERRUPTS;GCC_ARM7" c_user_include_directories="../../Source/include;../../Demo/uIP_Demo_Rowley_ARM7;../../Demo/Common/Include;uip;." project_directory="" link_include_startup_code="No" project_type="Executable" c_additional_options="" Name="Common" />
<configuration arm_target_loader_parameter="14745600" Target="LPC2124" property_groups_file_path="$(StudioDir)/targets/Philips_LPC210X/propertyGroups.xml" oscillator_frequency="14.7456MHz" linker_memory_map_file="$(StudioDir)/targets/Philips_LPC210X/Philips_LPC2124_MemoryMap.xml" gcc_entry_point="_start" c_preprocessor_definitions="THUMB_INTERWORK;SUPERVISOR_START;VECTORED_IRQ_INTERRUPTS;GCC_ARM7" c_user_include_directories="../../Source/include;../../Demo/uIP_Demo_Rowley_ARM7;../../Demo/Common/Include;uip;." project_directory="" link_include_startup_code="No" project_type="Executable" c_additional_options="" Name="Common" />
<configuration target_reset_script="SRAMReset()" Name="RAM" />
<configuration arm_target_flash_loader_file_path="$(StudioDir)/targets/Philips_LPC210X/Release/Loader.exe" target_reset_script="FLASHReset()" Name="Flash" />
<folder Name="uIP Source" >
@ -20,11 +20,11 @@
<folder Name="System Files" >
<configuration filter="" Name="Common" />
<file file_name="$(StudioDir)/source/crt0.s" Name="crt0.s" />
<file file_name="$(StudioDir)/targets/Philips_LPC210X/Philips_LPC210X_Startup.s" Name="Philips_LPC210X_Startup.s" />
<file file_name="$(StudioDir)/targets/Philips_LPC210X/Philips_LPC210X_Target.js" Name="Philips_LPC210X_Target.js" >
<configuration Name="Common" file_type="Reset Script" />
</file>
<file file_name="flash_placement.xml" Name="flash_placement.xml" />
<file file_name="Philips_LPC210X_Startup.s" Name="Philips_LPC210X_Startup.s" />
</folder>
<folder Name="FreeRTOS Source" >
<configuration filter="" Name="Common" />
@ -45,6 +45,7 @@
<file file_name="../Common/Minimal/PollQ.c" Name="PollQ.c" />
</folder>
<configuration c_preprocessor_definitions="" c_user_include_directories="" Name="Debug" />
<configuration arm_target_loader_parameter="14745600" oscillator_frequency="14.7456MHz" Name="THUMB Flash Debug" linker_output_format="hex" />
</project>
<configuration inherited_configurations="THUMB;Flash;Debug" Name="THUMB Flash Debug" />
<configuration arm_library_instruction_set="THUMB" c_preprocessor_definitions="__THUMB" arm_instruction_set="THUMB" hidden="Yes" Name="THUMB" />

View file

@ -1,6 +1,26 @@
<!DOCTYPE CrossStudio_for_ARM_Session_File>
<session>
<Breakpoints/>
<Autos>
<Watches active="0" />
</Autos>
<Bookmarks/>
<Breakpoints>
<BreakpointListItem actiontype="0" chainFrom="" line="-1" length="0" triggertype="0" useHWbreakpoint="false" group="ARM Exceptions" breakdatatype="5" value="0" name="unnamed" counter="0" state="2" mask="0" comparison="0" expression="D_Abort" filename="" />
<BreakpointListItem actiontype="0" chainFrom="" line="-1" length="0" triggertype="0" useHWbreakpoint="false" group="ARM Exceptions" breakdatatype="5" value="0" name="unnamed" counter="0" state="3" mask="0" comparison="0" expression="FIQ" filename="" />
<BreakpointListItem actiontype="0" chainFrom="" line="-1" length="0" triggertype="0" useHWbreakpoint="false" group="ARM Exceptions" breakdatatype="5" value="0" name="unnamed" counter="0" state="3" mask="0" comparison="0" expression="IRQ" filename="" />
<BreakpointListItem actiontype="0" chainFrom="" line="-1" length="0" triggertype="0" useHWbreakpoint="false" group="ARM Exceptions" breakdatatype="5" value="0" name="unnamed" counter="0" state="2" mask="0" comparison="0" expression="P_Abort" filename="" />
<BreakpointListItem actiontype="0" chainFrom="" line="-1" length="0" triggertype="0" useHWbreakpoint="false" group="ARM Exceptions" breakdatatype="5" value="0" name="unnamed" counter="0" state="3" mask="0" comparison="0" expression="Reset" filename="" />
<BreakpointListItem actiontype="0" chainFrom="" line="-1" length="0" triggertype="0" useHWbreakpoint="false" group="ARM Exceptions" breakdatatype="5" value="0" name="unnamed" counter="0" state="3" mask="0" comparison="0" expression="SWI" filename="" />
<BreakpointListItem actiontype="0" chainFrom="" line="-1" length="0" triggertype="0" useHWbreakpoint="false" group="ARM Exceptions" breakdatatype="5" value="0" name="unnamed" counter="0" state="2" mask="0" comparison="0" expression="Undef" filename="" />
<BreakpointListItem actiontype="0" chainFrom="" line="-1" length="0" triggertype="0" useHWbreakpoint="false" group="Cortex-M3 Exceptions" breakdatatype="5" value="0" name="unnamed" counter="0" state="2" mask="0" comparison="0" expression="BusFault" filename="" />
<BreakpointListItem actiontype="0" chainFrom="" line="-1" length="0" triggertype="0" useHWbreakpoint="false" group="Cortex-M3 Exceptions" breakdatatype="5" value="0" name="unnamed" counter="0" state="2" mask="0" comparison="0" expression="ExceptionEntryReturnFault" filename="" />
<BreakpointListItem actiontype="0" chainFrom="" line="-1" length="0" triggertype="0" useHWbreakpoint="false" group="Cortex-M3 Exceptions" breakdatatype="5" value="0" name="unnamed" counter="0" state="2" mask="0" comparison="0" expression="HardFault" filename="" />
<BreakpointListItem actiontype="0" chainFrom="" line="-1" length="0" triggertype="0" useHWbreakpoint="false" group="Cortex-M3 Exceptions" breakdatatype="5" value="0" name="unnamed" counter="0" state="2" mask="0" comparison="0" expression="MemManage" filename="" />
<BreakpointListItem actiontype="0" chainFrom="" line="-1" length="0" triggertype="0" useHWbreakpoint="false" group="Cortex-M3 Exceptions" breakdatatype="5" value="0" name="unnamed" counter="0" state="3" mask="0" comparison="0" expression="Reset" filename="" />
<BreakpointListItem actiontype="0" chainFrom="" line="-1" length="0" triggertype="0" useHWbreakpoint="false" group="Cortex-M3 Exceptions" breakdatatype="5" value="0" name="unnamed" counter="0" state="2" mask="0" comparison="0" expression="UsageFault_CheckingError" filename="" />
<BreakpointListItem actiontype="0" chainFrom="" line="-1" length="0" triggertype="0" useHWbreakpoint="false" group="Cortex-M3 Exceptions" breakdatatype="5" value="0" name="unnamed" counter="0" state="2" mask="0" comparison="0" expression="UsageFault_Coprocessor" filename="" />
<BreakpointListItem actiontype="0" chainFrom="" line="-1" length="0" triggertype="0" useHWbreakpoint="false" group="Cortex-M3 Exceptions" breakdatatype="5" value="0" name="unnamed" counter="0" state="2" mask="0" comparison="0" expression="UsageFault_StateError" filename="" />
</Breakpoints>
<ExecutionCountWindow/>
<Memory1>
<MemoryWindow autoEvaluate="0" addressText="" numColumns="8" sizeText="128" dataSize="1" radix="16" addressSpace="" />
@ -17,11 +37,11 @@
<Project>
<ProjectSessionItem path="rtosdemo" name="unnamed" />
<ProjectSessionItem path="rtosdemo;rtosdemo" name="unnamed" />
<ProjectSessionItem path="rtosdemo;rtosdemo;FreeRTOS Source" name="unnamed" />
<ProjectSessionItem path="rtosdemo;rtosdemo;uIP Source" name="unnamed" />
<ProjectSessionItem path="rtosdemo;rtosdemo;Demo App Source" name="unnamed" />
<ProjectSessionItem path="rtosdemo;rtosdemo;System Files" name="unnamed" />
</Project>
<Register1>
<RegisterWindow unsignedDisplays="" asciiDisplays="" octalDisplays="" openGroups="CPU - Current Mode" visibleGroups="CPU - Current Mode" decimalDisplays="" binaryDisplays="" />
<RegisterWindow unsignedDisplays="" asciiDisplays="" octalDisplays="" openGroups="" visibleGroups="CPU - Current Mode" decimalDisplays="" binaryDisplays="" />
</Register1>
<Register2>
<RegisterWindow unsignedDisplays="" asciiDisplays="" octalDisplays="" openGroups="" visibleGroups="" decimalDisplays="" binaryDisplays="" />
@ -49,7 +69,8 @@
<Watches active="0" />
</Watch4>
<Files>
<SessionOpenFile useTextEdit="1" useBinaryEdit="0" x="0" debugPath="E:\Dev\FreeRTOS\Source\portable\GCC\ARM7_LPC2000\port.c" y="0" useHTMLEdit="0" path="E:\Dev\FreeRTOS\Source\portable\GCC\ARM7_LPC2000\port.c" left="0" selected="0" name="unnamed" top="0" />
<SessionOpenFile useTextEdit="1" useBinaryEdit="0" x="0" debugPath="C:\E\Dev\_FreeRTOS\Demo\uIP_Demo_Rowley_ARM7\main.c" y="219" useHTMLEdit="0" path="C:\E\Dev\_FreeRTOS\Demo\uIP_Demo_Rowley_ARM7\main.c" left="0" selected="0" name="unnamed" top="200" />
<SessionOpenFile useTextEdit="1" useBinaryEdit="0" x="0" debugPath="C:\E\Dev\_FreeRTOS\Demo\uIP_Demo_Rowley_ARM7\Philips_LPC210X_Startup.s" y="119" useHTMLEdit="0" path="C:\E\Dev\_FreeRTOS\Demo\uIP_Demo_Rowley_ARM7\Philips_LPC210X_Startup.s" left="0" selected="1" name="unnamed" top="34" />
</Files>
<ARMCrossStudioWindow activeProject="rtosdemo" ignoreExceptions="IRQ;FIQ;SWI" autoConnectTarget="/ARM Simulators/Simulator, LPC22xx" debugSearchFileMap="" fileDialogInitialDirectory="D:\FreeRTOS\Demo\uIP_Demo_Rowley_ARM7\uip" fileDialogDefaultFilter="*" autoConnectCapabilities="4543" debugSearchPath="" buildConfiguration="Release" />
<ARMCrossStudioWindow activeProject="rtosdemo" autoConnectTarget="/USB CrossConnect for ARM" debugSearchFileMap="" fileDialogInitialDirectory="C:\E\Dev\_FreeRTOS\Demo\uIP_Demo_Rowley_ARM7" fileDialogDefaultFilter="*" autoConnectCapabilities="0" debugSearchPath="" buildConfiguration="THUMB Flash Debug" />
</session>

View file

@ -1,6 +1,6 @@
// cs8900a.c: device driver for the CS8900a chip in 8-bit mode.
#include <targets/LPC210x.h>
#include <LPC210x.h>
#include "cs8900a.h"
#include "uip.h"
@ -270,25 +270,31 @@ const TInitSeq InitSeq[] =
void
cs8900a_write(unsigned addr, unsigned int data)
{
IODIR |= 0xff << 16; // Data port to output
GPIO_IODIR |= 0xff << 16; // Data port to output
IOCLR = 0xf << 4; // Put address on bus
IOSET = addr << 4;
GPIO_IOCLR = 0xf << 4; // Put address on bus
GPIO_IOSET = addr << 4;
IOCLR = 0xff << 16; // Write low order byte to data bus
IOSET = data << 16;
GPIO_IOCLR = 0xff << 16; // Write low order byte to data bus
GPIO_IOSET = data << 16;
IOCLR = IOW; // Toggle IOW-signal
IOSET = IOW;
asm volatile ( "NOP" );
GPIO_IOCLR = IOW; // Toggle IOW-signal
asm volatile ( "NOP" );
GPIO_IOSET = IOW;
asm volatile ( "NOP" );
IOCLR = 0xf << 4;
IOSET = ((addr | 1) << 4); // And put next address on bus
GPIO_IOCLR = 0xf << 4;
GPIO_IOSET = ((addr | 1) << 4); // And put next address on bus
IOCLR = 0xff << 16; // Write high order byte to data bus
IOSET = data >> 8 << 16;
GPIO_IOCLR = 0xff << 16; // Write high order byte to data bus
GPIO_IOSET = data >> 8 << 16;
IOCLR = IOW; // Toggle IOW-signal
IOSET = IOW;
asm volatile ( "NOP" );
GPIO_IOCLR = IOW; // Toggle IOW-signal
asm volatile ( "NOP" );
GPIO_IOSET = IOW;
asm volatile ( "NOP" );
}
// Reads a word in little-endian byte order from a specified port-address
@ -297,20 +303,24 @@ cs8900a_read(unsigned addr)
{
unsigned int value;
IODIR &= ~(0xff << 16); // Data port to input
GPIO_IODIR &= ~(0xff << 16); // Data port to input
IOCLR = 0xf << 4; // Put address on bus
IOSET = addr << 4;
GPIO_IOCLR = 0xf << 4; // Put address on bus
GPIO_IOSET = addr << 4;
IOCLR = IOR; // IOR-signal low
value = (IOPIN >> 16) & 0xff; // get low order byte from data bus
IOSET = IOR;
asm volatile ( "NOP" );
GPIO_IOCLR = IOR; // IOR-signal low
asm volatile ( "NOP" );
value = (GPIO_IOPIN >> 16) & 0xff; // get low order byte from data bus
GPIO_IOSET = IOR;
IOSET = 1 << 4; // IOR high and put next address on bus
GPIO_IOSET = 1 << 4; // IOR high and put next address on bus
IOCLR = IOR; // IOR-signal low
value |= ((IOPIN >> 8) & 0xff00); // get high order byte from data bus
IOSET = IOR; // IOR-signal low
asm volatile ( "NOP" );
GPIO_IOCLR = IOR; // IOR-signal low
asm volatile ( "NOP" );
value |= ((GPIO_IOPIN >> 8) & 0xff00); // get high order byte from data bus
GPIO_IOSET = IOR; // IOR-signal low
return value;
}
@ -321,20 +331,24 @@ cs8900a_read_addr_high_first(unsigned addr)
{
unsigned int value;
IODIR &= ~(0xff << 16); // Data port to input
GPIO_IODIR &= ~(0xff << 16); // Data port to input
IOCLR = 0xf << 4; // Put address on bus
IOSET = (addr+1) << 4;
GPIO_IOCLR = 0xf << 4; // Put address on bus
GPIO_IOSET = (addr+1) << 4;
IOCLR = IOR; // IOR-signal low
value = ((IOPIN >> 8) & 0xff00); // get high order byte from data bus
IOSET = IOR; // IOR-signal high
asm volatile ( "NOP" );
GPIO_IOCLR = IOR; // IOR-signal low
asm volatile ( "NOP" );
value = ((GPIO_IOPIN >> 8) & 0xff00); // get high order byte from data bus
GPIO_IOSET = IOR; // IOR-signal high
IOCLR = 1 << 4; // Put low address on bus
GPIO_IOCLR = 1 << 4; // Put low address on bus
IOCLR = IOR; // IOR-signal low
value |= (IOPIN >> 16) & 0xff; // get low order byte from data bus
IOSET = IOR;
asm volatile ( "NOP" );
GPIO_IOCLR = IOR; // IOR-signal low
asm volatile ( "NOP" );
value |= (GPIO_IOPIN >> 16) & 0xff; // get low order byte from data bus
GPIO_IOSET = IOR;
return value;
}
@ -345,16 +359,16 @@ cs8900a_init(void)
int i;
// Reset outputs, control lines high
IOSET = IOR | IOW;
GPIO_IOSET = IOR | IOW;
// No LEDs on.
IOSET = LED_RED | LED_YELLOW | LED_GREEN;
GPIO_IOSET = LED_RED | LED_YELLOW | LED_GREEN;
// Port 3 as output (all pins but RS232)
IODIR = ~0U; // everything to output.
GPIO_IODIR = ~0U; // everything to output.
// Reset outputs
IOCLR = 0xff << 16; // clear data outputs
GPIO_IOCLR = 0xff << 16; // clear data outputs
// Reset the CS8900A
cs8900a_write(ADD_PORT, PP_SelfCTL);
@ -378,7 +392,7 @@ cs8900a_send(void)
{
unsigned u;
IOCLR = LED_RED; // Light RED LED when frame starting
GPIO_IOCLR = LED_RED; // Light RED LED when frame starting
// Transmit command
cs8900a_write(TX_CMD_PORT, TX_START_ALL_BYTES);
@ -394,7 +408,7 @@ cs8900a_send(void)
break;
if (u -- == 0)
{
IOSET = LED_RED; // Extinguish RED LED on end of frame
GPIO_IOSET = LED_RED; // Extinguish RED LED on end of frame
return;
}
@ -402,33 +416,37 @@ cs8900a_send(void)
skip_frame();
}
IODIR |= 0xff << 16; // Data port to output
GPIO_IODIR |= 0xff << 16; // Data port to output
// Send 40+14=54 bytes of header
for (u = 0; u < 54; u += 2)
{
IOCLR = 0xf << 4; // Put address on bus
IOSET = TX_FRAME_PORT << 4;
GPIO_IOCLR = 0xf << 4; // Put address on bus
GPIO_IOSET = TX_FRAME_PORT << 4;
IOCLR = 0xff << 16; // Write low order byte to data bus
IOSET = uip_buf[u] << 16; // write low order byte to data bus
GPIO_IOCLR = 0xff << 16; // Write low order byte to data bus
GPIO_IOSET = uip_buf[u] << 16; // write low order byte to data bus
IOCLR = IOW; // Toggle IOW-signal
IOSET = IOW;
asm volatile ( "NOP" );
GPIO_IOCLR = IOW; // Toggle IOW-signal
asm volatile ( "NOP" );
GPIO_IOSET = IOW;
IOCLR = 0xf << 4; // Put address on bus
IOSET = (TX_FRAME_PORT | 1) << 4; // and put next address on bus
GPIO_IOCLR = 0xf << 4; // Put address on bus
GPIO_IOSET = (TX_FRAME_PORT | 1) << 4; // and put next address on bus
IOCLR = 0xff << 16; // Write low order byte to data bus
IOSET = uip_buf[u+1] << 16; // write low order byte to data bus
GPIO_IOCLR = 0xff << 16; // Write low order byte to data bus
GPIO_IOSET = uip_buf[u+1] << 16; // write low order byte to data bus
IOCLR = IOW; // Toggle IOW-signal
IOSET = IOW;
asm volatile ( "NOP" );
GPIO_IOCLR = IOW; // Toggle IOW-signal
asm volatile ( "NOP" );
GPIO_IOSET = IOW;
}
if (uip_len <= 54)
{
IOSET = LED_RED; // Extinguish RED LED on end of frame
GPIO_IOSET = LED_RED; // Extinguish RED LED on end of frame
return;
}
@ -437,26 +455,30 @@ cs8900a_send(void)
for (u = 0; u < uip_len; u += 2)
{
IOCLR = 0xf << 4; // Put address on bus
IOSET = TX_FRAME_PORT << 4;
GPIO_IOCLR = 0xf << 4; // Put address on bus
GPIO_IOSET = TX_FRAME_PORT << 4;
IOCLR = 0xff << 16; // Write low order byte to data bus
IOSET = uip_appdata[u] << 16; // write low order byte to data bus
GPIO_IOCLR = 0xff << 16; // Write low order byte to data bus
GPIO_IOSET = uip_appdata[u] << 16; // write low order byte to data bus
IOCLR = IOW; // Toggle IOW-signal
IOSET = IOW;
asm volatile ( "NOP" );
GPIO_IOCLR = IOW; // Toggle IOW-signal
asm volatile ( "NOP" );
GPIO_IOSET = IOW;
IOCLR = 0xf << 4; // Put address on bus
IOSET = (TX_FRAME_PORT | 1) << 4; // and put next address on bus
GPIO_IOCLR = 0xf << 4; // Put address on bus
GPIO_IOSET = (TX_FRAME_PORT | 1) << 4; // and put next address on bus
IOCLR = 0xff << 16; // Write low order byte to data bus
IOSET = uip_appdata[u+1] << 16; // write low order byte to data bus
GPIO_IOCLR = 0xff << 16; // Write low order byte to data bus
GPIO_IOSET = uip_appdata[u+1] << 16; // write low order byte to data bus
IOCLR = IOW; // Toggle IOW-signal
IOSET = IOW;
asm volatile ( "NOP" );
GPIO_IOCLR = IOW; // Toggle IOW-signal
asm volatile ( "NOP" );
GPIO_IOSET = IOW;
}
IOSET = LED_RED; // Extinguish RED LED on end of frame
GPIO_IOSET = LED_RED; // Extinguish RED LED on end of frame
}
static void
@ -477,7 +499,7 @@ cs8900a_poll(void)
if ((cs8900a_read(DATA_PORT) & 0xd00) == 0)
return 0;
IOCLR = LED_GREEN; // Light GREED LED when frame coming in.
GPIO_IOCLR = LED_GREEN; // Light GREED LED when frame coming in.
// Read receiver status and discard it.
cs8900a_read_addr_high_first(RX_FRAME_PORT);
@ -493,30 +515,32 @@ cs8900a_poll(void)
}
// Data port to input
IODIR &= ~(0xff << 16);
GPIO_IODIR &= ~(0xff << 16);
IOCLR = 0xf << 4; // put address on bus
IOSET = RX_FRAME_PORT << 4;
GPIO_IOCLR = 0xf << 4; // put address on bus
GPIO_IOSET = RX_FRAME_PORT << 4;
// Read bytes into uip_buf
u = 0;
while (u < len)
{
IOCLR = 1 << 4; // put address on bus
GPIO_IOCLR = 1 << 4; // put address on bus
IOCLR = IOR; // IOR-signal low
uip_buf[u] = IOPIN >> 16; // get high order byte from data bus
IOSET = IOR; // IOR-signal high
GPIO_IOCLR = IOR; // IOR-signal low
uip_buf[u] = GPIO_IOPIN >> 16; // get high order byte from data bus
asm volatile ( "NOP" );
GPIO_IOSET = IOR; // IOR-signal high
IOSET = 1 << 4; // put address on bus
GPIO_IOSET = 1 << 4; // put address on bus
IOCLR = IOR; // IOR-signal low
uip_buf[u+1] = IOPIN >> 16; // get high order byte from data bus
IOSET = IOR; // IOR-signal high
GPIO_IOCLR = IOR; // IOR-signal low
asm volatile ( "NOP" );
uip_buf[u+1] = GPIO_IOPIN >> 16; // get high order byte from data bus
GPIO_IOSET = IOR; // IOR-signal high
u += 2;
}
IOSET = LED_GREEN; // Extinguish GREED LED when frame finished.
GPIO_IOSET = LED_GREEN; // Extinguish GREED LED when frame finished.
return len;
}