[processor-sdk/pdk.git] / packages / ti / transport / ndk / nimu / example / CCLink / cclink_slave / sample / include / USER_SAMPLE.h
1 /*\r
2 * Copyright (C) 2017 - 2018 Texas Instruments Incorporated - http://www.ti.com/\r
3 * Copyright (C) 2016 CC-Link Partner Association -http://am.cc-link.org/\r
4 * \r
5 * \r
6 * Redistribution and use in source and binary forms, with or without \r
7 * modification, are permitted provided that the following conditions \r
8 * are met:\r
9 *\r
10 * Redistributions of source code must retain the above copyright \r
11 * notice, this list of conditions and the following disclaimer.\r
12 *\r
13 * Redistributions in binary form must reproduce the above copyright\r
14 * notice, this list of conditions and the following disclaimer in the \r
15 * documentation and/or other materials provided with the \r
16 * distribution.\r
17 *\r
18 * Neither the name of Texas Instruments Incorporated nor the names of\r
19 * its contributors may be used to endorse or promote products derived\r
20 * from this software without specific prior written permission.\r
21 *\r
22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \r
23 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT \r
24 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\r
25 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT \r
26 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, \r
27 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT \r
28 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\r
29 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\r
30 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT \r
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE \r
32 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
33 *\r
34 */\r
35 \r
36 #ifndef __USER_SAMPLE_H__\r
37 #define __USER_SAMPLE_H__\r
38 \r
39 #include <stdint.h>\r
40 #ifdef __TIRTOS__\r
41 #include <stdio.h>\r
42 #include <string.h>\r
43 #include <stdlib.h>\r
44 #include <xdc/std.h>\r
45 #include <xdc/runtime/Error.h>\r
46 #include <xdc/runtime/System.h>\r
47 #include <ti/sysbios/BIOS.h>\r
48 #include <ti/sysbios/knl/Task.h>\r
49 #include <ti/csl/soc.h>\r
50 #include <ti/csl/cslr_device.h>\r
51 #endif\r
52 \r
53 #ifdef __cplusplus\r
54 extern "C" {\r
55 #endif\r
56 \r
57 /*[ Definition of CCIEF-BASIC profile for sample code (Please rewrite for user environment) ]*/\r
58 #define USER_PROFILE_VENDOR_CODE 0x1234\r
59 #define USER_PROFILE_MODEL_CODE 0x00010001\r
60 #define USER_PROFILE_MACHINE_VERSION 0x0001\r
61 #ifdef __TIRTOS__\r
62 #define TEST_RUN_INTERVAL_TIME 40000\r
63 #endif\r
64 \r
65 /*[ Definition of prameter for sample code (Please rewrite for user environment) ]*/\r
66 #define USER_PARAMETER_ID_IP_ADDRESS 1\r
67 #define USER_PARAMETER_ID_SUBNET_MASK 2\r
68 #define USER_PARAMETER_ID_DEFAULT_GW_IP_ADDRESS 3\r
69 #define USER_PARAMETER_ID_OCCUPIED_STATION_NUMBER 4\r
70 #define USER_PARAMETER_ID_CYCLIC_RESPONSE_WAIT_TIME 5\r
71 \r
72 /*[ Definition of type name for SLMP node (Please rewrite for user environment) ]*/\r
73 #define USER_TYPE_NAME "SampleCode " /* Less than 16 characters, space(20H) is stored for the remaining character */\r
74 #define USER_TYPE_NAME_CODE 0x1234\r
75 \r
76 /*[ Definition of SLMP server information for sample code (Please rewrite for user environment) ]*/\r
77 #define USER_SERVER_PORT_NUMBER 20000\r
78 #define USER_SERVER_HOSTNAME "SlaveSample"\r
79 \r
80 /*[ Structure of prameter for sample code (Please rewrite for user environment) ]*/\r
81 typedef struct \r
82 {\r
83 uint32_t ulIpAddress; /* Slave ip address */\r
84 uint32_t ulSubnetMask; /* Subnet Mask */\r
85 uint32_t ulDefaultGatewayIPAddress; /* Default Gateway IP Address */\r
86 uint16_t usOccupiedStationNumber; /* Number of occupied stations */\r
87 uint32_t ulCyclicResponseWaitTime; /* Wait for cyclic response time [ms] (0:Not wait) */\r
88 } USER_SLAVE_PARAMETER;\r
89 \r
90 /*[ Definition for sample code ]*/\r
91 #define USER_ERR_OK 0\r
92 #define USER_ERR_NG (-1)\r
93 #define USER_RESET_NONE 0\r
94 #define USER_RESET 1\r
95 #ifdef __TIRTOS__\r
96 #define USER_EXIT 2\r
97 #define USER_ERROR 2\r
98 \r
99 void cclink_thread (UArg a0, UArg a1);\r
100 #endif\r
101 \r
102 #ifdef __cplusplus\r
103 }\r
104 #endif\r
105 \r
106 #endif\r
107 /*EOF*/\r