Fix: Correct the copyright and avoid repeated inclusion of header files.
This commit is contained in:
parent
ce26824ed9
commit
4a9dbdaeda
@ -20,6 +20,4 @@
|
||||
#define BOOTROM_USB_WRITE_EP1 0x001065C0
|
||||
#define BOOTROM_USB_READ_EP1 0x00106612
|
||||
|
||||
|
||||
|
||||
#endif
|
@ -1,6 +1,7 @@
|
||||
/*
|
||||
* Copyright (c) 2024 hydrogenium2020-offical
|
||||
* Copyright (c) 2018 naehrwert
|
||||
* Copyright (c) 2018-2022 CTCaer
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
|
@ -1 +1,23 @@
|
||||
void config_gpios();
|
||||
/*
|
||||
* Copyright (c) 2024 hydrogenium2020-offical
|
||||
* Copyright (c) 2018 naehrwert
|
||||
* Copyright (c) 2019-2023 CTCaer
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
* version 2, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef _T124_GPIO_H_
|
||||
#define _T124_GPIO_H_
|
||||
|
||||
void config_gpios();
|
||||
|
||||
#endif
|
||||
|
39
loader/i2c.c
Normal file
39
loader/i2c.c
Normal file
@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Copyright (c) 2024 hydrogenium2020-offical
|
||||
* Copyright (c) 2018 naehrwert
|
||||
* Copyright (c) 2020 CTCaer
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
* version 2, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "types.h"
|
||||
#include "i2c.h"
|
||||
void i2c_init(u32 i2c_idx)
|
||||
{
|
||||
vu32 *base = (vu32 *)(I2C_BASE + (u32)_i2c_base_offsets[i2c_idx]);
|
||||
|
||||
base[I2C_CLK_DIVISOR] = (5 << 16) | 1; // SF mode Div: 6, HS mode div: 2.
|
||||
base[I2C_BUS_CLEAR_CONFIG] = (9 << 16) | BC_TERMINATE | BC_ENABLE;
|
||||
|
||||
// Load configuration.
|
||||
_i2c_load_cfg_wait(base);
|
||||
|
||||
for (u32 i = 0; i < 10; i++)
|
||||
{
|
||||
if (base[I2C_INT_STATUS] & BUS_CLEAR_DONE)
|
||||
break;
|
||||
usleep(25);
|
||||
}
|
||||
|
||||
(vu32)base[I2C_BUS_CLEAR_STATUS];
|
||||
base[I2C_INT_STATUS] = base[I2C_INT_STATUS];
|
||||
}
|
19
loader/i2c.h
19
loader/i2c.h
@ -1,22 +1,7 @@
|
||||
/*
|
||||
* Copyright (c) 2018 naehrwert
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
* version 2, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2024 hydrogenium2020-offical
|
||||
* Copyright (c) 2018 naehrwert
|
||||
* Copyright (c) 2020 CTCaer
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
@ -42,6 +27,6 @@
|
||||
#define I2C_5 4
|
||||
#define I2C_6 5
|
||||
|
||||
void i2c_init(u32 idx);
|
||||
void i2c_init(u32 i2c_idx);
|
||||
|
||||
#endif
|
||||
|
@ -1,6 +1,7 @@
|
||||
/*
|
||||
* Copyright (c) 2024 hydrogenium2020-offical
|
||||
* Copyright (c) 2018 naehrwert
|
||||
* Copyright (c) 2018-2023 CTCaer
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
@ -17,9 +18,7 @@
|
||||
#include "types.h"
|
||||
#include "printf.h"
|
||||
#include "string.h"
|
||||
|
||||
#include "t124.h"
|
||||
#include "se.h"
|
||||
#include "usb.h"
|
||||
#include "bootrom.h"
|
||||
#include "fuse.h"
|
||||
@ -28,8 +27,9 @@
|
||||
#include "util.h"
|
||||
#include "pinmux.h"
|
||||
#include "gpio.h"
|
||||
#include "i2c.h"
|
||||
#include "uart.h"
|
||||
#include "sdram.h"
|
||||
#include "memory_map.h"
|
||||
|
||||
static inline u32 read32(uintptr_t addr) {
|
||||
return *(vu32 *)addr;
|
||||
@ -76,36 +76,47 @@ void config_hw(){
|
||||
// uart_init(UART_D, 115200, UART_AO_TX_AO_RX);
|
||||
// uart_invert(UART_D, 0, UART_INVERT_TXD);
|
||||
|
||||
uart_send(UART_D, (u8 *)"hekate: Hello!\r\n", 16);
|
||||
uart_wait_xfer(UART_D, UART_TX_IDLE);
|
||||
//uart_send(UART_D, (u8 *)"hekate: Hello!\r\n", 16);
|
||||
//uart_wait_xfer(UART_D, UART_TX_IDLE);
|
||||
|
||||
mc_enable();
|
||||
printf_("[x] mc setup\n");
|
||||
// mc_enable();
|
||||
// printf_("[x] mc setup\n");
|
||||
|
||||
config_gpios();
|
||||
printf_("[x] GPIO setup\n");
|
||||
|
||||
|
||||
sdram_init();
|
||||
printf_("[x] SDRAM setup\n");
|
||||
|
||||
}
|
||||
extern void pivot_stack(u32 stack_top);
|
||||
__attribute__((section(".init")))
|
||||
void _start() {
|
||||
// u8 *buffer = (u8*)0x40020000;
|
||||
printf_("gardenia is booting.");
|
||||
printf_("gardenia is booting.\n");
|
||||
|
||||
//printf_("%p",&_start);
|
||||
//pivot_stack(0x200);
|
||||
|
||||
//Setting up hardware
|
||||
dump_pkc();
|
||||
config_hw();
|
||||
|
||||
//FIXME!!!->init memory
|
||||
//Pivot the stack so we have enough space.
|
||||
// pivot_stack(0x40000000);
|
||||
printf_("%d\n",MMIO_REG32(0x90010000,0));
|
||||
MMIO_REG32(0x90010000,0)=0x123456;
|
||||
printf_("%d\n",MMIO_REG32(0x90010000,0));
|
||||
sleep(200);
|
||||
printf_("%d\n",MMIO_REG32(0x90010000,0));
|
||||
|
||||
//Tegra/Horizon configuration goes to 0x80000000+, package2 goes to 0xA9800000, we place our heap in between.
|
||||
// heap_init(0x90020000);
|
||||
u32 total_size = (MC(MC_EMEM_CFG) >>
|
||||
MC_EMEM_CFG_SIZE_MB_SHIFT) & MC_EMEM_CFG_SIZE_MB_MASK;
|
||||
|
||||
printf_("Total SDRAM (MB): %u\n", total_size);
|
||||
|
||||
//Pivot the stack so we have enough space.
|
||||
pivot_stack(IPL_STACK_TOP);
|
||||
printf_("alive");
|
||||
|
||||
heap_init(IPL_HEAP_START);
|
||||
|
||||
enter_rcm();
|
||||
}
|
||||
|
38
loader/pmc.h
38
loader/pmc.h
@ -1,6 +1,7 @@
|
||||
/*
|
||||
* Copyright (c) 2024 hydrogenium2020-offical
|
||||
* Copyright (c) 2018 naehrwert
|
||||
* Copyright (c) 2020 CTCaer
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
@ -14,9 +15,44 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef _T124_PMC_H_
|
||||
#define _T124_PMC_H_
|
||||
|
||||
#include "types.h"
|
||||
#define APBDEV_PMC_OSC_EDPD_OVER 0x1A4
|
||||
|
||||
//SDRAM
|
||||
#define APBDEV_PMC_VDDP_SEL 0x1CC
|
||||
#define APBDEV_PMC_DDR_PWR 0xE8
|
||||
#define APBDEV_PMC_NO_IOPOWER 0x44
|
||||
#define APBDEV_PMC_REG_SHORT 0x2CC
|
||||
#define APBDEV_PMC_DDR_CFG 0x1D0
|
||||
#define APBDEV_PMC_POR_DPD_CTRL 0x264
|
||||
#define APBDEV_PMC_IO_DPD3_REQ 0x45c
|
||||
enum {
|
||||
PMC_XOFS_SHIFT = 1,
|
||||
PMC_XOFS_MASK = 0x3f << PMC_XOFS_SHIFT
|
||||
};
|
||||
};
|
||||
|
||||
enum {
|
||||
PMC_POR_DPD_CTRL_MEM0_ADDR0_CLK_SEL_DPD_MASK = 1 << 0,
|
||||
PMC_POR_DPD_CTRL_MEM0_ADDR1_CLK_SEL_DPD_MASK = 1 << 1,
|
||||
PMC_POR_DPD_CTRL_MEM0_HOLD_CKE_LOW_OVR_MASK = 1 << 31,
|
||||
};
|
||||
enum {
|
||||
PMC_DDR_CFG_PKG_MASK = 1 << 0,
|
||||
PMC_DDR_CFG_IF_MASK = 1 << 1,
|
||||
PMC_DDR_CFG_XM0_RESET_TRI_MASK = 1 << 12,
|
||||
PMC_DDR_CFG_XM0_RESET_DPDIO_MASK = 1 << 13,
|
||||
};
|
||||
enum {
|
||||
PMC_DDR_PWR_EMMC_MASK = 1 << 1,
|
||||
PMC_DDR_PWR_VAL_MASK = 1 << 0,
|
||||
};
|
||||
enum {
|
||||
PMC_NO_IOPOWER_MEM_MASK = 1 << 7,
|
||||
PMC_NO_IOPOWER_MEM_COMP_MASK = 1 << 16,
|
||||
};
|
||||
|
||||
#endif
|
@ -14,5 +14,9 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef _T124_TIMER_H_
|
||||
#define _T124_TIMER_H_
|
||||
|
||||
#define TIMERUS_CNTR_1US (0x10 + 0x0)
|
||||
#define TIMERUS_USEC_CFG (0x10 + 0x4)
|
||||
|
||||
#endif
|
@ -1,3 +1,21 @@
|
||||
/*
|
||||
* Copyright (c) 2018 naehrwert
|
||||
* Copyright (c) 2019-2022 CTCaer
|
||||
* Copyright (c) 2024 hydrogenium2020-offical
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
* version 2, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "uart.h"
|
||||
#include "t124.h"
|
||||
#include "util.h"
|
||||
|
@ -1,3 +1,23 @@
|
||||
/*
|
||||
* Copyright (c) 2018 naehrwert
|
||||
* Copyright (c) 2019-2020 CTCaer
|
||||
* Copyright (c) 2024 hydrogenium2020-offical
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
* version 2, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef _T124_UART_H_
|
||||
#define _T124_UART_H_
|
||||
|
||||
#include "types.h"
|
||||
#define UART_A 0
|
||||
#define UART_B 1
|
||||
@ -80,4 +100,6 @@ typedef struct _uart_t
|
||||
void uart_wait_xfer(u32 idx, u32 which);
|
||||
void uart_invert(u32 idx, u32 enable, u32 invert_mask);
|
||||
void uart_init(u32 idx, u32 baud, u32 mode);
|
||||
void uart_send(u32 idx, const u8 *buf, u32 len);
|
||||
void uart_send(u32 idx, const u8 *buf, u32 len);
|
||||
|
||||
#endif
|
||||
|
@ -1,6 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2024 hydrogenium2020-offical
|
||||
* Copyright (c) 2018 naehrwert
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
|
@ -1,6 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2024 hydrogenium2020-offical
|
||||
* Copyright (c) 2018 naehrwert
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
@ -14,8 +13,8 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef _T124_UTIL_H_
|
||||
#define _T124_UTIL_H_
|
||||
#ifndef _T124_USB_H_
|
||||
#define _T124_USB_H_
|
||||
#include "types.h"
|
||||
#define USB_MAX_TXFR_BYTES 0x1000
|
||||
u32 _usb_log(char *msg);
|
||||
|
@ -25,3 +25,21 @@ void sleep(u32 ticks)
|
||||
while (TIMER0(TIMERUS_CNTR_1US) - start <= ticks)
|
||||
;
|
||||
}
|
||||
// static inline void setbits32(uint32_t bits, void *addr)
|
||||
// {
|
||||
// write32(addr, read32(addr) | bits);
|
||||
// }
|
||||
|
||||
// static inline void clrbits32(uint32_t bits, void *addr)
|
||||
// {
|
||||
// write32(addr, read32(addr) & ~bits);
|
||||
// }
|
||||
|
||||
|
||||
// void clrsetbits32(addr, mask, set){
|
||||
// MMIO_REG32(addr,0)=MMIO_REG32(addr,0) &~(mask) | (value & mask);
|
||||
// }
|
||||
// static void writebits(uint32_t value, uint32_t *addr, uint32_t mask)
|
||||
// {
|
||||
// clrsetbits32(addr, mask, (value & mask));
|
||||
// }
|
||||
|
@ -1,18 +1,23 @@
|
||||
/*
|
||||
* Copyright (c) 2024 hydrogenium2020-offical
|
||||
* Copyright (c) 2018 naehrwert
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
* version 2, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
* Copyright (c) 2024 hydrogenium2020-offical
|
||||
* Copyright (c) 2019 CTCaer
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
* version 2, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef _T124_UTIL_H_
|
||||
#define _T124_UTIL_H_
|
||||
|
||||
#include "types.h"
|
||||
void sleep(u32 ticks);
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user