AM261x MCU+ SDK: APIs for RAM

| AM261x MCU+ SDK 26.00.00 |

Data Structures | Functions | Typedefs
APIs for RAM
APIs for Board Specific Device Drivers

## Introduction

This module contains APIs to program and use the Ram module on the board like GPMC pSRAM. See RAM for more details.

## Data Structures
struct | Ram_DevConfig
struct | Ram_Attrs
struct | Ram_Fxns
| Driver implementation callbacks. More...
struct | Ram_Config
| Ram driver configuration, these are filled by SysCfg based on the ram device that is selected. More...
struct | Ram_Params
| Parameters passed during RAM_open() More...

## Functions
Ram_Attrs * | Ram_getAttrs (uint32_t instanceId)
Ram_Handle | Ram_open (uint32_t instanceId, Ram_Params *params)
| Open RAM driver. More...
void | Ram_close (Ram_Handle handle)
| Close RAM driver. More...
int32_t | Ram_write (Ram_Handle handle, uint32_t offset, uint8_t *buf, uint32_t len)
| Write to RAM device. More...
int32_t | Ram_read (Ram_Handle handle, uint32_t offset, uint8_t *buf, uint32_t len)
| Read data from RAM device. More...

## Typedefs
typedef void * | Ram_Handle
| Handle to the RAM driver returned by Ram_open() More...
typedef struct Ram_Config_s | Ram_Config
| Forward declaration of Ram_Config. More...
typedef struct Ram_Params_s | Ram_Params
| Forward declaration of Ram_Params. More...

## RAM driver implementation callbacks
typedef int32_t(* | Ram_OpenFxn) (Ram_Config *config)
| Driver implementation to open a specific RAM driver. More...
typedef void(* | Ram_CloseFxn) (Ram_Config *config)
| Driver implementation to close a specific RAM driver. More...
typedef 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. More...
typedef 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. More...
typedef 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 before invoking Ram_open. More...
typedef int32_t(* | Ram_custProtocolFxn) (Ram_Config *config)
| User implementation of a custom function to configure RAM to operate in a specific protocol. More...

## Typedef Documentation

## ◆ Ram_Handle

typedef void* Ram_Handle

Handle to the RAM driver returned by Ram_open()

## ◆ Ram_Config

typedef struct Ram_Config_s Ram_Config

Forward declaration of Ram_Config.

## ◆ Ram_Params

typedef struct Ram_Params_s Ram_Params

Forward declaration of Ram_Params.

## ◆ Ram_OpenFxn

typedef int32_t(* Ram_OpenFxn) (Ram_Config *config)

Driver implementation to open a specific RAM driver.

Typically this callback is hidden from the end application and is implemented when a new type of RAM device needs to be implemented.

Parameters

  config | [in] RAM configuration for the specific RAM device

Returns
  SystemP_SUCCESS on success, else failure

## ◆ Ram_CloseFxn

typedef void(* Ram_CloseFxn) (Ram_Config *config)

Driver implementation to close a specific RAM driver.

Typically this callback is hidden from the end application and is implemented when a new type of RAM device needs to be implemented.

Parameters

  config | [in] RAM configuration for the specific RAM device

Returns
  SystemP_SUCCESS on success, else failure

## ◆ Ram_ReadFxn

typedef 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.

Typically this callback is hidden from the end application and is implemented when a new type of RAM device needs to be implemented.

Parameters

  config | [in] RAM configuration for the specific RAM device
  offset | [in] Offset in the RAM from where to start the read
  buf | [in] Buffer into which to read the data into
  len | [in] Length of the data to read, in bytes

Returns
  SystemP_SUCCESS on success, else failure

## ◆ Ram_WriteFxn

typedef 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.

Typically this callback is hidden from the end application and is implemented when a new type of RAM device needs to be implemented.

Parameters

  config | [in] RAM configuration for the specific RAM device
  offset | [in] Offset in the RAM from where to start the write.
  buf | [in] Buffer which has the data to write.
  len | [in] Length of the data to write, in bytes

Returns
  SystemP_SUCCESS on success, else failure

## ◆ Ram_quirksFxn

typedef 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 before invoking Ram_open.

User implementation of a custom function to handle vendor specific quirks

Typically this callback is hidden from the end application and is implemented when a new type of RAM device needs to be implemented.

Parameters

  config | [in] RAM configuration for the specific RAM device

Returns
  SystemP_SUCCESS on success, else failure

## ◆ Ram_custProtocolFxn

typedef int32_t(* Ram_custProtocolFxn) (Ram_Config *config)

User implementation of a custom function to configure RAM to operate in a specific protocol.

Parameters

  config | [in] RAM configuration for the specific RAM device

Returns
  SystemP_SUCCESS on success, else failure

## Function Documentation

## ◆ Ram_getAttrs()

Ram_Attrs* Ram_getAttrs | ( | uint32_t | instanceId | ) |

## ◆ Ram_open()

Ram_Handle Ram_open | ( | uint32_t | instanceId,
|  | Ram_Params * | params
| ) |  |

Open RAM driver.

Make sure the SOC peripheral driver is opened before calling this API. Drivers_open function generated by SysCfg opens the underlying SOC peripheral driver, e.g OSPI.

Global variables `RAM_Config gRAMConfig[]` and `uint32_t gRAMConfigNum` is instantiated by SysCfg to describe the RAM configuration based on user selection in SysCfg.

Parameters

  instanceId | [in] Index within `RAM_Config gRAMConfig[]` denoting the RAM driver to open
  params | [in] Open parameters

Returns
  Handle to RAM driver which should be used in subsequent API call
  NULL in case of failure

## ◆ Ram_close()

void Ram_close | ( | Ram_Handle | handle | ) |

Close RAM driver.

Parameters

  handle | [in] RAM driver handle from Ram_open

## ◆ Ram_write()

int32_t Ram_write | ( | Ram_Handle | handle,
|  | uint32_t | offset,
|  | uint8_t * | buf,
|  | uint32_t | len
| ) |  |

Write to RAM device.

Parameters

  handle | [in] RAM driver handle from Ram_open
  offset | [in] Offset in the RAM from where to start the write.
  buf | [in] Buffer which has the data to write.
  len | [in] Length of the data to write, in bytes

Returns
  SystemP_SUCCESS on success, else failure

## ◆ Ram_read()

int32_t Ram_read | ( | Ram_Handle | handle,
|  | uint32_t | offset,
|  | uint8_t * | buf,
|  | uint32_t | len
| ) |  |

Read data from RAM device.

Parameters

  handle | [in] RAM driver handle from Ram_open
  offset | [in] Offset in the RAM from where to start the read
  buf | [in] Buffer into which to read the data into
  len | [in] Length of the data to read, in bytes

Returns
  SystemP_SUCCESS on success, else failure