MAX78002 Peripheral Driver API
Peripheral Driver API for the MAX78002
sdhc.h
1
6/******************************************************************************
7 *
8 * Copyright (C) 2022-2023 Maxim Integrated Products, Inc. (now owned by
9 * Analog Devices, Inc.),
10 * Copyright (C) 2023-2024 Analog Devices, Inc.
11 *
12 * Licensed under the Apache License, Version 2.0 (the "License");
13 * you may not use this file except in compliance with the License.
14 * You may obtain a copy of the License at
15 *
16 * http://www.apache.org/licenses/LICENSE-2.0
17 *
18 * Unless required by applicable law or agreed to in writing, software
19 * distributed under the License is distributed on an "AS IS" BASIS,
20 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21 * See the License for the specific language governing permissions and
22 * limitations under the License.
23 *
24 ******************************************************************************/
25
26/* Define to prevent redundant inclusion */
27#ifndef LIBRARIES_PERIPHDRIVERS_INCLUDE_MAX78002_SDHC_H_
28#define LIBRARIES_PERIPHDRIVERS_INCLUDE_MAX78002_SDHC_H_
29
30/* **** Includes **** */
31#include "mxc_device.h"
32#include "sdhc_regs.h"
33
34#ifdef __cplusplus
35extern "C" {
36#endif
37
44/* **** Definitions **** */
45#define MXC_SDHC_Bus_Voltage_1_8 5
46#define MXC_SDHC_Bus_Voltage_3_0 6
47#define MXC_SDHC_Bus_Voltage_3_3 7
48
49#define MXC_SDHC_DIRECTION_CFG 0
50#define MXC_SDHC_DIRECTION_READ 1
51#define MXC_SDHC_DIRECTION_WRITE 2
52
57typedef struct {
58 unsigned int bus_voltage;
59 unsigned int block_gap;
60 unsigned int clk_div;
62
73typedef void (*mxc_sdhc_callback_fn)(int error_code);
74
79typedef struct {
80 uint32_t
82 uint32_t
84 uint32_t
86 uint32_t
88 unsigned int
90 unsigned int
92 uint32_t
94 uint32_t
99
100/* **** Function Prototypes **** */
101
110
115
120
128
133void MXC_SDHC_Set_Clock_Config(unsigned int clk_div);
134
142unsigned int MXC_SDHC_Get_Clock_Config(void);
143
149
168
179
186
193void MXC_SDHC_ClearFlags(uint32_t mask);
194
201unsigned MXC_SDHC_GetFlags(void);
202
207void MXC_SDHC_Reset(void);
208
214
221
227unsigned int MXC_SDHC_Get_Host_Cn_1(void);
228
236
244
251void MXC_SDHC_Get_Response128(unsigned char *response);
252
255#ifdef __cplusplus
256}
257#endif
258
259#endif // LIBRARIES_PERIPHDRIVERS_INCLUDE_MAX78002_SDHC_H_
unsigned int block_gap
Definition: sdhc.h:59
unsigned int dma
Definition: sdhc.h:89
uint32_t sdma
Definition: sdhc.h:81
uint32_t block_count
Definition: sdhc.h:85
unsigned int bus_voltage
Definition: sdhc.h:58
mxc_sdhc_callback_fn callback
Definition: sdhc.h:97
uint32_t block_size
Definition: sdhc.h:83
unsigned int clk_div
Definition: sdhc.h:60
uint32_t arg_1
Definition: sdhc.h:87
unsigned int direction
Definition: sdhc.h:91
uint32_t host_control_1
Definition: sdhc.h:95
uint32_t command
Definition: sdhc.h:93
void MXC_SDHC_Set_Clock_Config(unsigned int clk_div)
Set clock divider.
void(* mxc_sdhc_callback_fn)(int error_code)
Callback function type used in asynchromous SDHC communications requests.
Definition: sdhc.h:73
int MXC_SDHC_Shutdown(void)
Shutdown SDHC module.
unsigned MXC_SDHC_GetFlags(void)
Get interrupt flags.
void MXC_SDHC_PowerDown(void)
Disable SDHC Bus Power.
int MXC_SDHC_SendCommand(mxc_sdhc_cmd_cfg_t *sd_cmd_cfg)
Send Command, blocking.
void MXC_SDHC_Reset_CMD_DAT(void)
Abort any command or data transaction in progress on controller.
int MXC_SDHC_Init(const mxc_sdhc_cfg_t *cfg)
Initialize and enable SDHC module.
void MXC_SDHC_Reset(void)
Resets SDHC back to default settings.
void MXC_SDHC_ClearFlags(uint32_t mask)
Clear interrupt flags.
int MXC_SDHC_SendCommandAsync(mxc_sdhc_cmd_cfg_t *sd_cmd_cfg)
Send SDHC command Async.
int MXC_SDHC_Card_Busy(void)
Check if Card is busy.
unsigned int MXC_SDHC_Get_Clock_Config(void)
Get clock divider.
void MXC_SDHC_PowerUp(void)
Enable SDHC Bus Power.
void MXC_SDHC_Get_Response128(unsigned char *response)
Read a 128-bit command response.
unsigned int MXC_SDHC_Get_Host_Cn_1(void)
Retrieve host control 1 register.
uint32_t MXC_SDHC_Get_Response32(void)
Read a 32-bit command response.
uint32_t MXC_SDHC_Get_Response32_Auto(void)
Read a 32-bit command response for Auto commands.
void MXC_SDHC_Handler(void)
SDHC interrupt handler.
int MXC_SDHC_Card_Inserted(void)
See if card is inserted.
unsigned int MXC_SDHC_Get_Input_Clock_Freq(void)
Get the input clock frequency for the SDHC peripheral.
Used to configure voltage and clock for sdhc interface.
Definition: sdhc.h:57
Used to configure sdhc interface.
Definition: sdhc.h:79
Registers, Bit Masks and Bit Positions for the SDHC Peripheral Module.