-
Notifications
You must be signed in to change notification settings - Fork 106
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
309 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* spi_drv_rx65n.c | ||
* | ||
* Driver for the SPI back-end of the SPI_FLASH module. | ||
* | ||
* Example implementation for Renesas RX65N. | ||
* | ||
* Copyright (C) 2024 wolfSSL Inc. | ||
* | ||
* This file is part of wolfBoot. | ||
* | ||
* wolfBoot is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; either version 2 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* wolfBoot is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program; if not, write to the Free Software | ||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA | ||
*/ | ||
#include <stdint.h> | ||
#include "spi_drv.h" | ||
#include "spi_drv_rx65n.h" | ||
|
||
#if defined(SPI_FLASH) || defined(WOLFBOOT_TPM) | ||
|
||
|
||
#ifdef WOLFBOOT_TPM | ||
int spi_xfer(int cs, const uint8_t* tx, uint8_t* rx, uint32_t sz, int flags) | ||
{ | ||
uint32_t i; | ||
spi_cs_on(SPI_CS_TPM_PIO_BASE, cs); | ||
for (i = 0; i < sz; i++) { | ||
spi_write((const char)tx[i]); | ||
rx[i] = spi_read(); | ||
} | ||
if (!(flags & SPI_XFER_FLAG_CONTINUE)) { | ||
spi_cs_off(SPI_CS_TPM_PIO_BASE, cs); | ||
} | ||
return 0; | ||
} | ||
#endif /* WOLFBOOT_TPM */ | ||
|
||
#endif /* SPI_FLASH || WOLFBOOT_TPM */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/* spi_drv_rx65n.h | ||
* | ||
* wolfBoot is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; either version 2 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* wolfBoot is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program; if not, write to the Free Software | ||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA | ||
*/ | ||
|
||
#ifndef SPI_DRV_RX65N_H_INCLUDED | ||
#define SPI_DRV_RX65N_H_INCLUDED | ||
#include <stdint.h> | ||
|
||
#define SPI_CS_FLASH 0 | ||
#define SPI_CS_PIO_BASE 0UL | ||
|
||
#endif /* !SPI_DRV_RX65N_H_INCLUDED */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters