Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zynq7000: add SD card storage driver #433

Merged
merged 2 commits into from
Nov 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion _targets/Makefile.armv7a9-zynq7000
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@
DEFAULT_COMPONENTS := zynq7000-uart uart16550 zynq7000-pwm zynq7000-xgpio zynq7000-spi zynq7000-xspi zynq7000-gpio
DEFAULT_COMPONENTS += libflashdrv-zynq zynq7000-flash test_flashdrv libspi-msg libzynq7000-gpio-msg libzynq7000pwm
DEFAULT_COMPONENTS += libsensors sensors
DEFAULT_COMPONENTS += zynq7000-i2c
DEFAULT_COMPONENTS += zynq7000-i2c zynq7000-sdcard
10 changes: 10 additions & 0 deletions libmbr/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#
# Makefile for Phoenix-RTOS MBR library
#
# Copyright 2023 Phoenix Systems
#

NAME := libmbr
LOCAL_HEADERS := libmbr.h

include $(static-lib.mk)
47 changes: 47 additions & 0 deletions libmbr/libmbr.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*
* Phoenix-RTOS
*
* Master Boot Record
*
* Copyright 2017, 2020 Phoenix Systems
* Author: Kamil Amanowicz, Lukasz Kosinski
*
* This file is part of Phoenix-RTOS.
*
* %LICENSE%
*/

#ifndef _MBR_H_
#define _MBR_H_

#include <stdint.h>


/* Misc definitions */
#define MBR_MAGIC 0xaa55


/* Partition types */
enum {
PENTRY_LINUX = 0x83, /* Any native Linux partition */
PENTRY_PROTECTIVE = 0xee /* Protective MBR mode for GPT partition table */
};


typedef struct {
uint8_t status; /* Partition status */
uint8_t first[3]; /* First sector (CHS) */
uint8_t type; /* Partition type */
uint8_t last[3]; /* Last sector (CHS) */
uint32_t start; /* Partition start (LBA) */
uint32_t sectors; /* Number of sectors */
} __attribute__((packed)) pentry_t;


typedef struct {
char bca[446]; /* Bootstrap Code Area */
pentry_t pent[4]; /* Partition entries */
uint16_t magic; /* MBR magic */
} __attribute__((packed)) mbr_t;

#endif
21 changes: 21 additions & 0 deletions storage/zynq7000-sdcard/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#
# Phoenix-RTOS
#
# SD card driver
#
# Copyright 2023 Phoenix Systems
# Author: Jacek Maksymowicz
#

NAME := libsdcard-zynq
LOCAL_SRCS := sdcard.c zynq7000-sdio.c
LOCAL_HEADERS := sdcard.h

include $(static-lib.mk)

NAME := zynq7000-sdcard
LOCAL_SRCS := sdstorage_dev.c sdstorage_srv.c
DEP_LIBS := libmbr libsdcard-zynq
LIBS := libstorage libcache libmtd libjffs2 libext2

include $(binary.mk)
Loading
Loading