LibXenon
Bare-metal Xbox 360 homebrew library
Loading...
Searching...
No Matches
Data Structures | Macros | Functions | Variables
xenon_sfcx.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  sfc
 

Macros

#define SFCX_CONFIG   0x00
 
#define SFCX_STATUS   0x04
 
#define SFCX_COMMAND   0x08
 
#define SFCX_ADDRESS   0x0C
 
#define SFCX_DATA   0x10
 
#define SFCX_LOGICAL   0x14
 
#define SFCX_PHYSICAL   0x18
 
#define SFCX_DPHYSADDR   0x1C
 
#define SFCX_MPHYSADDR   0x20
 
#define SFCX_PHISON   0xFC
 
#define PAGE_BUF_TO_REG   0x00
 
#define REG_TO_PAGE_BUF   0x01
 
#define LOG_PAGE_TO_BUF   0x02
 
#define PHY_PAGE_TO_BUF   0x03
 
#define WRITE_PAGE_TO_PHY   0x04
 
#define BLOCK_ERASE   0x05
 
#define DMA_LOG_TO_RAM   0x06
 
#define DMA_PHY_TO_RAM   0x07
 
#define DMA_RAM_TO_PHY   0x08
 
#define UNLOCK_CMD_0   0x55
 
#define UNLOCK_CMD_1   0xAA
 
#define CONFIG_DBG_MUX_SEL   0x7C000000u
 
#define CONFIG_DIS_EXT_ER   0x2000000u
 
#define CONFIG_CSR_DLY   0x1FE0000u
 
#define CONFIG_ULT_DLY   0x1F800u
 
#define CONFIG_BYPASS   0x400u
 
#define CONFIG_DMA_LEN   0x3C0u
 
#define CONFIG_FLSH_SIZE   0x30u
 
#define CONFIG_WP_EN   0x8u
 
#define CONFIG_INT_EN   0x4u
 
#define CONFIG_ECC_DIS   0x2u
 
#define CONFIG_SW_RST   0x1u
 
#define STATUS_ILL_LOG   0x800u
 
#define STATUS_PIN_WP_N   0x400u
 
#define STATUS_PIN_BY_N   0x200u
 
#define STATUS_INT_CP   0x100u
 
#define STATUS_ADDR_ER   0x80u
 
#define STATUS_BB_ER   0x40u
 
#define STATUS_RNP_ER   0x20u
 
#define STATUS_ECC_ER   0x1Cu
 
#define STATUS_WR_ER   0x2u
 
#define STATUS_BUSY   0x1u
 
#define STATUS_ERROR   (STATUS_ILL_LOG|STATUS_ADDR_ER|STATUS_BB_ER|STATUS_RNP_ER|STATUS_ECC_ER|STATUS_WR_ER)
 
#define PAGE_VALID   0x4000000u
 
#define PAGE_PID   0x3FFFE00u
 
#define MAX_PAGE_SZ   0x210
 
#define MAX_BLOCK_SZ   0x42000
 
#define META_TYPE_0   0x00
 
#define META_TYPE_1   0x01
 
#define META_TYPE_2   0x02
 
#define CONFIG_BLOCKS   0x04
 
#define RAW_NAND_64   0x4200000
 
#define SFCX_INITIALIZED   1
 
#define SFCX_SUCCESS(status)   ((status&STATUS_ERROR)==0)
 

Functions

unsigned int sfcx_init (void)
 
void sfcx_writereg (int addr, unsigned long data)
 
unsigned long sfcx_readreg (int addr)
 
int sfcx_erase_block (int address)
 
int sfcx_read_page (unsigned char *data, int address, int raw)
 
int sfcx_write_page (unsigned char *data, int address)
 
int sfcx_read_block (unsigned char *data, int address, int raw)
 
int sfcx_write_block (unsigned char *data, int address)
 
void sfcx_calcecc (unsigned int *data)
 
int sfcx_get_blocknumber (unsigned char *data)
 
void sfcx_set_blocknumber (unsigned char *data, int num)
 
int sfcx_get_blockversion (unsigned char *data)
 
void sfcx_set_blockversion (unsigned char *data, int ver)
 
void sfcx_set_pagevalid (unsigned char *data)
 
void sfcx_set_pageinvalid (unsigned char *data)
 
int sfcx_is_pagevalid (unsigned char *data)
 
int sfcx_is_pagezeroed (unsigned char *data)
 
int sfcx_is_pageerased (unsigned char *data)
 
int sfcx_block_to_address (int block)
 
int sfcx_address_to_block (int address)
 
int sfcx_block_to_rawaddress (int block)
 
int sfcx_rawaddress_to_block (int address)
 
int rawflash_writeImage (int len, int f)
 
int try_rawflash (char *filename)
 
int sfcx_read_metadata_type (void)
 

Variables

struct sfc sfc
 

Macro Definition Documentation

◆ BLOCK_ERASE

#define BLOCK_ERASE   0x05

Definition at line 22 of file xenon_sfcx.h.

◆ CONFIG_BLOCKS

#define CONFIG_BLOCKS   0x04

Definition at line 68 of file xenon_sfcx.h.

◆ CONFIG_BYPASS

#define CONFIG_BYPASS   0x400u

Definition at line 34 of file xenon_sfcx.h.

◆ CONFIG_CSR_DLY

#define CONFIG_CSR_DLY   0x1FE0000u

Definition at line 32 of file xenon_sfcx.h.

◆ CONFIG_DBG_MUX_SEL

#define CONFIG_DBG_MUX_SEL   0x7C000000u

Definition at line 30 of file xenon_sfcx.h.

◆ CONFIG_DIS_EXT_ER

#define CONFIG_DIS_EXT_ER   0x2000000u

Definition at line 31 of file xenon_sfcx.h.

◆ CONFIG_DMA_LEN

#define CONFIG_DMA_LEN   0x3C0u

Definition at line 35 of file xenon_sfcx.h.

◆ CONFIG_ECC_DIS

#define CONFIG_ECC_DIS   0x2u

Definition at line 39 of file xenon_sfcx.h.

◆ CONFIG_FLSH_SIZE

#define CONFIG_FLSH_SIZE   0x30u

Definition at line 36 of file xenon_sfcx.h.

◆ CONFIG_INT_EN

#define CONFIG_INT_EN   0x4u

Definition at line 38 of file xenon_sfcx.h.

◆ CONFIG_SW_RST

#define CONFIG_SW_RST   0x1u

Definition at line 40 of file xenon_sfcx.h.

◆ CONFIG_ULT_DLY

#define CONFIG_ULT_DLY   0x1F800u

Definition at line 33 of file xenon_sfcx.h.

◆ CONFIG_WP_EN

#define CONFIG_WP_EN   0x8u

Definition at line 37 of file xenon_sfcx.h.

◆ DMA_LOG_TO_RAM

#define DMA_LOG_TO_RAM   0x06

Definition at line 23 of file xenon_sfcx.h.

◆ DMA_PHY_TO_RAM

#define DMA_PHY_TO_RAM   0x07

Definition at line 24 of file xenon_sfcx.h.

◆ DMA_RAM_TO_PHY

#define DMA_RAM_TO_PHY   0x08

Definition at line 25 of file xenon_sfcx.h.

◆ LOG_PAGE_TO_BUF

#define LOG_PAGE_TO_BUF   0x02

Definition at line 19 of file xenon_sfcx.h.

◆ MAX_BLOCK_SZ

#define MAX_BLOCK_SZ   0x42000

Definition at line 62 of file xenon_sfcx.h.

◆ MAX_PAGE_SZ

#define MAX_PAGE_SZ   0x210

Definition at line 61 of file xenon_sfcx.h.

◆ META_TYPE_0

#define META_TYPE_0   0x00

Definition at line 64 of file xenon_sfcx.h.

◆ META_TYPE_1

#define META_TYPE_1   0x01

Definition at line 65 of file xenon_sfcx.h.

◆ META_TYPE_2

#define META_TYPE_2   0x02

Definition at line 66 of file xenon_sfcx.h.

◆ PAGE_BUF_TO_REG

#define PAGE_BUF_TO_REG   0x00

Definition at line 17 of file xenon_sfcx.h.

◆ PAGE_PID

#define PAGE_PID   0x3FFFE00u

Definition at line 57 of file xenon_sfcx.h.

◆ PAGE_VALID

#define PAGE_VALID   0x4000000u

Definition at line 56 of file xenon_sfcx.h.

◆ PHY_PAGE_TO_BUF

#define PHY_PAGE_TO_BUF   0x03

Definition at line 20 of file xenon_sfcx.h.

◆ RAW_NAND_64

#define RAW_NAND_64   0x4200000

Definition at line 74 of file xenon_sfcx.h.

◆ REG_TO_PAGE_BUF

#define REG_TO_PAGE_BUF   0x01

Definition at line 18 of file xenon_sfcx.h.

◆ SFCX_ADDRESS

#define SFCX_ADDRESS   0x0C

Definition at line 8 of file xenon_sfcx.h.

◆ SFCX_COMMAND

#define SFCX_COMMAND   0x08

Definition at line 7 of file xenon_sfcx.h.

◆ SFCX_CONFIG

#define SFCX_CONFIG   0x00

Definition at line 5 of file xenon_sfcx.h.

◆ SFCX_DATA

#define SFCX_DATA   0x10

Definition at line 9 of file xenon_sfcx.h.

◆ SFCX_DPHYSADDR

#define SFCX_DPHYSADDR   0x1C

Definition at line 12 of file xenon_sfcx.h.

◆ SFCX_INITIALIZED

#define SFCX_INITIALIZED   1

Definition at line 76 of file xenon_sfcx.h.

◆ SFCX_LOGICAL

#define SFCX_LOGICAL   0x14

Definition at line 10 of file xenon_sfcx.h.

◆ SFCX_MPHYSADDR

#define SFCX_MPHYSADDR   0x20

Definition at line 13 of file xenon_sfcx.h.

◆ SFCX_PHISON

#define SFCX_PHISON   0xFC

Definition at line 14 of file xenon_sfcx.h.

◆ SFCX_PHYSICAL

#define SFCX_PHYSICAL   0x18

Definition at line 11 of file xenon_sfcx.h.

◆ SFCX_STATUS

#define SFCX_STATUS   0x04

Definition at line 6 of file xenon_sfcx.h.

◆ SFCX_SUCCESS

#define SFCX_SUCCESS (   status)    ((status&STATUS_ERROR)==0)

Definition at line 81 of file xenon_sfcx.h.

◆ STATUS_ADDR_ER

#define STATUS_ADDR_ER   0x80u

Definition at line 47 of file xenon_sfcx.h.

◆ STATUS_BB_ER

#define STATUS_BB_ER   0x40u

Definition at line 48 of file xenon_sfcx.h.

◆ STATUS_BUSY

#define STATUS_BUSY   0x1u

Definition at line 52 of file xenon_sfcx.h.

◆ STATUS_ECC_ER

#define STATUS_ECC_ER   0x1Cu

Definition at line 50 of file xenon_sfcx.h.

◆ STATUS_ERROR

Definition at line 53 of file xenon_sfcx.h.

◆ STATUS_ILL_LOG

#define STATUS_ILL_LOG   0x800u

Definition at line 43 of file xenon_sfcx.h.

◆ STATUS_INT_CP

#define STATUS_INT_CP   0x100u

Definition at line 46 of file xenon_sfcx.h.

◆ STATUS_PIN_BY_N

#define STATUS_PIN_BY_N   0x200u

Definition at line 45 of file xenon_sfcx.h.

◆ STATUS_PIN_WP_N

#define STATUS_PIN_WP_N   0x400u

Definition at line 44 of file xenon_sfcx.h.

◆ STATUS_RNP_ER

#define STATUS_RNP_ER   0x20u

Definition at line 49 of file xenon_sfcx.h.

◆ STATUS_WR_ER

#define STATUS_WR_ER   0x2u

Definition at line 51 of file xenon_sfcx.h.

◆ UNLOCK_CMD_0

#define UNLOCK_CMD_0   0x55

Definition at line 26 of file xenon_sfcx.h.

◆ UNLOCK_CMD_1

#define UNLOCK_CMD_1   0xAA

Definition at line 27 of file xenon_sfcx.h.

◆ WRITE_PAGE_TO_PHY

#define WRITE_PAGE_TO_PHY   0x04

Definition at line 21 of file xenon_sfcx.h.

Function Documentation

◆ rawflash_writeImage()

int rawflash_writeImage ( int  len,
int  f 
)

Definition at line 504 of file xenon_sfcx.c.

◆ sfcx_address_to_block()

int sfcx_address_to_block ( int  address)

Definition at line 377 of file xenon_sfcx.c.

◆ sfcx_block_to_address()

int sfcx_block_to_address ( int  block)

Definition at line 372 of file xenon_sfcx.c.

◆ sfcx_block_to_rawaddress()

int sfcx_block_to_rawaddress ( int  block)

Definition at line 382 of file xenon_sfcx.c.

◆ sfcx_calcecc()

void sfcx_calcecc ( unsigned int *  data)

Definition at line 211 of file xenon_sfcx.c.

◆ sfcx_erase_block()

int sfcx_erase_block ( int  address)

Definition at line 150 of file xenon_sfcx.c.

◆ sfcx_get_blocknumber()

int sfcx_get_blocknumber ( unsigned char *  data)

Definition at line 217 of file xenon_sfcx.c.

◆ sfcx_get_blockversion()

int sfcx_get_blockversion ( unsigned char *  data)

Definition at line 254 of file xenon_sfcx.c.

◆ sfcx_init()

unsigned int sfcx_init ( void  )

Definition at line 645 of file xenon_sfcx.c.

◆ sfcx_is_pageerased()

int sfcx_is_pageerased ( unsigned char *  data)

Definition at line 361 of file xenon_sfcx.c.

◆ sfcx_is_pagevalid()

int sfcx_is_pagevalid ( unsigned char *  data)

Definition at line 332 of file xenon_sfcx.c.

◆ sfcx_is_pagezeroed()

int sfcx_is_pagezeroed ( unsigned char *  data)

Definition at line 350 of file xenon_sfcx.c.

◆ sfcx_rawaddress_to_block()

int sfcx_rawaddress_to_block ( int  address)

Definition at line 387 of file xenon_sfcx.c.

◆ sfcx_read_block()

int sfcx_read_block ( unsigned char *  data,
int  address,
int  raw 
)

Definition at line 121 of file xenon_sfcx.c.

◆ sfcx_read_metadata_type()

int sfcx_read_metadata_type ( void  )

◆ sfcx_read_page()

int sfcx_read_page ( unsigned char *  data,
int  address,
int  raw 
)

Definition at line 25 of file xenon_sfcx.c.

◆ sfcx_readreg()

unsigned long sfcx_readreg ( int  addr)

Definition at line 20 of file xenon_sfcx.c.

◆ sfcx_set_blocknumber()

void sfcx_set_blocknumber ( unsigned char *  data,
int  num 
)

Definition at line 235 of file xenon_sfcx.c.

◆ sfcx_set_blockversion()

void sfcx_set_blockversion ( unsigned char *  data,
int  ver 
)

Definition at line 275 of file xenon_sfcx.c.

◆ sfcx_set_pageinvalid()

void sfcx_set_pageinvalid ( unsigned char *  data)

Definition at line 316 of file xenon_sfcx.c.

◆ sfcx_set_pagevalid()

void sfcx_set_pagevalid ( unsigned char *  data)

Definition at line 300 of file xenon_sfcx.c.

◆ sfcx_write_block()

int sfcx_write_block ( unsigned char *  data,
int  address 
)

Definition at line 136 of file xenon_sfcx.c.

◆ sfcx_write_page()

int sfcx_write_page ( unsigned char *  data,
int  address 
)

Definition at line 74 of file xenon_sfcx.c.

◆ sfcx_writereg()

void sfcx_writereg ( int  addr,
unsigned long  data 
)

Definition at line 15 of file xenon_sfcx.c.

◆ try_rawflash()

int try_rawflash ( char *  filename)

Definition at line 559 of file xenon_sfcx.c.

Variable Documentation

◆ sfc

struct sfc sfc
extern

Definition at line 10 of file xenon_sfcx.c.