![]() |
uGOOSE
1.0
GOOSE for Embedded Devices. Sample project for Renesas R-IN32-EC
|
#include <stdio.h>
#include <string.h>
#include <time.h>
#include "hwos_hwfnc.h"
#include "kernel.h"
#include "kernel_id.h"
#include "goose_task.h"
#include "uied_types.h"
#include "uied_ied.h"
#include "uied_prototype.h"
#include "net_hdr.h"
#include "DDR_ETH_CFG.h"
#include "DDR_ETH.h"
#include "ethsw.h"
Macros | |
#define | OCTET_BUFF_SIZE (1000u) |
#define | TMR_TICK_10_US (125) |
#define | TMR_TICK_1MS (100 * TMR_TICK_10_US) |
Functions | |
static void | InitGoose (void) |
Inits the goose data structure for sending. More... | |
static void | SendGoosePacket (const UINT8 u8_SrcPort, const UIED_INDEX idx_GooseIndex) |
Sends a Goose packet out of the specified port. More... | |
ER | GooseTaskInit (void) |
Task init function. More... | |
ER | GooseTask (SINT32 exinf) |
The Goose Task. More... | |
Variables | |
static UIED | st_Ied = IED_INIT |
static UINT8 | au8_Octets [OCTET_BUFF_SIZE] |
static UIED_INDEX | midx_GooseTxIndex = 0u |
static UIED_INDEX | midx_GooseRxIndex = 2u |
Test file for implementing the GOOSE library Renesas R-IN32M3-EC on the IAR R-IN32M3 KickStart� Kit
#define OCTET_BUFF_SIZE (1000u) |
Size of our tempory buffer
#define TMR_TICK_10_US (125) |
Number of ticks in 10 us (1count = 80ns)
#define TMR_TICK_1MS (100 * TMR_TICK_10_US) |
Number of ticks in 1 ms (1count = 80ns)
ER GooseTask | ( | SINT32 | exinf | ) |
The Goose Task.
This function is the 'Main' function of the Goose Task. The task will enter a 'while(1)' loop and not exit unless an error occurs. Two function are performed by this task:
First Packet (SeQ 0)
Goose 2 | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | .. | 63 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Array of BOOL | T | F | F | F | F | F | F | F | F | F | F | F | F | F | F |
Second Packet (SeQ 1)
Goose 2 | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | .. | 63 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Array of BOOL | T | T | F | F | F | F | F | F | F | F | F | F | F | F | F |
Third Packet (SeQ 2)
Goose 2 | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | .. | 63 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Array of BOOL | T | T | T | F | F | F | F | F | F | F | F | F | F | F | F |
Once the value has been updated, a GOOSE packet (Goose 3) will be sent out with the updated values.
exinf | Extra Information field provided by the OS |
ER GooseTaskInit | ( | void | ) |
Task init function.
This function is called to start the task. Any initialisation that may be required can be performed here, before the actual task is started.
|
static |
Inits the goose data structure for sending.
|
static |
Sends a Goose packet out of the specified port.
This function is used to the build a specified GOOSE packet and send it out of the specified port.
u8_SrcPort | Physical Port Number |
---|---|
0 | Port P0 |
1 | Port P1 |
2 | Both (Ports P0 & P1) |
u8_SrcPort | The port number to send the packet out of |
idx_GooseIndex | The index of the Goose packet definition to be sent |
|
static |
Tempory buffer used to build GOOSE packets
|
static |
Index of GOOSE packet to be received
|
static |
Index of GOOSE packet to be transmitted