AM64x MCU+ SDK  09.02.01
ram.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2021-2024 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 RAM_H_
34 #define RAM_H_
35 
36 #ifdef __cplusplus
37 extern "C"
38 {
39 #endif
40 
41 #include <stdint.h>
42 #include <kernel/dpl/SystemP.h>
43 #include <drivers/hw_include/soc_config.h>
44 
57 typedef void *Ram_Handle;
58 
62 typedef struct Ram_Config_s Ram_Config;
63 
67 typedef struct Ram_Params_s Ram_Params;
68 
69 typedef struct Ram_Attrs_s {
70 
71  uint32_t ramType;
72  char *ramName;
73  uint32_t deviceId;
74  uint32_t manufacturerId;
75  uint32_t driverInstance;
76  uint32_t ramSize;
78 } Ram_Attrs;
79 
97 typedef int32_t (*Ram_OpenFxn)(Ram_Config *config);
98 
109 typedef void (*Ram_CloseFxn)(Ram_Config *config);
110 
124 typedef int32_t (*Ram_ReadFxn)(Ram_Config *config, uint32_t offset,
125  uint8_t *buf, uint32_t len) ;
126 
140 typedef int32_t (*Ram_WriteFxn)(Ram_Config *config, uint32_t offset,
141  uint8_t *buf, uint32_t len) ;
142 
146 typedef struct Ram_Fxns_s
147 {
152 } Ram_Fxns;
153 
157 typedef struct Ram_Config_s
158 {
161  void *object;
163 } Ram_Config;
164 
181 typedef int32_t (*Ram_quirksFxn)(Ram_Config *config);
182 
190 typedef int32_t (*Ram_custProtocolFxn)(Ram_Config *config);
191 
198 typedef struct Ram_Params_s {
199 
202 
203 } Ram_Params;
204 
205 #if defined (DRV_VERSION_PSRAM_V0)
206 #include <board/ram/gpmc/psram_gpmc.h>
207 #endif
208 
209 Ram_Attrs *Ram_getAttrs(uint32_t instanceId);
210 
226 Ram_Handle Ram_open(uint32_t instanceId, Ram_Params *params);
227 
233 void Ram_close(Ram_Handle handle);
234 
245 int32_t Ram_write(Ram_Handle handle, uint32_t offset, uint8_t *buf, uint32_t len);
246 
257 int32_t Ram_read(Ram_Handle handle, uint32_t offset, uint8_t *buf, uint32_t len);
258 
262 #ifdef __cplusplus
263 }
264 #endif
265 
266 #endif /* RAM_H_ */
Ram_Fxns
Driver implementation callbacks.
Definition: ram.h:147
Ram_Attrs::ramName
char * ramName
Definition: ram.h:72
Ram_open
Ram_Handle Ram_open(uint32_t instanceId, Ram_Params *params)
Open RAM driver.
Ram_quirksFxn
int32_t(* Ram_quirksFxn)(Ram_Config *config)
Ram device config. This will be part of the ram config, so has to be filled by sysconfig or otherwise...
Definition: ram.h:181
Ram_Attrs::driverInstance
uint32_t driverInstance
Definition: ram.h:75
SystemP.h
Ram_getAttrs
Ram_Attrs * Ram_getAttrs(uint32_t instanceId)
Ram_WriteFxn
int32_t(* Ram_WriteFxn)(Ram_Config *config, uint32_t offset, uint8_t *buf, uint32_t len)
Driver implementation to write to RAM using specific RAM driver.
Definition: ram.h:140
Ram_Fxns::readFxn
Ram_ReadFxn readFxn
Definition: ram.h:150
Ram_Attrs
Definition: ram.h:69
Ram_Config
struct Ram_Config_s Ram_Config
Forward declaration of Ram_Config.
Definition: ram.h:62
Ram_custProtocolFxn
int32_t(* Ram_custProtocolFxn)(Ram_Config *config)
User implementation of a custom function to configure RAM to operate in a specific protocol.
Definition: ram.h:190
Ram_Attrs::deviceId
uint32_t deviceId
Definition: ram.h:73
Ram_Fxns::writeFxn
Ram_WriteFxn writeFxn
Definition: ram.h:151
Ram_read
int32_t Ram_read(Ram_Handle handle, uint32_t offset, uint8_t *buf, uint32_t len)
Read data from RAM device.
Ram_Attrs::manufacturerId
uint32_t manufacturerId
Definition: ram.h:74
Ram_Attrs::ramType
uint32_t ramType
Definition: ram.h:71
Ram_CloseFxn
void(* Ram_CloseFxn)(Ram_Config *config)
Driver implementation to close a specific RAM driver.
Definition: ram.h:109
Ram_Fxns::openFxn
Ram_OpenFxn openFxn
Definition: ram.h:148
Ram_Config::fxns
Ram_Fxns * fxns
Definition: ram.h:160
Ram_Params
Parameters passed during RAM_open()
Definition: ram.h:198
Ram_OpenFxn
int32_t(* Ram_OpenFxn)(Ram_Config *config)
Driver implementation to open a specific RAM driver.
Definition: ram.h:97
Ram_Params::quirksFxn
Ram_quirksFxn quirksFxn
Definition: ram.h:200
Ram_Config::object
void * object
Definition: ram.h:161
Ram_Fxns::closeFxn
Ram_CloseFxn closeFxn
Definition: ram.h:149
Ram_Config::attrs
Ram_Attrs * attrs
Definition: ram.h:159
Ram_Handle
void * Ram_Handle
Handle to the RAM driver returned by Ram_open()
Definition: ram.h:57
Ram_write
int32_t Ram_write(Ram_Handle handle, uint32_t offset, uint8_t *buf, uint32_t len)
Write to RAM device.
Ram_ReadFxn
int32_t(* Ram_ReadFxn)(Ram_Config *config, uint32_t offset, uint8_t *buf, uint32_t len)
Driver implementation to read from RAM using a specific RAM driver.
Definition: ram.h:124
Ram_Attrs::ramSize
uint32_t ramSize
Definition: ram.h:76
Ram_Params::custProtoFxn
Ram_custProtocolFxn custProtoFxn
Definition: ram.h:201
Ram_close
void Ram_close(Ram_Handle handle)
Close RAM driver.
Ram_Config
Ram driver configuration, these are filled by SysCfg based on the ram device that is selected.
Definition: ram.h:158
Ram_Params
struct Ram_Params_s Ram_Params
Forward declaration of Ram_Params.
Definition: ram.h:67