Skip to content

Instantly share code, notes, and snippets.

@shuffle2
shuffle2 / lzra.h
Created Apr 6, 2021
LZRA Decompressor
View lzra.h
/* LZRA Decompressor
* The format appears similar to LZRC (see tlzrc.c)
*/
#include <array>
#include <cstdint>
#include <cstring>
#include <cstdio>
typedef uint8_t u8;
typedef uint32_t u32;
View rgmii_phy_status.diff
diff --git a/liteeth/phy/ecp5rgmii.py b/liteeth/phy/ecp5rgmii.py
index 9bb1999..8899aaa 100644
--- a/liteeth/phy/ecp5rgmii.py
+++ b/liteeth/phy/ecp5rgmii.py
@@ -66,8 +66,10 @@ class LiteEthPHYRGMIIRX(Module):
assert rx_delay_taps < 128
rx_ctl_delayf = Signal()
- rx_ctl = Signal()
- rx_ctl_reg = Signal()
View pll.v
// attempting to create 100mhz ->pll-> 125mhz
// note clarity seems to suggest buffering clk100 since it's coming from pads, and
// various parameters differ from litex (besides defaulted ones)
// litex
(* FREQUENCY_PIN_CLKI = "100.0",
ICP_CURRENT = "6",
LPF_RESISTOR = "16",
MFG_ENABLE_FILTEROPAMP = "1",
MFG_GMCREF_SEL = "2" *)
View set_affinity.c
int set_affinity(int cpu) {
int policy = SCHED_FIFO;
struct sched_param param = {
.sched_priority = sched_get_priority_max(policy)
};
pthread_setschedparam(pthread_self(), policy, &param);
cpu_set_t cpuset;
CPU_ZERO(&cpuset);
CPU_SET(cpu, &cpuset);
View arm-toolchain.cmake
# arm core is ARM7TDMI-S
set(CMAKE_SYSTEM_NAME Generic)
set(CMAKE_C_COMPILER arm-none-eabi-gcc)
set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
#set(CMAKE_C_STANDARD 11)
#set(CMAKE_C_EXTENSIONS, TRUE)
View lzra_decompress.c
void LZRA_decompress(u8 *dest, u32 out_size, u8 *compress_data, u8 **next_ptr) {
u8 *input; // r11@1
int v7; // r3@1
u8 v8; // r6@1
int v9; // r4@1
s32 v10; // lr@7
u8 *v11; // r12@7
u32 v12; // r9@7
s32 v13; // r3@7
u8 *v14; // r1@8
@shuffle2
shuffle2 / fuses.c
Created Oct 17, 2017
dump + decode tegra t210 ipatches
View fuses.c
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/mman.h>
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#define ARRAYSIZE(x) (sizeof(x) / sizeof(*x))
@shuffle2
shuffle2 / brcm_flash.c
Created Sep 20, 2017
joycon command handling
View brcm_flash.c
unsigned __int8 *__fastcall process_cmd(struct_a1 *a1, int a2, int a3, unsigned __int8 *pkt, signed int pkt_len)
{
unsigned __int8 *pkt_; // r0@1 MAPDST
int v10; // r0@2
int v11; // r12@8
unsigned __int8 v12; // r0@13
signed int b0; // r0@15
int v14; // r0@38
unsigned __int8 v15; // r1@46
unsigned int v16; // r2@51
@shuffle2
shuffle2 / pro_brcm_fw0.txt
Last active Jul 12, 2017
parsing switch pro controller fw on flash
View pro_brcm_fw0.txt
0a: d0200: d02f7 b'00f0d0f910bd00000fb401f07bf80fbc04460068b7f786bf0fb401f0e2f9012803d10fbc4ff0010070bd0fbc04464ff6ff754df7dfbd0000384629460daa01f005fa94f76fff01f065fa92f78cff000001f010fcfebd044601f098fc70bd01f0aefcbde8f08101f0e8fc70bd02f095faf8bdbde8fc4702f0f3bb000002f06efc10bd000002f096fc70bd0000f0bc02f0fbbe000002f0beffbde8f88f03f0e2f8bde8f08107b0bde8f04f03f054babde8f04103f0b5bcbde8f04103f036bdbde8f04103f0bcbd000003f0b6fffebd0000bde8f04104f07cb9069dd9f755fa3a4600214046d9f750fac4f800806660d5f7d2bc2046d5f777'
0a: d02f7: d03ee b'fd6ff30b00216ad5f797bd0a600021816110bd000004f04dfca84200d2054654f7c3be0000bde87c4005f07cb84021b9f1010f02d1c7f14000c1b265f78cfb000000b54bf753fc05f08ff94bf75bbc00b54bf74cfc05f093f94bf754bc00b54bf745fc05f097f94bf74dbceff305803028e6d03128ebd03228f0d00ef00f00012802d1eff3088001e0eff3098021462a46334654f7fdf900b54bf726fcfee7000001d565f797f843f7e4f805f07ff965f718fa05f094f967f763ff65f771f9000005f0b4b905f0e8f91cbd000005f0c8fa30bd000005f023fbbde8fc9f05f0b3fb10bd05f0bdfb10bd05f05aff70bd05
@shuffle2
shuffle2 / so_socket.c
Last active Jun 4, 2017
IOS56 SO socket
View so_socket.c
int __fastcall so_set_fd_entry(sock_fd_node *node, int fd)
{
int proto; // r5@3
unsigned __int8 *v5; // r7@3
int v6; // r8@3
__int16 v7; // r2@3
int v9; // r4@15
int v10; // r3@15
int v11; // [sp+14h] [bp-4h]@0