Added Software projects
git-svn-id: file:///srv/dev-disk-by-uuid-17e88007-4d0c-45e0-8757-cacfcc458630/repositories/svn/Diplomarbeit@55 9fe90eed-be63-e94b-8204-d34ff4c2ff93
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,85 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>Applications</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
<project>BusProtocol</project>
|
||||
<project>Drivers</project>
|
||||
<project>FreeRTOS</project>
|
||||
<project>inc</project>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
|
||||
<triggers>clean,full,incremental,</triggers>
|
||||
<arguments>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.cleanBuildTarget</key>
|
||||
<value>clean</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.enableCleanBuild</key>
|
||||
<value>true</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>?name?</key>
|
||||
<value></value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.append_environment</key>
|
||||
<value>true</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.stopOnError</key>
|
||||
<value>true</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.buildCommand</key>
|
||||
<value>make</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.contents</key>
|
||||
<value>org.eclipse.cdt.make.core.activeConfigSettings</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.buildLocation</key>
|
||||
<value>${workspace_loc:/Applications/Debug}</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.useDefaultBuildCmd</key>
|
||||
<value>true</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.enableAutoBuild</key>
|
||||
<value>false</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.enableFullBuild</key>
|
||||
<value>true</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.buildArguments</key>
|
||||
<value></value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.fullBuildTarget</key>
|
||||
<value>all</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.autoBuildTarget</key>
|
||||
<value>all</value>
|
||||
</dictionary>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
|
||||
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
|
||||
<nature>org.eclipse.cdt.core.cnature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
@@ -0,0 +1,146 @@
|
||||
/* Sample initialization file */
|
||||
|
||||
.extern main
|
||||
.extern exit
|
||||
|
||||
.text
|
||||
.code 32
|
||||
|
||||
|
||||
.align 4
|
||||
|
||||
.extern __bss_beg__
|
||||
.extern __bss_end__
|
||||
.extern __stack_end__
|
||||
.extern __data_beg__
|
||||
.extern __data_end__
|
||||
.extern __data+beg_src__
|
||||
|
||||
.global start
|
||||
.global endless_loop
|
||||
|
||||
/* Stack Sizes */
|
||||
.set UND_STACK_SIZE, 0x00000004
|
||||
.set ABT_STACK_SIZE, 0x00000004
|
||||
.set FIQ_STACK_SIZE, 0x00000004
|
||||
.set IRQ_STACK_SIZE, 0X00000100
|
||||
.set SVC_STACK_SIZE, 0x00000100
|
||||
|
||||
/* Standard definitions of Mode bits and Interrupt (I & F) flags in PSRs */
|
||||
.set MODE_USR, 0x10 /* User Mode */
|
||||
.set MODE_FIQ, 0x11 /* FIQ Mode */
|
||||
.set MODE_IRQ, 0x12 /* IRQ Mode */
|
||||
.set MODE_SVC, 0x13 /* Supervisor Mode */
|
||||
.set MODE_ABT, 0x17 /* Abort Mode */
|
||||
.set MODE_UND, 0x1B /* Undefined Mode */
|
||||
.set MODE_SYS, 0x1F /* System Mode */
|
||||
|
||||
.equ I_BIT, 0x80 /* when I bit is set, IRQ is disabled */
|
||||
.equ F_BIT, 0x40 /* when F bit is set, FIQ is disabled */
|
||||
|
||||
start:
|
||||
_start:
|
||||
_mainCRTStartup:
|
||||
|
||||
/* Setup a stack for each mode - note that this only sets up a usable stack
|
||||
for system/user, SWI and IRQ modes. Also each mode is setup with
|
||||
interrupts initially disabled. */
|
||||
ldr r0, .LC6
|
||||
msr CPSR_c, #MODE_UND|I_BIT|F_BIT /* Undefined Instruction Mode
|
||||
mov sp, r0
|
||||
sub r0, r0, #UND_STACK_SIZE
|
||||
msr CPSR_c, #MODE_ABT|I_BIT|F_BIT /* Abort Mode */
|
||||
mov sp, r0
|
||||
sub r0, r0, #ABT_STACK_SIZE
|
||||
msr CPSR_c, #MODE_FIQ|I_BIT|F_BIT /* FIQ Mode */
|
||||
mov sp, r0
|
||||
sub r0, r0, #FIQ_STACK_SIZE
|
||||
msr CPSR_c, #MODE_IRQ|I_BIT|F_BIT /* IRQ Mode */
|
||||
mov sp, r0
|
||||
sub r0, r0, #IRQ_STACK_SIZE
|
||||
msr CPSR_c, #MODE_SVC|I_BIT|F_BIT /* Supervisor Mode */
|
||||
mov sp, r0
|
||||
sub r0, r0, #SVC_STACK_SIZE
|
||||
msr CPSR_c, #MODE_SYS|I_BIT|F_BIT /* System Mode */
|
||||
mov sp, r0
|
||||
|
||||
/* We want to start in supervisor mode. Operation will switch to system
|
||||
mode when the first task starts. */
|
||||
msr CPSR_c, #MODE_SVC|I_BIT|F_BIT
|
||||
|
||||
/* Clear BSS. */
|
||||
|
||||
mov a2, #0 /* Fill value */
|
||||
mov fp, a2 /* Null frame pointer */
|
||||
mov r7, a2 /* Null frame pointer for Thumb */
|
||||
|
||||
ldr r1, .LC1 /* Start of memory block */
|
||||
ldr r3, .LC2 /* End of memory block */
|
||||
subs r3, r3, r1 /* Length of block */
|
||||
beq .end_clear_loop
|
||||
mov r2, #0
|
||||
|
||||
.clear_loop:
|
||||
strb r2, [r1], #1
|
||||
subs r3, r3, #1
|
||||
bgt .clear_loop
|
||||
|
||||
.end_clear_loop:
|
||||
|
||||
/* Initialise data. */
|
||||
|
||||
ldr r1, .LC3 /* Start of memory block */
|
||||
ldr r2, .LC4 /* End of memory block */
|
||||
ldr r3, .LC5
|
||||
subs r3, r3, r1 /* Length of block */
|
||||
beq .end_set_loop
|
||||
|
||||
.set_loop:
|
||||
ldrb r4, [r2], #1
|
||||
strb r4, [r1], #1
|
||||
subs r3, r3, #1
|
||||
bgt .set_loop
|
||||
|
||||
.end_set_loop:
|
||||
|
||||
mov r0, #0 /* no arguments */
|
||||
mov r1, #0 /* no argv either */
|
||||
|
||||
bl main
|
||||
|
||||
endless_loop:
|
||||
b endless_loop
|
||||
|
||||
|
||||
.align 0
|
||||
|
||||
.LC1:
|
||||
.word __bss_beg__
|
||||
.LC2:
|
||||
.word __bss_end__
|
||||
.LC3:
|
||||
.word __data_beg__
|
||||
.LC4:
|
||||
.word __data_beg_src__
|
||||
.LC5:
|
||||
.word __data_end__
|
||||
.LC6:
|
||||
.word __stack_end__
|
||||
|
||||
|
||||
/* Setup vector table. Note that undf, pabt, dabt, fiq just execute
|
||||
a null loop. */
|
||||
|
||||
.section .startup,"ax"
|
||||
.code 32
|
||||
.align 0
|
||||
|
||||
.word 0x11111111 /* +0x0, product_id */
|
||||
.word 0x10101010 /* +0x4, version */
|
||||
.word 0x0 /* +0x8, length (filled by firmware loader) */
|
||||
.word 0x0 /* +0xC, CRC (filled by firmware loader) */
|
||||
.word 0x0 /* +0x10, reserved */
|
||||
.word 0x0 /* +0x14, reserved */
|
||||
.word 0x0 /* +0x18, reserved */
|
||||
.word 0x0 /* +0x1C, reserved */
|
||||
b _start /* +0x20, Firmware start */
|
||||
@@ -0,0 +1,274 @@
|
||||
/* ---------------------------------------------------------------------------
|
||||
* ledfunctions.c (c) 2008 Micro-key bv
|
||||
* ---------------------------------------------------------------------------
|
||||
* Micro-key bv
|
||||
* Industrieweg 28, 9804 TG Noordhorn
|
||||
* Postbus 92, 9800 AB Zuidhorn
|
||||
* The Netherlands
|
||||
* Tel: +31 594 503020
|
||||
* Fax: +31 594 505825
|
||||
* Email: support@microkey.nl
|
||||
* Web: www.microkey.nl
|
||||
* ---------------------------------------------------------------------------
|
||||
* Description:
|
||||
* Some handy Functions for the status and the Digital Output LEDs
|
||||
* ---------------------------------------------------------------------------
|
||||
* Version(s): 0.1, Mar 11, 2008, MMi
|
||||
* Creation.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* System include files
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#include "lpc23xx.h"
|
||||
#include "types.h"
|
||||
|
||||
|
||||
/* FreeRTOS includes */
|
||||
#include "FreeRTOS.h"
|
||||
#include "Task.h"
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Application include files
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#include "leds.h"
|
||||
#include "dio.h"
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Local constant and macro definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Global variable definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Local variable definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Local function definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
void LEDPauseFlash (t_led_ids LEDnum, UINT8 counts, INT16 delay_length)
|
||||
{
|
||||
/* Local Variable Declaration */
|
||||
UINT16 loopcnt; /* loop index */
|
||||
|
||||
for ( loopcnt=0; loopcnt <= (counts*2); loopcnt++)
|
||||
{
|
||||
if (LEDnum == LED0) /* RED LED */
|
||||
{
|
||||
ledToggle (LED0); /* Toggle LED Status */
|
||||
vTaskDelay (delay_length); /* Wait for defined time */
|
||||
}
|
||||
if (LEDnum == LED1) /* GREEN LED */
|
||||
{
|
||||
ledToggle (LED1);
|
||||
vTaskDelay (delay_length);
|
||||
}
|
||||
}
|
||||
if (ledGet (LED1) == FALSE) /* GREEN LED should be switched on */
|
||||
{
|
||||
ledToggle (LED1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void LEDResult (BOOLEAN TestResult)
|
||||
{
|
||||
if (TestResult == TRUE) /* If Test was passed */
|
||||
{
|
||||
ledSet (LED0, 1); /* switch on RED LED */
|
||||
}
|
||||
if (TestResult == FALSE) /* If test failed */
|
||||
{
|
||||
ledSet (LED0, 0); /* Switch off RED LED */
|
||||
}
|
||||
}
|
||||
|
||||
void LEDResultDIO (BOOLEAN TestResult, UINT16 dioNo)
|
||||
{
|
||||
if (TestResult == TRUE) /* If Test was passed */
|
||||
{
|
||||
dioWrite (0, dioNo, TRUE); /* switch on DIO LED */
|
||||
}
|
||||
if (TestResult == FALSE) /* If test failed */
|
||||
{
|
||||
dioWrite (0, dioNo, FALSE); /* Switch off DIO LED */
|
||||
}
|
||||
}
|
||||
|
||||
void LEDToggleForever (void)
|
||||
{
|
||||
ledSet (LED0, FALSE); /* Set both LEDs to StartUp */
|
||||
ledSet (LED1, TRUE);
|
||||
vTaskDelay (500); /* Wait for 500 ms */
|
||||
|
||||
for (;;) /* endless loop */
|
||||
{
|
||||
ledToggle (LED0); /* Toggle RED LED */
|
||||
ledToggle (LED1); /* Toggle GREEN LED */
|
||||
|
||||
vTaskDelay (500);
|
||||
}
|
||||
}
|
||||
|
||||
void LEDToggle (UINT16 cnts)
|
||||
{
|
||||
/* Local Variable Declaration */
|
||||
UINT16 loopcnt; /* loop index */
|
||||
|
||||
ledSet (LED0, FALSE); /* Set both LEDs to StartUp */
|
||||
ledSet (LED1, TRUE);
|
||||
vTaskDelay (500); /* Wait for 500 ms */
|
||||
|
||||
for ( loopcnt = 0; loopcnt <= cnts; loopcnt++)
|
||||
{
|
||||
ledToggle(LED0); /* Toggle RED LED */
|
||||
ledToggle(LED1); /* Toggle GREEN LED */
|
||||
|
||||
vTaskDelay (500);
|
||||
}
|
||||
}
|
||||
|
||||
void LEDShowStatus (UINT16 status)
|
||||
{
|
||||
/* Local Variable Declaration */
|
||||
UINT16 loopcnt; /* loop index */
|
||||
|
||||
if (ledGet (LED0) == TRUE) /* If current LED Status is TRUE */
|
||||
{
|
||||
ledSet( LED0, FALSE); /* Switch of RED LED */
|
||||
vTaskDelay (500); /* Wait for 500 ms */
|
||||
}
|
||||
|
||||
for (loopcnt = 0; loopcnt <= (status*2); loopcnt++)
|
||||
{
|
||||
ledToggle (LED0); /* Toggle RED LED */
|
||||
vTaskDelay (500);
|
||||
}
|
||||
vTaskDelay (1000);
|
||||
}
|
||||
|
||||
void gLEDToggle (UINT16 time)
|
||||
{
|
||||
for (;;) /* Endless loop */
|
||||
{
|
||||
ledToggle (LED1); /* Toggle GREEN LED */
|
||||
vTaskDelay (time); /* Wait for defined time */
|
||||
}
|
||||
}
|
||||
|
||||
void rLEDToggle (UINT16 time)
|
||||
{
|
||||
for (;;) /* Endless loop */
|
||||
{
|
||||
ledToggle (LED0); /* Toggle RED LED */
|
||||
vTaskDelay (time); /* Wait for defined Time */
|
||||
}
|
||||
}
|
||||
|
||||
void dioToggle (UINT16 LEDnr)
|
||||
{
|
||||
UINT16 time = 100; /* LED Toggle-time definition */
|
||||
|
||||
for (;;) /* Endless loop */
|
||||
{
|
||||
dioWrite (0, LEDnr, TRUE); /* Write defined digitalOut to HIGH */
|
||||
vTaskDelay (time); /* Wait for defined Toggle-time */
|
||||
dioWrite (0, LEDnr, FALSE); /* Write defined digitalOut to LOW */
|
||||
vTaskDelay (time);
|
||||
}
|
||||
}
|
||||
|
||||
void dioToggleNC (UINT16 LEDnr)
|
||||
{
|
||||
UINT16 time = 1000; /* LED Toggle-time definition */
|
||||
|
||||
for (;;) /* Endless loop */
|
||||
{
|
||||
dioWrite (0, LEDnr, TRUE); /* Write defined digitalOut to HIGH */
|
||||
vTaskDelay (time); /* Wait for defined Toggle-time */
|
||||
dioWrite (0, LEDnr, FALSE); /* Write defined digitalOut to LOW */
|
||||
vTaskDelay (time);
|
||||
}
|
||||
}
|
||||
|
||||
void dio2x4 (UINT32 ToggleTime)
|
||||
{
|
||||
|
||||
for (;;) /* endless loop */
|
||||
{
|
||||
dioWrite (0,0,TRUE); /* ON-OFF-ON-OFF-ON-OFF-ON-OFF */
|
||||
dioWrite (0,1,FALSE);
|
||||
dioWrite (0,2,TRUE);
|
||||
dioWrite (0,3,FALSE);
|
||||
dioWrite (0,4,TRUE);
|
||||
dioWrite (0,5,FALSE);
|
||||
dioWrite (0,6,TRUE);
|
||||
dioWrite (0,7,FALSE);
|
||||
|
||||
vTaskDelay(ToggleTime); /* Wait Toggle Time */
|
||||
|
||||
dioWrite (0,0,FALSE); /* OFF-ON-OFF-ON-OFF-ON-OFF-ON */
|
||||
dioWrite (0,1,TRUE);
|
||||
dioWrite (0,2,FALSE);
|
||||
dioWrite (0,3,TRUE);
|
||||
dioWrite (0,4,FALSE);
|
||||
dioWrite (0,5,TRUE);
|
||||
dioWrite (0,6,FALSE);
|
||||
dioWrite (0,7,TRUE);
|
||||
|
||||
vTaskDelay (ToggleTime);
|
||||
}
|
||||
}
|
||||
|
||||
void dioClean (void)
|
||||
{
|
||||
dioWrite (0,0,FALSE); /* Write digital Output to LOW */
|
||||
dioWrite (0,1,FALSE);
|
||||
dioWrite (0,2,FALSE);
|
||||
dioWrite (0,3,FALSE);
|
||||
dioWrite (0,4,FALSE);
|
||||
dioWrite (0,5,FALSE);
|
||||
dioWrite (0,6,FALSE);
|
||||
dioWrite (0,7,FALSE);
|
||||
}
|
||||
UINT8 dioCapture (void)
|
||||
{
|
||||
/* Local Variable Declaration */
|
||||
UINT8 dioCaptureResult = 0;
|
||||
|
||||
dioCaptureResult |= (dioReadBack (0,0) << 0); /*Save current DIO Status */
|
||||
dioCaptureResult |= (dioReadBack (0,1) << 1);
|
||||
dioCaptureResult |= (dioReadBack (0,2) << 2);
|
||||
dioCaptureResult |= (dioReadBack (0,3) << 3);
|
||||
dioCaptureResult |= (dioReadBack (0,4) << 4);
|
||||
dioCaptureResult |= (dioReadBack (0,5) << 5);
|
||||
dioCaptureResult |= (dioReadBack (0,6) << 6);
|
||||
dioCaptureResult |= (dioReadBack (0,7) << 7);
|
||||
|
||||
return dioCaptureResult; /* Return saved DIO Status */
|
||||
}
|
||||
|
||||
void dioResume (UINT8 dioResumeValue)
|
||||
{
|
||||
dioWrite (0,0,((dioResumeValue >> 0) & 1)); /* Set DIO to defined Value */
|
||||
dioWrite (0,1,((dioResumeValue >> 1) & 1));
|
||||
dioWrite (0,2,((dioResumeValue >> 2) & 1));
|
||||
dioWrite (0,3,((dioResumeValue >> 3) & 1));
|
||||
dioWrite (0,4,((dioResumeValue >> 4) & 1));
|
||||
dioWrite (0,5,((dioResumeValue >> 5) & 1));
|
||||
dioWrite (0,6,((dioResumeValue >> 6) & 1));
|
||||
dioWrite (0,7,((dioResumeValue >> 7) & 1));
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,220 @@
|
||||
/* ---------------------------------------------------------------------------
|
||||
* ledfunctions.h (c) 2008 Micro-key bv
|
||||
* ---------------------------------------------------------------------------
|
||||
* Micro-key bv
|
||||
* Industrieweg 28, 9804 TG Noordhorn
|
||||
* Postbus 92, 9800 AB Zuidhorn
|
||||
* The Netherlands
|
||||
* Tel: +31 594 503020
|
||||
* Fax: +31 594 505825
|
||||
* Email: support@microkey.nl
|
||||
* Web: www.microkey.nl
|
||||
* ---------------------------------------------------------------------------
|
||||
* Description:
|
||||
* Headerfile for ledfunctions.c
|
||||
* ---------------------------------------------------------------------------
|
||||
* Version(s): 0.1, Mar 11, 2008, MMi
|
||||
* Creation.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef LEDFUNCTIONS_H_
|
||||
#define LEDFUNCTIONS_H_
|
||||
/* ---------------------------------------------------------------------------
|
||||
* System include files.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#include "lpc23xx.h"
|
||||
#include "types.h"
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Application include files.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#include "leds.h"
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Constant and macro definitions.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Type definitions.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Variable declarations.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Function declarations.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Function: LEDPauseFlash
|
||||
*
|
||||
* Function that flashes either the RED or the GREEN LED in user defined
|
||||
* length and number.
|
||||
*
|
||||
* Parameters: t_led_ids LEDnum - Defines the LED to flash
|
||||
* UINT8 counts - Number of flash events
|
||||
* INT16 delay_length - length of single flash event
|
||||
*
|
||||
* Return: void
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
void LEDPauseFlash(t_led_ids LEDnum, UINT8 counts, INT16 delay_length);
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Function: LEDResult
|
||||
*
|
||||
* Function to display a BOOLEAN Variable either on RED or GREEN LED
|
||||
*
|
||||
* Parameters: BOOLEAN TestResult - Gives the BOOLEAN Variable to display
|
||||
*
|
||||
* Return: void
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
void LEDResult (BOOLEAN TestResult);
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Function: LEDResultDIO
|
||||
*
|
||||
* Function to display a BOOLEAN Variable on a DIO LED
|
||||
*
|
||||
* Parameters: BOOLEAN TestResult - Gives the BOOLEAN Variable to display
|
||||
* UINT 16 dioNo - Number of DIO channel
|
||||
*
|
||||
* Return: void
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
void LEDResultDIO (BOOLEAN TestResult, UINT16 dioNo);
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Function: LEDToggleForever
|
||||
*
|
||||
* Function that simply toggles RED and GREEN LED in an endless loop
|
||||
*
|
||||
* Parameters: void
|
||||
*
|
||||
* Return: void
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
void LEDToggleForever( void);
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Function: LEDToggle
|
||||
*
|
||||
* Function that simply toggles RED and GREEN LED for user defined number
|
||||
*
|
||||
* Parameters: UINT16 cnts - user defined toggle number
|
||||
*
|
||||
* Return: void
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
void LEDToggle( UINT16 cnts);
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Function: LEDShowStatus
|
||||
*
|
||||
* Function to display a Variable value by flashing that amount of.
|
||||
*
|
||||
* Parameters: UINT16 status - Value of Variable to flash like
|
||||
*
|
||||
* Return: void
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
void LEDShowStatus (UINT16 status);
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Functions: gLEDToggle / rLEDToggle
|
||||
*
|
||||
* Functions to toggle either RED or GREEN LED forever with user defined
|
||||
* flash time
|
||||
*
|
||||
* Parameters: UINT16 time
|
||||
*
|
||||
* Return: void
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
void gLEDToggle (UINT16 time);
|
||||
void rLEDToggle (UINT16 time);
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Function: dioToggle
|
||||
*
|
||||
* Function to toggle LED Status of a user defined Digital Output with 100 ms
|
||||
* flash time.
|
||||
*
|
||||
* Parameters: UINT16 LEDnr
|
||||
*
|
||||
* Return: void
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
void dioToggle (UINT16 LEDnr);
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Function: dioToggleNC
|
||||
*
|
||||
* Function to toggle LED Status of a user defined Digital Output with 1000 ms
|
||||
* flash time.
|
||||
*
|
||||
* Parameters: UINT16 LEDnr
|
||||
*
|
||||
* Return: void
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
void dioToggleNC (UINT16 LEDnr);
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Function: dio2x4
|
||||
*
|
||||
* Function to constantly flash the DIO LEDs in ON-OFF-ON-OFF pattern with
|
||||
* userdefined toggle Time.
|
||||
* Normaly used to note the user for something
|
||||
*
|
||||
* Parameters: UINT32 ToggleTime
|
||||
*
|
||||
* Return: void
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
void dio2x4 (UINT32 ToggleTime);
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Function: dioClean
|
||||
*
|
||||
* Sets all Digital Outputs back to LOW
|
||||
*
|
||||
* Parameters: void
|
||||
*
|
||||
* Return: void
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
void dioClean (void);
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Function: dioCapture
|
||||
*
|
||||
* Function to capture and save up to all 8 Digital Output Levels
|
||||
*
|
||||
* Parameters: void
|
||||
*
|
||||
* Return: UINT8 - up to all 8 Digital Output Levels
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
UINT8 dioCapture (void);
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Function: dioResume
|
||||
*
|
||||
* Function to set or restore up to all 8 Digital Output Levels
|
||||
*
|
||||
* Parameters: UINT8 dioResumeValue - Value for setting Output Levels
|
||||
*
|
||||
* Return: void
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
void dioResume (UINT8 dioResumeValue);
|
||||
|
||||
|
||||
#endif /*LEDFUNCTIONS_H_*/
|
||||
@@ -0,0 +1,176 @@
|
||||
/* ---------------------------------------------------------------------------
|
||||
* protocolfunctions.c - v0.1 (c) 2008 Micro-key bv
|
||||
* ---------------------------------------------------------------------------
|
||||
* Micro-key bv
|
||||
* Industrieweg 28, 9804 TG Noordhorn
|
||||
* Postbus 92, 9800 AB Zuidhorn
|
||||
* The Netherlands
|
||||
* Tel: +31 594 503020
|
||||
* Fax: +31 594 505825
|
||||
* Email: support@microkey.nl
|
||||
* Web: www.microkey.nl
|
||||
* ---------------------------------------------------------------------------
|
||||
* Description: Initialisation and direct usage of the Bus Protocol
|
||||
* ---------------------------------------------------------------------------
|
||||
* Version(s): 0.1, Jun 2, 2008, MMi
|
||||
* Creation.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* System include files
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#include "LPC23xx.h"
|
||||
#include "types.h"
|
||||
|
||||
#include "FreeRTOS.h"
|
||||
#include "task.h"
|
||||
#include "semphr.h"
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Application include files
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#include "protocolfunctions.h"
|
||||
#include "BusProtocol.h"
|
||||
|
||||
#include "adc.h"
|
||||
#include "dac.h"
|
||||
#include "bus.h"
|
||||
#include "dio.h"
|
||||
#include "serial.h"
|
||||
#include "SerOut.h"
|
||||
#include "topoftest.h"
|
||||
|
||||
#include "remote_digital.h"
|
||||
#include "remote_analogue.h"
|
||||
#include "remote_relay.h"
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Local constant and macro definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Global variable definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
extern BOOLEAN auto_testResult;
|
||||
extern UINT32 UINT32result;
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Local variable definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Local function definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
void protocolInit (t_bus_devices BUS_ID, UINT32 DEV_ID, UINT32 MAX_ID)
|
||||
{
|
||||
/* Create both needed Semaphores to be able to use them */
|
||||
vSemaphoreCreateBinary (generalSemaphore);
|
||||
vSemaphoreCreateBinary (slaveRestartSemaphore);
|
||||
|
||||
/* Init Device as Master of BUS1 System */
|
||||
handleBus1 = bpInit (BUS2, BUS1, DEV_ID, MAX_ID, 16);
|
||||
|
||||
/* Attach basicly needed Handshake Functions */
|
||||
bpAttachRpc (handleBus1, 1, "AvailableID", (t_rpc_remote_procedure_call) availableBusID, 0);
|
||||
bpAttachRpcResult(handleBus1, 1, (t_bp_rpcresult_callback) generalResultFunction, 0);
|
||||
|
||||
/* Following Attachments depend on Device ID */
|
||||
if (DEV_ID == 1)
|
||||
{
|
||||
/* If Device is Master, attach these functions */
|
||||
/* Attach Slave Result Functions (called by Slave on the Master) */
|
||||
bpAttachRpcResult(handleBus1, 2, (t_bp_rpcresult_callback) testResultFunction, 1);
|
||||
bpAttachRpcResult(handleBus1, 3, (t_bp_rpcresult_callback) slaveRestartFunction, 0);
|
||||
bpAttachRpcResult(handleBus1, 4, (t_bp_rpcresult_callback) UINT32ResultFunction, 1);
|
||||
bpAttachRpcResult(handleBus1, 9, (t_bp_rpcresult_callback) receiveRemoteAttachedFunctions, 1);
|
||||
|
||||
/* Attach test result functions */
|
||||
bpAttachRpcResult(handleBus1, 11, (t_bp_rpcresult_callback) digitalReadResult, 1);
|
||||
bpAttachRpcResult(handleBus1, 12, (t_bp_rpcresult_callback) analogueReadResult, 1);
|
||||
bpAttachRpcResult(handleBus1, 13, (t_bp_rpcresult_callback) digitalReadAllResult, maxDI_Channels);
|
||||
bpAttachRpcResult(handleBus1, 14, (t_bp_rpcresult_callback) analogueReadAllResult, maxDAC_Channels);
|
||||
|
||||
/* Attach semaphore release functions */
|
||||
bpAttachRpcResult(handleBus1, 20, (t_bp_rpcresult_callback) remoteDigitalSemaphoreRelease, 0);
|
||||
bpAttachRpcResult(handleBus1, 21, (t_bp_rpcresult_callback) remoteAnalogueSemaphoreRelease, 0);
|
||||
bpAttachRpcResult(handleBus1, 22, (t_bp_rpcresult_callback) remoteRelaySemaphoreRelease, 0);
|
||||
|
||||
}
|
||||
|
||||
if (DEV_ID > 1)
|
||||
{
|
||||
/* If Device is Slave, attach these functions */
|
||||
}
|
||||
}
|
||||
|
||||
void availableBusID (UINT8 senderId, UINT8 targetId, UINT8 requestNr,
|
||||
UINT8 functionId, UINT8 nrOfParams, UINT32 *params)
|
||||
{
|
||||
/* Just call first Result Function on Slave */
|
||||
bpSendRpcResult(handleBus1, 2, 1, 1, 0, NULL);
|
||||
}
|
||||
|
||||
/* generalResultFunction is the easiest Way to realise a Handshake between
|
||||
* Master and Slave. Master software takes a Semaphore and calls a function
|
||||
* on Slave, that is only calling generalResultfunction() on Master. If this
|
||||
* happens, the Semaphore will be released and Handshake is done
|
||||
*/
|
||||
void generalResultFunction (UINT8 requestNr, UINT8 nrOfResults, UINT32 *results)
|
||||
{
|
||||
/* If called, release the generalSemaphore */
|
||||
if (xSemaphoreGive (generalSemaphore) == pdTRUE)
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
/* Test functions called on Slave will return their Test Results with a
|
||||
* call on this function. Results on Slave are from type BOOLEAN
|
||||
*/
|
||||
void testResultFunction (UINT8 requestNr, UINT8 nrOfResults, UINT32 *results)
|
||||
{
|
||||
/* Set Slave Test result depending on what slave sends back as parameter*/
|
||||
if (*results == 1)
|
||||
{
|
||||
/* Test was successfull */
|
||||
auto_testResult = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Test was a failure */
|
||||
auto_testResult = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void slaveRestartFunction (UINT8 requestNr, UINT8 nrOfResults, UINT32 *results)
|
||||
{
|
||||
/* Release slaveRestartSemaphore if Slave calls this Function on Reboot */
|
||||
if (xSemaphoreGive (slaveRestartSemaphore) == pdTRUE)
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void UINT32ResultFunction (UINT8 requestNr, UINT8 nrOfResults, UINT32 *results)
|
||||
{
|
||||
UINT32result = *results;
|
||||
}
|
||||
|
||||
|
||||
void receiveRemoteAttachedFunctions (UINT8 requestNr, UINT8 nrOfResults, UINT32 *results)
|
||||
{
|
||||
sendString (SerOutPort, TRUE, importantMessage, (char *) results, Dummy, Dummy);
|
||||
}
|
||||
@@ -0,0 +1,162 @@
|
||||
/* ---------------------------------------------------------------------------
|
||||
* protocolfunctions.h - v0.1 (c) 2008 Micro-key bv
|
||||
* ---------------------------------------------------------------------------
|
||||
* Micro-key bv
|
||||
* Industrieweg 28, 9804 TG Noordhorn
|
||||
* Postbus 92, 9800 AB Zuidhorn
|
||||
* The Netherlands
|
||||
* Tel: +31 594 503020
|
||||
* Fax: +31 594 505825
|
||||
* Email: support@microkey.nl
|
||||
* Web: www.microkey.nl
|
||||
* ---------------------------------------------------------------------------
|
||||
* Description:
|
||||
* ---------------------------------------------------------------------------
|
||||
* Version(s): 0.1, Jun 2, 2008, MMi
|
||||
* Creation.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef __PROTOCOLTEST_H__
|
||||
#define __PROTOCOLTEST_H__
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* System include files.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#include "LPC23xx.h"
|
||||
#include "types.h"
|
||||
|
||||
/* FreeRTOS includes */
|
||||
#include "FreeRTOS.h"
|
||||
#include "task.h"
|
||||
#include "semphr.h"
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Application include files.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#include "Bus.h"
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Constant and macro definitions.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Type definitions.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Variable declarations.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
int handleBus1;
|
||||
|
||||
UINT8 remoteDeviceNumber;
|
||||
UINT8 thisDeviceNumber;
|
||||
|
||||
xSemaphoreHandle generalSemaphore;
|
||||
xSemaphoreHandle slaveRestartSemaphore;
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Function declarations.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Function: protocolInit
|
||||
*
|
||||
* Function to calibrate slaves Voltage Output
|
||||
*
|
||||
* Parameters: t_bus_devices BUS_ID - ID of the BUS system
|
||||
* UINT32 DEV_ID - ID of the local Device
|
||||
* UINT32 MAX_ID - Max ID in System
|
||||
*
|
||||
* Return: void
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
void protocolInit (t_bus_devices BUS_ID, UINT32 DEV_ID, UINT32 MAX_ID);
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Function: availableBusID
|
||||
*
|
||||
* Function that just calls a Result on the Caller. It's just a Handshake
|
||||
*
|
||||
* Parameters: UINT8 senderId - ID of Caller
|
||||
* UINT8 targetId - ID of Target
|
||||
* UINT8 requestNr - Number of the request
|
||||
* UINT8 functionId - Numer of function to call
|
||||
* UINT8 nrOfParams - Number of attached Paramters
|
||||
* UINT32 *params - Attached Paramters
|
||||
*
|
||||
* Return: void
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
void availableBusID (UINT8 senderId, UINT8 targetId, UINT8 requestNr,
|
||||
UINT8 functionId, UINT8 nrOfParams, UINT32 *params);
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Function: generalResultfunction
|
||||
*
|
||||
* Function that is called be Slave on the Master to release a Semaphore
|
||||
*
|
||||
* Parameters: UINT8 requestNr - number of the request
|
||||
* UINT8 nrOfResult - Number of Attached Results
|
||||
* UIN32 *results - Attached Results
|
||||
*
|
||||
* Return: void
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
void generalResultFunction (UINT8 requestNr, UINT8 nrOfResults, UINT32 *results);
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Function: testResultfunction
|
||||
*
|
||||
* Function that is called be Slave for telling a Test Result
|
||||
*
|
||||
* Parameters: UINT8 requestNr - number of the request
|
||||
* UINT8 nrOfResult - Number of Attached Results
|
||||
* UIN32 *results - Attached Results
|
||||
*
|
||||
* Return: void
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
void testResultFunction (UINT8 requestNr, UINT8 nrOfResults, UINT32 *results);
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Function: slaveRestartfunction
|
||||
*
|
||||
* Function that is called be Slave on the Master to tell about a Restart
|
||||
*
|
||||
* Parameters: UINT8 requestNr - number of the request
|
||||
* UINT8 nrOfResult - Number of Attached Results
|
||||
* UIN32 *results - Attached Results
|
||||
*
|
||||
* Return: void
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
void slaveRestartFunction (UINT8 requestNr, UINT8 nrOfResults, UINT32 *results);
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Function: UINT32ResultFunction
|
||||
*
|
||||
* Function to receive a UINT32 Result from Slave. Result is stored then in
|
||||
* the global variable UINT32 UINT32result
|
||||
*
|
||||
* Parameters: UINT8 requestNr - number of the request
|
||||
* UINT8 nrOfResult - Number of Attached Results
|
||||
* UIN32 *results - Attached Results
|
||||
*
|
||||
* Return: void
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
void UINT32ResultFunction (UINT8 requestNr, UINT8 nrOfResults, UINT32 *results);
|
||||
|
||||
|
||||
void receiveRemoteAttachedFunctions (UINT8 requestNr, UINT8 nrOfResults, UINT32 *results);
|
||||
|
||||
#endif /* __PROTOCOLTEST_H__ */
|
||||
@@ -0,0 +1,284 @@
|
||||
/* ---------------------------------------------------------------------------
|
||||
* taskfunctions.c (c) 2008 Micro-key bv
|
||||
* ---------------------------------------------------------------------------
|
||||
* Micro-key bv
|
||||
* Industrieweg 28, 9804 TG Noordhorn
|
||||
* Postbus 92, 9800 AB Zuidhorn
|
||||
* The Netherlands
|
||||
* Tel: +31 594 503020
|
||||
* Fax: +31 594 505825
|
||||
* Email: support@microkey.nl
|
||||
* Web: www.microkey.nl
|
||||
* ---------------------------------------------------------------------------
|
||||
* Description:
|
||||
* Contains Functions to control the TestLED Tasks
|
||||
* ---------------------------------------------------------------------------
|
||||
* Version(s): 0.1, Apr 09, 2008, MMi
|
||||
* Creation.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* System include files
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#include "lpc23xx.h"
|
||||
#include "types.h"
|
||||
|
||||
/* FreeRTOS includes */
|
||||
#include "FreeRTOS.h"
|
||||
#include "task.h"
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Application include files
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#include "taskfunctions.h"
|
||||
#include "dio.h"
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Local constant and macro definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Global variable definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Local variable definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Local function definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
void taskInit (void)
|
||||
{
|
||||
d_gLED = 0; /* Initialize TaskStatus with 0 */
|
||||
d_ledtestled = 0;
|
||||
d_dioled = 0;
|
||||
d_aioled = 0;
|
||||
d_busled = 0;
|
||||
d_eepromled = 0;
|
||||
d_flashled = 0;
|
||||
d_mmcled = 0;
|
||||
d_logled = 0;
|
||||
d_comled = 0;
|
||||
d_powerled = 0;
|
||||
d_rtcled = 0;
|
||||
}
|
||||
|
||||
void diotasksdelete(void)
|
||||
{
|
||||
if (d_dioled == pdPASS) /* If defined Task exists */
|
||||
{
|
||||
vTaskDelete (dioled); /* Delete Task */
|
||||
dioWrite (0,DIOLED,FALSE); /* Switch off corresponding DIO-LED */
|
||||
d_dioled = 0; /* Set TaskStatus to 0 */
|
||||
}
|
||||
if (d_ledtestled == pdPASS)
|
||||
{
|
||||
vTaskDelete (ledtestled);
|
||||
dioWrite (0,LEDTESTLED,FALSE);
|
||||
d_ledtestled = 0;
|
||||
}
|
||||
if (d_aioled == pdPASS)
|
||||
{
|
||||
vTaskDelete (aioled);
|
||||
dioWrite (0,AIOLED,FALSE);
|
||||
d_aioled = 0;
|
||||
}
|
||||
if (d_busled == pdPASS)
|
||||
{
|
||||
vTaskDelete (busled);
|
||||
dioWrite (0,BUSLED,FALSE);
|
||||
d_busled = 0;
|
||||
}
|
||||
#if (allMemoryUseSameLED == 0)
|
||||
if (d_eepromled == pdPASS)
|
||||
{
|
||||
vTaskDelete (eepromled);
|
||||
dioWrite (0,EEPROMLED,FALSE);
|
||||
d_eepromled = 0;
|
||||
}
|
||||
if (d_flashled == pdPASS)
|
||||
{
|
||||
vTaskDelete (flashled);
|
||||
dioWrite (0,FLASHLED,FALSE);
|
||||
d_flashled = 0;
|
||||
}
|
||||
if (d_logled == pdPASS)
|
||||
{
|
||||
vTaskDelete (logled);
|
||||
dioWrite (0,LOGLED,FALSE);
|
||||
d_logled = 0;
|
||||
}
|
||||
#else
|
||||
if (d_batteryled == pdPASS)
|
||||
{
|
||||
vTaskDelete (batteryled);
|
||||
dioWrite (0,BATTERYLED,FALSE);
|
||||
d_batteryled = 0;
|
||||
}
|
||||
|
||||
if (d_memoryled == pdPASS)
|
||||
{
|
||||
vTaskDelete (memoryled);
|
||||
dioWrite (0,MEMORYLED,FALSE);
|
||||
d_memoryled = 0;
|
||||
}
|
||||
#endif
|
||||
if (d_mmcled == pdPASS)
|
||||
{
|
||||
vTaskDelete (mmcled);
|
||||
dioWrite (0,MMCLED,FALSE);
|
||||
d_mmcled = 0;
|
||||
}
|
||||
if (d_comled == pdPASS)
|
||||
{
|
||||
vTaskDelete (comled);
|
||||
dioWrite (0,COMLED,FALSE);
|
||||
d_comled = 0;
|
||||
}
|
||||
if (d_powerled == pdPASS)
|
||||
{
|
||||
vTaskDelete (powerled);
|
||||
dioWrite (0,POWERLED,FALSE);
|
||||
d_powerled = 0;
|
||||
}
|
||||
if (d_rtcled == pdPASS)
|
||||
{
|
||||
vTaskDelete (rtcled);
|
||||
dioWrite (0,RTCLED,FALSE);
|
||||
d_rtcled = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void diotaskssuspend(void)
|
||||
{
|
||||
if (d_dioled == pdPASS) /* If defined Task exists */
|
||||
{
|
||||
vTaskSuspend (dioled); /* Suspend Task */
|
||||
dioWrite (0,DIOLED,FALSE); /* Switch off corresponding DIO-LED */
|
||||
}
|
||||
if (d_ledtestled == pdPASS)
|
||||
{
|
||||
vTaskSuspend (ledtestled);
|
||||
dioWrite (0,LEDTESTLED,FALSE);
|
||||
}
|
||||
if (d_aioled == pdPASS)
|
||||
{
|
||||
vTaskSuspend (aioled);
|
||||
dioWrite (0,AIOLED,FALSE);
|
||||
}
|
||||
if (d_busled == pdPASS)
|
||||
{
|
||||
vTaskSuspend (busled);
|
||||
dioWrite (0,BUSLED,FALSE);
|
||||
}
|
||||
#if (allMemoryUseSameLED == 0)
|
||||
if (d_eepromled == pdPASS)
|
||||
{
|
||||
vTaskSuspend (eepromled);
|
||||
dioWrite (0,EEPROMLED,FALSE);
|
||||
}
|
||||
if (d_flashled == pdPASS)
|
||||
{
|
||||
vTaskSuspend (flashled);
|
||||
dioWrite (0,FLASHLED,FALSE);
|
||||
}
|
||||
if (d_logled == pdPASS)
|
||||
{
|
||||
vTaskSuspend (logled);
|
||||
dioWrite (0,LOGLED,FALSE);
|
||||
}
|
||||
#else
|
||||
if (d_batteryled == pdPASS)
|
||||
{
|
||||
vTaskSuspend (batteryled);
|
||||
dioWrite (0,BATTERYLED,FALSE);
|
||||
}
|
||||
if (d_memoryled == pdPASS)
|
||||
{
|
||||
vTaskSuspend (memoryled);
|
||||
dioWrite (0,MEMORYLED,FALSE);
|
||||
}
|
||||
#endif
|
||||
if (d_mmcled == pdPASS)
|
||||
{
|
||||
vTaskSuspend (mmcled);
|
||||
dioWrite (0,MMCLED,FALSE);
|
||||
}
|
||||
if (d_comled == pdPASS)
|
||||
{
|
||||
vTaskSuspend (comled);
|
||||
dioWrite (0,COMLED,FALSE);
|
||||
}
|
||||
if (d_powerled == pdPASS)
|
||||
{
|
||||
vTaskSuspend (powerled);
|
||||
dioWrite (0,POWERLED,FALSE);
|
||||
}
|
||||
if (d_rtcled == pdPASS)
|
||||
{
|
||||
vTaskSuspend (rtcled);
|
||||
dioWrite (0,RTCLED,FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
void diotasksresume(void)
|
||||
{
|
||||
if (d_batteryled == pdPASS) /* If defined Task exists */
|
||||
{
|
||||
vTaskResume(batteryled); /* Resume Task */
|
||||
}
|
||||
if (d_dioled == pdPASS)
|
||||
{
|
||||
vTaskResume(dioled);
|
||||
}
|
||||
if (d_ledtestled == pdPASS)
|
||||
{
|
||||
vTaskResume(ledtestled);
|
||||
}
|
||||
if (d_aioled == pdPASS)
|
||||
{
|
||||
vTaskResume(aioled);
|
||||
}
|
||||
if (d_busled == pdPASS)
|
||||
{
|
||||
vTaskResume(busled);
|
||||
}
|
||||
if (d_eepromled == pdPASS)
|
||||
{
|
||||
vTaskResume(eepromled);
|
||||
}
|
||||
if (d_flashled == pdPASS)
|
||||
{
|
||||
vTaskResume(flashled);
|
||||
}
|
||||
if (d_logled == pdPASS)
|
||||
{
|
||||
vTaskResume(logled);
|
||||
}
|
||||
if (d_memoryled == pdPASS)
|
||||
{
|
||||
vTaskResume (memoryled);
|
||||
}
|
||||
if (d_mmcled == pdPASS)
|
||||
{
|
||||
vTaskResume(mmcled);
|
||||
}
|
||||
if (d_comled == pdPASS)
|
||||
{
|
||||
vTaskResume(comled);
|
||||
}
|
||||
if (d_powerled == pdPASS)
|
||||
{
|
||||
vTaskResume(powerled);
|
||||
}
|
||||
if (d_rtcled == pdPASS)
|
||||
{
|
||||
vTaskResume(rtcled);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,177 @@
|
||||
/* ---------------------------------------------------------------------------
|
||||
* taskfunctions.h (c) 2008 Micro-key bv
|
||||
* ---------------------------------------------------------------------------
|
||||
* Micro-key bv
|
||||
* Industrieweg 28, 9804 TG Noordhorn
|
||||
* Postbus 92, 9800 AB Zuidhorn
|
||||
* The Netherlands
|
||||
* Tel: +31 594 503020
|
||||
* Fax: +31 594 505825
|
||||
* Email: support@microkey.nl
|
||||
* Web: www.microkey.nl
|
||||
* ---------------------------------------------------------------------------
|
||||
* Description:
|
||||
* Headerfile for taskfunctions.c
|
||||
* ---------------------------------------------------------------------------
|
||||
* Version(s): 0.1, Apr 09, 2008, MMi
|
||||
* Creation.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef TASKFUNCTIONS_H_
|
||||
#define TASKFUNCTIONS_H_
|
||||
/* ---------------------------------------------------------------------------
|
||||
* System include files.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#include "lpc23xx.h"
|
||||
#include "types.h"
|
||||
|
||||
/* FreeRTOS includes */
|
||||
#include "FreeRTOS.h"
|
||||
#include "task.h"
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Application include files.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Constant and macro definitions.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#define allMemoryUseSameLED 1
|
||||
|
||||
|
||||
/* Allocation of digital Output LEDs to a single Test */
|
||||
/* LED Setting correspond to if all memory Test should share the same LED */
|
||||
#if (allMemoryUseSameLED == 0)
|
||||
#define LEDTESTLED 0
|
||||
#define EEPROMLED 1
|
||||
#define FLASHLED 2
|
||||
#define LOGLED 3
|
||||
#define DIOLED 4
|
||||
#define MMCLED 5
|
||||
#define POWERLED 6
|
||||
#define RTCLED 7
|
||||
#define AIOLED 8
|
||||
#define BUSLED 8
|
||||
#define COMLED 8
|
||||
#else
|
||||
#define BATTERYLED 0
|
||||
#define LEDTESTLED 1
|
||||
#define MEMORYLED 2
|
||||
#define DIOLED 3
|
||||
#define AIOLED 4
|
||||
#define MMCLED 5
|
||||
#define POWERLED 6
|
||||
#define RTCLED 7
|
||||
#define BUSLED 8
|
||||
#define COMLED 8
|
||||
#endif
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Type definitions.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Variable declarations.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* Taskhandler
|
||||
* Last Argument called in xTaskCreate
|
||||
* Needed to identify a Task
|
||||
*/
|
||||
xTaskHandle batteryled;
|
||||
xTaskHandle gLED;
|
||||
xTaskHandle ledtestled;
|
||||
xTaskHandle dioled;
|
||||
xTaskHandle aioled;
|
||||
xTaskHandle busled;
|
||||
xTaskHandle eepromled;
|
||||
xTaskHandle flashled;
|
||||
xTaskHandle logled;
|
||||
xTaskHandle memoryled;
|
||||
xTaskHandle mmcled;
|
||||
xTaskHandle comled;
|
||||
xTaskHandle powerled;
|
||||
xTaskHandle rtcled;
|
||||
xTaskHandle spinWheel;
|
||||
|
||||
/* BaseType
|
||||
* Return of xTaskCreate
|
||||
* Indicates wether a Function was created (=pdPASS) oder not (= 0)
|
||||
*/
|
||||
portBASE_TYPE d_batteryled;
|
||||
portBASE_TYPE d_gLED;
|
||||
portBASE_TYPE d_ledtestled;
|
||||
portBASE_TYPE d_dioled;
|
||||
portBASE_TYPE d_aioled;
|
||||
portBASE_TYPE d_busled;
|
||||
portBASE_TYPE d_eepromled;
|
||||
portBASE_TYPE d_flashled;
|
||||
portBASE_TYPE d_logled;
|
||||
portBASE_TYPE d_memoryled;
|
||||
portBASE_TYPE d_mmcled;
|
||||
portBASE_TYPE d_comled;
|
||||
portBASE_TYPE d_powerled;
|
||||
portBASE_TYPE d_rtcled;
|
||||
portBASE_TYPE d_spinWheel;
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Function declarations.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Function: taskInit
|
||||
*
|
||||
* Function to initialize TaskStatus Variables
|
||||
*
|
||||
* Parameter: void
|
||||
*
|
||||
* Return: void
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
void taskInit (void);
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Function: diotasksdelete
|
||||
*
|
||||
* Function to delete ALL existing Tasks flashing a DIO-LED
|
||||
*
|
||||
* Parameter: void
|
||||
*
|
||||
* Return: void
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
void diotasksdelete(void);
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Function: diotaskssuspend
|
||||
*
|
||||
* Function to suspend ALL existing Tasks flashing a DIO-LED
|
||||
*
|
||||
* Parameter: void
|
||||
*
|
||||
* Return: void
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
void diotaskssuspend (void);
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Function: diotasksresume
|
||||
*
|
||||
* Function to resume ALL existing and suspended Tasks flashing a DIO-LED
|
||||
*
|
||||
* Parameter: void
|
||||
*
|
||||
* Return: void
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
void diotasksresume (void);
|
||||
|
||||
#endif /*TASKFUNCTIONS_H_*/
|
||||
@@ -0,0 +1,347 @@
|
||||
/*
|
||||
FreeRTOS.org V4.6.1 - Copyright (C) 2003-2007 Richard Barry.
|
||||
|
||||
This file is part of the FreeRTOS.org distribution.
|
||||
|
||||
FreeRTOS.org 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.
|
||||
|
||||
FreeRTOS.org 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 FreeRTOS.org; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
A special exception to the GPL can be applied should you wish to distribute
|
||||
a combined work that includes FreeRTOS.org, without being obliged to provide
|
||||
the source code for any proprietary components. See the licensing section
|
||||
of http://www.FreeRTOS.org for full details of how and when the exception
|
||||
can be applied.
|
||||
|
||||
***************************************************************************
|
||||
See http://www.FreeRTOS.org for documentation, latest information, license
|
||||
and contact details. Please ensure to read the configuration and relevant
|
||||
port sections of the online documentation.
|
||||
|
||||
Also see http://www.SafeRTOS.com a version that has been certified for use
|
||||
in safety critical systems, plus commercial licensing, development and
|
||||
support options.
|
||||
***************************************************************************
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Description: MAIN File to Application Project
|
||||
* ---------------------------------------------------------------------------
|
||||
* Version(s): 0.1, Jul 07, 2008, MMi
|
||||
*
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* System include files
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#include "types.h"
|
||||
#include "sys_config.h"
|
||||
|
||||
/* Scheduler includes. */
|
||||
#include "FreeRTOS.h"
|
||||
#include "task.h"
|
||||
#include "queue.h"
|
||||
#include "semphr.h"
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Application include files
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
/* Drivers */
|
||||
#include "adc.h"
|
||||
#include "bus.h"
|
||||
#include "BusProtocol.h"
|
||||
#include "calibrateaio.h"
|
||||
#include "can.h"
|
||||
#include "dac.h"
|
||||
#include "dio.h"
|
||||
#include "eeprom.h"
|
||||
#include "ElecStatusCache.h"
|
||||
#include "ethernet.h"
|
||||
#include "irq.h"
|
||||
#include "leds.h"
|
||||
#include "menuargs.h"
|
||||
#include "mmc.h"
|
||||
#include "power.h"
|
||||
#include "relay.h"
|
||||
#include "rtc.h"
|
||||
#include "serial.h"
|
||||
#include "SerOut.h"
|
||||
#include "ssp0.h"
|
||||
#include "ssp1.h"
|
||||
|
||||
/* testfiles */
|
||||
#include "topoftest.h"
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Local constant and macro definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
/* Demo application definitions. */
|
||||
#define mainQUEUE_SIZE ( 3 )
|
||||
#define mainCHECK_DELAY (( portTickType ) 5000 / portTICK_RATE_MS )
|
||||
#define mainBASIC_WEB_STACK_SIZE ( configMINIMAL_STACK_SIZE * 6 )
|
||||
|
||||
/* Task priorities. */
|
||||
#define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 2 )
|
||||
#define mainCHECK_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 )
|
||||
#define mainBLOCK_Q_PRIORITY ( tskIDLE_PRIORITY + 2 )
|
||||
#define mainFLASH_PRIORITY ( tskIDLE_PRIORITY + 2 )
|
||||
#define mainCREATOR_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 )
|
||||
#define mainGEN_QUEUE_TASK_PRIORITY ( tskIDLE_PRIORITY )
|
||||
|
||||
/* Constants to setup the PLL. */
|
||||
#define mainPLL_ENABLE (( unsigned portLONG ) 0x0001 )
|
||||
#define mainPLL_CONNECT ((( unsigned portLONG ) 0x0002 ) | mainPLL_ENABLE )
|
||||
#define mainPLL_FEED_BYTE1 (( unsigned portLONG ) 0xaa )
|
||||
#define mainPLL_FEED_BYTE2 (( unsigned portLONG ) 0x55 )
|
||||
#define mainPLL_LOCK (( unsigned portLONG ) 0x4000000 )
|
||||
#define mainPLL_CONNECTED (( unsigned portLONG ) 0x2000000 )
|
||||
#define mainOSC_ENABLE (( unsigned portLONG ) 0x20 )
|
||||
#define mainOSC_STAT (( unsigned portLONG ) 0x40 )
|
||||
#define mainOSC_SELECT (( unsigned portLONG ) 0x01 )
|
||||
|
||||
/* Constants to setup the MAM. */
|
||||
#define mainMAM_TIM_3 (( unsigned portCHAR ) 0x03 )
|
||||
#define mainMAM_MODE_FULL (( unsigned portCHAR ) 0x02 )
|
||||
|
||||
#define SWI_RAM_ADDR 0x40000008
|
||||
#define SWI_RAM_FUNC_ADDR 0x40000028
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Global variable definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Local variable definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
BOOLEAN StopFlashing= FALSE;
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Local function definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
extern void vPortYieldProcessor (void);
|
||||
|
||||
/* Configure Hardware */
|
||||
static inline void prvSetVectors (void);
|
||||
static void prvSetupHardware (void);
|
||||
static void prvSetupDrivers (void);
|
||||
|
||||
/* Main Task */
|
||||
static void ExecuteTestsTask (void *pvParameters);
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
extern void *pvPortMalloc(size_t xWantedSize);
|
||||
|
||||
int main(void)
|
||||
{
|
||||
static portBASE_TYPE taskCreationResult = -20;
|
||||
|
||||
prvSetVectors();
|
||||
prvSetupHardware();
|
||||
|
||||
|
||||
/* Start the tasks defined within this file/specific to this demo. */
|
||||
taskCreationResult = xTaskCreate(ExecuteTestsTask,
|
||||
( signed portCHAR * ) "Tests", configMINIMAL_STACK_SIZE + 400,
|
||||
NULL, mainCHECK_TASK_PRIORITY - 1, NULL);
|
||||
|
||||
|
||||
/* Start the scheduler. */
|
||||
vTaskStartScheduler();
|
||||
|
||||
/* Will only get here if there was insufficient memory to create
|
||||
* the idle task.
|
||||
*/
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
void vApplicationTickHook(void)
|
||||
{
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void ExecuteTestsTask(void *pvParameters)
|
||||
{
|
||||
prvSetupDrivers();
|
||||
|
||||
// \MARK NEW PINSETTINGS FOR TESTER (2)
|
||||
#if (PINSET_TESTER == 2)
|
||||
ledSet(LED1, 1);
|
||||
ledSet(LED0, 1);
|
||||
#endif
|
||||
|
||||
mainInit();
|
||||
|
||||
/* IDLE MODE */
|
||||
for (;;)
|
||||
{
|
||||
// \MARK NEW PINSETTINGS FOR TESTER (2)
|
||||
#if (PINSET_TESTER == 2)
|
||||
vTaskDelay (1000);
|
||||
ledSet (LED0, FALSE);
|
||||
vTaskDelay (1000);
|
||||
ledSet (LED1, TRUE);
|
||||
#else
|
||||
vTaskDelay (100);
|
||||
#endif
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
inline void prvSetVectors()
|
||||
{
|
||||
unsigned int *ptr;
|
||||
// Set vectors of interrupt and software interupt
|
||||
|
||||
// Set interrupt vectors
|
||||
ptr = (unsigned int *)SWI_RAM_ADDR;
|
||||
*ptr = 0xE59FF018; // This is a ldr pc, [pc,#24] instruction
|
||||
|
||||
// Put SWI, IRQ vectors in RAM
|
||||
ptr = (unsigned int *)SWI_RAM_FUNC_ADDR;
|
||||
*ptr = (unsigned int)&vPortYieldProcessor; // Reserved for FreeRTOS
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void prvSetupHardware(void)
|
||||
{
|
||||
//UINT32 i = 0;
|
||||
//volatile UINT32 *vect_addr, *vect_prio;
|
||||
|
||||
#ifdef RUN_FROM_RAM
|
||||
/* Remap the interrupt vectors to RAM if we are are running from RAM. */
|
||||
SCB_MEMMAP = 2;
|
||||
#endif
|
||||
|
||||
/* Disable the PLL. */
|
||||
PLLCON = 0;
|
||||
PLLFEED = mainPLL_FEED_BYTE1;
|
||||
PLLFEED = mainPLL_FEED_BYTE2;
|
||||
/* Configure clock source. */
|
||||
SCS |= mainOSC_ENABLE;
|
||||
while ( !( SCS & mainOSC_STAT ))
|
||||
;
|
||||
CLKSRCSEL = mainOSC_SELECT;
|
||||
|
||||
/* Setup the PLL to multiply the XTAL input by 4. */
|
||||
PLLCFG = ( PLL_MUL | PLL_DIV );
|
||||
PLLFEED = mainPLL_FEED_BYTE1;
|
||||
PLLFEED = mainPLL_FEED_BYTE2;
|
||||
|
||||
/* Turn on and wait for the PLL to lock... */
|
||||
PLLCON = mainPLL_ENABLE;
|
||||
PLLFEED = mainPLL_FEED_BYTE1;
|
||||
PLLFEED = mainPLL_FEED_BYTE2;
|
||||
CCLKCFG = CCLK_DIV;
|
||||
while ( !( PLLSTAT & mainPLL_LOCK ))
|
||||
;
|
||||
|
||||
/* Connecting the clock. */
|
||||
PLLCON = mainPLL_CONNECT;
|
||||
PLLFEED = mainPLL_FEED_BYTE1;
|
||||
PLLFEED = mainPLL_FEED_BYTE2;
|
||||
while ( !( PLLSTAT & mainPLL_CONNECTED ))
|
||||
;
|
||||
|
||||
/* Setup and turn on the MAM. Three cycle access is used due to the fast
|
||||
PLL used. It is possible faster overall performance could be obtained by
|
||||
tuning the MAM and PLL settings. */
|
||||
MAMCR = 0;
|
||||
MAMTIM = mainMAM_TIM_3;
|
||||
MAMCR = mainMAM_MODE_FULL;
|
||||
|
||||
// Enable power on ethernet chip for using its RAM
|
||||
PCONP |= (1 << 30);
|
||||
|
||||
init_VIC();
|
||||
}
|
||||
|
||||
void prvSetupDrivers(void)
|
||||
{
|
||||
|
||||
#if (PINSET_TESTER == 0)
|
||||
/* Load Inits necessary for the Olimex DemoBoard */
|
||||
ssp0Init();
|
||||
ssp0Enable();
|
||||
ssp1Init();
|
||||
ssp1Enable();
|
||||
rtcInit();
|
||||
MmcInit();
|
||||
CANInit(CANBitrate125k_12MHz);
|
||||
CANSetFilter (0x00000101);
|
||||
// ethInit();
|
||||
|
||||
#endif
|
||||
#if (PINSET_TESTER == 1)
|
||||
/* Load Inits necessary and available on IO Controller --> REV_C <-- */
|
||||
bpecInit();
|
||||
dioInit();
|
||||
ledInit();
|
||||
ssp0Init();
|
||||
ssp0Enable();
|
||||
ssp1Init();
|
||||
ssp1Enable();
|
||||
eepromInit();
|
||||
adcInit();
|
||||
dacInit();
|
||||
powerInit();
|
||||
rtcInit();
|
||||
MmcInit();
|
||||
calibrationInit();
|
||||
#endif
|
||||
|
||||
#if (PINSET_TESTER == 2)
|
||||
/* Load Inits necessary and available on QUA_2475_TESTER */
|
||||
bpecInit();
|
||||
dioInit();
|
||||
rlyInit();
|
||||
ledInit();
|
||||
ssp0Init();
|
||||
ssp0Enable();
|
||||
ssp1Init();
|
||||
ssp1Enable();
|
||||
eepromInit();
|
||||
adcInit();
|
||||
dacInit();
|
||||
powerInit();
|
||||
rtcInit();
|
||||
MmcInit();
|
||||
calibrationInit();
|
||||
CANInit(CANBitrate125k_12MHz);
|
||||
// ethInit();
|
||||
|
||||
#endif
|
||||
|
||||
menuInit(); /* Init the Menu in every Case */
|
||||
|
||||
// Open both COM-ports
|
||||
serInit(COM1, B115200, UART_8N1, UART_FIFO_8);
|
||||
serInit(COM2, B115200, UART_8N1, UART_FIFO_8);
|
||||
|
||||
#if ((PINSET_TESTER == 1) || (PINSET_TESTER == 2))
|
||||
/* BusInit only necessary on IO_CTRL or TESTER, DemoBoard got no Busses */
|
||||
busInit(BUS1);
|
||||
busInit(BUS2);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -0,0 +1,422 @@
|
||||
/* ---------------------------------------------------------------------------
|
||||
* menu.c (c) 2008 Micro-key bv
|
||||
* ---------------------------------------------------------------------------
|
||||
* Micro-key bv
|
||||
* Industrieweg 28, 9804 TG Noordhorn
|
||||
* Postbus 92, 9800 AB Zuidhorn
|
||||
* The Netherlands
|
||||
* Tel: +31 594 503020
|
||||
* Fax: +31 594 505825
|
||||
* Email: support@microkey.nl
|
||||
* Web: www.microkey.nl
|
||||
* ---------------------------------------------------------------------------
|
||||
* Description:
|
||||
* ---------------------------------------------------------------------------
|
||||
* Version(s): 0.1, Apr 01, 2008, MMi
|
||||
* Creation.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* System include files
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
/* Compiler includes */
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
/* Hardware includes */
|
||||
#include "lpc23xx.h"
|
||||
#include "types.h"
|
||||
|
||||
/* FreeRTOS includes */
|
||||
#include "FreeRTOS.h"
|
||||
#include "Task.h"
|
||||
#include "semphr.h"
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Application include files
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#include "topoftest.h"
|
||||
#include "menu.h"
|
||||
#include "menufunctions.h"
|
||||
#include "menuargs.h"
|
||||
#include "dac.h"
|
||||
#include "adc.h"
|
||||
#include "dio.h"
|
||||
#include "logging.h"
|
||||
#include "SerOut.h"
|
||||
|
||||
#include "ledfunctions.h"
|
||||
#include "taskfunctions.h"
|
||||
#include "BusProtocol.h"
|
||||
|
||||
#include "remote_tests.h"
|
||||
#include "remote_misc.h"
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Local constant and macro definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Global variable definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
extern const char *command_table[NUMBER_OF_COMMANDS];
|
||||
extern const fpointer command_pointer[NUMBER_OF_COMMANDS];
|
||||
extern UINT8 cmd_table_offset[ALPHABET_DIGITS];
|
||||
extern const char * menuHelptextArray [NUMBER_OF_COMMANDS];
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Local variable definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
UINT32 arg1 = 0;
|
||||
UINT32 arg2 = 0;
|
||||
UINT32 arg3 = 0;
|
||||
|
||||
BOOLEAN quit = FALSE;
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Local function definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
void TABfunction (char * command);
|
||||
|
||||
|
||||
|
||||
void CallMenu(void)
|
||||
{
|
||||
/* local Variable Declaration */
|
||||
UINT32 bytesreceived = 0;
|
||||
static UINT8 receiveString[60];
|
||||
static UINT8 backupString[60];
|
||||
UINT8 buffer;
|
||||
BOOLEAN receive;
|
||||
|
||||
char separator[] = " ";
|
||||
char *commandt;
|
||||
char *pcmd;
|
||||
char *arg1t;
|
||||
char *arg2t;
|
||||
char *arg3t;
|
||||
UINT8 command[15];
|
||||
UINT8 cmd_len;
|
||||
|
||||
UINT8 loopcnt;
|
||||
BOOLEAN callhelp = FALSE;
|
||||
|
||||
|
||||
do /* do-while loop for Main Menu */
|
||||
{
|
||||
/* Display PROMPT to Console */
|
||||
serWrite(MenuPort, strlen("\n\r\n\rCMD> "), (UINT8 *)"\n\r\n\rCMD> ");
|
||||
|
||||
/* Reset String input Variables */
|
||||
buffer = 0;
|
||||
bytesreceived = 0;
|
||||
|
||||
commandt = 0;
|
||||
cmd_len = 0;
|
||||
arg1 = 0;
|
||||
arg2 = 0;
|
||||
arg3 = 0;
|
||||
|
||||
do /* do-while loop for String input */
|
||||
{
|
||||
if ((receive = serGet(MenuPort, &buffer) == TRUE))
|
||||
{
|
||||
if (buffer == '\t')
|
||||
{
|
||||
receiveString[bytesreceived] = '\0';
|
||||
TABfunction((char *) receiveString);
|
||||
}
|
||||
|
||||
/* Detection of Escape characters. VT100 Commands are 4 Bytes,
|
||||
* so software takes out three more bytes from the buffer.
|
||||
*/
|
||||
else if (buffer == 27)
|
||||
{
|
||||
serGet(MenuPort, &buffer);
|
||||
serGet(MenuPort, &buffer);
|
||||
// serGet(MenuPort, &buffer);
|
||||
|
||||
/* Detection for LEFT and RIGHT Arrow keys.
|
||||
* Future implementation may be done for advanced shell
|
||||
*/
|
||||
if (buffer =='A')
|
||||
{
|
||||
serWrite(MenuPort, strlen("\x1B[1B"), (UINT8 *)"\x1B[1B");
|
||||
/* UP arrow Key detected */
|
||||
if (bytesreceived == 0)
|
||||
{
|
||||
/* If Cursor is on the beginning position */
|
||||
strcpy ((char *)receiveString, (char *)backupString);
|
||||
bytesreceived = strlen((char *)backupString);
|
||||
serWrite(MenuPort, bytesreceived, backupString);
|
||||
}
|
||||
}
|
||||
// else if (buffer == 'B')
|
||||
// {
|
||||
// /* DOWN arrow Key detected */
|
||||
// }
|
||||
//
|
||||
// else if (buffer == 'C')
|
||||
// {
|
||||
// /* RIGHT arrow Key detected */
|
||||
// bytesreceived++;
|
||||
// }
|
||||
// else if (buffer == 'D')
|
||||
// {
|
||||
// /* LEFT arrow Key detected */
|
||||
// if (bytesreceived > 0)
|
||||
// {
|
||||
// /* If cursor is not on first position */
|
||||
// bytesreceived--;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// /* Move Cursor one position to right (VT100) */
|
||||
// serWrite(SerOutPort, sizeof("\x1B[1C"), "\x1B[1C");
|
||||
// }
|
||||
// }
|
||||
else
|
||||
{
|
||||
/* Any other Control Key detected. Read and ignore */
|
||||
serGet(MenuPort, &buffer);
|
||||
}
|
||||
}
|
||||
|
||||
else if (buffer == 127)
|
||||
{
|
||||
/* If pressed key was BackSpace (NOTE KEYCODE, NOT 0x08)*/
|
||||
if (bytesreceived > 0)
|
||||
{
|
||||
/* Cursor is not first position, step back in array */
|
||||
receiveString[bytesreceived--] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Cursor ist on first position, do not step back */
|
||||
/* Move Cursor one position to right (VT100) */
|
||||
serWrite(SerOutPort, strlen("\x1B[1C"), (UINT8 *)"\x1B[1C");
|
||||
}
|
||||
}
|
||||
else if (buffer == 13)
|
||||
{
|
||||
receiveString[bytesreceived] = '\0';
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Write Byte in String and increase String index */
|
||||
receiveString[bytesreceived] = buffer;
|
||||
bytesreceived++;
|
||||
}
|
||||
vTaskDelay(10); /* Share Calculation Time */
|
||||
}
|
||||
}while (buffer != 13); /*Read input until ENTER-Key */
|
||||
|
||||
writeLog(LogInput, MenuPort, menuMessage, (char *)receiveString);
|
||||
|
||||
/* Copy actual received command string to a backup string */
|
||||
strcpy ((char *)backupString, (char *)receiveString);
|
||||
sendString (MenuPort, GotoNewLine, menuMessage,
|
||||
"receiveString: ", (char *)receiveString, Dummy);
|
||||
sendString (MenuPort, GotoNewLine, menuMessage,
|
||||
"backupString: ", (char *)backupString, Dummy);
|
||||
|
||||
/* Split command and arguments with strtok() function, where a
|
||||
* SPACE letter is used as devider.
|
||||
*/
|
||||
commandt = strtok ((char *)receiveString, (char *)separator);
|
||||
arg1t = strtok (NULL, (char *)separator);
|
||||
arg2t = strtok (NULL, (char *)separator);
|
||||
arg3t = strtok (NULL, (char *)separator);
|
||||
|
||||
if ((pcmd = strstr ((char *)commandt, "_help")) != NULL)
|
||||
{
|
||||
callhelp = TRUE;
|
||||
sendString (MenuPort, GotoNewLine, menuMessage,
|
||||
"Help Stat recognised ", Dummy, Dummy);
|
||||
|
||||
/* Copy command to an own string */
|
||||
cmd_len = strlen (commandt);
|
||||
strncpy ((char *)command, commandt, (cmd_len - 5));
|
||||
command[cmd_len - 5] = '\0';
|
||||
}
|
||||
else
|
||||
{
|
||||
callhelp = FALSE;
|
||||
|
||||
/* Copy command to an own string */
|
||||
strcpy ((char *)command, commandt);
|
||||
|
||||
/* Detect if arguments are given dezimal or hexadezimal. Detection
|
||||
* looks for a leading "0x" on the string. Afterwards, the given
|
||||
* Value is transformed to an integer value with sscanf. No Error
|
||||
* checking. The value is transformed step by step until the string-
|
||||
* end token or the first not-hex symbol.
|
||||
*/
|
||||
if ((arg1t[0] == 48) && (arg1t[1] == 120))
|
||||
{
|
||||
/* First Argument is given in Hex, transform value */
|
||||
sscanf((char *)(arg1t), "%x", &arg1);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* First argument is given dezimal, cast to integer */
|
||||
arg1 = (UINT32) atoi((char *) (arg1t));
|
||||
}
|
||||
|
||||
if ((arg2t[0] == 48) && (arg2t[1] == 120))
|
||||
{
|
||||
/* Second Argument is given in Hex, transform value */
|
||||
sscanf((char *)(arg2t), "%x", &arg2);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Second argument is given dezimal, cast to integer */
|
||||
arg2 = (UINT32) atoi((char *) (arg2t));
|
||||
}
|
||||
|
||||
if ((arg3t[0] == 48) && (arg3t[1] == 120))
|
||||
{
|
||||
/* Third Argument is given in Hex, transform value */
|
||||
sscanf((char *)(arg3t), "%x", &arg3);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Third argument is given dezimal, cast to integer */
|
||||
arg3 = (UINT32) atoi((char *) (arg3t));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
sendString (MenuPort, GotoNewLine, menuMessage,
|
||||
"commandt: ", (char *)commandt, Dummy);
|
||||
sendString (MenuPort, FALSE, menuMessage,
|
||||
"\tcommand: ", (char *)command, Dummy);
|
||||
sendString (MenuPort, GotoNewLine, menuMessage,
|
||||
"arg1t: ", (char *)arg1t, Dummy);
|
||||
sendString (MenuPort, FALSE, menuMessage,
|
||||
"\targ1: ", ItoDStr(arg1), Dummy);
|
||||
sendString (MenuPort, GotoNewLine, menuMessage,
|
||||
"arg2t: ", (char *)arg2t, Dummy);
|
||||
sendString (MenuPort, FALSE, menuMessage,
|
||||
"\targ2: ", ItoDStr(arg2), Dummy);
|
||||
sendString (MenuPort, GotoNewLine, menuMessage,
|
||||
"arg3t: ", (char *)arg3t, Dummy);
|
||||
sendString (MenuPort, FALSE, menuMessage,
|
||||
"\targ3: ", ItoDStr(arg3), Dummy);
|
||||
|
||||
|
||||
/* Advanced Search algorithm for commands */
|
||||
/* Menu structure is based on 2 tables for the commands and one more
|
||||
* as offset.
|
||||
* The given command is first checked on a valid first letter. If
|
||||
* valid, this letter is compared with the offset table. If an offset
|
||||
* is defines for the first letter, at least commands with this first
|
||||
* letter exist. Do a string compare starting at the address in the
|
||||
* command array given by the offset for the first letter. This
|
||||
* prevents of scanning all commands beginning with a different letter
|
||||
*/
|
||||
|
||||
if ((command[0] >= 97) && (command[0] <= 122))
|
||||
{
|
||||
/* First sign of command is within specified Range */
|
||||
if (cmd_table_offset[(command[0] - 97)] != 0xFF)
|
||||
{
|
||||
/* If Offset for specified letter is available */
|
||||
for (loopcnt = (cmd_table_offset[(command[0] - 97)]);
|
||||
loopcnt < NUMBER_OF_COMMANDS;
|
||||
loopcnt++)
|
||||
{
|
||||
/* Try to find the typed in command starting on the
|
||||
* offset position given with the first letter.
|
||||
*/
|
||||
if (strcmp ((char *)command, command_table[loopcnt]) == 0)
|
||||
{
|
||||
/* Found a valid command!
|
||||
* Use the found array-index to grip the corresponding
|
||||
* function pointer from pointer-array
|
||||
*/
|
||||
if (callhelp == FALSE)
|
||||
{
|
||||
(*command_pointer[loopcnt])();
|
||||
}
|
||||
else
|
||||
{
|
||||
sendString (MenuPort, TRUE, importantMessage,
|
||||
(char *) menuHelptextArray[loopcnt], Dummy, Dummy);
|
||||
// debugPrint((char *)menuHelptextArray[loopcnt]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (loopcnt == (NUMBER_OF_COMMANDS - 1))
|
||||
{
|
||||
/* No valid command was found. give Error Emssage */
|
||||
sendString (MenuPort, TRUE, importantMessage,
|
||||
(char *) command," - No such command!", Dummy);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* No Offset available for the specified letter */
|
||||
sendString (MenuPort, TRUE, importantMessage,
|
||||
(char *) command," - No such command!", Dummy);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* First letter is out of the specified Range */
|
||||
sendString (MenuPort, TRUE, importantMessage,
|
||||
(char *) command," - No such command!", Dummy);
|
||||
}
|
||||
|
||||
|
||||
receiveString[0] = '\0';
|
||||
|
||||
vTaskDelay(100);
|
||||
} while (quit == FALSE);
|
||||
}
|
||||
|
||||
|
||||
void TABfunction (char * command)
|
||||
{
|
||||
UINT32 loopcnt;
|
||||
UINT32 commandlength;
|
||||
|
||||
commandlength = strlen (command);
|
||||
serWrite (MenuPort, strlen ("\n\r\t\t"), (UINT8 *)"\n\r\t\t");
|
||||
|
||||
if ((command[0] >= 97) && (command[0] <= 122))
|
||||
{
|
||||
/* First sign of command is within specified Range */
|
||||
if (cmd_table_offset[(command[0] - 97)] != 0xFF)
|
||||
{
|
||||
/* If Offset for specified letter is available */
|
||||
for (loopcnt = (cmd_table_offset[(command[0] - 97)]);
|
||||
loopcnt < NUMBER_OF_COMMANDS;
|
||||
loopcnt++)
|
||||
{
|
||||
if (strncmp ((char *)command, command_table[loopcnt], commandlength) == 0)
|
||||
{
|
||||
sendString (MenuPort, FALSE, importantMessage,
|
||||
" ", (char *)command_table[loopcnt], Dummy);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/* Display PROMPT to Console */
|
||||
serWrite(MenuPort, strlen("\n\r\n\rCMD> "), (UINT8 *)"\n\r\n\rCMD> ");
|
||||
serWrite (MenuPort, strlen (command), (UINT8 *)command);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
/* ---------------------------------------------------------------------------
|
||||
* testmenu.h (c) 2008 Micro-key bv
|
||||
* ---------------------------------------------------------------------------
|
||||
* Micro-key bv
|
||||
* Industrieweg 28, 9804 TG Noordhorn
|
||||
* Postbus 92, 9800 AB Zuidhorn
|
||||
* The Netherlands
|
||||
* Tel: +31 594 503020
|
||||
* Fax: +31 594 505825
|
||||
* Email: support@microkey.nl
|
||||
* Web: www.microkey.nl
|
||||
* ---------------------------------------------------------------------------
|
||||
* Description:
|
||||
* Headfile for the CMD Prompt File testmenu.c
|
||||
* ---------------------------------------------------------------------------
|
||||
* Version(s): 0.1, Apr 01, 2008, MMi
|
||||
* Creation.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef TESTMENU_H_
|
||||
#define TESTMENU_H_
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* System include files.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#include "lpc23xx.h"
|
||||
#include "types.h"
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Application include files.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Constant and macro definitions.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Type definitions.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Variable declarations.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Function declarations.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Function: CallMenu
|
||||
*
|
||||
* Function to display a simplyfied PROMPT on COM-Port.
|
||||
*
|
||||
* Parameter: void
|
||||
*
|
||||
* Return: void
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
void CallMenu(void);
|
||||
|
||||
|
||||
#endif /*TESTMENU_H_*/
|
||||
@@ -0,0 +1,383 @@
|
||||
/* ---------------------------------------------------------------------------
|
||||
* menuargs.c (c) 2008 Micro-key bv
|
||||
* ---------------------------------------------------------------------------
|
||||
* Micro-key bv
|
||||
* Industrieweg 28, 9804 TG Noordhorn
|
||||
* Postbus 92, 9800 AB Zuidhorn
|
||||
* The Netherlands
|
||||
* Tel: +31 594 503020
|
||||
* Fax: +31 594 505825
|
||||
* Email: support@microkey.nl
|
||||
* Web: www.microkey.nl
|
||||
* ---------------------------------------------------------------------------
|
||||
* Description:
|
||||
* ---------------------------------------------------------------------------
|
||||
* Version(s): 0.1, Nov 13, 2008, MMi
|
||||
* Creation.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* System include files
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
/* Compiler includes */
|
||||
#include <string.h>
|
||||
|
||||
#include "LPC23xx.h"
|
||||
#include "types.h"
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Application include files
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#include "menuargs.h"
|
||||
#include "menufunctions.h"
|
||||
|
||||
#include "SerOut.h"
|
||||
|
||||
#include "can.h"
|
||||
|
||||
#include "remote_tests.h"
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Local constant and macro definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#define ASCII_START 97
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Global variable definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Local variable definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* Make Sure that at least the first letter of this is in alphabetical order*/
|
||||
const char *command_table[NUMBER_OF_COMMANDS] =
|
||||
{
|
||||
"aio",
|
||||
"battery",
|
||||
"bus",
|
||||
"canread",
|
||||
"cantest",
|
||||
"canwrite",
|
||||
"ccin",
|
||||
"ccout",
|
||||
"cdel",
|
||||
"cload",
|
||||
"confin",
|
||||
"confout",
|
||||
"cslave",
|
||||
"curout",
|
||||
"curin",
|
||||
"cvin",
|
||||
"cvout",
|
||||
"digiin",
|
||||
"digiout",
|
||||
"dio",
|
||||
"eeprom",
|
||||
"fattest",
|
||||
"help",
|
||||
"initSD",
|
||||
"initTest",
|
||||
"ledclean",
|
||||
"ledtest",
|
||||
"listlocal",
|
||||
// "listremoteattach",
|
||||
"logenable",
|
||||
"logmount",
|
||||
"logstart",
|
||||
"logstop",
|
||||
"ls",
|
||||
"menudebug",
|
||||
"mmc",
|
||||
"power",
|
||||
"quit",
|
||||
"readrtc",
|
||||
"remotecall",
|
||||
"rtc",
|
||||
"run",
|
||||
"stat_cal",
|
||||
"stat_def",
|
||||
"stat_kill",
|
||||
"stat_show",
|
||||
"stat_showall",
|
||||
"setmux",
|
||||
"setrtc",
|
||||
"tasksdelete",
|
||||
"volin",
|
||||
"volout"
|
||||
};
|
||||
|
||||
/* Make Sure that at least the first letter of this is in alphabetical order*/
|
||||
const fpointer command_pointer[NUMBER_OF_COMMANDS] =
|
||||
{
|
||||
m_aio,
|
||||
m_battery,
|
||||
m_bus,
|
||||
m_canread,
|
||||
m_cantest,
|
||||
m_canwrite,
|
||||
m_ccin,
|
||||
m_ccout,
|
||||
m_cdel,
|
||||
m_cload,
|
||||
m_confin,
|
||||
m_confout,
|
||||
m_cslave,
|
||||
m_curout,
|
||||
m_curin,
|
||||
m_cvin,
|
||||
m_cvout,
|
||||
m_digiin,
|
||||
m_digiout,
|
||||
m_dio,
|
||||
m_eeprom,
|
||||
m_fattest,
|
||||
m_help,
|
||||
m_initSD,
|
||||
r_TestInit,
|
||||
m_clean,
|
||||
m_ledtest,
|
||||
m_listLocalattachments,
|
||||
// m_listremoteattachments,
|
||||
m_logEnable,
|
||||
m_sdMount,
|
||||
m_logStart,
|
||||
m_logStop,
|
||||
m_loglist,
|
||||
m_menuDebug,
|
||||
m_mmc,
|
||||
m_power,
|
||||
m_quit,
|
||||
m_readRTC,
|
||||
m_callRemoteFunction,
|
||||
m_rtc,
|
||||
m_run,
|
||||
m_c_cal,
|
||||
m_c_def,
|
||||
m_c_kill,
|
||||
m_c_stat,
|
||||
m_c_show,
|
||||
m_switchMux,
|
||||
m_setRTC,
|
||||
m_tasksdelete,
|
||||
m_volin,
|
||||
m_volout,
|
||||
};
|
||||
|
||||
/* Array to store the offsets to the first letters of commands */
|
||||
UINT8 cmd_table_offset[ALPHABET_DIGITS];
|
||||
|
||||
const char * menuHelptextArray [NUMBER_OF_COMMANDS] =
|
||||
{
|
||||
"\n\r\n\r\taio arg1 arg2\n\r\ttests the analogue in- and outputs"
|
||||
"\n\r\n\r\t\targ1: device number. 0 sets up a self test"
|
||||
"\n\r\t\targ2: test type (0: MB, 1: EB) (Only on remote test)",
|
||||
|
||||
"\n\r\n\r\tbattery arg1\n\r\ttests the battery supply of a remote device"
|
||||
"\n\r\n\r\t\targ1: device number. 0 is self device",
|
||||
|
||||
"\n\r\n\r\tbus\n\r\ttests the local bus connections with transmit and receive strings",
|
||||
|
||||
"\n\r\n\r\tcanread\n\r\tPrints out the actual frame received on CAN",
|
||||
|
||||
"\n\r\n\r\tcantest\n\r\tTests the CAN interface with a Self Test",
|
||||
|
||||
"\n\r\n\r\tcanwrite arg1 arg2 arg3\n\r\twrites a message in a CAN frame"
|
||||
"\n\r\n\r\t\targ1 - Bits 0-10: Identifier, 13-15: Interface Number, 16-19: Data Length"
|
||||
"\n\r\t\targ2 - first 4 Bytes of Message"
|
||||
"\n\r\t\targ3 - last 4 Bytes of Message",
|
||||
|
||||
"\n\r\n\r\tccin\n\r\tcalibrate the local analogue current inputs"
|
||||
"\n\r\tPut calibration Value (e.g.20 mA) on each line separately when asked for",
|
||||
|
||||
"\n\r\n\r\tccout\n\r\tcalibrate the local analogue current outputs"
|
||||
"\n\r\tOnly useful with already calibrated analogue current inputs"
|
||||
"\n\r\tConnect outputs 0-5 to inputs 0-5. Software works automated",
|
||||
|
||||
"\n\r\n\r\tcdel arg1 arg2\n\r\tDeletes and resets the calibration values in eeprom"
|
||||
"\n\r\n\r\t\targ1: number of target device"
|
||||
"\n\r\t\targ2=0-3: kind of values to reset - 0=VI, 1=VO, 2=CI, 3=CO",
|
||||
|
||||
"\n\r\n\r\tcload arg1 arg2\n\r\treloads calibration values from EEPROM to system"
|
||||
"\n\r\n\r\t\targ1: number of target device"
|
||||
"\n\r\t\targ2=0-3: kind of values to reset - 0=VI, 1=VO, 2=CI, 3=CO",
|
||||
|
||||
"\n\r\n\r\tconfin arg1 arg2\n\r\tConfigures an analogue input on local device"
|
||||
"\n\r\n\r\t\targ1=0-7, 9: chose channel 0-7 or chose all channels with 9"
|
||||
"\n\r\t\targ2=0-1: 0: Sets mode to Voltage, 1: Sets mode to Current",
|
||||
|
||||
"\n\r\n\r\tconfout arg1 arg2\n\r\tConfigures an analogue input on local device"
|
||||
"\n\r\n\r\t\targ1=0-5, 9: chose channel 0-7 or chose all channels with 9"
|
||||
"\n\r\t\targ2=0-1: 0: Sets mode to Voltage, 1: Sets mode to Current",
|
||||
|
||||
"\n\r\n\r\tcslave\n\r\tcalibrates the slave with number 2",
|
||||
|
||||
"\n\r\n\r\tcurout arg1 arg2 arg3\n\r\tDrives an analogue Output with current value"
|
||||
"\n\r\n\r\t\targ1: device number"
|
||||
"\n\r\t\targ2=0-5: channel number"
|
||||
"\n\r\t\targ3=0-20000: value",
|
||||
|
||||
"\n\r\n\r\tcurin arg1 arg2\n\r\t Reads the actual current value from a analogue input"
|
||||
"\n\r\n\r\t\targ1: device number"
|
||||
"\n\r\t\targ2: channel number",
|
||||
|
||||
"\n\r\n\r\tcvin\n\r\tCalibrates the analogue voltage inputs"
|
||||
"\n\r\tPut calibration value (e.g.10 V) on all inputs at the same time."
|
||||
"\n\r\tSoftware works automated",
|
||||
|
||||
"\n\r\n\r\tcvout\n\r\tCalibrate the analogue voltage outputs"
|
||||
"\n\r\tOnly useful with already calibrated analogue voltage inputs"
|
||||
"\n\r\tConnect outputs 0-5 to inputs 0-5. Software works automated",
|
||||
|
||||
"\n\r\n\r\tdigiin arg1 arg2\n\r\tReads the actual value of a digital input"
|
||||
"\n\r\n\r\t\targ1: device number"
|
||||
"\n\r\t\targ2: channel number",
|
||||
|
||||
"\n\r\n\r\tdigiout arg1 arg2 arg3\n\r\tWrites to a digital output"
|
||||
"\n\r\n\r\t\targ1: device number"
|
||||
"\n\r\t\targ2: channel number"
|
||||
"\n\r\t\targ3=0-1: 0: FALSE/LOW, 1: TRUE/HIGH",
|
||||
|
||||
"\n\r\n\r\tdio arg1 arg2\n\r\tTests the digital in- and outputs"
|
||||
"\n\r\n\r\t\targ1: device number. 0 sets up a self test"
|
||||
"\n\r\t\targ2: test type (0: MB, 1: EB) (Only on remote test)",
|
||||
|
||||
"\n\r\n\r\teeprom arg1\n\r\tTests the connection and algorithms of the EEPROM"
|
||||
"\n\r\n\r\t\targ1: device number. 0 sets up a self test",
|
||||
|
||||
"\n\r\n\r\tfattest\n\r\tTest sequence for FAT Filesystem on SD/MMC",
|
||||
|
||||
"\n\r\n\r\thelp\n\r\tCALLS HELP, WHAT ELSE???",
|
||||
|
||||
"\n\r\n\r\tinitSD\n\r\tInitialises the SD Card",
|
||||
|
||||
"\n\r\n\r\tinitTest\n\r\tInitialises the remote test applications",
|
||||
|
||||
"\n\r\n\r\tledclean arg1\n\r\tSets all digital output LEDs to OFF"
|
||||
"\n\r\n\r\t\targ1: device number",
|
||||
|
||||
"\n\r\n\r\tledtest arg1\n\r\tTests all LEDs available"
|
||||
"\n\r\n\r\t\targ1: device number. 0 sets up a self test",
|
||||
|
||||
"\n\r\n\r\tlistlocalattach\n\r\tLists all local bus-attached functions",
|
||||
|
||||
// "\n\r\n\r\tlistremoteattach\n\r\tLists all remote bus-attached functions",
|
||||
|
||||
"\n\r\n\r\tlogenable arg1\n\r\tEnables/Disables Output logging"
|
||||
"\n\r\n\r\targ1=0-1: 0: disable, 1: enable",
|
||||
|
||||
"\n\r\n\r\tlogmount\n\r\tmounts the SD Card to file system",
|
||||
|
||||
"\n\r\n\r\tlogstart arg1\n\r\tStarts logging on file"
|
||||
"\n\r\n\r\targ1: serial number of device and filename of log-file",
|
||||
|
||||
"\n\r\n\r\tlogstop\n\r\tstops logging on file",
|
||||
|
||||
"\n\r\n\r\tls\n\rlists all existing logfiles",
|
||||
|
||||
"\n\r\n\r\tmenudebug arg1\n\r\tEnables detailed messages from the menu"
|
||||
"\n\r\n\r\t\targ1=0-1: 1: enable, 0: disable",
|
||||
|
||||
"\n\r\n\r\tmmc arg1\n\r\tTests the memory card interface"
|
||||
"\n\r\n\r\t\targ1: device number. 0 sets up a self test",
|
||||
|
||||
"\n\r\n\r\tpower arg1\n\r\tTests the devices power connections"
|
||||
"\n\r\n\r\t\targ1: device number. 0 sets up a self test",
|
||||
|
||||
"\n\r\n\r\tquit\n\r\tEXITS MENU",
|
||||
|
||||
"\n\r\n\r\treadrtc\n\r\tReads the RTC",
|
||||
|
||||
"\n\r\n\r\tremotecall arg1 arg2 arg3\n\r\tCalls remote functions on Salve"
|
||||
"\n\r\n\r\t\targ1: Remote function number"
|
||||
"\n\r\t\targ2: Number of function parameters"
|
||||
"\n\r\t\targ3: Function paramters",
|
||||
|
||||
"\n\r\n\r\trtc arg1\n\r\tTests the RealTime Clock"
|
||||
"\n\r\n\r\t\targ1: device number. 0 sets up a self test",
|
||||
|
||||
"\n\r\n\r\trun\n\r\tRuns a complete test sequence",
|
||||
|
||||
"\n\r\n\r\tstat_cal arg1\n\r\tSets the status of the analogue in- and outputs to CALIBRATED"
|
||||
"\n\r\n\r\t\targ1: device number. 0 is self device",
|
||||
|
||||
"\n\r\n\r\tstat_def arg1\n\r\tSets the status of the analogue in- and outputs to DEFAULT"
|
||||
"\n\r\n\r\t\targ1: device number. 0 is self device",
|
||||
|
||||
"\n\r\n\r\tstat_kill arg1\n\r\tDeletes the status of the analogue in- and outputs"
|
||||
"\n\r\n\r\targ1: device number. 0 is self device",
|
||||
|
||||
"\n\r\n\r\tstat_show arg1 arg2\n\r\tShows the status of the analogue in- and outputs"
|
||||
"\n\r\n\r\t\targ1: device number"
|
||||
"\n\r\t\targ2: Status type - 0=VI, 1=VO, 2=CI, 3=CO",
|
||||
|
||||
"\n\r\n\r\tstat_showall arg1\n\r\tShows the status of ALL analogue in- and outputs"
|
||||
"\n\r\n\r\t\targ1: device number",
|
||||
|
||||
"\n\r\n\r\tsetMux arg1 arg2\n\r\tSets the in- and ouput mux devices"
|
||||
"\n\r\n\r\t\targ1: Mux type (0: DI; 1: DO; 2: AI; 3: AO)"
|
||||
"\n\r\t\targ2: Mode (0: Main board; 1: Extension board)",
|
||||
|
||||
"\n\r\n\r\tsetRTC arg1 arg2 arg3\n\r\tSets Date and Time in the RTC"
|
||||
"\n\r\n\r\targ1:|day|hour|minutes|seconds| (each 8 bit)"
|
||||
"\n\r\targ2: |0|0|0|0|month|dayOfWeek (each 8 bit)"
|
||||
"\n\r\targ3: |dayOfYear|year| (each 16 bit)",
|
||||
|
||||
"\n\r\n\r\ttasksdelete\n\r\tDeletes all testLED tasks",
|
||||
|
||||
"\n\r\n\r\tvolin arg1 arg2\n\r\tReads actual value on analogue voltage input"
|
||||
"\n\r\n\r\t\targ1: device number. 0 is self device"
|
||||
"\n\r\t\targ2=0-7: channel number",
|
||||
|
||||
"\n\r\n\r\tvolout arg1 arg2 arg3\n\r\tDrives analogue voltage output"
|
||||
"\n\r\n\r\t\targ1: device number. 0 is self device"
|
||||
"\n\r\t\targ2=0-5: channel number"
|
||||
"\n\r\t\targ3=0-10000: Value"
|
||||
|
||||
|
||||
};
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Local function definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
void menuInit (void)
|
||||
{
|
||||
UINT8 loopcnt = 0;
|
||||
UINT8 asciicnt;
|
||||
BOOLEAN breakout;
|
||||
|
||||
/* Calculate Array-Offsets for each possible first letter
|
||||
* The actual Letter is mentioned in asciicnt, which starts with dezimal
|
||||
* code of the first, small letter (a = 97).
|
||||
*/
|
||||
for (asciicnt = ASCII_START; asciicnt < (ASCII_START + ALPHABET_DIGITS); asciicnt++)
|
||||
{
|
||||
loopcnt = 0;
|
||||
breakout = FALSE;
|
||||
/* Perform search as long as no accordance was found or array ends */
|
||||
while (breakout == FALSE)
|
||||
{
|
||||
if (loopcnt < NUMBER_OF_COMMANDS)
|
||||
{
|
||||
if (command_table[loopcnt][0] == asciicnt)
|
||||
{
|
||||
/* Accordance found! Save Offset in offset-array */
|
||||
cmd_table_offset[(asciicnt - ASCII_START)] = loopcnt;
|
||||
breakout = TRUE; /* Enable breakout of loop */
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* No Accordance found. Save "NO OFFSET" to offset-array */
|
||||
cmd_table_offset[(asciicnt - ASCII_START)] = 0xFF;
|
||||
breakout = TRUE; /* Enable breakout of loop */
|
||||
}
|
||||
loopcnt++;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
/* ---------------------------------------------------------------------------
|
||||
* menuargs.h (c) 2008 Micro-key bv
|
||||
* ---------------------------------------------------------------------------
|
||||
* Micro-key bv
|
||||
* Industrieweg 28, 9804 TG Noordhorn
|
||||
* Postbus 92, 9800 AB Zuidhorn
|
||||
* The Netherlands
|
||||
* Tel: +31 594 503020
|
||||
* Fax: +31 594 505825
|
||||
* Email: support@microkey.nl
|
||||
* Web: www.microkey.nl
|
||||
* ---------------------------------------------------------------------------
|
||||
* Description:
|
||||
* ---------------------------------------------------------------------------
|
||||
* Version(s): 0.1, Nov 13, 2008, MMi
|
||||
* Creation.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef MENUARGS_H_
|
||||
#define MENUARGS_H_
|
||||
/* ---------------------------------------------------------------------------
|
||||
* System include files.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Application include files.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Constant and macro definitions.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#define ALPHABET_DIGITS 26
|
||||
#define NUMBER_OF_COMMANDS 55
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Type definitions.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
typedef void (*fpointer)(void);
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Variable declarations.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Function declarations.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
void menuInit (void);
|
||||
|
||||
#endif /*MENUARGS_H_*/
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,119 @@
|
||||
/* ---------------------------------------------------------------------------
|
||||
* menufunctions.h (c) 2008 Micro-key bv
|
||||
* ---------------------------------------------------------------------------
|
||||
* Micro-key bv
|
||||
* Industrieweg 28, 9804 TG Noordhorn
|
||||
* Postbus 92, 9800 AB Zuidhorn
|
||||
* The Netherlands
|
||||
* Tel: +31 594 503020
|
||||
* Fax: +31 594 505825
|
||||
* Email: support@microkey.nl
|
||||
* Web: www.microkey.nl
|
||||
* ---------------------------------------------------------------------------
|
||||
* Description:
|
||||
* ---------------------------------------------------------------------------
|
||||
* Version(s): 0.1, Nov 14, 2008, MMi
|
||||
* Creation.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef MENUFUNCTIONS_H_
|
||||
#define MENUFUNCTIONS_H_
|
||||
/* ---------------------------------------------------------------------------
|
||||
* System include files.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Application include files.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Constant and macro definitions.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Type definitions.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Variable declarations.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Function declarations.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
void m_run (void);
|
||||
/*
|
||||
* INPUT AND OUTPUT SECTION
|
||||
*/
|
||||
void m_confout (void);
|
||||
void m_confin (void);
|
||||
void m_switchMux(void);
|
||||
void m_curout (void);
|
||||
void m_volout (void);
|
||||
void m_digiout (void);
|
||||
void m_volin (void);
|
||||
void m_curin (void);
|
||||
void m_digiin (void);
|
||||
void m_canread (void);
|
||||
void m_canwrite (void);
|
||||
/*
|
||||
* CALIBRATION SECTION
|
||||
*/
|
||||
void m_cvout (void);
|
||||
void m_cvin (void);
|
||||
void m_ccout (void);
|
||||
void m_ccin (void);
|
||||
void m_cdel (void);
|
||||
void m_cload (void);
|
||||
void m_c_stat (void);
|
||||
void m_c_kill (void);
|
||||
void m_c_def (void);
|
||||
void m_c_cal (void);
|
||||
void m_c_show (void);
|
||||
void m_cslave(void);
|
||||
/*
|
||||
* TEST COMMAND SECTION
|
||||
*/
|
||||
void m_battery (void);
|
||||
void m_ledtest (void);
|
||||
void m_dio (void);
|
||||
void m_aio(void);
|
||||
void m_bus (void);
|
||||
void m_cantest (void);
|
||||
void m_eeprom (void);
|
||||
void m_mmc (void);
|
||||
void m_power(void);
|
||||
void m_rtc (void);
|
||||
void m_fattest (void);
|
||||
/*
|
||||
* LOGGING SECTION
|
||||
*/
|
||||
void m_initSD (void);
|
||||
void m_sdMount (void);
|
||||
void m_logEnable (void);
|
||||
void m_logStart (void);
|
||||
void m_logStop (void);
|
||||
void m_loglist (void);
|
||||
/*
|
||||
* MISC SECTION
|
||||
*/
|
||||
void m_setRTC (void);
|
||||
void m_readRTC (void);
|
||||
void m_callRemoteFunction (void);
|
||||
void m_listLocalattachments (void);
|
||||
void m_clean(void);
|
||||
void m_tasksdelete(void);
|
||||
void m_quit(void);
|
||||
void m_help(void);
|
||||
void m_menuDebug (void);
|
||||
|
||||
|
||||
|
||||
#endif /*MENUFUNCTIONS_H_*/
|
||||
@@ -0,0 +1,333 @@
|
||||
/* ---------------------------------------------------------------------------
|
||||
* remote_analogue.c (c) 2008 Micro-key bv
|
||||
* ---------------------------------------------------------------------------
|
||||
* Micro-key bv
|
||||
* Industrieweg 28, 9804 TG Noordhorn
|
||||
* Postbus 92, 9800 AB Zuidhorn
|
||||
* The Netherlands
|
||||
* Tel: +31 594 503020
|
||||
* Fax: +31 594 505825
|
||||
* Email: support@microkey.nl
|
||||
* Web: www.microkey.nl
|
||||
* ---------------------------------------------------------------------------
|
||||
* Description: remote analogue test sequence
|
||||
* ---------------------------------------------------------------------------
|
||||
* Version(s): 0.1, Dez 15, 2008, MMi
|
||||
* Creation.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* System include files
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#include "LPC23xx.h"
|
||||
#include "types.h"
|
||||
|
||||
#include "FreeRTOS.h"
|
||||
#include "task.h"
|
||||
#include "semphr.h"
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Application include files
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#include "remote_analogue.h"
|
||||
#include "adc.h"
|
||||
#include "dac.h"
|
||||
|
||||
#include "protocolfunctions.h"
|
||||
#include "BusProtocol.h"
|
||||
#include "SerOut.h"
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Local constant and macro definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Global variable definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Local variable definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
UINT32 remoteAioReadResult = 0;
|
||||
|
||||
BOOLEAN remoteAnalogueInitialised = FALSE;
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Local function definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
void remoteAioInit (void)
|
||||
{
|
||||
UINT32 loopcnt;
|
||||
RESULT set_mb;
|
||||
RESULT set_eb;
|
||||
|
||||
remoteAnalogueInitialised = TRUE; /* Mark driver as initialised */
|
||||
|
||||
sendString (SerOutPort, TRUE, importantMessage,
|
||||
NewLine, "Initialise analogue remote buffers", Dummy);
|
||||
sendString (SerOutPort, FALSE, importantMessage,
|
||||
"\tInputs...", Dummy, Dummy);
|
||||
for (loopcnt = 0; loopcnt < NUMBER_OF_TOTAL_AI; loopcnt++)
|
||||
{
|
||||
remoteAnalogueInputs[loopcnt] = 0;
|
||||
}
|
||||
sendString (SerOutPort, FALSE, importantMessage,
|
||||
"Done", Dummy, Dummy);
|
||||
|
||||
sendString (SerOutPort, FALSE, importantMessage,
|
||||
"\tOutputs...", Dummy, Dummy);
|
||||
for (loopcnt = 0; loopcnt < NUMBER_OF_TOTAL_AO; loopcnt++)
|
||||
{
|
||||
remoteAnalogueInputs[loopcnt] = 0;
|
||||
}
|
||||
sendString (SerOutPort, FALSE, importantMessage,
|
||||
"Done", Dummy, Dummy);
|
||||
|
||||
vSemaphoreCreateBinary (remoteAnalogueSemaphore);
|
||||
sendString (SerOutPort, TRUE, importantMessage,
|
||||
"Take analogue semaphore... ", Dummy, Dummy);
|
||||
|
||||
if (xSemaphoreTake(remoteAnalogueSemaphore, 0) == pdTRUE)
|
||||
{
|
||||
sendString (SerOutPort, FALSE, importantMessage,
|
||||
"Done", Dummy, Dummy);
|
||||
}
|
||||
else
|
||||
{
|
||||
sendString (SerOutPort, FALSE, importantMessage,
|
||||
"Failed", Dummy, Dummy);
|
||||
}
|
||||
|
||||
|
||||
sendString(SerOutPort, TRUE, importantMessage,
|
||||
"reset remote analogue outputs...", Dummy, Dummy);
|
||||
set_mb = remoteAioWriteAll (remoteDeviceNumber, analogue_mb, 0);
|
||||
set_eb = remoteAioWriteAll (remoteDeviceNumber, analogue_eb, 0);
|
||||
if ((set_mb == OK) && (set_eb == OK))
|
||||
{
|
||||
sendString(SerOutPort, FALSE, importantMessage, "Done", Dummy, Dummy);
|
||||
}
|
||||
else
|
||||
{
|
||||
sendString(SerOutPort, FALSE, importantMessage, "Failed", Dummy, Dummy);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
RESULT remoteAioWrite (UINT8 device, UINT8 channel, INT32 value)
|
||||
{
|
||||
|
||||
INT32 sendArray[2];
|
||||
RESULT returnValue;
|
||||
|
||||
if (remoteAnalogueInitialised == FALSE)
|
||||
{
|
||||
/* Remote digital driver is not initialised */
|
||||
sendString (SerOutPort, TRUE, importantMessage,
|
||||
"\t\tanalogue not intialised", Dummy, Dummy);
|
||||
return (ERROR);
|
||||
}
|
||||
|
||||
sendArray[0] = (INT32) channel;
|
||||
sendArray[1] = (INT32) value;
|
||||
|
||||
bpSendCallRpc(handleBus1, device, 22, 2, sendArray);
|
||||
|
||||
if (xSemaphoreTake(remoteAnalogueSemaphore, 3000) != pdTRUE)
|
||||
{
|
||||
sendString (SerOutPort, TRUE, importantMessage,
|
||||
s_tab, "analogue write was not successful", Dummy);
|
||||
|
||||
returnValue = ERROR;
|
||||
}
|
||||
else
|
||||
{
|
||||
remoteAnalogueOutputs[channel] = value;
|
||||
|
||||
returnValue = OK;
|
||||
}
|
||||
|
||||
return (returnValue);
|
||||
}
|
||||
|
||||
|
||||
RESULT remoteAioWriteAll(UINT8 device, t_boardtype_analogue board, BOOLEAN value)
|
||||
{
|
||||
INT32 sendArray[2];
|
||||
UINT8 loopcnt = 0;
|
||||
UINT8 loopend = 0;
|
||||
RESULT returnValue;
|
||||
|
||||
if (remoteAnalogueInitialised == FALSE)
|
||||
{
|
||||
/* Remote digital driver is not initialised */
|
||||
sendString (SerOutPort, TRUE, importantMessage,
|
||||
"\t\tanalogue not intialised", Dummy, Dummy);
|
||||
return (ERROR);
|
||||
}
|
||||
|
||||
sendArray[0] = (INT32)board;
|
||||
sendArray[1] = (INT32)value;
|
||||
|
||||
bpSendCallRpc(handleBus1, device, 25, 2, sendArray);
|
||||
|
||||
if (xSemaphoreTake(remoteAnalogueSemaphore, 3000) != pdTRUE)
|
||||
{
|
||||
sendString(SerOutPort, TRUE, importantMessage, s_tab,
|
||||
"analogue write was not successful", Dummy);
|
||||
|
||||
returnValue = ERROR;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
switch (board)
|
||||
{
|
||||
case analogue_mb:
|
||||
loopcnt = 0;
|
||||
loopend = NUMBER_OF_AO_MB;
|
||||
break;
|
||||
|
||||
case analogue_eb:
|
||||
loopcnt = NUMBER_OF_AO_MB;
|
||||
loopend = NUMBER_OF_TOTAL_AO;
|
||||
break;
|
||||
}
|
||||
|
||||
for (loopcnt; loopcnt < loopend; loopcnt++)
|
||||
{
|
||||
remoteAnalogueOutputs[loopcnt] = value;
|
||||
// \TODO IS THIS LOOP WORKING??
|
||||
}
|
||||
|
||||
returnValue = OK;
|
||||
}
|
||||
|
||||
return (returnValue);
|
||||
}
|
||||
|
||||
|
||||
|
||||
UINT32 remoteAioRead (UINT8 device, UINT8 channel)
|
||||
{
|
||||
|
||||
if (remoteAnalogueInitialised == FALSE)
|
||||
{
|
||||
/* Remote digital driver is not initialised */
|
||||
sendString (SerOutPort, TRUE, importantMessage,
|
||||
"\t\tanalogue not intialised", Dummy, Dummy);
|
||||
return (ERROR);
|
||||
}
|
||||
|
||||
|
||||
bpSendCallRpc(handleBus1, device, 23, 1, (INT32)&channel);
|
||||
if (xSemaphoreTake(remoteAnalogueSemaphore, 3000) != pdTRUE)
|
||||
{
|
||||
sendString (SerOutPort, TRUE, importantMessage,
|
||||
s_tab, "analogue read did not receive a readback", Dummy);
|
||||
}
|
||||
else
|
||||
{
|
||||
remoteAnalogueInputs[channel] = remoteAioReadResult;
|
||||
}
|
||||
|
||||
return (remoteAioReadResult);
|
||||
|
||||
}
|
||||
|
||||
|
||||
void remoteAioReadAll (UINT8 device, t_boardtype_analogue board)
|
||||
{
|
||||
|
||||
if (remoteAnalogueInitialised == FALSE)
|
||||
{
|
||||
/* Remote digital driver is not initialised */
|
||||
sendString (SerOutPort, TRUE, importantMessage,
|
||||
"\t\tanalogue not intialised", Dummy, Dummy);
|
||||
return;
|
||||
}
|
||||
|
||||
bpSendCallRpc(handleBus1, device, 27, 1, (INT32)&board);
|
||||
if (xSemaphoreTake(remoteAnalogueSemaphore, 3000) != pdTRUE)
|
||||
{
|
||||
sendString (SerOutPort, TRUE, importantMessage,
|
||||
s_tab, "analogue read all did not receive a readback", Dummy);
|
||||
}
|
||||
else
|
||||
{
|
||||
sendString (SerOutPort, TRUE, importantMessage,
|
||||
f_tab, "analogue read all finished receiving", Dummy);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void remoteAnalogueSemaphoreRelease (UINT8 requestNr, UINT8 nrOfResults, UINT32 *results)
|
||||
{
|
||||
|
||||
if (remoteAnalogueInitialised == FALSE)
|
||||
{
|
||||
/* Remote digital driver is not initialised */
|
||||
sendString (SerOutPort, TRUE, importantMessage,
|
||||
"\t\tanalogue not intialised", Dummy, Dummy);
|
||||
return;
|
||||
}
|
||||
|
||||
xSemaphoreGive (remoteAnalogueSemaphore);
|
||||
}
|
||||
|
||||
void analogueReadResult (UINT8 requestNr, UINT8 nrOfResults, UINT32 *results)
|
||||
{
|
||||
/* nrOfResults = 2
|
||||
* results[0]: analogue input value
|
||||
*/
|
||||
|
||||
if (remoteAnalogueInitialised == FALSE)
|
||||
{
|
||||
/* Remote digital driver is not initialised */
|
||||
sendString (SerOutPort, TRUE, importantMessage,
|
||||
"\t\tanalogue not intialised", Dummy, Dummy);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Asign remote analogue input result to local variable */
|
||||
remoteAioReadResult = (UINT32) results[0];
|
||||
|
||||
|
||||
xSemaphoreGive (remoteAnalogueSemaphore);
|
||||
}
|
||||
|
||||
|
||||
void analogueReadAllResult (UINT8 requestNr, UINT8 nrOfResults, UINT32 *results)
|
||||
{
|
||||
/* nrOfResults = maxDI_Channels
|
||||
* results[x]: analogue input x value
|
||||
*/
|
||||
|
||||
UINT32 loopcnt;
|
||||
|
||||
if (remoteAnalogueInitialised == FALSE)
|
||||
{
|
||||
/* Remote digital driver is not initialised */
|
||||
sendString (SerOutPort, TRUE, importantMessage,
|
||||
"\t\tanalogue not intialised", Dummy, Dummy);
|
||||
return;
|
||||
}
|
||||
|
||||
for (loopcnt = 0; loopcnt < maxDAC_Channels; loopcnt++)
|
||||
{
|
||||
/* Copy read result to value array */
|
||||
remoteAnalogueInputs[loopcnt] = results[loopcnt];
|
||||
|
||||
}
|
||||
xSemaphoreGive (remoteAnalogueSemaphore);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
/* ---------------------------------------------------------------------------
|
||||
* remote_analogue.h (c) 2008 Micro-key bv
|
||||
* ---------------------------------------------------------------------------
|
||||
* Micro-key bv
|
||||
* Industrieweg 28, 9804 TG Noordhorn
|
||||
* Postbus 92, 9800 AB Zuidhorn
|
||||
* The Netherlands
|
||||
* Tel: +31 594 503020
|
||||
* Fax: +31 594 505825
|
||||
* Email: support@microkey.nl
|
||||
* Web: www.microkey.nl
|
||||
* ---------------------------------------------------------------------------
|
||||
* Description:
|
||||
* ---------------------------------------------------------------------------
|
||||
* Version(s): 0.1, Dez 15, 2008, MMi
|
||||
* Creation.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef REMOTE_ANALOGUE_H_
|
||||
#define REMOTE_ANALOGUE_H_
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* System include files.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#include "LPC23xx.h"
|
||||
#include "types.h"
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Application include files.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Constant and macro definitions.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#define NUMBER_OF_AI_MB 8
|
||||
#define NUMBER_OF_AO_MB 8
|
||||
|
||||
#define NUMBER_OF_AI_EB 4
|
||||
#define NUMBER_OF_AO_EB 4
|
||||
|
||||
#define NUMBER_OF_TOTAL_AI (NUMBER_OF_AI_MB + NUMBER_OF_AI_EB)
|
||||
#define NUMBER_OF_TOTAL_AO (NUMBER_OF_AO_MB + NUMBER_OF_AO_EB)
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Type definitions.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
analogue_mb = 0,
|
||||
analogue_eb = 1
|
||||
} t_boardtype_analogue;
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Variable declarations.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
INT32 remoteAnalogueInputs[(NUMBER_OF_TOTAL_AI)];
|
||||
INT32 remoteAnalogueOutputs[(NUMBER_OF_TOTAL_AO)];
|
||||
|
||||
xSemaphoreHandle remoteAnalogueSemaphore;
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Function declarations.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
void remoteAioInit (void);
|
||||
|
||||
RESULT remoteAioWrite (UINT8 device, UINT8 channel, INT32 value);
|
||||
|
||||
RESULT remoteAioWriteAll (UINT8 device, t_boardtype_analogue board, BOOLEAN value);
|
||||
|
||||
UINT32 remoteAioRead (UINT8 device, UINT8 channel);
|
||||
|
||||
void remoteAioReadAll (UINT8 device, t_boardtype_analogue board);
|
||||
|
||||
void remoteAnalogueSemaphoreRelease (UINT8 requestNr, UINT8 nrOfResults, UINT32 *results);
|
||||
|
||||
void analogueReadResult (UINT8 requestNr, UINT8 nrOfResults, UINT32 *results);
|
||||
|
||||
void analogueReadAllResult (UINT8 requestNr, UINT8 nrOfResults, UINT32 *results);
|
||||
|
||||
|
||||
|
||||
#endif /*REMOTE_ANALOGUE_H_*/
|
||||
@@ -0,0 +1,376 @@
|
||||
/* ---------------------------------------------------------------------------
|
||||
* remote_digital.c (c) 2008 Micro-key bv
|
||||
* ---------------------------------------------------------------------------
|
||||
* Micro-key bv
|
||||
* Industrieweg 28, 9804 TG Noordhorn
|
||||
* Postbus 92, 9800 AB Zuidhorn
|
||||
* The Netherlands
|
||||
* Tel: +31 594 503020
|
||||
* Fax: +31 594 505825
|
||||
* Email: support@microkey.nl
|
||||
* Web: www.microkey.nl
|
||||
* ---------------------------------------------------------------------------
|
||||
* Description: remote digital test sequence
|
||||
* ---------------------------------------------------------------------------
|
||||
* Version(s): 0.1, Dez 15, 2008, MMi
|
||||
* Creation.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* System include files
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#include "LPC23xx.h"
|
||||
#include "types.h"
|
||||
|
||||
#include "FreeRTOS.h"
|
||||
#include "task.h"
|
||||
#include "semphr.h"
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Application include files
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#include "remote_digital.h"
|
||||
#include "dio.h"
|
||||
|
||||
#include "protocolfunctions.h"
|
||||
#include "BusProtocol.h"
|
||||
#include "SerOut.h"
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Local constant and macro definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Global variable definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
BOOLEAN remoteDigitalInitialised = FALSE;
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Local variable definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
BOOLEAN remoteDioReadResult = FALSE;
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Local function definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
void remoteDioInit (void)
|
||||
{
|
||||
UINT32 loopcnt;
|
||||
RESULT set_mb;
|
||||
RESULT set_eb;
|
||||
|
||||
remoteDigitalInitialised = TRUE; /* Mark driver as initialised */
|
||||
|
||||
sendString (SerOutPort, TRUE, importantMessage,
|
||||
NewLine, "Initialise digital remote buffers", Dummy);
|
||||
sendString (SerOutPort, FALSE, importantMessage,
|
||||
"\tInputs...", Dummy, Dummy);
|
||||
for (loopcnt = 0; loopcnt < NUMBER_OF_TOTAL_DI; loopcnt++)
|
||||
{
|
||||
remoteDigitalInputs[loopcnt] = FALSE;
|
||||
}
|
||||
sendString (SerOutPort, FALSE, importantMessage,
|
||||
"Done", Dummy, Dummy);
|
||||
|
||||
sendString (SerOutPort, FALSE, importantMessage,
|
||||
"\tOutputs...", Dummy, Dummy);
|
||||
for (loopcnt = 0; loopcnt < NUMBER_OF_TOTAL_DO; loopcnt++)
|
||||
{
|
||||
remoteDigitalOutputs[loopcnt] = FALSE;
|
||||
}
|
||||
sendString (SerOutPort, FALSE, importantMessage,
|
||||
"Done", Dummy, Dummy);
|
||||
|
||||
|
||||
vSemaphoreCreateBinary (remoteDigitalSemaphore);
|
||||
sendString (SerOutPort, TRUE, importantMessage,
|
||||
"Take digital semaphore... ", Dummy, Dummy);
|
||||
if (xSemaphoreTake(remoteDigitalSemaphore, 0) == pdTRUE)
|
||||
{
|
||||
sendString (SerOutPort, FALSE, importantMessage,
|
||||
"Done", Dummy, Dummy);
|
||||
}
|
||||
else
|
||||
{
|
||||
sendString (SerOutPort, FALSE, importantMessage,
|
||||
"Failed", Dummy, Dummy);
|
||||
}
|
||||
|
||||
|
||||
sendString(SerOutPort, TRUE, importantMessage,
|
||||
"reset remote digital outputs...", Dummy, Dummy);
|
||||
set_mb = remoteDioWriteAll (remoteDeviceNumber, digital_mb, FALSE);
|
||||
set_eb = remoteDioWriteAll (remoteDeviceNumber, digital_eb, FALSE);
|
||||
|
||||
if ((set_mb == OK) && (set_eb == OK))
|
||||
{
|
||||
sendString(SerOutPort, FALSE, importantMessage, "Done", Dummy, Dummy);
|
||||
}
|
||||
else
|
||||
{
|
||||
sendString(SerOutPort, FALSE, importantMessage, "Failed", Dummy, Dummy);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
RESULT remoteDioWrite (UINT8 device, UINT8 channel, BOOLEAN value)
|
||||
{
|
||||
INT32 sendArray[2];
|
||||
RESULT returnValue;
|
||||
|
||||
if (remoteDigitalInitialised == FALSE)
|
||||
{
|
||||
/* Remote digital driver is not initialised */
|
||||
sendString (SerOutPort, TRUE, importantMessage,
|
||||
"\t\tdigital not intialised", Dummy, Dummy);
|
||||
return (ERROR);
|
||||
}
|
||||
|
||||
sendArray[0] = (INT32) channel;
|
||||
sendArray[1] = (INT32) value;
|
||||
|
||||
bpSendCallRpc(handleBus1, device, 20, 2, sendArray);
|
||||
|
||||
if (xSemaphoreTake(remoteDigitalSemaphore, 3000) != pdTRUE)
|
||||
{
|
||||
sendString (SerOutPort, TRUE, importantMessage,
|
||||
s_tab, "digital write was not successful", Dummy);
|
||||
|
||||
returnValue = ERROR;
|
||||
}
|
||||
else
|
||||
{
|
||||
remoteDigitalOutputs[channel] = value;
|
||||
|
||||
returnValue = OK;
|
||||
}
|
||||
|
||||
return (returnValue);
|
||||
}
|
||||
|
||||
|
||||
RESULT remoteDioWriteAll(UINT8 device, t_boardtype_digital board, BOOLEAN value)
|
||||
{
|
||||
INT32 sendArray[2];
|
||||
UINT8 loopcnt = 0;
|
||||
UINT8 loopend = 0;
|
||||
|
||||
RESULT returnValue;
|
||||
|
||||
if (remoteDigitalInitialised == FALSE)
|
||||
{
|
||||
/* Remote digital driver is not initialised */
|
||||
sendString (SerOutPort, TRUE, importantMessage,
|
||||
"\t\tdigital not intialised", Dummy, Dummy);
|
||||
return (ERROR);
|
||||
}
|
||||
|
||||
sendArray[0] = (INT32)board;
|
||||
sendArray[1] = (INT32)value;
|
||||
|
||||
bpSendCallRpc(handleBus1, device, 21, 2, sendArray);
|
||||
|
||||
if (xSemaphoreTake(remoteDigitalSemaphore, 3000) != pdTRUE)
|
||||
{
|
||||
sendString(SerOutPort, TRUE, importantMessage, s_tab,
|
||||
"digital write was not successful", Dummy);
|
||||
|
||||
returnValue = ERROR;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
switch (board)
|
||||
{
|
||||
case digital_mb:
|
||||
loopcnt = 0;
|
||||
loopend = NUMBER_OF_DO_MB;
|
||||
break;
|
||||
|
||||
case digital_eb:
|
||||
loopcnt = NUMBER_OF_DO_MB;
|
||||
loopend = NUMBER_OF_TOTAL_DO;
|
||||
break;
|
||||
}
|
||||
|
||||
for (loopcnt; loopcnt < loopend; loopcnt++)
|
||||
{
|
||||
remoteDigitalOutputs[loopcnt] = value;
|
||||
// \TODO IS THIS LOOP WORKING??
|
||||
}
|
||||
|
||||
returnValue = OK;
|
||||
}
|
||||
|
||||
return (returnValue);
|
||||
}
|
||||
|
||||
|
||||
BOOLEAN remoteDioRead (UINT8 device, INT32 channel)
|
||||
{
|
||||
INT32 channelArray[1];
|
||||
|
||||
channelArray[0] = channel;
|
||||
|
||||
|
||||
if (remoteDigitalInitialised == FALSE)
|
||||
{
|
||||
/* Remote digital driver is not initialised */
|
||||
sendString (SerOutPort, TRUE, importantMessage,
|
||||
"\t\tdigital not intialised", Dummy, Dummy);
|
||||
return (ERROR);
|
||||
}
|
||||
|
||||
|
||||
bpSendCallRpc(handleBus1, device, 22, 1, channelArray);
|
||||
if (xSemaphoreTake(remoteDigitalSemaphore, 3000) != pdTRUE)
|
||||
{
|
||||
sendString (SerOutPort, TRUE, importantMessage,
|
||||
s_tab, "digital read did not receive a readback", Dummy);
|
||||
}
|
||||
else
|
||||
{
|
||||
remoteDigitalInputs[channel] = remoteDioReadResult;
|
||||
}
|
||||
|
||||
return (remoteDioReadResult);
|
||||
}
|
||||
|
||||
|
||||
void remoteDioReadAll (UINT8 device, t_boardtype_digital board)
|
||||
{
|
||||
INT32 boardArray[1];
|
||||
|
||||
boardArray[0] = board;
|
||||
|
||||
if (remoteDigitalInitialised == FALSE)
|
||||
{
|
||||
/* Remote digital driver is not initialised */
|
||||
sendString (SerOutPort, TRUE, importantMessage,
|
||||
"\t\tdigital not intialised", Dummy, Dummy);
|
||||
return;
|
||||
}
|
||||
|
||||
bpSendCallRpc(handleBus1, device, 23, 1, boardArray);
|
||||
if (xSemaphoreTake(remoteDigitalSemaphore, 3000) != pdTRUE)
|
||||
{
|
||||
sendString (SerOutPort, TRUE, importantMessage,
|
||||
s_tab, "digital read all did not receive a readback", Dummy);
|
||||
}
|
||||
else
|
||||
{
|
||||
sendString (SerOutPort, TRUE, importantMessage,
|
||||
f_tab, "digital read all finished receiving", Dummy);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
void remoteDigitalSemaphoreRelease (UINT8 requestNr, UINT8 nrOfResults, UINT32 *results)
|
||||
{
|
||||
|
||||
if (remoteDigitalInitialised == FALSE)
|
||||
{
|
||||
/* Remote digital driver is not initialised */
|
||||
sendString (SerOutPort, TRUE, importantMessage,
|
||||
"\t\tdigital not intialised", Dummy, Dummy);
|
||||
return;
|
||||
}
|
||||
|
||||
xSemaphoreGive (remoteDigitalSemaphore);
|
||||
}
|
||||
|
||||
void digitalReadResult (UINT8 requestNr, UINT8 nrOfResults, UINT32 *results)
|
||||
{
|
||||
|
||||
if (remoteDigitalInitialised == FALSE)
|
||||
{
|
||||
/* Remote digital driver is not initialised */
|
||||
sendString (SerOutPort, TRUE, importantMessage,
|
||||
"\t\tdigital not intialised", Dummy, Dummy);
|
||||
return;
|
||||
}
|
||||
|
||||
/* nrOfResults = 2
|
||||
* results[0]: digital input value (0: LOW, !0: HIGH)
|
||||
*/
|
||||
if (results[0] == 0)
|
||||
{
|
||||
/* Remote digital input is LOW */
|
||||
remoteDioReadResult = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Remote digital input is HIGH */
|
||||
remoteDioReadResult = TRUE;
|
||||
}
|
||||
xSemaphoreGive (remoteDigitalSemaphore);
|
||||
}
|
||||
|
||||
|
||||
void digitalReadAllResult (UINT8 requestNr, UINT8 nrOfResults, UINT32 *results)
|
||||
{
|
||||
/* nrOfResults = 2
|
||||
* results[0]: boardType (0: MB; 1: EB)
|
||||
* results[1]: digital input value
|
||||
*/
|
||||
|
||||
UINT32 loopcnt;
|
||||
UINT32 tempValue;
|
||||
|
||||
if (remoteDigitalInitialised == FALSE)
|
||||
{
|
||||
/* Remote digital driver is not initialised */
|
||||
sendString (SerOutPort, TRUE, importantMessage,
|
||||
"\t\tdigital not intialised", Dummy, Dummy);
|
||||
return;
|
||||
}
|
||||
|
||||
sendString (SerOutPort, TRUE, importantMessage,
|
||||
"\t\tdigital real all: ", ItoHStr (results[1]), Dummy);
|
||||
|
||||
if (results[0] == 0)
|
||||
{
|
||||
/* Incoming Results are from Mainboard */
|
||||
for (loopcnt = 0; loopcnt < NUMBER_OF_DI_MB; loopcnt++)
|
||||
{
|
||||
tempValue = (results[1] & (0x0000 | (1 << loopcnt)));
|
||||
if (tempValue == 0)
|
||||
{
|
||||
remoteDigitalInputs[loopcnt] = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
remoteDigitalInputs[loopcnt] = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else if (results[0] == 1)
|
||||
{
|
||||
/* Incoming Results are from Extensionboard */
|
||||
for (loopcnt = 0; loopcnt < NUMBER_OF_DI_EB; loopcnt++)
|
||||
{
|
||||
tempValue = (results[1] & (0x0000 | (1 << loopcnt)));
|
||||
|
||||
if (tempValue == 0)
|
||||
{
|
||||
remoteDigitalInputs[(loopcnt + NUMBER_OF_DI_MB)] = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
remoteDigitalInputs[(loopcnt + NUMBER_OF_DI_MB)] = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
xSemaphoreGive (remoteDigitalSemaphore);
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
/* ---------------------------------------------------------------------------
|
||||
* remote_digital.h (c) 2008 Micro-key bv
|
||||
* ---------------------------------------------------------------------------
|
||||
* Micro-key bv
|
||||
* Industrieweg 28, 9804 TG Noordhorn
|
||||
* Postbus 92, 9800 AB Zuidhorn
|
||||
* The Netherlands
|
||||
* Tel: +31 594 503020
|
||||
* Fax: +31 594 505825
|
||||
* Email: support@microkey.nl
|
||||
* Web: www.microkey.nl
|
||||
* ---------------------------------------------------------------------------
|
||||
* Description:
|
||||
* ---------------------------------------------------------------------------
|
||||
* Version(s): 0.1, Nov 11, 2008, MMi
|
||||
* Creation.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef DIGITAL_TEST_H_
|
||||
#define DIGITAL_TEST_H_
|
||||
/* ---------------------------------------------------------------------------
|
||||
* System include files.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#include "LPC23xx.h"
|
||||
#include "types.h"
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Application include files.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Constant and macro definitions.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#define NUMBER_OF_DI_MB 8
|
||||
#define NUMBER_OF_DO_MB 8
|
||||
|
||||
#define NUMBER_OF_DI_EB 4
|
||||
#define NUMBER_OF_DO_EB 4
|
||||
|
||||
#define NUMBER_OF_TOTAL_DI (NUMBER_OF_DI_MB + NUMBER_OF_DI_EB)
|
||||
#define NUMBER_OF_TOTAL_DO (NUMBER_OF_DO_MB + NUMBER_OF_DO_EB)
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Type definitions.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
digital_mb = 0,
|
||||
digital_eb = 1
|
||||
} t_boardtype_digital;
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Variable declarations.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
BOOLEAN remoteDigitalInputs[(NUMBER_OF_TOTAL_DI)];
|
||||
BOOLEAN remoteDigitalOutputs[(NUMBER_OF_TOTAL_DO)];
|
||||
|
||||
xSemaphoreHandle remoteDigitalSemaphore;
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Function declarations.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
void remoteDioInit (void);
|
||||
|
||||
RESULT remoteDioWrite (UINT8 device, UINT8 channel, BOOLEAN value);
|
||||
|
||||
RESULT remoteDioWriteAll (UINT8 device, t_boardtype_digital board, BOOLEAN value);
|
||||
|
||||
BOOLEAN remoteDioRead (UINT8 device, INT32 channel);
|
||||
|
||||
void remoteDioReadAll (UINT8 device, t_boardtype_digital board);
|
||||
|
||||
void remoteDigitalSemaphoreRelease (UINT8 requestNr, UINT8 nrOfResults, UINT32 *results);
|
||||
|
||||
void digitalReadResult (UINT8 requestNr, UINT8 nrOfResults, UINT32 *results);
|
||||
|
||||
void digitalReadAllResult (UINT8 requestNr, UINT8 nrOfResults, UINT32 *results);
|
||||
|
||||
#endif /*DIGITAL_TEST_H_*/
|
||||
@@ -0,0 +1,144 @@
|
||||
/* ---------------------------------------------------------------------------
|
||||
* remote_misc.c (c) 2008 Micro-key bv
|
||||
* ---------------------------------------------------------------------------
|
||||
* Micro-key bv
|
||||
* Industrieweg 28, 9804 TG Noordhorn
|
||||
* Postbus 92, 9800 AB Zuidhorn
|
||||
* The Netherlands
|
||||
* Tel: +31 594 503020
|
||||
* Fax: +31 594 505825
|
||||
* Email: support@microkey.nl
|
||||
* Web: www.microkey.nl
|
||||
* ---------------------------------------------------------------------------
|
||||
* Description:
|
||||
* ---------------------------------------------------------------------------
|
||||
* Version(s): 0.1, Nov 11, 2008, MMi
|
||||
* Creation.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* System include files
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#include "lpc23xx.h"
|
||||
#include "types.h"
|
||||
|
||||
/* FreeRTOS includes */
|
||||
#include "FreeRTOS.h"
|
||||
#include "Task.h"
|
||||
#include "Semphr.h"
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Application include files
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#include "BusProtocol.h"
|
||||
#include "protocolfunctions.h"
|
||||
|
||||
#include "remote_misc.h"
|
||||
#include "SerOut.h"
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Local constant and macro definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#define ident_calibrated 0x55
|
||||
#define ident_default 0xAA
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Global variable definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
extern UINT32 UINT32result; /* from topoftests.c */
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Local variable definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Local function definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#if ((PINSET_TESTER == 1) || (PINSET_TESTER == 2))
|
||||
BOOLEAN makeHandshake (void)
|
||||
{
|
||||
/* Make Handshake with first Slave device.
|
||||
* Take Semaphore, call remote function and take Semaphore again with
|
||||
* waitcycle. Semaphore can just be taken when remote function
|
||||
* finished and returns call to release Semaphore.
|
||||
*/
|
||||
|
||||
BOOLEAN handshakeResult;
|
||||
|
||||
xSemaphoreTake(generalSemaphore, 1); /* Take generalSemaphore */
|
||||
bpSendCallRpc (handleBus1, 2, 1, 0, NULL); /* Call Slaves Handshake */
|
||||
if (xSemaphoreTake(generalSemaphore, 2000) == pdPASS)
|
||||
{ /* Wait for Handshake done */
|
||||
handshakeResult = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
handshakeResult = FALSE;
|
||||
}
|
||||
|
||||
return (handshakeResult);
|
||||
}
|
||||
#endif
|
||||
|
||||
UINT8 returnRemoteCalibrationStatus (INT32 correctionType)
|
||||
{
|
||||
xSemaphoreTake(generalSemaphore, 0);
|
||||
bpSendCallRpc(handleBus1, 2, 13, 1, &correctionType);
|
||||
if (xSemaphoreTake(generalSemaphore, 5000) != pdPASS)
|
||||
{
|
||||
/* Semaphore is not released, timeout in transmission */
|
||||
xSemaphoreGive (generalSemaphore);
|
||||
UINT32result = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (UINT32result & ident_default)
|
||||
{
|
||||
}
|
||||
else if (UINT32result & ident_calibrated)
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
}
|
||||
return ((UINT8) UINT32result);
|
||||
}
|
||||
|
||||
|
||||
UINT8 showRemoteCalibrationStatus (INT32 correctionType)
|
||||
{
|
||||
xSemaphoreTake(generalSemaphore, 0);
|
||||
bpSendCallRpc(handleBus1, 2, 13, 1, &correctionType);
|
||||
if (xSemaphoreTake(generalSemaphore, 5000) != pdPASS)
|
||||
{
|
||||
/* Semaphore is not released, timeout in transmission */
|
||||
xSemaphoreGive (generalSemaphore);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (UINT32result & ident_default)
|
||||
{
|
||||
sendString (SerOutPort, FALSE, testMessage,
|
||||
"Values are in DEFAULT Mode", Dummy, Dummy);
|
||||
}
|
||||
else if (UINT32result & ident_calibrated)
|
||||
{
|
||||
sendString (SerOutPort, FALSE, testMessage,
|
||||
"Values are in CALIBRATED Mode", Dummy, Dummy);
|
||||
}
|
||||
else
|
||||
{
|
||||
sendString (SerOutPort, FALSE, testMessage,
|
||||
"NO VALID VALUES IN EEPROM", Dummy, Dummy);
|
||||
}
|
||||
}
|
||||
return ((UINT8) UINT32result);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
/* ---------------------------------------------------------------------------
|
||||
* remote_misc.h (c) 2008 Micro-key bv
|
||||
* ---------------------------------------------------------------------------
|
||||
* Micro-key bv
|
||||
* Industrieweg 28, 9804 TG Noordhorn
|
||||
* Postbus 92, 9800 AB Zuidhorn
|
||||
* The Netherlands
|
||||
* Tel: +31 594 503020
|
||||
* Fax: +31 594 505825
|
||||
* Email: support@microkey.nl
|
||||
* Web: www.microkey.nl
|
||||
* ---------------------------------------------------------------------------
|
||||
* Description:
|
||||
* ---------------------------------------------------------------------------
|
||||
* Version(s): 0.1, Nov 11, 2008, MMi
|
||||
* Creation.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#include "lpc23xx.h"
|
||||
#include "types.h"
|
||||
/* ---------------------------------------------------------------------------
|
||||
* System include files.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Application include files.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Constant and macro definitions.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Type definitions.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Variable declarations.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Function declarations.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Function: makeHandshake
|
||||
*
|
||||
* Functions Calls first Attached Function on Slave, which is sending an
|
||||
* Answer back to Master
|
||||
*
|
||||
* Parameter: void
|
||||
*
|
||||
* Return: BOOLEAN - Result of Handshake
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
BOOLEAN makeHandshake (void);
|
||||
|
||||
UINT8 returnRemoteCalibrationStatus (INT32 correctionType);
|
||||
|
||||
UINT8 showRemoteCalibrationStatus (INT32 correctionType);
|
||||
|
||||
void digitalReadResult (UINT8 requestNr, UINT8 nrOfResults, UINT32 *results);
|
||||
|
||||
#ifndef REMOTE_MISC_H_
|
||||
#define REMOTE_MISC_H_
|
||||
|
||||
#endif /*REMOTE_MISC_H_*/
|
||||
@@ -0,0 +1,221 @@
|
||||
/* ---------------------------------------------------------------------------
|
||||
* remote_relay.c (c) 2008 Micro-key bv
|
||||
* ---------------------------------------------------------------------------
|
||||
* Micro-key bv
|
||||
* Industrieweg 28, 9804 TG Noordhorn
|
||||
* Postbus 92, 9800 AB Zuidhorn
|
||||
* The Netherlands
|
||||
* Tel: +31 594 503020
|
||||
* Fax: +31 594 505825
|
||||
* Email: support@microkey.nl
|
||||
* Web: www.microkey.nl
|
||||
* ---------------------------------------------------------------------------
|
||||
* Description:
|
||||
* ---------------------------------------------------------------------------
|
||||
* Version(s): 0.1, Dez 16, 2008, MMi
|
||||
* Creation.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* System include files
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#include "LPC23xx.h"
|
||||
#include "types.h"
|
||||
|
||||
#include "FreeRTOS.h"
|
||||
#include "task.h"
|
||||
#include "semphr.h"
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Application include files
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include "protocolfunctions.h"
|
||||
#include "BusProtocol.h"
|
||||
#include "SerOut.h"
|
||||
|
||||
#include "remote_relay.h"
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Local constant and macro definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Global variable definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Local variable definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
BOOLEAN remoteRelayInitialised = FALSE;
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Local function definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
void remoteRelayInit(void)
|
||||
{
|
||||
UINT32 loopcnt;
|
||||
RESULT set_mb;
|
||||
RESULT set_eb;
|
||||
|
||||
remoteRelayInitialised = TRUE;
|
||||
|
||||
sendString(SerOutPort, TRUE, importantMessage, NewLine,
|
||||
"Initialise relay remote buffers...", Dummy);
|
||||
|
||||
for (loopcnt = 0; loopcnt < NUMBER_OF_TOTAL_RLY; loopcnt++)
|
||||
{
|
||||
remoteRelayInputs[loopcnt] = 0;
|
||||
}
|
||||
sendString(SerOutPort, FALSE, importantMessage, "Done", Dummy, Dummy);
|
||||
|
||||
|
||||
vSemaphoreCreateBinary (remoteRelaySemaphore);
|
||||
sendString (SerOutPort, TRUE, importantMessage,
|
||||
"Take relay semaphore... ", Dummy, Dummy);
|
||||
|
||||
if (xSemaphoreTake(remoteRelaySemaphore, 0) == pdTRUE)
|
||||
{
|
||||
sendString (SerOutPort, FALSE, importantMessage,
|
||||
"Done", Dummy, Dummy);
|
||||
}
|
||||
else
|
||||
{
|
||||
sendString (SerOutPort, FALSE, importantMessage,
|
||||
"Failed", Dummy, Dummy);
|
||||
}
|
||||
|
||||
|
||||
sendString(SerOutPort, TRUE, importantMessage,
|
||||
"reset remote relays...", Dummy, Dummy);
|
||||
set_mb = remoteRelaySetAll (remoteDeviceNumber, relay_mb, FALSE);
|
||||
set_eb = remoteRelaySetAll (remoteDeviceNumber, relay_eb, FALSE);
|
||||
if ((set_mb == OK) && (set_eb == OK))
|
||||
{
|
||||
sendString(SerOutPort, FALSE, importantMessage, "Done", Dummy, Dummy);
|
||||
}
|
||||
else
|
||||
{
|
||||
sendString(SerOutPort, FALSE, importantMessage, "Failed", Dummy, Dummy);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
RESULT remoteRelaySet (UINT8 device, UINT8 channel, BOOLEAN value)
|
||||
{
|
||||
INT32 sendArray[2];
|
||||
RESULT returnValue;
|
||||
|
||||
if (remoteRelayInitialised == FALSE)
|
||||
{
|
||||
/* Remote digital driver is not initialised */
|
||||
sendString (SerOutPort, TRUE, importantMessage,
|
||||
"\t\trelay not intialised", Dummy, Dummy);
|
||||
return (ERROR);
|
||||
}
|
||||
|
||||
|
||||
sendArray[0] = (INT32)channel;
|
||||
sendArray[1] = (INT32)value;
|
||||
|
||||
bpSendCallRpc(handleBus1, device, 28, 2, sendArray);
|
||||
|
||||
if (xSemaphoreTake(remoteRelaySemaphore, 3000) != pdTRUE)
|
||||
{
|
||||
sendString (SerOutPort, TRUE, importantMessage,
|
||||
s_tab, "relay set was not successful", Dummy);
|
||||
|
||||
returnValue = ERROR;
|
||||
}
|
||||
else
|
||||
{
|
||||
remoteRelayInputs[channel] = value;
|
||||
|
||||
returnValue = OK;
|
||||
}
|
||||
|
||||
return (returnValue);
|
||||
|
||||
}
|
||||
|
||||
|
||||
BOOLEAN remoteRelayRead (UINT8 device, UINT8 channel)
|
||||
{
|
||||
|
||||
if (remoteRelayInitialised == FALSE)
|
||||
{
|
||||
/* Remote digital driver is not initialised */
|
||||
sendString (SerOutPort, TRUE, importantMessage,
|
||||
"\t\trelay not intialised", Dummy, Dummy);
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
RESULT remoteRelaySetAll(UINT8 device, t_boardtype_relay board, BOOLEAN value)
|
||||
{
|
||||
INT32 sendArray[2];
|
||||
UINT32 loopcnt = 0;
|
||||
UINT32 loopend = 0;
|
||||
RESULT returnValue;
|
||||
|
||||
if (remoteRelayInitialised == FALSE)
|
||||
{
|
||||
/* Remote digital driver is not initialised */
|
||||
sendString (SerOutPort, TRUE, importantMessage,
|
||||
"\t\trelay not intialised", Dummy, Dummy);
|
||||
return (ERROR);
|
||||
}
|
||||
|
||||
sendArray[0] = (INT32)board;
|
||||
sendArray[1] = (INT32)value;
|
||||
|
||||
bpSendCallRpc(handleBus1, device, 29, 2, sendArray);
|
||||
|
||||
if (xSemaphoreTake(remoteRelaySemaphore, 3000) != pdTRUE)
|
||||
{
|
||||
sendString(SerOutPort, TRUE, importantMessage, s_tab,
|
||||
"relay set was not successful", Dummy);
|
||||
|
||||
returnValue = ERROR;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
switch (board)
|
||||
{
|
||||
case relay_mb:
|
||||
loopcnt = 0;
|
||||
loopend = NUMBER_OF_RLY_MB;
|
||||
break;
|
||||
|
||||
case relay_eb:
|
||||
loopcnt = NUMBER_OF_RLY_MB;
|
||||
loopend = NUMBER_OF_TOTAL_RLY;
|
||||
break;
|
||||
}
|
||||
|
||||
for (loopcnt; loopcnt < loopend; loopcnt++)
|
||||
{
|
||||
remoteRelayInputs[loopcnt] = value;
|
||||
}
|
||||
returnValue = OK;
|
||||
}
|
||||
|
||||
return (returnValue);
|
||||
}
|
||||
|
||||
|
||||
void remoteRelaySemaphoreRelease (UINT8 requestNr, UINT8 nrOfResults, UINT32 *results)
|
||||
{
|
||||
xSemaphoreGive (remoteRelaySemaphore);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
/* ---------------------------------------------------------------------------
|
||||
* remote_relay.h (c) 2008 Micro-key bv
|
||||
* ---------------------------------------------------------------------------
|
||||
* Micro-key bv
|
||||
* Industrieweg 28, 9804 TG Noordhorn
|
||||
* Postbus 92, 9800 AB Zuidhorn
|
||||
* The Netherlands
|
||||
* Tel: +31 594 503020
|
||||
* Fax: +31 594 505825
|
||||
* Email: support@microkey.nl
|
||||
* Web: www.microkey.nl
|
||||
* ---------------------------------------------------------------------------
|
||||
* Description:
|
||||
* ---------------------------------------------------------------------------
|
||||
* Version(s): 0.1, Dez 16, 2008, MMi
|
||||
* Creation.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef REMOTE_RELAY_H_
|
||||
#define REMOTE_RELAY_H_
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* System include files.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#include "LPC23xx.h"
|
||||
#include "types.h"
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Application include files.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Constant and macro definitions.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#define NUMBER_OF_RLY_MB 4
|
||||
#define NUMBER_OF_RLY_EB 2
|
||||
#define NUMBER_OF_TOTAL_RLY (NUMBER_OF_RLY_MB + NUMBER_OF_RLY_EB)
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Type definitions.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
relay_mb = 0,
|
||||
relay_eb = 1
|
||||
} t_boardtype_relay;
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Variable declarations.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
BOOLEAN remoteRelayInputs[(NUMBER_OF_TOTAL_RLY)];
|
||||
|
||||
xSemaphoreHandle remoteRelaySemaphore;
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Function declarations.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
void remoteRelayInit(void);
|
||||
|
||||
RESULT remoteRelaySet (UINT8 device, UINT8 channel, BOOLEAN value);
|
||||
|
||||
BOOLEAN remoteRelayRead (UINT8 device, UINT8 channel);
|
||||
|
||||
RESULT remoteRelaySetAll (UINT8 device, t_boardtype_relay board, BOOLEAN value);
|
||||
|
||||
void remoteRelaySemaphoreRelease (UINT8 requestNr, UINT8 nrOfResults, UINT32 *results);
|
||||
|
||||
|
||||
#endif /*REMOTE_RELAY_H_*/
|
||||
@@ -0,0 +1,331 @@
|
||||
/* ---------------------------------------------------------------------------
|
||||
* remote_tests.c (c) 2008 Micro-key bv
|
||||
* ---------------------------------------------------------------------------
|
||||
* Micro-key bv
|
||||
* Industrieweg 28, 9804 TG Noordhorn
|
||||
* Postbus 92, 9800 AB Zuidhorn
|
||||
* The Netherlands
|
||||
* Tel: +31 594 503020
|
||||
* Fax: +31 594 505825
|
||||
* Email: support@microkey.nl
|
||||
* Web: www.microkey.nl
|
||||
* ---------------------------------------------------------------------------
|
||||
* Description: Function to call single tests on remote system
|
||||
*
|
||||
* NOTE: allMemoryUseSameLED is defined in taskfunctions.h
|
||||
*
|
||||
* ---------------------------------------------------------------------------
|
||||
* Version(s): 0.1, Aug 29, 2008, MMi
|
||||
* Creation.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* System include files
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#include "LPC23xx.h"
|
||||
#include "types.h"
|
||||
|
||||
/* FreeRTOS includes */
|
||||
#include "FreeRTOS.h"
|
||||
#include "Task.h"
|
||||
#include "semphr.h"
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Application include files
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#include "remote_tests.h"
|
||||
#include "SerOut.h"
|
||||
#include "dio.h"
|
||||
#include "ledfunctions.h"
|
||||
#include "protocolfunctions.h"
|
||||
#include "taskfunctions.h"
|
||||
#include "BusProtocol.h"
|
||||
|
||||
/* Test includes */
|
||||
#include "testLED.h"
|
||||
#include "testdio.h"
|
||||
#include "testaio.h"
|
||||
#include "testBUS.h"
|
||||
#include "testeeprom.h"
|
||||
#include "testMMC.h"
|
||||
#include "testpower.h"
|
||||
#include "testrtc.h"
|
||||
|
||||
#include "remote_analogue.h"
|
||||
#include "remote_digital.h"
|
||||
#include "remote_relay.h"
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Local constant and macro definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Global variable definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
extern BOOLEAN auto_testResult;
|
||||
extern BOOLEAN GotoNewLine;
|
||||
extern BOOLEAN block_SpinningWheel;
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Local variable definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Local function definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
void r_TestInit (void)
|
||||
{
|
||||
remoteDioInit();
|
||||
vTaskDelay (200);
|
||||
remoteAioInit();
|
||||
vTaskDelay (200);
|
||||
remoteRelayInit();
|
||||
vTaskDelay (200);
|
||||
}
|
||||
|
||||
|
||||
void r_BatteryTest (BOOLEAN * batterytest)
|
||||
{
|
||||
/* Test for Battery and batterysupplied Memory */
|
||||
sendString(SerOutPort, TRUE, headerMessage,
|
||||
StartMessage, f_lines, "Battery Test");
|
||||
bpSendCallRpc(handleBus1, 2, 17, 0, NULL); /* Write on Battery Memory */
|
||||
sendString(SerOutPort, TRUE, noteMessage,
|
||||
NewLine, "\t\tSwitch SLAVE OFF for 5 Seconds", Dummy);
|
||||
if (xSemaphoreTake(slaveRestartSemaphore, 60000) == pdPASS)
|
||||
{ /* Wait for slave Restart */
|
||||
bpSendCallRpc(handleBus1, 2, 18, 0, NULL); /* Read from Memory */
|
||||
xSemaphoreTake(generalSemaphore, 3000);
|
||||
}
|
||||
else
|
||||
{
|
||||
auto_testResult = FALSE;
|
||||
xSemaphoreGive (slaveRestartSemaphore);
|
||||
}
|
||||
|
||||
*batterytest = auto_testResult;
|
||||
#if (allMemoryUseSameLED == 1)
|
||||
postpareTest(*batterytest, &d_batteryled, BATTERYLED, (void *)dioToggle,
|
||||
(pUINT8) "batteryerror", &batteryled);
|
||||
#endif
|
||||
bpSendCallRpc(handleBus1, 2, 4, 0, NULL); /* Call dioClean() */
|
||||
sendString (SerOutPort, TRUE, resultMessage,
|
||||
"n\rBATTERY Test Result: ", s_lines, BoolRestoStr (*batterytest));
|
||||
|
||||
}
|
||||
|
||||
|
||||
void r_LEDTest (BOOLEAN * ledtest)
|
||||
{
|
||||
/* Local Variable declaration */
|
||||
UINT8 buffer = 0;
|
||||
UINT8 captureDio;
|
||||
UINT8 dioAllOn = 0xFF;
|
||||
BOOLEAN receive = FALSE;
|
||||
|
||||
/* Test for all accessable LEDs */
|
||||
sendString(SerOutPort, TRUE, headerMessage,
|
||||
StartMessage, f_lines, "LED TEST");
|
||||
captureDio = dioCapture();
|
||||
diotaskssuspend();
|
||||
dioResume (dioAllOn);
|
||||
bpSendCallRpc(handleBus1, 2, 21, 0, NULL); /* Call ledTest() */
|
||||
sendString (SerOutPort, TRUE, noteMessage,
|
||||
"\n\tAre all LEDs turned on? ",
|
||||
"\n\r\tPRESS y (YES) oder n (NO): ",
|
||||
NewLine);
|
||||
|
||||
do /* do-while loop for String input */
|
||||
{
|
||||
vTaskDelay (10);
|
||||
buffer = 0;
|
||||
receive = serGet(SerOutPort, &buffer);
|
||||
|
||||
} while ((buffer != 121) && (buffer != 110));
|
||||
|
||||
if (buffer == 121) /* 121 = y (ScanCode) */
|
||||
{
|
||||
*ledtest = TRUE;
|
||||
}
|
||||
else if (buffer == 110) /* 110 = n (ScanCode) */
|
||||
{
|
||||
*ledtest = FALSE;
|
||||
}
|
||||
xSemaphoreTake(generalSemaphore, 5000);
|
||||
dioResume(captureDio);
|
||||
diotasksresume();
|
||||
bpSendCallRpc(handleBus1, 2, 32, 0, NULL); /* Postpare Test on Slave */
|
||||
postpareTest(*ledtest, &d_ledtestled, LEDTESTLED, (void *)dioToggle,
|
||||
(pUINT8) "LEDerror", &ledtestled);
|
||||
bpSendCallRpc(handleBus1, 2, 4, 0, NULL); /* Call dioClean() */
|
||||
sendString (SerOutPort, GotoNewLine, resultMessage,
|
||||
"n\rLED Test Result: ", s_lines, BoolRestoStr (*ledtest));
|
||||
}
|
||||
|
||||
|
||||
void r_EEPROMTest (BOOLEAN * eepromtest)
|
||||
{
|
||||
/* Test for EEPROM Memory */
|
||||
sendString(SerOutPort, TRUE, headerMessage,
|
||||
StartMessage, f_lines, "EEPROM");
|
||||
sendString (SerOutPort, FALSE, importantMessage,
|
||||
"\t", Dummy, Dummy);
|
||||
|
||||
block_SpinningWheel = FALSE;
|
||||
bpSendCallRpc(handleBus1, 2, 22, 0, NULL); /* Call eepromTest() */
|
||||
|
||||
if (xSemaphoreTake(generalSemaphore, 5000) != pdPASS)
|
||||
{
|
||||
block_SpinningWheel = TRUE;
|
||||
sendString (SerOutPort, TRUE, importantMessage,
|
||||
"\tTimeout occoured!", Dummy, Dummy);
|
||||
auto_testResult = FALSE;
|
||||
xSemaphoreGive (generalSemaphore);
|
||||
}
|
||||
block_SpinningWheel = TRUE;
|
||||
*eepromtest = auto_testResult;
|
||||
#if (allMemoryUseSameLED == 0)
|
||||
postpareTest(*eepromtest, &d_eepromled, EEPROMLED, (void *)dioToggle,
|
||||
(pUINT8) "EEPROMerror", eepromled);
|
||||
#else
|
||||
postpareTest(*eepromtest, &d_memoryled, MEMORYLED, (void *)dioToggle,
|
||||
(pUINT8) "memoryerror", &memoryled);
|
||||
#endif
|
||||
bpSendCallRpc(handleBus1, 2, 4, 0, NULL); /* Call dioClean() */
|
||||
sendString(SerOutPort, GotoNewLine, resultMessage,
|
||||
"\n\rEEPROM Test Result:",
|
||||
s_lines, BoolRestoStr(*eepromtest));
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
void r_MMCTest(BOOLEAN * mmctest)
|
||||
{
|
||||
/* Test for Multimedia Card */
|
||||
sendString(SerOutPort, TRUE, headerMessage,
|
||||
StartMessage, f_lines, "MMC");
|
||||
sendString (SerOutPort, FALSE, importantMessage,
|
||||
"\t", Dummy, Dummy);
|
||||
|
||||
block_SpinningWheel = FALSE;
|
||||
bpSendCallRpc(handleBus1, 2, 27, 0, NULL); /* Call MMCTest() */
|
||||
|
||||
if (xSemaphoreTake(generalSemaphore, 5000) != pdPASS)
|
||||
{
|
||||
block_SpinningWheel = TRUE;
|
||||
sendString(SerOutPort, TRUE, importantMessage, "\tTimeout occoured!",
|
||||
Dummy, Dummy);
|
||||
auto_testResult = FALSE;
|
||||
xSemaphoreGive (generalSemaphore);
|
||||
}
|
||||
|
||||
block_SpinningWheel = TRUE;
|
||||
*mmctest = auto_testResult;
|
||||
|
||||
postpareTest(*mmctest, &d_mmcled, MMCLED, (void *)dioToggle,
|
||||
(pUINT8) "MMCerror", &mmcled);
|
||||
sendString(SerOutPort, GotoNewLine, resultMessage,
|
||||
"\n\rMMC Test Result: ", s_lines, BoolRestoStr(*mmctest));
|
||||
}
|
||||
|
||||
|
||||
void r_PowerTest (BOOLEAN * powertest)
|
||||
{ /* Test for Power Supply */
|
||||
sendString(SerOutPort, TRUE, headerMessage,
|
||||
StartMessage, f_lines, "Power Supply");
|
||||
sendString (SerOutPort, FALSE, importantMessage,
|
||||
"\t", Dummy, Dummy);
|
||||
|
||||
block_SpinningWheel = FALSE;
|
||||
bpSendCallRpc(handleBus1, 2, 28, 0, NULL); /* Call eepromTest() */
|
||||
|
||||
if (xSemaphoreTake(generalSemaphore, 5000) != pdPASS)
|
||||
{
|
||||
block_SpinningWheel = TRUE;
|
||||
sendString (SerOutPort, TRUE, importantMessage,
|
||||
"\tTimeout occoured!", Dummy, Dummy);
|
||||
auto_testResult = FALSE;
|
||||
xSemaphoreGive (generalSemaphore);
|
||||
}
|
||||
block_SpinningWheel = TRUE;
|
||||
*powertest = auto_testResult;
|
||||
postpareTest(*powertest, &d_powerled, POWERLED, (void *)dioToggle,
|
||||
(pUINT8) "POWERerror", &powerled);
|
||||
|
||||
sendString(SerOutPort, GotoNewLine, resultMessage,
|
||||
"\n\rPower Supply Test Result:",
|
||||
f_lines, BoolRestoStr(*powertest));
|
||||
}
|
||||
|
||||
|
||||
void r_RTCTest (BOOLEAN * rtctest)
|
||||
{ /* Test for Real Time Clock */
|
||||
sendString(SerOutPort, TRUE, headerMessage,
|
||||
StartMessage, f_lines, "RealTimeClock");
|
||||
sendString (SerOutPort, FALSE, importantMessage,
|
||||
"\t", Dummy, Dummy);
|
||||
|
||||
block_SpinningWheel = FALSE;
|
||||
bpSendCallRpc(handleBus1, 2, 29, 0, NULL); /* Call eepromTest() */
|
||||
|
||||
if (xSemaphoreTake(generalSemaphore, 5000) != pdPASS)
|
||||
{
|
||||
block_SpinningWheel = TRUE;
|
||||
sendString (SerOutPort, TRUE, importantMessage,
|
||||
"\tTimeout occoured!", Dummy, Dummy);
|
||||
auto_testResult = FALSE;
|
||||
xSemaphoreGive (generalSemaphore);
|
||||
}
|
||||
block_SpinningWheel = TRUE;
|
||||
*rtctest = auto_testResult;
|
||||
postpareTest(*rtctest, &d_rtcled, RTCLED, (void *)dioToggle,
|
||||
(pUINT8) "RTCerror", &rtcled);
|
||||
|
||||
sendString(SerOutPort, GotoNewLine, resultMessage,
|
||||
"\n\rRealTimeClock Test Result:",
|
||||
f_lines, BoolRestoStr(*rtctest));
|
||||
}
|
||||
|
||||
|
||||
/* Function to handle all necessary commands and calculations after a
|
||||
* single test. Because these are all the same, they are done in a
|
||||
* extra function
|
||||
*/
|
||||
void postpareTest (BOOLEAN TestResult, portBASE_TYPE *basetype,
|
||||
UINT32 LEDNumber, pdTASK_CODE TaskCode,
|
||||
pUINT8 taskname, xTaskHandle *pTaskHandler)
|
||||
{
|
||||
|
||||
if (TestResult == TRUE)
|
||||
{ /* if Test is passed */
|
||||
if (*basetype == pdPASS) /* If defined Task exists */
|
||||
{
|
||||
vTaskDelete (*pTaskHandler);/* Delete defined Task */
|
||||
*basetype = 0; /* Reset corresponding bastetype */
|
||||
}
|
||||
dioWrite( 0, LEDNumber, TRUE); /* illume corresponding LED */
|
||||
}
|
||||
else
|
||||
{ /* if DIO Test fails */
|
||||
if (*basetype == pdPASS)
|
||||
{
|
||||
/* Task already exists, so do nothing */
|
||||
}
|
||||
else
|
||||
{
|
||||
*basetype = xTaskCreate((void *)TaskCode,
|
||||
( signed portCHAR * ) taskname,
|
||||
configMINIMAL_STACK_SIZE, (UINT16 *)LEDNumber,
|
||||
tskIDLE_PRIORITY + 2, pTaskHandler);
|
||||
} /* Create Task to flash LED */
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
/* ---------------------------------------------------------------------------
|
||||
* remote_tests.h (c) 2008 Micro-key bv
|
||||
* ---------------------------------------------------------------------------
|
||||
* Micro-key bv
|
||||
* Industrieweg 28, 9804 TG Noordhorn
|
||||
* Postbus 92, 9800 AB Zuidhorn
|
||||
* The Netherlands
|
||||
* Tel: +31 594 503020
|
||||
* Fax: +31 594 505825
|
||||
* Email: support@microkey.nl
|
||||
* Web: www.microkey.nl
|
||||
* ---------------------------------------------------------------------------
|
||||
* Description:
|
||||
* ---------------------------------------------------------------------------
|
||||
* Version(s): 0.1, Aug 29, 2008, MMi
|
||||
* Creation.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef REMOTE_TESTS_H_
|
||||
#define REMOTE_TESTS_H_
|
||||
/* ---------------------------------------------------------------------------
|
||||
* System include files.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#include "LPC23xx.h"
|
||||
#include "types.h"
|
||||
|
||||
/* FreeRTOS includes */
|
||||
#include "FreeRTOS.h"
|
||||
#include "Task.h"
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Application include files.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Constant and macro definitions.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Type definitions.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Variable declarations.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Function declarations.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
void r_TestInit (void);
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Function: r_xyzTest
|
||||
*
|
||||
* Functions that call the corresponding test on remote Device and handle
|
||||
* some optical commands like Result printout and LED controlling
|
||||
*
|
||||
* Parameter: BOOLEAN * xyztest - Test Result is written to this variable
|
||||
*
|
||||
* Return: void
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
void r_BatteryTest (BOOLEAN * batterytest);
|
||||
void r_LEDTest (BOOLEAN * ledtest);
|
||||
void r_framTest (BOOLEAN * framtest);
|
||||
void r_EEPROMTest (BOOLEAN * eepromtest);
|
||||
void r_FLASHTest (BOOLEAN * flashtest);
|
||||
void r_LogTest (BOOLEAN *logtest);
|
||||
void r_DIOTest (BOOLEAN * diotest);
|
||||
void r_AIOTest (BOOLEAN * aiotest);
|
||||
void r_MMCTest (BOOLEAN * mmctest);
|
||||
void r_PowerTest (BOOLEAN * powertest);
|
||||
void r_RTCTest (BOOLEAN * rtctest);
|
||||
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Function: postpareTest
|
||||
*
|
||||
* Function to manage all needed things after a Test - e.g. Restore
|
||||
* DIO-Results or Create/Resume Tasks.
|
||||
*
|
||||
* Parameter: BOOLEAN TestResult - Testresult of current Test
|
||||
* portBASE_TYPE *basetype - TaskCreation Result
|
||||
* UINT32 LEDNumber - LEDNumber to be used for that Test
|
||||
* pdTASK_CODE TaskCode - Function, that should be tasked
|
||||
* pUINT8 taskname - Name for the Task
|
||||
* xTaskHandle *pTaskHandler - TaskHandler
|
||||
*
|
||||
* Return: void
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
void postpareTest (BOOLEAN TestResult, portBASE_TYPE *basetype,
|
||||
UINT32 LEDNumber, pdTASK_CODE TaskCode,
|
||||
pUINT8 taskname, xTaskHandle *pTaskHandler);
|
||||
|
||||
#endif /*REMOTE_TESTS_H_*/
|
||||
@@ -0,0 +1,341 @@
|
||||
/* ---------------------------------------------------------------------------
|
||||
* test_analogue.c (c) 2008 Micro-key bv
|
||||
* ---------------------------------------------------------------------------
|
||||
* Micro-key bv
|
||||
* Industrieweg 28, 9804 TG Noordhorn
|
||||
* Postbus 92, 9800 AB Zuidhorn
|
||||
* The Netherlands
|
||||
* Tel: +31 594 503020
|
||||
* Fax: +31 594 505825
|
||||
* Email: support@microkey.nl
|
||||
* Web: www.microkey.nl
|
||||
* ---------------------------------------------------------------------------
|
||||
* Description:
|
||||
* ---------------------------------------------------------------------------
|
||||
* Version(s): 0.1, Dez 15, 2008, MMi
|
||||
* Creation.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* System include files
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#include "LPC23xx.h"
|
||||
#include "types.h"
|
||||
|
||||
/* FreeRTOS includes */
|
||||
#include "FreeRTOS.h"
|
||||
#include "Task.h"
|
||||
#include "semphr.h"
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Application include files
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#include "test_analogue.h"
|
||||
#include "remote_analogue.h"
|
||||
#include "adc.h"
|
||||
#include "dac.h"
|
||||
|
||||
#include "remote_tests.h"
|
||||
#include "SerOut.h"
|
||||
#include "protocolfunctions.h"
|
||||
#include "BusProtocol.h"
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Local constant and macro definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#define cTestvalue 15000
|
||||
#define cNullvalue 0
|
||||
|
||||
#define ciTolerance_null 50
|
||||
#define ciTolerance_uncal 3500
|
||||
#define ciTolerance_cal 50
|
||||
|
||||
#define coTolerance_null 50
|
||||
#define coTolerance_uncal 3500
|
||||
#define coTolerance_cal 50
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Global variable definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Local variable definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Local function definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
BOOLEAN remoteAnalogueLinetestMBExecute (void)
|
||||
{
|
||||
BOOLEAN returnValue;
|
||||
BOOLEAN remoteAnalogueOutput;
|
||||
BOOLEAN remoteAnalogueInput;
|
||||
|
||||
remoteAnalogueOutput = remoteAnalogueOutputTest_MB();
|
||||
sendString (SerOutPort, TRUE, resultMessage,
|
||||
"remote analogue output test: ", f_tab, BoolRestoStr(remoteAnalogueOutput));
|
||||
|
||||
remoteAnalogueInput = remoteAnalogueInputTest_MB();
|
||||
sendString (SerOutPort, TRUE, resultMessage,
|
||||
"remote analogue input test: ", f_tab, BoolRestoStr(remoteAnalogueInput));
|
||||
|
||||
if ((remoteAnalogueOutput == TRUE) && (remoteAnalogueInput == TRUE))
|
||||
{
|
||||
returnValue = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
returnValue = FALSE;
|
||||
}
|
||||
|
||||
return (returnValue);
|
||||
|
||||
}
|
||||
|
||||
|
||||
BOOLEAN remoteAnalogueLinetestEBExecute (void)
|
||||
{
|
||||
// \MARK NEW PINSETTINGS FOR TESTER (2)
|
||||
#if (PINSET_TESTER == 2)
|
||||
BOOLEAN remoteAnalogueOutput;
|
||||
BOOLEAN remoteAnalogueInput;
|
||||
|
||||
remoteAnalogueOutput = remoteAnalogueOutputTest_MB();
|
||||
sendString (SerOutPort, TRUE, resultMessage,
|
||||
"remote analogue output test: ", f_tab, BoolRestoStr(remoteAnalogueOutput));
|
||||
|
||||
remoteAnalogueInput = remoteAnalogueInputTest_MB();
|
||||
sendString (SerOutPort, TRUE, resultMessage,
|
||||
"remote analogue input test: ", f_tab, BoolRestoStr(remoteAnalogueInput));
|
||||
|
||||
if ((remoteAnalogueOutput == TRUE) && (remoteAnalogueInput == TRUE))
|
||||
{
|
||||
returnValue = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
returnValue = FALSE;
|
||||
}
|
||||
|
||||
return (returnValue);
|
||||
#else
|
||||
sendString (SerOutPort, TRUE, importantMessage,
|
||||
"Extension Board test not available on this device", Dummy, Dummy);
|
||||
|
||||
return (FALSE);
|
||||
#endif
|
||||
}
|
||||
|
||||
BOOLEAN remoteAnalogueOutputTest_MB (void)
|
||||
{
|
||||
UINT32 loopcnt;
|
||||
UINT32 channelcnt;
|
||||
UINT32 testTolerance;
|
||||
UINT32 lowRead;
|
||||
UINT32 highRead;
|
||||
|
||||
BOOLEAN returnResult = TRUE;
|
||||
BOOLEAN Low_Test = TRUE;
|
||||
BOOLEAN High_Test = TRUE;
|
||||
BOOLEAN AllOther_Test = TRUE;
|
||||
|
||||
|
||||
// \TODO SET TEST TOLERANCE DEPENDING ON THE CALIBRATION STATUS
|
||||
testTolerance = coTolerance_uncal;
|
||||
|
||||
adcModeAll(adcCURRENT); /* Set local ADC to mode CURRENT*/
|
||||
remoteAioWriteAll(remoteDeviceNumber, analogue_mb, cNullvalue);
|
||||
vTaskDelay (500);
|
||||
|
||||
sendString (SerOutPort, FALSE, testMessage, NewLine,
|
||||
"\tCurrent Test Value: ", ItoDStr (cTestvalue));
|
||||
sendString (SerOutPort, FALSE, testMessage,
|
||||
"\t\tTolerance: ", ItoDStr (testTolerance), Dummy);
|
||||
|
||||
for (channelcnt = 0; channelcnt < NUMBER_OF_AO_MB; channelcnt++)
|
||||
{
|
||||
lowRead = adcRead(thisDeviceNumber, channelcnt);
|
||||
if (lowRead < (cNullvalue + coTolerance_null))
|
||||
{
|
||||
/* Read a null-like value - LOW test passed */
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Read a too high value - LOW test failed */
|
||||
Low_Test = FALSE;
|
||||
}
|
||||
|
||||
remoteAioWrite(remoteDeviceNumber, channelcnt, cTestvalue);
|
||||
vTaskDelay (500);
|
||||
highRead = adcRead(thisDeviceNumber, channelcnt);
|
||||
|
||||
if ((highRead < (cTestvalue + testTolerance)) && (highRead > (cTestvalue - testTolerance)))
|
||||
{
|
||||
/* Read a value within the test tolerances - High test passed */
|
||||
}
|
||||
else
|
||||
{
|
||||
/* read a value out of the test tolerances - High test failed */
|
||||
High_Test = FALSE;
|
||||
}
|
||||
|
||||
for (loopcnt = 0; loopcnt < NUMBER_OF_AO_MB; loopcnt++)
|
||||
{
|
||||
if (loopcnt == channelcnt)
|
||||
{
|
||||
/* Skip actual test channel */
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Check channel for remaining LOW */
|
||||
if (adcRead(thisDeviceNumber, loopcnt) >= (cNullvalue + coTolerance_null))
|
||||
{
|
||||
/* Actual channels value too high, AllOther test failed */
|
||||
AllOther_Test = FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
remoteAioWrite(remoteDeviceNumber, channelcnt, cNullvalue);
|
||||
|
||||
/* Message out Test Results */
|
||||
sendString (SerOutPort, TRUE, testMessage,
|
||||
"\tCurrent Test for Analogue Input ", ItoDStr(channelcnt), ": ");
|
||||
sendString (SerOutPort, FALSE, testMessage,
|
||||
" ", Dummy, ItoDStr (lowRead));
|
||||
sendString (SerOutPort, FALSE, testMessage,
|
||||
" ", Dummy, ItoDStr (highRead));
|
||||
sendString (SerOutPort, FALSE, testMessage,
|
||||
" All Other: ", Dummy, BoolRestoStr (AllOther_Test));
|
||||
|
||||
if ((Low_Test == FALSE) || (High_Test == FALSE) || (AllOther_Test == FALSE))
|
||||
{
|
||||
returnResult = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
return (returnResult);
|
||||
}
|
||||
|
||||
|
||||
|
||||
BOOLEAN remoteAnalogueInputTest_MB (void)
|
||||
{
|
||||
UINT32 loopcnt;
|
||||
UINT32 channelcnt;
|
||||
UINT32 testTolerance;
|
||||
UINT32 lowRead;
|
||||
UINT32 highRead;
|
||||
|
||||
BOOLEAN returnResult = TRUE;
|
||||
BOOLEAN Low_Test = TRUE;
|
||||
BOOLEAN High_Test = TRUE;
|
||||
BOOLEAN AllOther_Test = TRUE;
|
||||
|
||||
// \TODO SET TEST TOLERANCE DEPENDING ON THE CALIBRATION STATUS
|
||||
testTolerance = coTolerance_uncal;
|
||||
|
||||
dacModeAll(dacCURRENT); /* Set local DAC to mode CURRENT*/
|
||||
/* Reset all local DAC channels to zero ampere */
|
||||
for (loopcnt = 0; loopcnt < maxDAC_Channels; loopcnt++)
|
||||
{
|
||||
dacWrite(thisDeviceNumber, loopcnt, cNullvalue);
|
||||
}
|
||||
|
||||
vTaskDelay (500);
|
||||
|
||||
sendString (SerOutPort, FALSE, testMessage, NewLine,
|
||||
"\tCurrent Test Value: ", ItoDStr (cTestvalue));
|
||||
sendString (SerOutPort, FALSE, testMessage,
|
||||
"\t\tTolerance: ", ItoDStr (testTolerance), Dummy);
|
||||
|
||||
for (channelcnt = 0; channelcnt < NUMBER_OF_AI_MB; channelcnt++)
|
||||
{
|
||||
lowRead = remoteAioRead(remoteDeviceNumber, channelcnt);
|
||||
if (lowRead < (cNullvalue + testTolerance))
|
||||
{
|
||||
/* Read a null-like value - LOW test passed */
|
||||
Low_Test = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Read a too high value - LOW test failed */
|
||||
Low_Test = FALSE;
|
||||
}
|
||||
|
||||
dacWrite(thisDeviceNumber, channelcnt, cTestvalue);
|
||||
vTaskDelay (200);
|
||||
highRead = remoteAioRead(remoteDeviceNumber, channelcnt);
|
||||
|
||||
if ((highRead < (cTestvalue + testTolerance)) && (highRead > (cTestvalue - testTolerance)))
|
||||
{
|
||||
/* Read a value within the test tolerances - High test passed */
|
||||
High_Test = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* read a value out of the test tolerances - High test failed */
|
||||
High_Test = FALSE;
|
||||
}
|
||||
|
||||
remoteAioReadAll(remoteDeviceNumber, analogue_mb);
|
||||
vTaskDelay (200);
|
||||
|
||||
for (loopcnt = 0; loopcnt < NUMBER_OF_AO_MB; loopcnt++)
|
||||
{
|
||||
if (loopcnt == channelcnt)
|
||||
{
|
||||
/* Skip test channel */
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Check actual channel to remain LOW */
|
||||
if (remoteAnalogueOutputs[loopcnt] >= (cNullvalue + ciTolerance_null))
|
||||
{
|
||||
/* Channel should remain LOW - AllOther test failed */
|
||||
AllOther_Test = FALSE;
|
||||
break; /* Skip rest of loop */
|
||||
}
|
||||
else
|
||||
{
|
||||
AllOther_Test = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dacWrite(thisDeviceNumber, channelcnt, cNullvalue);
|
||||
|
||||
/* Message out Test Results */
|
||||
sendString (SerOutPort, TRUE, testMessage,
|
||||
"\tCurrent Test for Analogue Input ", ItoDStr(channelcnt), ": ");
|
||||
sendString (SerOutPort, FALSE, testMessage,
|
||||
" ", Dummy, ItoDStr (lowRead));
|
||||
sendString (SerOutPort, FALSE, testMessage,
|
||||
" ", Dummy, ItoDStr (highRead));
|
||||
sendString (SerOutPort, FALSE, testMessage,
|
||||
" All Other: ", Dummy, BoolRestoStr (AllOther_Test));
|
||||
|
||||
if ((Low_Test == FALSE) || (High_Test == FALSE) || (AllOther_Test == FALSE))
|
||||
{
|
||||
returnResult = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
return (returnResult);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
BOOLEAN remoteAnalogueOutputTest_EB (void)
|
||||
{
|
||||
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
/* ---------------------------------------------------------------------------
|
||||
* test_analogue.h (c) 2008 Micro-key bv
|
||||
* ---------------------------------------------------------------------------
|
||||
* Micro-key bv
|
||||
* Industrieweg 28, 9804 TG Noordhorn
|
||||
* Postbus 92, 9800 AB Zuidhorn
|
||||
* The Netherlands
|
||||
* Tel: +31 594 503020
|
||||
* Fax: +31 594 505825
|
||||
* Email: support@microkey.nl
|
||||
* Web: www.microkey.nl
|
||||
* ---------------------------------------------------------------------------
|
||||
* Description:
|
||||
* ---------------------------------------------------------------------------
|
||||
* Version(s): 0.1, Dez 15, 2008, MMi
|
||||
* Creation.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef TEST_ANALOGUE_H_
|
||||
#define TEST_ANALOGUE_H_
|
||||
/* ---------------------------------------------------------------------------
|
||||
* System include files.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#include "LPC23xx.h"
|
||||
#include "types.h"
|
||||
|
||||
/* FreeRTOS includes */
|
||||
#include "FreeRTOS.h"
|
||||
#include "Task.h"
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Application include files.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Constant and macro definitions.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Type definitions.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Variable declarations.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Function declarations.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
BOOLEAN remoteAnalogueLinetestMBExecute (void);
|
||||
|
||||
BOOLEAN remoteAnalogueLinetestEBExecute (void);
|
||||
|
||||
BOOLEAN remoteAnalogueOutputTest_MB (void);
|
||||
|
||||
BOOLEAN remoteAnalogueInputTest_MB (void);
|
||||
|
||||
BOOLEAN remoteAnalogueOutputTest_EB (void);
|
||||
|
||||
BOOLEAN remoteAnalogueInputTest_EB (void);
|
||||
|
||||
|
||||
#endif /*TEST_ANALOGUE_H_*/
|
||||
@@ -0,0 +1,499 @@
|
||||
/* ---------------------------------------------------------------------------
|
||||
* test_digital.c (c) 2008 Micro-key bv
|
||||
* ---------------------------------------------------------------------------
|
||||
* Micro-key bv
|
||||
* Industrieweg 28, 9804 TG Noordhorn
|
||||
* Postbus 92, 9800 AB Zuidhorn
|
||||
* The Netherlands
|
||||
* Tel: +31 594 503020
|
||||
* Fax: +31 594 505825
|
||||
* Email: support@microkey.nl
|
||||
* Web: www.microkey.nl
|
||||
* ---------------------------------------------------------------------------
|
||||
* Description:
|
||||
* ---------------------------------------------------------------------------
|
||||
* Version(s): 0.1, Dez 15, 2008, MMi
|
||||
* Creation.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* System include files
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#include "LPC23xx.h"
|
||||
#include "types.h"
|
||||
|
||||
/* FreeRTOS includes */
|
||||
#include "FreeRTOS.h"
|
||||
#include "Task.h"
|
||||
#include "semphr.h"
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Application include files
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#include "test_digital.h"
|
||||
#include "remote_digital.h"
|
||||
|
||||
#include "dio.h"
|
||||
#include "remote_tests.h"
|
||||
#include "SerOut.h"
|
||||
#include "protocolfunctions.h"
|
||||
#include "BusProtocol.h"
|
||||
#include "ledfunctions.h"
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Local constant and macro definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Global variable definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Local variable definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Local function definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
BOOLEAN remoteDigitalLinetestMBExecute (void)
|
||||
{
|
||||
BOOLEAN returnValue;
|
||||
BOOLEAN remoteDigitalOutput;
|
||||
BOOLEAN remoteDigitalInput;
|
||||
|
||||
|
||||
remoteDigitalOutput = remoteDigitalOutputTest_MB();
|
||||
sendString (SerOutPort, TRUE, resultMessage,
|
||||
"remote digital_mb output test: ", f_tab, BoolRestoStr(remoteDigitalOutput));
|
||||
remoteDigitalInput = remoteDigitalInputTest_MB();
|
||||
sendString (SerOutPort, TRUE, resultMessage,
|
||||
"remote digital_mb input test: ", f_tab, BoolRestoStr(remoteDigitalInput));
|
||||
|
||||
if ((remoteDigitalOutput == TRUE) && (remoteDigitalInput == TRUE))
|
||||
{
|
||||
returnValue = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
returnValue = FALSE;
|
||||
}
|
||||
|
||||
return (returnValue);
|
||||
}
|
||||
|
||||
BOOLEAN remoteDigitalLinetestEBExecute (void)
|
||||
{
|
||||
// \MARK NEW PINSETTINGS FOR TESTER (2)
|
||||
#if (PINSET_TESTER == 2)
|
||||
BOOLEAN returnValue;
|
||||
BOOLEAN remoteDigitalOutput;
|
||||
BOOLEAN remoteDigitalInput;
|
||||
|
||||
remoteDigitalOutput = remoteDigitalOutputTest_EB();
|
||||
sendString (SerOutPort, TRUE, resultMessage,
|
||||
"remote digital_eb output test: ", f_tab, BoolRestoStr(remoteDigitalOutput));
|
||||
|
||||
remoteDigitalInput = remoteDigitalInputTest_EB();
|
||||
sendString (SerOutPort, TRUE, resultMessage,
|
||||
"remote digital_eb input test: ", f_tab, BoolRestoStr(remoteDigitalInput));
|
||||
|
||||
if ((remoteDigitalOutput == TRUE) && (remoteDigitalInput == TRUE))
|
||||
{
|
||||
returnValue = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
returnValue = FALSE;
|
||||
}
|
||||
|
||||
return (returnValue);
|
||||
#else
|
||||
sendString (SerOutPort, TRUE, importantMessage,
|
||||
"Extension Board test not available on this device", Dummy, Dummy);
|
||||
|
||||
return (FALSE);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
BOOLEAN remoteDigitalOutputTest_MB (void)
|
||||
{
|
||||
UINT32 channelcnt;
|
||||
UINT32 loopcnt;
|
||||
|
||||
BOOLEAN returnResult = TRUE;
|
||||
BOOLEAN Low_Test = TRUE;
|
||||
BOOLEAN High_Test = TRUE;
|
||||
BOOLEAN AllOther_Test = TRUE;
|
||||
|
||||
/* Reset all remote digital outputs to LOW/OFF */
|
||||
remoteDioWriteAll(remoteDeviceNumber, digital_mb, FALSE);
|
||||
vTaskDelay (200);
|
||||
|
||||
for (channelcnt = 0; channelcnt < NUMBER_OF_DO_MB; channelcnt++)
|
||||
{
|
||||
|
||||
/* Read remote digital channel value for LOW test */
|
||||
if (dioRead(thisDeviceNumber, channelcnt) == FALSE)
|
||||
{
|
||||
/* Read back a LOW Value, which is correct - LOW test passed */
|
||||
Low_Test = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* read back a HIGH Value, which is incorrect - LOW test failed */
|
||||
Low_Test = FALSE;
|
||||
}
|
||||
|
||||
/* Drive testchannel to HIGH Output value */
|
||||
remoteDioWrite(remoteDeviceNumber, channelcnt, TRUE);
|
||||
vTaskDelay (200); /* Assure command was executed */
|
||||
|
||||
if (dioRead(thisDeviceNumber, channelcnt) == TRUE)
|
||||
{
|
||||
/* Read back a HIGH Value, which is correct - HIGH test passed */
|
||||
High_Test = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* read back a LOW Value, which is incorrect - HIGH test failed */
|
||||
High_Test = FALSE;
|
||||
}
|
||||
|
||||
vTaskDelay (200);
|
||||
/* Check all other channels for remaining at LOW */
|
||||
for (loopcnt = 0; loopcnt < NUMBER_OF_DO_MB; loopcnt++)
|
||||
{
|
||||
if (loopcnt == channelcnt)
|
||||
{
|
||||
/* Skip test channel */
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Check actual channel to remain LOW */
|
||||
if (dioRead(thisDeviceNumber, loopcnt) == TRUE)
|
||||
{
|
||||
/* Channel should remain LOW - AllOther test failed */
|
||||
AllOther_Test = FALSE;
|
||||
break; /* Skip rest of loop */
|
||||
}
|
||||
else
|
||||
{
|
||||
AllOther_Test = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
remoteDioWrite(remoteDeviceNumber, channelcnt, FALSE);
|
||||
|
||||
/* Message out Test Results */
|
||||
sendString (SerOutPort, TRUE, testMessage,
|
||||
"\tLinetest for Digital Input ", ItoDStr(channelcnt), ": ");
|
||||
sendString (SerOutPort, FALSE, testMessage,
|
||||
" ", Dummy, BoolRestoStr (Low_Test));
|
||||
sendString (SerOutPort, FALSE, testMessage,
|
||||
" ", Dummy, BoolRestoStr (AllOther_Test));
|
||||
sendString (SerOutPort, FALSE, testMessage,
|
||||
" ", Dummy, BoolRestoStr (High_Test));
|
||||
vTaskDelay (50);
|
||||
|
||||
if ((Low_Test == FALSE) || (High_Test == FALSE) || (AllOther_Test == FALSE))
|
||||
{
|
||||
returnResult = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
return (returnResult);
|
||||
}
|
||||
|
||||
BOOLEAN remoteDigitalInputTest_MB (void)
|
||||
{
|
||||
UINT32 channelcnt;
|
||||
UINT32 loopcnt;
|
||||
|
||||
BOOLEAN returnResult = TRUE;
|
||||
BOOLEAN Low_Test = TRUE;
|
||||
BOOLEAN High_Test = TRUE;
|
||||
BOOLEAN AllOther_Test = TRUE;
|
||||
|
||||
dioClean(); /* Clean local digital outputs */
|
||||
vTaskDelay (500);
|
||||
|
||||
for (channelcnt = 0; channelcnt < NUMBER_OF_DI_MB; channelcnt++)
|
||||
{
|
||||
if (remoteDioRead(remoteDeviceNumber, channelcnt) == FALSE)
|
||||
{
|
||||
/* Read back a LOW Value, which is correct - LOW test passed */
|
||||
Low_Test = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* read back a HIGH Value, which is incorrect - LOW test failed */
|
||||
Low_Test = FALSE;
|
||||
}
|
||||
|
||||
vTaskDelay (200);
|
||||
dioWrite(thisDeviceNumber, channelcnt, TRUE);
|
||||
vTaskDelay(200);
|
||||
|
||||
if (remoteDioRead(remoteDeviceNumber, channelcnt) == TRUE)
|
||||
{
|
||||
/* Read back a HIGH Value, which is correct - HIGH test passed */
|
||||
vTaskDelay(500);
|
||||
High_Test = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* read back a LOW Value, which is incorrect - HIGH test failed */
|
||||
vTaskDelay(500);
|
||||
High_Test = FALSE;
|
||||
}
|
||||
|
||||
remoteDioReadAll(remoteDeviceNumber, digital_mb);
|
||||
vTaskDelay (200);
|
||||
|
||||
for (loopcnt = 0; loopcnt < NUMBER_OF_DI_MB; loopcnt++)
|
||||
{
|
||||
if (loopcnt == channelcnt)
|
||||
{
|
||||
/* Skip test channel */
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Check actual channel to remain LOW */
|
||||
if (remoteDigitalInputs[loopcnt] == TRUE)
|
||||
{
|
||||
/* Channel should remain LOW - AllOther test failed */
|
||||
AllOther_Test = FALSE;
|
||||
break; /* Skip rest of loop */
|
||||
}
|
||||
else
|
||||
{
|
||||
AllOther_Test = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* Return to LOW channel value */
|
||||
dioWrite (thisDeviceNumber, channelcnt, FALSE);
|
||||
|
||||
/* Message out Test Results */
|
||||
sendString (SerOutPort, TRUE, testMessage,
|
||||
"\tLinetest for Digital Input ", ItoDStr(channelcnt), ": ");
|
||||
sendString (SerOutPort, FALSE, testMessage,
|
||||
" ", Dummy, BoolRestoStr (Low_Test));
|
||||
sendString (SerOutPort, FALSE, testMessage,
|
||||
" ", Dummy, BoolRestoStr (AllOther_Test));
|
||||
sendString (SerOutPort, FALSE, testMessage,
|
||||
" ", Dummy, BoolRestoStr (High_Test));
|
||||
vTaskDelay (50);
|
||||
|
||||
if ((Low_Test == FALSE) || (High_Test == FALSE) || (AllOther_Test == FALSE))
|
||||
{
|
||||
returnResult = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
return (returnResult);
|
||||
}
|
||||
|
||||
|
||||
BOOLEAN remoteDigitalOutputTest_EB (void)
|
||||
{
|
||||
UINT32 channelcnt;
|
||||
UINT32 loopcnt;
|
||||
|
||||
BOOLEAN returnResult = TRUE;
|
||||
BOOLEAN Low_Test = TRUE;
|
||||
BOOLEAN High_Test = TRUE;
|
||||
BOOLEAN AllOther_Test = TRUE;
|
||||
|
||||
// \MARK NEW PINSETTINGS FOR TESTER (2)
|
||||
#if (PINSET_TESTER == 2)
|
||||
dio_inMuxEn (TRUE); /* Switch dio to Extension Board*/
|
||||
#endif
|
||||
|
||||
/* Reset all remote digital outputs to LOW/OFF */
|
||||
remoteDioWriteAll(remoteDeviceNumber, digital_eb, FALSE);
|
||||
vTaskDelay (200);
|
||||
|
||||
for (channelcnt = NUMBER_OF_DO_MB; channelcnt < NUMBER_OF_TOTAL_DO; channelcnt++)
|
||||
{
|
||||
if (dioRead(thisDeviceNumber, (channelcnt - NUMBER_OF_DO_MB)) == FALSE)
|
||||
{
|
||||
/* Read back a LOW Value, which is correct - LOW test passed */
|
||||
Low_Test = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* read back a HIGH Value, which is incorrect - LOW test failed */
|
||||
Low_Test = FALSE;
|
||||
}
|
||||
|
||||
/* Drive testchannel to HIGH Output value */
|
||||
remoteDioWrite(remoteDeviceNumber, channelcnt, TRUE);
|
||||
vTaskDelay (200); /* Assure command was executed */
|
||||
|
||||
if (dioRead(remoteDeviceNumber, (channelcnt - NUMBER_OF_DO_MB)) == TRUE)
|
||||
{
|
||||
/* Read back a HIGH Value, which is correct - HIGH test passed */
|
||||
High_Test = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* read back a LOW Value, which is incorrect - HIGH test failed */
|
||||
High_Test = FALSE;
|
||||
}
|
||||
|
||||
vTaskDelay (200);
|
||||
for (loopcnt = 0; loopcnt < NUMBER_OF_DO_EB; loopcnt++)
|
||||
{
|
||||
if (loopcnt == channelcnt)
|
||||
{
|
||||
/* Skip test channel */
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Check actual channel to remain LOW */
|
||||
if (dioRead(thisDeviceNumber, loopcnt) == TRUE)
|
||||
{
|
||||
/* Channel should remain LOW - AllOther test failed */
|
||||
AllOther_Test = FALSE;
|
||||
break; /* Skip rest of loop */
|
||||
}
|
||||
else
|
||||
{
|
||||
AllOther_Test = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* Message out Test Results */
|
||||
sendString (SerOutPort, TRUE, testMessage,
|
||||
"\tLinetest for Digital Input ", ItoDStr(channelcnt), ": ");
|
||||
sendString (SerOutPort, FALSE, testMessage,
|
||||
" ", Dummy, BoolRestoStr (Low_Test));
|
||||
sendString (SerOutPort, FALSE, testMessage,
|
||||
" ", Dummy, BoolRestoStr (AllOther_Test));
|
||||
sendString (SerOutPort, FALSE, testMessage,
|
||||
" ", Dummy, BoolRestoStr (High_Test));
|
||||
vTaskDelay (50);
|
||||
|
||||
if ((Low_Test == FALSE) || (High_Test == FALSE) || (AllOther_Test == FALSE))
|
||||
{
|
||||
returnResult = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
// \MARK NEW PINSETTINGS FOR TESTER (2)
|
||||
#if (PINSET_TESTER == 2)
|
||||
dio_inMuxEn (FALSE); /* Switch dio back to main Board*/
|
||||
#endif
|
||||
|
||||
return (returnResult);
|
||||
}
|
||||
|
||||
|
||||
BOOLEAN remoteDigitalInputTest_EB (void)
|
||||
{
|
||||
UINT32 channelcnt;
|
||||
UINT32 loopcnt;
|
||||
|
||||
BOOLEAN returnResult = TRUE;
|
||||
BOOLEAN Low_Test = TRUE;
|
||||
BOOLEAN High_Test = TRUE;
|
||||
BOOLEAN AllOther_Test = TRUE;
|
||||
|
||||
// \MARK NEW PINSETTINGS FOR TESTER (2)
|
||||
#if (PINSET_TESTER == 2)
|
||||
dio_outMuxEn (TRUE); /* Switch dio to Extension Board*/
|
||||
#endif
|
||||
|
||||
dioClean(); /* Clean local digital outputs */
|
||||
vTaskDelay (500);
|
||||
|
||||
for (channelcnt = 0; channelcnt < NUMBER_OF_DI_EB; channelcnt++)
|
||||
{
|
||||
if (remoteDioRead(remoteDeviceNumber, (channelcnt + NUMBER_OF_DI_MB)) == FALSE)
|
||||
{
|
||||
/* Read back a LOW Value, which is correct - LOW test passed */
|
||||
Low_Test = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* read back a HIGH Value, which is incorrect - LOW test failed */
|
||||
Low_Test = FALSE;
|
||||
}
|
||||
|
||||
vTaskDelay (200);
|
||||
dioWrite(thisDeviceNumber, channelcnt, TRUE);
|
||||
|
||||
if (remoteDioRead(remoteDeviceNumber, (channelcnt + NUMBER_OF_DI_MB)) == TRUE)
|
||||
{
|
||||
/* Read back a HIGH Value, which is correct - HIGH test passed */
|
||||
High_Test = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* read back a LOW Value, which is incorrect - HIGH test failed */
|
||||
High_Test = FALSE;
|
||||
}
|
||||
|
||||
remoteDioReadAll(remoteDeviceNumber, digital_eb);
|
||||
vTaskDelay (200);
|
||||
|
||||
for (loopcnt = 0; loopcnt < NUMBER_OF_DI_EB; loopcnt++)
|
||||
{
|
||||
if (loopcnt == channelcnt)
|
||||
{
|
||||
/* Skip test channel */
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Check actual channel to remain LOW */
|
||||
if (remoteDigitalInputs[(loopcnt + NUMBER_OF_DI_MB)] == TRUE)
|
||||
{
|
||||
/* Channel should remain LOW - AllOther test failed */
|
||||
AllOther_Test = FALSE;
|
||||
break; /* Skip rest of loop */
|
||||
}
|
||||
else
|
||||
{
|
||||
AllOther_Test = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* Return to LOW channel value */
|
||||
dioWrite (thisDeviceNumber, channelcnt, FALSE);
|
||||
|
||||
/* Message out Test Results */
|
||||
sendString (SerOutPort, TRUE, testMessage,
|
||||
"\tLinetest for Digital Input ", ItoDStr(channelcnt), ": ");
|
||||
sendString (SerOutPort, FALSE, testMessage,
|
||||
" ", Dummy, BoolRestoStr (Low_Test));
|
||||
sendString (SerOutPort, FALSE, testMessage,
|
||||
" ", Dummy, BoolRestoStr (AllOther_Test));
|
||||
sendString (SerOutPort, FALSE, testMessage,
|
||||
" ", Dummy, BoolRestoStr (High_Test));
|
||||
vTaskDelay (50);
|
||||
|
||||
if ((Low_Test == FALSE) || (High_Test == FALSE) || (AllOther_Test == FALSE))
|
||||
{
|
||||
returnResult = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
// \MARK NEW PINSETTINGS FOR TESTER (2)
|
||||
#if (PINSET_TESTER == 2)
|
||||
dio_outMuxEn (FALSE); /* Switch dio back to main Board*/
|
||||
#endif
|
||||
|
||||
return (returnResult);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
/* ---------------------------------------------------------------------------
|
||||
* test_digital.h (c) 2008 Micro-key bv
|
||||
* ---------------------------------------------------------------------------
|
||||
* Micro-key bv
|
||||
* Industrieweg 28, 9804 TG Noordhorn
|
||||
* Postbus 92, 9800 AB Zuidhorn
|
||||
* The Netherlands
|
||||
* Tel: +31 594 503020
|
||||
* Fax: +31 594 505825
|
||||
* Email: support@microkey.nl
|
||||
* Web: www.microkey.nl
|
||||
* ---------------------------------------------------------------------------
|
||||
* Description:
|
||||
* ---------------------------------------------------------------------------
|
||||
* Version(s): 0.1, Dez 15, 2008, MMi
|
||||
* Creation.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef TEST_DIGITAL_H_
|
||||
#define TEST_DIGITAL_H_
|
||||
/* ---------------------------------------------------------------------------
|
||||
* System include files.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#include "LPC23xx.h"
|
||||
#include "types.h"
|
||||
|
||||
/* FreeRTOS includes */
|
||||
#include "FreeRTOS.h"
|
||||
#include "Task.h"
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Application include files.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Constant and macro definitions.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Type definitions.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Variable declarations.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Function declarations.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
BOOLEAN remoteDigitalLinetestMBExecute (void);
|
||||
BOOLEAN remoteDigitalLinetestEBExecute (void);
|
||||
|
||||
BOOLEAN remoteDigitalOutputTest_MB (void);
|
||||
BOOLEAN remoteDigitalInputTest_MB (void);
|
||||
BOOLEAN remoteDigitalOutputTest_EB (void);
|
||||
#endif /*TEST_DIGITAL_H_*/
|
||||
@@ -0,0 +1,140 @@
|
||||
/* ---------------------------------------------------------------------------
|
||||
* test_leds.c (c) 2008 Micro-key bv
|
||||
* ---------------------------------------------------------------------------
|
||||
* Micro-key bv
|
||||
* Industrieweg 28, 9804 TG Noordhorn
|
||||
* Postbus 92, 9800 AB Zuidhorn
|
||||
* The Netherlands
|
||||
* Tel: +31 594 503020
|
||||
* Fax: +31 594 505825
|
||||
* Email: support@microkey.nl
|
||||
* Web: www.microkey.nl
|
||||
* ---------------------------------------------------------------------------
|
||||
* Description: remote LED test sequence
|
||||
* ---------------------------------------------------------------------------
|
||||
* Version(s): 0.1, Dez 16, 2008, MMi
|
||||
* Creation.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* System include files
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#include "LPC23xx.h"
|
||||
#include "types.h"
|
||||
|
||||
#include "FreeRTOS.h"
|
||||
#include "task.h"
|
||||
#include "semphr.h"
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Application include files
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include "protocolfunctions.h"
|
||||
#include "BusProtocol.h"
|
||||
#include "SerOut.h"
|
||||
|
||||
#include "remote_analogue.h"
|
||||
#include "remote_digital.h"
|
||||
#include "remote_relay.h"
|
||||
#include "dio.h"
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Local constant and macro definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Global variable definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Local variable definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Local function definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
BOOLEAN remoteLEDTestMBexecute (void)
|
||||
{
|
||||
UINT32 loopcnt;
|
||||
UINT8 buffer;
|
||||
BOOLEAN ledTest = TRUE;
|
||||
BOOLEAN receive = FALSE;
|
||||
|
||||
|
||||
/* Drive LEDs to status ON */
|
||||
sendString (SerOutPort, GotoNewLine, testMessage,
|
||||
"Set local digital outputs to HIGH... ", Dummy, Dummy);
|
||||
/* Set digital input LEDs to ON */
|
||||
for (loopcnt = 0; loopcnt < maxDO_Channels; loopcnt++)
|
||||
{
|
||||
dioWrite(thisDeviceNumber, loopcnt, TRUE);
|
||||
}
|
||||
sendString (SerOutPort, FALSE, testMessage,
|
||||
"Done", Dummy, Dummy);
|
||||
|
||||
/* Set remote digital output LEDs to on */
|
||||
sendString (SerOutPort, GotoNewLine, testMessage,
|
||||
"Set remote digital outputs to HIGH... ", Dummy, Dummy);
|
||||
if (remoteDioWriteAll(remoteDeviceNumber, digital_mb, TRUE) == OK)
|
||||
{
|
||||
sendString (SerOutPort, FALSE, testMessage,
|
||||
"Done", Dummy, Dummy);
|
||||
}
|
||||
else
|
||||
{
|
||||
sendString (SerOutPort, FALSE, testMessage,
|
||||
"Failed", Dummy, Dummy);
|
||||
}
|
||||
|
||||
/* Set remote relay througput LEDs to on */
|
||||
sendString (SerOutPort, GotoNewLine, testMessage,
|
||||
"Set remote relay outputs to HIGH... ", Dummy, Dummy);
|
||||
if (remoteRelaySetAll(remoteDeviceNumber, relay_mb, TRUE) == OK)
|
||||
{
|
||||
sendString (SerOutPort, FALSE, testMessage,
|
||||
"Done", Dummy, Dummy);
|
||||
}
|
||||
else
|
||||
{
|
||||
sendString (SerOutPort, FALSE, testMessage,
|
||||
"Failed", Dummy, Dummy);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
sendString (SerOutPort, TRUE, noteMessage,
|
||||
"\tAre all LEDs turned on? ",
|
||||
"\n\r\tPRESS y (YES) oder n (NO): ",
|
||||
NewLine);
|
||||
|
||||
do /* do-while loop for String input */
|
||||
{
|
||||
receive = serGet(SerOutPort, &buffer);
|
||||
|
||||
} while ((buffer != 121) && (buffer != 110));
|
||||
|
||||
if (buffer == 121) /* 121 = y (ScanCode) */
|
||||
{
|
||||
sendString (SerOutPort, TRUE, noteMessage,
|
||||
"All LEDs working", Dummy, Dummy);
|
||||
ledTest = TRUE;
|
||||
}
|
||||
else if (buffer == 110) /* 110 = n (ScanCode) */
|
||||
{
|
||||
sendString (SerOutPort, TRUE, noteMessage,
|
||||
"LEDs broken", Dummy, Dummy);
|
||||
ledTest = FALSE;
|
||||
}
|
||||
|
||||
// \TODO CALCULATE RESULT
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
/* ---------------------------------------------------------------------------
|
||||
* test_leds.h (c) 2008 Micro-key bv
|
||||
* ---------------------------------------------------------------------------
|
||||
* Micro-key bv
|
||||
* Industrieweg 28, 9804 TG Noordhorn
|
||||
* Postbus 92, 9800 AB Zuidhorn
|
||||
* The Netherlands
|
||||
* Tel: +31 594 503020
|
||||
* Fax: +31 594 505825
|
||||
* Email: support@microkey.nl
|
||||
* Web: www.microkey.nl
|
||||
* ---------------------------------------------------------------------------
|
||||
* Description:
|
||||
* ---------------------------------------------------------------------------
|
||||
* Version(s): 0.1, Dez 16, 2008, MMi
|
||||
* Creation.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef TEST_LEDS_H_
|
||||
#define TEST_LEDS_H_
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* System include files.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#include "LPC23xx.h"
|
||||
#include "types.h"
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Application include files.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Constant and macro definitions.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Type definitions.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Variable declarations.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Function declarations.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
BOOLEAN remoteLEDTestMBexecute (void);
|
||||
|
||||
|
||||
#endif /*TEST_LEDS_H_*/
|
||||
@@ -0,0 +1,216 @@
|
||||
/* ---------------------------------------------------------------------------
|
||||
* testuart2.c (c) 2008 Micro-key bv
|
||||
* ---------------------------------------------------------------------------
|
||||
* Micro-key bv
|
||||
* Industrieweg 28, 9804 TG Noordhorn
|
||||
* Postbus 92, 9800 AB Zuidhorn
|
||||
* The Netherlands
|
||||
* Tel: +31 594 503020
|
||||
* Fax: +31 594 505825
|
||||
* Email: support@microkey.nl
|
||||
* Web: www.microkey.nl
|
||||
* ---------------------------------------------------------------------------
|
||||
* Description:
|
||||
* Contains BUS System Test Functions
|
||||
* ---------------------------------------------------------------------------
|
||||
* Version(s): 0.1, Mar 10, 2008, MMi
|
||||
* Creation.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* APPLICATION NOTE FOR BUS TEST!!!!
|
||||
*
|
||||
* THIS TEST ONLY WILL WORK IF DEVICE IS RUNNING IN A SINGLE MODE. IF DEVICE
|
||||
* IS INITIALIZED WITH BUS PROTOCOL (ANYWAY IF MASTER OR SLAVE), THIS TEST
|
||||
* WILL CAUSE THE HARDWARE TO CRASH
|
||||
*/
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* System include files
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#include "lpc23xx.h"
|
||||
#include "types.h"
|
||||
|
||||
#include "FreeRTOS.h"
|
||||
#include "task.h"
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Application include files
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#include "testBUS.h"
|
||||
#include "bus.h"
|
||||
#include "uart2.h"
|
||||
#include "uart3.h"
|
||||
#include "SerOut.h"
|
||||
#include "taskfunctions.h"
|
||||
#include "ledfunctions.h"
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Local constant and macro definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Global variable definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Local variable definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
char BUS1Buffer[20] = " 'BUSTEST first' "; /* first Teststring */
|
||||
char BUS2Buffer[20] = " 'BUSTEST second' "; /* second Teststring */
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Local function definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
extern void onUart2TxFinished();
|
||||
extern void onUart3TxFinished();
|
||||
|
||||
|
||||
BOOLEAN testbusStart(void)
|
||||
{
|
||||
/*Local Variable Declaration */
|
||||
BOOLEAN BUSTestResult = FALSE;
|
||||
BOOLEAN BUSTest11 = FALSE;
|
||||
BOOLEAN BUSTest12 = FALSE;
|
||||
BOOLEAN BUSTest21 = FALSE;
|
||||
BOOLEAN BUSTest22 = FALSE;
|
||||
BOOLEAN receive;
|
||||
UINT8 buffer;
|
||||
|
||||
|
||||
BUSTest11 = DoBUS1Test(); /* Test Bus1 */
|
||||
BUSTest12 = DoBUS2Test(); /* Test Bus2 */
|
||||
|
||||
|
||||
sendString (SerOutPort, TRUE, noteMessage, /* Send Text notification */
|
||||
NewLine, "\tSWITCH BUS CONNECTOR AND PRESS ENTER", NewLine);
|
||||
|
||||
do /* do-while loop for String input */
|
||||
{
|
||||
receive = serGet(SerOutPort, &buffer);
|
||||
} while (buffer != 13); /*Read input until ENTER-Key */
|
||||
|
||||
BUSTest21 = DoBUS1Test(); /* Test Bus1 */
|
||||
BUSTest22 = DoBUS2Test(); /* Test Bus2 */
|
||||
|
||||
if ((BUSTest11 == TRUE) && (BUSTest12 == TRUE)
|
||||
&&(BUSTest21 == TRUE) && (BUSTest22 == TRUE))
|
||||
{ /* If both Bustests passed */
|
||||
BUSTestResult = TRUE; /* set Test Result to TRUE */
|
||||
}
|
||||
|
||||
return BUSTestResult; /* Return Test Result */
|
||||
}
|
||||
|
||||
BOOLEAN DoBUS1Test (void)
|
||||
{
|
||||
/* Local Variable Declaration */
|
||||
BOOLEAN Uart2TestResult = TRUE;
|
||||
UINT16 B1received_int = 0;
|
||||
UINT16 B1send_int = 0;
|
||||
UINT8 B1receiveBuffer[50];
|
||||
|
||||
|
||||
sendString (SerOutPort, TRUE, testMessage,
|
||||
"\tWrite String ", BUS1Buffer, " on BUS1... ");
|
||||
busWrite ( BUS1, sizeof (BUS1Buffer), (UINT8 *) BUS1Buffer);
|
||||
/* Send Teststring on Bus1 */
|
||||
vTaskDelay (500); /* Wait to InputRegister to be ready*/
|
||||
B1send_int = sizeof (BUS1Buffer); /* calculate Length of Teststring */
|
||||
B1received_int = busRead (BUS2, (UINT8 *)B1receiveBuffer);
|
||||
/* Read Teststring on Bus2 */
|
||||
sendString (SerOutPort, TRUE, testMessage,
|
||||
"\tRead ", (char *) B1receiveBuffer, " on BUS2");
|
||||
/* Message out received String */
|
||||
if (B1send_int != B1received_int) /* If received String is a fault */
|
||||
{
|
||||
Uart2TestResult = FALSE; /* Set Bus1 TestResult to FALSE */
|
||||
}
|
||||
return Uart2TestResult; /* Return Test Result */
|
||||
}
|
||||
|
||||
BOOLEAN DoBUS2Test (void)
|
||||
{
|
||||
/* See "DoBUS1Test" for comments */
|
||||
|
||||
BOOLEAN Uart3TestResult = TRUE;
|
||||
UINT16 B2received_int = 0;
|
||||
UINT16 B2send_int = 0;
|
||||
UINT8 B2receiveBuffer[50];
|
||||
|
||||
sendString (SerOutPort, TRUE, testMessage,
|
||||
"\tWrite String ", BUS2Buffer, " on BUS2... ");
|
||||
busWrite ( BUS2, sizeof (BUS2Buffer), (UINT8 *) BUS2Buffer);
|
||||
vTaskDelay( 500 );
|
||||
B2send_int = sizeof (BUS2Buffer);
|
||||
B2received_int = busRead (BUS1, (UINT8 *)B2receiveBuffer);
|
||||
sendString (SerOutPort, TRUE, testMessage,
|
||||
"\tRead ", (char *) B2receiveBuffer, " on BUS1");
|
||||
|
||||
if (B2send_int != B2received_int)
|
||||
{
|
||||
Uart3TestResult = FALSE;
|
||||
}
|
||||
return Uart3TestResult;
|
||||
}
|
||||
|
||||
BOOLEAN Uart2LoopBackTest (void)
|
||||
{
|
||||
/* UART2 is in LoopBack by forcing it to receive its own Transmission */
|
||||
FIO4CLR |= (1 << 1); /* Enable Receiver */
|
||||
FIO4SET |= (1 << 0); /* Enable Transmitter */
|
||||
|
||||
/* Local Variable Declaration */
|
||||
BOOLEAN Result = TRUE; /* LoopBack Test Result */
|
||||
char EBBuffer[10] = "placed"; /* Teststring */
|
||||
UINT16 EBsend_int = 0;
|
||||
UINT16 EBreceived_int = 0;
|
||||
UINT8 EBreceiveBuffer[10];
|
||||
|
||||
uart2Write( (char *)EBBuffer, sizeof(EBBuffer)); /* Write Teststring */
|
||||
EBsend_int = sizeof (EBBuffer); /* Calculate Length */
|
||||
vTaskDelay (500); /* Wait to InputRegister to be ready*/
|
||||
EBreceived_int = busRead (BUS2, (UINT8 *)EBreceiveBuffer);
|
||||
/* Read/Delete received String */
|
||||
EBreceived_int = busRead (BUS1, (UINT8 *)EBreceiveBuffer);
|
||||
/* Read/Delete received String */
|
||||
if (EBsend_int != EBreceived_int) /* If received String is a fault */
|
||||
{
|
||||
Result = FALSE; /* Set Result to FALSE */
|
||||
}
|
||||
|
||||
onUart2TxFinished(); /* Switch back to receive Mode */
|
||||
return Result; /* Return Result */
|
||||
}
|
||||
|
||||
BOOLEAN Uart3LoopBackTest (void)
|
||||
{
|
||||
/* UART3 is in LoopBack by forcing it to receive its own Transmission */
|
||||
FIO4CLR |= (1 << 3); /* Enable Receiver */
|
||||
FIO4SET |= (1 << 2); /* Enable Transmitter */
|
||||
|
||||
BOOLEAN Result = TRUE;
|
||||
|
||||
char EBBuffer[10] = "placed";
|
||||
UINT16 EBsend_int = 0;
|
||||
UINT16 EBreceived_int = 0;
|
||||
UINT8 EBreceiveBuffer[10];
|
||||
|
||||
uart3Write( (char *)EBBuffer, sizeof(EBBuffer));
|
||||
EBsend_int = sizeof (EBBuffer);
|
||||
vTaskDelay (500);
|
||||
EBreceived_int = busRead (BUS1, (UINT8 *)EBreceiveBuffer);
|
||||
EBreceived_int = busRead (BUS2, (UINT8 *)EBreceiveBuffer);
|
||||
if (EBsend_int != EBreceived_int)
|
||||
{
|
||||
Result = FALSE;
|
||||
}
|
||||
onUart3TxFinished();
|
||||
return Result;
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
/* ---------------------------------------------------------------------------
|
||||
* testuart2.h (c) 2008 Micro-key bv
|
||||
* ---------------------------------------------------------------------------
|
||||
* Micro-key bv
|
||||
* Industrieweg 28, 9804 TG Noordhorn
|
||||
* Postbus 92, 9800 AB Zuidhorn
|
||||
* The Netherlands
|
||||
* Tel: +31 594 503020
|
||||
* Fax: +31 594 505825
|
||||
* Email: support@microkey.nl
|
||||
* Web: www.microkey.nl
|
||||
* ---------------------------------------------------------------------------
|
||||
* Description:
|
||||
* Headerfile for testBus.c
|
||||
* ---------------------------------------------------------------------------
|
||||
* Version(s): 0.1, Mar 10, 2008, MMi
|
||||
* Creation.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef TESTUART2_H_
|
||||
#define TESTUART2_H_
|
||||
/* ---------------------------------------------------------------------------
|
||||
* System include files.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#include "lpc23xx.h"
|
||||
#include "types.h"
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Application include files.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Constant and macro definitions.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Type definitions.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Variable declarations.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Function declarations.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Function: testBUSStart
|
||||
*
|
||||
* Main Function of BUS Tests
|
||||
*
|
||||
* Parameters: void
|
||||
*
|
||||
* Return: BOOLEAN - Test Result
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
BOOLEAN testbusStart();
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Function: DoBUS1Test / DoBUS2Test
|
||||
*
|
||||
* Functions to Test both Busses
|
||||
*
|
||||
* Parameters: void
|
||||
*
|
||||
* Return: BOOLEAN - single Test Result
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
BOOLEAN DoBUS1Test (void);
|
||||
BOOLEAN DoBUS2Test (void);
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Function: Uart2LoopBackTest / Uart3LoopBackTest
|
||||
*
|
||||
* Functions to set either Uart2 or Uart3 in a Loopback Mode to receive it's
|
||||
* own sent Message. Functions contain a Test that checks wether the received
|
||||
* Message equals the sent one.
|
||||
*
|
||||
* Parameters: void
|
||||
*
|
||||
* Return: BOOLEAN - Test Result
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
BOOLEAN Uart2LoopBackTest (void);
|
||||
BOOLEAN Uart3LoopBackTest (void);
|
||||
|
||||
|
||||
#endif /*TESTUART2_H_*/
|
||||
@@ -0,0 +1,130 @@
|
||||
/* ---------------------------------------------------------------------------
|
||||
* testLED.c (c) 2008 Micro-key bv
|
||||
* ---------------------------------------------------------------------------
|
||||
* Micro-key bv
|
||||
* Industrieweg 28, 9804 TG Noordhorn
|
||||
* Postbus 92, 9800 AB Zuidhorn
|
||||
* The Netherlands
|
||||
* Tel: +31 594 503020
|
||||
* Fax: +31 594 505825
|
||||
* Email: support@microkey.nl
|
||||
* Web: www.microkey.nl
|
||||
* ---------------------------------------------------------------------------
|
||||
* Description:
|
||||
* ---------------------------------------------------------------------------
|
||||
* Version(s): 0.1, Mei 16, 2008, MMi
|
||||
* Creation.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* System include files
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#include "LPC23xx.h"
|
||||
#include "types.h"
|
||||
|
||||
/* FreeRTOS includes */
|
||||
#include "FreeRTOS.h"
|
||||
#include "task.h"
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Application include files
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#include "testLED.h"
|
||||
#include "serial.h"
|
||||
#include "SerOut.h"
|
||||
#include "dio.h"
|
||||
#include "leds.h"
|
||||
#include "taskfunctions.h"
|
||||
#include "ledfunctions.h"
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Local constant and macro definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Global variable definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Local variable definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Local function definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
BOOLEAN testledStart (void)
|
||||
{
|
||||
BOOLEAN testledResult = FALSE;
|
||||
|
||||
testledResult = doledTest ();
|
||||
|
||||
return (testledResult);
|
||||
}
|
||||
|
||||
BOOLEAN doledTest (void)
|
||||
{
|
||||
UINT8 buffer;
|
||||
UINT8 captureDio;
|
||||
BOOLEAN ledTest = TRUE;
|
||||
BOOLEAN receive = FALSE;
|
||||
|
||||
captureDio = dioCapture();
|
||||
|
||||
|
||||
/* Set all DIOs to HIGH */
|
||||
dioWrite (0, 0, TRUE);
|
||||
dioWrite (0, 1, TRUE);
|
||||
dioWrite (0, 2, TRUE);
|
||||
dioWrite (0, 3, TRUE);
|
||||
dioWrite (0, 4, TRUE);
|
||||
dioWrite (0, 5, TRUE);
|
||||
dioWrite (0, 6, TRUE);
|
||||
dioWrite (0, 7, TRUE);
|
||||
|
||||
ledSet (LED0, 1); /* Set RED Status LED to HIGH */
|
||||
|
||||
if (d_gLED == pdPASS) /* Check for existing LED Task */
|
||||
{
|
||||
vTaskSuspend (gLED); /* Suspend existing Task */
|
||||
}
|
||||
ledSet (LED1, 1); /* Set GREEN Status LED to HIGH */
|
||||
|
||||
|
||||
FIO0DIR |= (1 << 13); /* Set USB_LED PIN as GP Output */
|
||||
FIO0CLR1 |= (1 << 5); /* Drive USB_LED PIN to ZERO */
|
||||
|
||||
sendString (SerOutPort, TRUE, noteMessage,
|
||||
"\tAre all LEDs turned on? ",
|
||||
"\n\r\tPRESS y (YES) oder n (NO): ",
|
||||
NewLine);
|
||||
|
||||
do /* do-while loop for String input */
|
||||
{
|
||||
receive = serGet(SerOutPort, &buffer);
|
||||
|
||||
} while ((buffer != 121) && (buffer != 110));
|
||||
|
||||
if (buffer == 121) /* 121 = y (ScanCode) */
|
||||
{
|
||||
ledTest = TRUE;
|
||||
}
|
||||
else if (buffer == 110) /* 110 = n (ScanCode) */
|
||||
{
|
||||
ledTest = FALSE;
|
||||
}
|
||||
|
||||
vTaskResume (gLED); /* Resume ActiveLED Task */
|
||||
FIO0SET1 |= (1 << 5); /* Drive USB_LED PIN to HIGH */
|
||||
dioResume(captureDio);
|
||||
|
||||
|
||||
return (ledTest);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
/* ---------------------------------------------------------------------------
|
||||
* testLED.h (c) 2008 Micro-key bv
|
||||
* ---------------------------------------------------------------------------
|
||||
* Micro-key bv
|
||||
* Industrieweg 28, 9804 TG Noordhorn
|
||||
* Postbus 92, 9800 AB Zuidhorn
|
||||
* The Netherlands
|
||||
* Tel: +31 594 503020
|
||||
* Fax: +31 594 505825
|
||||
* Email: support@microkey.nl
|
||||
* Web: www.microkey.nl
|
||||
* ---------------------------------------------------------------------------
|
||||
* Description: Digital inputs/outputs interface.
|
||||
* ---------------------------------------------------------------------------
|
||||
* Version(s): 0.1, Mei 16, 2008, MMi
|
||||
* Creation.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef TESTLED_H_
|
||||
#define TESTLED_H_
|
||||
/* ---------------------------------------------------------------------------
|
||||
* System include files.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#include "LPC23xx.h"
|
||||
#include "types.h"
|
||||
|
||||
/* FreeRTOS includes */
|
||||
#include "FreeRTOS.h"
|
||||
#include "task.h"
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Application include files.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Constant and macro definitions.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Type definitions.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Variable declarations.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Function declarations.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Function: testledStart
|
||||
*
|
||||
* Main Function of LED test
|
||||
*
|
||||
* Parameters: void
|
||||
*
|
||||
* Return: BOOLEAN - Test Result
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
BOOLEAN testledStart (void);
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Function: DoledTest
|
||||
*
|
||||
* Switchs on all accessable LEDs and asks the user to tell result
|
||||
*
|
||||
* Parameters: void
|
||||
*
|
||||
* Return: BOOLEAN - single Test Result
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
BOOLEAN doledTest (void);
|
||||
|
||||
|
||||
#endif /*TESTLED_H_*/
|
||||
@@ -0,0 +1,288 @@
|
||||
/* ---------------------------------------------------------------------------
|
||||
* testMMC.c (c) 2008 Micro-key bv
|
||||
* ---------------------------------------------------------------------------
|
||||
* Micro-key bv
|
||||
* Industrieweg 28, 9804 TG Noordhorn
|
||||
* Postbus 92, 9800 AB Zuidhorn
|
||||
* The Netherlands
|
||||
* Tel: +31 594 503020
|
||||
* Fax: +31 594 505825
|
||||
* Email: support@microkey.nl
|
||||
* Web: www.microkey.nl
|
||||
* ---------------------------------------------------------------------------
|
||||
* Description:
|
||||
* MemoryCard Test Application
|
||||
* ---------------------------------------------------------------------------
|
||||
* Version(s): 0.1, Apr 24, 2008, MMi
|
||||
* Creation.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* System include files
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
/* Compiler includes */
|
||||
#include <string.h>
|
||||
|
||||
#include "LPC23xx.h"
|
||||
#include "types.h"
|
||||
|
||||
/* FreeRTOS includes */
|
||||
#include "FreeRTOS.h"
|
||||
#include "Task.h"
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Application include files
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#include "testMMC.h"
|
||||
#include "mmc.h"
|
||||
#include "mmc_transfer.h"
|
||||
#include "ledfunctions.h"
|
||||
#include "SerOut.h"
|
||||
#include "dio.h"
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Local constant and macro definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#define PageSize 512 /* MMC Card Memory Page Size */
|
||||
#define ArrayLength 0x1000 /* Length of test Arrays */
|
||||
|
||||
#define MaxNumberOfAddress 7 /* Number of Testadresses */
|
||||
#define MaxNumberOfLength 7 /* Number of Testlengths */
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Global variable definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Local variable definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
/* Array contains all Adresses, where Data should be written to */
|
||||
UINT32 AddressArray[MaxNumberOfAddress] =
|
||||
{
|
||||
0x00,
|
||||
0x10,
|
||||
0x200,
|
||||
0x23E,
|
||||
0x3FF,
|
||||
0x400,
|
||||
0x401,
|
||||
};
|
||||
|
||||
/* Array contains all Lengths, that should be written to the Testadresses */
|
||||
UINT32 LengthArray[MaxNumberOfLength]=
|
||||
{
|
||||
0x00,
|
||||
0x80,
|
||||
0x199,
|
||||
0x200,
|
||||
0x201,
|
||||
0x800,
|
||||
0x1000
|
||||
};
|
||||
|
||||
UINT8 Write[0x1000]; /* used with MMC Write Function */
|
||||
UINT8 Read[0x1000]; /* used with MMC Read Function */
|
||||
UINT8 nullarray[0x1000];
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Local function definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
BOOLEAN testmmcStart(void)
|
||||
{
|
||||
BOOLEAN testMMCResult = FALSE;
|
||||
|
||||
testMMCResult = DoMMCTest();
|
||||
|
||||
return (testMMCResult);
|
||||
}
|
||||
|
||||
BOOLEAN DoMMCTest (void)
|
||||
{
|
||||
UINT32 loopcnt;
|
||||
UINT32 AddressIndex= 0;
|
||||
UINT32 LengthIndex = 0;
|
||||
UINT8 character = 4;
|
||||
BOOLEAN MMCTestResult = FALSE;
|
||||
BOOLEAN RWTest = TRUE;
|
||||
BOOLEAN LengthTest = TRUE;
|
||||
BOOLEAN MBSTest = TRUE;
|
||||
BOOLEAN PresentTest = TRUE;
|
||||
MmcState_t WriteStatus;
|
||||
MmcState_t ReadStatus;
|
||||
MmcState_t DiscStatus;
|
||||
|
||||
/* Prepare Read and Write Array with writing Zero to every Position */
|
||||
for (loopcnt = 0; loopcnt < ArrayLength; loopcnt++)
|
||||
{
|
||||
Read[loopcnt] = 0;
|
||||
Write[loopcnt] = 0;
|
||||
nullarray[loopcnt] = 0;
|
||||
|
||||
}
|
||||
|
||||
/* Fill WriteArray with Characters */
|
||||
for (loopcnt = 0; loopcnt < ArrayLength; loopcnt++)
|
||||
{
|
||||
Write[loopcnt] = character;
|
||||
character += 3;
|
||||
}
|
||||
|
||||
MMC_StatusOut (DiscStatus = MmcInitMedia()); /* Init Card, give Status */
|
||||
|
||||
if (DiscStatus == MmcNoPresent)
|
||||
{
|
||||
/* disc is not inserted, so Test will be aborted here */
|
||||
PresentTest = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Nested Test
|
||||
* Array "Write" is written with all available Lengths in LengthArray
|
||||
* to all available Adresses in AdressArray.
|
||||
*/
|
||||
while (AddressIndex < MaxNumberOfAddress)
|
||||
{
|
||||
LengthIndex = 0; /* Reset LengthIndex */
|
||||
while (LengthIndex < MaxNumberOfLength)
|
||||
{
|
||||
WriteStatus = CardWrite ((pUINT8)Write, AddressArray[AddressIndex],
|
||||
LengthArray[LengthIndex]); /* Write to MMC */
|
||||
|
||||
ReadStatus = CardRead ((pUINT8)Read, AddressArray[AddressIndex],
|
||||
LengthArray[LengthIndex]); /* Read from MMC */
|
||||
|
||||
/* Check Status of Read and Write Events */
|
||||
if ((ReadStatus == MmcOk) && (WriteStatus == MmcOk))
|
||||
{
|
||||
for (loopcnt = 0; loopcnt < LengthArray[LengthIndex]; loopcnt++)
|
||||
{ /* Compare both Arrays */
|
||||
if (Read[loopcnt] != Write[loopcnt])
|
||||
{ /* If miscompare occures */
|
||||
dioWrite(0, 6, TRUE);
|
||||
RWTest = FALSE;
|
||||
}
|
||||
else /* Everything's OK */
|
||||
{
|
||||
dioWrite(0, 7, TRUE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Check if Length-Control in MMC-Read/Write works correctly*/
|
||||
else if (((LengthArray[LengthIndex] % PageSize) != 0)
|
||||
|| (LengthArray[LengthIndex] == 0))
|
||||
{
|
||||
if ((WriteStatus == MmcMiscompare)
|
||||
&& (ReadStatus == MmcMiscompare))
|
||||
{
|
||||
dioWrite (0,5,TRUE); /* Length Control works */
|
||||
}
|
||||
else
|
||||
{
|
||||
dioWrite (0,4,TRUE); /* Length Control works not */
|
||||
LengthTest = FALSE;
|
||||
}
|
||||
}
|
||||
/* Check if MasterBootSector Protection works */
|
||||
else if ((AddressArray[AddressIndex] < 0x200)
|
||||
&& (LengthArray[LengthIndex] != 0))
|
||||
{
|
||||
if (WriteStatus == MmcCardError)
|
||||
{
|
||||
dioWrite (0,3,TRUE); /* MBS Protection works */
|
||||
}
|
||||
else
|
||||
{
|
||||
dioWrite (0,2,TRUE); /* MBS Protection works not */
|
||||
MBSTest = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
dioWrite (0,1,TRUE);
|
||||
dioWrite (0,0,TRUE);
|
||||
sendString (SerOutPort, TRUE, testMessage,
|
||||
"\t Length: ", s_tab, ItoDStr (LengthArray[LengthIndex]));
|
||||
sendString (SerOutPort, TRUE, testMessage,
|
||||
"\t Address: ", s_tab, ItoDStr (AddressArray[AddressIndex]));
|
||||
MMC_StatusOut (WriteStatus);
|
||||
MMC_StatusOut (ReadStatus);
|
||||
RWTest = FALSE;
|
||||
}
|
||||
|
||||
LengthIndex++;
|
||||
} // End LENGTH WHILE-LOOP
|
||||
AddressIndex++;
|
||||
} // End ADDRESS WHILE-LOOP
|
||||
}
|
||||
|
||||
|
||||
vTaskDelay (1000);
|
||||
/* Test Result Message Output */
|
||||
sendString (SerOutPort, TRUE, testMessage,
|
||||
"\t Disc present: ", s_tab, BoolRestoStr (PresentTest));
|
||||
sendString (SerOutPort, TRUE, testMessage,
|
||||
"\t Read and Write Test: ", f_tab, BoolRestoStr(RWTest));
|
||||
sendString (SerOutPort, TRUE, testMessage,
|
||||
"\t Length Status Check: ", f_tab, BoolRestoStr(LengthTest));
|
||||
sendString (SerOutPort, TRUE, testMessage,
|
||||
"\t MBS Defend Check: ", f_tab, BoolRestoStr(MBSTest));
|
||||
|
||||
/* Calculate complete Test Result out of single Tests */
|
||||
if ((RWTest == TRUE) && (LengthTest == TRUE)
|
||||
&& (MBSTest == TRUE) && (PresentTest == TRUE))
|
||||
{
|
||||
MMCTestResult = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
MMCTestResult = FALSE;
|
||||
}
|
||||
|
||||
|
||||
return (MMCTestResult);
|
||||
}
|
||||
|
||||
void MMC_StatusOut (MmcState_t Status)
|
||||
{
|
||||
switch (Status)
|
||||
{
|
||||
case MmcOk:
|
||||
sendString (SerOutPort, TRUE, testMessage,
|
||||
"MMC is OK", Dummy, Dummy);
|
||||
break;
|
||||
case MmcNoPresent:
|
||||
sendString (SerOutPort, TRUE, testMessage,
|
||||
"MMC is not present", Dummy, Dummy);
|
||||
break;
|
||||
case MmcNoResponse:
|
||||
sendString (SerOutPort, TRUE, testMessage,
|
||||
"MMC not responding", Dummy, Dummy);
|
||||
break;
|
||||
case MmcCardError:
|
||||
sendString (SerOutPort, TRUE, testMessage,
|
||||
"MMC Card Error", Dummy, Dummy);
|
||||
break;
|
||||
case MmcMiscompare:
|
||||
sendString (SerOutPort, TRUE, testMessage,
|
||||
"MMC Miscompare", Dummy, Dummy);
|
||||
break;
|
||||
case MmcDmaError:
|
||||
sendString (SerOutPort, TRUE, testMessage,
|
||||
"MMC DMA Error", Dummy, Dummy);
|
||||
break;
|
||||
case MmcProtect:
|
||||
sendString (SerOutPort, TRUE, testMessage,
|
||||
"Card is Protected", Dummy, Dummy);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
/* ---------------------------------------------------------------------------
|
||||
* testMMC.h (c) 2008 Micro-key bv
|
||||
* ---------------------------------------------------------------------------
|
||||
* Micro-key bv
|
||||
* Industrieweg 28, 9804 TG Noordhorn
|
||||
* Postbus 92, 9800 AB Zuidhorn
|
||||
* The Netherlands
|
||||
* Tel: +31 594 503020
|
||||
* Fax: +31 594 505825
|
||||
* Email: support@microkey.nl
|
||||
* Web: www.microkey.nl
|
||||
* ---------------------------------------------------------------------------
|
||||
* Description:
|
||||
* ---------------------------------------------------------------------------
|
||||
* Version(s): 0.1, Apr 24, 2008, MMi
|
||||
* Creation.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef TESTMMC_H_
|
||||
#define TESTMMC_H_
|
||||
/* ---------------------------------------------------------------------------
|
||||
* System include files.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#include "LPC23xx.h"
|
||||
#include "types.h"
|
||||
|
||||
#include "mmc.h"
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Application include files.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Constant and macro definitions.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Type definitions.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Variable declarations.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Function declarations.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Function: testmmcStart
|
||||
*
|
||||
* Main Function of MemoryCard Test Application
|
||||
*
|
||||
* Parameters: void
|
||||
*
|
||||
* Return: BOOLEAN - Test Result
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
BOOLEAN testmmcStart (void);
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Function:DoMMCTest
|
||||
*
|
||||
* Contains test Application
|
||||
*
|
||||
* Parameters: void
|
||||
*
|
||||
* Return: BOOLEAN - Test Result
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
BOOLEAN DoMMCTest (void);
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* MMC_StatusOut
|
||||
*
|
||||
* Function to Printout MMC Status
|
||||
*
|
||||
* Parameters: MmcState_t Status - MMC Status to print out
|
||||
*
|
||||
* Return: void
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
void MMC_StatusOut (MmcState_t Status);
|
||||
|
||||
|
||||
|
||||
#endif /*TESTMMC_H_*/
|
||||
@@ -0,0 +1,413 @@
|
||||
/* ---------------------------------------------------------------------------
|
||||
* testaio.c (c) 2008 Micro-key bv
|
||||
* ---------------------------------------------------------------------------
|
||||
* Micro-key bv
|
||||
* Industrieweg 28, 9804 TG Noordhorn
|
||||
* Postbus 92, 9800 AB Zuidhorn
|
||||
* The Netherlands
|
||||
* Tel: +31 594 503020
|
||||
* Fax: +31 594 505825
|
||||
* Email: support@microkey.nl
|
||||
* Web: www.microkey.nl
|
||||
* ---------------------------------------------------------------------------
|
||||
* Description:
|
||||
* Analogue Test File
|
||||
*
|
||||
* Note:
|
||||
* Output 0 is connected to Input 0 and 4
|
||||
* Output 1 is connected to Input 1 and 5
|
||||
* Output 2 is connected to Input 2 and 6
|
||||
* Output 3 is connected to Input 3 and 7
|
||||
*
|
||||
*
|
||||
* ---------------------------------------------------------------------------
|
||||
* Version(s): 0.1, Sep 08, 2008, MMi
|
||||
* Creation.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* System include files
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#include "lpc23xx.h"
|
||||
#include "types.h"
|
||||
|
||||
|
||||
/* FreeRTOS includes */
|
||||
#include "FreeRTOS.h"
|
||||
#include "Task.h"
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Application include files
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#include "adc.h"
|
||||
#include "dac.h"
|
||||
#include "dio.h"
|
||||
#include "testaio.h"
|
||||
#include "calibrateaio.h"
|
||||
|
||||
#include "SerOut.h"
|
||||
#include "BusProtocol.h"
|
||||
|
||||
#include "remote_misc.h"
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Local constant and macro definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#define NumberOfAIs maxADC_Channels /* See adc.h */
|
||||
#define NumberOfAIOs maxDAC_Channels /* See dac.h */
|
||||
|
||||
#define vTestValue 5000 /* Value for Test Voltage Output in mV */
|
||||
#define cTestValue 10000 /* Value for Test Current Output in uA */
|
||||
#define vNullValue 0
|
||||
#define cNullValue 0
|
||||
|
||||
#define vLimit 20 /* Test Limit for Voltage Test */
|
||||
#define cLimit 100 /* Test Limit for Current Test */
|
||||
|
||||
#define vNullLimit 50 /* Test Limit for NULL-Voltage Test */
|
||||
#define cNullLimit 50 /* Test Limit for NULL-Current Test */
|
||||
|
||||
#define TestDelay 200
|
||||
|
||||
#define VoltageOutputCalibrationValue 10000 /* Calibration Value for V */
|
||||
#define CurrentOutputCalibrationValue 20000 /* Calibration Value for C */
|
||||
|
||||
#define VoltageOutputTestValue 7000 /* Remote Test Value for V */
|
||||
#define CurrentOutputTestValue 15000 /* Remote Test Value for C */
|
||||
|
||||
#define ident_calibrated 0x55 /* Calibrated status identifier */
|
||||
#define ident_default 0xAA /* Default status identifier */
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Global variable definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* Bus informations from protocolfunctions.c */
|
||||
extern UINT8 remoteDeviceNumber;
|
||||
extern UINT8 thisDeviceNumber;
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Local variable definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Local function definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
BOOLEAN testaioStart (void)
|
||||
{
|
||||
BOOLEAN AIOTestResult = FALSE; /* BOOLEAN Variable to return Result*/
|
||||
BOOLEAN VoltageTest_MB;
|
||||
BOOLEAN CurrentTest_MB;
|
||||
BOOLEAN VoltageTest_EB;
|
||||
BOOLEAN CurrentTest_EB;
|
||||
|
||||
/* Do analogue line test for Mainboard Connectors */
|
||||
VoltageTest_MB = doAIOVoltageTest(); /* Call Test Function */
|
||||
CurrentTest_MB = doAIOCurrentTest();
|
||||
|
||||
// \MARK NEW PINSETTINGS FOR TESTER (2)
|
||||
#if (PINSET_TESTER == 2)
|
||||
/* Enable extension-board channels by switching multiplexers */
|
||||
adc_MuxEn(TRUE);
|
||||
dac_MuxEn(TRUE);
|
||||
|
||||
/* Do analogue line test for extension Board Connectors */
|
||||
VoltageTest_EB = doAIOVoltageTest(); /* Call Test Function */
|
||||
CurrentTest_EB = doAIOCurrentTest();
|
||||
|
||||
/* Switch off multiplexers again to main-board connectors */
|
||||
adc_MuxEn(FALSE);
|
||||
dac_MuxEn(FALSE);
|
||||
#endif
|
||||
|
||||
if ((VoltageTest_MB == TRUE) && (CurrentTest_MB == TRUE)
|
||||
// \MARK NEW PINSETTINGS FOR TESTER (2)
|
||||
#if (PINSET_TESTER == 2)
|
||||
&& (VoltageTest_EB == TRUE) && (CurrentTest_EB == TRUE)
|
||||
#endif
|
||||
)
|
||||
{
|
||||
AIOTestResult = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
AIOTestResult = FALSE;
|
||||
}
|
||||
|
||||
return (AIOTestResult); /* Return Test Result */
|
||||
}
|
||||
|
||||
BOOLEAN doAIOVoltageTest (void)
|
||||
{
|
||||
UINT32 aiocnt;
|
||||
BOOLEAN AIOLineTestResult = FALSE;
|
||||
BOOLEAN LowTest = TRUE;
|
||||
BOOLEAN AllOtherTest = TRUE;
|
||||
BOOLEAN HighTest = TRUE;
|
||||
UINT32 LowBuffer;
|
||||
BOOLEAN AllOtherBuffer;
|
||||
UINT32 HighBuffer;
|
||||
|
||||
SetAnalogueInput(FALSE); /* Set Analogue Input to Voltage */
|
||||
dacMode (0, dacVOLTAGE); /* Set Output Types to Voltage */
|
||||
dacMode (1, dacVOLTAGE);
|
||||
dacMode (2, dacVOLTAGE);
|
||||
dacMode (3, dacVOLTAGE);
|
||||
|
||||
dacWrite (thisDeviceNumber, 0, vNullValue); /* Write 0 Volts to Output */
|
||||
dacWrite (thisDeviceNumber, 1, vNullValue);
|
||||
dacWrite (thisDeviceNumber, 2, vNullValue);
|
||||
dacWrite (thisDeviceNumber, 3, vNullValue);
|
||||
vTaskDelay (TestDelay);
|
||||
|
||||
sendString (SerOutPort, FALSE, testMessage, NewLine,
|
||||
"\tVoltage Test Value: ", ItoDStr (vTestValue));
|
||||
sendString (SerOutPort, FALSE, testMessage,
|
||||
"\t\tTolerance: ", ItoDStr (vLimit), Dummy);
|
||||
|
||||
for (aiocnt = 0; aiocnt < NumberOfAIs; aiocnt++) /*Test Line by Line */
|
||||
{
|
||||
/* Test if Input Voltage is below NullLimit */
|
||||
if ((LowBuffer = adcRead (thisDeviceNumber, aiocnt)) > vNullLimit)
|
||||
{
|
||||
LowTest = FALSE; /* Failed, then set Test failed */
|
||||
}
|
||||
|
||||
/* Write chosen Output to Test Value */
|
||||
if (aiocnt < NumberOfAIOs)
|
||||
{
|
||||
dacWrite (thisDeviceNumber, aiocnt, vTestValue);
|
||||
}
|
||||
else /* if selected Input is > possible */
|
||||
{ /* Outputs, restart at Output 0 */
|
||||
dacWrite (thisDeviceNumber, (aiocnt - NumberOfAIOs), vTestValue);
|
||||
}
|
||||
vTaskDelay (TestDelay); /* Wait for Output to be set */
|
||||
|
||||
/* Check if all other Inputs are Zero */
|
||||
if ((AllOtherBuffer = CheckAllOtherAIOZero(aiocnt, TRUE)) == FALSE)
|
||||
{
|
||||
AllOtherTest = FALSE;
|
||||
}
|
||||
|
||||
/* Read Test Level on Input */
|
||||
HighBuffer = adcRead (thisDeviceNumber, aiocnt);
|
||||
if ((HighBuffer < (vTestValue - vLimit))
|
||||
|| (HighBuffer > (vTestValue + vLimit))) // \TODO is this working???
|
||||
{ /* Is read Value in the Limits? */
|
||||
HighTest = FALSE;
|
||||
}
|
||||
|
||||
/* Write chosen Output back to Null */
|
||||
if (aiocnt < NumberOfAIOs)
|
||||
{
|
||||
dacWrite (thisDeviceNumber, aiocnt, vNullValue);
|
||||
}
|
||||
else /* if selected Input is > possible */
|
||||
{ /* Outputs, restart at Output 0 */
|
||||
dacWrite (thisDeviceNumber, (aiocnt - NumberOfAIOs), vNullValue);
|
||||
}
|
||||
|
||||
/* Message out Test Results */
|
||||
sendString (SerOutPort, TRUE, testMessage,
|
||||
"\tVoltage Test for Analogue Input ", ItoDStr(aiocnt), ": ");
|
||||
sendString (SerOutPort, FALSE, testMessage,
|
||||
" ", Dummy, ItoDStr (LowBuffer));
|
||||
sendString (SerOutPort, FALSE, testMessage,
|
||||
" ", Dummy, ItoDStr (HighBuffer));
|
||||
sendString (SerOutPort, FALSE, testMessage,
|
||||
" All Other: ", Dummy, BoolRestoStr (AllOtherBuffer));
|
||||
|
||||
vTaskDelay (TestDelay);
|
||||
}
|
||||
|
||||
/* Set complete LineTestResult */
|
||||
if ((LowTest == TRUE) && (HighTest == TRUE) && (AllOtherTest == TRUE))
|
||||
{
|
||||
AIOLineTestResult = TRUE;
|
||||
}
|
||||
|
||||
return (AIOLineTestResult);
|
||||
}
|
||||
|
||||
|
||||
BOOLEAN doAIOCurrentTest (void)
|
||||
{
|
||||
UINT32 aiocnt;
|
||||
UINT32 LowBuffer;
|
||||
UINT32 HighBuffer;
|
||||
BOOLEAN AIOCurrentTest = TRUE;
|
||||
BOOLEAN LowTest;
|
||||
BOOLEAN HighTest;
|
||||
|
||||
|
||||
|
||||
dacMode (0, dacCURRENT); /* Set Output Types to Current */
|
||||
dacMode (1, dacCURRENT);
|
||||
dacMode (2, dacCURRENT);
|
||||
dacMode (3, dacCURRENT);
|
||||
|
||||
dacWrite (thisDeviceNumber, 0, cNullValue); /* Write 0 uA to Output */
|
||||
dacWrite (thisDeviceNumber, 1, cNullValue);
|
||||
dacWrite (thisDeviceNumber, 2, cNullValue);
|
||||
dacWrite (thisDeviceNumber, 3, cNullValue);
|
||||
vTaskDelay (TestDelay);
|
||||
|
||||
sendString (SerOutPort, TRUE, testMessage, NewLine,
|
||||
"\tCurrent Test Value: ", ItoDStr (cTestValue));
|
||||
sendString (SerOutPort, FALSE, testMessage,
|
||||
"\t\tTolerance: ", ItoDStr (cLimit), Dummy);
|
||||
|
||||
for (aiocnt = 0; aiocnt < NumberOfAIs; aiocnt++)
|
||||
{
|
||||
adcMode( aiocnt, adcCURRENT ); /* Inputs set to Current */
|
||||
vTaskDelay (200);
|
||||
|
||||
/* Read back the low Value on Input */
|
||||
LowBuffer = adcRead (thisDeviceNumber, aiocnt);
|
||||
if (LowBuffer < cNullLimit)
|
||||
{
|
||||
/* If read Value is within the Limit, test passed */
|
||||
LowTest = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* If read Value is out of Limit, test failed */
|
||||
LowTest = FALSE;
|
||||
}
|
||||
|
||||
/* Write Output to defined Test Value */
|
||||
if (aiocnt < NumberOfAIOs)
|
||||
{
|
||||
dacWrite(thisDeviceNumber, aiocnt, cTestValue);
|
||||
}
|
||||
else
|
||||
{
|
||||
dacWrite(thisDeviceNumber, (aiocnt - NumberOfAIOs), cTestValue);
|
||||
}
|
||||
vTaskDelay (500);
|
||||
|
||||
HighBuffer = adcRead(thisDeviceNumber, aiocnt);
|
||||
if ((HighBuffer < (cTestValue - cLimit))
|
||||
|| (HighBuffer > (cTestValue + cLimit)))
|
||||
{
|
||||
/* If read Value is within the Limit, test passed */
|
||||
HighTest = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* If read Value is out of Limit, test failed */
|
||||
HighTest = TRUE;
|
||||
}
|
||||
|
||||
/* Drive Output back to Zero Value */
|
||||
if (aiocnt < NumberOfAIOs)
|
||||
{
|
||||
dacWrite(thisDeviceNumber, aiocnt, cNullValue);
|
||||
}
|
||||
else
|
||||
{
|
||||
dacWrite(thisDeviceNumber, (aiocnt - NumberOfAIOs), cNullValue);
|
||||
}
|
||||
/* Set Input Mode to Voltage to prevent of leek Current */
|
||||
adcMode (aiocnt, adcVOLTAGE);
|
||||
|
||||
/* Message out Test Results */
|
||||
sendString (SerOutPort, TRUE, testMessage,
|
||||
"\tCurrent Test for Analogue Input ", ItoDStr(aiocnt), ": ");
|
||||
sendString (SerOutPort, FALSE, testMessage,
|
||||
" ", Dummy, ItoDStr (LowBuffer));
|
||||
sendString (SerOutPort, FALSE, testMessage,
|
||||
" ", Dummy, ItoDStr (HighBuffer));
|
||||
|
||||
/* Set complete LineTestResult */
|
||||
if ((LowTest != TRUE) || (HighTest != TRUE))
|
||||
{
|
||||
AIOCurrentTest = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
return (AIOCurrentTest);
|
||||
}
|
||||
|
||||
|
||||
BOOLEAN CheckAllOtherAIOZero (UINT32 AIONumber, BOOLEAN local)
|
||||
{
|
||||
|
||||
UINT32 loopcnt;
|
||||
BOOLEAN AllZeroResult = TRUE;
|
||||
|
||||
for (loopcnt = 0; loopcnt < NumberOfAIs; loopcnt++) /* Test Line by Line*/
|
||||
{
|
||||
if ((loopcnt == AIONumber) || /* except currently tested Input */
|
||||
(loopcnt == (AIONumber + NumberOfAIOs)) ||
|
||||
(loopcnt == (AIONumber - NumberOfAIOs)))
|
||||
{
|
||||
if (loopcnt < (NumberOfAIOs - 1))
|
||||
{
|
||||
loopcnt++; /* Skip currently tested Output */
|
||||
}
|
||||
else
|
||||
{
|
||||
break; /* If tested Output is the last one,*/
|
||||
} /* simply break out of loop */
|
||||
}
|
||||
if (local == TRUE)
|
||||
{
|
||||
if (adcRead (thisDeviceNumber, loopcnt) > vNullLimit)
|
||||
{ /* If Input Value exceeds Limit */
|
||||
AllZeroResult = FALSE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (adcRead (remoteDeviceNumber, loopcnt) > vNullLimit)
|
||||
{ /* If Input Value exceeds Limit */
|
||||
sendString (SerOutPort, TRUE, testMessage,
|
||||
"line: ", ItoDStr (loopcnt), Dummy);
|
||||
sendString (SerOutPort, TRUE, testMessage,
|
||||
"Value: ",
|
||||
ItoDStr (adcRead (remoteDeviceNumber, loopcnt)), Dummy);
|
||||
|
||||
AllZeroResult = FALSE;
|
||||
}
|
||||
vTaskDelay (100);
|
||||
}
|
||||
}
|
||||
return (AllZeroResult);
|
||||
}
|
||||
|
||||
|
||||
void SetAnalogueInput(BOOLEAN isCurrent)
|
||||
{
|
||||
if (isCurrent == TRUE)
|
||||
{
|
||||
adcMode( 0, adcCURRENT ); /* Inputs set to Current */
|
||||
adcMode( 1, adcCURRENT );
|
||||
adcMode( 2, adcCURRENT );
|
||||
adcMode( 3, adcCURRENT );
|
||||
adcMode( 4, adcCURRENT );
|
||||
adcMode( 5, adcCURRENT );
|
||||
adcMode( 6, adcCURRENT );
|
||||
adcMode( 7, adcCURRENT );
|
||||
}
|
||||
else
|
||||
{
|
||||
adcMode( 0, adcVOLTAGE ); /* Inputs set to Voltage */
|
||||
adcMode( 1, adcVOLTAGE );
|
||||
adcMode( 2, adcVOLTAGE );
|
||||
adcMode( 3, adcVOLTAGE );
|
||||
adcMode( 4, adcVOLTAGE );
|
||||
adcMode( 5, adcVOLTAGE );
|
||||
adcMode( 6, adcVOLTAGE );
|
||||
adcMode( 7, adcVOLTAGE );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,150 @@
|
||||
/* ---------------------------------------------------------------------------
|
||||
* testaio.h (c) 2008 Micro-key bv
|
||||
* ---------------------------------------------------------------------------
|
||||
* Micro-key bv
|
||||
* Industrieweg 28, 9804 TG Noordhorn
|
||||
* Postbus 92, 9800 AB Zuidhorn
|
||||
* The Netherlands
|
||||
* Tel: +31 594 503020
|
||||
* Fax: +31 594 505825
|
||||
* Email: support@microkey.nl
|
||||
* Web: www.microkey.nl
|
||||
* ---------------------------------------------------------------------------
|
||||
* Description:
|
||||
* Headerfile for analogue Testfile testaio.c
|
||||
* ---------------------------------------------------------------------------
|
||||
* Version(s): 0.1, Sep 08, 2008, MMi
|
||||
* Creation.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef TESTAIO_H_
|
||||
#define TESTAIO_H_
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* System include files.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#include "lpc23xx.h"
|
||||
#include "types.h"
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Application include files.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Constant and macro definitions.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Type definitions.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Variable declarations.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Function declarations.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Function: testioStart
|
||||
*
|
||||
* Main Function of Analogue Tests.
|
||||
*
|
||||
* Parameters: void
|
||||
*
|
||||
* Return : BOOLEAN - Test Result
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
BOOLEAN testaioStart (void); /* Test analog Input/Output */
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Function: doAIOVoltageTest / doAIOCurrentTest
|
||||
*
|
||||
* Function to test every single analogue Output and Input (either V or C)
|
||||
*
|
||||
* Parameters: void
|
||||
*
|
||||
* Return : BOOLEAN - Test Result
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
BOOLEAN doAIOVoltageTest (void);
|
||||
|
||||
BOOLEAN doAIOCurrentTest (void);
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Function: CheckAllOtherAIOZero
|
||||
*
|
||||
* Function to check if all other analogue Inputs but the chosen one is
|
||||
* Zero or below a certain test Limit.
|
||||
*
|
||||
* Parameters: UINT32 AIONumber - currently tested Input
|
||||
* BOOLEAN local - check either local or remote lines
|
||||
*
|
||||
* Return : BOOLEAN - Test Result
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
BOOLEAN CheckAllOtherAIOZero (UINT32 AIONumber, BOOLEAN local);
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Function: Set AnalogueInput
|
||||
*
|
||||
* Function to set Inputs either to Voltage or Current Mode
|
||||
*
|
||||
* Parameters: BOOLEAN isCurrent - Indicates if Voltage or Current Mode
|
||||
*
|
||||
* Return : void
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
void SetAnalogueInput(BOOLEAN isCurrent);
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Function: testSlaveAnalogueLines
|
||||
*
|
||||
* Main function to remote AIO Test
|
||||
*
|
||||
* Parameters: void
|
||||
*
|
||||
* Return : BOOLEAN - TestResult
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
BOOLEAN testSlaveAnalogueLines (void);
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Function: remoteaioOutput
|
||||
*
|
||||
* Function to test remote analogue Outputs
|
||||
*
|
||||
* Parameters: BOOLEAN testmodeVOLTAGE - test in voltage (TRUE) or current
|
||||
* (FALSE) mode
|
||||
*
|
||||
* Return : BOOLEAN - Test Result
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
BOOLEAN remoteaioOutput (BOOLEAN testmodeVOLTAGE);
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Function: remoteaioInput
|
||||
*
|
||||
* Function to test remote analogue Inputs
|
||||
*
|
||||
* Parameters: BOOLEAN testmodeVOLTAGE - test in voltage (TRUE) or current
|
||||
* (FALSE) mode
|
||||
*
|
||||
* Return : BOOLEAN - Test Result
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
BOOLEAN remoteaioInput (BOOLEAN testmodeVOLTAGE);
|
||||
|
||||
#endif /*TESTAIO_H_*/
|
||||
@@ -0,0 +1,121 @@
|
||||
/* ---------------------------------------------------------------------------
|
||||
* testcan.c (c) 2008 Micro-key bv
|
||||
* ---------------------------------------------------------------------------
|
||||
* Micro-key bv
|
||||
* Industrieweg 28, 9804 TG Noordhorn
|
||||
* Postbus 92, 9800 AB Zuidhorn
|
||||
* The Netherlands
|
||||
* Tel: +31 594 503020
|
||||
* Fax: +31 594 505825
|
||||
* Email: support@microkey.nl
|
||||
* Web: www.microkey.nl
|
||||
* ---------------------------------------------------------------------------
|
||||
* Description:
|
||||
* ---------------------------------------------------------------------------
|
||||
* Version(s): 0.1, Nov 17, 2008, MMi
|
||||
* Creation.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* System include files
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#include "lpc23xx.h"
|
||||
#include "types.h"
|
||||
|
||||
#include "FreeRTOS.h"
|
||||
#include "task.h"
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Application include files
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#include "testcan.h"
|
||||
#include "can.h"
|
||||
#include "SerOut.h"
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Local constant and macro definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#define CAN_FILTER1 0x00000101
|
||||
#define CAN_MSGLNG 0x00050000
|
||||
#define CAN_DATAA 0x01234567
|
||||
#define CAN_DATAB 0xFEDCBA98
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Global variable definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Local variable definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Local function definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
BOOLEAN testCanStart (void)
|
||||
{
|
||||
BOOLEAN canResult;
|
||||
|
||||
canResult = canSelftest ();
|
||||
|
||||
return (canResult);
|
||||
}
|
||||
|
||||
BOOLEAN canSelftest (void)
|
||||
{
|
||||
CAN_MSG SendMessage;
|
||||
CAN_MSG ReceiveMessage;
|
||||
|
||||
/* Set CAN2 in SelfTest Mode - CAN2 must be in RESET mode for that */
|
||||
CAN2MOD |= (1 << 0); /* Set Mode to Reset (Bit 0) */
|
||||
CAN2MOD |= (1 << 2); /* Set bit "selftest" */
|
||||
CAN2MOD &=~(1 << 0); /* Set Mode to normal */
|
||||
|
||||
vTaskDelay (500);
|
||||
|
||||
// SendMessage.Dat1 = 0x00080102L; // 8 bytes, ID 0x102
|
||||
// SendMessage.DatA = 0x00000000L; // all zeros
|
||||
// SendMessage.DatB = 0x00000000L; // all zeros
|
||||
|
||||
SendMessage.Dat1 = (CAN_FILTER1 | CAN_MSGLNG); /* Set Length and Filter */
|
||||
SendMessage.DatA = CAN_DATAA; /* Define first 4 Bytes */
|
||||
SendMessage.DatB = CAN_DATAB; /* Define last 4 bytes */
|
||||
|
||||
CANPushMessage (&SendMessage);
|
||||
|
||||
vTaskDelay (1000);
|
||||
|
||||
CANPullMessage (&ReceiveMessage);
|
||||
|
||||
if (SendMessage.Dat1 == ReceiveMessage.Dat1)
|
||||
{
|
||||
debugPrint("Dat1 is OK\n\r");
|
||||
if (SendMessage.DatA == ReceiveMessage.DatA)
|
||||
{
|
||||
debugPrint("DataA is OK\n\r");
|
||||
if (SendMessage.DatB == ReceiveMessage.DatB)
|
||||
{
|
||||
debugPrint("DataB is OK\n\r");
|
||||
}
|
||||
else
|
||||
{
|
||||
debugPrint("DataB is not OK\n\r");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
debugPrint("DataA is not OK\n\r");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
debugPrint("Dat1 is not OK\n\r;");
|
||||
}
|
||||
|
||||
return (TRUE);
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
/* ---------------------------------------------------------------------------
|
||||
* testcan.h (c) 2008 Micro-key bv
|
||||
* ---------------------------------------------------------------------------
|
||||
* Micro-key bv
|
||||
* Industrieweg 28, 9804 TG Noordhorn
|
||||
* Postbus 92, 9800 AB Zuidhorn
|
||||
* The Netherlands
|
||||
* Tel: +31 594 503020
|
||||
* Fax: +31 594 505825
|
||||
* Email: support@microkey.nl
|
||||
* Web: www.microkey.nl
|
||||
* ---------------------------------------------------------------------------
|
||||
* Description:
|
||||
* ---------------------------------------------------------------------------
|
||||
* Version(s): 0.1, Nov 17, 2008, MMi
|
||||
* Creation.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef TESTCAN_H_
|
||||
#define TESTCAN_H_
|
||||
/* ---------------------------------------------------------------------------
|
||||
* System include files.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Application include files.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Constant and macro definitions.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Type definitions.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Variable declarations.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Function declarations.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
BOOLEAN testCanStart (void);
|
||||
|
||||
BOOLEAN canSelftest (void);
|
||||
|
||||
|
||||
#endif /*TESTCAN_H_*/
|
||||
@@ -0,0 +1,228 @@
|
||||
/* ---------------------------------------------------------------------------
|
||||
* testdio.c (c) 2008 Micro-key bv
|
||||
* ---------------------------------------------------------------------------
|
||||
* Micro-key bv
|
||||
* Industrieweg 28, 9804 TG Noordhorn
|
||||
* Postbus 92, 9800 AB Zuidhorn
|
||||
* The Netherlands
|
||||
* Tel: +31 594 503020
|
||||
* Fax: +31 594 505825
|
||||
* Email: support@microkey.nl
|
||||
* Web: www.microkey.nl
|
||||
* ---------------------------------------------------------------------------
|
||||
* Description:
|
||||
* Contains the digital Input/Output test Function
|
||||
*
|
||||
*
|
||||
* ---------------------------------------------------------------------------
|
||||
* Version(s): 0.1, Mar 06, 2008, MMi
|
||||
* Creation.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* System include files
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#include "LPC23xx.h"
|
||||
#include "types.h"
|
||||
|
||||
/* FreeRTOS includes */
|
||||
#include "FreeRTOS.h"
|
||||
#include "task.h"
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Application include files
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#include "dio.h"
|
||||
#include "testdio.h"
|
||||
#include "SerOut.h"
|
||||
#include "ledfunctions.h"
|
||||
#include "BusProtocol.h"
|
||||
#include "protocolfunctions.h"
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Local constant and macro definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
// \MARK NEW PINSETTINGS FOR TESTER (2)
|
||||
#if (PINSET_TESTER == 2)
|
||||
#define NumberOfDIOs 8
|
||||
#else
|
||||
#define NumberOfDIOs 11 /* Number of digital Inputs */
|
||||
#endif
|
||||
#define NumberOfDOs 8 /* Number of digital Outputs */
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Global variable definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Local variable definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Local function definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
BOOLEAN testdioStart (void)
|
||||
{
|
||||
BOOLEAN DIOTestResult;
|
||||
BOOLEAN DIOTestResult_MB = FALSE;
|
||||
BOOLEAN DIOTestResult_EB = FALSE;
|
||||
|
||||
DIOTestResult_MB = doDIOLineTest();
|
||||
|
||||
// \MARK NEW PINSETTINGS FOR TESTER (2)
|
||||
#if (PINSET_TESTER == 2)
|
||||
dio_inMuxEn();
|
||||
|
||||
/* Do digital line test for extension Board Connectors */
|
||||
DIOTestResult_EB = doDIOLineTest();
|
||||
|
||||
dio_outMuxEn();
|
||||
#endif
|
||||
|
||||
if ((DIOTestResult_MB == TRUE)
|
||||
// \MARK NEW PINSETTINGS FOR TESTER (2)
|
||||
#if (PINSET_TESTER == 2)
|
||||
&& (DIOTestResult_EB == TRUE)
|
||||
#endif
|
||||
)
|
||||
{
|
||||
DIOTestResult = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
DIOTestResult = FALSE;
|
||||
}
|
||||
|
||||
return (DIOTestResult);
|
||||
|
||||
}
|
||||
|
||||
|
||||
BOOLEAN doDIOLineTest (void)
|
||||
{
|
||||
UINT32 diocnt = 0;
|
||||
BOOLEAN LineTestResult = FALSE;
|
||||
BOOLEAN LowTest = TRUE;
|
||||
BOOLEAN AllOther = TRUE;
|
||||
BOOLEAN HighTest = TRUE;
|
||||
BOOLEAN LowBuffer;
|
||||
BOOLEAN AllOtherBuffer;
|
||||
BOOLEAN HighBuffer;
|
||||
|
||||
dioClean();
|
||||
vTaskDelay (100);
|
||||
|
||||
|
||||
for (diocnt = 0; diocnt < NumberOfDIOs; diocnt++)
|
||||
{
|
||||
/* Read LOW Value on selected Digital Input and set Read Result */
|
||||
if ((LowBuffer = !dioRead (thisDeviceNumber, diocnt)) == FALSE)
|
||||
{ /* LowBuffer contains Read Result */
|
||||
LowTest = FALSE;
|
||||
}
|
||||
|
||||
/* Drive selected Digital Output to HIGH. */
|
||||
if (diocnt >= NumberOfDOs)
|
||||
{
|
||||
dioWrite (thisDeviceNumber, (diocnt - NumberOfDOs), TRUE);
|
||||
}
|
||||
else /* if selected Input is > possible */
|
||||
{ /* Outputs, restart at Output 0 */
|
||||
dioWrite (thisDeviceNumber, diocnt, TRUE);
|
||||
}
|
||||
vTaskDelay (50); /* small Delay */
|
||||
|
||||
/* Check if all Lines but the selected one are LOW */
|
||||
if ((AllOtherBuffer = CheckAllOtherDIOZero(diocnt, TRUE)) == FALSE)
|
||||
{
|
||||
AllOther = FALSE;
|
||||
}
|
||||
|
||||
/* Read HIGH Value on selected Digital Input and set Read Result */
|
||||
if ((HighBuffer = dioRead (thisDeviceNumber, diocnt)) == FALSE)
|
||||
{
|
||||
HighTest = FALSE;
|
||||
}
|
||||
|
||||
/* Set selected digital Input back to LOW */
|
||||
if (diocnt >= NumberOfDOs)
|
||||
{
|
||||
dioWrite (thisDeviceNumber, (diocnt - NumberOfDOs), FALSE);
|
||||
}
|
||||
else /* if selected Input is > possible */
|
||||
{ /* Outputs, restart at Output 0 */
|
||||
dioWrite (thisDeviceNumber, diocnt, FALSE);
|
||||
}
|
||||
|
||||
/* Message out Test Results */
|
||||
sendString (SerOutPort, TRUE, testMessage,
|
||||
"\tLinetest for Digital Input ", ItoDStr(diocnt), ": ");
|
||||
sendString (SerOutPort, FALSE, testMessage,
|
||||
" ", Dummy, BoolRestoStr (LowBuffer));
|
||||
sendString (SerOutPort, FALSE, testMessage,
|
||||
" ", Dummy, BoolRestoStr (AllOtherBuffer));
|
||||
sendString (SerOutPort, FALSE, testMessage,
|
||||
" ", Dummy, BoolRestoStr (HighBuffer));
|
||||
vTaskDelay (50);
|
||||
}
|
||||
|
||||
/* Set complete LineTestResult */
|
||||
if ((LowTest == TRUE) && (HighTest == TRUE) && (AllOther == TRUE))
|
||||
{
|
||||
LineTestResult = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
LineTestResult = FALSE;
|
||||
}
|
||||
|
||||
return (LineTestResult);
|
||||
}
|
||||
|
||||
|
||||
BOOLEAN CheckAllOtherDIOZero (UINT32 DIONumber, BOOLEAN local)
|
||||
{
|
||||
UINT32 loopcnt = 0;
|
||||
BOOLEAN allZeroResult = TRUE;
|
||||
|
||||
for (loopcnt = 0; loopcnt < NumberOfDIOs; loopcnt++) /*Test Line by Line*/
|
||||
{
|
||||
if ((loopcnt == DIONumber) || /* except currently tested Input */
|
||||
(loopcnt == (DIONumber + NumberOfDOs)) ||
|
||||
(loopcnt == (DIONumber - NumberOfDOs)))
|
||||
{
|
||||
if (loopcnt < (NumberOfDIOs - 1))
|
||||
{
|
||||
loopcnt++; /* Skip currently tested Input */
|
||||
}
|
||||
else
|
||||
{
|
||||
break; /* If currently tested Input is the */
|
||||
} /* last one, simply break out */
|
||||
}
|
||||
|
||||
if (local == TRUE)
|
||||
{
|
||||
if (dioRead (thisDeviceNumber, loopcnt) == TRUE)
|
||||
{
|
||||
allZeroResult = FALSE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (dioRead (remoteDeviceNumber, loopcnt) == TRUE)
|
||||
{
|
||||
allZeroResult = FALSE;
|
||||
}
|
||||
vTaskDelay (100);
|
||||
}
|
||||
}
|
||||
return (allZeroResult);
|
||||
}
|
||||
@@ -0,0 +1,135 @@
|
||||
/* ---------------------------------------------------------------------------
|
||||
* testdio.h (c) 2008 Micro-key bv
|
||||
* ---------------------------------------------------------------------------
|
||||
* Micro-key bv
|
||||
* Industrieweg 28, 9804 TG Noordhorn
|
||||
* Postbus 92, 9800 AB Zuidhorn
|
||||
* The Netherlands
|
||||
* Tel: +31 594 503020
|
||||
* Fax: +31 594 505825
|
||||
* Email: support@microkey.nl
|
||||
* Web: www.microkey.nl
|
||||
* ---------------------------------------------------------------------------
|
||||
* Description:
|
||||
* Headerfile for digital Input/Output Test testdio.c
|
||||
* ---------------------------------------------------------------------------
|
||||
* Version(s): 0.1, Mar 06, 2008, MMi
|
||||
* Creation.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifndef TESTDIO_H_
|
||||
#define TESTDIO_H_
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* System include files.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#include "lpc23xx.h"
|
||||
#include "types.h"
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Application include files.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Constant and macro definitions.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Type definitions.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Variable declarations.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Function declarations.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Function: testdioStart
|
||||
*
|
||||
* Main Function for Digital Tests
|
||||
*
|
||||
* Parameters: void
|
||||
*
|
||||
* Return: BOOLEAN - Test Result
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
BOOLEAN testdioStart(void);
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Function: doDIOLineTest
|
||||
*
|
||||
* Function to test LOW and HIGH Level on every single digital Input
|
||||
*
|
||||
* Parameters: void
|
||||
*
|
||||
* Return: BOOLEAN - Test Result
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
BOOLEAN doDIOLineTest (void);
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Function: CheckAllOtherDIOZero
|
||||
*
|
||||
* Function to test if all other Inputs but the chosen one is LOW
|
||||
*
|
||||
* Parameters: UINT32 DIONumber - currently tested Input
|
||||
* BOOLEAN local - Check local or remote lines
|
||||
*
|
||||
* Return: BOOLEAN - Test Result
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
BOOLEAN CheckAllOtherDIOZero (UINT32 DIONumber, BOOLEAN local);
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Function: testremotedioStart
|
||||
*
|
||||
* Main function to remote Digital IO Test
|
||||
*
|
||||
* Parameters: void
|
||||
*
|
||||
* Return: BOOLEAN - Test Result
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
BOOLEAN testremotedioStart (void);
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Function: remotedioOutput
|
||||
*
|
||||
* Remote digital Output test
|
||||
*
|
||||
* Parameters: void
|
||||
*
|
||||
* Return: BOOLEAN - Test Result
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
BOOLEAN remotedioOutput (void);
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Function: remotedioInput
|
||||
*
|
||||
* Remote digital Input test
|
||||
*
|
||||
* Parameters: void
|
||||
*
|
||||
* Return: BOOLEAN - Test Result
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
BOOLEAN remotedioInput (void);
|
||||
|
||||
|
||||
|
||||
#endif /*TESTDIO_H_*/
|
||||
@@ -0,0 +1,172 @@
|
||||
/* ---------------------------------------------------------------------------
|
||||
* testeeprom.c (c) 2008 Micro-key bv
|
||||
* ---------------------------------------------------------------------------
|
||||
* Micro-key bv
|
||||
* Industrieweg 28, 9804 TG Noordhorn
|
||||
* Postbus 92, 9800 AB Zuidhorn
|
||||
* The Netherlands
|
||||
* Tel: +31 594 503020
|
||||
* Fax: +31 594 505825
|
||||
* Email: support@microkey.nl
|
||||
* Web: www.microkey.nl
|
||||
* ---------------------------------------------------------------------------
|
||||
* Description:
|
||||
* ---------------------------------------------------------------------------
|
||||
* Version(s): 0.1, Mar 11, 2008, MMi
|
||||
* Creation.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* System include files
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#include "lpc23xx.h"
|
||||
#include "types.h"
|
||||
|
||||
|
||||
/* FreeRTOS includes */
|
||||
#include "FreeRTOS.h"
|
||||
#include "Task.h"
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Application include files
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#include "testeeprom.h"
|
||||
#include "eeprom.h"
|
||||
#include "SerOut.h"
|
||||
#include "dio.h"
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Local constant and macro definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Global variable definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
/* Use same Arrays as Flash Test to minimize Memory usage */
|
||||
// \MARK ARRAYS NOT NECESSARY ON OLIMEXBOARD
|
||||
#if ((PINSET_TESTER == 1) || (PINSET_TESTER == 2))
|
||||
UINT8 eepromResponseString[3000];
|
||||
UINT8 eepromTestString[3000];
|
||||
#endif
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Local variable definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
UINT16 adres_var[2];
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Local function definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
BOOLEAN testeepromStart(void)
|
||||
{
|
||||
BOOLEAN eepromTestResult;
|
||||
|
||||
eepromTestResult = doeepromTest();
|
||||
|
||||
return (eepromTestResult);
|
||||
}
|
||||
|
||||
BOOLEAN doeepromTest (void)
|
||||
{
|
||||
BOOLEAN testFailed= FALSE;
|
||||
|
||||
// \MARK TEST NOT NECESSARY ON OLIMEXBOARD
|
||||
#if ((PINSET_TESTER == 1) || (PINSET_TESTER == 2))
|
||||
/*Local Variable Declaration */
|
||||
UINT8 testByte;
|
||||
UINT8 testString[] = "Dit is een oefening";
|
||||
UINT16 index;
|
||||
UINT8 oneByte = 0;
|
||||
|
||||
sendString (COM2, TRUE, testMessage,
|
||||
"\tWrite Byte 0x34 to Adress 256", Dummy, Dummy);
|
||||
eepromWrite (256, 0x34); /* Write one Byte to EEPROM */
|
||||
eepromRead (256, &testByte); /* Read written Byte from EEPROM */
|
||||
testFailed = (testByte != 0x34); /* compare read and written Bytes */
|
||||
if (testFailed == FALSE)
|
||||
{
|
||||
sendString (COM2, FALSE, testMessage,
|
||||
"\t DONE", Dummy, Dummy);
|
||||
dioWrite (0, 1, TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
sendString (COM2, FALSE, testMessage,
|
||||
"\t FAILURE", Dummy, Dummy);
|
||||
dioWrite (0, 0, TRUE);
|
||||
}
|
||||
|
||||
if (!testFailed) /* If no Test fail up to here */
|
||||
{
|
||||
sendString (COM2, TRUE, testMessage,
|
||||
"\tWrite 10 Bytes to Adress 511", Dummy, Dummy);
|
||||
eepromWriteBuffer( 511, testString, 10);
|
||||
/* Write Teststring to EEPROM with */
|
||||
/* width of 10 Bytes */
|
||||
eepromReadBuffer( 511, eepromResponseString, 10);
|
||||
/* Read written String from EEPROM */
|
||||
|
||||
for (index = 0; index < 10; index++)
|
||||
{ /* Compare both Strings */
|
||||
if (eepromResponseString[index] != testString[index])
|
||||
{ /* If Strings are not equal */
|
||||
testFailed = TRUE; /* Set Test Result to FALSE */
|
||||
}
|
||||
}
|
||||
if (testFailed == FALSE)
|
||||
{
|
||||
sendString (COM2, FALSE, testMessage,
|
||||
"\t DONE", Dummy, Dummy);
|
||||
dioWrite (0, 3, TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
sendString (COM2, FALSE, testMessage,
|
||||
"\t FAILURE", Dummy, Dummy);
|
||||
dioWrite (0, 2, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
if (!testFailed) /* If no Test fail up to here */
|
||||
{
|
||||
sendString (COM2, TRUE, testMessage,
|
||||
"\tWrite 3000 Byte to Adress 500", Dummy, Dummy);
|
||||
int loopcnt;
|
||||
for (loopcnt=0; loopcnt < 3000; loopcnt++)
|
||||
{ /* Fill flashTestString */
|
||||
eepromTestString[loopcnt] = oneByte++;
|
||||
}
|
||||
eepromWriteBuffer( 500, eepromTestString, 3000);
|
||||
/* Write flashTestString to EEPROM */
|
||||
/* with width of 3000 Bytes */
|
||||
eepromReadBuffer( 500, eepromResponseString, 3000);
|
||||
/* Read written String from EEPROM */
|
||||
|
||||
for (index = 0; index < 3000; index++)
|
||||
{ /* Compare both Strings */
|
||||
if (eepromResponseString[index] != eepromTestString[index])
|
||||
{ /* If Strings are not equal */
|
||||
testFailed = TRUE; /* Set Test Result to FALSE */
|
||||
}
|
||||
}
|
||||
if (testFailed == FALSE)
|
||||
{
|
||||
sendString (COM2, FALSE, testMessage, "\t DONE", Dummy, Dummy);
|
||||
dioWrite (0, 5, TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
sendString (COM2, FALSE, testMessage, "\t FAILURE", Dummy, Dummy);
|
||||
dioWrite (0, 4, TRUE);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return (!testFailed); /* Return Test Result */
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
/* ---------------------------------------------------------------------------
|
||||
* testeeprom.h (c) 2008 Micro-key bv
|
||||
* ---------------------------------------------------------------------------
|
||||
* Micro-key bv
|
||||
* Industrieweg 28, 9804 TG Noordhorn
|
||||
* Postbus 92, 9800 AB Zuidhorn
|
||||
* The Netherlands
|
||||
* Tel: +31 594 503020
|
||||
* Fax: +31 594 505825
|
||||
* Email: support@microkey.nl
|
||||
* Web: www.microkey.nl
|
||||
* ---------------------------------------------------------------------------
|
||||
* Description:
|
||||
* Headerfile for the EEPROMtest File testeeprom.c
|
||||
* ---------------------------------------------------------------------------
|
||||
* Version(s): 0.1, Mar 11, 2008, MMi
|
||||
* Creation.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef TESTEEPROM_H_
|
||||
#define TESTEEPROM_H_
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* System include files.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#include "lpc23xx.h"
|
||||
#include "types.h"
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Application include files.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Constant and macro definitions.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Type definitions.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Variable declarations.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Function declarations.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Function: testeepromStart
|
||||
*
|
||||
* Main Function for EEPROM Tests
|
||||
*
|
||||
* Parameter: void
|
||||
*
|
||||
* Return: BOOLEAN - Test result
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
BOOLEAN testeepromStart(void);
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Function: doeepromTest
|
||||
*
|
||||
* Function containing EEPROM Test routines
|
||||
*
|
||||
* Parameter: void
|
||||
*
|
||||
* Return: BOOLEAN - Test result
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
BOOLEAN doeepromTest (void);
|
||||
|
||||
|
||||
#endif /*TESTEEPROM_H_*/
|
||||
@@ -0,0 +1,120 @@
|
||||
/* ---------------------------------------------------------------------------
|
||||
* testpower.c (c) 2008 Micro-key bv
|
||||
* ---------------------------------------------------------------------------
|
||||
* Micro-key bv
|
||||
* Industrieweg 28, 9804 TG Noordhorn
|
||||
* Postbus 92, 9800 AB Zuidhorn
|
||||
* The Netherlands
|
||||
* Tel: +31 594 503020
|
||||
* Fax: +31 594 505825
|
||||
* Email: support@microkey.nl
|
||||
* Web: www.microkey.nl
|
||||
* ---------------------------------------------------------------------------
|
||||
* Description:
|
||||
* ---------------------------------------------------------------------------
|
||||
* Version(s): 0.1, Mar 25, 2008, MMi
|
||||
* Creation.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* System include files
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#include "lpc23xx.h"
|
||||
#include "types.h"
|
||||
|
||||
#include "FreeRTOS.h"
|
||||
#include "task.h"
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Application include files
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#include "testpower.h"
|
||||
#include "power.h"
|
||||
#include "SerOut.h"
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Local constant and macro definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Global variable definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#define lowerlimit5V 4800 /* Lower VCC Limit */
|
||||
#define higherlimit5V 5200 /* Higher VCC Limit */
|
||||
|
||||
#define lowerlimit24V 23000 /* Lower 24V Limit */
|
||||
#define higherlimit24V 25000 /* Higher 24V Limit */
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Local variable definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
static UINT8 PWRTest; /* Debugable Variable, to show Bus Test Result */
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Local function definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
BOOLEAN testpowerStart(void)
|
||||
{
|
||||
BOOLEAN PowerTestResult; /* BOOLEAN Variable for Test Result */
|
||||
|
||||
PowerTestResult = DoVoltageTest(); /* Do Power Test */
|
||||
return PowerTestResult; /* Return Test Result */
|
||||
}
|
||||
BOOLEAN DoVoltageTest (void)
|
||||
{
|
||||
/* Local Variable Declaration */
|
||||
BOOLEAN VTestResult = TRUE;
|
||||
static UINT16 vMeasure5V; /* Debugable */
|
||||
static UINT16 vMeasure24V;
|
||||
|
||||
PWRTest = 0x11;
|
||||
|
||||
/* Test for 5 V VCC Power Supply */
|
||||
vMeasure5V = powerVccVoltage(); /* Read current VCC Voltage */
|
||||
/* Message out Measure Value and Test Limits */
|
||||
sendString (SerOutPort, TRUE, testMessage, "\t5V Powertest", NewLine,
|
||||
"\tLimits (lower/higher): ");
|
||||
sendString (SerOutPort, FALSE, testMessage,
|
||||
ItoDStr (lowerlimit5V), devider, Dummy);
|
||||
sendString (SerOutPort, FALSE, testMessage,
|
||||
Dummy, Dummy, ItoDStr (higherlimit5V));
|
||||
sendString (SerOutPort, TRUE, testMessage,
|
||||
"\tDetected ", ItoDStr(vMeasure5V), " mV");
|
||||
|
||||
if ((vMeasure5V < lowerlimit5V) || (vMeasure5V > higherlimit5V))
|
||||
{ /* If measured Value out of Limits */
|
||||
VTestResult = FALSE; /* Set Test Result to FALSE */
|
||||
PWRTest &= ~(0x01);
|
||||
}
|
||||
|
||||
vTaskDelay (500); /* Wait for 500 ms */
|
||||
|
||||
/* Test for 24 V Power Supply */
|
||||
vMeasure24V = powerV24Voltage(); /* Read current power supply Voltage*/
|
||||
/* Message out Measure Value and Test Limits */
|
||||
sendString (SerOutPort, TRUE, testMessage, "\n\r\t24V Powertest", NewLine,
|
||||
"\tLimits (lower/higher): ");
|
||||
sendString (SerOutPort, FALSE, testMessage,
|
||||
ItoDStr (lowerlimit24V), devider, Dummy);
|
||||
sendString (SerOutPort, FALSE, testMessage,
|
||||
Dummy, Dummy, ItoDStr (higherlimit24V));
|
||||
sendString (SerOutPort, TRUE, testMessage,
|
||||
"\tDetected ", ItoDStr(vMeasure24V), " mV");
|
||||
|
||||
if ((vMeasure24V < lowerlimit24V) || (vMeasure24V > higherlimit24V))
|
||||
{ /* If measured Value out of Limits */
|
||||
VTestResult = FALSE; /* Set Test Result to FALSE */
|
||||
PWRTest &= ~(0x10);
|
||||
}
|
||||
|
||||
return VTestResult; /* Return Test Result */
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
/* ---------------------------------------------------------------------------
|
||||
* testpower.h (c) 2008 Micro-key bv
|
||||
* ---------------------------------------------------------------------------
|
||||
* Micro-key bv
|
||||
* Industrieweg 28, 9804 TG Noordhorn
|
||||
* Postbus 92, 9800 AB Zuidhorn
|
||||
* The Netherlands
|
||||
* Tel: +31 594 503020
|
||||
* Fax: +31 594 505825
|
||||
* Email: support@microkey.nl
|
||||
* Web: www.microkey.nl
|
||||
* ---------------------------------------------------------------------------
|
||||
* Description:
|
||||
* Headerfile for powertest File testpower.c
|
||||
* ---------------------------------------------------------------------------
|
||||
* Version(s): 0.1, Mar 25, 2008, MMi
|
||||
* Creation.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef TESTPOWER_H_
|
||||
#define TESTPOWER_H_
|
||||
/* ---------------------------------------------------------------------------
|
||||
* System include files.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#include "lpc23xx.h"
|
||||
#include "types.h"
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Application include files.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Constant and macro definitions.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Type definitions.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Variable declarations.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Function declarations.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Function: testpowerStart
|
||||
*
|
||||
* Main Function for Power Tests
|
||||
*
|
||||
* Parameter: void
|
||||
*
|
||||
* Return: BOOLEAN - Test Result
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
BOOLEAN testpowerStart(void);
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Function: DoVoltageTest
|
||||
*
|
||||
* Function to test VCC and 24V Power Supply
|
||||
*
|
||||
* Parameter: void
|
||||
*
|
||||
* Return: BOOLEAN - Test Result
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
BOOLEAN DoVoltageTest (void);
|
||||
|
||||
|
||||
#endif /*TESTPOWER_H_*/
|
||||
@@ -0,0 +1,48 @@
|
||||
/* ---------------------------------------------------------------------------
|
||||
* testrly.c (c) 2008 Micro-key bv
|
||||
* ---------------------------------------------------------------------------
|
||||
* Micro-key bv
|
||||
* Industrieweg 28, 9804 TG Noordhorn
|
||||
* Postbus 92, 9800 AB Zuidhorn
|
||||
* The Netherlands
|
||||
* Tel: +31 594 503020
|
||||
* Fax: +31 594 505825
|
||||
* Email: support@microkey.nl
|
||||
* Web: www.microkey.nl
|
||||
* ---------------------------------------------------------------------------
|
||||
* Description:
|
||||
* ---------------------------------------------------------------------------
|
||||
* Version(s): 0.1, Nov 17, 2008, MMi
|
||||
* Creation.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* System include files
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Application include files
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Local constant and macro definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Global variable definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Local variable definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Local function definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -0,0 +1,52 @@
|
||||
/* ---------------------------------------------------------------------------
|
||||
* testrly.h (c) 2008 Micro-key bv
|
||||
* ---------------------------------------------------------------------------
|
||||
* Micro-key bv
|
||||
* Industrieweg 28, 9804 TG Noordhorn
|
||||
* Postbus 92, 9800 AB Zuidhorn
|
||||
* The Netherlands
|
||||
* Tel: +31 594 503020
|
||||
* Fax: +31 594 505825
|
||||
* Email: support@microkey.nl
|
||||
* Web: www.microkey.nl
|
||||
* ---------------------------------------------------------------------------
|
||||
* Description:
|
||||
* ---------------------------------------------------------------------------
|
||||
* Version(s): 0.1, Nov 17, 2008, MMi
|
||||
* Creation.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef TESTRLY_H_
|
||||
#define TESTRLY_H_
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* System include files.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Application include files.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Constant and macro definitions.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Type definitions.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Variable declarations.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Function declarations.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#endif /*TESTRLY_H_*/
|
||||
@@ -0,0 +1,182 @@
|
||||
/* ---------------------------------------------------------------------------
|
||||
* testrtc.c (c) 2008 Micro-key bv
|
||||
* ---------------------------------------------------------------------------
|
||||
* Micro-key bv
|
||||
* Industrieweg 28, 9804 TG Noordhorn
|
||||
* Postbus 92, 9800 AB Zuidhorn
|
||||
* The Netherlands
|
||||
* Tel: +31 594 503020
|
||||
* Fax: +31 594 505825
|
||||
* Email: support@microkey.nl
|
||||
* Web: www.microkey.nl
|
||||
* ---------------------------------------------------------------------------
|
||||
* Description:
|
||||
* ---------------------------------------------------------------------------
|
||||
* Version(s): 0.1, Feb 26, 2008, MMi
|
||||
* Creation.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* System include files
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#include "lpc23xx.h"
|
||||
#include "types.h"
|
||||
|
||||
/* FreeRTOS includes */
|
||||
#include "FreeRTOS.h"
|
||||
#include "task.h"
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Application include files
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#include "testrtc.h"
|
||||
#include "rtc.h"
|
||||
#include "SerOut.h"
|
||||
#include "ledfunctions.h"
|
||||
#include "dio.h"
|
||||
#include "testdio.h"
|
||||
#include "taskfunctions.h"
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Local constant and macro definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
/* Clock defines to set Clock to a known Value */
|
||||
#define dsec 5
|
||||
#define dmin 10
|
||||
#define dhour 15
|
||||
#define dday 20
|
||||
#define ddow 2
|
||||
#define dmon 3
|
||||
#define dyear 3250
|
||||
#define ddoy 350
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Global variable definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Local variable definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
t_rtc rtcWriteValue = /* Variable of RTC-used Type to set */
|
||||
{ dsec, /* RTC to a known Value */
|
||||
dmin,
|
||||
dhour,
|
||||
dday,
|
||||
ddow,
|
||||
dmon,
|
||||
dday,
|
||||
dyear,
|
||||
ddoy};
|
||||
|
||||
t_rtc rtcReadValue; /* Variable of RTC-used Type to */
|
||||
/* read RTC Values */
|
||||
t_rtc *rtcPtr; /* Pointer of RTC-Used Type */
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Local function definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
BOOLEAN testrtcStart(void)
|
||||
{
|
||||
BOOLEAN testrtcResult = TRUE; /* BOOLEAN Variable for Test Result */
|
||||
|
||||
DoRTCWrite(); /* Write known Value to RTC */
|
||||
dioWrite (0, 1, TRUE);
|
||||
dioWrite (0, 3, TRUE);
|
||||
testrtcResult = DoRTCRead(); /* Read RTC Values */
|
||||
|
||||
return (testrtcResult); /* Return Test Result */
|
||||
}
|
||||
|
||||
|
||||
void DoRTCWrite (void)
|
||||
{
|
||||
rtcPtr = &rtcWriteValue; /* Set Pointer */
|
||||
sendString (SerOutPort, TRUE, testMessage,
|
||||
"\tWrite Custom CLOCK Data to RTC Register",
|
||||
Dummy, NewLine); /* Message Output */
|
||||
rtcWrite (rtcPtr); /* Write Values to RTC */
|
||||
}
|
||||
|
||||
|
||||
BOOLEAN DoRTCRead (void)
|
||||
{
|
||||
BOOLEAN rtcReadResult;
|
||||
rtcPtr = &rtcReadValue; /* Set Pointer */
|
||||
|
||||
sendString (SerOutPort, TRUE, testMessage,
|
||||
"\tAttempt to read RTC Values: ",
|
||||
Dummy, Dummy); /* Message Output */
|
||||
|
||||
rtcRead (rtcPtr); /* Read RTC Values */
|
||||
|
||||
/* Message out all read Values compared with written Values */
|
||||
sendString (SerOutPort, TRUE, testMessage, "\tRTC Seconds: ",
|
||||
ItoDStr (rtcReadValue.sec), Dummy);
|
||||
sendString (SerOutPort, FALSE, testMessage,
|
||||
"\t(Should be: ", ItoDStr (dsec), ")");
|
||||
vTaskDelay (200);
|
||||
sendString (SerOutPort, TRUE, testMessage, "\tRTC Minutes: ",
|
||||
ItoDStr (rtcReadValue.min), Dummy);
|
||||
sendString (SerOutPort, FALSE, testMessage,
|
||||
"\t(Should be: ", ItoDStr (dmin), ")");
|
||||
vTaskDelay (200);
|
||||
sendString (SerOutPort, TRUE, testMessage, "\tRTC Hours: ",
|
||||
ItoDStr (rtcReadValue.hour), Dummy);
|
||||
sendString (SerOutPort, FALSE, testMessage,
|
||||
"\t(Should be: ", ItoDStr (dhour), ")");
|
||||
vTaskDelay (200);
|
||||
sendString (SerOutPort, TRUE, testMessage, "\tRTC Day: ",
|
||||
ItoDStr (rtcReadValue.day), Dummy);
|
||||
sendString (SerOutPort, FALSE, testMessage,
|
||||
"\t(Should be: ", ItoDStr (dday), ")");
|
||||
vTaskDelay (200);
|
||||
sendString (SerOutPort, TRUE, testMessage, "\tRTC Day of Week: ",
|
||||
ItoDStr (rtcReadValue.dow), Dummy);
|
||||
sendString (SerOutPort, FALSE, testMessage,
|
||||
"\t(Should be: ", ItoDStr (ddow), ")");
|
||||
vTaskDelay (200);
|
||||
sendString (SerOutPort, TRUE, testMessage, "\tRTC Month: ",
|
||||
ItoDStr (rtcReadValue.mon), Dummy);
|
||||
sendString (SerOutPort, FALSE, testMessage,
|
||||
"\t(Should be: ", ItoDStr (dmon), ")");
|
||||
vTaskDelay (200);
|
||||
sendString (SerOutPort, TRUE, testMessage, "\tRTC Year: ",
|
||||
ItoDStr (rtcReadValue.year), Dummy);
|
||||
sendString (SerOutPort, FALSE, testMessage,
|
||||
"\t(Should be: ", ItoDStr (dyear), ")");
|
||||
vTaskDelay (200);
|
||||
sendString (SerOutPort, TRUE, testMessage, "\tRTC Day of Year: ",
|
||||
ItoDStr (rtcReadValue.doy), Dummy);
|
||||
sendString (SerOutPort, FALSE, testMessage,
|
||||
"\t(Should be: ", ItoDStr (ddoy), ")");
|
||||
|
||||
if ((dsec == rtcReadValue.sec) && /* Compare read Values with */
|
||||
(dmin == rtcReadValue.min) && /* written Values */
|
||||
(dhour == rtcReadValue.hour) &&
|
||||
(dday == rtcReadValue.day) &&
|
||||
(ddow == rtcReadValue.dow) &&
|
||||
(dmon == rtcReadValue.mon) &&
|
||||
(dyear == rtcReadValue.year) &&
|
||||
(ddoy == rtcReadValue.doy))
|
||||
{ /* If all Values equals */
|
||||
|
||||
rtcRead (rtcPtr); /* Read RTC Values again */
|
||||
if (dsec != rtcReadValue.sec) /* If RTC runs (seconds-compare) */
|
||||
{
|
||||
rtcReadResult = TRUE; /* Set Test Result to TRUE */
|
||||
}
|
||||
else /* If Run Test fails */
|
||||
{
|
||||
rtcReadResult = FALSE; /* Set Test Result to FALSE */
|
||||
}
|
||||
}
|
||||
else /* If Read Test Fails */
|
||||
{
|
||||
rtcReadResult = FALSE; /* Set Test Result to FALSE */
|
||||
}
|
||||
|
||||
return rtcReadResult; /* Return Test Result */
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
/* ---------------------------------------------------------------------------
|
||||
* testrtc.h (c) 2008 Micro-key bv
|
||||
* ---------------------------------------------------------------------------
|
||||
* Micro-key bv
|
||||
* Industrieweg 28, 9804 TG Noordhorn
|
||||
* Postbus 92, 9800 AB Zuidhorn
|
||||
* The Netherlands
|
||||
* Tel: +31 594 503020
|
||||
* Fax: +31 594 505825
|
||||
* Email: support@microkey.nl
|
||||
* Web: www.microkey.nl
|
||||
* ---------------------------------------------------------------------------
|
||||
* Description:
|
||||
* Headerfile for RTC test File testrtc.c
|
||||
* ---------------------------------------------------------------------------
|
||||
* Version(s): 0.1, Feb 26, 2008, MMi
|
||||
* Creation.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef TESTRTC_H_
|
||||
#define TESTRTC_H_
|
||||
/* ---------------------------------------------------------------------------
|
||||
* System include files.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#include "lpc23xx.h"
|
||||
#include "types.h"
|
||||
|
||||
|
||||
/* FreeRTOS includes */
|
||||
#include "FreeRTOS.h"
|
||||
#include "Task.h"
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Application include files.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Constant and macro definitions.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Type definitions.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Variable declarations.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Function declarations.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Function: testrtcStart
|
||||
*
|
||||
* Main Function for RTC Tests
|
||||
*
|
||||
* Parameter: void
|
||||
*
|
||||
* Return: BOOLEAN - Test Result
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
BOOLEAN testrtcStart(void);
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Function: DoRTCWrite
|
||||
*
|
||||
* Writes defined Values to the RTC
|
||||
*
|
||||
* Parameter: void
|
||||
*
|
||||
* Return: void
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
void DoRTCWrite (void);
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Function: DoRTCRead
|
||||
*
|
||||
* Reads Values from the RTC and compares them with written Values. Also does
|
||||
* a check if RTC is running
|
||||
*
|
||||
* Parameter: void
|
||||
*
|
||||
* Return: BOOLEAN - Test Result
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
BOOLEAN DoRTCRead (void);
|
||||
|
||||
#endif /*TESTRTC_H_*/
|
||||
@@ -0,0 +1,180 @@
|
||||
/* ---------------------------------------------------------------------------
|
||||
* topoftest.c (c) 2008 Micro-key bv
|
||||
* ---------------------------------------------------------------------------
|
||||
* Micro-key bv
|
||||
* Industrieweg 28, 9804 TG Noordhorn
|
||||
* Postbus 92, 9800 AB Zuidhorn
|
||||
* The Netherlands
|
||||
* Tel: +31 594 503020
|
||||
* Fax: +31 594 505825
|
||||
* Email: support@microkey.nl
|
||||
* Web: www.microkey.nl
|
||||
* ---------------------------------------------------------------------------
|
||||
* Description:
|
||||
* DesignTest MAIN File
|
||||
* Contains automatic Test Application
|
||||
* ---------------------------------------------------------------------------
|
||||
* Version(s): 0.1, Mar 06, 2008, MMi
|
||||
* Creation.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* System include files
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
/* Compiler includes */
|
||||
#include <string.h>
|
||||
|
||||
#include "LPC23xx.h"
|
||||
#include "types.h"
|
||||
|
||||
/* FreeRTOS includes */
|
||||
#include "FreeRTOS.h"
|
||||
#include "task.h"
|
||||
#include "semphr.h"
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Application include files
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#include "topoftest.h"
|
||||
#include "dio.h"
|
||||
#include "ledfunctions.h"
|
||||
#include "taskfunctions.h"
|
||||
#include "menu.h"
|
||||
#include "menuargs.h"
|
||||
#include "serial.h"
|
||||
#include "SerOut.h"
|
||||
#include "bus.h"
|
||||
#include "dac.h"
|
||||
#include "BusProtocol.h"
|
||||
#include "protocolfunctions.h"
|
||||
#include "remote_tests.h"
|
||||
#include "remote_misc.h"
|
||||
|
||||
/*Test includes */
|
||||
#include "testLED.h"
|
||||
#include "testdio.h"
|
||||
#include "testaio.h"
|
||||
#include "testBUS.h"
|
||||
#include "testeeprom.h"
|
||||
#include "testMMC.h"
|
||||
#include "testpower.h"
|
||||
#include "testrtc.h"
|
||||
|
||||
/* temp includes */
|
||||
#include "fat_test.h"
|
||||
#include "mmc_transfer.h"
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Local constant and macro definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* Time in ms between single Tests */
|
||||
#define TestPause 100
|
||||
|
||||
/* BUS Communication IDs */
|
||||
#define BUS_ID 1 /* 1 for Master, >1 for Slave */
|
||||
#define BUS_numbers 2 /* Maximum Numbers of Devices */
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Global variable definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Local variable definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
UINT32 UINT32result;
|
||||
BOOLEAN auto_testResult;
|
||||
BOOLEAN placedEB = TRUE; /* Indicate whether Extension Board is connected */
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Local function definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
void mainInit(void)
|
||||
{
|
||||
#if ((PINSET_TESTER == 0) || (PINSET_TESTER == 2))
|
||||
/* Olimex Board and Tester only have one serial port */
|
||||
SerOutPort = COM1; /* Set Message ComPort to COM2 */
|
||||
MenuPort = COM1;
|
||||
#else
|
||||
/* IO-CTRL got 2 serial ports to communicate */
|
||||
SerOutPort = COM2; /* Set Message ComPort to COM2 */
|
||||
MenuPort = COM2;
|
||||
#endif
|
||||
|
||||
thisDeviceNumber = 0; /* define this device as Master */
|
||||
remoteDeviceNumber = 2; /* define default remote device */
|
||||
|
||||
block_ImportantMessage = FALSE;
|
||||
block_HeaderMessage = FALSE;
|
||||
block_ResultMessage = FALSE;
|
||||
block_NoteMessage = FALSE;
|
||||
block_TestMessage = FALSE;
|
||||
block_MenuMessage = TRUE;
|
||||
block_SpinningWheel = TRUE;
|
||||
GotoNewLine = TRUE;
|
||||
|
||||
|
||||
/* Do Test Initialisations */
|
||||
taskInit(); /* Initialize TaskStatus Variables */
|
||||
protocolInit (BUS1, BUS_ID, BUS_numbers); /* Init Bus System */
|
||||
|
||||
|
||||
/* Indicate Board activity with flashing green LED */
|
||||
d_gLED = xTaskCreate( (void *)gLEDToggle,
|
||||
( signed portCHAR * ) "LedToggle",
|
||||
configMINIMAL_STACK_SIZE, (UINT16 *)500,
|
||||
tskIDLE_PRIORITY + 2, &gLED);
|
||||
|
||||
/* Create Spinning Wheel Task and block it immediately */
|
||||
d_spinWheel = xTaskCreate( (void *)showSpinningWheel,
|
||||
( signed portCHAR * ) "SpinningWheel",
|
||||
configMINIMAL_STACK_SIZE, NULL,
|
||||
tskIDLE_PRIORITY + 2, &spinWheel);
|
||||
|
||||
|
||||
|
||||
// dioClean();
|
||||
CallMenu(); /* Goto Menu */
|
||||
|
||||
}
|
||||
|
||||
|
||||
void showSpinningWheel (void)
|
||||
{
|
||||
static UINT32 arraycnt = 0;
|
||||
UINT8 SpinningWheelArray[4] = {'-', '\\', '|', '/'};
|
||||
|
||||
|
||||
for (;;)
|
||||
{
|
||||
/* Make it possible to block the PrintOut of the Wheel */
|
||||
switch (block_SpinningWheel)
|
||||
{
|
||||
case TRUE:
|
||||
break;
|
||||
case FALSE:
|
||||
/* Set cursor one Position to left, then Put Character */
|
||||
/* Don't care about the Warning */
|
||||
serWrite(SerOutPort, strlen("\x1B[1D"), (UINT8 *)"\x1B[1D");
|
||||
serPut(SerOutPort, SpinningWheelArray[arraycnt]);
|
||||
|
||||
if (arraycnt == 3)
|
||||
{
|
||||
arraycnt = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
arraycnt += 1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
vTaskDelay(100);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,117 @@
|
||||
/* ---------------------------------------------------------------------------
|
||||
* topoftest.h (c) 2008 Micro-key bv
|
||||
* ---------------------------------------------------------------------------
|
||||
* Micro-key bv
|
||||
* Industrieweg 28, 9804 TG Noordhorn
|
||||
* Postbus 92, 9800 AB Zuidhorn
|
||||
* The Netherlands
|
||||
* Tel: +31 594 503020
|
||||
* Fax: +31 594 505825
|
||||
* Email: support@microkey.nl
|
||||
* Web: www.microkey.nl
|
||||
* ---------------------------------------------------------------------------
|
||||
* Description:
|
||||
* Headfile for Main designtest File topoftest.c
|
||||
* ---------------------------------------------------------------------------
|
||||
* Version(s): 0.1, Mar 06, 2008, MMi
|
||||
* Creation.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef TOPOFTEST_H_
|
||||
#define TOPOFTEST_H_
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* System include files.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#include "lpc23xx.h"
|
||||
#include "types.h"
|
||||
#include "serial.h"
|
||||
|
||||
/* FreeRTOS includes */
|
||||
#include "FreeRTOS.h"
|
||||
#include "task.h"
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Application include files.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Constant and macro definitions.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Type definitions.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Variable declarations.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
/* Global Test Result Variables */
|
||||
BOOLEAN g_slaveaiotest;
|
||||
BOOLEAN g_ledtest;
|
||||
BOOLEAN g_framtest;
|
||||
BOOLEAN g_diotest;
|
||||
BOOLEAN g_aiotest;
|
||||
BOOLEAN g_cantest;
|
||||
BOOLEAN g_eepromtest;
|
||||
BOOLEAN g_flashtest;
|
||||
BOOLEAN g_comtest;
|
||||
BOOLEAN g_mmctest;
|
||||
BOOLEAN g_logtest;
|
||||
BOOLEAN g_powertest;
|
||||
BOOLEAN g_rtctest;
|
||||
BOOLEAN g_batterytest;
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Function declarations.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Function: designtest
|
||||
*
|
||||
* Main Function to the design Test.
|
||||
* Application Initialisations are called from here.
|
||||
*
|
||||
* Parameters: void
|
||||
*
|
||||
* Return: void
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
void mainInit(void);
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Function: CalcTestResult
|
||||
*
|
||||
* Calculates a "PASSED" oder "FAILED" Result out of the single, global
|
||||
* Test Results
|
||||
*
|
||||
* Parameters: void
|
||||
*
|
||||
* Return: BOOLEAN - Calculation Result
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
BOOLEAN CalcTestResult (void);
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Function: showSpinningWheel
|
||||
*
|
||||
* Function to show a spinning wheel out of characters '/', '-', '\' and '|'
|
||||
* The Wheel is used to indecate, that the system is still running but busy
|
||||
* with a certain task.
|
||||
*
|
||||
* Parameter: void
|
||||
*
|
||||
* Return: void
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
void showSpinningWheel (void);
|
||||
|
||||
#endif /*TOPOFTEST_H_*/
|
||||
@@ -0,0 +1,640 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<?fileVersion 4.0.0?>
|
||||
|
||||
<cproject>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.settings">
|
||||
<cconfiguration id="cdt.managedbuild.config.gnu.cygwin.exe.debug.1822617334">
|
||||
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.cygwin.exe.debug.1822617334" moduleId="org.eclipse.cdt.core.settings" name="Debug">
|
||||
<externalSettings/>
|
||||
<extensions>
|
||||
<extension id="org.eclipse.cdt.core.Cygwin_PE" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
<extension id="org.eclipse.cdt.core.MakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
</extensions>
|
||||
</storageModule>
|
||||
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||
<configuration artifactExtension="elf" artifactName="BootLoader" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug,org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="" id="cdt.managedbuild.config.gnu.cygwin.exe.debug.1822617334" name="Debug" parent="cdt.managedbuild.config.gnu.cygwin.exe.debug" postannouncebuildStep="Build HEX & Symbol files" postbuildStep="arm-elf-objcopy ${BuildArtifactFileName} -O ihex ${BuildArtifactFileBaseName}.hex && arm-elf-nm -n ${BuildArtifactFileName} > ${BuildArtifactFileBaseName}.sym " preannouncebuildStep="" prebuildStep="">
|
||||
<folderInfo id="cdt.managedbuild.config.gnu.cygwin.exe.debug.1822617334." name="/" resourcePath="">
|
||||
<toolChain id="cdt.managedbuild.toolchain.gnu.cygwin.exe.debug.475123734" name="Cygwin GCC" superClass="cdt.managedbuild.toolchain.gnu.cygwin.exe.debug">
|
||||
<targetPlatform id="cdt.managedbuild.target.gnu.platform.cygwin.exe.debug.1571482679" name="Debug Platform" superClass="cdt.managedbuild.target.gnu.platform.cygwin.exe.debug"/>
|
||||
<builder buildPath="${workspace_loc:/BootLoader/Debug}" id="cdt.managedbuild.target.gnu.builder.cygwin.exe.debug.169364774" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="cdt.managedbuild.target.gnu.builder.cygwin.exe.debug"/>
|
||||
<tool command="arm-elf-as" id="cdt.managedbuild.tool.gnu.assembler.cygwin.exe.debug.2039043188" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.cygwin.exe.debug">
|
||||
<inputType id="cdt.managedbuild.tool.gnu.assembler.input.1800208006" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
|
||||
</tool>
|
||||
<tool id="cdt.managedbuild.tool.gnu.archiver.cygwin.base.1287807221" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.cygwin.base"/>
|
||||
<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.cygwin.exe.debug.1018125982" name="Cygwin C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.cygwin.exe.debug">
|
||||
<option id="gnu.cpp.compiler.cygwin.exe.debug.option.optimization.level.743353311" name="Optimization Level" superClass="gnu.cpp.compiler.cygwin.exe.debug.option.optimization.level" value="gnu.cpp.compiler.optimization.level.none" valueType="enumerated"/>
|
||||
<option id="gnu.cpp.compiler.cygwin.exe.debug.option.debugging.level.214016809" name="Debug Level" superClass="gnu.cpp.compiler.cygwin.exe.debug.option.debugging.level" value="gnu.cpp.compiler.debugging.level.max" valueType="enumerated"/>
|
||||
</tool>
|
||||
<tool command="arm-elf-gcc" id="cdt.managedbuild.tool.gnu.c.compiler.cygwin.exe.debug.1736357620" name="Cygwin C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.cygwin.exe.debug">
|
||||
<option defaultValue="gnu.c.optimization.level.none" id="gnu.c.compiler.cygwin.exe.debug.option.optimization.level.387927747" name="Optimization Level" superClass="gnu.c.compiler.cygwin.exe.debug.option.optimization.level" value="gnu.c.optimization.level.more" valueType="enumerated"/>
|
||||
<option id="gnu.c.compiler.cygwin.exe.debug.option.debugging.level.309309572" name="Debug Level" superClass="gnu.c.compiler.cygwin.exe.debug.option.debugging.level" value="gnu.c.debugging.level.none" valueType="enumerated"/>
|
||||
<option id="gnu.c.compiler.option.include.paths.683380352" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/inc}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/FreeRTOS/include}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/Drivers}""/>
|
||||
</option>
|
||||
<option id="gnu.c.compiler.option.misc.other.1132712743" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fomit-frame-pointer -mcpu=arm7tdmi -Wa,-adhlns=${OUTPUT_PREFIX}.lst -mthumb-interwork" valueType="string"/>
|
||||
<option id="gnu.c.compiler.option.preprocessor.def.symbols.267432365" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" valueType="definedSymbols">
|
||||
<listOptionValue builtIn="false" value="ROWLEY_LPC23xx"/>
|
||||
<listOptionValue builtIn="false" value="ALIGN_STRUCT_END=__attribute\(\(aligned\(4\)\)\)"/>
|
||||
<listOptionValue builtIn="false" value="PACK_STRUCT_END=__attribute\(\(packed\)\)"/>
|
||||
</option>
|
||||
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.cygwin.240736807" superClass="cdt.managedbuild.tool.gnu.c.compiler.input.cygwin"/>
|
||||
</tool>
|
||||
<tool command="arm-elf-gcc" commandLinePattern="${COMMAND} ${FLAGS} "${workspace_loc:/BootLoader/bootbl.s}" ${OUTPUT_FLAG}${OUTPUT_PREFIX}${OUTPUT} ${INPUTS}" id="cdt.managedbuild.tool.gnu.c.linker.cygwin.exe.debug.2033802624" name="Cygwin C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.cygwin.exe.debug">
|
||||
<option id="gnu.c.link.option.nostart.393578512" name="Do not use standard start files (-nostartfiles)" superClass="gnu.c.link.option.nostart" value="true" valueType="boolean"/>
|
||||
<option id="gnu.c.link.option.libs.929241096" name="Libraries (-l)" superClass="gnu.c.link.option.libs" valueType="libs">
|
||||
<listOptionValue builtIn="false" value="Drivers"/>
|
||||
</option>
|
||||
<option id="gnu.c.link.option.paths.2045578413" name="Library search path (-L)" superClass="gnu.c.link.option.paths" valueType="libPaths">
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/Drivers/Debug}""/>
|
||||
</option>
|
||||
<option id="gnu.c.link.option.other.1386441755" name="Other options (-Xlinker [option])" superClass="gnu.c.link.option.other" valueType="stringList">
|
||||
<listOptionValue builtIn="false" value="-M"/>
|
||||
<listOptionValue builtIn="false" value="-Map=${BuildArtifactFileBaseName}.map"/>
|
||||
<listOptionValue builtIn="false" value="--error-unresolved-symbols"/>
|
||||
</option>
|
||||
<option id="gnu.c.link.option.ldflags.1971598579" name="Linker flags" superClass="gnu.c.link.option.ldflags" value="-T"${workspace_loc:/BootLoader/lpc2368bl.ld}" -mthumb-interwork" valueType="string"/>
|
||||
<inputType id="cdt.managedbuild.tool.gnu.c.linker.input.1562844765" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
|
||||
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
|
||||
<additionalInput kind="additionalinput" paths="$(LIBS)"/>
|
||||
</inputType>
|
||||
</tool>
|
||||
<tool id="cdt.managedbuild.tool.gnu.cpp.linker.cygwin.exe.debug.378779751" name="Cygwin C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.cygwin.exe.debug"/>
|
||||
</toolChain>
|
||||
</folderInfo>
|
||||
<fileInfo id="cdt.managedbuild.config.gnu.cygwin.exe.debug.1822617334.1927321613" name="appImage.c" rcbsApplicability="disable" resourcePath="appImage.c" toolsToInvoke="cdt.managedbuild.tool.gnu.c.compiler.cygwin.exe.debug.1736357620.1841951792">
|
||||
<tool id="cdt.managedbuild.tool.gnu.c.compiler.cygwin.exe.debug.1736357620.1841951792" name="Cygwin C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.cygwin.exe.debug.1736357620">
|
||||
<option id="gnu.c.compiler.option.misc.other.16529659" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fomit-frame-pointer -mcpu=arm7tdmi -Wa,-adhlns=appImage.lst -mthumb-interwork" valueType="string"/>
|
||||
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.cygwin.614418320" superClass="cdt.managedbuild.tool.gnu.c.compiler.input.cygwin"/>
|
||||
</tool>
|
||||
<tool announcement="Invoking: Resource Custom Build Step" command="" customBuildStep="true" id="org.eclipse.cdt.managedbuilder.ui.rcbs.686390080" name="Resource Custom Build Step">
|
||||
<inputType id="org.eclipse.cdt.managedbuilder.ui.rcbs.inputtype.1697795953" name="Resource Custom Build Step Input Type">
|
||||
<additionalInput kind="additionalinputdependency" paths=""/>
|
||||
</inputType>
|
||||
<outputType id="org.eclipse.cdt.managedbuilder.ui.rcbs.outputtype.1751288609" name="Resource Custom Build Step Output Type" outputNames=""/>
|
||||
</tool>
|
||||
</fileInfo>
|
||||
<sourceEntries>
|
||||
<entry excluding="iap.s|bootbl.s|boot.s" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
|
||||
</sourceEntries>
|
||||
</configuration>
|
||||
</storageModule>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.language.mapping"/>
|
||||
|
||||
<storageModule moduleId="scannerConfiguration">
|
||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"/>
|
||||
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="makefileGenerator">
|
||||
<runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.cygwin.exe.release.1492194825;cdt.managedbuild.config.gnu.cygwin.exe.release.1492194825.;cdt.managedbuild.tool.gnu.c.compiler.cygwin.exe.release.699035238;cdt.managedbuild.tool.gnu.c.compiler.input.cygwin.805945285">
|
||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC"/>
|
||||
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="makefileGenerator">
|
||||
<runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
</scannerConfigBuildInfo>
|
||||
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.cygwin.exe.debug.1822617334;cdt.managedbuild.config.gnu.cygwin.exe.debug.1822617334.;cdt.managedbuild.tool.gnu.c.compiler.cygwin.exe.debug.1736357620;cdt.managedbuild.tool.gnu.c.compiler.input.cygwin.240736807">
|
||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC"/>
|
||||
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="makefileGenerator">
|
||||
<runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="arm-elf-gcc" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
</scannerConfigBuildInfo>
|
||||
</storageModule>
|
||||
</cconfiguration>
|
||||
<cconfiguration id="cdt.managedbuild.config.gnu.cygwin.exe.release.1492194825">
|
||||
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.cygwin.exe.release.1492194825" moduleId="org.eclipse.cdt.core.settings" name="Release">
|
||||
<externalSettings/>
|
||||
<extensions>
|
||||
<extension id="org.eclipse.cdt.core.Cygwin_PE" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
<extension id="org.eclipse.cdt.core.MakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
</extensions>
|
||||
</storageModule>
|
||||
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||
<configuration artifactName="BootLoader" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.release,org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="" id="cdt.managedbuild.config.gnu.cygwin.exe.release.1492194825" name="Release" parent="cdt.managedbuild.config.gnu.cygwin.exe.release">
|
||||
<folderInfo id="cdt.managedbuild.config.gnu.cygwin.exe.release.1492194825." name="/" resourcePath="">
|
||||
<toolChain id="cdt.managedbuild.toolchain.gnu.cygwin.exe.release.1207631725" name="Cygwin GCC" superClass="cdt.managedbuild.toolchain.gnu.cygwin.exe.release">
|
||||
<targetPlatform id="cdt.managedbuild.target.gnu.platform.cygwin.exe.release.963165440" name="Debug Platform" superClass="cdt.managedbuild.target.gnu.platform.cygwin.exe.release"/>
|
||||
<builder buildPath="${workspace_loc:/BootLoader/Release}" id="cdt.managedbuild.target.gnu.builder.cygwin.exe.release.47010349" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="cdt.managedbuild.target.gnu.builder.cygwin.exe.release"/>
|
||||
<tool id="cdt.managedbuild.tool.gnu.assembler.cygwin.exe.release.532501561" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.cygwin.exe.release">
|
||||
<inputType id="cdt.managedbuild.tool.gnu.assembler.input.2047156987" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
|
||||
</tool>
|
||||
<tool id="cdt.managedbuild.tool.gnu.archiver.cygwin.base.17647796" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.cygwin.base"/>
|
||||
<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.cygwin.exe.release.563132892" name="Cygwin C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.cygwin.exe.release">
|
||||
<option id="gnu.cpp.compiler.cygwin.exe.release.option.optimization.level.1314404243" name="Optimization Level" superClass="gnu.cpp.compiler.cygwin.exe.release.option.optimization.level" value="gnu.cpp.compiler.optimization.level.most" valueType="enumerated"/>
|
||||
<option id="gnu.cpp.compiler.cygwin.exe.release.option.debugging.level.338270375" name="Debug Level" superClass="gnu.cpp.compiler.cygwin.exe.release.option.debugging.level" value="gnu.cpp.compiler.debugging.level.none" valueType="enumerated"/>
|
||||
</tool>
|
||||
<tool id="cdt.managedbuild.tool.gnu.c.compiler.cygwin.exe.release.699035238" name="Cygwin C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.cygwin.exe.release">
|
||||
<option defaultValue="gnu.c.optimization.level.most" id="gnu.c.compiler.cygwin.exe.release.option.optimization.level.1282751053" name="Optimization Level" superClass="gnu.c.compiler.cygwin.exe.release.option.optimization.level" valueType="enumerated"/>
|
||||
<option id="gnu.c.compiler.cygwin.exe.release.option.debugging.level.140271121" name="Debug Level" superClass="gnu.c.compiler.cygwin.exe.release.option.debugging.level" value="gnu.c.debugging.level.none" valueType="enumerated"/>
|
||||
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.cygwin.805945285" superClass="cdt.managedbuild.tool.gnu.c.compiler.input.cygwin"/>
|
||||
</tool>
|
||||
<tool id="cdt.managedbuild.tool.gnu.c.linker.cygwin.exe.release.240706140" name="Cygwin C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.cygwin.exe.release">
|
||||
<inputType id="cdt.managedbuild.tool.gnu.c.linker.input.1354318945" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
|
||||
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
|
||||
<additionalInput kind="additionalinput" paths="$(LIBS)"/>
|
||||
</inputType>
|
||||
</tool>
|
||||
<tool id="cdt.managedbuild.tool.gnu.cpp.linker.cygwin.exe.release.818994093" name="Cygwin C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.cygwin.exe.release"/>
|
||||
</toolChain>
|
||||
</folderInfo>
|
||||
<sourceEntries>
|
||||
<entry excluding="iap.s|bootbl.s|boot.s" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
|
||||
</sourceEntries>
|
||||
</configuration>
|
||||
</storageModule>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.language.mapping"/>
|
||||
|
||||
<storageModule moduleId="scannerConfiguration">
|
||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"/>
|
||||
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="makefileGenerator">
|
||||
<runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.cygwin.exe.release.1492194825;cdt.managedbuild.config.gnu.cygwin.exe.release.1492194825.;cdt.managedbuild.tool.gnu.c.compiler.cygwin.exe.release.699035238;cdt.managedbuild.tool.gnu.c.compiler.input.cygwin.805945285">
|
||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC"/>
|
||||
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="makefileGenerator">
|
||||
<runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
</scannerConfigBuildInfo>
|
||||
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.cygwin.exe.debug.1822617334;cdt.managedbuild.config.gnu.cygwin.exe.debug.1822617334.;cdt.managedbuild.tool.gnu.c.compiler.cygwin.exe.debug.1736357620;cdt.managedbuild.tool.gnu.c.compiler.input.cygwin.240736807">
|
||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC"/>
|
||||
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="makefileGenerator">
|
||||
<runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="arm-elf-gcc" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
</scannerConfigBuildInfo>
|
||||
</storageModule>
|
||||
</cconfiguration>
|
||||
</storageModule>
|
||||
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||
<project id="BootLoader.cdt.managedbuild.target.gnu.cygwin.exe.1365251609" name="Executable" projectType="cdt.managedbuild.target.gnu.cygwin.exe"/>
|
||||
</storageModule>
|
||||
</cproject>
|
||||
@@ -0,0 +1,83 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>BootLoader</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
<project>Drivers</project>
|
||||
<project>inc</project>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
|
||||
<triggers>clean,full,incremental,</triggers>
|
||||
<arguments>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.cleanBuildTarget</key>
|
||||
<value>clean</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.enableCleanBuild</key>
|
||||
<value>true</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.append_environment</key>
|
||||
<value>true</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>?name?</key>
|
||||
<value></value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.stopOnError</key>
|
||||
<value>true</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.buildCommand</key>
|
||||
<value>make</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.contents</key>
|
||||
<value>org.eclipse.cdt.make.core.activeConfigSettings</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.buildLocation</key>
|
||||
<value>${workspace_loc:/BootLoader/Debug}</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.useDefaultBuildCmd</key>
|
||||
<value>true</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.enableFullBuild</key>
|
||||
<value>true</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.enableAutoBuild</key>
|
||||
<value>false</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.fullBuildTarget</key>
|
||||
<value>all</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.buildArguments</key>
|
||||
<value></value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.autoBuildTarget</key>
|
||||
<value>all</value>
|
||||
</dictionary>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
|
||||
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
|
||||
<nature>org.eclipse.cdt.core.cnature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
@@ -0,0 +1,187 @@
|
||||
/* ---------------------------------------------------------------------------
|
||||
* CommListeners.c - v0.1 (c) 2008 Micro-key bv
|
||||
* ---------------------------------------------------------------------------
|
||||
* Micro-key bv
|
||||
* Industrieweg 28, 9804 TG Noordhorn
|
||||
* Postbus 92, 9800 AB Zuidhorn
|
||||
* The Netherlands
|
||||
* Tel: +31 594 503020
|
||||
* Fax: +31 594 505825
|
||||
* Email: support@microkey.nl
|
||||
* Web: www.microkey.nl
|
||||
* ---------------------------------------------------------------------------
|
||||
* Description:
|
||||
* ---------------------------------------------------------------------------
|
||||
* Version(s): 0.1, Feb 15, 2008, FSc
|
||||
* Creation.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* System include files
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Application include files
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#include "types.h"
|
||||
#include "CommListeners.h"
|
||||
#include "IspProtocol.h"
|
||||
#include "serial.h"
|
||||
#include "bus.h"
|
||||
#include "crc.h"
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Local constant and macro definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#define ACKNOWLEDGE_MSGSIZE 6
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Global variable definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Local variable definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
int com1IspHandler;
|
||||
int com2IspHandler;
|
||||
int bus1IspHandler;
|
||||
int bus2IspHandler;
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Local function definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
void sendAckOnCom1(t_isp_responses response);
|
||||
void sendAckOnCom2(t_isp_responses response);
|
||||
void sendAckOnBus1(t_isp_responses response);
|
||||
void sendAckOnBus2(t_isp_responses response);
|
||||
UINT8 *createAckMessage(t_isp_responses response );
|
||||
|
||||
/** \brief Initialises the COM1 listener for handling IspProtocol on COM1 */
|
||||
void initCom1Listener()
|
||||
{
|
||||
com1IspHandler = ispInitProtocol( sendAckOnCom1 );
|
||||
}
|
||||
|
||||
/** \brief Initialises the COM2 listener for handling IspProtocol on COM2 */
|
||||
void initCom2Listener()
|
||||
{
|
||||
com2IspHandler = ispInitProtocol( sendAckOnCom2 );
|
||||
|
||||
}
|
||||
|
||||
/** \brief Initialises the BUS1 listener for handling IspProtocol on BUS1 */
|
||||
void initBus1Listener()
|
||||
{
|
||||
bus1IspHandler = ispInitProtocol( sendAckOnBus1 );
|
||||
}
|
||||
|
||||
/** \brief Initialises the BUS2 listener for handling IspProtocol on BUS2 */
|
||||
void initBus2Listener()
|
||||
{
|
||||
bus2IspHandler = ispInitProtocol( sendAckOnBus2 );
|
||||
}
|
||||
|
||||
|
||||
/** \brief Does IspProtocol handling for fresh received bytes on COM1 */
|
||||
void listen2Com1()
|
||||
{
|
||||
UINT8 byte;
|
||||
if (serGet( COM1, &byte) == TRUE)
|
||||
{
|
||||
ispHandleRxByte( com1IspHandler, byte );
|
||||
}
|
||||
}
|
||||
|
||||
/** \brief Does IspProtocol handling for fresh received bytes on COM2 */
|
||||
void listen2Com2()
|
||||
{
|
||||
UINT8 byte;
|
||||
static int nrReceivedBytes = 0;;
|
||||
if (serGet( COM2, &byte) == TRUE)
|
||||
{
|
||||
nrReceivedBytes++;
|
||||
ispHandleRxByte( com2IspHandler, byte );
|
||||
}
|
||||
}
|
||||
|
||||
/** \brief Does IspProtocol handling for fresh received bytes on BUS1 */
|
||||
void listen2Bus1()
|
||||
{
|
||||
UINT8 byte;
|
||||
if (busGet( BUS1, &byte) == TRUE)
|
||||
{
|
||||
ispHandleRxByte( bus1IspHandler, byte );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/** \brief Does IspProtocol handling for fresh received bytes on BUS2 */
|
||||
void listen2Bus2()
|
||||
{
|
||||
UINT8 byte;
|
||||
if (busGet( BUS2, &byte) == TRUE)
|
||||
{
|
||||
ispHandleRxByte( bus2IspHandler, byte );
|
||||
}
|
||||
}
|
||||
|
||||
void sendAckOnCom1(t_isp_responses response)
|
||||
{
|
||||
UINT8 *message = createAckMessage( response );
|
||||
|
||||
// Send over COM1
|
||||
serWrite(COM1, ACKNOWLEDGE_MSGSIZE, message);
|
||||
}
|
||||
|
||||
void sendAckOnCom2(t_isp_responses response)
|
||||
{
|
||||
UINT8 *message = createAckMessage( response );
|
||||
|
||||
// Send over COM2
|
||||
serWrite(COM2, ACKNOWLEDGE_MSGSIZE, message);
|
||||
}
|
||||
|
||||
void sendAckOnBus1(t_isp_responses response)
|
||||
{
|
||||
UINT8 *message = createAckMessage( response );
|
||||
|
||||
// Send over BUS1
|
||||
busWrite(BUS1, ACKNOWLEDGE_MSGSIZE, message);
|
||||
}
|
||||
|
||||
void sendAckOnBus2(t_isp_responses response)
|
||||
{
|
||||
UINT8 *message = createAckMessage( response );
|
||||
|
||||
// Send over BUS2
|
||||
busWrite(BUS2, ACKNOWLEDGE_MSGSIZE, message);
|
||||
}
|
||||
|
||||
//
|
||||
UINT8 *createAckMessage(t_isp_responses response )
|
||||
{
|
||||
static UINT8 AcknowledgeMsg[ACKNOWLEDGE_MSGSIZE];
|
||||
UINT16 msgCrc;
|
||||
|
||||
// Assemble message
|
||||
AcknowledgeMsg[0] = ISP_START_BYTE;
|
||||
AcknowledgeMsg[1] = ISP_MSGID_ACKNOWLEDGE;
|
||||
AcknowledgeMsg[2] = 1;
|
||||
AcknowledgeMsg[3] = (UINT8)response;
|
||||
|
||||
// Calculate CRC
|
||||
msgCrc = crcCalc( &(AcknowledgeMsg[1]), 3, 0 );
|
||||
|
||||
AcknowledgeMsg[4] = (UINT8)(msgCrc >> 8);
|
||||
AcknowledgeMsg[5] = (UINT8)(msgCrc & 0x00FF);
|
||||
|
||||
return AcknowledgeMsg;
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
/* ---------------------------------------------------------------------------
|
||||
* CommListeners.h - v0.1 (c) 2008 Micro-key bv
|
||||
* ---------------------------------------------------------------------------
|
||||
* Micro-key bv
|
||||
* Industrieweg 28, 9804 TG Noordhorn
|
||||
* Postbus 92, 9800 AB Zuidhorn
|
||||
* The Netherlands
|
||||
* Tel: +31 594 503020
|
||||
* Fax: +31 594 505825
|
||||
* Email: support@microkey.nl
|
||||
* Web: www.microkey.nl
|
||||
* ---------------------------------------------------------------------------
|
||||
* Description:
|
||||
* ---------------------------------------------------------------------------
|
||||
* Version(s): 0.1, Feb 15, 2008, FSc
|
||||
* Creation.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef __COMMLISTENERS_H__
|
||||
#define __COMMLISTENERS_H__
|
||||
/** \file CommListeners.h
|
||||
\brief
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* System include files.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Application include files.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Constant and macro definitions.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Type definitions.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Variable declarations.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Function declarations.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/** \brief Initialises the COM1 listener for handling IspProtocol on COM1 */
|
||||
void initCom1Listener();
|
||||
/** \brief Initialises the COM2 listener for handling IspProtocol on COM2 */
|
||||
void initCom2Listener();
|
||||
/** \brief Initialises the BUS1 listener for handling IspProtocol on BUS1 */
|
||||
void initBus1Listener();
|
||||
/** \brief Initialises the BUS2 listener for handling IspProtocol on BUS2 */
|
||||
void initBus2Listener();
|
||||
|
||||
/** \brief Does IspProtocol handling for fresh received bytes on COM1 */
|
||||
void listen2Com1();
|
||||
/** \brief Does IspProtocol handling for fresh received bytes on COM2 */
|
||||
void listen2Com2();
|
||||
/** \brief Does IspProtocol handling for fresh received bytes on BUS1 */
|
||||
void listen2Bus1();
|
||||
/** \brief Does IspProtocol handling for fresh received bytes on BUS2 */
|
||||
void listen2Bus2();
|
||||
|
||||
|
||||
#endif /* __COMMLISTENERS_H__ */
|
||||
@@ -0,0 +1,123 @@
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Crc.c - v0.1 (c) 2008 Micro-key bv
|
||||
* ---------------------------------------------------------------------------
|
||||
* Micro-key bv
|
||||
* Industrieweg 28, 9804 TG Noordhorn
|
||||
* Postbus 92, 9800 AB Zuidhorn
|
||||
* The Netherlands
|
||||
* Tel: +31 594 503020
|
||||
* Fax: +31 594 505825
|
||||
* Email: support@microkey.nl
|
||||
* Web: www.microkey.nl
|
||||
* ---------------------------------------------------------------------------
|
||||
* Description:
|
||||
* ---------------------------------------------------------------------------
|
||||
* Version(s): 0.1, Jan 31, 2008, FSc
|
||||
* Creation.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* System include files
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Application include files
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#include "crc.h"
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Local constant and macro definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
const UINT16 CRC_table[256] =
|
||||
{
|
||||
0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50A5, 0x60C6, 0x70E7,
|
||||
0x8108, 0x9129, 0xA14A, 0xB16B, 0xC18C, 0xD1AD, 0xE1CE, 0xF1EF,
|
||||
0x1231, 0x0210, 0x3273, 0x2252, 0x52B5, 0x4294, 0x72F7, 0x62D6,
|
||||
0x9339, 0x8318, 0xB37B, 0xA35A, 0xD3BD, 0xC39C, 0xF3FF, 0xE3DE,
|
||||
0x2462, 0x3443, 0x0420, 0x1401, 0x64E6, 0x74C7, 0x44A4, 0x5485,
|
||||
0xA56A, 0xB54B, 0x8528, 0x9509, 0xE5EE, 0xF5CF, 0xC5AC, 0xD58D,
|
||||
0x3653, 0x2672, 0x1611, 0x0630, 0x76D7, 0x66F6, 0x5695, 0x46B4,
|
||||
0xB75B, 0xA77A, 0x9719, 0x8738, 0xF7DF, 0xE7FE, 0xD79D, 0xC7BC,
|
||||
0x48C4, 0x58E5, 0x6886, 0x78A7, 0x0840, 0x1861, 0x2802, 0x3823,
|
||||
0xC9CC, 0xD9ED, 0xE98E, 0xF9AF, 0x8948, 0x9969, 0xA90A, 0xB92B,
|
||||
0x5AF5, 0x4AD4, 0x7AB7, 0x6A96, 0x1A71, 0x0A50, 0x3A33, 0x2A12,
|
||||
0xDBFD, 0xCBDC, 0xFBBF, 0xEB9E, 0x9B79, 0x8B58, 0xBB3B, 0xAB1A,
|
||||
0x6CA6, 0x7C87, 0x4CE4, 0x5CC5, 0x2C22, 0x3C03, 0x0C60, 0x1C41,
|
||||
0xEDAE, 0xFD8F, 0xCDEC, 0xDDCD, 0xAD2A, 0xBD0B, 0x8D68, 0x9D49,
|
||||
0x7E97, 0x6EB6, 0x5ED5, 0x4EF4, 0x3E13, 0x2E32, 0x1E51, 0x0E70,
|
||||
0xFF9F, 0xEFBE, 0xDFDD, 0xCFFC, 0xBF1B, 0xAF3A, 0x9F59, 0x8F78,
|
||||
0x9188, 0x81A9, 0xB1CA, 0xA1EB, 0xD10C, 0xC12D, 0xF14E, 0xE16F,
|
||||
0x1080, 0x00A1, 0x30C2, 0x20E3, 0x5004, 0x4025, 0x7046, 0x6067,
|
||||
0x83B9, 0x9398, 0xA3FB, 0xB3DA, 0xC33D, 0xD31C, 0xE37F, 0xF35E,
|
||||
0x02B1, 0x1290, 0x22F3, 0x32D2, 0x4235, 0x5214, 0x6277, 0x7256,
|
||||
0xB5EA, 0xA5CB, 0x95A8, 0x8589, 0xF56E, 0xE54F, 0xD52C, 0xC50D,
|
||||
0x34E2, 0x24C3, 0x14A0, 0x0481, 0x7466, 0x6447, 0x5424, 0x4405,
|
||||
0xA7DB, 0xB7FA, 0x8799, 0x97B8, 0xE75F, 0xF77E, 0xC71D, 0xD73C,
|
||||
0x26D3, 0x36F2, 0x0691, 0x16B0, 0x6657, 0x7676, 0x4615, 0x5634,
|
||||
0xD94C, 0xC96D, 0xF90E, 0xE92F, 0x99C8, 0x89E9, 0xB98A, 0xA9AB,
|
||||
0x5844, 0x4865, 0x7806, 0x6827, 0x18C0, 0x08E1, 0x3882, 0x28A3,
|
||||
0xCB7D, 0xDB5C, 0xEB3F, 0xFB1E, 0x8BF9, 0x9BD8, 0xABBB, 0xBB9A,
|
||||
0x4A75, 0x5A54, 0x6A37, 0x7A16, 0x0AF1, 0x1AD0, 0x2AB3, 0x3A92,
|
||||
0xFD2E, 0xED0F, 0xDD6C, 0xCD4D, 0xBDAA, 0xAD8B, 0x9DE8, 0x8DC9,
|
||||
0x7C26, 0x6C07, 0x5C64, 0x4C45, 0x3CA2, 0x2C83, 0x1CE0, 0x0CC1,
|
||||
0xEF1F, 0xFF3E, 0xCF5D, 0xDF7C, 0xAF9B, 0xBFBA, 0x8FD9, 0x9FF8,
|
||||
0x6E17, 0x7E36, 0x4E55, 0x5E74, 0x2E93, 0x3EB2, 0x0ED1, 0x1EF0
|
||||
};
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Global variable definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Local variable definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Local function definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*!
|
||||
* \brief Calculate 16 bit CRC
|
||||
*
|
||||
* a function to calculate an serial 16 bit CRC
|
||||
* according to the CCITT V.024 standard
|
||||
* To short down the calculation time of the serial CRC
|
||||
* a hash table is used.
|
||||
* This CRC is a fast (with hash table) and good CRC for
|
||||
* data transfer and integrity test of data storage. It can effectively
|
||||
* can detect errors by data transfer. 16 Bit is good for data blocks from
|
||||
* 0 - 4 KByte with a residual risk for non detection of 10E-8 per transfer.
|
||||
* (Multiply this with the error factor of the transmit line)
|
||||
*
|
||||
* The polynoom of CRC-16-CCIT = x^16 + x^12 + x^5 + 1
|
||||
*
|
||||
* \param data Build the crc from this data block
|
||||
* \param length Length of the data block
|
||||
* \param feed Initial CRC value (take 0 by default)
|
||||
*/
|
||||
UINT16 crcCalc(UINT8 * data, UINT32 length, UINT16 feed)
|
||||
{
|
||||
unsigned short crc = feed;
|
||||
unsigned char index;
|
||||
unsigned int count;
|
||||
|
||||
for(count=0; count<length; count++)
|
||||
{
|
||||
index = (unsigned char)(crc >> 8);
|
||||
crc = crc & 0x00FF;
|
||||
crc = (crc << 8);
|
||||
crc &= 0xFF00;
|
||||
crc = crc ^ CRC_table[index] ^ (*data & 0x00FF);
|
||||
data++;
|
||||
}
|
||||
|
||||
return crc;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Crc.h - v0.1 (c) 2008 Micro-key bv
|
||||
* ---------------------------------------------------------------------------
|
||||
* Micro-key bv
|
||||
* Industrieweg 28, 9804 TG Noordhorn
|
||||
* Postbus 92, 9800 AB Zuidhorn
|
||||
* The Netherlands
|
||||
* Tel: +31 594 503020
|
||||
* Fax: +31 594 505825
|
||||
* Email: support@microkey.nl
|
||||
* Web: www.microkey.nl
|
||||
* ---------------------------------------------------------------------------
|
||||
* Description:
|
||||
* ---------------------------------------------------------------------------
|
||||
* Version(s): 0.1, Jan 31, 2008, FSc
|
||||
* Creation.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef __CRC_H__
|
||||
#define __CRC_H__
|
||||
/** \file Crc.h
|
||||
\brief
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* System include files.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Application include files.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#include "types.h"
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Constant and macro definitions.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Type definitions.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Variable declarations.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Function declarations.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
UINT16 crcCalc(UINT8 * pData, UINT32 length, UINT16 feed);
|
||||
|
||||
#endif /* __CRC_H__ */
|
||||
|
||||
@@ -0,0 +1,620 @@
|
||||
/* ---------------------------------------------------------------------------
|
||||
* IspProtocol.c - v0.1 (c) 2008 Micro-key bv
|
||||
* ---------------------------------------------------------------------------
|
||||
* Micro-key bv
|
||||
* Industrieweg 28, 9804 TG Noordhorn
|
||||
* Postbus 92, 9800 AB Zuidhorn
|
||||
* The Netherlands
|
||||
* Tel: +31 594 503020
|
||||
* Fax: +31 594 505825
|
||||
* Email: support@microkey.nl
|
||||
* Web: www.microkey.nl
|
||||
* ---------------------------------------------------------------------------
|
||||
* Description:
|
||||
* ---------------------------------------------------------------------------
|
||||
* Version(s): 0.1, Feb 13, 2008, FSc
|
||||
* Creation.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* System include files
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Application include files
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#include "types.h"
|
||||
#include "IspProtocol.h"
|
||||
#include "InternalFlash.h"
|
||||
#include "Crc.h"
|
||||
#include "Leds.h"
|
||||
#include "appImage.h"
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Local constant and macro definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#define MAX_ADMINS (4)
|
||||
#define START_BYTE (0xAA)
|
||||
#define MAX_PAYLOAD_SIZE (80)
|
||||
|
||||
#define MSGID_ACKNOWLEDGE (0x01)
|
||||
#define MSGID_UNLOCK (0x02)
|
||||
#define MSGID_ERASEBLOCK (0x03)
|
||||
#define MSGID_PROGRAMFLASH (0x04)
|
||||
#define MSGID_VERIFYFLASH (0x05)
|
||||
#define MSGID_FINISHPROGRAMMING (0x06)
|
||||
#define MSGID_STARTPROGRAM (0x07)
|
||||
|
||||
#define APP_FLASH_START_ADDR (0x00005000)
|
||||
#define APP_FLASH_END_ADDR (0x0007DFFF)
|
||||
#define APP_FLASH_START_SECTOR (5)
|
||||
#define APP_FLASH_END_SECTOR (27)
|
||||
#define APP_IMAGE_LENGTH_OFFS 0x0008
|
||||
#define APP_IMAGE_CRC_OFFS 0x000C
|
||||
|
||||
#define PROGRAM_BLOCK_SIZE (256)
|
||||
#define INVALID_ADDRESS (0xFFFFFFFF)
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Global variable definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Local variable definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
IDLE,
|
||||
MESSAGE_ID,
|
||||
PAYLOAD_SIZE,
|
||||
PAYLOAD,
|
||||
CRC
|
||||
} t_isp_decodestatus;
|
||||
|
||||
typedef struct t_ISP_MESSAGE {
|
||||
UINT8 messageId;
|
||||
UINT8 payloadSize;
|
||||
UINT8 payload[MAX_PAYLOAD_SIZE];
|
||||
UINT16 crc;
|
||||
} t_isp_message;
|
||||
|
||||
typedef struct t_ISP_ADMIN {
|
||||
t_isp_decodestatus status;
|
||||
UINT8 rxIndex;
|
||||
UINT16 rxCrc;
|
||||
t_isp_message rxMessage;
|
||||
t_isp_ack_callback ackCallback;
|
||||
} t_isp_admin;
|
||||
|
||||
static t_isp_admin ispAdmins[MAX_ADMINS];
|
||||
static UINT8 lastReservedAdmin = 0;
|
||||
static UINT32 maxProgrammedAddress = 0;
|
||||
static UINT32 startAddress = INVALID_ADDRESS;
|
||||
static UINT8 verifyBlock[PROGRAM_BLOCK_SIZE] __attribute__((aligned(PROGRAM_BLOCK_SIZE)));
|
||||
static UINT8 programBlock[PROGRAM_BLOCK_SIZE] __attribute__((aligned(PROGRAM_BLOCK_SIZE)));
|
||||
static UINT8 programFirstBlock[PROGRAM_BLOCK_SIZE] __attribute__((aligned(PROGRAM_BLOCK_SIZE)));
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Local function definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
void sendAcknowledge(t_isp_admin *handle, t_isp_responses response);
|
||||
BOOLEAN ValidMessageId( UINT8 messageId);
|
||||
void handleMessage(t_isp_admin *admin);
|
||||
void handleUnlockMessage(t_isp_admin *admin);
|
||||
void handleEraseBlockMessage(t_isp_admin *admin);
|
||||
void handleStartProgram(t_isp_admin *admin);
|
||||
void handleFinishProgramming(t_isp_admin *admin);
|
||||
void handleVerifyFlashMessage(t_isp_admin *admin);
|
||||
void handleProgramFlashMessage(t_isp_admin *admin);
|
||||
iflashresult fillProgramBlock( UINT32 address, UINT8 size, UINT8 *data);
|
||||
iflashresult programFlash();
|
||||
void resetRamBlock( UINT32 address );
|
||||
iflashresult StoreCrcAndLength( UINT32 imageSize );
|
||||
|
||||
|
||||
|
||||
/** \brief Initialises a instance of the ISP-protocol handler.
|
||||
*
|
||||
* For each communication port, one ISP-protocol handler must be initialised.
|
||||
*
|
||||
* \param ackCallback Callback-function used for parent to send acknowledge
|
||||
* \returns handle Handle for this ISP-protocol handler.
|
||||
*/
|
||||
int ispInitProtocol(t_isp_ack_callback ackCallback )
|
||||
{
|
||||
int result;
|
||||
if (lastReservedAdmin < MAX_ADMINS)
|
||||
{
|
||||
ispAdmins[lastReservedAdmin].status = IDLE;
|
||||
ispAdmins[lastReservedAdmin].ackCallback = ackCallback;
|
||||
|
||||
result = lastReservedAdmin;
|
||||
lastReservedAdmin++;
|
||||
}
|
||||
else
|
||||
{
|
||||
result = -1;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/** \brief Does the protocol handling by parsing each byte received on the communication port.
|
||||
*
|
||||
* \param handle Handle for the ISP-protocol handler
|
||||
* \param byte The received byte on the communication port
|
||||
*/
|
||||
void ispHandleRxByte( int handle, UINT8 byte )
|
||||
{
|
||||
t_isp_admin *admin = &(ispAdmins[handle]);
|
||||
|
||||
switch( admin->status )
|
||||
{
|
||||
case(IDLE):
|
||||
if (byte == START_BYTE)
|
||||
{
|
||||
admin->status = MESSAGE_ID;
|
||||
}
|
||||
break;
|
||||
case(MESSAGE_ID):
|
||||
if (ValidMessageId(byte) == TRUE )
|
||||
{
|
||||
// Determine Payload-size
|
||||
admin->rxCrc = crcCalc(&byte, 1, 0);
|
||||
admin->rxMessage.messageId = byte;
|
||||
admin->status = PAYLOAD_SIZE;
|
||||
}
|
||||
else
|
||||
{
|
||||
sendAcknowledge( admin, ISP_INVALID_MESSAGE_ID );
|
||||
admin->status = IDLE;
|
||||
}
|
||||
break;
|
||||
case(PAYLOAD_SIZE):
|
||||
// Determine Payload-size
|
||||
if (byte <=MAX_PAYLOAD_SIZE)
|
||||
{
|
||||
admin->rxMessage.payloadSize = byte;
|
||||
admin->rxCrc = crcCalc(&byte, 1, admin->rxCrc);
|
||||
admin->rxIndex = 0;
|
||||
if (byte > 0)
|
||||
{
|
||||
admin->status = PAYLOAD;
|
||||
}
|
||||
else
|
||||
{
|
||||
admin->status = CRC;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sendAcknowledge( admin, ISP_PAYLOAD_TOO_LARGE );
|
||||
admin->status = IDLE;
|
||||
}
|
||||
break;
|
||||
case(PAYLOAD):
|
||||
admin->rxMessage.payload[ admin->rxIndex ] = byte;
|
||||
admin->rxCrc = crcCalc(&byte, 1, admin->rxCrc);
|
||||
admin->rxIndex++;
|
||||
|
||||
if (admin->rxIndex >= admin->rxMessage.payloadSize)
|
||||
{
|
||||
admin->rxIndex = 0;
|
||||
admin->status = CRC;
|
||||
}
|
||||
break;
|
||||
case(CRC):
|
||||
// Receive and check CRC
|
||||
if (admin->rxIndex == 0)
|
||||
{
|
||||
admin->rxMessage.crc = (byte << 8);
|
||||
}
|
||||
else
|
||||
{
|
||||
admin->rxMessage.crc |= (byte & 0x00FF);
|
||||
}
|
||||
|
||||
admin->rxIndex++;
|
||||
|
||||
if (admin->rxIndex >= 2)
|
||||
{
|
||||
if (admin->rxCrc == admin->rxMessage.crc)
|
||||
{
|
||||
/* Crc was succesfully checked */
|
||||
handleMessage(admin);
|
||||
}
|
||||
else
|
||||
{
|
||||
sendAcknowledge( admin, ISP_RECV_BAD_CRC );
|
||||
}
|
||||
admin->status = IDLE;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
admin->status = IDLE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void handleMessage(t_isp_admin *admin)
|
||||
{
|
||||
switch( admin->rxMessage.messageId )
|
||||
{
|
||||
case(MSGID_UNLOCK):
|
||||
//sendAcknowledge( admin, ISP_CMD_SUCCESS);
|
||||
handleUnlockMessage( admin );
|
||||
break;
|
||||
case(MSGID_ERASEBLOCK):
|
||||
handleEraseBlockMessage( admin );
|
||||
break;
|
||||
case(MSGID_PROGRAMFLASH):
|
||||
handleProgramFlashMessage( admin );
|
||||
break;
|
||||
case(MSGID_VERIFYFLASH):
|
||||
handleVerifyFlashMessage( admin );
|
||||
break;
|
||||
case(MSGID_FINISHPROGRAMMING):
|
||||
handleFinishProgramming( admin );
|
||||
break;
|
||||
case(MSGID_STARTPROGRAM):
|
||||
handleStartProgram( admin );
|
||||
break;
|
||||
default:
|
||||
sendAcknowledge( admin, ISP_INVALID_MESSAGE_ID);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
BOOLEAN ValidMessageId( UINT8 messageId)
|
||||
{
|
||||
if ((messageId >= 0x01) && (messageId <= 0x07))
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
void sendAcknowledge(t_isp_admin *handle, t_isp_responses response)
|
||||
{
|
||||
handle->ackCallback( response );
|
||||
}
|
||||
|
||||
|
||||
void handleUnlockMessage(t_isp_admin *admin)
|
||||
{
|
||||
iflashresult unlockResult = ISP_CMD_SUCCESS;
|
||||
|
||||
maxProgrammedAddress = 0;
|
||||
unlockResult =iflashPrepare( APP_FLASH_START_SECTOR, APP_FLASH_END_SECTOR);
|
||||
|
||||
admin->ackCallback( (t_isp_responses)unlockResult );
|
||||
}
|
||||
|
||||
void handleEraseBlockMessage(t_isp_admin *admin)
|
||||
{
|
||||
iflashresult result;
|
||||
UINT8 blockNr;
|
||||
|
||||
// Extract block nr from message
|
||||
blockNr = admin->rxMessage.payload[0];
|
||||
|
||||
if ( ( blockNr >= APP_FLASH_START_SECTOR)
|
||||
&& ( blockNr <= APP_FLASH_END_SECTOR))
|
||||
{
|
||||
result = iflashErase( blockNr );
|
||||
}
|
||||
else
|
||||
{
|
||||
result = ISP_INVALID_SECTOR;
|
||||
}
|
||||
|
||||
admin->ackCallback( (t_isp_responses)result );
|
||||
}
|
||||
|
||||
void handleProgramFlashMessage(t_isp_admin *admin)
|
||||
{
|
||||
iflashresult result;
|
||||
UINT32 address;
|
||||
UINT8 size;
|
||||
UINT8 *data;
|
||||
UINT8 index = 0;
|
||||
|
||||
// Extract address, datalength & data from message
|
||||
address = ispGet32bit(admin->rxMessage.payload, &index);
|
||||
size = ispGet8bit(admin->rxMessage.payload, &index);
|
||||
data = &(admin->rxMessage.payload[index]);
|
||||
|
||||
if (maxProgrammedAddress < address) maxProgrammedAddress = address;
|
||||
|
||||
if ( (address >= APP_FLASH_START_ADDR)
|
||||
&& (address <= APP_FLASH_END_ADDR)
|
||||
)
|
||||
{
|
||||
result = fillProgramBlock(address, size, data );
|
||||
}
|
||||
else
|
||||
{
|
||||
result = ISP_DST_ADDR_ERROR;
|
||||
}
|
||||
|
||||
admin->ackCallback( (t_isp_responses)result );
|
||||
}
|
||||
|
||||
void handleVerifyFlashMessage(t_isp_admin *admin)
|
||||
{
|
||||
iflashresult result;
|
||||
UINT32 address;
|
||||
UINT8 size;
|
||||
UINT8 index = 0;
|
||||
UINT8 bufferIdx;
|
||||
|
||||
// Extract address, datalength & data from message
|
||||
address = ispGet32bit(admin->rxMessage.payload, &index);
|
||||
size = ispGet8bit(admin->rxMessage.payload, &index);
|
||||
for (bufferIdx = 0; bufferIdx < size; bufferIdx++)
|
||||
{
|
||||
verifyBlock[bufferIdx] = ispGet8bit(admin->rxMessage.payload, &index);
|
||||
}
|
||||
|
||||
// Make size dividable by 4
|
||||
size = size - (size % 4);
|
||||
|
||||
if ((size >= 4) && (address != APP_FLASH_START_ADDR))
|
||||
{
|
||||
result = iflashVerify( address, size, verifyBlock );
|
||||
}
|
||||
else
|
||||
{
|
||||
result = ISP_CMD_SUCCESS;
|
||||
}
|
||||
|
||||
admin->ackCallback( (t_isp_responses)result );
|
||||
}
|
||||
|
||||
void handleFinishProgramming(t_isp_admin *admin)
|
||||
{
|
||||
iflashresult result;
|
||||
UINT32 imageSize;
|
||||
|
||||
// Program remaining block on flash
|
||||
fillProgramBlock(0, 0, 0 );
|
||||
|
||||
// Calculate image length
|
||||
imageSize = maxProgrammedAddress - APP_FLASH_START_ADDR;
|
||||
|
||||
// Calculate and store Crc & imageSize on flash
|
||||
result = StoreCrcAndLength( imageSize );
|
||||
|
||||
admin->ackCallback( (t_isp_responses)result );
|
||||
}
|
||||
|
||||
void handleStartProgram(t_isp_admin *admin)
|
||||
{
|
||||
//if (appiValidAppImageAvail() == TRUE)
|
||||
{
|
||||
ledSet( LED1, 0 );
|
||||
ledSet( LED0, 0 );
|
||||
|
||||
appiJumpToAppImage();
|
||||
}
|
||||
//else
|
||||
//{
|
||||
// admin->ackCallback( ISP_BUSY );
|
||||
//}
|
||||
}
|
||||
|
||||
|
||||
void ispAdd16bit(UINT8 *payloadlocation, UINT16 data)
|
||||
{
|
||||
UINT8 index = 0;
|
||||
|
||||
payloadlocation[index] = (UINT8)(data >> 8);
|
||||
index++;
|
||||
payloadlocation[index] = (UINT8)(data & 0x00FF);
|
||||
}
|
||||
|
||||
|
||||
void ispAdd32bit(UINT8 *payloadlocation, UINT32 data)
|
||||
{
|
||||
UINT8 index = 0;
|
||||
|
||||
payloadlocation[index] = (UINT8)(data >> 24);
|
||||
index++;
|
||||
payloadlocation[index] = (UINT8)(data >> 16);
|
||||
index++;
|
||||
payloadlocation[index] = (UINT8)(data >> 8);
|
||||
index++;
|
||||
payloadlocation[index] = (UINT8)(data & 0xFF);
|
||||
|
||||
}
|
||||
|
||||
UINT8 ispGet8bit(UINT8 *payload, UINT8 *payloadIndex)
|
||||
{
|
||||
UINT8 result;
|
||||
|
||||
result = (UINT8)payload[*payloadIndex];
|
||||
(*payloadIndex)++;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
UINT16 ispGet16bit(UINT8 *payload, UINT8 *payloadIndex)
|
||||
{
|
||||
UINT16 result;
|
||||
|
||||
result = ((UINT16)payload[*payloadIndex]) << 8;
|
||||
(*payloadIndex)++;
|
||||
result += ((UINT16)payload[*payloadIndex] & 0x00FF);
|
||||
(*payloadIndex)++;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
UINT32 ispGet32bit(UINT8 *payload, UINT8 *payloadIndex)
|
||||
{
|
||||
UINT32 result;
|
||||
|
||||
result = ((UINT32)payload[*payloadIndex]) << 24;
|
||||
(*payloadIndex)++;
|
||||
result += ((UINT32)payload[*payloadIndex]) << 16;
|
||||
(*payloadIndex)++;
|
||||
result += ((UINT32)payload[*payloadIndex]) << 8;
|
||||
(*payloadIndex)++;
|
||||
result += ((UINT32)payload[*payloadIndex] & 0x000000FF);
|
||||
(*payloadIndex)++;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
iflashresult fillProgramBlock( UINT32 address, UINT8 size, UINT8 *data)
|
||||
{
|
||||
UINT32 programIndex;
|
||||
UINT32 beginIndex;
|
||||
UINT32 dataIndex;
|
||||
UINT32 endIndex;
|
||||
iflashresult result = ISP_CMD_SUCCESS;
|
||||
|
||||
if (data == 0)
|
||||
{
|
||||
// finish sending last block
|
||||
if (startAddress > 0)
|
||||
{
|
||||
result = programFlash();
|
||||
}
|
||||
else
|
||||
{
|
||||
result = ISP_CMD_SUCCESS;
|
||||
}
|
||||
startAddress = INVALID_ADDRESS;
|
||||
return result;
|
||||
}
|
||||
|
||||
// Determine startAddress.
|
||||
if (startAddress == INVALID_ADDRESS)
|
||||
{
|
||||
// Make sure address is alligned to 256
|
||||
resetRamBlock(address - (address % PROGRAM_BLOCK_SIZE));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (address > (startAddress + PROGRAM_BLOCK_SIZE))
|
||||
{
|
||||
result = programFlash();
|
||||
resetRamBlock( address );
|
||||
}
|
||||
}
|
||||
|
||||
// Determine endIndex;
|
||||
if ( (startAddress + PROGRAM_BLOCK_SIZE) > (address + size) )
|
||||
{
|
||||
endIndex = (address - startAddress) + size;
|
||||
}
|
||||
else
|
||||
{
|
||||
endIndex = PROGRAM_BLOCK_SIZE;
|
||||
}
|
||||
|
||||
// Copy data into programblock
|
||||
dataIndex = 0;
|
||||
beginIndex = address - startAddress;
|
||||
for (programIndex = beginIndex; programIndex < endIndex; programIndex++)
|
||||
{
|
||||
programBlock[programIndex] = data[dataIndex];
|
||||
dataIndex++;
|
||||
}
|
||||
|
||||
// if program block is full, program it
|
||||
if (dataIndex < size)
|
||||
{
|
||||
result = programFlash();
|
||||
resetRamBlock( startAddress + PROGRAM_BLOCK_SIZE );
|
||||
|
||||
// Copy rest in new block
|
||||
endIndex = size - dataIndex;
|
||||
for (programIndex = 0; programIndex < endIndex; programIndex++)
|
||||
{
|
||||
programBlock[programIndex] = data[dataIndex];
|
||||
dataIndex++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((startAddress + PROGRAM_BLOCK_SIZE) == (address + size))
|
||||
{
|
||||
result = programFlash();
|
||||
resetRamBlock( INVALID_ADDRESS );
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void resetRamBlock( UINT32 address )
|
||||
{
|
||||
UINT32 programIndex;
|
||||
|
||||
startAddress = address;
|
||||
for (programIndex = 0; programIndex < PROGRAM_BLOCK_SIZE; programIndex++)
|
||||
{
|
||||
programBlock[programIndex] = 0x00;
|
||||
}
|
||||
}
|
||||
|
||||
iflashresult programFlash()
|
||||
{
|
||||
UINT16 index;
|
||||
|
||||
if (startAddress != APP_FLASH_START_ADDR)
|
||||
{
|
||||
iflashPrepare( APP_FLASH_START_SECTOR, APP_FLASH_END_SECTOR);
|
||||
return iflashProgram( startAddress, PROGRAM_BLOCK_SIZE, programBlock );
|
||||
}
|
||||
else
|
||||
{
|
||||
// keep copy of first block, programmed later at FinishedProgramming
|
||||
for (index = 0; index < PROGRAM_BLOCK_SIZE; index++)
|
||||
{
|
||||
programFirstBlock[index] = programBlock[index];
|
||||
}
|
||||
|
||||
return ISP_CMD_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
iflashresult StoreCrcAndLength( UINT32 imageSize )
|
||||
{
|
||||
static UINT16 crc = 0;
|
||||
static UINT8 *image = 0;
|
||||
|
||||
// Calculate Crc over part before Length & CRC
|
||||
crc = crcCalc(programFirstBlock, APP_IMAGE_LENGTH_OFFS, crc);
|
||||
|
||||
// Calculate Crc over part after Length & CRC in first program block
|
||||
image = (UINT8 *)(programFirstBlock + APP_IMAGE_CRC_OFFS + 4);
|
||||
crc = crcCalc(image, PROGRAM_BLOCK_SIZE - (APP_IMAGE_CRC_OFFS + 4), crc);
|
||||
|
||||
// Calculate Crc over rest of image already programmed
|
||||
image = (UINT8 *)(APP_FLASH_START_ADDR + PROGRAM_BLOCK_SIZE);
|
||||
crc = crcCalc(image, imageSize - PROGRAM_BLOCK_SIZE, crc);
|
||||
|
||||
// Fill in Length & CRC
|
||||
ispAdd32bit(programFirstBlock + APP_IMAGE_LENGTH_OFFS, imageSize);
|
||||
ispAdd16bit(programFirstBlock + APP_IMAGE_CRC_OFFS, crc);
|
||||
|
||||
// Program first block on flash
|
||||
iflashPrepare( APP_FLASH_START_SECTOR, APP_FLASH_START_SECTOR);
|
||||
return iflashProgram( APP_FLASH_START_ADDR, PROGRAM_BLOCK_SIZE, programFirstBlock );
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
/* ---------------------------------------------------------------------------
|
||||
* IspProtocol.h - v0.1 (c) 2008 Micro-key bv
|
||||
* ---------------------------------------------------------------------------
|
||||
* Micro-key bv
|
||||
* Industrieweg 28, 9804 TG Noordhorn
|
||||
* Postbus 92, 9800 AB Zuidhorn
|
||||
* The Netherlands
|
||||
* Tel: +31 594 503020
|
||||
* Fax: +31 594 505825
|
||||
* Email: support@microkey.nl
|
||||
* Web: www.microkey.nl
|
||||
* ---------------------------------------------------------------------------
|
||||
* Description: Handles the ISP-protocol (standard In System Programming -protocol)
|
||||
* ---------------------------------------------------------------------------
|
||||
* Version(s): 0.1, Feb 13, 2008, FSc
|
||||
* Creation.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef __ISPPROTOCOL_H__
|
||||
#define __ISPPROTOCOL_H__
|
||||
/** \file IspProtocol.h
|
||||
\brief Handles the ISP-protocol (standard In System Programming -protocol)
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* System include files.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Application include files.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Constant and macro definitions.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#define ISP_MAX_ADMINS (4)
|
||||
#define ISP_START_BYTE (0xAA)
|
||||
#define ISP_MAX_PAYLOAD_SIZE (80)
|
||||
|
||||
#define ISP_MSGID_ACKNOWLEDGE (0x01)
|
||||
#define ISP_MSGID_UNLOCK (0x02)
|
||||
#define ISP_MSGID_ERASEBLOCK (0x03)
|
||||
#define ISP_MSGID_PROGRAMFLASH (0x04)
|
||||
#define ISP_MSGID_VERIFYFLASH (0x05)
|
||||
#define ISP_MSGID_FINISHPROGRAMMING (0x06)
|
||||
#define ISP_MSGID_STARTPROGRAM (0x07)
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Type definitions.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
ISP_CMD_SUCCESS = 0,
|
||||
ISP_INVALID_COMMAND = 1,
|
||||
ISP_SRC_ADDR_ERROR = 2,
|
||||
ISP_DST_ADDR_ERROR = 3,
|
||||
ISP_SRC_ADDR_NOT_MAPPED = 4,
|
||||
ISP_DST_ADDR_NOT_MAPPED = 5,
|
||||
ISP_COUNT_ERROR = 6,
|
||||
ISP_INVALID_SECTOR = 7,
|
||||
ISP_SECTOR_NOT_BLANK = 8,
|
||||
ISP_SECTOR_NOT_PREPARED_FOR_WRITE_OPERATION = 9,
|
||||
ISP_COMPARE_ERROR = 10,
|
||||
ISP_BUSY = 11,
|
||||
ISP_PAYLOAD_TOO_LARGE = 12,
|
||||
ISP_RECV_BAD_CRC = 13,
|
||||
ISP_INVALID_MESSAGE_ID = 14
|
||||
} t_isp_responses;
|
||||
|
||||
typedef void (*t_isp_ack_callback)(t_isp_responses response);
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Variable declarations.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Function declarations.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
/** \brief Initialises a instance of the ISP-protocol handler */
|
||||
int ispInitProtocol(t_isp_ack_callback);
|
||||
|
||||
/** \brief Does the protocol handling by parsing each byte received on the communication port. */
|
||||
void ispHandleRxByte( int handle, UINT8 byte );
|
||||
|
||||
void ispAdd16bit(UINT8 *payloadlocation, UINT16 data);
|
||||
void ispAdd32bit(UINT8 *payloadlocation, UINT32 data);
|
||||
UINT8 ispGet8bit(UINT8 *payload, UINT8 *payloadIndex);
|
||||
UINT16 ispGet16bit(UINT8 *payload, UINT8 *payloadIndex);
|
||||
UINT32 ispGet32bit(UINT8 *payload, UINT8 *payloadIndex);
|
||||
|
||||
|
||||
#endif /* __ISPPROTOCOL_H__ */
|
||||
@@ -0,0 +1,158 @@
|
||||
/* ---------------------------------------------------------------------------
|
||||
* appImage.c - v0.1 (c) 2008 Micro-key bv
|
||||
* ---------------------------------------------------------------------------
|
||||
* Micro-key bv
|
||||
* Industrieweg 28, 9804 TG Noordhorn
|
||||
* Postbus 92, 9800 AB Zuidhorn
|
||||
* The Netherlands
|
||||
* Tel: +31 594 503020
|
||||
* Fax: +31 594 505825
|
||||
* Email: support@microkey.nl
|
||||
* Web: www.microkey.nl
|
||||
* ---------------------------------------------------------------------------
|
||||
* Description:
|
||||
* ---------------------------------------------------------------------------
|
||||
* Version(s): 0.1, Feb 12, 2008, FSc
|
||||
* Creation.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* System include files
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Application include files
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#include "types.h"
|
||||
#include "appImage.h"
|
||||
#include "LPC23xx.h"
|
||||
#include "crc.h"
|
||||
#include "IspProtocol.h"
|
||||
#include "bootloader.h"
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Local constant and macro definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
typedef void (*t_application_startup)(void);
|
||||
|
||||
#define APPI_FLASH_START_ADDR 0x5000
|
||||
#define APPI_FLASH_END_ADDR 0x7E000
|
||||
#define APPI_C_ENTRY_OFFS 0x0020
|
||||
#define APPI_IMAGE_LENGTH_OFFS 0x0008
|
||||
#define APPI_IMAGE_CRC_OFFS 0x000C
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Global variable definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Local variable definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Local function definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
void appiCalculateCrc( UINT32 imageLength, UINT16 *crc );
|
||||
|
||||
|
||||
/** \brief Checks if the Application image requests a Image update
|
||||
*
|
||||
* When the application image wants to start an image update, it sets
|
||||
* a pattern on a known RAM-location and resets the CPU. Now the bootloader
|
||||
* can verify this pattern.
|
||||
*
|
||||
* \retval TRUE Application did request an update
|
||||
* \retval FALSE Application did not request an update
|
||||
*/
|
||||
BOOLEAN appiApplicationRequestsUpdate()
|
||||
{
|
||||
if (blGetBootmode() == STAY_IN_BOOTLOADER)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/** \brief Checks if a valid Application image.
|
||||
*
|
||||
* \retval TRUE Flash contains a valid Application image
|
||||
* \retval FALSE Flash doesn't contain a valid Application image
|
||||
*/
|
||||
BOOLEAN appiValidAppImageAvail()
|
||||
{
|
||||
static UINT32 imageSize = 0;
|
||||
static UINT16 recordedCrc = 0;
|
||||
UINT8 index;
|
||||
static UINT16 calculatedCrc;
|
||||
|
||||
index = APPI_IMAGE_LENGTH_OFFS;
|
||||
imageSize = ispGet32bit((UINT8 *)APPI_FLASH_START_ADDR, &index);
|
||||
recordedCrc = ispGet16bit((UINT8 *)APPI_FLASH_START_ADDR, &index);
|
||||
|
||||
if ( (imageSize >= 100)
|
||||
&& (imageSize <= (APPI_FLASH_START_ADDR - APPI_FLASH_END_ADDR))
|
||||
)
|
||||
{
|
||||
appiCalculateCrc(imageSize, &calculatedCrc);
|
||||
|
||||
if (recordedCrc != calculatedCrc)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (imageSize == 0)
|
||||
{
|
||||
// escape for debugging
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/** \brief Jumps to the Application image. Function won't return.
|
||||
*/
|
||||
void appiJumpToAppImage()
|
||||
{
|
||||
unsigned int application_start_addr = APPI_FLASH_START_ADDR + APPI_C_ENTRY_OFFS;
|
||||
|
||||
blResetBootmode();
|
||||
|
||||
DISABLE_INTERRUPTS();
|
||||
|
||||
((t_application_startup)application_start_addr)();
|
||||
}
|
||||
|
||||
void appiCalculateCrc( UINT32 imageLength, UINT16 *crc )
|
||||
{
|
||||
UINT8 *image = (UINT8 *)(APPI_FLASH_START_ADDR);
|
||||
*crc = 0;
|
||||
|
||||
// Calculate Crc over part before Length & CRC
|
||||
*crc = crcCalc(image, APPI_IMAGE_LENGTH_OFFS, *crc);
|
||||
|
||||
// Calculate Crc over part after Length & CRC
|
||||
image = (UINT8 *)(APPI_FLASH_START_ADDR + APPI_IMAGE_CRC_OFFS + 4);
|
||||
*crc = crcCalc(image, imageLength - (APPI_IMAGE_CRC_OFFS + 4), *crc);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
/* ---------------------------------------------------------------------------
|
||||
* appImage.h - v0.1 (c) 2008 Micro-key bv
|
||||
* ---------------------------------------------------------------------------
|
||||
* Micro-key bv
|
||||
* Industrieweg 28, 9804 TG Noordhorn
|
||||
* Postbus 92, 9800 AB Zuidhorn
|
||||
* The Netherlands
|
||||
* Tel: +31 594 503020
|
||||
* Fax: +31 594 505825
|
||||
* Email: support@microkey.nl
|
||||
* Web: www.microkey.nl
|
||||
* ---------------------------------------------------------------------------
|
||||
* Description:
|
||||
* ---------------------------------------------------------------------------
|
||||
* Version(s): 0.1, Feb 12, 2008, FSc
|
||||
* Creation.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef __APPIMAGE_H__
|
||||
#define __APPIMAGE_H__
|
||||
/** \file appImage.h
|
||||
\brief
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* System include files.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Application include files.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Constant and macro definitions.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Type definitions.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Variable declarations.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Function declarations.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/** \brief Checks if the Application image requests a Image update */
|
||||
BOOLEAN appiApplicationRequestsUpdate();
|
||||
|
||||
/** \brief Checks if a valid Application image. */
|
||||
BOOLEAN appiValidAppImageAvail();
|
||||
|
||||
/** \brief Jumps to the Application image. Function won't return. */
|
||||
void appiJumpToAppImage();
|
||||
|
||||
|
||||
|
||||
#endif /* __APPIMAGE_H__ */
|
||||
@@ -0,0 +1,158 @@
|
||||
/* Sample initialization file */
|
||||
|
||||
.extern main
|
||||
.extern exit
|
||||
|
||||
.text
|
||||
.code 32
|
||||
|
||||
|
||||
.align 0
|
||||
|
||||
.extern __bss_beg__
|
||||
.extern __bss_end__
|
||||
.extern __stack_end__
|
||||
.extern __data_beg__
|
||||
.extern __data_end__
|
||||
.extern __data+beg_src__
|
||||
|
||||
.global start
|
||||
.global endless_loop
|
||||
|
||||
/* Stack Sizes */
|
||||
.set UND_STACK_SIZE, 0x00000004
|
||||
.set ABT_STACK_SIZE, 0x00000004
|
||||
.set FIQ_STACK_SIZE, 0x00000004
|
||||
.set IRQ_STACK_SIZE, 0X00000100
|
||||
.set SVC_STACK_SIZE, 0x00000100
|
||||
|
||||
/* Standard definitions of Mode bits and Interrupt (I & F) flags in PSRs */
|
||||
.set MODE_USR, 0x10 /* User Mode */
|
||||
.set MODE_FIQ, 0x11 /* FIQ Mode */
|
||||
.set MODE_IRQ, 0x12 /* IRQ Mode */
|
||||
.set MODE_SVC, 0x13 /* Supervisor Mode */
|
||||
.set MODE_ABT, 0x17 /* Abort Mode */
|
||||
.set MODE_UND, 0x1B /* Undefined Mode */
|
||||
.set MODE_SYS, 0x1F /* System Mode */
|
||||
|
||||
.equ I_BIT, 0x80 /* when I bit is set, IRQ is disabled */
|
||||
.equ F_BIT, 0x40 /* when F bit is set, FIQ is disabled */
|
||||
|
||||
start:
|
||||
_start:
|
||||
_mainCRTStartup:
|
||||
|
||||
/* Setup a stack for each mode - note that this only sets up a usable stack
|
||||
for system/user, SWI and IRQ modes. Also each mode is setup with
|
||||
interrupts initially disabled. */
|
||||
ldr r0, .LC6
|
||||
msr CPSR_c, #MODE_UND|I_BIT|F_BIT /* Undefined Instruction Mode */
|
||||
mov sp, r0
|
||||
sub r0, r0, #UND_STACK_SIZE
|
||||
msr CPSR_c, #MODE_ABT|I_BIT|F_BIT /* Abort Mode */
|
||||
mov sp, r0
|
||||
sub r0, r0, #ABT_STACK_SIZE
|
||||
msr CPSR_c, #MODE_FIQ|I_BIT|F_BIT /* FIQ Mode */
|
||||
mov sp, r0
|
||||
sub r0, r0, #FIQ_STACK_SIZE
|
||||
msr CPSR_c, #MODE_IRQ|I_BIT|F_BIT /* IRQ Mode */
|
||||
mov sp, r0
|
||||
sub r0, r0, #IRQ_STACK_SIZE
|
||||
msr CPSR_c, #MODE_SVC|I_BIT|F_BIT /* Supervisor Mode */
|
||||
mov sp, r0
|
||||
sub r0, r0, #SVC_STACK_SIZE
|
||||
msr CPSR_c, #MODE_SYS|I_BIT|F_BIT /* System Mode */
|
||||
mov sp, r0
|
||||
|
||||
/* We want to start in supervisor mode. Operation will switch to system
|
||||
mode when the first task starts. */
|
||||
msr CPSR_c, #MODE_SVC|I_BIT|F_BIT
|
||||
|
||||
/* Clear BSS. */
|
||||
|
||||
mov a2, #0 /* Fill value */
|
||||
mov fp, a2 /* Null frame pointer */
|
||||
mov r7, a2 /* Null frame pointer for Thumb */
|
||||
|
||||
ldr r1, .LC1 /* Start of memory block */
|
||||
ldr r3, .LC2 /* End of memory block */
|
||||
subs r3, r3, r1 /* Length of block */
|
||||
beq .end_clear_loop
|
||||
mov r2, #0
|
||||
|
||||
.clear_loop:
|
||||
strb r2, [r1], #1
|
||||
subs r3, r3, #1
|
||||
bgt .clear_loop
|
||||
|
||||
.end_clear_loop:
|
||||
|
||||
/* Initialise data. */
|
||||
|
||||
ldr r1, .LC3 /* Start of memory block */
|
||||
ldr r2, .LC4 /* End of memory block */
|
||||
ldr r3, .LC5
|
||||
subs r3, r3, r1 /* Length of block */
|
||||
beq .end_set_loop
|
||||
|
||||
.set_loop:
|
||||
ldrb r4, [r2], #1
|
||||
strb r4, [r1], #1
|
||||
subs r3, r3, #1
|
||||
bgt .set_loop
|
||||
|
||||
.end_set_loop:
|
||||
|
||||
mov r0, #0 /* no arguments */
|
||||
mov r1, #0 /* no argv either */
|
||||
|
||||
bl main
|
||||
|
||||
endless_loop:
|
||||
b endless_loop
|
||||
|
||||
|
||||
.align 0
|
||||
|
||||
.LC1:
|
||||
.word __bss_beg__
|
||||
.LC2:
|
||||
.word __bss_end__
|
||||
.LC3:
|
||||
.word __data_beg__
|
||||
.LC4:
|
||||
.word __data_beg_src__
|
||||
.LC5:
|
||||
.word __data_end__
|
||||
.LC6:
|
||||
.word __stack_end__
|
||||
|
||||
|
||||
/* Setup vector table. Note that undf, pabt, dabt, fiq just execute
|
||||
a null loop. */
|
||||
|
||||
.section .startup,"ax"
|
||||
.code 32
|
||||
.align 0
|
||||
|
||||
b _start /* reset - _start */
|
||||
ldr pc, _undf /* undefined - _undf */
|
||||
ldr pc, _swi /* SWI - _swi */
|
||||
ldr pc, _pabt /* program abort - _pabt */
|
||||
ldr pc, _dabt /* data abort - _dabt */
|
||||
nop /* reserved */
|
||||
ldr pc, [pc,#-0x120] /* IRQ - read the VIC */
|
||||
ldr pc, _fiq /* FIQ - _fiq */
|
||||
|
||||
_undf: .word __undf /* undefined */
|
||||
_swi: .word 0x40000008 /* SWI */
|
||||
_pabt: .word __pabt /* program abort */
|
||||
_dabt: .word __dabt /* data abort */
|
||||
.word 0
|
||||
_irq: .word 0
|
||||
_fiq: .word __fiq /* FIQ */
|
||||
|
||||
__undf: b . /* undefined */
|
||||
__pabt: b . /* program abort */
|
||||
__dabt: b . /* data abort */
|
||||
__fiq: b . /* FIQ */
|
||||
@@ -0,0 +1,68 @@
|
||||
MEMORY
|
||||
{
|
||||
flash : ORIGIN = 0x00000000, LENGTH = 20K
|
||||
ramheader : ORIGIN = 0x40000000, LENGTH = 0x60
|
||||
ram : ORIGIN = 0x40000060, LENGTH = 32K - 0x60
|
||||
usbram : ORIGIN = 0x7FD00000, LENGTH = 8K
|
||||
ethram : ORIGIN = 0x7FE00000, LENGTH = 16K
|
||||
}
|
||||
|
||||
__stack_end__ = 0x40000000 + 32K - 4;
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
. = 0;
|
||||
startup : { *(.startup)} >flash
|
||||
|
||||
prog :
|
||||
{
|
||||
*(.text)
|
||||
*(.rodata)
|
||||
*(.rodata*)
|
||||
*(.glue_7)
|
||||
*(.glue_7t)
|
||||
} >flash
|
||||
|
||||
__end_of_text__ = .;
|
||||
|
||||
.data :
|
||||
{
|
||||
__data_beg__ = .;
|
||||
__data_beg_src__ = __end_of_text__;
|
||||
*(.data)
|
||||
__data_end__ = .;
|
||||
} >ram AT>flash
|
||||
|
||||
.bss :
|
||||
{
|
||||
__bss_beg__ = .;
|
||||
*(.bss)
|
||||
__bss_end__ = .;
|
||||
} >ram
|
||||
|
||||
/* Align here to ensure that the .bss section occupies space up to
|
||||
_end. Align after .bss to ensure correct alignment even if the
|
||||
.bss section disappears because there are no input sections. */
|
||||
. = ALIGN(32 / 8);
|
||||
|
||||
.usbram (NOLOAD):
|
||||
{
|
||||
__usbram_beg__ = .;
|
||||
*(.dmaram)
|
||||
__usbram_end__ = .;
|
||||
} >usbram
|
||||
|
||||
.ethram (NOLOAD):
|
||||
{
|
||||
__ethram_beg__ = .;
|
||||
*(.ethram)
|
||||
__ethram_end__ = .;
|
||||
} >ethram
|
||||
}
|
||||
. = ALIGN(32 / 8);
|
||||
_end = .;
|
||||
/*_bss_end__ = . ; __bss_end__ = . ; */
|
||||
__end__ = . ;
|
||||
PROVIDE (end = .);
|
||||
|
||||
|
||||
@@ -0,0 +1,207 @@
|
||||
/*
|
||||
FreeRTOS.org V4.6.1 - Copyright (C) 2003-2007 Richard Barry.
|
||||
|
||||
This file is part of the FreeRTOS.org distribution.
|
||||
|
||||
FreeRTOS.org 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.
|
||||
|
||||
FreeRTOS.org 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 FreeRTOS.org; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
A special exception to the GPL can be applied should you wish to distribute
|
||||
a combined work that includes FreeRTOS.org, without being obliged to provide
|
||||
the source code for any proprietary components. See the licensing section
|
||||
of http://www.FreeRTOS.org for full details of how and when the exception
|
||||
can be applied.
|
||||
|
||||
***************************************************************************
|
||||
See http://www.FreeRTOS.org for documentation, latest information, license
|
||||
and contact details. Please ensure to read the configuration and relevant
|
||||
port sections of the online documentation.
|
||||
|
||||
Also see http://www.SafeRTOS.com a version that has been certified for use
|
||||
in safety critical systems, plus commercial licensing, development and
|
||||
support options.
|
||||
***************************************************************************
|
||||
*/
|
||||
|
||||
/* includes */
|
||||
#include "types.h"
|
||||
#include "sys_config.h"
|
||||
#include "dio.h"
|
||||
#include "leds.h"
|
||||
#include "serial.h"
|
||||
#include "irq.h"
|
||||
#include "bus.h"
|
||||
#include "appimage.h"
|
||||
#include "LPC23xx.h"
|
||||
#include "CommListeners.h"
|
||||
#include "InternalFlash.h"
|
||||
#include "Watchdog.h"
|
||||
|
||||
/* Constants to setup the PLL. */
|
||||
#define mainPLL_ENABLE ( ( UINT32 ) 0x0001 )
|
||||
#define mainPLL_CONNECT ( ( ( UINT32 ) 0x0002 ) | mainPLL_ENABLE )
|
||||
#define mainPLL_FEED_BYTE1 ( ( UINT32 ) 0xaa )
|
||||
#define mainPLL_FEED_BYTE2 ( ( UINT32 ) 0x55 )
|
||||
#define mainPLL_LOCK ( ( UINT32 ) 0x4000000 )
|
||||
#define mainPLL_CONNECTED ( ( UINT32 ) 0x2000000 )
|
||||
#define mainOSC_ENABLE ( ( UINT32 ) 0x20 )
|
||||
#define mainOSC_STAT ( ( UINT32 ) 0x40 )
|
||||
#define mainOSC_SELECT ( ( UINT32 ) 0x01 )
|
||||
|
||||
#define SWI_RAM_ADDR 0x40000008
|
||||
#define SWI_RAM_FUNC_ADDR 0x40000028
|
||||
|
||||
/* Constants to setup the MAM. */
|
||||
#define mainMAM_TIM_3 ( ( UINT8 ) 0x03 )
|
||||
#define mainMAM_MODE_FULL ( ( UINT8 ) 0x02 )
|
||||
|
||||
/* Configure the hardware as required by the demo. */
|
||||
static inline void prvSetVectors();
|
||||
static void prvSetupHardware( void );
|
||||
static void prvSetupDrivers( void );
|
||||
static void cpu_swi_isr( void );
|
||||
|
||||
BOOLEAN StopFlashing = FALSE;
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
|
||||
int main( void )
|
||||
{
|
||||
prvSetVectors();
|
||||
prvSetupHardware();
|
||||
prvSetupDrivers();
|
||||
|
||||
ENABLE_INTERRUPTS();
|
||||
|
||||
ledSet( LED1, 1 ); // Turn both LED's on to indicate Bootcode
|
||||
ledSet( LED0, 1 );
|
||||
|
||||
//watchdogEnable( 10000 );
|
||||
|
||||
if ((appiValidAppImageAvail() == TRUE) && (appiApplicationRequestsUpdate() == FALSE))
|
||||
{
|
||||
// Reset watchdog flag anyway
|
||||
watchdogCausedReset();
|
||||
|
||||
ledSet( LED1, 0 );
|
||||
ledSet( LED0, 0 );
|
||||
|
||||
appiJumpToAppImage();
|
||||
}
|
||||
|
||||
// Enter program state
|
||||
initCom1Listener();
|
||||
initCom2Listener();
|
||||
initBus1Listener();
|
||||
initBus2Listener();
|
||||
|
||||
// for now stay in bootloader to test different things
|
||||
for (;;)
|
||||
{
|
||||
listen2Com1();
|
||||
listen2Com2();
|
||||
listen2Bus1();
|
||||
listen2Bus2();
|
||||
|
||||
watchdogFeed();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
inline void prvSetVectors()
|
||||
{
|
||||
unsigned int *ptr;
|
||||
// Set vectors of interrupt, software interupt and fiq
|
||||
|
||||
// Set interrupt vectors
|
||||
ptr = (unsigned int *)SWI_RAM_ADDR;
|
||||
*ptr = 0xE59FF018; // This is a ldr pc, [pc,#24] instruction
|
||||
|
||||
// Put SWI, IRQ & FIQ vectors in RAM
|
||||
ptr = (unsigned int *)SWI_RAM_FUNC_ADDR;
|
||||
*ptr = (unsigned int)&cpu_swi_isr;
|
||||
}
|
||||
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void prvSetupHardware( void )
|
||||
{
|
||||
//UINT32 i = 0;
|
||||
//volatile UINT32 *vect_addr, *vect_prio;
|
||||
|
||||
#ifdef RUN_FROM_RAM
|
||||
/* Remap the interrupt vectors to RAM if we are are running from RAM. */
|
||||
SCB_MEMMAP = 2;
|
||||
#endif
|
||||
|
||||
/* Disable the PLL. */
|
||||
PLLCON = 0;
|
||||
PLLFEED = mainPLL_FEED_BYTE1;
|
||||
PLLFEED = mainPLL_FEED_BYTE2;
|
||||
|
||||
/* Configure clock source. */
|
||||
SCS |= mainOSC_ENABLE;
|
||||
while( !( SCS & mainOSC_STAT ) );
|
||||
CLKSRCSEL = mainOSC_SELECT;
|
||||
|
||||
/* Setup the PLL to multiply the XTAL input by 4. */
|
||||
PLLCFG = ( PLL_MUL | PLL_DIV );
|
||||
PLLFEED = mainPLL_FEED_BYTE1;
|
||||
PLLFEED = mainPLL_FEED_BYTE2;
|
||||
|
||||
/* Turn on and wait for the PLL to lock... */
|
||||
PLLCON = mainPLL_ENABLE;
|
||||
PLLFEED = mainPLL_FEED_BYTE1;
|
||||
PLLFEED = mainPLL_FEED_BYTE2;
|
||||
CCLKCFG = CCLK_DIV;
|
||||
while( !( PLLSTAT & mainPLL_LOCK ) );
|
||||
|
||||
/* Connecting the clock. */
|
||||
PLLCON = mainPLL_CONNECT;
|
||||
PLLFEED = mainPLL_FEED_BYTE1;
|
||||
PLLFEED = mainPLL_FEED_BYTE2;
|
||||
while( !( PLLSTAT & mainPLL_CONNECTED ) );
|
||||
|
||||
/* Setup and turn on the MAM. Three cycle access is used due to the fast
|
||||
PLL used. It is possible faster overall performance could be obtained by
|
||||
tuning the MAM and PLL settings. */
|
||||
MAMCR = 0;
|
||||
MAMTIM = mainMAM_TIM_3;
|
||||
MAMCR = mainMAM_MODE_FULL;
|
||||
|
||||
init_VIC();
|
||||
}
|
||||
|
||||
void prvSetupDrivers( void )
|
||||
{
|
||||
iflashInit();
|
||||
ledInit();
|
||||
ledSet( LED1, 1 );
|
||||
ledSet( LED0, 1 );
|
||||
//for(;;);
|
||||
|
||||
// Open both COM-ports
|
||||
serInit( COM1, B57600, UART_8N1, UART_FIFO_8);
|
||||
serInit( COM2, B57600, UART_8N1, UART_FIFO_8);
|
||||
busInit( BUS1 );
|
||||
busInit( BUS2 );
|
||||
}
|
||||
|
||||
void cpu_swi_isr()
|
||||
{
|
||||
for (;;);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>inc</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
@@ -0,0 +1,112 @@
|
||||
/*
|
||||
FreeRTOS V4.6.1 - Copyright (C) 2003-2005 Richard Barry.
|
||||
|
||||
This file is part of the FreeRTOS distribution.
|
||||
|
||||
FreeRTOS 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.
|
||||
|
||||
FreeRTOS 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 FreeRTOS; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
A special exception to the GPL can be applied should you wish to distribute
|
||||
a combined work that includes FreeRTOS, without being obliged to provide
|
||||
the source code for any proprietary components. See the licensing section
|
||||
of http://www.FreeRTOS.org for full details of how and when the exception
|
||||
can be applied.
|
||||
|
||||
***************************************************************************
|
||||
See http://www.FreeRTOS.org for documentation, latest information, license
|
||||
and contact details. Please ensure to read the configuration and relevant
|
||||
port sections of the online documentation.
|
||||
***************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef FREERTOS_CONFIG_H
|
||||
#define FREERTOS_CONFIG_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include "lpc23xx.h"
|
||||
/*-----------------------------------------------------------
|
||||
* Application specific definitions.
|
||||
*
|
||||
* These definitions should be adjusted for your particular hardware and
|
||||
* application requirements.
|
||||
*
|
||||
* THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE
|
||||
* FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.
|
||||
*----------------------------------------------------------*/
|
||||
|
||||
#define configPINSEL2_VALUE 0x50151105
|
||||
|
||||
#define configUSE_PREEMPTION 1
|
||||
#define configUSE_IDLE_HOOK 0
|
||||
#define configUSE_TICK_HOOK 1
|
||||
#define configCPU_CLOCK_HZ ( ( unsigned portLONG ) 48000000 ) /* =12Mhz xtal multiplied by 5 using the PLL. */
|
||||
#define configTICK_RATE_HZ ( ( portTickType ) 1000 )
|
||||
#define configMAX_PRIORITIES ( ( unsigned portBASE_TYPE ) 4 )
|
||||
#define configMINIMAL_STACK_SIZE ( ( unsigned portSHORT ) 104 )
|
||||
#define configTOTAL_HEAP_SIZE (( size_t ) ( 14 * 1024 ) )
|
||||
#define configMAX_TASK_NAME_LEN ( 20 )
|
||||
#define configUSE_TRACE_FACILITY 1
|
||||
#define configUSE_16_BIT_TICKS 0
|
||||
#define configIDLE_SHOULD_YIELD 1
|
||||
#define configUSE_MUTEXES 1
|
||||
|
||||
/* Co-routine definitions. */
|
||||
#define configUSE_CO_ROUTINES 0
|
||||
#define configMAX_CO_ROUTINE_PRIORITIES ( 2 )
|
||||
|
||||
|
||||
/* Set the following definitions to 1 to include the API function, or zero
|
||||
to exclude the API function. */
|
||||
|
||||
#define INCLUDE_vTaskPrioritySet 1
|
||||
#define INCLUDE_uxTaskPriorityGet 1
|
||||
#define INCLUDE_vTaskDelete 1
|
||||
#define INCLUDE_vTaskCleanUpResources 0
|
||||
#define INCLUDE_vTaskSuspend 1
|
||||
#define INCLUDE_vTaskDelayUntil 1
|
||||
#define INCLUDE_vTaskDelay 1
|
||||
#define INCLUDE_xTaskGetCurrentTaskHandle 1
|
||||
|
||||
|
||||
#endif /* FREERTOS_CONFIG_H */
|
||||
|
||||
|
||||
#ifndef sbi
|
||||
#define sbi(x,y) x|=(1 << (y))
|
||||
#endif
|
||||
|
||||
#ifndef cbi
|
||||
#define cbi(x,y) x&=~(1 << (y))
|
||||
#endif
|
||||
|
||||
#ifndef tstb
|
||||
#define tstb(x,y) (x & (1 << (y)) ? 1 : 0)
|
||||
#endif
|
||||
|
||||
#ifndef toggle
|
||||
#define toggle(x,y) x^=(1 << (y))
|
||||
#endif
|
||||
|
||||
#ifndef BIT
|
||||
#define BIT(x) (1 << (x))
|
||||
|
||||
typedef struct
|
||||
{
|
||||
long xColumn;
|
||||
char *pcMessage;
|
||||
} xLCDMessage;
|
||||
|
||||
extern void vApplicationTickHook( void );
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,89 @@
|
||||
MEMORY
|
||||
{
|
||||
flash : ORIGIN = 0x00005000, LENGTH = 500K - 20K
|
||||
ramheader : ORIGIN = 0x40000000, LENGTH = 0x60
|
||||
/* ram : ORIGIN = 0x40000060, LENGTH = 32K - 0x60 */
|
||||
ram : ORIGIN = 0x40000060, LENGTH = 64K - 0x60
|
||||
usbram : ORIGIN = 0x7FD00000, LENGTH = 8K
|
||||
ethram : ORIGIN = 0x7FE00000, LENGTH = 16K
|
||||
rtcram : ORIGIN = 0xE0084000, LENGTH = 2K
|
||||
}
|
||||
|
||||
/* __stack_end__ = 0x40000000 + 32K - 4; */
|
||||
__stack_end__ = 0x40000000 + 64K - 4;
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
. = 0;
|
||||
startup : { *(.startup)} >flash
|
||||
|
||||
prog :
|
||||
{
|
||||
*(.text)
|
||||
*(.rodata)
|
||||
*(.rodata*)
|
||||
*(.glue_7)
|
||||
*(.glue_7t)
|
||||
} >flash
|
||||
|
||||
__end_of_text__ = .;
|
||||
|
||||
.data :
|
||||
{
|
||||
__data_beg__ = .;
|
||||
__data_beg_src__ = __end_of_text__;
|
||||
*(.data)
|
||||
__data_end__ = .;
|
||||
} >ram AT>flash
|
||||
|
||||
.bss :
|
||||
{
|
||||
__bss_beg__ = .;
|
||||
*(.bss)
|
||||
*(COMMON)
|
||||
__bss_end__ = .;
|
||||
} >ram
|
||||
|
||||
.backupram (NOLOAD):
|
||||
{
|
||||
__backupram_beg__ = .;
|
||||
*(.backupram);
|
||||
__backupram_end__ = .;
|
||||
} >ram
|
||||
|
||||
|
||||
/* Align here to ensure that the .bss section occupies space up to
|
||||
_end. Align after .bss to ensure correct alignment even if the
|
||||
.bss section disappears because there are no input sections. */
|
||||
. = ALIGN(32 / 8);
|
||||
|
||||
.usbram (NOLOAD):
|
||||
{
|
||||
__usbram_beg__ = .;
|
||||
*(.dmaram)
|
||||
__usbram_end__ = .;
|
||||
} >usbram
|
||||
|
||||
.ethram (NOLOAD):
|
||||
{
|
||||
__ethram_beg__ = .;
|
||||
*(.ethram)
|
||||
__ethram_end__ = .;
|
||||
} >ethram
|
||||
|
||||
|
||||
.rtcram (NOLOAD):
|
||||
{
|
||||
__rtcram_beg__ = .;
|
||||
*(.rtcram)
|
||||
__rtcram_end__ = .;
|
||||
} >rtcram
|
||||
|
||||
}
|
||||
. = ALIGN(32 / 8);
|
||||
_end = .;
|
||||
/*_bss_end__ = . ; __bss_end__ = . ; */
|
||||
__end__ = . ;
|
||||
PROVIDE (end = .);
|
||||
|
||||
|
||||
@@ -0,0 +1,202 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* $RCSfile: $
|
||||
* $Revision: $
|
||||
*
|
||||
* This module provides information about the project configuration
|
||||
* Copyright 2004, R O SoftWare
|
||||
* No guarantees, warrantees, or promises, implied or otherwise.
|
||||
* May be used for hobby or commercial purposes provided copyright
|
||||
* notice remains intact.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
/* modified by Martin Thomas */
|
||||
|
||||
// 5/2007 mt: adapted to LPC23xx/24xx
|
||||
|
||||
#ifndef SYS_CONFIG_H__
|
||||
#define SYS_CONFIG_H__
|
||||
|
||||
#include "LPC23xx.h"
|
||||
|
||||
/*#include "app_types.h"
|
||||
//#include "LPC_REGS.h"*/
|
||||
|
||||
// some handy DEFINES
|
||||
#ifndef FALSE
|
||||
#define FALSE 0
|
||||
#ifndef TRUE
|
||||
#define TRUE !FALSE
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef BIT
|
||||
#define BIT(n) (1L << (n))
|
||||
#endif
|
||||
|
||||
#ifndef TSTBIT
|
||||
#define TSTBIT(a, n) (a & (1L << n) ? TRUE : FALSE)
|
||||
#endif
|
||||
|
||||
#define HLWORD(hb,lb) ( ((UINT16)(hb)<< 8) | ((UINT16)(lb) & 0x00FF) )
|
||||
|
||||
#define SW1_PIN FIO0PIN
|
||||
#define SW1_BIT BIT(29)
|
||||
#define SW2_PIN SW1_PIN
|
||||
#define SW2_BIT BIT(18)
|
||||
|
||||
#define LED1_SET FIO0SET
|
||||
#define LED1_DIR FIO0DIR
|
||||
#define LED1_CLR FIO0CLR
|
||||
#define LED1_PIN FIO0PIN
|
||||
#define LED1_BIT BIT(21) /* MCI PWR */
|
||||
|
||||
#if 0
|
||||
#define LED2_SET FIO1SET
|
||||
#define LED2_DIR FIO1DIR
|
||||
#define LED2_CLR FIO1CLR
|
||||
#define LED2_BIT BIT(26) /* LCD BL */
|
||||
#endif
|
||||
|
||||
#define HOST_BAUD_U0 (115200)
|
||||
#define HOST_BAUD_U1 (115200)
|
||||
|
||||
#define WDOG()
|
||||
|
||||
// PLL setup values are computed within the LPC include file
|
||||
// It relies upon the following defines
|
||||
// PLL input is the XTAL at FOSC
|
||||
// FCCO is FOSC * PLL_MUL * 2 / PLL_DIV
|
||||
//
|
||||
#define FOSC (12000000) // Master Oscillator Freq.
|
||||
#define PLL_MUL (11) // PLL Multiplier
|
||||
#define PLL_DIV (0) // PLL Divider
|
||||
#define CCLK_DIV (5) // PLL out -> CPU clock divider
|
||||
#define FCCO ((FOSC * (PLL_MUL + 1) * 2) / (PLL_DIV + 1)) // PLLclk= 288 Mhz
|
||||
#define CCLK ( FCCO / (CCLK_DIV + 1) ) // CPU Clock Freq. (48 Mhz)
|
||||
|
||||
// Pheripheral Bus Speed Divider
|
||||
#define PBSD 4 // MUST BE 1, 2, or 4
|
||||
#define PCLK (CCLK / PBSD) // Pheripheal Bus Clock Freq.
|
||||
|
||||
|
||||
// The following ist not used in this example:
|
||||
// Port Bit Definitions & Macros: Description - initial conditions
|
||||
// Port 0
|
||||
#define P00_UNUSED_BIT BIT(0) // P0.00 unused - low output
|
||||
#define P01_UNUSED_BIT BIT(1) // P0.01 unused - low output
|
||||
#define P02_UNUSED_BIT BIT(2) // P0.02 unused - low output
|
||||
#define P03_UNUSED_BIT BIT(3) // P0.03 unused - low output
|
||||
#define P04_UNUSED_BIT BIT(4) // P0.04 unused - low output
|
||||
#define P05_UNUSED_BIT BIT(5) // P0.05 unused - low output
|
||||
#define P06_UNUSED_BIT BIT(6) // P0.06 unused - low output
|
||||
#define P07_UNUSED_BIT BIT(7) // P0.06 unused - low output
|
||||
#define P08_UNUSED_BIT BIT(8) // P0.08 unused - low output
|
||||
#define P09_UNUSED_BIT BIT(9) // P0.09 unused - low output
|
||||
#define P10_UNUSED_BIT BIT(10) // P0.10 unused - low output
|
||||
#define P11_UNUSED_BIT BIT(11) // P0.11 unused - low output
|
||||
#define P12_UNUSED_BIT BIT(12) // P0.12 unused - low output
|
||||
#define P13_UNUSED_BIT BIT(13) // P0.13 unused - low output
|
||||
#define P14_UNUSED_BIT BIT(14) // P0.14 unused - low output
|
||||
#define P15_UNUSED_BIT BIT(15) // P0.15 unused - low output
|
||||
#define P16_UNUSED_BIT BIT(16) // P0.16 unused - low output
|
||||
#define P17_UNUSED_BIT BIT(17) // P0.17 unused - low output
|
||||
#define P18_UNUSED_BIT BIT(18) // P0.18 unused - low output
|
||||
#define P19_UNUSED_BIT BIT(19) // P0.19 unused - low output
|
||||
#define P20_UNUSED_BIT BIT(20) // P0.20 unused - low output
|
||||
#define P21_UNUSED_BIT BIT(21) // P0.21 unused - low output
|
||||
#define P22_UNUSED_BIT BIT(22) // P0.22 unused - low output
|
||||
#define P23_UNUSED_BIT BIT(23) // P0.23 unused - low output
|
||||
#define P24_UNUSED_BIT BIT(24) // P0.24 unused - low output
|
||||
#define P25_UNUSED_BIT BIT(25) // P0.25 unused - low output
|
||||
#define P26_UNUSED_BIT BIT(26) // P0.26 unused - low output
|
||||
#define P27_UNUSED_BIT BIT(27) // P0.27 unused - low output
|
||||
#define P28_UNUSED_BIT BIT(28) // P0.28 unused - low output
|
||||
#define P29_UNUSED_BIT BIT(29) // P0.29 unused - low output
|
||||
#define P30_UNUSED_BIT BIT(30) // P0.30 unused - low output
|
||||
#define P31_UNUSED_BIT BIT(31) // P0.31 unused - low output
|
||||
|
||||
// Port 1
|
||||
// Port Bit Definitions & Macros: Description - initial conditions
|
||||
#define P1_00_UNUSED_BIT BIT(0) // P1_0.00 unused - low output
|
||||
#define P1_01_UNUSED_BIT BIT(1) // P1_0.01 unused - low output
|
||||
#define P1_02_UNUSED_BIT BIT(2) // P1_0.02 unused - low output
|
||||
#define P1_03_UNUSED_BIT BIT(3) // P1_0.03 unused - low output
|
||||
#define P1_04_UNUSED_BIT BIT(4) // P1_0.04 unused - low output
|
||||
#define P1_05_UNUSED_BIT BIT(5) // P1_0.05 unused - low output
|
||||
#define P1_06_UNUSED_BIT BIT(6) // P1_0.06 unused - low output
|
||||
#define P1_07_UNUSED_BIT BIT(7) // P1_0.06 unused - low output
|
||||
#define P1_08_UNUSED_BIT BIT(8) // P1_0.08 unused - low output
|
||||
#define P1_09_UNUSED_BIT BIT(9) // P1_0.09 unused - low output
|
||||
#define P1_10_UNUSED_BIT BIT(10) // P1_0.10 unused - low output
|
||||
#define P1_11_UNUSED_BIT BIT(11) // P1_0.11 unused - low output
|
||||
#define P1_12_UNUSED_BIT BIT(12) // P1_0.12 unused - low output
|
||||
#define P1_13_UNUSED_BIT BIT(13) // P1_0.13 unused - low output
|
||||
#define P1_14_UNUSED_BIT BIT(14) // P1_0.14 unused - low output
|
||||
#define P1_15_UNUSED_BIT BIT(15) // P1_0.15 unused - low output
|
||||
#define P1_16_UNUSED_BIT BIT(16) // P1_0.16 unused - low output
|
||||
#define P1_17_UNUSED_BIT BIT(17) // P1_0.17 unused - low output
|
||||
#define P1_18_UNUSED_BIT BIT(18) // P1_0.18 unused - low output
|
||||
#define P1_19_UNUSED_BIT BIT(19) // P1_0.19 unused - low output
|
||||
#define P1_20_UNUSED_BIT BIT(20) // P1_0.20 unused - low output
|
||||
#define P1_21_UNUSED_BIT BIT(21) // P1_0.21 unused - low output
|
||||
#define P1_22_UNUSED_BIT BIT(22) // P1_0.22 unused - low output
|
||||
#define P1_23_UNUSED_BIT BIT(23) // P1_0.23 unused - low output
|
||||
#define P1_24_UNUSED_BIT BIT(24) // P1_0.24 unused - low output
|
||||
#define P1_25_UNUSED_BIT BIT(25) // P1_0.25 unused - low output
|
||||
#define P1_26_UNUSED_BIT BIT(26) // P1_0.26 unused - low output
|
||||
#define P1_27_UNUSED_BIT BIT(27) // P1_0.27 unused - low output
|
||||
#define P1_28_UNUSED_BIT BIT(28) // P1_0.28 unused - low output
|
||||
#define P1_29_UNUSED_BIT BIT(29) // P1_0.29 unused - low output
|
||||
#define P1_30_UNUSED_BIT BIT(30) // P1_0.30 unused - low output
|
||||
#define P1_31_UNUSED_BIT BIT(31) // P1_0.31 unused - low output
|
||||
|
||||
|
||||
#define PIO_INPUT_BITS (uint32_t) ( \
|
||||
0 )
|
||||
|
||||
#define PIO_ZERO_BITS (uint32_t) ( \
|
||||
P00_UNUSED_BIT | \
|
||||
P01_UNUSED_BIT | \
|
||||
P02_UNUSED_BIT | \
|
||||
P03_UNUSED_BIT | \
|
||||
P04_UNUSED_BIT | \
|
||||
P05_UNUSED_BIT | \
|
||||
P06_UNUSED_BIT | \
|
||||
P07_UNUSED_BIT | \
|
||||
P08_UNUSED_BIT | \
|
||||
P09_UNUSED_BIT | \
|
||||
P10_UNUSED_BIT | \
|
||||
P11_UNUSED_BIT | \
|
||||
P12_UNUSED_BIT | \
|
||||
P13_UNUSED_BIT | \
|
||||
P14_UNUSED_BIT | \
|
||||
P15_UNUSED_BIT | \
|
||||
P16_UNUSED_BIT | \
|
||||
P16_UNUSED_BIT | \
|
||||
P17_UNUSED_BIT | \
|
||||
P18_UNUSED_BIT | \
|
||||
P19_UNUSED_BIT | \
|
||||
P20_UNUSED_BIT | \
|
||||
P21_UNUSED_BIT | \
|
||||
P22_UNUSED_BIT | \
|
||||
P23_UNUSED_BIT | \
|
||||
P24_UNUSED_BIT | \
|
||||
P25_UNUSED_BIT | \
|
||||
P26_UNUSED_BIT | \
|
||||
P27_UNUSED_BIT | \
|
||||
P28_UNUSED_BIT | \
|
||||
P29_UNUSED_BIT | \
|
||||
P30_UNUSED_BIT | \
|
||||
P31_UNUSED_BIT | \
|
||||
0 )
|
||||
|
||||
#define PIO_ONE_BITS (uint32_t) ( \
|
||||
0 )
|
||||
|
||||
#define PIO_OUTPUT_BITS (uint32_t) ( \
|
||||
PIO_ZERO_BITS | \
|
||||
PIO_ONE_BITS )
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,108 @@
|
||||
/* ---------------------------------------------------------------------------
|
||||
* types.h - v0.1 (c) 2007 Micro-key bv
|
||||
* ---------------------------------------------------------------------------
|
||||
* Micro-key bv
|
||||
* Industrieweg 28, 9804 TG Noordhorn
|
||||
* Postbus 92, 9800 AB Zuidhorn
|
||||
* The Netherlands
|
||||
* Tel: +31 594 503020
|
||||
* Fax: +31 594 505825
|
||||
* Email: support@microkey.nl
|
||||
* Web: www.microkey.nl
|
||||
* ---------------------------------------------------------------------------
|
||||
* Description: Contains definitions of native types.
|
||||
* ---------------------------------------------------------------------------
|
||||
* Version(s): 0.1, 10-09-2007, Marcel Mulder.
|
||||
* Creation.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef __TYPES_H__
|
||||
#define __TYPES_H__
|
||||
/** \file types.h
|
||||
\brief Contains the native types of LPC2378
|
||||
*/
|
||||
/* ---------------------------------------------------------------------------
|
||||
* System include files.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Application include files.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Constant and macro definitions.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#define UINT8 unsigned char
|
||||
#define UINT16 unsigned short
|
||||
#define UINT32 unsigned int
|
||||
|
||||
|
||||
typedef unsigned long long UINT64; // Unsigned 64 bit quantity
|
||||
|
||||
|
||||
#define pUINT8 unsigned char *
|
||||
#define pUINT16 unsigned short *
|
||||
#define pUINT32 unsigned int *
|
||||
|
||||
|
||||
#define INT8 char
|
||||
#define INT16 short
|
||||
#define INT32 int
|
||||
|
||||
|
||||
#define pINT8 char *
|
||||
#define pINT16 short *
|
||||
#define pINT32 int *
|
||||
|
||||
|
||||
#ifndef BIT
|
||||
#define BIT(n) (1L << (n))
|
||||
#endif
|
||||
|
||||
#ifndef NULL
|
||||
#define NULL (0)
|
||||
#endif
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Type definitions.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#ifdef fsasfd
|
||||
typedef enum
|
||||
{
|
||||
FALSE = 0, /**< Definition of false*/
|
||||
TRUE
|
||||
} BOOLEAN;
|
||||
#endif
|
||||
|
||||
#ifndef FALSE
|
||||
#define FALSE (1 == 0)
|
||||
#endif
|
||||
|
||||
#ifndef TRUE
|
||||
#define TRUE (1==1)
|
||||
#endif
|
||||
|
||||
#define BOOLEAN char
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
ERROR = 0, /**< Definition for ERROR*/
|
||||
OK
|
||||
} RESULT;
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Variable declarations.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Function declarations.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#endif /* __TYPES_H__ */
|
||||
@@ -0,0 +1,607 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<?fileVersion 4.0.0?>
|
||||
|
||||
<cproject>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.settings">
|
||||
<cconfiguration id="cdt.managedbuild.config.gnu.cygwin.lib.debug.1544585684">
|
||||
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.cygwin.lib.debug.1544585684" moduleId="org.eclipse.cdt.core.settings" name="Debug">
|
||||
<externalSettings>
|
||||
<externalSetting>
|
||||
<entry flags="VALUE_WORKSPACE_PATH" kind="includePath" name="/BusProtocol"/>
|
||||
<entry flags="VALUE_WORKSPACE_PATH" kind="libraryPath" name="/BusProtocol/Debug"/>
|
||||
</externalSetting>
|
||||
</externalSettings>
|
||||
<extensions>
|
||||
<extension id="org.eclipse.cdt.core.Cygwin_PE" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
<extension id="org.eclipse.cdt.core.MakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
</extensions>
|
||||
</storageModule>
|
||||
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||
<configuration artifactExtension="a" artifactName="BusProtocol" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.staticLib" buildProperties="org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug,org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.staticLib" cleanCommand="rm -rf" description="" id="cdt.managedbuild.config.gnu.cygwin.lib.debug.1544585684" name="Debug" parent="cdt.managedbuild.config.gnu.cygwin.lib.debug" postannouncebuildStep="" postbuildStep="" preannouncebuildStep="" prebuildStep="">
|
||||
<folderInfo id="cdt.managedbuild.config.gnu.cygwin.lib.debug.1544585684." name="/" resourcePath="">
|
||||
<toolChain id="cdt.managedbuild.toolchain.gnu.cygwin.lib.debug.326940027" name="Cygwin GCC" superClass="cdt.managedbuild.toolchain.gnu.cygwin.lib.debug">
|
||||
<targetPlatform id="cdt.managedbuild.target.gnu.platform.cygwin.lib.debug.1094805505" name="Debug Platform" superClass="cdt.managedbuild.target.gnu.platform.cygwin.lib.debug"/>
|
||||
<builder autoBuildTarget="all" buildPath="${workspace_loc:/BusProtocol/Debug}" cleanBuildTarget="clean" enableAutoBuild="false" enableCleanBuild="true" enabledIncrementalBuild="true" id="cdt.managedbuild.target.gnu.builder.cygwin.lib.debug.1509971901" incrementalBuildTarget="all" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="cdt.managedbuild.target.gnu.builder.cygwin.lib.debug"/>
|
||||
<tool command="arm-elf-as" id="cdt.managedbuild.tool.gnu.assembler.cygwin.lib.debug.772227085" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.cygwin.lib.debug">
|
||||
<inputType id="cdt.managedbuild.tool.gnu.assembler.input.1203300128" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
|
||||
</tool>
|
||||
<tool command="arm-elf-ar" id="cdt.managedbuild.tool.gnu.archiver.cygwin.lib.debug.777348117" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.cygwin.lib.debug"/>
|
||||
<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.cygwin.lib.debug.858821726" name="Cygwin C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.cygwin.lib.debug"/>
|
||||
<tool command="arm-elf-gcc" id="cdt.managedbuild.tool.gnu.c.compiler.cygwin.lib.debug.1733787066" name="Cygwin C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.cygwin.lib.debug">
|
||||
<option id="gnu.c.compiler.option.include.paths.1509385572" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/inc}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/Drivers}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/BusProtocol}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/FreeRTOS/include}""/>
|
||||
</option>
|
||||
<option id="gnu.c.compiler.option.preprocessor.def.symbols.1680796165" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" valueType="definedSymbols">
|
||||
<listOptionValue builtIn="false" value="ROWLEY_LPC23xx"/>
|
||||
<listOptionValue builtIn="false" value="THUMB_INTERWORK"/>
|
||||
<listOptionValue builtIn="false" value="ALIGN_STRUCT_END=__attribute\(\(aligned\(4\)\)\)"/>
|
||||
<listOptionValue builtIn="false" value="PACK_STRUCT_END=__attribute\(\(packed\)\)"/>
|
||||
</option>
|
||||
<option id="gnu.c.compiler.option.misc.other.499633930" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fomit-frame-pointer -mcpu=arm7tdmi -fshort-enums -mthumb-interwork" valueType="string"/>
|
||||
<option id="gnu.c.compiler.cygwin.lib.debug.option.optimization.level.563157300" name="Optimization Level" superClass="gnu.c.compiler.cygwin.lib.debug.option.optimization.level" value="gnu.c.optimization.level.more" valueType="enumerated"/>
|
||||
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.cygwin.456804014" superClass="cdt.managedbuild.tool.gnu.c.compiler.input.cygwin"/>
|
||||
</tool>
|
||||
<tool id="cdt.managedbuild.tool.gnu.c.linker.cygwin.base.1773436851" name="Cygwin C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.cygwin.base"/>
|
||||
<tool id="cdt.managedbuild.tool.gnu.cpp.linker.cygwin.base.1204613450" name="Cygwin C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.cygwin.base"/>
|
||||
</toolChain>
|
||||
</folderInfo>
|
||||
</configuration>
|
||||
</storageModule>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.language.mapping"/>
|
||||
|
||||
<storageModule moduleId="scannerConfiguration">
|
||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"/>
|
||||
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="makefileGenerator">
|
||||
<runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.cygwin.lib.release.1186752811;cdt.managedbuild.config.gnu.cygwin.lib.release.1186752811.;cdt.managedbuild.tool.gnu.c.compiler.cygwin.lib.release.782884106;cdt.managedbuild.tool.gnu.c.compiler.input.cygwin.2138187002">
|
||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC"/>
|
||||
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="makefileGenerator">
|
||||
<runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
</scannerConfigBuildInfo>
|
||||
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.cygwin.lib.debug.1544585684;cdt.managedbuild.config.gnu.cygwin.lib.debug.1544585684.;cdt.managedbuild.tool.gnu.c.compiler.cygwin.lib.debug.1733787066;cdt.managedbuild.tool.gnu.c.compiler.input.cygwin.456804014">
|
||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC"/>
|
||||
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="makefileGenerator">
|
||||
<runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="arm-elf-gcc" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
</scannerConfigBuildInfo>
|
||||
</storageModule>
|
||||
<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets"/>
|
||||
</cconfiguration>
|
||||
<cconfiguration id="cdt.managedbuild.config.gnu.cygwin.lib.release.1186752811">
|
||||
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.cygwin.lib.release.1186752811" moduleId="org.eclipse.cdt.core.settings" name="Release">
|
||||
<externalSettings>
|
||||
<externalSetting>
|
||||
<entry flags="VALUE_WORKSPACE_PATH" kind="includePath" name="/BusProtocol"/>
|
||||
<entry flags="VALUE_WORKSPACE_PATH" kind="libraryPath" name="/BusProtocol/Release"/>
|
||||
</externalSetting>
|
||||
</externalSettings>
|
||||
<extensions>
|
||||
<extension id="org.eclipse.cdt.core.Cygwin_PE" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
<extension id="org.eclipse.cdt.core.MakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
</extensions>
|
||||
</storageModule>
|
||||
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||
<configuration artifactExtension="a" artifactName="BusProtocol" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.staticLib" buildProperties="org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.release,org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.staticLib" cleanCommand="rm -rf" description="" id="cdt.managedbuild.config.gnu.cygwin.lib.release.1186752811" name="Release" parent="cdt.managedbuild.config.gnu.cygwin.lib.release">
|
||||
<folderInfo id="cdt.managedbuild.config.gnu.cygwin.lib.release.1186752811." name="/" resourcePath="">
|
||||
<toolChain id="cdt.managedbuild.toolchain.gnu.cygwin.lib.release.1075073645" name="Cygwin GCC" superClass="cdt.managedbuild.toolchain.gnu.cygwin.lib.release">
|
||||
<targetPlatform id="cdt.managedbuild.target.gnu.platform.cygwin.lib.release.152549363" name="Debug Platform" superClass="cdt.managedbuild.target.gnu.platform.cygwin.lib.release"/>
|
||||
<builder buildPath="${workspace_loc:/BusProtocol/Release}" id="cdt.managedbuild.target.gnu.builder.cygwin.lib.release.1933028258" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="cdt.managedbuild.target.gnu.builder.cygwin.lib.release"/>
|
||||
<tool id="cdt.managedbuild.tool.gnu.assembler.cygwin.lib.release.983843060" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.cygwin.lib.release">
|
||||
<inputType id="cdt.managedbuild.tool.gnu.assembler.input.329238432" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
|
||||
</tool>
|
||||
<tool id="cdt.managedbuild.tool.gnu.archiver.cygwin.lib.release.919655387" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.cygwin.lib.release"/>
|
||||
<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.cygwin.lib.release.1331857812" name="Cygwin C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.cygwin.lib.release">
|
||||
<option id="gnu.cpp.compiler.cygwin.lib.release.option.optimization.level.1532574349" name="Optimization Level" superClass="gnu.cpp.compiler.cygwin.lib.release.option.optimization.level" value="gnu.cpp.compiler.optimization.level.most" valueType="enumerated"/>
|
||||
<option id="gnu.cpp.compiler.cygwin.lib.release.option.debugging.level.1861766211" name="Debug Level" superClass="gnu.cpp.compiler.cygwin.lib.release.option.debugging.level" value="gnu.cpp.compiler.debugging.level.none" valueType="enumerated"/>
|
||||
</tool>
|
||||
<tool id="cdt.managedbuild.tool.gnu.c.compiler.cygwin.lib.release.782884106" name="Cygwin C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.cygwin.lib.release">
|
||||
<option defaultValue="gnu.c.optimization.level.most" id="gnu.c.compiler.cygwin.lib.release.option.optimization.level.1435830" name="Optimization Level" superClass="gnu.c.compiler.cygwin.lib.release.option.optimization.level" valueType="enumerated"/>
|
||||
<option id="gnu.c.compiler.cygwin.lib.release.option.debugging.level.570236671" name="Debug Level" superClass="gnu.c.compiler.cygwin.lib.release.option.debugging.level" value="gnu.c.debugging.level.none" valueType="enumerated"/>
|
||||
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.cygwin.2138187002" superClass="cdt.managedbuild.tool.gnu.c.compiler.input.cygwin"/>
|
||||
</tool>
|
||||
<tool id="cdt.managedbuild.tool.gnu.c.linker.cygwin.base.1391519689" name="Cygwin C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.cygwin.base"/>
|
||||
<tool id="cdt.managedbuild.tool.gnu.cpp.linker.cygwin.base.1610264802" name="Cygwin C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.cygwin.base"/>
|
||||
</toolChain>
|
||||
</folderInfo>
|
||||
</configuration>
|
||||
</storageModule>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.language.mapping"/>
|
||||
|
||||
<storageModule moduleId="scannerConfiguration">
|
||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"/>
|
||||
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="makefileGenerator">
|
||||
<runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.cygwin.lib.release.1186752811;cdt.managedbuild.config.gnu.cygwin.lib.release.1186752811.;cdt.managedbuild.tool.gnu.c.compiler.cygwin.lib.release.782884106;cdt.managedbuild.tool.gnu.c.compiler.input.cygwin.2138187002">
|
||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC"/>
|
||||
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="makefileGenerator">
|
||||
<runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
</scannerConfigBuildInfo>
|
||||
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.cygwin.lib.debug.1544585684;cdt.managedbuild.config.gnu.cygwin.lib.debug.1544585684.;cdt.managedbuild.tool.gnu.c.compiler.cygwin.lib.debug.1733787066;cdt.managedbuild.tool.gnu.c.compiler.input.cygwin.456804014">
|
||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC"/>
|
||||
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="makefileGenerator">
|
||||
<runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="arm-elf-gcc" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
</scannerConfigBuildInfo>
|
||||
</storageModule>
|
||||
<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets"/>
|
||||
</cconfiguration>
|
||||
</storageModule>
|
||||
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||
<project id="BusProtocol.cdt.managedbuild.target.gnu.cygwin.lib.1635067160" name="Static Library" projectType="cdt.managedbuild.target.gnu.cygwin.lib"/>
|
||||
</storageModule>
|
||||
</cproject>
|
||||
@@ -0,0 +1,84 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>BusProtocol</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
<project>Drivers</project>
|
||||
<project>FreeRTOS</project>
|
||||
<project>inc</project>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
|
||||
<triggers>clean,full,incremental,</triggers>
|
||||
<arguments>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.cleanBuildTarget</key>
|
||||
<value>clean</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.enableCleanBuild</key>
|
||||
<value>true</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.append_environment</key>
|
||||
<value>true</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>?name?</key>
|
||||
<value></value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.stopOnError</key>
|
||||
<value>true</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.buildCommand</key>
|
||||
<value>make</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.contents</key>
|
||||
<value>org.eclipse.cdt.make.core.activeConfigSettings</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.buildLocation</key>
|
||||
<value>${workspace_loc:/BusProtocol/Debug}</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.useDefaultBuildCmd</key>
|
||||
<value>true</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.enableFullBuild</key>
|
||||
<value>true</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.enableAutoBuild</key>
|
||||
<value>false</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.fullBuildTarget</key>
|
||||
<value>all</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.buildArguments</key>
|
||||
<value></value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.autoBuildTarget</key>
|
||||
<value>all</value>
|
||||
</dictionary>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
|
||||
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
|
||||
<nature>org.eclipse.cdt.core.cnature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
@@ -0,0 +1,131 @@
|
||||
/* ---------------------------------------------------------------------------
|
||||
* BpMessageFormat.c - v0.1 (c) 2008 Micro-key bv
|
||||
* ---------------------------------------------------------------------------
|
||||
* Micro-key bv
|
||||
* Industrieweg 28, 9804 TG Noordhorn
|
||||
* Postbus 92, 9800 AB Zuidhorn
|
||||
* The Netherlands
|
||||
* Tel: +31 594 503020
|
||||
* Fax: +31 594 505825
|
||||
* Email: support@microkey.nl
|
||||
* Web: www.microkey.nl
|
||||
* ---------------------------------------------------------------------------
|
||||
* Description:
|
||||
* ---------------------------------------------------------------------------
|
||||
* Version(s): 0.1, Jan 29, 2008, FSc
|
||||
* Creation.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* System include files
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Application include files
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#include "BpMessageFormat.h"
|
||||
#include "Crc.h"
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Local constant and macro definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Global variable definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Local variable definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Local function definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
/** \brief Calculates the CRC over payload etc... and sets unique start byte
|
||||
*
|
||||
* \param msg Message over which the CRC should be calculated
|
||||
*/
|
||||
void bpmsgEncodeMessage( t_bpmsg_message * msg )
|
||||
{
|
||||
UINT16 crc;
|
||||
|
||||
crc = crcCalc( &msg->payloadSize, 1, 0);
|
||||
crc = crcCalc( msg->payload, msg->payloadSize, crc);
|
||||
|
||||
msg->crc = crc;
|
||||
}
|
||||
|
||||
|
||||
void bpmsgAdd16bit(UINT8 *payloadlocation, UINT16 data)
|
||||
{
|
||||
UINT8 index = 0;
|
||||
|
||||
payloadlocation[index] = (UINT8)(data >> 8);
|
||||
index++;
|
||||
payloadlocation[index] = (UINT8)(data & 0x00FF);
|
||||
}
|
||||
|
||||
|
||||
void bpmsgAdd32bit(UINT8 *payloadlocation, UINT32 data)
|
||||
{
|
||||
UINT8 index = 0;
|
||||
|
||||
payloadlocation[index] = (UINT8)(data >> 24);
|
||||
index++;
|
||||
payloadlocation[index] = (UINT8)(data >> 16);
|
||||
index++;
|
||||
payloadlocation[index] = (UINT8)(data >> 8);
|
||||
index++;
|
||||
payloadlocation[index] = (UINT8)(data & 0xFF);
|
||||
|
||||
}
|
||||
|
||||
UINT8 bpmsgGet8bit(UINT8 *payload, UINT8 *payloadIndex)
|
||||
{
|
||||
UINT8 result;
|
||||
|
||||
result = (UINT8)payload[*payloadIndex];
|
||||
(*payloadIndex)++;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
UINT16 bpmsgGet16bit(UINT8 *payload, UINT8 *payloadIndex)
|
||||
{
|
||||
UINT16 result;
|
||||
|
||||
result = ((UINT16)payload[*payloadIndex]) << 8;
|
||||
(*payloadIndex)++;
|
||||
result += ((UINT16)payload[*payloadIndex] & 0x00FF);
|
||||
(*payloadIndex)++;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
UINT32 bpmsgGet32bit(UINT8 *payload, UINT8 *payloadIndex)
|
||||
{
|
||||
UINT32 result;
|
||||
|
||||
result = ((UINT32)payload[*payloadIndex]) << 24;
|
||||
(*payloadIndex)++;
|
||||
result += ((UINT32)payload[*payloadIndex]) << 16;
|
||||
(*payloadIndex)++;
|
||||
result += ((UINT32)payload[*payloadIndex]) << 8;
|
||||
(*payloadIndex)++;
|
||||
result += ((UINT32)payload[*payloadIndex] & 0x000000FF);
|
||||
(*payloadIndex)++;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,102 @@
|
||||
/* ---------------------------------------------------------------------------
|
||||
* BpMessageFormat.h - v0.1 (c) 2008 Micro-key bv
|
||||
* ---------------------------------------------------------------------------
|
||||
* Micro-key bv
|
||||
* Industrieweg 28, 9804 TG Noordhorn
|
||||
* Postbus 92, 9800 AB Zuidhorn
|
||||
* The Netherlands
|
||||
* Tel: +31 594 503020
|
||||
* Fax: +31 594 505825
|
||||
* Email: support@microkey.nl
|
||||
* Web: www.microkey.nl
|
||||
* ---------------------------------------------------------------------------
|
||||
* Description:
|
||||
* ---------------------------------------------------------------------------
|
||||
* Version(s): 0.1, Jan 29, 2008, FSc
|
||||
* Creation.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef __BPMESSAGEFORMAT_H__
|
||||
#define __BPMESSAGEFORMAT_H__
|
||||
/** \file BpMessageFormat.h
|
||||
\brief
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* System include files.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Application include files.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#include "types.h"
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Constant and macro definitions.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#define BPMSG_STARTBYTE (0xAA)
|
||||
|
||||
#define BPMSG_MSGID_PASSTURN (0x00)
|
||||
#define BPMSG_MSGID_RESETCLIENT (0x01)
|
||||
#define BPMSG_MSGID_GIVEELECTRONICSTATUS (0x02)
|
||||
#define BPMSG_MSGID_SETDACVALUE (0x03)
|
||||
#define BPMSG_MSGID_SETDIGITALOUTVALUE (0x04)
|
||||
#define BPMSG_MSGID_SETADCMODE (0x05)
|
||||
#define BPMSG_MSGID_SETALLDIGITALOUT (0x06)
|
||||
#define BPMSG_MSGID_SETALLDACVALUES (0x07)
|
||||
#define BPMSG_MSGID_SETALLDOUTPUT (0x08)
|
||||
#define BPMSG_MSGID_CALLRPC (0x10)
|
||||
#define BPMSG_MSGID_GIVERPCRESULTS (0x11)
|
||||
|
||||
#define BPMSG_BROADCAST_ID (0xFF)
|
||||
#define BPMSG_MASTER_DEVID (0x01)
|
||||
#define BPMSG_STATUS_FINISHEDSENDING (0xC0)
|
||||
#define BPMSG_STATUS_BUSYSENDING (0x40)
|
||||
#define BPMSG_DACMODE_VOLTAGE (0x00)
|
||||
#define BPMSG_DACMODE_CURRENT (0x01)
|
||||
#define BPMSG_ADCMODE_VOLTAGE (0x00)
|
||||
#define BPMSG_ADCMODE_CURRENT (0x01)
|
||||
#define BPMSG_RPC_ERRORRESULT (0xFF)
|
||||
|
||||
#define BPMSG_UINT32_SIZE (4)
|
||||
#define BPMSG_UINT16_SIZE (2)
|
||||
#define BPMSG_UINT8_SIZE (1)
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Type definitions.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
typedef struct t_BPMSG_MESSAGE {
|
||||
UINT8 uniqueStartByte;
|
||||
UINT8 senderId;
|
||||
UINT8 targetId;
|
||||
UINT8 packetNr;
|
||||
UINT8 status;
|
||||
UINT8 messageId;
|
||||
UINT8 payloadSize;
|
||||
UINT8 *payload;
|
||||
UINT16 crc;
|
||||
} t_bpmsg_message;
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Variable declarations.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Function declarations.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/** \brief Calculates the CRC over payload and sets unique start byte */
|
||||
void bpmsgEncodeMessage( t_bpmsg_message * msg );
|
||||
void bpmsgAdd16bit(UINT8 *payloadlocation, UINT16 data);
|
||||
void bpmsgAdd32bit(UINT8 *payloadlocation, UINT32 data);
|
||||
UINT8 bpmsgGet8bit(UINT8 *payload, UINT8 *payloadIndex);
|
||||
UINT16 bpmsgGet16bit(UINT8 *payload, UINT8 *payloadIndex);
|
||||
UINT32 bpmsgGet32bit(UINT8 *payload, UINT8 *payloadIndex);
|
||||
|
||||
#endif /* __BPMESSAGEFORMAT_H__ */
|
||||
@@ -0,0 +1,685 @@
|
||||
/* ---------------------------------------------------------------------------
|
||||
* BusProtocol.c - v0.1 (c) 2008 Micro-key bv
|
||||
* ---------------------------------------------------------------------------
|
||||
* Micro-key bv
|
||||
* Industrieweg 28, 9804 TG Noordhorn
|
||||
* Postbus 92, 9800 AB Zuidhorn
|
||||
* The Netherlands
|
||||
* Tel: +31 594 503020
|
||||
* Fax: +31 594 505825
|
||||
* Email: support@microkey.nl
|
||||
* Web: www.microkey.nl
|
||||
* ---------------------------------------------------------------------------
|
||||
* Description:
|
||||
* ---------------------------------------------------------------------------
|
||||
* Version(s): 0.1, Jan 28, 2008, FSc
|
||||
* Creation.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* System include files
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Application include files
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#include "types.h"
|
||||
#include "BusProtocol.h"
|
||||
#include "ProtocolThread.h"
|
||||
#include "MessageHandlerQueue.h"
|
||||
#include "RemoteProcedureCalls.h"
|
||||
#include "RpcResults.h"
|
||||
#include "bus.h"
|
||||
#include "serial.h"
|
||||
#include "ElecStatusCache.h"
|
||||
#include "mem_mod.h"
|
||||
|
||||
#include "FreeRTOS.h"
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Local constant and macro definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Global variable definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Local variable definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
typedef struct t_BP_ADMIN {
|
||||
UINT8 deviceId;
|
||||
UINT8 rpcRequestNr;
|
||||
int rpcHandle;
|
||||
int rpcrHandle;
|
||||
int bpthreadHandle;
|
||||
int messageHandlerHandle;
|
||||
} t_bp_admin;
|
||||
|
||||
memman *bpMessagePool;
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Local function definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
static void WriteElectricStatusCallback( int handle, BOOLEAN isDigital, UINT8 device, UINT8 channel, UINT16 value );
|
||||
|
||||
/** \brief Initialises the BusProtocol
|
||||
*
|
||||
* \param bus The bus to communicate on
|
||||
* \param deviceId the bus identity for this device
|
||||
* \retval the handle for the BusProtocol-driver (0 = unsuccesfull)
|
||||
*/
|
||||
int bpInit( t_bus_devices recvBus, t_bus_devices sendBus, UINT8 deviceId, UINT8 highestDeviceId, UINT8 inputQueueSize )
|
||||
{
|
||||
t_bp_admin *newBusProtocol = (t_bp_admin *)pvPortMalloc( sizeof(t_bp_admin));
|
||||
|
||||
if (newBusProtocol != NULL)
|
||||
{
|
||||
// Fill administration
|
||||
newBusProtocol->deviceId = deviceId;
|
||||
newBusProtocol->rpcRequestNr = 0;
|
||||
newBusProtocol->rpcHandle = rpcInit();
|
||||
newBusProtocol->rpcrHandle = rpcrInit();
|
||||
newBusProtocol->messageHandlerHandle = mhqInit();
|
||||
|
||||
// Allocate payload queue
|
||||
bpMessagePool = Memmod_Create( inputQueueSize, 64); // Make sure size is dividable by 4
|
||||
|
||||
// Register RPC Callback
|
||||
mhqAdd( newBusProtocol->messageHandlerHandle, BPMSG_MSGID_CALLRPC, rpcRequestHandler, newBusProtocol->rpcHandle );
|
||||
|
||||
// Register RPC-result Callback
|
||||
mhqAdd( newBusProtocol->messageHandlerHandle, BPMSG_MSGID_GIVERPCRESULTS, rpcrRequestHandler, newBusProtocol->rpcrHandle );
|
||||
|
||||
// Register Write electronic status callbac )
|
||||
bpecAttachWriteCallback(newBusProtocol, WriteElectricStatusCallback);
|
||||
|
||||
// Open bus
|
||||
busInit(recvBus);
|
||||
if (recvBus != sendBus)
|
||||
{
|
||||
busInit(sendBus);
|
||||
}
|
||||
|
||||
// Create & start thread to poll bus
|
||||
newBusProtocol->bpthreadHandle = bpthreadStart( recvBus, sendBus, deviceId, highestDeviceId, (int)newBusProtocol, newBusProtocol->messageHandlerHandle );
|
||||
}
|
||||
|
||||
return (int)newBusProtocol;
|
||||
}
|
||||
|
||||
/** \brief Closes the active BusProtocol
|
||||
*
|
||||
* \post Protocol on this handle cannot be used anymore
|
||||
* \param handle The handle for the BusProtocol (received with bpInit())
|
||||
*/
|
||||
void bpDeinit( int handle )
|
||||
{
|
||||
// Stop & Destroy the bus poll thread
|
||||
rpcDeinit( ((t_bp_admin *)handle)->rpcHandle );
|
||||
rpcrDeinit( ((t_bp_admin *)handle)->rpcrHandle );
|
||||
bpthreadStop( ((t_bp_admin *)handle)->bpthreadHandle );
|
||||
|
||||
// Free BusProtocol-administration
|
||||
vPortFree( (void *)handle );
|
||||
}
|
||||
|
||||
|
||||
/** \brief Indicates whether a message a device is received in the last 10 seconds
|
||||
* Only used by the master
|
||||
*/
|
||||
BOOLEAN bpDeviceIsDetected( int handle, UINT8 deviceId )
|
||||
{
|
||||
return bpthreadDeviceIsDetected(((t_bp_admin *)handle)->bpthreadHandle, deviceId);
|
||||
}
|
||||
|
||||
|
||||
/** \brief Sends message to pass turn (Nothing to send)
|
||||
*
|
||||
* \param handle The handle for the BusProtocol (received with bpInit())
|
||||
*/
|
||||
void bpSendPassTurn( int handle )
|
||||
{
|
||||
t_bpmsg_message sendPassTurnMessage;
|
||||
|
||||
BP_DEBUG_OUT('p');BP_DEBUG_OUT('>');
|
||||
|
||||
// Create new message
|
||||
sendPassTurnMessage.uniqueStartByte = BPMSG_STARTBYTE;
|
||||
sendPassTurnMessage.senderId = ((t_bp_admin *)handle)->deviceId;
|
||||
sendPassTurnMessage.targetId = BPMSG_BROADCAST_ID;
|
||||
sendPassTurnMessage.packetNr = 0; // packetNr filled at transmitting time
|
||||
sendPassTurnMessage.status = 0; // Clear status (filled by ProtocolThread)
|
||||
sendPassTurnMessage.messageId = BPMSG_MSGID_PASSTURN;
|
||||
sendPassTurnMessage.payloadSize = 0;
|
||||
sendPassTurnMessage.payload = NULL;
|
||||
|
||||
// Calculate CRC
|
||||
bpmsgEncodeMessage(&sendPassTurnMessage);
|
||||
|
||||
bpthreadAddMessage(((t_bp_admin *)handle)->bpthreadHandle, &sendPassTurnMessage);
|
||||
}
|
||||
|
||||
/** \brief Sends message to reset another bus device
|
||||
*
|
||||
* \param handle The handle for the BusProtocol (received with bpInit())
|
||||
* \param deviceId Identity of targeted bus device (0xFF = all devices)
|
||||
*/
|
||||
void bpSendResetClient( int handle, UINT8 deviceId )
|
||||
{
|
||||
t_bpmsg_message sendResetClientMessage;
|
||||
|
||||
// Create new message
|
||||
sendResetClientMessage.uniqueStartByte = BPMSG_STARTBYTE;
|
||||
sendResetClientMessage.senderId = ((t_bp_admin *)handle)->deviceId;
|
||||
sendResetClientMessage.targetId = deviceId;
|
||||
sendResetClientMessage.packetNr = 0; // packetNr filled at transmitting time
|
||||
sendResetClientMessage.status = 0; // Clear status (filled by ProtocolThread)
|
||||
sendResetClientMessage.messageId = BPMSG_MSGID_RESETCLIENT;
|
||||
sendResetClientMessage.payloadSize = 0;
|
||||
sendResetClientMessage.payload = NULL;
|
||||
|
||||
// Calculate CRC
|
||||
bpmsgEncodeMessage(&sendResetClientMessage);
|
||||
|
||||
bpthreadAddMessage(((t_bp_admin *)handle)->bpthreadHandle, &sendResetClientMessage);
|
||||
}
|
||||
|
||||
/** \brief Sends message with all electronic information (DAC's, ADC's and digital I/O)
|
||||
*
|
||||
* Broadcasts the electronic status of the device
|
||||
*
|
||||
* \param handle The handle for the BusProtocol (received with bpInit())
|
||||
* \param nrOfAdcValues Number of ADC-values included in the message
|
||||
* \param adcValues Pointer to a UINT16 array
|
||||
* \param nrOfDacValues Number of DAC-values included in the message
|
||||
* \param dacValues Pointer to a UINT16 array
|
||||
* \param nrOfDiValues Number of digital input values included in the message
|
||||
* \param diValues Digital input channel values (8 channels per byte)
|
||||
* \param nrOfDoValues Number of digital output values inculded in the message
|
||||
* \param doValues Digital output channel values (8 channels per byte)
|
||||
*/
|
||||
void bpSendGiveElectronicStatus( int handle,
|
||||
UINT8 nrOfAdcValues,
|
||||
UINT16 *adcValues,
|
||||
UINT8 nrOfDacValues,
|
||||
UINT16 *dacValues,
|
||||
UINT8 nrOfDiValues,
|
||||
UINT8 *diValues,
|
||||
UINT8 nrOfDoValues,
|
||||
UINT8 *doValues
|
||||
)
|
||||
{
|
||||
t_bpmsg_message sendGiveElectronicStatusMessage;
|
||||
UINT8 *payload;
|
||||
UINT16 payloadSize;
|
||||
UINT8 payloadIndex = 0;
|
||||
UINT8 index;
|
||||
|
||||
// Determine payload size
|
||||
payloadSize = BPMSG_UINT8_SIZE;
|
||||
payloadSize += nrOfAdcValues * BPMSG_UINT16_SIZE;
|
||||
payloadSize += BPMSG_UINT8_SIZE;
|
||||
payloadSize += nrOfDacValues * BPMSG_UINT16_SIZE;
|
||||
payloadSize += BPMSG_UINT8_SIZE;
|
||||
payloadSize += nrOfDiValues * BPMSG_UINT8_SIZE;
|
||||
payloadSize += BPMSG_UINT8_SIZE;
|
||||
payloadSize += nrOfDoValues * BPMSG_UINT8_SIZE;
|
||||
|
||||
payload = (UINT8 *)Memmod_Alloc( bpMessagePool );
|
||||
if (payload == 0) return;
|
||||
|
||||
// Create new message
|
||||
sendGiveElectronicStatusMessage.uniqueStartByte = BPMSG_STARTBYTE;
|
||||
sendGiveElectronicStatusMessage.senderId = ((t_bp_admin *)handle)->deviceId;
|
||||
sendGiveElectronicStatusMessage.targetId = BPMSG_BROADCAST_ID;
|
||||
sendGiveElectronicStatusMessage.packetNr = 0; // packetNr filled at transmitting time
|
||||
sendGiveElectronicStatusMessage.status = 0; // Clear status (filled by ProtocolThread)
|
||||
sendGiveElectronicStatusMessage.messageId = BPMSG_MSGID_GIVEELECTRONICSTATUS;
|
||||
sendGiveElectronicStatusMessage.payloadSize = payloadSize;
|
||||
sendGiveElectronicStatusMessage.payload = payload;
|
||||
|
||||
// Fill Payload
|
||||
payload[payloadIndex] = nrOfAdcValues;
|
||||
payloadIndex += BPMSG_UINT8_SIZE;
|
||||
for (index = 0; index < nrOfAdcValues; index++)
|
||||
{
|
||||
bpmsgAdd16bit( &payload[payloadIndex], adcValues[index]);
|
||||
payloadIndex += BPMSG_UINT16_SIZE;
|
||||
}
|
||||
|
||||
payload[payloadIndex] = nrOfDacValues;
|
||||
payloadIndex += BPMSG_UINT8_SIZE;
|
||||
for (index = 0; index < nrOfDacValues; index++)
|
||||
{
|
||||
bpmsgAdd16bit( &payload[payloadIndex], dacValues[index]);
|
||||
payloadIndex += BPMSG_UINT16_SIZE;
|
||||
}
|
||||
|
||||
payload[payloadIndex] = nrOfDiValues;
|
||||
payloadIndex += BPMSG_UINT8_SIZE;
|
||||
for (index = 0; index < nrOfDiValues; index++)
|
||||
{
|
||||
payload[payloadIndex] = diValues[index];
|
||||
payloadIndex += BPMSG_UINT8_SIZE;
|
||||
}
|
||||
|
||||
payload[payloadIndex] = nrOfDoValues;
|
||||
payloadIndex += BPMSG_UINT8_SIZE;
|
||||
for (index = 0; index < nrOfDoValues; index++)
|
||||
{
|
||||
payload[payloadIndex] = doValues[index];
|
||||
payloadIndex += BPMSG_UINT8_SIZE;
|
||||
}
|
||||
|
||||
// Calculate CRC
|
||||
bpmsgEncodeMessage(&sendGiveElectronicStatusMessage);
|
||||
|
||||
bpthreadAddMessage(((t_bp_admin *)handle)->bpthreadHandle, &sendGiveElectronicStatusMessage);
|
||||
}
|
||||
|
||||
/** \brief Sends message to set a DAC on another bus device
|
||||
*
|
||||
* \param handle The handle for the BusProtocol (received with bpInit())
|
||||
* \param deviceId Identity of targeted bus device
|
||||
* \param channelNr Number of the DAC-channel
|
||||
* \param dacMode Voltage (0) / Ampere (<> 0)
|
||||
* \param davValue New DAC value (voltage: 0-10000mV, ampere: 0-20000uA)
|
||||
*/
|
||||
void bpSendSetDacValue( int handle, UINT8 deviceId, UINT8 channelNr, UINT8 dacMode, UINT16 dacValue )
|
||||
{
|
||||
t_bpmsg_message sendSetDacMessage;
|
||||
UINT8 *payload = (UINT8 *) Memmod_Alloc( bpMessagePool );
|
||||
if (payload == 0) return;
|
||||
|
||||
BP_DEBUG_OUT('a'); BP_DEBUG_OUT('>');
|
||||
|
||||
// Create new message
|
||||
sendSetDacMessage.uniqueStartByte = BPMSG_STARTBYTE;
|
||||
sendSetDacMessage.senderId = ((t_bp_admin *)handle)->deviceId;
|
||||
sendSetDacMessage.targetId = deviceId;
|
||||
sendSetDacMessage.packetNr = 0; // packetNr filled at transmitting time
|
||||
sendSetDacMessage.status = 0; // Clear status (filled by ProtocolThread)
|
||||
sendSetDacMessage.messageId = BPMSG_MSGID_SETDACVALUE;
|
||||
sendSetDacMessage.payloadSize = 4;
|
||||
sendSetDacMessage.payload = payload;
|
||||
|
||||
// Fill Payload
|
||||
payload[0] = channelNr;
|
||||
payload[1] = dacMode;
|
||||
bpmsgAdd16bit( &payload[2], dacValue);
|
||||
|
||||
// Calculate CRC
|
||||
bpmsgEncodeMessage(&sendSetDacMessage);
|
||||
|
||||
bpthreadAddMessage(((t_bp_admin *)handle)->bpthreadHandle, &sendSetDacMessage);
|
||||
}
|
||||
|
||||
/** \brief Sends message to set the values of all DAC's on another bus device
|
||||
*
|
||||
* \param handle The handle for the BusProtocol (received with bpInit())
|
||||
* \param deviceId Identity of targeted bus device
|
||||
* \param davValue pointer to array with 4 DAC value, i.e. DAC-value position 0 for Channel 0 etc... (voltage: 0-10000mV, ampere: 0-20000uA)
|
||||
*/
|
||||
void bpSendSetAllDacValues( int handle, UINT8 deviceId, UINT16 *dacValue )
|
||||
{
|
||||
t_bpmsg_message sendSetDacMessage;
|
||||
UINT8 *payload = (UINT8 *) Memmod_Alloc( bpMessagePool );
|
||||
if (payload == 0) return;
|
||||
|
||||
BP_DEBUG_OUT('a'); BP_DEBUG_OUT('>');
|
||||
|
||||
// Create new message
|
||||
sendSetDacMessage.uniqueStartByte = BPMSG_STARTBYTE;
|
||||
sendSetDacMessage.senderId = ((t_bp_admin *)handle)->deviceId;
|
||||
sendSetDacMessage.targetId = deviceId;
|
||||
sendSetDacMessage.packetNr = 0; // packetNr filled at transmitting time
|
||||
sendSetDacMessage.status = 0; // Clear status (filled by ProtocolThread)
|
||||
sendSetDacMessage.messageId = BPMSG_MSGID_SETALLDACVALUES;
|
||||
sendSetDacMessage.payloadSize = 4 * 2;
|
||||
sendSetDacMessage.payload = payload;
|
||||
|
||||
// Fill Payload
|
||||
bpmsgAdd16bit( &payload[0], dacValue[0]);
|
||||
bpmsgAdd16bit( &payload[2], dacValue[1]);
|
||||
bpmsgAdd16bit( &payload[4], dacValue[2]);
|
||||
bpmsgAdd16bit( &payload[6], dacValue[3]);
|
||||
|
||||
// Calculate CRC
|
||||
bpmsgEncodeMessage(&sendSetDacMessage);
|
||||
|
||||
bpthreadAddMessage(((t_bp_admin *)handle)->bpthreadHandle, &sendSetDacMessage);
|
||||
}
|
||||
|
||||
|
||||
/** \brief Sends message to set a digital out on another bus device
|
||||
*
|
||||
* \param handle The handle for the BusProtocol (received with bpInit())
|
||||
* \param bitNr Number of the digital output pin
|
||||
* \param value Low-level (0) or High-level (<> 0)
|
||||
*/
|
||||
void bpSendSetDigitalOutValue( int handle, UINT8 deviceId, UINT8 bitNr, UINT8 value )
|
||||
{
|
||||
t_bpmsg_message sendSetDoMessage;
|
||||
UINT8 *payload = (UINT8 *)Memmod_Alloc( bpMessagePool );
|
||||
if (payload == 0) return;
|
||||
|
||||
BP_DEBUG_OUT('d'); BP_DEBUG_OUT('>');
|
||||
|
||||
// Create new message
|
||||
sendSetDoMessage.uniqueStartByte = BPMSG_STARTBYTE;
|
||||
sendSetDoMessage.senderId = ((t_bp_admin *)handle)->deviceId;
|
||||
sendSetDoMessage.targetId = deviceId;
|
||||
sendSetDoMessage.packetNr = 0; // packetNr filled at transmitting time
|
||||
sendSetDoMessage.status = 0; // Clear status (filled by ProtocolThread)
|
||||
sendSetDoMessage.messageId = BPMSG_MSGID_SETDIGITALOUTVALUE;
|
||||
sendSetDoMessage.payloadSize = 2;
|
||||
sendSetDoMessage.payload = payload;
|
||||
|
||||
// Fill Payload
|
||||
payload[0] = bitNr;
|
||||
payload[1] = value;
|
||||
|
||||
// Calculate CRC
|
||||
bpmsgEncodeMessage(&sendSetDoMessage);
|
||||
|
||||
bpthreadAddMessage(((t_bp_admin *)handle)->bpthreadHandle, &sendSetDoMessage);
|
||||
}
|
||||
|
||||
/** \brief Sends message to set all digital out ports at once on another bus device
|
||||
*
|
||||
* \param handle The handle for the BusProtocol (received with bpInit())
|
||||
* \param deviceId The ID of the other bus device
|
||||
* \param bits All bitsNumber of the digital output pin
|
||||
*/
|
||||
void bpSendSetAllDigitalOut( int handle, UINT8 deviceId, UINT8 bits)
|
||||
{
|
||||
t_bpmsg_message sendSetDoMessage;
|
||||
UINT8 *payload = (UINT8 *)Memmod_Alloc( bpMessagePool );
|
||||
if (payload == 0) return;
|
||||
|
||||
BP_DEBUG_OUT('d'); BP_DEBUG_OUT('>');
|
||||
|
||||
// Create new message
|
||||
sendSetDoMessage.uniqueStartByte = BPMSG_STARTBYTE;
|
||||
sendSetDoMessage.senderId = ((t_bp_admin *)handle)->deviceId;
|
||||
sendSetDoMessage.targetId = deviceId;
|
||||
sendSetDoMessage.packetNr = 0; // packetNr filled at transmitting time
|
||||
sendSetDoMessage.status = 0; // Clear status (filled by ProtocolThread)
|
||||
sendSetDoMessage.messageId = BPMSG_MSGID_SETALLDIGITALOUT;
|
||||
sendSetDoMessage.payloadSize = 1;
|
||||
sendSetDoMessage.payload = payload;
|
||||
|
||||
// Fill Payload
|
||||
payload[0] = bits;
|
||||
|
||||
// Calculate CRC
|
||||
bpmsgEncodeMessage(&sendSetDoMessage);
|
||||
|
||||
bpthreadAddMessage(((t_bp_admin *)handle)->bpthreadHandle, &sendSetDoMessage);
|
||||
}
|
||||
|
||||
/** \brief Sends message to set all outputs (analogue & digital) on another bus device
|
||||
*
|
||||
* \param handle The handle for the BusProtocol (received with bpInit())
|
||||
* \param deviceId Identity of targeted bus device
|
||||
* \param bits All bitsNumber of the digital output pin
|
||||
* \param davValue pointer to array with 4 DAC value, i.e. DAC-value position 0 for Channel 0 etc... (voltage: 0-10000mV, ampere: 0-20000uA)
|
||||
*/
|
||||
void bpSendSetAllOutput( int handle, UINT8 deviceId, UINT8 bits, UINT16 *dacValue )
|
||||
{
|
||||
t_bpmsg_message sendSetAllOutpuntMessage;
|
||||
UINT8 *payload = (UINT8 *) Memmod_Alloc( bpMessagePool );
|
||||
if (payload == 0) return;
|
||||
|
||||
BP_DEBUG_OUT('a'); BP_DEBUG_OUT('o'); BP_DEBUG_OUT('>');
|
||||
|
||||
// Create new message
|
||||
sendSetAllOutpuntMessage.uniqueStartByte = BPMSG_STARTBYTE;
|
||||
sendSetAllOutpuntMessage.senderId = ((t_bp_admin *)handle)->deviceId;
|
||||
sendSetAllOutpuntMessage.targetId = deviceId;
|
||||
sendSetAllOutpuntMessage.packetNr = 0; // packetNr filled at transmitting time
|
||||
sendSetAllOutpuntMessage.status = 0; // Clear status (filled by ProtocolThread)
|
||||
sendSetAllOutpuntMessage.messageId = BPMSG_MSGID_SETALLDOUTPUT;
|
||||
sendSetAllOutpuntMessage.payloadSize = (4 * 2) + 1;
|
||||
sendSetAllOutpuntMessage.payload = payload;
|
||||
|
||||
// Fill Payload
|
||||
payload[0] = bits;
|
||||
bpmsgAdd16bit( &payload[1], dacValue[0]);
|
||||
bpmsgAdd16bit( &payload[3], dacValue[1]);
|
||||
bpmsgAdd16bit( &payload[5], dacValue[2]);
|
||||
bpmsgAdd16bit( &payload[7], dacValue[3]);
|
||||
|
||||
// Calculate CRC
|
||||
bpmsgEncodeMessage(&sendSetAllOutpuntMessage);
|
||||
|
||||
bpthreadAddMessage(((t_bp_admin *)handle)->bpthreadHandle, &sendSetAllOutpuntMessage);
|
||||
}
|
||||
|
||||
|
||||
/** \brief Sends message to call an Remote Procedure Call on an other bus device
|
||||
*
|
||||
* Request to execute a procedure on another device
|
||||
*
|
||||
* \param handle The handle for the BusProtocol (received with bpInit())
|
||||
* \param deviceId Identity of targeted bus device
|
||||
* \param functionId Identity of the RPC-function
|
||||
* \param nrOfParams Number of parameters for the RPC-function
|
||||
* \param params Pointer to an array of 32-bit integers
|
||||
*/
|
||||
void bpSendCallRpc( int handle, UINT8 deviceId, UINT8 functionId, UINT8 nrOfParams, INT32 *params )
|
||||
{
|
||||
t_bpmsg_message sendCallRpcMessage;
|
||||
UINT8 *payload;
|
||||
UINT8 payloadSize;
|
||||
UINT8 payloadIndex = 0;
|
||||
UINT8 index;
|
||||
|
||||
BP_DEBUG_OUT('c'); BP_DEBUG_OUT('>');
|
||||
|
||||
// Determine payload size
|
||||
payloadSize = 3 * BPMSG_UINT8_SIZE;
|
||||
payloadSize += nrOfParams * BPMSG_UINT32_SIZE;
|
||||
|
||||
payload = (UINT8 *)Memmod_Alloc( bpMessagePool );
|
||||
if (payload == 0) return;
|
||||
|
||||
// Create new message
|
||||
sendCallRpcMessage.uniqueStartByte = BPMSG_STARTBYTE;
|
||||
sendCallRpcMessage.senderId = ((t_bp_admin *)handle)->deviceId;
|
||||
sendCallRpcMessage.targetId = deviceId;
|
||||
sendCallRpcMessage.packetNr = 0; // packetNr filled at transmitting time
|
||||
sendCallRpcMessage.status = 0; // Clear status (filled by ProtocolThread)
|
||||
sendCallRpcMessage.messageId = BPMSG_MSGID_CALLRPC;
|
||||
sendCallRpcMessage.payloadSize = payloadSize;
|
||||
sendCallRpcMessage.payload = payload;
|
||||
|
||||
// Fill Payload
|
||||
payload[payloadIndex] = ((t_bp_admin *)handle)->rpcRequestNr;
|
||||
((t_bp_admin *)handle)->rpcRequestNr++;
|
||||
payloadIndex += BPMSG_UINT8_SIZE;
|
||||
|
||||
payload[payloadIndex] = functionId;
|
||||
payloadIndex += BPMSG_UINT8_SIZE;
|
||||
|
||||
payload[payloadIndex] = nrOfParams;
|
||||
payloadIndex += BPMSG_UINT8_SIZE;
|
||||
|
||||
for (index = 0; index < nrOfParams; index++)
|
||||
{
|
||||
bpmsgAdd32bit( payload + payloadIndex, (UINT32)params[index]);
|
||||
payloadIndex += BPMSG_UINT32_SIZE;
|
||||
}
|
||||
|
||||
if (payloadIndex >= 54)
|
||||
{
|
||||
serWrite(1, sizeof("Message too large"), "Message too large");
|
||||
}
|
||||
|
||||
// Calculate CRC
|
||||
bpmsgEncodeMessage(&sendCallRpcMessage);
|
||||
|
||||
bpthreadAddMessage(((t_bp_admin *)handle)->bpthreadHandle, &sendCallRpcMessage);
|
||||
}
|
||||
|
||||
/** \brief Sends message to give result on issued RPC-function
|
||||
*
|
||||
* \param handle The handle for the BusProtocol (received with bpInit())
|
||||
* \param nrOfResults Number of results to be send
|
||||
* \param results Pointer to array with results.
|
||||
*/
|
||||
void bpSendRpcResult( int handle, UINT8 deviceId, UINT8 functionId, UINT8 requestNr, UINT8 nrOfResults, INT32 *results )
|
||||
{
|
||||
t_bpmsg_message sendCallRpcResultMessage;
|
||||
UINT8 *payload;
|
||||
UINT8 payloadSize;
|
||||
UINT8 payloadIndex = 0;
|
||||
UINT8 index;
|
||||
|
||||
BP_DEBUG_OUT('r'); BP_DEBUG_OUT('>');
|
||||
|
||||
// Determine payload size
|
||||
payloadSize = 3 * BPMSG_UINT8_SIZE;
|
||||
payloadSize += nrOfResults * BPMSG_UINT32_SIZE;
|
||||
|
||||
payload = (UINT8 *)Memmod_Alloc( bpMessagePool );
|
||||
if (payload == 0) return;
|
||||
|
||||
// Create new message
|
||||
sendCallRpcResultMessage.uniqueStartByte = BPMSG_STARTBYTE;
|
||||
sendCallRpcResultMessage.senderId = ((t_bp_admin *)handle)->deviceId;
|
||||
sendCallRpcResultMessage.targetId = deviceId;
|
||||
sendCallRpcResultMessage.packetNr = 0; // packetNr filled at transmitting time
|
||||
sendCallRpcResultMessage.status = 0; // Clear status (filled by ProtocolThread)
|
||||
sendCallRpcResultMessage.messageId = BPMSG_MSGID_GIVERPCRESULTS;
|
||||
sendCallRpcResultMessage.payloadSize = payloadSize;
|
||||
sendCallRpcResultMessage.payload = payload;
|
||||
|
||||
// Fill Payload
|
||||
payload[payloadIndex] = requestNr;
|
||||
payloadIndex += BPMSG_UINT8_SIZE;
|
||||
|
||||
payload[payloadIndex] = functionId;
|
||||
payloadIndex += BPMSG_UINT8_SIZE;
|
||||
|
||||
payload[payloadIndex] = nrOfResults;
|
||||
payloadIndex += BPMSG_UINT8_SIZE;
|
||||
|
||||
for (index = 0; index < nrOfResults; index++)
|
||||
{
|
||||
bpmsgAdd32bit( &payload[payloadIndex], (UINT32)results[index]);
|
||||
payloadIndex += BPMSG_UINT32_SIZE;
|
||||
}
|
||||
|
||||
// Calculate CRC
|
||||
bpmsgEncodeMessage(&sendCallRpcResultMessage);
|
||||
|
||||
bpthreadAddMessage(((t_bp_admin *)handle)->bpthreadHandle, &sendCallRpcResultMessage);
|
||||
}
|
||||
|
||||
|
||||
/** \brief Attachs a callback, which is called when it is the device its turn to send data on the bus
|
||||
*
|
||||
* \param handle The handle for the BusProtocol (received with bpInit())
|
||||
* \param onMyTurnCallback pointer to the callback function
|
||||
*/
|
||||
void bpAttachOnMyTurn( int handle, t_bp_myturn_callback onMyTurnCallback )
|
||||
{
|
||||
t_bp_admin *bpAdmin = (t_bp_admin *)handle;
|
||||
|
||||
bpthreadAttachMyTurn( bpAdmin->bpthreadHandle, onMyTurnCallback);
|
||||
}
|
||||
|
||||
/** \brief Detaches the above callback
|
||||
*
|
||||
* \param handle The handle for the BusProtocol (received with bpInit())
|
||||
* \param onMyTurnCallback pointer to the callback function
|
||||
*/
|
||||
void bpDetachOnMyTurn( int handle, t_bp_myturn_callback onMyTurnCallback )
|
||||
{
|
||||
t_bp_admin *bpAdmin = (t_bp_admin *)handle;
|
||||
|
||||
bpthreadDetachMyTurn( bpAdmin->bpthreadHandle, onMyTurnCallback);
|
||||
}
|
||||
|
||||
/** \brief Attachs a RPC-function, which can be called by another bus device
|
||||
*
|
||||
* \param handle The handle for the BusProtocol (received with bpInit())
|
||||
* \param functionId The identity of the RPC-function
|
||||
* \param functionPointer Pointer to actual RPC-function
|
||||
* \param nrOfParams Number of parameters, required by RPC
|
||||
*/
|
||||
void bpAttachRpc( int handle, UINT8 functionId, char * functionName, t_rpc_remote_procedure_call functionPointer, UINT8 nrOfParams )
|
||||
{
|
||||
t_bp_admin *bpAdmin = (t_bp_admin *)handle;
|
||||
|
||||
rpcAdd( bpAdmin->rpcHandle, functionId, functionName, functionPointer, nrOfParams);
|
||||
}
|
||||
|
||||
/** \brief Detaches the above RPC-function
|
||||
*
|
||||
* \post RPC-function is not supported anymore
|
||||
* \param handle The handle for the BusProtocol (received with bpInit())
|
||||
* \param functionId Identity of the detached RPC-function
|
||||
*/
|
||||
void bpDetachRpc( int handle, UINT8 functionId )
|
||||
{
|
||||
t_bp_admin *bpAdmin = (t_bp_admin *)handle;
|
||||
|
||||
rpcRemove( bpAdmin->rpcHandle, functionId );
|
||||
}
|
||||
|
||||
/** \brief Attachs a "RPC result"-function, which is a result of a requeste RPC-call on another bus device
|
||||
*
|
||||
* \param handle The handle for the BusProtocol (returned by bpInit())
|
||||
* \param functionId The functionId on which the result should be catched
|
||||
* \param functionPointer The funtion which must be called when a RPC-result is received.
|
||||
*/
|
||||
void bpAttachRpcResult( int handle, UINT8 functionId, t_bp_rpcresult_callback functionPointer, UINT8 nrOfResults )
|
||||
{
|
||||
t_bp_admin *bpAdmin = (t_bp_admin *)handle;
|
||||
|
||||
rpcrAdd( bpAdmin->rpcrHandle, functionId, functionPointer, nrOfResults);
|
||||
}
|
||||
|
||||
/** \brief Detaches the above "RPC result"-function
|
||||
*
|
||||
* \param handle The handle for the BusProtocol (returned by bpInit())
|
||||
* \param functionId The functionId on which the result should be catched
|
||||
*/
|
||||
void bpDetachRpcResult( int handle, UINT8 functionId )
|
||||
{
|
||||
t_bp_admin *bpAdmin = (t_bp_admin *)handle;
|
||||
|
||||
rpcrRemove( bpAdmin->rpcrHandle, functionId );
|
||||
}
|
||||
|
||||
t_rpc_entity *bpLookupRpcEntry( int handle, UINT8 functionId )
|
||||
{
|
||||
t_bp_admin *bpAdmin = (t_bp_admin *)handle;
|
||||
|
||||
return rpcLookupEntry( bpAdmin->rpcHandle, functionId );
|
||||
}
|
||||
|
||||
|
||||
void WriteElectricStatusCallback( int handle, BOOLEAN isDigital, UINT8 device, UINT8 channel, UINT16 value )
|
||||
{
|
||||
if (isDigital)
|
||||
{
|
||||
bpSendSetDigitalOutValue( handle, device, channel, (BOOLEAN)value ) ;
|
||||
}
|
||||
else
|
||||
{
|
||||
bpSendSetDacValue( handle, device, channel, 0, value );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,141 @@
|
||||
/* ---------------------------------------------------------------------------
|
||||
* BusProtocol.h - v0.1 (c) 2008 Micro-key bv
|
||||
* ---------------------------------------------------------------------------
|
||||
* Micro-key bv
|
||||
* Industrieweg 28, 9804 TG Noordhorn
|
||||
* Postbus 92, 9800 AB Zuidhorn
|
||||
* The Netherlands
|
||||
* Tel: +31 594 503020
|
||||
* Fax: +31 594 505825
|
||||
* Email: support@microkey.nl
|
||||
* Web: www.microkey.nl
|
||||
* ---------------------------------------------------------------------------
|
||||
* Description:
|
||||
* ---------------------------------------------------------------------------
|
||||
* Version(s): 0.1, Jan 28, 2008, FSc
|
||||
* Creation.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef __BUSPROTOCOL_H__
|
||||
#define __BUSPROTOCOL_H__
|
||||
/** \file BusProtocol.h
|
||||
\brief Implementation of BusProtocol
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* System include files.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Application include files.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#include "types.h"
|
||||
#include "bus.h"
|
||||
#include "RemoteProcedureCalls.h"
|
||||
#include "BpMessageFormat.h"
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Constant and macro definitions.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#define MASTER_DEVICE_ID (1)
|
||||
#define MAX_PAYLOAD_SIZE (50)
|
||||
#define BP_DEBUG_OUT(a) /* serPut( COM2, a) */
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Type definitions.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
typedef void (*t_bp_myturn_callback)(void);
|
||||
typedef void (*t_bp_rpcresult_callback)( UINT8 requestNr, UINT8 nrOfResults, UINT32 *results );
|
||||
typedef void (*t_bp_messagehandler)(t_bpmsg_message *receivedMessage, int ownHandler );
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Variable declarations.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Function declarations.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/** \brief Initialises the BusProtocol */
|
||||
int bpInit( t_bus_devices recvBus, t_bus_devices sendBus, UINT8 deviceId, UINT8 highestDeviceId, UINT8 inputQueueSize );
|
||||
|
||||
/** \brief Closes the active BusProtocol */
|
||||
void bpDeinit( int handle );
|
||||
|
||||
/** \brief Indicates whether a message a device is received in the last 10 seconds
|
||||
* Only used by the master
|
||||
*/
|
||||
BOOLEAN bpDeviceIsDetected( int handle, UINT8 deviceId );
|
||||
|
||||
/** \brief Sends message to pass turn (Nothing to send) */
|
||||
void bpSendPassTurn( int handle );
|
||||
|
||||
/** \brief Sends message to reset another bus device */
|
||||
void bpSendResetClient( int handle, UINT8 deviceId );
|
||||
|
||||
/** \brief Sends message with all electronic information (DAC's, ADC's and digital I/O) */
|
||||
void bpSendGiveElectronicStatus( int handle,
|
||||
UINT8 nrOfAdcValues,
|
||||
UINT16 *adcValues,
|
||||
UINT8 nrOfDacValues,
|
||||
UINT16 *dacValues,
|
||||
UINT8 nrOfDiValues,
|
||||
UINT8 *diValues,
|
||||
UINT8 nrOfDoValues,
|
||||
UINT8 *doValues
|
||||
);
|
||||
|
||||
/** \brief Sends message to set a DAC on another bus device */
|
||||
void bpSendSetDacValue( int handle, UINT8 deviceId, UINT8 channelNr, UINT8 dacMode, UINT16 dacValue );
|
||||
|
||||
/** \brief Sends message to set the values of all DAC's on another bus device */
|
||||
void bpSendSetAllDacValues( int handle, UINT8 deviceId, UINT16 *dacValue );
|
||||
|
||||
/** \brief Sends message to set a digital out on another bus device */
|
||||
void bpSendSetDigitalOutValue( int handle, UINT8 deviceId, UINT8 bitNr, UINT8 value );
|
||||
|
||||
/** \brief Sends message to set all digital out ports at once on another bus device */
|
||||
void bpSendSetAllDigitalOut( int handle, UINT8 deviceId, UINT8 bits);
|
||||
|
||||
/** \brief Sends message to set all outputs (analogue & digital) on another bus device */
|
||||
void bpSendSetAllOutput( int handle, UINT8 deviceId, UINT8 bits, UINT16 *dacValue);
|
||||
|
||||
/** \brief Sends message to call an Remote Procedure Call on an other bus device */
|
||||
void bpSendCallRpc( int handle, UINT8 deviceId, UINT8 functionId, UINT8 nrOfParams, INT32 *params );
|
||||
|
||||
/** \brief Attachs a callback, which is called when it is the device its turn to send data on the bus */
|
||||
void bpAttachOnMyTurn( int handle, t_bp_myturn_callback onMyTurnCallback );
|
||||
|
||||
/** \brief Detaches the above callback */
|
||||
void bpDetachOnMyTurn( int handle, t_bp_myturn_callback onMyTurnCallback );
|
||||
|
||||
/** \brief Attach callback on receiving a specific message */
|
||||
void bpAttachMessageHandler( int handle, UINT8 messageId, t_bp_messagehandler messageHandler);
|
||||
|
||||
/** \brief Attach callback on receiving a specific message */
|
||||
void bpDetachMessageHandler( int handle, UINT8 messageId, t_bp_messagehandler messageHandler);
|
||||
|
||||
/** \brief Attachs a RPC-function, which can be called by another bus device */
|
||||
void bpAttachRpc( int handle, UINT8 functionId, char * functionName, t_rpc_remote_procedure_call functionPointer, UINT8 nrOfParams );
|
||||
|
||||
/** \brief Detaches the above RPC-function */
|
||||
void bpDetachRpc( int handle, UINT8 functionId );
|
||||
|
||||
/** \brief Attachs a "RPC result"-function, which is a result of a requeste RPC-call on another bus device */
|
||||
void bpAttachRpcResult( int handle, UINT8 functionId, t_bp_rpcresult_callback functionPointer, UINT8 nrOfResult );
|
||||
|
||||
/** \brief Detaches the above "RPC result"-function */
|
||||
void bpDetachRpcResult( int handle, UINT8 functionId );
|
||||
|
||||
t_rpc_entity *bpLookupRpcEntry( int handle, UINT8 functionId );
|
||||
|
||||
/** \brief Sends message to give result on issued RPC-function */
|
||||
void bpSendRpcResult( int handle, UINT8 deviceId, UINT8 functionId, UINT8 requestNr, UINT8 nrOfResults, INT32 *results );
|
||||
|
||||
#endif /* __BUSPROTOCOL_H__ */
|
||||
@@ -0,0 +1,123 @@
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Crc.c - v0.1 (c) 2008 Micro-key bv
|
||||
* ---------------------------------------------------------------------------
|
||||
* Micro-key bv
|
||||
* Industrieweg 28, 9804 TG Noordhorn
|
||||
* Postbus 92, 9800 AB Zuidhorn
|
||||
* The Netherlands
|
||||
* Tel: +31 594 503020
|
||||
* Fax: +31 594 505825
|
||||
* Email: support@microkey.nl
|
||||
* Web: www.microkey.nl
|
||||
* ---------------------------------------------------------------------------
|
||||
* Description:
|
||||
* ---------------------------------------------------------------------------
|
||||
* Version(s): 0.1, Jan 31, 2008, FSc
|
||||
* Creation.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* System include files
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Application include files
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#include "crc.h"
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Local constant and macro definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
const UINT16 CRC_table[256] =
|
||||
{
|
||||
0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50A5, 0x60C6, 0x70E7,
|
||||
0x8108, 0x9129, 0xA14A, 0xB16B, 0xC18C, 0xD1AD, 0xE1CE, 0xF1EF,
|
||||
0x1231, 0x0210, 0x3273, 0x2252, 0x52B5, 0x4294, 0x72F7, 0x62D6,
|
||||
0x9339, 0x8318, 0xB37B, 0xA35A, 0xD3BD, 0xC39C, 0xF3FF, 0xE3DE,
|
||||
0x2462, 0x3443, 0x0420, 0x1401, 0x64E6, 0x74C7, 0x44A4, 0x5485,
|
||||
0xA56A, 0xB54B, 0x8528, 0x9509, 0xE5EE, 0xF5CF, 0xC5AC, 0xD58D,
|
||||
0x3653, 0x2672, 0x1611, 0x0630, 0x76D7, 0x66F6, 0x5695, 0x46B4,
|
||||
0xB75B, 0xA77A, 0x9719, 0x8738, 0xF7DF, 0xE7FE, 0xD79D, 0xC7BC,
|
||||
0x48C4, 0x58E5, 0x6886, 0x78A7, 0x0840, 0x1861, 0x2802, 0x3823,
|
||||
0xC9CC, 0xD9ED, 0xE98E, 0xF9AF, 0x8948, 0x9969, 0xA90A, 0xB92B,
|
||||
0x5AF5, 0x4AD4, 0x7AB7, 0x6A96, 0x1A71, 0x0A50, 0x3A33, 0x2A12,
|
||||
0xDBFD, 0xCBDC, 0xFBBF, 0xEB9E, 0x9B79, 0x8B58, 0xBB3B, 0xAB1A,
|
||||
0x6CA6, 0x7C87, 0x4CE4, 0x5CC5, 0x2C22, 0x3C03, 0x0C60, 0x1C41,
|
||||
0xEDAE, 0xFD8F, 0xCDEC, 0xDDCD, 0xAD2A, 0xBD0B, 0x8D68, 0x9D49,
|
||||
0x7E97, 0x6EB6, 0x5ED5, 0x4EF4, 0x3E13, 0x2E32, 0x1E51, 0x0E70,
|
||||
0xFF9F, 0xEFBE, 0xDFDD, 0xCFFC, 0xBF1B, 0xAF3A, 0x9F59, 0x8F78,
|
||||
0x9188, 0x81A9, 0xB1CA, 0xA1EB, 0xD10C, 0xC12D, 0xF14E, 0xE16F,
|
||||
0x1080, 0x00A1, 0x30C2, 0x20E3, 0x5004, 0x4025, 0x7046, 0x6067,
|
||||
0x83B9, 0x9398, 0xA3FB, 0xB3DA, 0xC33D, 0xD31C, 0xE37F, 0xF35E,
|
||||
0x02B1, 0x1290, 0x22F3, 0x32D2, 0x4235, 0x5214, 0x6277, 0x7256,
|
||||
0xB5EA, 0xA5CB, 0x95A8, 0x8589, 0xF56E, 0xE54F, 0xD52C, 0xC50D,
|
||||
0x34E2, 0x24C3, 0x14A0, 0x0481, 0x7466, 0x6447, 0x5424, 0x4405,
|
||||
0xA7DB, 0xB7FA, 0x8799, 0x97B8, 0xE75F, 0xF77E, 0xC71D, 0xD73C,
|
||||
0x26D3, 0x36F2, 0x0691, 0x16B0, 0x6657, 0x7676, 0x4615, 0x5634,
|
||||
0xD94C, 0xC96D, 0xF90E, 0xE92F, 0x99C8, 0x89E9, 0xB98A, 0xA9AB,
|
||||
0x5844, 0x4865, 0x7806, 0x6827, 0x18C0, 0x08E1, 0x3882, 0x28A3,
|
||||
0xCB7D, 0xDB5C, 0xEB3F, 0xFB1E, 0x8BF9, 0x9BD8, 0xABBB, 0xBB9A,
|
||||
0x4A75, 0x5A54, 0x6A37, 0x7A16, 0x0AF1, 0x1AD0, 0x2AB3, 0x3A92,
|
||||
0xFD2E, 0xED0F, 0xDD6C, 0xCD4D, 0xBDAA, 0xAD8B, 0x9DE8, 0x8DC9,
|
||||
0x7C26, 0x6C07, 0x5C64, 0x4C45, 0x3CA2, 0x2C83, 0x1CE0, 0x0CC1,
|
||||
0xEF1F, 0xFF3E, 0xCF5D, 0xDF7C, 0xAF9B, 0xBFBA, 0x8FD9, 0x9FF8,
|
||||
0x6E17, 0x7E36, 0x4E55, 0x5E74, 0x2E93, 0x3EB2, 0x0ED1, 0x1EF0
|
||||
};
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Global variable definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Local variable definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Local function definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*!
|
||||
* \brief Calculate 16 bit CRC
|
||||
*
|
||||
* a function to calculate an serial 16 bit CRC
|
||||
* according to the CCITT V.024 standard
|
||||
* To short down the calculation time of the serial CRC
|
||||
* a hash table is used.
|
||||
* This CRC is a fast (with hash table) and good CRC for
|
||||
* data transfer and integrity test of data storage. It can effectively
|
||||
* can detect errors by data transfer. 16 Bit is good for data blocks from
|
||||
* 0 - 4 KByte with a residual risk for non detection of 10E-8 per transfer.
|
||||
* (Multiply this with the error factor of the transmit line)
|
||||
*
|
||||
* The polynoom of CRC-16-CCIT = x^16 + x^12 + x^5 + 1
|
||||
*
|
||||
* \param data Build the crc from this data block
|
||||
* \param length Length of the data block
|
||||
* \param feed Initial CRC value (take 0 by default)
|
||||
*/
|
||||
UINT16 crcCalc(UINT8 * data, UINT32 length, UINT16 feed)
|
||||
{
|
||||
unsigned short crc = feed;
|
||||
unsigned char index;
|
||||
unsigned int count;
|
||||
|
||||
for(count=0; count<length; count++)
|
||||
{
|
||||
index = (unsigned char)(crc >> 8);
|
||||
crc = crc & 0x00FF;
|
||||
crc = (crc << 8);
|
||||
crc &= 0xFF00;
|
||||
crc = crc ^ CRC_table[index] ^ (*data & 0x00FF);
|
||||
data++;
|
||||
}
|
||||
|
||||
return crc;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Crc.h - v0.1 (c) 2008 Micro-key bv
|
||||
* ---------------------------------------------------------------------------
|
||||
* Micro-key bv
|
||||
* Industrieweg 28, 9804 TG Noordhorn
|
||||
* Postbus 92, 9800 AB Zuidhorn
|
||||
* The Netherlands
|
||||
* Tel: +31 594 503020
|
||||
* Fax: +31 594 505825
|
||||
* Email: support@microkey.nl
|
||||
* Web: www.microkey.nl
|
||||
* ---------------------------------------------------------------------------
|
||||
* Description:
|
||||
* ---------------------------------------------------------------------------
|
||||
* Version(s): 0.1, Jan 31, 2008, FSc
|
||||
* Creation.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef __CRC_H__
|
||||
#define __CRC_H__
|
||||
/** \file Crc.h
|
||||
\brief
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* System include files.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Application include files.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#include "types.h"
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Constant and macro definitions.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Type definitions.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Variable declarations.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Function declarations.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
UINT16 crcCalc(UINT8 * pData, UINT32 length, UINT16 feed);
|
||||
|
||||
#endif /* __CRC_H__ */
|
||||
|
||||
@@ -0,0 +1,204 @@
|
||||
/* ---------------------------------------------------------------------------
|
||||
* MessageHandlerQueue.c - v0.1 (c) 2008 Micro-key bv
|
||||
* ---------------------------------------------------------------------------
|
||||
* Micro-key bv
|
||||
* Industrieweg 28, 9804 TG Noordhorn
|
||||
* Postbus 92, 9800 AB Zuidhorn
|
||||
* The Netherlands
|
||||
* Tel: +31 594 503020
|
||||
* Fax: +31 594 505825
|
||||
* Email: support@microkey.nl
|
||||
* Web: www.microkey.nl
|
||||
* ---------------------------------------------------------------------------
|
||||
* Description:
|
||||
* ---------------------------------------------------------------------------
|
||||
* Version(s): 0.1, Jan 30, 2008, FSc
|
||||
* Creation.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* System include files
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Application include files
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#include "MessageHandlerQueue.h"
|
||||
|
||||
#include "FreeRTOS.h"
|
||||
#include "task.h"
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Local constant and macro definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
typedef struct t_mhq_ENTITY
|
||||
{
|
||||
UINT8 messageId;
|
||||
t_bp_messagehandler messageHandler;
|
||||
int ownHandle;
|
||||
struct t_mhq_ENTITY *next;
|
||||
struct t_mhq_ENTITY *previous;
|
||||
} t_mhq_entity;
|
||||
|
||||
typedef struct t_mhq_ADMIN
|
||||
{
|
||||
struct t_mhq_ENTITY *head;
|
||||
struct t_mhq_ENTITY *tail;
|
||||
} t_mhq_admin;
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Global variable definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Local variable definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Local function definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
static t_mhq_entity *lookupMhqEntry(int handle, UINT8 messageId);
|
||||
|
||||
|
||||
int mhqInit()
|
||||
{
|
||||
t_mhq_admin *newAdmin = (t_mhq_admin *)pvPortMalloc( sizeof(t_mhq_admin) );
|
||||
|
||||
newAdmin->head = NULL;
|
||||
|
||||
return (int)newAdmin;
|
||||
}
|
||||
|
||||
void mhqDeinit(int handle)
|
||||
{
|
||||
t_mhq_entity *iterator = ((t_mhq_admin *)handle)->head;
|
||||
|
||||
while (iterator != NULL)
|
||||
{
|
||||
t_mhq_entity *nextItem = iterator->next;
|
||||
vPortFree( iterator );
|
||||
iterator = nextItem;
|
||||
}
|
||||
|
||||
vPortFree( (t_mhq_admin *)handle );
|
||||
}
|
||||
|
||||
void mhqAdd(int handle, UINT8 messageId, t_bp_messagehandler messageHandler, int ownHandle)
|
||||
{
|
||||
t_mhq_admin *theAdmin = (t_mhq_admin *)handle;
|
||||
t_mhq_entity *newEntry = (t_mhq_entity *)pvPortMalloc( sizeof(t_mhq_entity) );
|
||||
|
||||
// fill entry
|
||||
newEntry->messageId = messageId;
|
||||
newEntry->messageHandler = messageHandler;
|
||||
newEntry->ownHandle = ownHandle;
|
||||
newEntry->next = NULL;
|
||||
newEntry->previous = NULL;
|
||||
|
||||
taskENTER_CRITICAL();
|
||||
{
|
||||
// Add to linked list
|
||||
if (theAdmin->head != NULL)
|
||||
{
|
||||
theAdmin->tail->next = newEntry;
|
||||
newEntry->previous = theAdmin->tail;
|
||||
theAdmin->tail = newEntry;
|
||||
}
|
||||
else
|
||||
{
|
||||
theAdmin->head = newEntry;
|
||||
theAdmin->tail = newEntry;
|
||||
}
|
||||
}
|
||||
taskEXIT_CRITICAL();
|
||||
}
|
||||
|
||||
void mhqRemove(int handle, UINT8 messageId, t_bp_messagehandler messageHandler)
|
||||
{
|
||||
t_mhq_entity *entry = lookupMhqEntry(handle, messageId);
|
||||
t_mhq_admin *theAdmin = (t_mhq_admin *)handle;
|
||||
|
||||
taskENTER_CRITICAL();
|
||||
{
|
||||
if (entry != NULL)
|
||||
{
|
||||
// rebuild linked list
|
||||
if (entry->next != NULL)
|
||||
{
|
||||
entry->next->previous = entry->previous;
|
||||
}
|
||||
else
|
||||
{
|
||||
theAdmin->tail = entry->previous;
|
||||
}
|
||||
|
||||
if (entry->previous != NULL)
|
||||
{
|
||||
entry->previous->next = entry->next;
|
||||
}
|
||||
else
|
||||
{
|
||||
theAdmin->head = entry->next;
|
||||
}
|
||||
|
||||
// remove entry
|
||||
vPortFree( entry );
|
||||
}
|
||||
}
|
||||
taskEXIT_CRITICAL();
|
||||
}
|
||||
|
||||
RESULT mhqExecute(int handle, UINT8 messageId, t_bpmsg_message *message)
|
||||
{
|
||||
t_mhq_entity *item = lookupMhqEntry(handle, messageId);
|
||||
|
||||
if (item != NULL)
|
||||
{
|
||||
item->messageHandler( message, item->ownHandle );
|
||||
|
||||
return OK;
|
||||
}
|
||||
else
|
||||
{
|
||||
return ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
t_mhq_entity *lookupMhqEntry(int handle, UINT8 messageId)
|
||||
{
|
||||
t_mhq_admin *theAdmin = (t_mhq_admin *)handle;
|
||||
t_mhq_entity *result = NULL;
|
||||
t_mhq_entity *iterator;
|
||||
|
||||
taskENTER_CRITICAL();
|
||||
{
|
||||
iterator = theAdmin->head;
|
||||
while ((result == NULL) && (iterator != NULL))
|
||||
{
|
||||
if (iterator->messageId == messageId)
|
||||
{
|
||||
result = iterator;
|
||||
}
|
||||
else
|
||||
{
|
||||
iterator = iterator->next;
|
||||
}
|
||||
}
|
||||
}
|
||||
taskEXIT_CRITICAL();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
/* ---------------------------------------------------------------------------
|
||||
* MessageHandlerQueue.h - v0.1 (c) 2008 Micro-key bv
|
||||
* ---------------------------------------------------------------------------
|
||||
* Micro-key bv
|
||||
* Industrieweg 28, 9804 TG Noordhorn
|
||||
* Postbus 92, 9800 AB Zuidhorn
|
||||
* The Netherlands
|
||||
* Tel: +31 594 503020
|
||||
* Fax: +31 594 505825
|
||||
* Email: support@microkey.nl
|
||||
* Web: www.microkey.nl
|
||||
* ---------------------------------------------------------------------------
|
||||
* Description:
|
||||
* ---------------------------------------------------------------------------
|
||||
* Version(s): 0.1, Jan 30, 2008, FSc
|
||||
* Creation.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef __MESSAGEHANDLERQUEUE_H__
|
||||
#define __MESSAGEHANDLERQUEUE_H__
|
||||
/** \file MessageHandlerQueue.h
|
||||
\brief Contains a list of message handlers
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* System include files.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Application include files.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#include "BusProtocol.h"
|
||||
#include "BpMessageFormat.h"
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Constant and macro definitions.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Type definitions.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Variable declarations.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Function declarations.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
int mhqInit();
|
||||
void mhqAdd(int handle, UINT8 messageId, t_bp_messagehandler messageHandler, int ownHandle);
|
||||
void mhqRemove(int handle, UINT8 messageId, t_bp_messagehandler messageHandler);
|
||||
RESULT mhqExecute(int handle, UINT8 messageId, t_bpmsg_message *message);
|
||||
|
||||
|
||||
#endif /* __MESSAGEHANDLERQUEUE_H__ */
|
||||
|
||||
@@ -0,0 +1,124 @@
|
||||
/* ---------------------------------------------------------------------------
|
||||
* MessageQueue.c - v0.1 (c) 2008 Micro-key bv
|
||||
* ---------------------------------------------------------------------------
|
||||
* Micro-key bv
|
||||
* Industrieweg 28, 9804 TG Noordhorn
|
||||
* Postbus 92, 9800 AB Zuidhorn
|
||||
* The Netherlands
|
||||
* Tel: +31 594 503020
|
||||
* Fax: +31 594 505825
|
||||
* Email: support@microkey.nl
|
||||
* Web: www.microkey.nl
|
||||
* ---------------------------------------------------------------------------
|
||||
* Description:
|
||||
* ---------------------------------------------------------------------------
|
||||
* Version(s): 0.1, Jan 29, 2008, FSc
|
||||
* Creation.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* System include files
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Application include files
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#include "MessageQueue.h"
|
||||
|
||||
#include "FreeRTOS.h"
|
||||
#include "task.h"
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Local constant and macro definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Global variable definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Local variable definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Local function definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
t_mq_messagequeue *mqInit()
|
||||
{
|
||||
t_mq_messagequeue *newMessageQueue = (t_mq_messagequeue *)pvPortMalloc( sizeof(t_mq_messagequeue) );
|
||||
|
||||
newMessageQueue->count = 0;
|
||||
newMessageQueue->head = 0;
|
||||
newMessageQueue->tail = 0;
|
||||
|
||||
return newMessageQueue;
|
||||
}
|
||||
|
||||
RESULT mqAdd( t_mq_messagequeue *queue, t_bpmsg_message *message)
|
||||
{
|
||||
RESULT result = OK;
|
||||
|
||||
taskENTER_CRITICAL();
|
||||
{
|
||||
if(queue->count >= TX_QUEUE_SIZE)
|
||||
{
|
||||
result = ERROR;
|
||||
}
|
||||
else
|
||||
{
|
||||
memcpy( &(queue->messages[queue->tail]), message, sizeof(t_bpmsg_message) );
|
||||
queue->count++;
|
||||
queue->tail = (queue->tail + 1) % TX_QUEUE_SIZE;
|
||||
}
|
||||
}
|
||||
taskEXIT_CRITICAL();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
RESULT mqGet( t_mq_messagequeue *queue, t_bpmsg_message *message)
|
||||
{
|
||||
RESULT result = OK;
|
||||
|
||||
taskENTER_CRITICAL();
|
||||
{
|
||||
if(queue->count > 0)
|
||||
{
|
||||
memcpy( message, &(queue->messages[queue->head]), sizeof(t_bpmsg_message) );
|
||||
queue->head = (queue->head + 1) % TX_QUEUE_SIZE;
|
||||
queue->count--;
|
||||
}
|
||||
else
|
||||
{
|
||||
result = ERROR;
|
||||
}
|
||||
}
|
||||
taskEXIT_CRITICAL();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
BOOLEAN mqEmpty( t_mq_messagequeue *queue )
|
||||
{
|
||||
UINT8 count;
|
||||
|
||||
taskENTER_CRITICAL();
|
||||
{
|
||||
count = queue->count;
|
||||
}
|
||||
taskEXIT_CRITICAL();
|
||||
|
||||
return ( count == 0 ? TRUE : FALSE);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
/* ---------------------------------------------------------------------------
|
||||
* MessageQueue.h - v0.1 (c) 2008 Micro-key bv
|
||||
* ---------------------------------------------------------------------------
|
||||
* Micro-key bv
|
||||
* Industrieweg 28, 9804 TG Noordhorn
|
||||
* Postbus 92, 9800 AB Zuidhorn
|
||||
* The Netherlands
|
||||
* Tel: +31 594 503020
|
||||
* Fax: +31 594 505825
|
||||
* Email: support@microkey.nl
|
||||
* Web: www.microkey.nl
|
||||
* ---------------------------------------------------------------------------
|
||||
* Description:
|
||||
* ---------------------------------------------------------------------------
|
||||
* Version(s): 0.1, Jan 29, 2008, FSc
|
||||
* Creation.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef __MESSAGEQUEUE_H__
|
||||
#define __MESSAGEQUEUE_H__
|
||||
/** \file MessageQueue.h
|
||||
\brief
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* System include files.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Application include files.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#include "types.h"
|
||||
#include "BpMessageFormat.h"
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Constant and macro definitions.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#define TX_QUEUE_SIZE (20)
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Type definitions.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
typedef struct t_mq_MESSAGEQUEUE
|
||||
{
|
||||
t_bpmsg_message messages[TX_QUEUE_SIZE];
|
||||
UINT8 head;
|
||||
UINT8 tail;
|
||||
UINT8 count;
|
||||
} t_mq_messagequeue;
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Variable declarations.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Function declarations.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
t_mq_messagequeue *mqInit();
|
||||
RESULT mqAdd( t_mq_messagequeue *queue, t_bpmsg_message *message);
|
||||
RESULT mqGet( t_mq_messagequeue *queue, t_bpmsg_message *message);
|
||||
BOOLEAN mqEmpty( t_mq_messagequeue *queue );
|
||||
|
||||
|
||||
#endif /* __MESSAGEQUEUE_H__ */
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,80 @@
|
||||
/* ---------------------------------------------------------------------------
|
||||
* ProtocolThread.h - v0.1 (c) 2008 Micro-key bv
|
||||
* ---------------------------------------------------------------------------
|
||||
* Micro-key bv
|
||||
* Industrieweg 28, 9804 TG Noordhorn
|
||||
* Postbus 92, 9800 AB Zuidhorn
|
||||
* The Netherlands
|
||||
* Tel: +31 594 503020
|
||||
* Fax: +31 594 505825
|
||||
* Email: support@microkey.nl
|
||||
* Web: www.microkey.nl
|
||||
* ---------------------------------------------------------------------------
|
||||
* Description:
|
||||
* ---------------------------------------------------------------------------
|
||||
* Version(s): 0.1, Jan 29, 2008, FSc
|
||||
* Creation.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef __PROTOCOLTHREAD_H__
|
||||
#define __PROTOCOLTHREAD_H__
|
||||
/** \file ProtocolThread.h
|
||||
\brief Thread which handles the messaging of the protocol.
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* System include files.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Application include files.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#include "bus.h"
|
||||
#include "BpMessageFormat.h"
|
||||
#include "BusProtocol.h"
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Constant and macro definitions.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Type definitions.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Variable declarations.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Function declarations.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
/** \brief Starts the protocol handling thread */
|
||||
int bpthreadStart( t_bus_devices recvBus, t_bus_devices sendBus, UINT8 deviceId, UINT8 highestDeviceId, int bpHandle, int mhqHandle );
|
||||
|
||||
/** \brief Stops the protocol handling thread */
|
||||
void bpthreadStop( int handle );
|
||||
|
||||
/** \brief Indicates whether a message a device is received in the last 10 seconds
|
||||
* Only used by the master
|
||||
*/
|
||||
BOOLEAN bpthreadDeviceIsDetected( int handle, UINT8 deviceId );
|
||||
|
||||
/** \brief Add a message to the tx-queue. Message will be send when its this device its turn */
|
||||
void bpthreadAddMessage( int handle, t_bpmsg_message *message );
|
||||
|
||||
/** \brief Attaches a callback function to MyTurn-event, which notifies when it is this device its turn */
|
||||
void bpthreadAttachMyTurn( int handle, t_bp_myturn_callback callback);
|
||||
|
||||
/** \brief Detaches the callback function to MyTurn-event */
|
||||
void bpthreadDetachMyTurn( int handle, t_bp_myturn_callback callback);
|
||||
|
||||
|
||||
#endif /* __PROTOCOLTHREAD_H__ */
|
||||
|
||||
@@ -0,0 +1,301 @@
|
||||
/* ---------------------------------------------------------------------------
|
||||
* RemoteProcedureCalls.c - v0.1 (c) 2008 Micro-key bv
|
||||
* ---------------------------------------------------------------------------
|
||||
* Micro-key bv
|
||||
* Industrieweg 28, 9804 TG Noordhorn
|
||||
* Postbus 92, 9800 AB Zuidhorn
|
||||
* The Netherlands
|
||||
* Tel: +31 594 503020
|
||||
* Fax: +31 594 505825
|
||||
* Email: support@microkey.nl
|
||||
* Web: www.microkey.nl
|
||||
* ---------------------------------------------------------------------------
|
||||
* Description:
|
||||
* ---------------------------------------------------------------------------
|
||||
* Version(s): 0.1, Jan 29, 2008, FSc
|
||||
* Creation.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* System include files
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Application include files
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#include "types.h"
|
||||
#include "RemoteProcedureCalls.h"
|
||||
#include "serial.h"
|
||||
#include "BusProtocol.h"
|
||||
|
||||
#include "FreeRTOS.h"
|
||||
#include "queue.h"
|
||||
#include "mem_mod.h"
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Local constant and macro definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#define RPC_DISPATCH_QUEUE_SIZE (10)
|
||||
|
||||
|
||||
extern memman *bpMessagePool;
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Global variable definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Local variable definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Local function definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
//static t_rpc_entity *lookupRpcEntry( int handle, UINT8 functionId );
|
||||
|
||||
|
||||
/** \brief Initialises a Remote Procedure Call administration
|
||||
*
|
||||
* \returns Handle to Remote Procedure Call administration (0 = failure)
|
||||
*/
|
||||
int rpcInit()
|
||||
{
|
||||
t_rpc_admin *newAdmin = (t_rpc_admin *)pvPortMalloc( sizeof(t_rpc_admin) );
|
||||
if (newAdmin != NULL)
|
||||
{
|
||||
newAdmin->firstEntry = NULL;
|
||||
newAdmin->lastEntry = NULL;
|
||||
}
|
||||
|
||||
return (int)newAdmin;
|
||||
}
|
||||
|
||||
/** \brief Deinitialises the Remote Procedure Call administration
|
||||
*
|
||||
* \param handle Handle to RPC-adminstration
|
||||
*/
|
||||
void rpcDeinit( int handle )
|
||||
{
|
||||
t_rpc_admin *theAdmin = (t_rpc_admin *)handle;
|
||||
|
||||
// Remove whole list
|
||||
if (theAdmin->firstEntry != NULL)
|
||||
{
|
||||
t_rpc_entity *entry = theAdmin->firstEntry;
|
||||
|
||||
while (entry != NULL)
|
||||
{
|
||||
t_rpc_entity *nextEntry = entry->next;
|
||||
|
||||
vPortFree( entry );
|
||||
|
||||
entry = nextEntry;
|
||||
}
|
||||
}
|
||||
|
||||
// Remove admin
|
||||
vPortFree( (void *)handle );
|
||||
}
|
||||
|
||||
/** \brief Adds a Remote Procedure Call to the administration
|
||||
*
|
||||
* \param handle Handle to RPC-administration
|
||||
* \param functionId Identifier for RPC
|
||||
* \param nrOfParams Nr of parameters required by RPC-function
|
||||
*/
|
||||
void rpcAdd( int handle, UINT8 functionId, char * functionName, t_rpc_remote_procedure_call funcptr, UINT8 nrOfParams )
|
||||
{
|
||||
t_rpc_entity *newEntry = (t_rpc_entity *)pvPortMalloc( sizeof(t_rpc_entity) );
|
||||
t_rpc_admin *theAdmin = (t_rpc_admin *)handle;
|
||||
|
||||
// fill entry
|
||||
newEntry->functionId = functionId;
|
||||
newEntry->functionName = functionName;
|
||||
newEntry->rpcFunction = funcptr;
|
||||
newEntry->nrOfParams = nrOfParams;
|
||||
newEntry->next = NULL;
|
||||
newEntry->previous = NULL;
|
||||
|
||||
// Add to linked list
|
||||
if (theAdmin->firstEntry != NULL)
|
||||
{
|
||||
theAdmin->lastEntry->next = newEntry;
|
||||
newEntry->previous = theAdmin->lastEntry;
|
||||
theAdmin->lastEntry = newEntry;
|
||||
}
|
||||
else
|
||||
{
|
||||
theAdmin->firstEntry = newEntry;
|
||||
theAdmin->lastEntry = newEntry;
|
||||
}
|
||||
}
|
||||
|
||||
/** \brief Removes a Remote Procedure Call to the administration
|
||||
*
|
||||
* \param handle Handle to RPC-administration
|
||||
* \param functionId Identifier for RPC-function
|
||||
*/
|
||||
void rpcRemove( int handle, UINT8 functionId )
|
||||
{
|
||||
t_rpc_entity *entry = rpcLookupEntry(handle, functionId);
|
||||
t_rpc_admin *theAdmin = (t_rpc_admin *)handle;
|
||||
|
||||
if (entry != NULL)
|
||||
{
|
||||
// rebuild linked list
|
||||
if (entry->next != NULL)
|
||||
{
|
||||
entry->next->previous = entry->previous;
|
||||
}
|
||||
else
|
||||
{
|
||||
theAdmin->lastEntry = entry->previous;
|
||||
}
|
||||
|
||||
if (entry->previous != NULL)
|
||||
{
|
||||
entry->previous->next = entry->next;
|
||||
}
|
||||
else
|
||||
{
|
||||
theAdmin->firstEntry = entry->next;
|
||||
}
|
||||
|
||||
// remove entry
|
||||
vPortFree( entry );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/** \brief Looks up a Remote Procedure Call to the administration
|
||||
*
|
||||
* \param handle Handle to RPC-administration
|
||||
* \param functionId Identifier for RPC-function
|
||||
* \retval Pointer to RPC-function (NULL when not found)
|
||||
*/
|
||||
t_rpc_remote_procedure_call rpcLookup( int handle, UINT8 functionId )
|
||||
{
|
||||
t_rpc_remote_procedure_call result = NULL;
|
||||
t_rpc_entity *entry = rpcLookupEntry(handle, functionId);
|
||||
|
||||
if (entry != NULL)
|
||||
{
|
||||
result = entry->rpcFunction;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/** \brief Executes a Remote Procedure Call
|
||||
*
|
||||
* \param handle Handle to RPC-administration
|
||||
* \param nrOfParams Nr of parameters in params-array
|
||||
* \param params Pointer to array with all parameters
|
||||
* \retval OK RPC request is send
|
||||
* \retval ERROR Unable to send RPC request
|
||||
*/
|
||||
RESULT rpcExecute( int handle, UINT8 functionId, UINT8 nrOfParams, const UINT32 *params )
|
||||
{
|
||||
t_rpc_entity *entry = rpcLookupEntry(handle, functionId);
|
||||
if (entry != NULL)
|
||||
{
|
||||
// Dispatch function to rpcThread
|
||||
// execute function
|
||||
//result = entry->rpcFunction;
|
||||
return OK;
|
||||
}
|
||||
else
|
||||
{
|
||||
return ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
t_rpc_entity *rpcLookupEntry( int handle, UINT8 functionId )
|
||||
{
|
||||
t_rpc_admin *theAdmin = (t_rpc_admin *)handle;
|
||||
t_rpc_entity *result = NULL;
|
||||
t_rpc_entity *iterator;
|
||||
|
||||
iterator = theAdmin->firstEntry;
|
||||
while ((result == NULL) && (iterator != NULL))
|
||||
{
|
||||
if (iterator->functionId == functionId)
|
||||
{
|
||||
result = iterator;
|
||||
}
|
||||
else
|
||||
{
|
||||
iterator = iterator->next;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
void rpcRequestHandler(t_bpmsg_message *msg, int ownHandler)
|
||||
{
|
||||
UINT8 index = 0;
|
||||
UINT8 count;
|
||||
UINT8 targetId, senderId, requestNr, functionId, nrOfParams;
|
||||
UINT32 *params;
|
||||
t_rpc_entity *rpcEntry;
|
||||
|
||||
// Decode message
|
||||
targetId = msg->targetId;
|
||||
senderId = msg->senderId;
|
||||
requestNr = bpmsgGet8bit( msg->payload, &index);
|
||||
functionId = bpmsgGet8bit( msg->payload, &index);
|
||||
nrOfParams = bpmsgGet8bit( msg->payload, &index);
|
||||
|
||||
BP_DEBUG_OUT('{');
|
||||
BP_DEBUG_OUT('a' + functionId);
|
||||
|
||||
// Allocate an array for the params
|
||||
if (nrOfParams > 0)
|
||||
{
|
||||
params = (UINT32 *)Memmod_Alloc( bpMessagePool );
|
||||
if (params != NULL)
|
||||
{
|
||||
for (count = 0; count < nrOfParams; count++)
|
||||
{
|
||||
params[count] = bpmsgGet32bit(msg->payload, &index);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Error already indicated by heap_2.c
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
params = NULL;
|
||||
}
|
||||
|
||||
// Call RPC-function
|
||||
rpcEntry = rpcLookupEntry(ownHandler, functionId);
|
||||
if (rpcEntry != NULL)
|
||||
{
|
||||
BP_DEBUG_OUT('a' + functionId);
|
||||
// execute function
|
||||
rpcEntry->rpcFunction( senderId, targetId, requestNr, functionId, nrOfParams, params );
|
||||
}
|
||||
|
||||
if (params != NULL)
|
||||
{
|
||||
Memmod_Free( bpMessagePool, params );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,96 @@
|
||||
/* ---------------------------------------------------------------------------
|
||||
* RemoteProcedureCalls.h - v0.1 (c) 2008 Micro-key bv
|
||||
* ---------------------------------------------------------------------------
|
||||
* Micro-key bv
|
||||
* Industrieweg 28, 9804 TG Noordhorn
|
||||
* Postbus 92, 9800 AB Zuidhorn
|
||||
* The Netherlands
|
||||
* Tel: +31 594 503020
|
||||
* Fax: +31 594 505825
|
||||
* Email: support@microkey.nl
|
||||
* Web: www.microkey.nl
|
||||
* ---------------------------------------------------------------------------
|
||||
* Description: Holds supported Remote Procedure Calls
|
||||
* ---------------------------------------------------------------------------
|
||||
* Version(s): 0.1, Jan 29, 2008, FSc
|
||||
* Creation.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef __REMOTEPROCEDURECALLS_H__
|
||||
#define __REMOTEPROCEDURECALLS_H__
|
||||
/** \file RemoteProcedureCalls.h
|
||||
\brief
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* System include files.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Application include files.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#include "BpMessageFormat.h"
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Constant and macro definitions.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Type definitions.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
typedef void (*t_rpc_remote_procedure_call)( UINT8 senderId, UINT8 targetId, UINT8 requestNr, UINT8 functionId, UINT8 nrOfParams, UINT32 *params );
|
||||
|
||||
typedef struct t_RPC_ENTITY {
|
||||
UINT8 functionId;
|
||||
char * functionName;
|
||||
UINT8 nrOfParams;
|
||||
t_rpc_remote_procedure_call rpcFunction;
|
||||
struct t_RPC_ENTITY *next;
|
||||
struct t_RPC_ENTITY *previous;
|
||||
} t_rpc_entity;
|
||||
|
||||
typedef struct t_RPC_ADMIN {
|
||||
t_rpc_entity *firstEntry;
|
||||
t_rpc_entity *lastEntry;
|
||||
} t_rpc_admin;
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Variable declarations.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Function declarations.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
/** \brief Initialises a Remote Procedure Call administration */
|
||||
int rpcInit();
|
||||
|
||||
/** \brief Deinitialises the Remote Procedure Call administration */
|
||||
void rpcDeinit( int handle );
|
||||
|
||||
/** \brief Adds a Remote Procedure Call to the administration */
|
||||
void rpcAdd( int handle, UINT8 functionId, char * functionName, t_rpc_remote_procedure_call funcptr, UINT8 nrOfParams );
|
||||
|
||||
/** \brief Removes a Remote Procedure Call to the administration */
|
||||
void rpcRemove( int handle, UINT8 functionId );
|
||||
|
||||
/** \brief Looks up a Remote Procedure Call to the administration */
|
||||
t_rpc_remote_procedure_call rpcLookup( int handle, UINT8 functionId );
|
||||
|
||||
/** \brief Executes a Remote Procedure Call */
|
||||
RESULT rpcExecute( int handle, UINT8 functionId, UINT8 nrOfParams, const UINT32 *params );
|
||||
|
||||
t_rpc_entity *rpcLookupEntry( int handle, UINT8 functionId );
|
||||
|
||||
/** \brief Message handler for RPC-requests */
|
||||
void rpcRequestHandler(t_bpmsg_message *msg, int ownHandler);
|
||||
|
||||
#endif /* __REMOTEPROCEDURECALLS_H__ */
|
||||
@@ -0,0 +1,288 @@
|
||||
/* ---------------------------------------------------------------------------
|
||||
* RemoteProcedureCalls.c - v0.1 (c) 2008 Micro-key bv
|
||||
* ---------------------------------------------------------------------------
|
||||
* Micro-key bv
|
||||
* Industrieweg 28, 9804 TG Noordhorn
|
||||
* Postbus 92, 9800 AB Zuidhorn
|
||||
* The Netherlands
|
||||
* Tel: +31 594 503020
|
||||
* Fax: +31 594 505825
|
||||
* Email: support@microkey.nl
|
||||
* Web: www.microkey.nl
|
||||
* ---------------------------------------------------------------------------
|
||||
* Description:
|
||||
* ---------------------------------------------------------------------------
|
||||
* Version(s): 0.1, Jan 29, 2008, FSc
|
||||
* Creation.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* System include files
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Application include files
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#include "types.h"
|
||||
#include "RpcResults.h"
|
||||
#include "serial.h"
|
||||
#include "BusProtocol.h"
|
||||
#include "mem_mod.h"
|
||||
|
||||
#include "FreeRTOS.h"
|
||||
#include "queue.h"
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Local constant and macro definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#define RPCR_DISPATCH_QUEUE_SIZE (10)
|
||||
|
||||
typedef struct t_RPCR_ENTITY {
|
||||
UINT8 functionId;
|
||||
UINT8 nrOfParams;
|
||||
t_bp_rpcresult_callback rpcrFunction;
|
||||
struct t_RPCR_ENTITY *next;
|
||||
struct t_RPCR_ENTITY *previous;
|
||||
} t_rpcr_entity;
|
||||
|
||||
typedef struct t_RPCR_ADMIN {
|
||||
t_rpcr_entity *firstEntry;
|
||||
t_rpcr_entity *lastEntry;
|
||||
} t_rpcr_admin;
|
||||
|
||||
extern memman *bpMessagePool;
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Global variable definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Local variable definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Local function definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
static t_rpcr_entity *lookupRpcrEntry( int handle, UINT8 functionId );
|
||||
|
||||
|
||||
/** \brief Initialises a Remote Procedure Call administration
|
||||
*
|
||||
* \returns Handle to Remote Procedure Call administration (0 = failure)
|
||||
*/
|
||||
int rpcrInit()
|
||||
{
|
||||
t_rpcr_admin *newAdmin = (t_rpcr_admin *)pvPortMalloc( sizeof(t_rpcr_admin) );
|
||||
if (newAdmin != NULL)
|
||||
{
|
||||
newAdmin->firstEntry = NULL;
|
||||
newAdmin->lastEntry = NULL;
|
||||
}
|
||||
|
||||
return (int)newAdmin;
|
||||
}
|
||||
|
||||
/** \brief Deinitialises the Remote Procedure Call administration
|
||||
*
|
||||
* \param handle Handle to RPC-adminstration
|
||||
*/
|
||||
void rpcrDeinit( int handle )
|
||||
{
|
||||
t_rpcr_admin *theAdmin = (t_rpcr_admin *)handle;
|
||||
|
||||
// Remove whole list
|
||||
if (theAdmin->firstEntry != NULL)
|
||||
{
|
||||
t_rpcr_entity *entry = theAdmin->firstEntry;
|
||||
|
||||
while (entry != NULL)
|
||||
{
|
||||
t_rpcr_entity *nextEntry = entry->next;
|
||||
|
||||
vPortFree( entry );
|
||||
|
||||
entry = nextEntry;
|
||||
}
|
||||
}
|
||||
|
||||
// Remove admin
|
||||
vPortFree( (void *)handle );
|
||||
}
|
||||
|
||||
/** \brief Adds a Remote Procedure Call to the administration
|
||||
*
|
||||
* \param handle Handle to RPC-administration
|
||||
* \param functionId Identifier for RPC
|
||||
* \param nrOfParams Nr of parameters required by RPC-function
|
||||
*/
|
||||
void rpcrAdd( int handle, UINT8 functionId, t_bp_rpcresult_callback funcptr, UINT8 nrOfParams )
|
||||
{
|
||||
t_rpcr_entity *newEntry = (t_rpcr_entity *)pvPortMalloc( sizeof(t_rpcr_entity) );
|
||||
t_rpcr_admin *theAdmin = (t_rpcr_admin *)handle;
|
||||
|
||||
// fill entry
|
||||
newEntry->functionId = functionId;
|
||||
newEntry->rpcrFunction = funcptr;
|
||||
newEntry->nrOfParams = nrOfParams;
|
||||
newEntry->next = NULL;
|
||||
newEntry->previous = NULL;
|
||||
|
||||
// Add to linked list
|
||||
if (theAdmin->firstEntry != NULL)
|
||||
{
|
||||
theAdmin->lastEntry->next = newEntry;
|
||||
newEntry->previous = theAdmin->lastEntry;
|
||||
theAdmin->lastEntry = newEntry;
|
||||
}
|
||||
else
|
||||
{
|
||||
theAdmin->firstEntry = newEntry;
|
||||
theAdmin->lastEntry = newEntry;
|
||||
}
|
||||
}
|
||||
|
||||
/** \brief Removes a Remote Procedure Call to the administration
|
||||
*
|
||||
* \param handle Handle to RPC-administration
|
||||
* \param functionId Identifier for RPC-function
|
||||
*/
|
||||
void rpcrRemove( int handle, UINT8 functionId )
|
||||
{
|
||||
t_rpcr_entity *entry = lookupRpcrEntry(handle, functionId);
|
||||
t_rpcr_admin *theAdmin = (t_rpcr_admin *)handle;
|
||||
|
||||
if (entry != NULL)
|
||||
{
|
||||
// rebuild linked list
|
||||
if (entry->next != NULL)
|
||||
{
|
||||
entry->next->previous = entry->previous;
|
||||
}
|
||||
else
|
||||
{
|
||||
theAdmin->lastEntry = entry->previous;
|
||||
}
|
||||
|
||||
if (entry->previous != NULL)
|
||||
{
|
||||
entry->previous->next = entry->next;
|
||||
}
|
||||
else
|
||||
{
|
||||
theAdmin->firstEntry = entry->next;
|
||||
}
|
||||
|
||||
// remove entry
|
||||
vPortFree( entry );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/** \brief Looks up a Remote Procedure Call to the administration
|
||||
*
|
||||
* \param handle Handle to RPC-administration
|
||||
* \param functionId Identifier for RPC-function
|
||||
* \retval Pointer to RPC-function (NULL when not found)
|
||||
*/
|
||||
t_bp_rpcresult_callback rpcrLookup( int handle, UINT8 functionId )
|
||||
{
|
||||
t_bp_rpcresult_callback result = NULL;
|
||||
t_rpcr_entity *entry = lookupRpcrEntry(handle, functionId);
|
||||
|
||||
if (entry != NULL)
|
||||
{
|
||||
result = entry->rpcrFunction;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
t_rpcr_entity *lookupRpcrEntry( int handle, UINT8 functionId )
|
||||
{
|
||||
t_rpcr_admin *theAdmin = (t_rpcr_admin *)handle;
|
||||
t_rpcr_entity *result = NULL;
|
||||
t_rpcr_entity *iterator;
|
||||
|
||||
iterator = theAdmin->firstEntry;
|
||||
while ((result == NULL) && (iterator != NULL))
|
||||
{
|
||||
if (iterator->functionId == functionId)
|
||||
{
|
||||
result = iterator;
|
||||
}
|
||||
else
|
||||
{
|
||||
iterator = iterator->next;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
void rpcrRequestHandler(t_bpmsg_message *msg, int ownHandler)
|
||||
{
|
||||
UINT8 index = 0;
|
||||
UINT8 count;
|
||||
UINT8 targetId, senderId, requestNr, functionId, nrOfResults;
|
||||
UINT32 *results;
|
||||
t_rpcr_entity *rpcrEntry;
|
||||
|
||||
BP_DEBUG_OUT( '!');
|
||||
|
||||
// Decode message
|
||||
targetId = msg->targetId;
|
||||
senderId = msg->senderId;
|
||||
requestNr = bpmsgGet8bit( msg->payload, &index);
|
||||
functionId = bpmsgGet8bit( msg->payload, &index);
|
||||
nrOfResults = bpmsgGet8bit( msg->payload, &index);
|
||||
|
||||
// Allocate an array for the params
|
||||
if (nrOfResults > 0)
|
||||
{
|
||||
results = (UINT32 *)Memmod_Alloc( bpMessagePool );
|
||||
if (results != NULL)
|
||||
{
|
||||
for (count = 0; count < nrOfResults; count++)
|
||||
{
|
||||
results[count] = bpmsgGet32bit(msg->payload, &index);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Error already indicated by heap_2.c
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
results = NULL;
|
||||
}
|
||||
|
||||
// Call RPC-function
|
||||
rpcrEntry = lookupRpcrEntry(ownHandler, functionId);
|
||||
if (rpcrEntry != NULL)
|
||||
{
|
||||
// execute function
|
||||
BP_DEBUG_OUT('#');
|
||||
rpcrEntry->rpcrFunction( requestNr, nrOfResults, results );
|
||||
}
|
||||
|
||||
if (results != NULL)
|
||||
{
|
||||
Memmod_Free( bpMessagePool, results );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
/* ---------------------------------------------------------------------------
|
||||
* RpcResults.h - v0.1 (c) 2008 Micro-key bv
|
||||
* ---------------------------------------------------------------------------
|
||||
* Micro-key bv
|
||||
* Industrieweg 28, 9804 TG Noordhorn
|
||||
* Postbus 92, 9800 AB Zuidhorn
|
||||
* The Netherlands
|
||||
* Tel: +31 594 503020
|
||||
* Fax: +31 594 505825
|
||||
* Email: support@microkey.nl
|
||||
* Web: www.microkey.nl
|
||||
* ---------------------------------------------------------------------------
|
||||
* Description: Holds supported Remote Procedure Calls
|
||||
* ---------------------------------------------------------------------------
|
||||
* Version(s): 0.1, Jan 29, 2008, FSc
|
||||
* Creation.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef __RPCRESULTS_H__
|
||||
#define __RPCRESULTS_H__
|
||||
/** \file RpcResults.h
|
||||
\brief
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* System include files.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Application include files.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#include "BusProtocol.h"
|
||||
#include "BpMessageFormat.h"
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Constant and macro definitions.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Type definitions.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Variable declarations.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Function declarations.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
/** \brief Initialises a Remote Procedure Call-Result administration */
|
||||
int rpcrInit();
|
||||
|
||||
/** \brief Deinitialises the Remote Procedure Call-Result administration */
|
||||
void rpcrDeinit( int handle );
|
||||
|
||||
/** \brief Adds a RPC-result handler to the administration */
|
||||
void rpcrAdd( int handle, UINT8 functionId, t_bp_rpcresult_callback funcptr, UINT8 nrOfParams);
|
||||
|
||||
/** \brief Removes a RPC-result handler to the administration */
|
||||
void rpcrRemove( int handle, UINT8 functionId );
|
||||
|
||||
/** \brief Looks up a RPC-result handler to the administration */
|
||||
t_bp_rpcresult_callback rpcrLookup( int handle, UINT8 functionId );
|
||||
|
||||
/** \brief Message handler for RPC-requests */
|
||||
void rpcrRequestHandler(t_bpmsg_message *msg, int ownHandler);
|
||||
|
||||
#endif /* __RPCRESULTS_H__ */
|
||||
@@ -0,0 +1,90 @@
|
||||
|
||||
#include "mem_mod.h"
|
||||
|
||||
/* FreeRTOS includes */
|
||||
#include "FreeRTOS.h"
|
||||
#include "Task.h"
|
||||
#include "Queue.h"
|
||||
|
||||
extern void serWrite (
|
||||
int device,
|
||||
short length, /**< Lengh of data in bytes */
|
||||
char * data /**< Pointer to data */
|
||||
);
|
||||
|
||||
void Memmod_Init(memman *me,unsigned char buf_count,unsigned short buf_size)
|
||||
{
|
||||
unsigned char *buffer;
|
||||
unsigned short i;
|
||||
me->count = buf_count;
|
||||
me->size = buf_size;
|
||||
buffer = pvPortMalloc(buf_count*buf_size);
|
||||
me->buffer = buffer;
|
||||
me->free_index = buf_count;
|
||||
me->freelist = pvPortMalloc(buf_count*sizeof(link_item));
|
||||
for(i=0;i<buf_count;i++)
|
||||
{
|
||||
me->freelist[i].data = buffer;
|
||||
buffer = buffer+buf_size;
|
||||
}
|
||||
}
|
||||
|
||||
unsigned char* Memmod_GetBuffer(memman *me)
|
||||
{
|
||||
return me->buffer;
|
||||
}
|
||||
|
||||
memman *Memmod_Create(unsigned char buf_count,unsigned short buf_size)
|
||||
{
|
||||
memman *new_item;
|
||||
new_item = (memman *)pvPortMalloc(sizeof(memman));
|
||||
Memmod_Init(new_item,buf_count,buf_size);
|
||||
return new_item;
|
||||
}
|
||||
|
||||
void *Memmod_Alloc(memman *me)
|
||||
{
|
||||
unsigned char index;
|
||||
void *retval;
|
||||
|
||||
taskENTER_CRITICAL();
|
||||
{
|
||||
index = me->free_index;
|
||||
if(index > 0)
|
||||
{
|
||||
index--;
|
||||
me->free_index=index;
|
||||
retval = me->freelist[index].data;
|
||||
}
|
||||
else
|
||||
{
|
||||
retval = 0;
|
||||
}
|
||||
}
|
||||
taskEXIT_CRITICAL();
|
||||
|
||||
if (retval == 0)
|
||||
{
|
||||
serWrite(1, sizeof("buffer error"), "buffer error");
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
void Memmod_Free(memman *me,void *buffer)
|
||||
{
|
||||
unsigned char index;
|
||||
|
||||
taskENTER_CRITICAL();
|
||||
{
|
||||
index = me->free_index;
|
||||
if(index < me->count)
|
||||
{
|
||||
me->freelist[index].data = buffer;
|
||||
index++;
|
||||
me->free_index=index;
|
||||
}
|
||||
}
|
||||
taskEXIT_CRITICAL();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
#ifndef _MEM_MODH
|
||||
#define _MEM_MODH
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct link_item
|
||||
{
|
||||
void *data;
|
||||
} link_item;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned char count;
|
||||
unsigned char size;
|
||||
unsigned char free_index;
|
||||
void *buffer;
|
||||
link_item *freelist;
|
||||
} memman;
|
||||
|
||||
void Memmod_Init(memman *me,unsigned char buf_count,unsigned short buf_size);
|
||||
memman *Memmod_Create(unsigned char buf_count,unsigned short buf_size);
|
||||
unsigned char* Memmod_GetBuffer(memman *me);
|
||||
void *Memmod_Alloc(memman *me);
|
||||
void Memmod_Free(memman *me,void *buffer);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,554 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<?fileVersion 4.0.0?>
|
||||
|
||||
<cproject>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.settings">
|
||||
<cconfiguration id="preference.org.eclipse.cdt.managedbuilder.core.configurationDataProvider.1098510086.1154456939">
|
||||
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||
<configuration artifactExtension="a" artifactName="Drivers" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.staticLib" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.staticLib" description="" id="preference.org.eclipse.cdt.managedbuilder.core.configurationDataProvider.1098510086.1154456939" name="Debug" parent="org.eclipse.cdt.build.core.prefbase.cfg" postannouncebuildStep="" postbuildStep="" preannouncebuildStep="" prebuildStep="">
|
||||
<folderInfo id="preference.org.eclipse.cdt.managedbuilder.core.configurationDataProvider.1098510086.1154456939." name="/" resourcePath="">
|
||||
<toolChain id="cdt.managedbuild.toolchain.gnu.cygwin.base.633642026" name="Cygwin GCC" superClass="cdt.managedbuild.toolchain.gnu.cygwin.base" unusedChildren="cdt.managedbuild.tool.gnu.cpp.compiler.cygwin.base;cdt.managedbuild.tool.gnu.cpp.linker.cygwin.base">
|
||||
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.Cygwin_PE" id="cdt.managedbuild.target.gnu.platform.cygwin.base.2110914823" name="Debug Platform" osList="win32" superClass="cdt.managedbuild.target.gnu.platform.cygwin.base"/>
|
||||
<builder buildPath="${workspace_loc:/Drivers/Debug}" id="cdt.managedbuild.target.gnu.builder.cygwin.base.607554776" keepEnvironmentInBuildfile="false" name="Gnu Make Builder" superClass="cdt.managedbuild.target.gnu.builder.cygwin.base"/>
|
||||
<tool command="arm-elf-ar" id="cdt.managedbuild.tool.gnu.archiver.cygwin.base.357143976" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.cygwin.base">
|
||||
<option id="gnu.both.lib.option.flags.1185130714" name="Archiver flags" superClass="gnu.both.lib.option.flags" value="-r" valueType="string"/>
|
||||
</tool>
|
||||
<tool command="arm-elf-gcc" id="cdt.managedbuild.tool.gnu.c.compiler.cygwin.base.835204668" name="Cygwin C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.cygwin.base">
|
||||
<option id="gnu.c.compiler.option.include.paths.1137340833" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/inc}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/MmcFilesystem}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/Drivers/webserver}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/Drivers/webserver/httpd-fs}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/Drivers/ethernet/httpd}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/Drivers/ethernet/httpd/httpd-fs}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/Drivers/ethernet}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/FreeRTOS/include}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/BusProtocol}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/Drivers}""/>
|
||||
</option>
|
||||
<option id="gnu.c.compiler.option.misc.other.1949135949" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fomit-frame-pointer -mcpu=arm7tdmi -fshort-enums -mthumb-interwork" valueType="string"/>
|
||||
<option id="gnu.c.compiler.option.preprocessor.def.symbols.1085516223" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" valueType="definedSymbols">
|
||||
<listOptionValue builtIn="false" value="ROWLEY_LPC23xx"/>
|
||||
<listOptionValue builtIn="false" value="LPC23xx"/>
|
||||
<listOptionValue builtIn="false" value="LPC2378_PORTB"/>
|
||||
<listOptionValue builtIn="false" value="PACK_STRUCT_END=__attribute\(\(packed\)\)"/>
|
||||
<listOptionValue builtIn="false" value="ALIGN_STRUCT_END=__attribute\(\(aligned\(4\)\)\)"/>
|
||||
</option>
|
||||
<option id="gnu.c.compiler.option.optimization.level.1752774671" name="Optimization Level" superClass="gnu.c.compiler.option.optimization.level" value="gnu.c.optimization.level.more" valueType="enumerated"/>
|
||||
<option id="gnu.c.compiler.option.misc.verbose.462009253" name="Verbose (-v)" superClass="gnu.c.compiler.option.misc.verbose" value="false" valueType="boolean"/>
|
||||
<option id="gnu.c.compiler.option.misc.ansi.2137510527" name="Support ANSI programs (-ansi)" superClass="gnu.c.compiler.option.misc.ansi" value="false" valueType="boolean"/>
|
||||
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.cygwin.604520423" superClass="cdt.managedbuild.tool.gnu.c.compiler.input.cygwin"/>
|
||||
</tool>
|
||||
<tool command="arm-elf-as" commandLinePattern="${COMMAND} ${FLAGS} ${OUTPUT_FLAG}${OUTPUT_PREFIX}${OUTPUT} ${INPUTS}" id="cdt.managedbuild.tool.gnu.assembler.cygwin.base.406320894" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.cygwin.base">
|
||||
<option id="gnu.both.asm.option.flags.1225377542" name="Assembler flags" superClass="gnu.both.asm.option.flags" value="-mcpu=arm7tdmi " valueType="string"/>
|
||||
<inputType id="cdt.managedbuild.tool.gnu.assembler.input.1377488642" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
|
||||
</tool>
|
||||
<tool id="cdt.managedbuild.tool.gnu.c.linker.cygwin.base.1772915699" name="Cygwin C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.cygwin.base"/>
|
||||
</toolChain>
|
||||
</folderInfo>
|
||||
<fileInfo id="preference.org.eclipse.cdt.managedbuilder.core.configurationDataProvider.1098510086.1154456939.1726487795" name="uart2ISR.c" rcbsApplicability="disable" resourcePath="uart2ISR.c" toolsToInvoke="cdt.managedbuild.tool.gnu.c.compiler.cygwin.base.835204668.807212826">
|
||||
<tool id="cdt.managedbuild.tool.gnu.c.compiler.cygwin.base.835204668.807212826" name="Cygwin C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.cygwin.base.835204668">
|
||||
<option id="gnu.c.compiler.option.misc.other.1483219050" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fomit-frame-pointer -mcpu=arm7tdmi -mthumb-interwork" valueType="string"/>
|
||||
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.cygwin.538962034" superClass="cdt.managedbuild.tool.gnu.c.compiler.input.cygwin"/>
|
||||
</tool>
|
||||
<tool customBuildStep="true" id="org.eclipse.cdt.managedbuilder.ui.rcbs.1247135253" name="Resource Custom Build Step">
|
||||
<inputType id="org.eclipse.cdt.managedbuilder.ui.rcbs.inputtype.1636187940" name="Resource Custom Build Step Input Type">
|
||||
<additionalInput kind="additionalinputdependency" paths=""/>
|
||||
</inputType>
|
||||
<outputType id="org.eclipse.cdt.managedbuilder.ui.rcbs.outputtype.2037878102" name="Resource Custom Build Step Output Type"/>
|
||||
</tool>
|
||||
</fileInfo>
|
||||
<fileInfo id="preference.org.eclipse.cdt.managedbuilder.core.configurationDataProvider.1098510086.1154456939.542584516" name="ssp0ISR.h" rcbsApplicability="disable" resourcePath="ssp0ISR.h" toolsToInvoke="">
|
||||
<tool announcement="Invoking: Resource Custom Build Step" command="" customBuildStep="true" id="org.eclipse.cdt.managedbuilder.ui.rcbs.1012553571" name="Resource Custom Build Step">
|
||||
<inputType id="org.eclipse.cdt.managedbuilder.ui.rcbs.inputtype.220483950" name="Resource Custom Build Step Input Type">
|
||||
<additionalInput kind="additionalinputdependency" paths=""/>
|
||||
</inputType>
|
||||
<outputType id="org.eclipse.cdt.managedbuilder.ui.rcbs.outputtype.1469071974" name="Resource Custom Build Step Output Type" outputNames=""/>
|
||||
</tool>
|
||||
</fileInfo>
|
||||
<fileInfo id="preference.org.eclipse.cdt.managedbuilder.core.configurationDataProvider.1098510086.1154456939.1910095641" name="uartISR.c" rcbsApplicability="disable" resourcePath="uartISR.c" toolsToInvoke="cdt.managedbuild.tool.gnu.c.compiler.cygwin.base.835204668.1416994682">
|
||||
<tool id="cdt.managedbuild.tool.gnu.c.compiler.cygwin.base.835204668.1416994682" name="Cygwin C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.cygwin.base.835204668">
|
||||
<option id="gnu.c.compiler.option.misc.other.1446657461" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fomit-frame-pointer -mcpu=arm7tdmi -mthumb-interwork" valueType="string"/>
|
||||
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.cygwin.140142352" superClass="cdt.managedbuild.tool.gnu.c.compiler.input.cygwin"/>
|
||||
</tool>
|
||||
<tool customBuildStep="true" id="org.eclipse.cdt.managedbuilder.ui.rcbs.1456382687" name="Resource Custom Build Step">
|
||||
<inputType id="org.eclipse.cdt.managedbuilder.ui.rcbs.inputtype.477895768" name="Resource Custom Build Step Input Type">
|
||||
<additionalInput kind="additionalinputdependency" paths=""/>
|
||||
</inputType>
|
||||
<outputType id="org.eclipse.cdt.managedbuilder.ui.rcbs.outputtype.1335295582" name="Resource Custom Build Step Output Type"/>
|
||||
</tool>
|
||||
</fileInfo>
|
||||
<fileInfo id="preference.org.eclipse.cdt.managedbuilder.core.configurationDataProvider.1098510086.1154456939.71673656" name="uart3ISR.c" rcbsApplicability="disable" resourcePath="uart3ISR.c" toolsToInvoke="cdt.managedbuild.tool.gnu.c.compiler.cygwin.base.835204668.362131041">
|
||||
<tool id="cdt.managedbuild.tool.gnu.c.compiler.cygwin.base.835204668.362131041" name="Cygwin C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.cygwin.base.835204668">
|
||||
<option id="gnu.c.compiler.option.misc.other.225622065" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fomit-frame-pointer -mcpu=arm7tdmi -mthumb-interwork" valueType="string"/>
|
||||
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.cygwin.401063069" superClass="cdt.managedbuild.tool.gnu.c.compiler.input.cygwin"/>
|
||||
</tool>
|
||||
<tool customBuildStep="true" id="org.eclipse.cdt.managedbuilder.ui.rcbs.413027139" name="Resource Custom Build Step">
|
||||
<inputType id="org.eclipse.cdt.managedbuilder.ui.rcbs.inputtype.1803766596" name="Resource Custom Build Step Input Type">
|
||||
<additionalInput kind="additionalinputdependency" paths=""/>
|
||||
</inputType>
|
||||
<outputType id="org.eclipse.cdt.managedbuilder.ui.rcbs.outputtype.1065873980" name="Resource Custom Build Step Output Type"/>
|
||||
</tool>
|
||||
</fileInfo>
|
||||
<fileInfo id="preference.org.eclipse.cdt.managedbuilder.core.configurationDataProvider.1098510086.1154456939.291818688" name="armVIC.h" rcbsApplicability="disable" resourcePath="armVIC.h" toolsToInvoke=""/>
|
||||
<fileInfo id="preference.org.eclipse.cdt.managedbuilder.core.configurationDataProvider.1098510086.1154456939.1708887602" name="InternalFlash.c" rcbsApplicability="disable" resourcePath="InternalFlash.c" toolsToInvoke="cdt.managedbuild.tool.gnu.c.compiler.cygwin.base.835204668.932504930">
|
||||
<tool id="cdt.managedbuild.tool.gnu.c.compiler.cygwin.base.835204668.932504930" name="Cygwin C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.cygwin.base.835204668">
|
||||
<option id="gnu.c.compiler.option.misc.other.558003532" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fomit-frame-pointer -mcpu=arm7tdmi -mthumb-interwork -Wa,-adhlns=InternalFlash.lst" valueType="string"/>
|
||||
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.cygwin.1690946070" superClass="cdt.managedbuild.tool.gnu.c.compiler.input.cygwin"/>
|
||||
</tool>
|
||||
<tool announcement="Invoking: Resource Custom Build Step" command="" customBuildStep="true" id="org.eclipse.cdt.managedbuilder.ui.rcbs.961589329" name="Resource Custom Build Step">
|
||||
<inputType id="org.eclipse.cdt.managedbuilder.ui.rcbs.inputtype.1906296082" name="Resource Custom Build Step Input Type">
|
||||
<additionalInput kind="additionalinputdependency" paths=""/>
|
||||
</inputType>
|
||||
<outputType id="org.eclipse.cdt.managedbuilder.ui.rcbs.outputtype.1575197997" name="Resource Custom Build Step Output Type" outputNames=""/>
|
||||
</tool>
|
||||
</fileInfo>
|
||||
<fileInfo id="preference.org.eclipse.cdt.managedbuilder.core.configurationDataProvider.1098510086.1154456939.1994651202" name="ssp0ISR.c" rcbsApplicability="disable" resourcePath="ssp0ISR.c" toolsToInvoke="cdt.managedbuild.tool.gnu.c.compiler.cygwin.base.835204668.913112132">
|
||||
<tool id="cdt.managedbuild.tool.gnu.c.compiler.cygwin.base.835204668.913112132" name="Cygwin C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.cygwin.base.835204668">
|
||||
<option id="gnu.c.compiler.option.misc.other.494774626" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fomit-frame-pointer -mcpu=arm7tdmi -mthumb-interwork" valueType="string"/>
|
||||
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.cygwin.1950626595" superClass="cdt.managedbuild.tool.gnu.c.compiler.input.cygwin"/>
|
||||
</tool>
|
||||
<tool customBuildStep="true" id="org.eclipse.cdt.managedbuilder.ui.rcbs.1012067148" name="Resource Custom Build Step">
|
||||
<inputType id="org.eclipse.cdt.managedbuilder.ui.rcbs.inputtype.1191788519" name="Resource Custom Build Step Input Type">
|
||||
<additionalInput kind="additionalinputdependency" paths=""/>
|
||||
</inputType>
|
||||
<outputType id="org.eclipse.cdt.managedbuilder.ui.rcbs.outputtype.904965216" name="Resource Custom Build Step Output Type"/>
|
||||
</tool>
|
||||
</fileInfo>
|
||||
<fileInfo id="preference.org.eclipse.cdt.managedbuilder.core.configurationDataProvider.1098510086.1154456939.498448602" name="ssp1ISR.c" rcbsApplicability="disable" resourcePath="ssp1ISR.c" toolsToInvoke="cdt.managedbuild.tool.gnu.c.compiler.cygwin.base.835204668.2078712431">
|
||||
<tool id="cdt.managedbuild.tool.gnu.c.compiler.cygwin.base.835204668.2078712431" name="Cygwin C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.cygwin.base.835204668">
|
||||
<option id="gnu.c.compiler.option.misc.other.1436529494" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fomit-frame-pointer -mcpu=arm7tdmi -mthumb-interwork" valueType="string"/>
|
||||
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.cygwin.2052416051" superClass="cdt.managedbuild.tool.gnu.c.compiler.input.cygwin"/>
|
||||
</tool>
|
||||
<tool customBuildStep="true" id="org.eclipse.cdt.managedbuilder.ui.rcbs.1278877933" name="Resource Custom Build Step">
|
||||
<inputType id="org.eclipse.cdt.managedbuilder.ui.rcbs.inputtype.2116630855" name="Resource Custom Build Step Input Type">
|
||||
<additionalInput kind="additionalinputdependency" paths=""/>
|
||||
</inputType>
|
||||
<outputType id="org.eclipse.cdt.managedbuilder.ui.rcbs.outputtype.1780833023" name="Resource Custom Build Step Output Type"/>
|
||||
</tool>
|
||||
</fileInfo>
|
||||
<fileInfo id="preference.org.eclipse.cdt.managedbuilder.core.configurationDataProvider.1098510086.1154456939.295586484" name="dioISR.c" rcbsApplicability="disable" resourcePath="dioISR.c" toolsToInvoke="cdt.managedbuild.tool.gnu.c.compiler.cygwin.base.835204668.1556128745">
|
||||
<tool id="cdt.managedbuild.tool.gnu.c.compiler.cygwin.base.835204668.1556128745" name="Cygwin C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.cygwin.base.835204668">
|
||||
<option id="gnu.c.compiler.option.misc.other.525661100" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fomit-frame-pointer -mcpu=arm7tdmi -mthumb-interwork" valueType="string"/>
|
||||
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.cygwin.1249324241" superClass="cdt.managedbuild.tool.gnu.c.compiler.input.cygwin"/>
|
||||
</tool>
|
||||
<tool customBuildStep="true" id="org.eclipse.cdt.managedbuilder.ui.rcbs.1640417589" name="Resource Custom Build Step">
|
||||
<inputType id="org.eclipse.cdt.managedbuilder.ui.rcbs.inputtype.1006727924" name="Resource Custom Build Step Input Type">
|
||||
<additionalInput kind="additionalinputdependency" paths=""/>
|
||||
</inputType>
|
||||
<outputType id="org.eclipse.cdt.managedbuilder.ui.rcbs.outputtype.1533768805" name="Resource Custom Build Step Output Type"/>
|
||||
</tool>
|
||||
</fileInfo>
|
||||
<fileInfo id="preference.org.eclipse.cdt.managedbuilder.core.configurationDataProvider.1098510086.1154456939.22360852" name="armVIC.c" rcbsApplicability="disable" resourcePath="armVIC.c" toolsToInvoke="cdt.managedbuild.tool.gnu.c.compiler.cygwin.base.835204668.591611026">
|
||||
<tool id="cdt.managedbuild.tool.gnu.c.compiler.cygwin.base.835204668.591611026" name="Cygwin C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.cygwin.base.835204668">
|
||||
<option id="gnu.c.compiler.option.misc.other.828490660" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fomit-frame-pointer -mcpu=arm7tdmi -mthumb-interwork" valueType="string"/>
|
||||
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.cygwin.823549379" superClass="cdt.managedbuild.tool.gnu.c.compiler.input.cygwin"/>
|
||||
</tool>
|
||||
<tool customBuildStep="true" id="org.eclipse.cdt.managedbuilder.ui.rcbs.1351627299" name="Resource Custom Build Step">
|
||||
<inputType id="org.eclipse.cdt.managedbuilder.ui.rcbs.inputtype.1687122584" name="Resource Custom Build Step Input Type">
|
||||
<additionalInput kind="additionalinputdependency" paths=""/>
|
||||
</inputType>
|
||||
<outputType id="org.eclipse.cdt.managedbuilder.ui.rcbs.outputtype.113518925" name="Resource Custom Build Step Output Type"/>
|
||||
</tool>
|
||||
</fileInfo>
|
||||
<sourceEntries>
|
||||
<entry excluding="webserver|ethernet|spi0.c" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
|
||||
</sourceEntries>
|
||||
</configuration>
|
||||
</storageModule>
|
||||
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="preference.org.eclipse.cdt.managedbuilder.core.configurationDataProvider.1098510086.1154456939" moduleId="org.eclipse.cdt.core.settings" name="Debug">
|
||||
<externalSettings>
|
||||
<externalSetting>
|
||||
<entry flags="VALUE_WORKSPACE_PATH" kind="includePath" name="/Drivers"/>
|
||||
<entry flags="VALUE_WORKSPACE_PATH" kind="libraryPath" name="/Drivers/Debug"/>
|
||||
</externalSetting>
|
||||
</externalSettings>
|
||||
<extensions>
|
||||
<extension id="org.eclipse.cdt.core.Cygwin_PE" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
<extension id="org.eclipse.cdt.core.MakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
</extensions>
|
||||
</storageModule>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
|
||||
|
||||
<storageModule moduleId="org.eclipse.cdt.core.language.mapping"/>
|
||||
<storageModule moduleId="scannerConfiguration">
|
||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"/>
|
||||
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="makefileGenerator">
|
||||
<runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<scannerConfigBuildInfo instanceId="preference.org.eclipse.cdt.managedbuilder.core.configurationDataProvider.1098510086.1154456939;preference.org.eclipse.cdt.managedbuilder.core.configurationDataProvider.1098510086.1154456939.;cdt.managedbuild.tool.gnu.c.compiler.cygwin.base.835204668;cdt.managedbuild.tool.gnu.c.compiler.input.cygwin.604520423">
|
||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC"/>
|
||||
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="makefileGenerator">
|
||||
<runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="arm-elf-gcc" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
</scannerConfigBuildInfo>
|
||||
</storageModule>
|
||||
<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets"/>
|
||||
</cconfiguration>
|
||||
<cconfiguration id="preference.org.eclipse.cdt.managedbuilder.core.configurationDataProvider.1098510086.1129081297">
|
||||
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||
<configuration artifactExtension="" artifactName="Drivers" buildProperties="" description="" id="preference.org.eclipse.cdt.managedbuilder.core.configurationDataProvider.1098510086.1129081297" name="Release" parent="org.eclipse.cdt.build.core.prefbase.cfg">
|
||||
<folderInfo id="preference.org.eclipse.cdt.managedbuilder.core.configurationDataProvider.1098510086.1129081297." name="/" resourcePath="">
|
||||
<toolChain id="org.eclipse.cdt.build.core.prefbase.toolchain.1880939016" name="No ToolChain" resourceTypeBasedDiscovery="false" superClass="org.eclipse.cdt.build.core.prefbase.toolchain">
|
||||
<targetPlatform binaryParser="org.eclipse.cdt.core.ELF" id="org.eclipse.cdt.build.core.prefbase.toolchain.1880939016.902038749" name=""/>
|
||||
<builder id="org.eclipse.cdt.build.core.settings.default.builder.251371665" keepEnvironmentInBuildfile="false" name="Gnu Make Builder" superClass="org.eclipse.cdt.build.core.settings.default.builder"/>
|
||||
<tool id="org.eclipse.cdt.build.core.settings.holder.libs.3457715" name="holder for library settings" superClass="org.eclipse.cdt.build.core.settings.holder.libs"/>
|
||||
<tool id="org.eclipse.cdt.build.core.settings.holder.1309685191" name="Assembly" superClass="org.eclipse.cdt.build.core.settings.holder">
|
||||
<inputType id="org.eclipse.cdt.build.core.settings.holder.inType.1220779287" languageId="org.eclipse.cdt.core.assembly" languageName="Assembly" sourceContentType="org.eclipse.cdt.core.asmSource" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/>
|
||||
</tool>
|
||||
<tool id="org.eclipse.cdt.build.core.settings.holder.1638995662" name="GNU C++" superClass="org.eclipse.cdt.build.core.settings.holder">
|
||||
<inputType id="org.eclipse.cdt.build.core.settings.holder.inType.1684595952" languageId="org.eclipse.cdt.core.g++" languageName="GNU C++" sourceContentType="org.eclipse.cdt.core.cxxSource,org.eclipse.cdt.core.cxxHeader" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/>
|
||||
</tool>
|
||||
<tool id="org.eclipse.cdt.build.core.settings.holder.275834681" name="GNU C" superClass="org.eclipse.cdt.build.core.settings.holder">
|
||||
<inputType id="org.eclipse.cdt.build.core.settings.holder.inType.1651791339" languageId="org.eclipse.cdt.core.gcc" languageName="GNU C" sourceContentType="org.eclipse.cdt.core.cSource,org.eclipse.cdt.core.cHeader" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/>
|
||||
</tool>
|
||||
</toolChain>
|
||||
</folderInfo>
|
||||
<sourceEntries>
|
||||
<entry excluding="webserver|ethernet|spi0.c" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
|
||||
</sourceEntries>
|
||||
</configuration>
|
||||
</storageModule>
|
||||
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="preference.org.eclipse.cdt.managedbuilder.core.configurationDataProvider.1098510086.1129081297" moduleId="org.eclipse.cdt.core.settings" name="Release">
|
||||
<externalSettings/>
|
||||
<extensions>
|
||||
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
<extension id="org.eclipse.cdt.core.VCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.MakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
</extensions>
|
||||
</storageModule>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
|
||||
|
||||
<storageModule moduleId="org.eclipse.cdt.core.language.mapping"/>
|
||||
<storageModule moduleId="scannerConfiguration">
|
||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"/>
|
||||
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="makefileGenerator">
|
||||
<runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<scannerConfigBuildInfo instanceId="preference.org.eclipse.cdt.managedbuilder.core.configurationDataProvider.1098510086.1154456939;preference.org.eclipse.cdt.managedbuilder.core.configurationDataProvider.1098510086.1154456939.;cdt.managedbuild.tool.gnu.c.compiler.cygwin.base.835204668;cdt.managedbuild.tool.gnu.c.compiler.input.cygwin.604520423">
|
||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC"/>
|
||||
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="makefileGenerator">
|
||||
<runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="arm-elf-gcc" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
</scannerConfigBuildInfo>
|
||||
</storageModule>
|
||||
<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets"/>
|
||||
</cconfiguration>
|
||||
</storageModule>
|
||||
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||
<project id="Drivers.null.1361814750" name="Drivers"/>
|
||||
</storageModule>
|
||||
</cproject>
|
||||
@@ -0,0 +1,84 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>Drivers</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
<project>FreeRTOS</project>
|
||||
<project>inc</project>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
|
||||
<triggers>clean,full,incremental,</triggers>
|
||||
<arguments>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.cleanBuildTarget</key>
|
||||
<value>clean</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.enableCleanBuild</key>
|
||||
<value>true</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.append_environment</key>
|
||||
<value>true</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>?name?</key>
|
||||
<value></value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.stopOnError</key>
|
||||
<value>true</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.buildCommand</key>
|
||||
<value>make</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.contents</key>
|
||||
<value>org.eclipse.cdt.make.core.activeConfigSettings</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.buildLocation</key>
|
||||
<value>${workspace_loc:/Drivers/Debug}</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.useDefaultBuildCmd</key>
|
||||
<value>true</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.enableFullBuild</key>
|
||||
<value>true</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.enableAutoBuild</key>
|
||||
<value>false</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.fullBuildTarget</key>
|
||||
<value>all</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.buildArguments</key>
|
||||
<value></value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.autoBuildTarget</key>
|
||||
<value>all</value>
|
||||
</dictionary>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
|
||||
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
|
||||
<nature>org.eclipse.cdt.core.cnature</nature>
|
||||
<nature>org.eclipse.cdt.core.ccnature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
@@ -0,0 +1,20 @@
|
||||
All:
|
||||
UINT8 device [0..255] 0 = Self
|
||||
1..32 = Remote
|
||||
ADC:
|
||||
UINT8 channel [0..255] 0..7 = valid
|
||||
8..255 = future use
|
||||
if mode == VOLTAGE UINT16 value [0..10000] mV
|
||||
if mode == CURRENT UINT16 value [0..20000] uA
|
||||
|
||||
DAC:
|
||||
UINT8 channel [0..255] 0..3 = valid
|
||||
4..255 = future use
|
||||
if mode == VOLTAGE UINT16 value [0..10000] mV
|
||||
if mode == CURRENT UINT16 value [0..20000] uA
|
||||
|
||||
serial:
|
||||
Baudrate: B1200, B9600, B19200, B38400, B57600, B115200
|
||||
Mode: UART_8N1, UART_7N1, UART_8N2, UART_7N2, UART_8E1, UART_7E1, UART_8E2, UART_7E2, UART_8O1, UART_7O1, UART_8O2, UART_7O2
|
||||
FMode: UART_FIFO_OFF, UART_FIFO_1, UART_FIFO_4, UART_FIFO_8, UART_FIFO_14
|
||||
|
||||
@@ -0,0 +1,88 @@
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Bootloader.c - v0.1 (c) 2008 Micro-key bv
|
||||
* ---------------------------------------------------------------------------
|
||||
* Micro-key bv
|
||||
* Industrieweg 28, 9804 TG Noordhorn
|
||||
* Postbus 92, 9800 AB Zuidhorn
|
||||
* The Netherlands
|
||||
* Tel: +31 594 503020
|
||||
* Fax: +31 594 505825
|
||||
* Email: support@microkey.nl
|
||||
* Web: www.microkey.nl
|
||||
* ---------------------------------------------------------------------------
|
||||
* Description: Activates the bootloader.
|
||||
* ---------------------------------------------------------------------------
|
||||
* Version(s): 0.1, Feb 21, 2008, FSc
|
||||
* Creation.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* System include files
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Application include files
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#include "types.h"
|
||||
#include "sys_config.h"
|
||||
#include "Bootloader.h"
|
||||
#include "watchdog.h"
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Local constant and macro definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
typedef void (*t_bootloader_startup)(void);
|
||||
#define BOOTMODE_ADDR 0x4000005C
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Global variable definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Local variable definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Local function definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
//* \brief Jumps to bootloader
|
||||
void blActivateBootloader()
|
||||
{
|
||||
// Set direction pin for storing
|
||||
*((UINT32 *)BOOTMODE_ADDR) = STAY_IN_BOOTLOADER;
|
||||
|
||||
DISABLE_INTERRUPTS();
|
||||
|
||||
watchdogEnable( 1 ); // force watchdog reset
|
||||
}
|
||||
|
||||
|
||||
t_bl_bootmodes blGetBootmode()
|
||||
{
|
||||
if ( *((UINT32 *)BOOTMODE_ADDR) == (UINT32)STAY_IN_BOOTLOADER)
|
||||
{
|
||||
return STAY_IN_BOOTLOADER;
|
||||
}
|
||||
else
|
||||
{
|
||||
return CONTINUE_APPLICATION;
|
||||
}
|
||||
}
|
||||
|
||||
void blResetBootmode()
|
||||
{
|
||||
*((UINT32 *)BOOTMODE_ADDR) = CONTINUE_APPLICATION;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Bootloader.h - v0.1 (c) 2008 Micro-key bv
|
||||
* ---------------------------------------------------------------------------
|
||||
* Micro-key bv
|
||||
* Industrieweg 28, 9804 TG Noordhorn
|
||||
* Postbus 92, 9800 AB Zuidhorn
|
||||
* The Netherlands
|
||||
* Tel: +31 594 503020
|
||||
* Fax: +31 594 505825
|
||||
* Email: support@microkey.nl
|
||||
* Web: www.microkey.nl
|
||||
* ---------------------------------------------------------------------------
|
||||
* Description:
|
||||
* ---------------------------------------------------------------------------
|
||||
* Version(s): 0.1, Feb 21, 2008, FSc
|
||||
* Creation.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef __BOOTLOADER_H__
|
||||
#define __BOOTLOADER_H__
|
||||
/** \file Bootloader.h
|
||||
\brief Activates the bootloader
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* System include files.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Application include files.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Constant and macro definitions.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Type definitions.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
typedef enum { STAY_IN_BOOTLOADER = 0xABCDEF01, CONTINUE_APPLICATION = 0 } t_bl_bootmodes;
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Variable declarations.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Function declarations.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/** \brief Sets the bootmode to STAY_IN_BOOTLOADER and activates the bootloader */
|
||||
void blActivateBootloader();
|
||||
|
||||
/** \brief Returns the bootmode */
|
||||
t_bl_bootmodes blGetBootmode();
|
||||
|
||||
/** \brief Sets bootmode to default status (CONTINUE APPLICATION) */
|
||||
void blResetBootmode();
|
||||
|
||||
#endif /* __BOOTLOADER_H__ */
|
||||
@@ -0,0 +1,267 @@
|
||||
# Doxyfile 1.5.3
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Project related configuration options
|
||||
#---------------------------------------------------------------------------
|
||||
DOXYFILE_ENCODING = UTF-8
|
||||
PROJECT_NAME = "Landustrie IO controller API "
|
||||
PROJECT_NUMBER = V0.1
|
||||
OUTPUT_DIRECTORY = P:/LAN_2636/SW/API/Doxygen
|
||||
CREATE_SUBDIRS = NO
|
||||
OUTPUT_LANGUAGE = English
|
||||
BRIEF_MEMBER_DESC = YES
|
||||
REPEAT_BRIEF = YES
|
||||
ABBREVIATE_BRIEF = "The $name class " \
|
||||
"The $name widget " \
|
||||
"The $name file " \
|
||||
is \
|
||||
provides \
|
||||
specifies \
|
||||
contains \
|
||||
represents \
|
||||
a \
|
||||
an \
|
||||
the
|
||||
ALWAYS_DETAILED_SEC = NO
|
||||
INLINE_INHERITED_MEMB = NO
|
||||
FULL_PATH_NAMES = YES
|
||||
STRIP_FROM_PATH = C:/Tools/doxygen/bin/
|
||||
STRIP_FROM_INC_PATH =
|
||||
SHORT_NAMES = NO
|
||||
JAVADOC_AUTOBRIEF = NO
|
||||
QT_AUTOBRIEF = NO
|
||||
MULTILINE_CPP_IS_BRIEF = NO
|
||||
DETAILS_AT_TOP = NO
|
||||
INHERIT_DOCS = YES
|
||||
SEPARATE_MEMBER_PAGES = NO
|
||||
TAB_SIZE = 8
|
||||
ALIASES =
|
||||
OPTIMIZE_OUTPUT_FOR_C = YES
|
||||
OPTIMIZE_OUTPUT_JAVA = NO
|
||||
BUILTIN_STL_SUPPORT = NO
|
||||
CPP_CLI_SUPPORT = NO
|
||||
DISTRIBUTE_GROUP_DOC = NO
|
||||
SUBGROUPING = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# Build related configuration options
|
||||
#---------------------------------------------------------------------------
|
||||
EXTRACT_ALL = YES
|
||||
EXTRACT_PRIVATE = YES
|
||||
EXTRACT_STATIC = YES
|
||||
EXTRACT_LOCAL_CLASSES = YES
|
||||
EXTRACT_LOCAL_METHODS = NO
|
||||
EXTRACT_ANON_NSPACES = NO
|
||||
HIDE_UNDOC_MEMBERS = NO
|
||||
HIDE_UNDOC_CLASSES = NO
|
||||
HIDE_FRIEND_COMPOUNDS = NO
|
||||
HIDE_IN_BODY_DOCS = NO
|
||||
INTERNAL_DOCS = NO
|
||||
CASE_SENSE_NAMES = NO
|
||||
HIDE_SCOPE_NAMES = NO
|
||||
SHOW_INCLUDE_FILES = YES
|
||||
INLINE_INFO = YES
|
||||
SORT_MEMBER_DOCS = YES
|
||||
SORT_BRIEF_DOCS = NO
|
||||
SORT_BY_SCOPE_NAME = NO
|
||||
GENERATE_TODOLIST = YES
|
||||
GENERATE_TESTLIST = YES
|
||||
GENERATE_BUGLIST = YES
|
||||
GENERATE_DEPRECATEDLIST= YES
|
||||
ENABLED_SECTIONS =
|
||||
MAX_INITIALIZER_LINES = 30
|
||||
SHOW_USED_FILES = YES
|
||||
SHOW_DIRECTORIES = NO
|
||||
FILE_VERSION_FILTER =
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to warning and progress messages
|
||||
#---------------------------------------------------------------------------
|
||||
QUIET = NO
|
||||
WARNINGS = YES
|
||||
WARN_IF_UNDOCUMENTED = YES
|
||||
WARN_IF_DOC_ERROR = YES
|
||||
WARN_NO_PARAMDOC = NO
|
||||
WARN_FORMAT = "$file:$line: $text "
|
||||
WARN_LOGFILE =
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the input files
|
||||
#---------------------------------------------------------------------------
|
||||
INPUT = P:/LAN_2636/SW/API
|
||||
INPUT_ENCODING = UTF-8
|
||||
FILE_PATTERNS = *.c \
|
||||
*.cc \
|
||||
*.cxx \
|
||||
*.cpp \
|
||||
*.c++ \
|
||||
*.d \
|
||||
*.java \
|
||||
*.ii \
|
||||
*.ixx \
|
||||
*.ipp \
|
||||
*.i++ \
|
||||
*.inl \
|
||||
*.h \
|
||||
*.hh \
|
||||
*.hxx \
|
||||
*.hpp \
|
||||
*.h++ \
|
||||
*.idl \
|
||||
*.odl \
|
||||
*.cs \
|
||||
*.php \
|
||||
*.php3 \
|
||||
*.inc \
|
||||
*.m \
|
||||
*.mm \
|
||||
*.dox \
|
||||
*.py
|
||||
RECURSIVE = NO
|
||||
EXCLUDE =
|
||||
EXCLUDE_SYMLINKS = NO
|
||||
EXCLUDE_PATTERNS =
|
||||
EXCLUDE_SYMBOLS =
|
||||
EXAMPLE_PATH =
|
||||
EXAMPLE_PATTERNS = *
|
||||
EXAMPLE_RECURSIVE = NO
|
||||
IMAGE_PATH =
|
||||
INPUT_FILTER =
|
||||
FILTER_PATTERNS =
|
||||
FILTER_SOURCE_FILES = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to source browsing
|
||||
#---------------------------------------------------------------------------
|
||||
SOURCE_BROWSER = YES
|
||||
INLINE_SOURCES = NO
|
||||
STRIP_CODE_COMMENTS = YES
|
||||
REFERENCED_BY_RELATION = YES
|
||||
REFERENCES_RELATION = YES
|
||||
REFERENCES_LINK_SOURCE = YES
|
||||
USE_HTAGS = NO
|
||||
VERBATIM_HEADERS = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the alphabetical class index
|
||||
#---------------------------------------------------------------------------
|
||||
ALPHABETICAL_INDEX = YES
|
||||
COLS_IN_ALPHA_INDEX = 5
|
||||
IGNORE_PREFIX =
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the HTML output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_HTML = YES
|
||||
HTML_OUTPUT = html
|
||||
HTML_FILE_EXTENSION = .html
|
||||
HTML_HEADER =
|
||||
HTML_FOOTER =
|
||||
HTML_STYLESHEET =
|
||||
HTML_ALIGN_MEMBERS = YES
|
||||
GENERATE_HTMLHELP = NO
|
||||
HTML_DYNAMIC_SECTIONS = NO
|
||||
CHM_FILE =
|
||||
HHC_LOCATION =
|
||||
GENERATE_CHI = NO
|
||||
BINARY_TOC = NO
|
||||
TOC_EXPAND = NO
|
||||
DISABLE_INDEX = NO
|
||||
ENUM_VALUES_PER_LINE = 4
|
||||
GENERATE_TREEVIEW = NO
|
||||
TREEVIEW_WIDTH = 250
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the LaTeX output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_LATEX = YES
|
||||
LATEX_OUTPUT = latex
|
||||
LATEX_CMD_NAME = latex
|
||||
MAKEINDEX_CMD_NAME = makeindex
|
||||
COMPACT_LATEX = NO
|
||||
PAPER_TYPE = a4wide
|
||||
EXTRA_PACKAGES =
|
||||
LATEX_HEADER =
|
||||
PDF_HYPERLINKS = YES
|
||||
USE_PDFLATEX = YES
|
||||
LATEX_BATCHMODE = NO
|
||||
LATEX_HIDE_INDICES = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the RTF output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_RTF = NO
|
||||
RTF_OUTPUT = rtf
|
||||
COMPACT_RTF = NO
|
||||
RTF_HYPERLINKS = NO
|
||||
RTF_STYLESHEET_FILE =
|
||||
RTF_EXTENSIONS_FILE =
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the man page output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_MAN = NO
|
||||
MAN_OUTPUT = man
|
||||
MAN_EXTENSION = .3
|
||||
MAN_LINKS = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the XML output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_XML = NO
|
||||
XML_OUTPUT = xml
|
||||
XML_SCHEMA =
|
||||
XML_DTD =
|
||||
XML_PROGRAMLISTING = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options for the AutoGen Definitions output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_AUTOGEN_DEF = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the Perl module output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_PERLMOD = NO
|
||||
PERLMOD_LATEX = NO
|
||||
PERLMOD_PRETTY = YES
|
||||
PERLMOD_MAKEVAR_PREFIX =
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the preprocessor
|
||||
#---------------------------------------------------------------------------
|
||||
ENABLE_PREPROCESSING = YES
|
||||
MACRO_EXPANSION = NO
|
||||
EXPAND_ONLY_PREDEF = NO
|
||||
SEARCH_INCLUDES = YES
|
||||
INCLUDE_PATH =
|
||||
INCLUDE_FILE_PATTERNS =
|
||||
PREDEFINED =
|
||||
EXPAND_AS_DEFINED =
|
||||
SKIP_FUNCTION_MACROS = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration::additions related to external references
|
||||
#---------------------------------------------------------------------------
|
||||
TAGFILES =
|
||||
GENERATE_TAGFILE =
|
||||
ALLEXTERNALS = NO
|
||||
EXTERNAL_GROUPS = YES
|
||||
PERL_PATH = /usr/bin/perl
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the dot tool
|
||||
#---------------------------------------------------------------------------
|
||||
CLASS_DIAGRAMS = NO
|
||||
MSCGEN_PATH =
|
||||
HIDE_UNDOC_RELATIONS = YES
|
||||
HAVE_DOT = YES
|
||||
CLASS_GRAPH = YES
|
||||
COLLABORATION_GRAPH = YES
|
||||
GROUP_GRAPHS = YES
|
||||
UML_LOOK = NO
|
||||
TEMPLATE_RELATIONS = NO
|
||||
INCLUDE_GRAPH = YES
|
||||
INCLUDED_BY_GRAPH = YES
|
||||
CALL_GRAPH = NO
|
||||
CALLER_GRAPH = NO
|
||||
GRAPHICAL_HIERARCHY = YES
|
||||
DIRECTORY_GRAPH = YES
|
||||
DOT_IMAGE_FORMAT = png
|
||||
DOT_PATH =
|
||||
DOTFILE_DIRS =
|
||||
DOT_GRAPH_MAX_NODES = 50
|
||||
MAX_DOT_GRAPH_DEPTH = 1000
|
||||
DOT_TRANSPARENT = NO
|
||||
DOT_MULTI_TARGETS = NO
|
||||
GENERATE_LEGEND = YES
|
||||
DOT_CLEANUP = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration::additions related to the search engine
|
||||
#---------------------------------------------------------------------------
|
||||
SEARCHENGINE = NO
|
||||
@@ -0,0 +1,271 @@
|
||||
/* ---------------------------------------------------------------------------
|
||||
* BusProtocol.c - v0.1 (c) 2008 Micro-key bv
|
||||
* ---------------------------------------------------------------------------
|
||||
* Micro-key bv
|
||||
* Industrieweg 28, 9804 TG Noordhorn
|
||||
* Postbus 92, 9800 AB Zuidhorn
|
||||
* The Netherlands
|
||||
* Tel: +31 594 503020
|
||||
* Fax: +31 594 505825
|
||||
* Email: support@microkey.nl
|
||||
* Web: www.microkey.nl
|
||||
* ---------------------------------------------------------------------------
|
||||
* Description:
|
||||
* ---------------------------------------------------------------------------
|
||||
* Version(s): 0.1, Jan 28, 2008, FSc
|
||||
* Creation.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* System include files
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Application include files
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#include "types.h"
|
||||
#include "ElecStatusCache.h"
|
||||
|
||||
#include "FreeRTOS.h"
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Local constant and macro definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#define MAX_NR_DEVICES 20
|
||||
#define CACHE_NOT_USED 0xFF
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Global variable definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Local variable definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
static UINT16 *bpecAdcReadCache[MAX_NR_DEVICES];
|
||||
static UINT8 bpecAdcReadCacheSize[MAX_NR_DEVICES];
|
||||
static UINT16 *bpecDacReadBackCache[MAX_NR_DEVICES];
|
||||
static UINT8 bpecDacReadBackCacheSize[MAX_NR_DEVICES];
|
||||
static BOOLEAN *bpecDioReadCache[MAX_NR_DEVICES];
|
||||
static UINT8 bpecDioReadCacheSize[MAX_NR_DEVICES];
|
||||
static BOOLEAN *bpecDioReadBackCache[MAX_NR_DEVICES];
|
||||
static UINT8 bpecDioReadBackCacheSize[MAX_NR_DEVICES];
|
||||
static t_bpec_write_callback bpecWriteCallback;
|
||||
static int bpecBusProtocolHandle;
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Local function definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
void bpecInit()
|
||||
{
|
||||
int i;
|
||||
|
||||
bpecWriteCallback = NULL;
|
||||
bpecBusProtocolHandle = -1;
|
||||
|
||||
// Empty the administration
|
||||
for (i = 0; i < MAX_NR_DEVICES; i++)
|
||||
{
|
||||
bpecAdcReadCache[i] = NULL;
|
||||
bpecAdcReadCacheSize[i] = CACHE_NOT_USED;
|
||||
bpecDacReadBackCache[i] = NULL;
|
||||
bpecDacReadBackCacheSize[i] = CACHE_NOT_USED;
|
||||
bpecDioReadCache[i] = NULL;
|
||||
bpecDioReadCacheSize[i] = CACHE_NOT_USED;
|
||||
bpecDioReadBackCache[i] = NULL;
|
||||
bpecDioReadBackCacheSize[i] = CACHE_NOT_USED;
|
||||
}
|
||||
}
|
||||
|
||||
void bpecAttachWriteCallback(int busProtocolHandle, t_bpec_write_callback callback)
|
||||
{
|
||||
bpecBusProtocolHandle = busProtocolHandle;
|
||||
bpecWriteCallback = callback;
|
||||
}
|
||||
|
||||
void bpecDetachWriteCallback()
|
||||
{
|
||||
bpecBusProtocolHandle = -1;
|
||||
bpecWriteCallback = NULL;
|
||||
}
|
||||
|
||||
void bpecWriteDacValue( UINT8 device, UINT8 channel, UINT16 dacValue )
|
||||
{
|
||||
if (bpecWriteCallback != NULL)
|
||||
{
|
||||
bpecWriteCallback( bpecBusProtocolHandle, FALSE, device, channel, dacValue );
|
||||
}
|
||||
}
|
||||
|
||||
void bpecWriteDioValue( UINT8 device, UINT8 channel, BOOLEAN doValue )
|
||||
{
|
||||
if (bpecWriteCallback != NULL)
|
||||
{
|
||||
bpecWriteCallback( bpecBusProtocolHandle, TRUE, device, channel, (UINT16)doValue );
|
||||
}
|
||||
}
|
||||
|
||||
void bpecSetAdcReadCache( UINT8 device, UINT16 adcValues[], UINT8 nrOfAdcValues)
|
||||
{
|
||||
static int NrOfAllocs = 0;
|
||||
if (bpecAdcReadCacheSize[device] != nrOfAdcValues)
|
||||
{
|
||||
if (bpecAdcReadCacheSize[device] == CACHE_NOT_USED)
|
||||
{
|
||||
NrOfAllocs++;
|
||||
bpecAdcReadCache[device] = pvPortMalloc( nrOfAdcValues * sizeof(UINT16) );
|
||||
if (bpecAdcReadCache[device] != NULL)
|
||||
{
|
||||
bpecAdcReadCacheSize[device] = nrOfAdcValues;
|
||||
memcpy(bpecAdcReadCache[device], adcValues, nrOfAdcValues * sizeof(UINT16));
|
||||
} /* else Failure */
|
||||
}
|
||||
/* else Failure */
|
||||
}
|
||||
else
|
||||
{
|
||||
memcpy(bpecAdcReadCache[device], adcValues, nrOfAdcValues * sizeof(UINT16));
|
||||
}
|
||||
}
|
||||
|
||||
void bpecSetDioReadCache( UINT8 device, BOOLEAN dioValues[], UINT8 nrOfDioValues)
|
||||
{
|
||||
if (bpecDioReadCacheSize[device] != nrOfDioValues)
|
||||
{
|
||||
if (bpecDioReadCacheSize[device] == CACHE_NOT_USED)
|
||||
{
|
||||
bpecDioReadCache[device] = pvPortMalloc( nrOfDioValues * sizeof(BOOLEAN) );
|
||||
if (bpecDioReadCache[device] != NULL)
|
||||
{
|
||||
bpecDioReadCacheSize[device] = nrOfDioValues;
|
||||
memcpy(bpecDioReadCache[device], dioValues, nrOfDioValues * sizeof(BOOLEAN));
|
||||
} /* else Failure */
|
||||
}
|
||||
/* else Failure */
|
||||
}
|
||||
else
|
||||
{
|
||||
memcpy(bpecDioReadCache[device], dioValues, nrOfDioValues * sizeof(BOOLEAN));
|
||||
}
|
||||
}
|
||||
|
||||
void bpecSetDioReadBackCache( UINT8 device, BOOLEAN dioValues[], UINT8 nrOfDioValues)
|
||||
{
|
||||
static int NrOfWritings = 0;
|
||||
static int LastSetDevice = 0;
|
||||
static int LastSetNrOfDioValues = 0;
|
||||
NrOfWritings++;
|
||||
LastSetDevice = device;
|
||||
LastSetNrOfDioValues = nrOfDioValues;
|
||||
|
||||
if (bpecDioReadBackCacheSize[device] != nrOfDioValues)
|
||||
{
|
||||
if (bpecDioReadBackCacheSize[device] == CACHE_NOT_USED)
|
||||
{
|
||||
bpecDioReadBackCache[device] = pvPortMalloc( nrOfDioValues * sizeof(BOOLEAN) );
|
||||
if (bpecDioReadBackCache[device] != NULL)
|
||||
{
|
||||
bpecDioReadBackCacheSize[device] = nrOfDioValues;
|
||||
memcpy(bpecDioReadBackCache[device], dioValues, nrOfDioValues * sizeof(BOOLEAN));
|
||||
} /* else Failure */
|
||||
}
|
||||
/* else Failure */
|
||||
}
|
||||
else
|
||||
{
|
||||
memcpy(bpecDioReadBackCache[device], dioValues, nrOfDioValues * sizeof(BOOLEAN));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void bpecSetDacReadBackCache( UINT8 device, UINT16 dacValues[], UINT8 nrOfDacValues)
|
||||
{
|
||||
if (bpecDacReadBackCacheSize[device] != nrOfDacValues)
|
||||
{
|
||||
if (bpecDacReadBackCacheSize[device] == CACHE_NOT_USED)
|
||||
{
|
||||
bpecDacReadBackCache[device] = pvPortMalloc( nrOfDacValues * sizeof(UINT16) );
|
||||
if (bpecDacReadBackCache[device] != NULL)
|
||||
{
|
||||
bpecDacReadBackCacheSize[device] = nrOfDacValues;
|
||||
memcpy(bpecDacReadBackCache[device], dacValues, nrOfDacValues * sizeof(UINT16));
|
||||
} /* else Failure */
|
||||
}
|
||||
/* else Failure */
|
||||
}
|
||||
else
|
||||
{
|
||||
memcpy(bpecDacReadBackCache[device], dacValues, nrOfDacValues * sizeof(UINT16));
|
||||
}
|
||||
}
|
||||
|
||||
UINT16 bpecAdcRead( UINT8 device, UINT8 channel )
|
||||
{
|
||||
UINT16 result = 0;
|
||||
|
||||
if (bpecAdcReadCacheSize[device] != CACHE_NOT_USED)
|
||||
{
|
||||
if (channel < bpecAdcReadCacheSize[device])
|
||||
{
|
||||
result = (bpecAdcReadCache[device])[channel];
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
BOOLEAN bpecDioRead( UINT8 device, UINT8 channel )
|
||||
{
|
||||
BOOLEAN result = FALSE;
|
||||
|
||||
if (bpecDioReadCacheSize[device] != CACHE_NOT_USED)
|
||||
{
|
||||
if (channel < bpecDioReadCacheSize[device])
|
||||
{
|
||||
result = (bpecDioReadCache[device])[channel];
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
BOOLEAN bpecDioReadBack( UINT8 device, UINT8 channel )
|
||||
{
|
||||
BOOLEAN result = FALSE;
|
||||
|
||||
if (bpecDioReadBackCacheSize[device] != CACHE_NOT_USED)
|
||||
{
|
||||
if (channel < bpecDioReadBackCacheSize[device])
|
||||
{
|
||||
result = (bpecDioReadBackCache[device])[channel];
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
UINT16 bpecDacReadBack( UINT8 device, UINT8 channel )
|
||||
{
|
||||
UINT16 result = 0;
|
||||
|
||||
if (bpecDacReadBackCacheSize[device] != CACHE_NOT_USED)
|
||||
{
|
||||
if (channel < bpecDacReadBackCacheSize[device])
|
||||
{
|
||||
result = (bpecDacReadBackCache[device])[channel];
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user