<commit_before>/*
 * Author: <NAME> <<EMAIL>>
 * Bitcoin:	1CanaaniJzgps8EV6Sfmpb7T8RutpaeyFn
 *
 * This is free and unencumbered software released into the public domain.
 * For details see the UNLICENSE file at the root of the source tree.
 */

#ifndef _SYSTEM_CONFIG_H_
#define _SYSTEM_CONFIG_H_

#define CPU_FREQUENCY		(50 * 1000 * 1000) /* 50Mhz */
#define UART_BAUD_RATE          (115200)

#define SPI_BASE		(0x80000000)
#define UART0_BASE		(0x80000100)
#define GPIO_BASE		(0x80000200)
#define UART1_BASE		(0x80000300)
#define SHA256_BASE		(0x80000400)
#define ALINK_BASE		(0x80000500)
#define TWIPWM_BASE		(0x80000600)


/* Line status register */
#define LM32_UART_LSR_DR	(1 << 0)
#define LM32_UART_LSR_THRR	(1 << 5)
#define LM32_UART_LSR_TEMT	(1 << 6)

/* Line control register */
#define LM32_UART_LCR_WLS0	(1 << 0)
#define LM32_UART_LCR_WLS1	(1 << 1)
#define LM32_UART_LCR_8BIT	(LM32_UART_LCR_WLS1 | LM32_UART_LCR_WLS0)

/* Modem control register */
#define LM32_UART_MCR_DTR	(1 << 0)
#define LM32_UART_MCR_RTS	(1 << 1)

struct lm32_uart {
	volatile unsigned char rxtx;
	volatile unsigned char ier;
	volatile unsigned char iir;
	volatile unsigned char lcr;
	volatile unsigned char mcr;
	volatile unsigned char lsr;
	volatile unsigned char msr;
	volatile unsigned char pad0;
	volatile unsigned char divl;
	volatile unsigned char divh;
};

/* SHA256
 * Please read http://csrc.nist.gov/publications/fips/fips180-4/fips-180-4.pdf
 * Example here: http://csrc.nist.gov/groups/ST/toolkit/documents/Examples/SHA256.pdf
 * 1. Write the CMD_INIT
 * 2. Wait the CMD_DONE when write every 512bits data
 *    You may need pad the data to 512bits
 * 3. Wait teh CMD_DONE. read the result out
 */
#define LM32_SHA256_CMD_INIT	(1 << 0)
#define LM32_SHA256_CMD_DONE	(1 << 1)

struct lm32_sha256 {
	volatile unsigned int cmd;
	volatile unsigned int din;
	volatile unsigned int hash;
	volatile unsigned int hi;
	volatile unsigned int pre;
};


/* This is the ASIC task FIFO buffer registers */
#define LM32_ALINK_STATE_TXFULL	(1 << 0)
#define LM32_ALINK_STATE_FLUSH	(1 << 1)
#define LM32_ALINK_STATE_TXCOUNT	(0x000000F0)
#define LM32_ALINK_STATE_RXEMPTY	(1 << 16)
#define LM32_ALINK_STATE_RXCOUNT (0x00F00000)

struct lm32_alink {
	volatile unsigned int tx;
	volatile unsigned int state;	/* Read only */
	volatile unsigned int en;
	volatile unsigned int busy;	/* Read only */
	volatile unsigned int rx;
};

/* This is the TwoWire & PWM registers */
#define LM32_TWIPWM_CR_ENABLE	(1 << 0)
#define LM32_TWIPWM_CR_TSTART	(1 << 1)
#define LM32_TWIPWM_CR_TDONE	(1 << 2)
#define LM32_TWIPWM_CR_CMD_START	(0 << 4)
#define LM32_TWIPWM_CR_CMD_WD		(1 << 4)<commit_msg>add hardware IRQ info<commit_after>/*
 * Author: <NAME> <<EMAIL>>
 * Bitcoin:	1CanaaniJzgps8EV6Sfmpb7T8RutpaeyFn
 *
 * This is free and unencumbered software released into the public domain.
 * For details see the UNLICENSE file at the root of the source tree.
 */

#ifndef _SYSTEM_CONFIG_H_
#define _SYSTEM_CONFIG_H_

#define CPU_FREQUENCY		(50 * 1000 * 1000) /* 50Mhz */
#define UART_BAUD_RATE          (115200)

/* Interrupt
 * Define at last few lines of verilog/superkdf9/soc/superkdf9_simple.v
 */
#define IRQ_GPIO		(0x00000001) /* 0 */
#define IRQ_SPI			(0x00000002) /* 1 */

#define IRQ_UART		(0x00000008) /* 3 */
#define IRQ_UARTDEBUG		(0x00000010) /* 4 */


/* Registers */
#define SPI_BASE		(0x80000000)
#define UART0_BASE		(0x80000100)
#define GPIO_BASE		(0x80000200)
#define UART1_BASE		(0x80000300)
#define SHA256_BASE		(0x80000400)
#define ALINK_BASE		(0x80000500)
#define TWIPWM_BASE		(0x80000600)


/* UART */
#define LM32_UART_IER_RBRI	(1 << 0)
#define LM32_UART_IER_THRI	(1 << 1)

#define LM32_UART_STAT_RX_EVT	(0x4)
#define LM32_UART_STAT_TX_EVT	(0x2)

/* Line status register */
#define LM32_UART_LSR_DR	(1 << 0)
#define LM32_UART_LSR_THRR	(1 << 5)
#define LM32_UART_LSR_TEMT	(1 << 6)

/* Line control register */
#define LM32_UART_LCR_WLS0	(1 << 0)
#define LM32_UART_LCR_WLS1	(1 << 1)
#define LM32_UART_LCR_8BIT	(LM32_UART_LCR_WLS1 | LM32_UART_LCR_WLS0)

/* Modem control register */
#define LM32_UART_MCR_DTR	(1 << 0)
#define LM32_UART_MCR_RTS	(1 << 1)

struct lm32_uart {
	volatile unsigned char rxtx;
	volatile unsigned char ier;
	volatile unsigned char iir;
	volatile unsigned char lcr;
	volatile unsigned char mcr;
	volatile unsigned char lsr;
	volatile unsigned char msr;
	volatile unsigned char pad0;
	volatile unsigned char divl;
	volatile unsigned char divh;
};

/* SHA256
 * Please read http://csrc.nist.gov/publications/fips/fips180-4/fips-180-4.pdf
 * Example here: http://csrc.nist.gov/groups/ST/toolkit/documents/Examples/SHA256.pdf
 * 1. Write the CMD_INIT
 * 2. Wait the CMD_DONE when write every 512bits data
 *    You may need pad the data to 512bits
 * 3. Wait teh CMD_DONE. read the result out
 */
#define LM32_SHA256_CMD_INIT	(1 << 0)
#define LM32_SHA256_CMD_DONE	(1 << 1)

struct lm32_sha256 {
	volatile unsigned int cmd;
	volatile unsigned int din;
	volatile unsigned int hash;
	volatile unsigned int hi;
	volatile unsigned int pre; /* Please read the A3255 datasheet */
};


/* ALINK */
#define LM32_ALINK_STATE_TXFULL	(1 << 0)
#define LM32_ALINK_STATE_FLUSH	(1 << 1)
#define LM32_ALINK_STATE_TXCOUNT	(0x000000F0)
#define LM32_ALINK_STATE_RXEMPTY	(1 << 16)
#define LM32_ALINK_STATE_RXCOUNT (0x00F00000)

struct lm32_alink {
	volatile unsigned int tx;
	volatile unsigned int state;	/* Read only */
	volatile unsigned int en;
	volatile unsigned int busy;	/* Read only */
	volatile unsigned int rx;
};

/* TWI PWM */
#define LM32_TWIPWM_CR_ENABLE	(1 << 0)
#define LM32_TWIPWM_CR_TSTART	(1 << 1)
#define LM32_TWIPWM_CR_TDONE	(1 << 2)
#define LM32_TWIPWM_CR_CMD_START	(0 << 4)
#define LM32_TWIPWM_CR_CMD_WD		(1 << 4)
{'fraction_non_alphanumeric': 0.09880868955851436, 'fraction_numerical': 0.09145059565522075, 'mean_word_length': 4.619094488188976, 'pattern_counts': {'":': 0, '<': 81, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 5, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1273881', 'n_tokens_mistral': 2717, 'n_tokens_neox': 2272, 'n_words': 618}