AM263x Motor Control SDK  09.02.00
tamagawa_soc_uart_interface.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 #ifndef TAMAGAWA_UART_DRV_H_
34 #define TAMAGAWA_UART_DRV_H_
35 
49 #ifdef __cplusplus
50 extern "C" {
51 #endif
52 
53 /* ========================================================================== */
54 /* Macros & Typedefs */
55 /* ========================================================================== */
56 
60 #define MAX_EEPROM_ADDRESS (127)
61 
64 #define MAX_EEPROM_WRITE_DATA (255)
65 
68 enum data_id
69 {
80 };
81 /* ========================================================================== */
82 /* Structure Declarations */
83 /* ========================================================================== */
88 {
89  uint8_t adf;
90  uint8_t edf;
91 };
92 
97 {
98  uint32_t abs;
99  uint32_t abm;
100  uint8_t cf;
101  uint8_t sf;
102  uint8_t enid;
103  uint8_t almc;
104  uint8_t adf;
105  uint8_t edf;
106  uint8_t crc;
107 };
112 {
113  uint8_t data_id;
114  struct tamagawa_tx tx;
115  struct tamagawa_rx rx;
116  uint8_t rx_crc;
117  uint32_t uart_instance;
118  uint32_t gpio_base_address;
119  uint32_t gpio_pin_number;
120 };
121 
122 /* ========================================================================== */
123 /* Function Declarations */
124 /* ========================================================================== */
137 int32_t tamagawa_command_process(volatile struct tamagawa_uart_interface *tamagawa_interface, UARTLLD_Handle *gUartHandle, int32_t cmd);
148 int32_t tamagawa_crc_verify(volatile struct tamagawa_uart_interface *tamagawa_interface);
162 void tamagawa_init(volatile struct tamagawa_uart_interface *tamagawa_interface, uint32_t instance , uint32_t base_address, uint32_t pin_number, uint32_t pin_direction);
163 
166 #ifdef __cplusplus
167 }
168 #endif
169 
170 #endif
DATA_ID_C
@ DATA_ID_C
Definition: tamagawa_soc_uart_interface.h:77
DATA_ID_NUM
@ DATA_ID_NUM
Definition: tamagawa_soc_uart_interface.h:79
tamagawa_rx::sf
uint8_t sf
Definition: tamagawa_soc_uart_interface.h:101
tamagawa_command_process
int32_t tamagawa_command_process(volatile struct tamagawa_uart_interface *tamagawa_interface, UARTLLD_Handle *gUartHandle, int32_t cmd)
Process The Tamagawa Command.
tamagawa_uart_interface::data_id
uint8_t data_id
Definition: tamagawa_soc_uart_interface.h:113
DATA_ID_1
@ DATA_ID_1
Definition: tamagawa_soc_uart_interface.h:71
tamagawa_rx::enid
uint8_t enid
Definition: tamagawa_soc_uart_interface.h:102
tamagawa_rx::abs
uint32_t abs
Definition: tamagawa_soc_uart_interface.h:98
tamagawa_uart_interface
Tamagawa Interface.
Definition: tamagawa_soc_uart_interface.h:112
tamagawa_uart_interface::rx_crc
uint8_t rx_crc
Definition: tamagawa_soc_uart_interface.h:116
DATA_ID_7
@ DATA_ID_7
Definition: tamagawa_soc_uart_interface.h:75
tamagawa_uart_interface::gpio_pin_number
uint32_t gpio_pin_number
Definition: tamagawa_soc_uart_interface.h:119
tamagawa_crc_verify
int32_t tamagawa_crc_verify(volatile struct tamagawa_uart_interface *tamagawa_interface)
Compare Received CRC and Calculated CRC.
tamagawa_rx::almc
uint8_t almc
Definition: tamagawa_soc_uart_interface.h:103
tamagawa_rx::crc
uint8_t crc
Definition: tamagawa_soc_uart_interface.h:106
tamagawa_tx::edf
uint8_t edf
Definition: tamagawa_soc_uart_interface.h:90
tamagawa_rx::edf
uint8_t edf
Definition: tamagawa_soc_uart_interface.h:105
DATA_ID_2
@ DATA_ID_2
Definition: tamagawa_soc_uart_interface.h:72
data_id
data_id
Data ID codes.
Definition: tamagawa_soc_uart_interface.h:69
DATA_ID_6
@ DATA_ID_6
Definition: tamagawa_soc_uart_interface.h:74
tamagawa_rx
Tamagawa Interface Received data.
Definition: tamagawa_soc_uart_interface.h:97
DATA_ID_8
@ DATA_ID_8
Definition: tamagawa_soc_uart_interface.h:76
DATA_ID_3
@ DATA_ID_3
Definition: tamagawa_soc_uart_interface.h:73
tamagawa_init
void tamagawa_init(volatile struct tamagawa_uart_interface *tamagawa_interface, uint32_t instance, uint32_t base_address, uint32_t pin_number, uint32_t pin_direction)
Configure GOPIO pin for RTSn(sw flow control)
tamagawa_rx::adf
uint8_t adf
Definition: tamagawa_soc_uart_interface.h:104
tamagawa_uart_interface::tx
struct tamagawa_tx tx
Definition: tamagawa_soc_uart_interface.h:114
tamagawa_tx
Tamagawa Interface Transmit data.
Definition: tamagawa_soc_uart_interface.h:88
tamagawa_rx::abm
uint32_t abm
Definition: tamagawa_soc_uart_interface.h:99
tamagawa_rx::cf
uint8_t cf
Definition: tamagawa_soc_uart_interface.h:100
tamagawa_tx::adf
uint8_t adf
Definition: tamagawa_soc_uart_interface.h:89
tamagawa_uart_interface::uart_instance
uint32_t uart_instance
Definition: tamagawa_soc_uart_interface.h:117
tamagawa_uart_interface::rx
struct tamagawa_rx rx
Definition: tamagawa_soc_uart_interface.h:115
DATA_ID_D
@ DATA_ID_D
Definition: tamagawa_soc_uart_interface.h:78
tamagawa_uart_interface::gpio_base_address
uint32_t gpio_base_address
Definition: tamagawa_soc_uart_interface.h:118
DATA_ID_0
@ DATA_ID_0
Definition: tamagawa_soc_uart_interface.h:70