AM261x MCU+ SDK  11.00.00
sent_decoder.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2023 Texas Instruments Incorporated
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  *
8  * Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  *
11  * Redistributions in binary form must reproduce the above copyright
12  * notice, this list of conditions and the following disclaimer in the
13  * documentation and/or other materials provided with the
14  * distribution.
15  *
16  * Neither the name of Texas Instruments Incorporated nor the names of
17  * its contributors may be used to endorse or promote products derived
18  * from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
32 
33 #include <stdio.h>
34 #include <string.h>
35 #include <kernel/dpl/DebugP.h>
36 #include "ti_drivers_config.h"
37 #include "ti_drivers_open_close.h"
38 #include "ti_board_open_close.h"
39 #include <drivers/pruicss.h>
40 #include <icss_intc_defines.h>
41 
50 #define MSS_CTRL_ICSSM_PRU_GPIO_OUT_CTRL_VALUE (0x17F)
51 
52 /*CRC4 LUT offset*/
53 #define CRC4_LUT_OFFSET (0x00U)
54 
55 /*Data ready flag offset located in SRAM*/
56 #define CH0_DATA_READY_FLAG_OFFSET (0x00U)
57 #define CH1_DATA_READY_FLAG_OFFSET (0x01U)
58 #define CH2_DATA_READY_FLAG_OFFSET (0x02U)
59 #define CH3_DATA_READY_FLAG_OFFSET (0x03U)
60 #define CH4_DATA_READY_FLAG_OFFSET (0x04U)
61 #define CH5_DATA_READY_FLAG_OFFSET (0x05U)
62 #define CH6_DATA_READY_FLAG_OFFSET (0x06U)
63 #define CH7_DATA_READY_FLAG_OFFSET (0x07U)
64 
65 /*Offset for Data buffer of channels located in SRAM*/
66 #define CH0_DATA_OFFSET (0x40U)
67 #define CH1_DATA_OFFSET (0x4CU)
68 #define CH2_DATA_OFFSET (0x58U)
69 #define CH3_DATA_OFFSET (0x64U)
70 #define CH4_DATA_OFFSET (0x70U)
71 #define CH5_DATA_OFFSET (0x7CU)
72 #define CH6_DATA_OFFSET (0x88U)
73 #define CH7_DATA_OFFSET (0x94U)
74 
75 /*Flag Mask for individual channels*/
76 #define CH0_FLAG_MASK (0xFFU)
77 #define CH1_FLAG_MASK (0xFF00U)
78 #define CH2_FLAG_MASK (0xFF0000U)
79 #define CH3_FLAG_MASK (0xFF000000U)
80 #define CH4_FLAG_MASK (0xFFU)
81 #define CH5_FLAG_MASK (0xFF00U)
82 #define CH6_FLAG_MASK (0xFF0000U)
83 #define CH7_FLAG_MASK (0xFF000000U)
84 
85 /*Mask for data nibbles*/
86 #define CONFIG_TICK_TIME_OFFSET (0x0U)
87 #define STATUS_COM_BIT_OFFSET (0x2U)
88 #define DATA0_OFFSET (0x3U)
89 #define DATA1_OFFSET (0x4U)
90 #define DATA2_OFFSET (0x5U)
91 #define DATA3_OFFSET (0x6U)
92 #define DATA4_OFFSET (0x7U)
93 #define DATA5_OFFSET (0x8U)
94 #define CRC_OFFSET (0x9U)
95 #define ERROR_STATUS_OFFSET (0xAU)
96 
99 
113 typedef struct Sent_Obj_s
114 {
115  /*Tick Period Config*/
116  uint16_t ConfigTickTime;
117  /*Status & Comm Data 0*/
118  uint8_t StatusComBit;
119  /*Data 0*/
120  uint8_t Data0;
121  /*Data 1*/
122  uint8_t Data1;
123  /*Data 2*/
124  uint8_t Data2;
125  /*Data 3*/
126  uint8_t Data3;
127  /*Data 4*/
128  uint8_t Data4;
129  /*Data 5*/
130  uint8_t Data5;
131  /*CRC*/
132  uint8_t CRC;
133  /*Channel Status Code*/
134  uint16_t error_status;
135 } Sent_Obj;
136 
142 typedef struct Sent_Obj_s *Sent_Handle;
Sent_Obj
SENT Wave Struct Sync Pulse: 56 ticks 4 bit Status and Message Pulse: 17-32 tick 4 bit (9:12) Data0 F...
Definition: sent_decoder.h:114
pruicss.h
gPruIcss0Handle
PRUICSS_Handle gPruIcss0Handle
Global Structure pointer holding PRUSS1 memory Map.
Definition: sent_decoder.h:98
Sent_Obj::Data5
uint8_t Data5
Definition: sent_decoder.h:130
Sent_Obj::Data0
uint8_t Data0
Definition: sent_decoder.h:120
Sent_Obj::Data2
uint8_t Data2
Definition: sent_decoder.h:124
Sent_Obj::Data3
uint8_t Data3
Definition: sent_decoder.h:126
Sent_Obj::ConfigTickTime
uint16_t ConfigTickTime
Definition: sent_decoder.h:116
Sent_Obj::CRC
uint8_t CRC
Definition: sent_decoder.h:132
Sent_Obj::Data1
uint8_t Data1
Definition: sent_decoder.h:122
DebugP.h
Sent_Handle
struct Sent_Obj_s * Sent_Handle
SENT FRame handle.
Definition: sent_decoder.h:142
Sent_Obj::StatusComBit
uint8_t StatusComBit
Definition: sent_decoder.h:118
Sent_Obj::Data4
uint8_t Data4
Definition: sent_decoder.h:128
Sent_Obj::error_status
uint16_t error_status
Definition: sent_decoder.h:134
PRUICSS_Handle
struct PRUICSS_Config_s * PRUICSS_Handle
A handle that is returned from a PRUICSS_open() call. This handle is required for calling other APIs.
Definition: pruicss/m_v0/pruicss.h:226