uGOOSE  1.0
GOOSE for Embedded Devices. Sample project for Renesas R-IN32-EC
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
goose_task.c File Reference
#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"
Include dependency graph for goose_task.c:

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
 

Detailed Description

Test file for implementing the GOOSE library Renesas R-IN32M3-EC on the IAR R-IN32M3 KickStart� Kit

Macro Definition Documentation

#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)

Function Documentation

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:

  1. Send the defined GOOSE data set (Goose 1) at the specified intervals.
  2. Receive the defined GOOSE data set (Goose 3) and import the sent value into the IED. A single boolen value is sent and this value is used to modify the data used in GOOSE data set 2 (Goose 2). The data set consists of an array of 64 boolean values. The Sequence number of the received packet is used as an index into this array and the boolean value found at this location is set to the value in the received packet.

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.

Precondition
None.
Postcondition
This function should never return, unless an error has occured.
Parameters
exinfExtra Information field provided by the OS
Returns
ER Error Code

Here is the call graph for this function:

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.

Precondition
None.
Postcondition
The task will be made ready to run
Returns
ER Error Code

Here is the call graph for this function:

static void InitGoose ( void  )
static

Inits the goose data structure for sending.

Precondition
None.
Postcondition
None.
Returns
None

Here is the caller graph for this function:

static void SendGoosePacket ( const UINT8  u8_SrcPort,
const UIED_INDEX  idx_GooseIndex 
)
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)
Precondition
None.
Postcondition
A Goose packet will have been created and sent
Parameters
u8_SrcPortThe port number to send the packet out of
idx_GooseIndexThe index of the Goose packet definition to be sent
Returns
None

Here is the caller graph for this function:

Variable Documentation

UINT8 au8_Octets[OCTET_BUFF_SIZE]
static

Tempory buffer used to build GOOSE packets

UIED_INDEX midx_GooseRxIndex = 2u
static

Index of GOOSE packet to be received

UIED_INDEX midx_GooseTxIndex = 0u
static

Index of GOOSE packet to be transmitted

UIED st_Ied = IED_INIT
static

IED structure used by the GOOSE library