Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions example/As6Project/AsProject.apj
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<?AutomationStudio Version="6.0.2.177" WorkingVersion="6.0"?>
<Project Description="Starter Automation Studio project." Version="1.0.0" Edition="Standard" EditionComment="Standard" xmlns="http://br-automation.co.at/AS/Project">
<Communication />
<ANSIC DefaultIncludes="true" />
<IEC ExtendedConstants="true" IecExtendedComments="true" KeywordsAsStructureMembers="false" NamingConventions="true" Pointers="true" Preprocessor="false" />
<Motion RestartAcoposParameter="true" RestartInitParameter="true" />
<Project StoreRuntimeInProject="false" />
<Variables DefaultInitValue="0" DefaultRetain="false" DefaultVolatile="true" />
</Project>
4 changes: 4 additions & 0 deletions example/As6Project/Logical/Global.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

TYPE

END_TYPE
8 changes: 8 additions & 0 deletions example/As6Project/Logical/Global.var
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

VAR

END_VAR

VAR CONSTANT

END_VAR
9 changes: 9 additions & 0 deletions example/As6Project/Logical/Libraries/Loupe/Package.pkg
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<?AutomationStudio FileVersion="4.9"?>
<Package xmlns="http://br-automation.co.at/AS/Package">
<Objects>
<Object Type="Library" Language="ANSIC" Reference="true">..\..\src\Ar\stringext\ANSIC.lby</Object>
<Object Type="Library" Language="Binary">tlsf</Object>
<Object Type="Library" Language="Binary">rtk_lib</Object>
</Objects>
</Package>
34 changes: 34 additions & 0 deletions example/As6Project/Logical/Libraries/Loupe/rtk_lib/Binary.lby
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="utf-8"?>
<?AutomationStudio FileVersion="4.9"?>
<Library Version="6.0.0" SubType="Binary" xmlns="http://br-automation.co.at/AS/Library">
<Files>
<File>arErrno.h</File>
<File>arexport.h</File>
<File>arInternetTypes.h</File>
<File>arNetworkConvert.h</File>
<File>arSelect.h</File>
<File>arSocket.h</File>
<File>arState.h</File>
<File>bootModeApi.h</File>
<File>cosyApi.h</File>
<File>cosyReadApi.h</File>
<File>cosyWriteApi.h</File>
<File>hostApi.h</File>
<File>iecType.h</File>
<File>pvElementIteratorApi.h</File>
<File>rtk.h</File>
<File>rtkBase.h</File>
<File>rtkCriticalSection.h</File>
<File>rtkFifo.h</File>
<File>rtkMemory.h</File>
<File>rtkMisc.h</File>
<File>rtkObject.h</File>
<File>rtkPlainFifo.h</File>
<File>rtkRtc.h</File>
<File>rtkSemaphore.h</File>
<File>rtkTask.h</File>
<File>rtkTimer.h</File>
<File>rtkTypes.h</File>
<File>SiosClock.h</File>
</Files>
</Library>
Binary file not shown.
Binary file not shown.
36 changes: 36 additions & 0 deletions example/As6Project/Logical/Libraries/Loupe/rtk_lib/SiosClock.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@

/* sequential io scheduler clock */

#ifndef _SIOS_CLOCK_H_
#define _SIOS_CLOCK_H_

#ifdef __cplusplus
extern "C" {
#endif


/* SIOS Aufloesung auslesen.
Der Rueckgabeparameter liefert die die tatsaechliche SIOS-Zykluszeit in Nanosekunden. Dieser Wert entspricht
auch gleichzeitig der Aufloesung der SIOS-Clock. Die Aufloesung der SIOS-Clock wird staendig korrigiert und
angepasst. Bei Verwendung des Wertes genuegt es also nicht ihn nur einmal zu Beginn auszulesen, er muss
von Zeit zu Zeit aktualisiert werden.
*/
void siosClockGetRes(unsigned long* resolution);

/* SIOS Zeit auslesen.
Die beiden Rueckgabeparameter, aufgeteilt in einen Sekunden- und einen Nanosekunden- Anteil, liefern die
Uhrzeit zum Beginn des laufenden SIOS-Zyklus. Beide Werte beziehen sich auf den festgelegten Zeitpunkt:
01.01.1970, 00:00:000000000.
*/
void siosClockGetTime(unsigned long* seconds, unsigned long* nanoscs);


#if AR_CORE
#include <private/SiosClockP.h>
#endif

#ifdef __cplusplus
}
#endif

#endif
131 changes: 131 additions & 0 deletions example/As6Project/Logical/Libraries/Loupe/rtk_lib/arErrno.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@

/* global error status value definitions and a function to read the global error status value */


#ifndef _AR_ERRNO_H_
#define _AR_ERRNO_H_

#ifdef __cplusplus
extern "C" {
#endif

/* AR error codes corresponding to POSIX Error codes */
#define AR_EPERM 1 /* Not owner */
#define AR_ENOENT 2 /* No such file or directory */
#define AR_ESRCH 3 /* No such process */
#define AR_EINTR 4 /* Interrupted system call */
#define AR_EIO 5 /* I/O error */
#define AR_ENXIO 6 /* No such device or address */
#define AR_E2BIG 7 /* Arg list too long */
#define AR_ENOEXEC 8 /* Exec format error */
#define AR_EBADF 9 /* Bad file number */
#define AR_ECHILD 10 /* No children */
#define AR_EAGAIN 11 /* No more processes */
#define AR_ENOMEM 12 /* Not enough core */
#define AR_EACCESS 13 /* Permission denied */
#define AR_EFAULT 14 /* Bad address */
#define AR_ENOTEMPTY 15 /* Directory not empty */
#define AR_EBUSY 16 /* Mount device busy */
#define AR_EEXIST 17 /* File exists */
#define AR_EXDEV 18 /* Cross-device link */
#define AR_ENODEV 19 /* No such device */
#define AR_ENOTDIR 20 /* Not a directory*/
#define AR_EISDIR 21 /* Is a directory */
#define AR_EINVAL 22 /* Invalid argument */
#define AR_ENFILE 23 /* File table overflow */
#define AR_EMFILE 24 /* Too many open files */
#define AR_ENOTTY 25 /* Not a typewriter */
#define AR_ENAMETOOLONG 26 /* File name too long */
#define AR_EFBIG 27 /* File too large */
#define AR_ENOSPC 28 /* No space left on device */
#define AR_ESPIPE 29 /* Illegal seek */
#define AR_EROFS 30 /* Read-only file system */
#define AR_EMLINK 31 /* Too many links */
#define AR_EPIPE 32 /* Broken pipe */
#define AR_EDEADLK 33 /* Resource deadlock avoided */
#define AR_ENOLCK 34 /* No locks available */
#define AR_ENOTSUP 35 /* Unsupported value */
#define AR_EMSGSIZE 36 /* Message size */

/* ANSI math software */
#define AR_EDOM 37 /* Argument too large */
#define AR_ERANGE 38 /* Result too large */

/* ipc/network software */

/* argument errors */
#define AR_EDESTADDRREQ 40 /* Destination address required */
#define AR_EPROTOTYPE 41 /* Protocol wrong type for socket */
#define AR_ENOPROTOOPT 42 /* Protocol not available */
#define AR_EPROTONOSUPPORT 43 /* Protocol not supported */
#define AR_ESOCKTNOSUPPORT 44 /* Socket type not supported */
#define AR_EOPNOTSUPP 45 /* Operation not supported on socket */
#define AR_EPFNOSUPPORT 46 /* Protocol family not supported */
#define AR_EAFNOSUPPORT 47 /* Addr family not supported */
#define AR_EADDRINUSE 48 /* Address already in use */
#define AR_EADDRNOTAVAIL 49 /* Can't assign requested address */
#define AR_ENOTSOCK 50 /* Socket operation on non-socket */

/* operational errors */
#define AR_ENETUNREACH 51 /* Network is unreachable */
#define AR_ENETRESET 52 /* Network dropped connection on reset*/
#define AR_ECONNABORTED 53 /* Software caused connection abort */
#define AR_ECONNRESET 54 /* Connection reset by peer */
#define AR_ENOBUFS 55 /* No buffer space available */
#define AR_EISCONN 56 /* Socket is already connected */
#define AR_ENOTCONN 57 /* Socket is not connected */
#define AR_ESHUTDOWN 58 /* Can't send after socket shutdown */
#define AR_ETOOMANYREFS 59 /* Too many references: can't splice */
#define AR_ETIMEDOUT 60 /* Connection timed out */
#define AR_ECONNREFUSED 61 /* Connection refused */
#define AR_ENETDOWN 62 /* Network is down */
#define AR_ETXTBSY 63 /* Text file busy */
#define AR_ELOOP 64 /* Too many levels of symbolic links */
#define AR_EHOSTUNREACH 65 /* No route to host */
#define AR_ENOTBLK 66 /* Block device required */
#define AR_EHOSTDOWN 67 /* Host is down */

/* non-blocking and interrupt i/o */
#define AR_EINPROGRESS 68 /* Operation now in progress */
#define AR_EALREADY 69 /* Operation already in progress */
#define AR_EWOULDBLOCK 70 /* Operation would block */

#define AR_ENOSYS 71 /* Function not implemented */

/* aio errors (should be under posix) */
#define AR_ECANCELED 72 /* Operation canceled */

/* specific STREAMS errno values */
#define AR_ENOSR 74 /* Insufficient memory */
#define AR_ENOSTR 75 /* STREAMS device required */
#define AR_EPROTO 76 /* Generic STREAMS error */
#define AR_EBADMSG 77 /* Invalid STREAMS message */
#define AR_ENODATA 78 /* Missing expected message data */
#define AR_ETIME 79 /* STREAMS timeout occurred */
#define AR_ENOMSG 80 /* Unexpected message type */

#define AR_EFPOS 81 /* File positioning error */
#define AR_EILSEQ 82 /* Illegal byte sequence. */

/* error codes used by network stack */
#define AR_EDQUOT 83 /* routing error */

#define AR_EIDRM 84 /* Identifier removed */
#define AR_EOVERFLOW 85 /* Value too large for data type */
#define AR_EMULTIHOP 86 /* Reserved */
#define AR_ENOLINK 87 /* Reserved */
#define AR_ESTALE 88 /* Reserved */

#define AR_EFIREWALL 1006 /* the communication was blocked by the AR firewall. This is not a POSIX error code */

#define AR_EUNKNOWN 0xFFFFFF

/* Get the global error status value of the calling task.
* For ARsim only socket errors are currently handled properly. */
int arerrnoGet(void);

#ifdef __cplusplus
}
#endif

#endif
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@

/* Base definition for AR socket and conversion functions */


#ifndef _AR_INTERNET_TYPES_H_
#define _AR_INTERNET_TYPES_H_

#ifdef __cplusplus
extern "C" {
#endif

#include <stdint.h>

/* Protocols - used for arsocket, getsockopt, setsockopt */
#define AR_IPPROTO_IP 0 /* Internet Protocol version 4. */
#define AR_IPPROTO_ICMP 1 /* control message protocol */
#define AR_IPPROTO_TCP 6 /* tcp */
#define AR_IPPROTO_UDP 17 /* user datagram protocol */
#define AR_IPPROTO_RAW 255 /* raw IP packet */

/* values for AR_IN_ADDR struct */
#define AR_INADDR_ANY 0x00000000UL
#define AR_INADDR_BROADCAST 0xffffffffUL /* must be masked */
#define AR_INADDR_NONE 0xffffffffUL /* -1 return */
#define AR_INADDR_LOOPBACK 0x7f000001UL

/* Address families - used for arsocket, arinet_ntop, arinet_pton */
#define AR_AF_UNSPEC 0 /* unspecified */
#define AR_AF_INET 2 /* internetwork: UDP, TCP, etc. */

/* Internet address (contains AR_INADDR_xxx values) */
typedef struct AR_IN_ADDR
{
uint32_t addr;
} AR_IN_ADDR;


#ifdef __cplusplus
}
#endif

#endif
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@

/* AR network conversion functions
The syntax and behavior of these functions is equal to the corresponding POSIX IPv4 functions */


#ifndef _AR_NETWORK_CONVERT_H_
#define _AR_NETWORK_CONVERT_H_

#ifdef __cplusplus
extern "C" {
#endif

#include <arInternetTypes.h>


/* Convert a string representation of an internet address "src" (given in decimal values only - e.g. 192.168.0.1)
* to its binary form "dst" (being a pointer to AR_IN_ADDR for family = AR_AF_INET respectively).
* Returns 1 on success, 0 if the string was not a valid address, or <0 on error */
int arinet_pton(int family, const char* src, void* dst);

/* Convert the network address "src" (being a pointer to AR_IN_ADDR for family = AR_AF_INET respectively) into a
* character string (dst, size). "dst" is a pointer to the buffer with length "size". After the function call the buffer
* contains the string representation of the address in decimal values (e.g. 192.168.0.1).
* Return dst on success, or NULL on error */
const char* arinet_ntop(int family, const void* src, char* dst, int size);

/* Convert a short value (2 bytes) from host byte-order to net byte-order */
uint16_t arhtons(uint16_t val);

/* Convert a long value (4 bytes) from host byte-order to net byte-order */
uint32_t arhtonl(uint32_t val);

/* Convert a short value (2 bytes) from net byte-order to host byte-order */
uint16_t arntohs(uint16_t val);

/* Convert a long value (4 bytes) from net byte-order to host byte-order */
uint32_t arntohl(uint32_t val);


#if AR_CORE
#include <private/arNetworkConvertP.h>
#endif

#ifdef __cplusplus
}
#endif

#endif
Loading