treewide: strip trailing whitespace

Strip trailing whitespace in all code:
find . -type f | grep "\.c$" | xargs sed -i 's/[ \t]\+$//'
find . -type f | grep "\.h$" | xargs sed -i 's/[ \t]\+$//'
find . -type f | grep "\.dts$" | xargs sed -i 's/[ \t]\+$//'
find . -type f | grep "\.dtsi$" | xargs sed -i 's/[ \t]\+$//'

Signed-off-by: Mieczyslaw Nalewaj <namiltd@yahoo.com>
Link: https://github.com/openwrt/openwrt/pull/18626
Signed-off-by: Robert Marko <robimarko@gmail.com>
This commit is contained in:
Mieczyslaw Nalewaj 2025-05-19 14:27:36 +02:00 committed by Robert Marko
parent 6b43a52171
commit a238170e57
138 changed files with 1965 additions and 1965 deletions

View File

@ -1489,14 +1489,14 @@ IFX_MEI_DFEMemoryAlloc (DSL_DEV_Device_t * pDev, long size)
allocate_size = size;
else
allocate_size = SDRAM_SEGMENT_SIZE;
org_mem_ptr = kmalloc (allocate_size, GFP_KERNEL);
if (org_mem_ptr == NULL) {
IFX_MEI_EMSG ("%d: kmalloc %d bytes memory fail!\n", idx, allocate_size);
err = -ENOMEM;
goto allocate_error;
}
if (((unsigned long)org_mem_ptr) & (1023)) {
/* Pointer not 1k aligned, so free it and allocate a larger chunk
* for further alignment.
@ -1637,7 +1637,7 @@ DSL_BSP_FWDownload (DSL_DEV_Device_t * pDev, const char *buf,
retval = -ENOMEM;
goto error;
}
if (((unsigned long)org_mem_ptr) & (1023)) {
/* Pointer not 1k aligned, so free it and allocate a larger chunk
* for further alignment.
@ -1654,7 +1654,7 @@ DSL_BSP_FWDownload (DSL_DEV_Device_t * pDev, const char *buf,
} else {
adsl_mem_info[XDATA_REGISTER].address = org_mem_ptr;
}
adsl_mem_info[XDATA_REGISTER].org_address = org_mem_ptr;
adsl_mem_info[XDATA_REGISTER].size = SDRAM_SEGMENT_SIZE;
@ -1770,7 +1770,7 @@ int DSL_BSP_EventCBUnregister(DSL_BSP_EventCallBack_t *p)
IFX_MEI_EMSG("Dying Gasp! Shutting Down... (Work around for Amazon-S Venus emulator)\n");
#else
IFX_MEI_EMSG("Dying Gasp! Shutting Down...\n");
// kill_proc (1, SIGINT, 1);
// kill_proc (1, SIGINT, 1);
#endif
return IRQ_HANDLED;
}

View File

@ -35,7 +35,7 @@
/*!
\defgroup IFX_AES_FUNCTIONS IFX_AES_FUNCTIONS
\ingroup IFX_DEU
\brief IFX AES driver Functions
\brief IFX AES driver Functions
*/
@ -68,7 +68,7 @@
#include "ifxmips_deu.h"
#if defined(CONFIG_DANUBE)
#if defined(CONFIG_DANUBE)
#include "ifxmips_deu_danube.h"
extern int ifx_danube_pre_1_4;
#elif defined(CONFIG_AR9)
@ -114,7 +114,7 @@ void aes_dma_memory_copy(u32 *outcopy, u32 *out_dma, u8 *out_arg, int nbytes);
void des_dma_memory_copy(u32 *outcopy, u32 *out_dma, u8 *out_arg, int nbytes);
int aes_memory_allocate(int value);
int des_memory_allocate(int value);
void memory_release(u32 *addr);
void memory_release(u32 *addr);
extern void ifx_deu_aes (void *ctx_arg, uint8_t *out_arg, const uint8_t *in_arg,
@ -138,16 +138,16 @@ struct aes_ctx {
};
extern int disable_deudma;
extern int disable_multiblock;
extern int disable_multiblock;
/*! \fn int aes_set_key (struct crypto_tfm *tfm, const uint8_t *in_key, unsigned int key_len)
* \ingroup IFX_AES_FUNCTIONS
* \brief sets the AES keys
* \param tfm linux crypto algo transform
* \param in_key input key
* \param key_len key lengths of 16, 24 and 32 bytes supported
* \ingroup IFX_AES_FUNCTIONS
* \brief sets the AES keys
* \param tfm linux crypto algo transform
* \param in_key input key
* \param key_len key lengths of 16, 24 and 32 bytes supported
* \return -EINVAL - bad key length, 0 - SUCCESS
*/
*/
static int aes_set_key (struct crypto_tfm *tfm, const u8 *in_key, unsigned int key_len)
{
struct aes_ctx *ctx = crypto_tfm_ctx(tfm);
@ -186,7 +186,7 @@ static int aes_set_key_skcipher (struct crypto_skcipher *tfm, const u8 *in_key,
/*! \fn void aes_set_key_skcipher (void *ctx_arg)
* \ingroup IFX_AES_FUNCTIONS
* \brief sets the AES key to the hardware, requires spinlock to be set by caller
* \param ctx_arg crypto algo context
* \param ctx_arg crypto algo context
* \return
*/
static void aes_set_key_hw (void *ctx_arg)
@ -242,15 +242,15 @@ static void aes_set_key_hw (void *ctx_arg)
/*! \fn void ifx_deu_aes (void *ctx_arg, u8 *out_arg, const u8 *in_arg, u8 *iv_arg, size_t nbytes, int encdec, int mode)
* \ingroup IFX_AES_FUNCTIONS
* \brief main interface to AES hardware
* \param ctx_arg crypto algo context
* \param out_arg output bytestream
* \param in_arg input bytestream
* \param iv_arg initialization vector
* \param nbytes length of bytestream
* \param encdec 1 for encrypt; 0 for decrypt
* \param mode operation mode such as ebc, cbc, ctr
* \param ctx_arg crypto algo context
* \param out_arg output bytestream
* \param in_arg input bytestream
* \param iv_arg initialization vector
* \param nbytes length of bytestream
* \param encdec 1 for encrypt; 0 for decrypt
* \param mode operation mode such as ebc, cbc, ctr
*
*/
*/
void ifx_deu_aes (void *ctx_arg, u8 *out_arg, const u8 *in_arg,
u8 *iv_arg, size_t nbytes, int encdec, int mode)
@ -261,14 +261,14 @@ void ifx_deu_aes (void *ctx_arg, u8 *out_arg, const u8 *in_arg,
unsigned long flag;
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
int i = 0;
int byte_cnt = nbytes;
int byte_cnt = nbytes;
CRTCL_SECT_START;
aes_set_key_hw (ctx_arg);
aes->controlr.E_D = !encdec; //encryption
aes->controlr.O = mode; //0 ECB 1 CBC 2 OFB 3 CFB 4 CTR
aes->controlr.O = mode; //0 ECB 1 CBC 2 OFB 3 CFB 4 CTR
//aes->controlr.F = 128; //default; only for CFB and OFB modes; change only for customer-specific apps
if (mode > 0) {
@ -286,7 +286,7 @@ void ifx_deu_aes (void *ctx_arg, u8 *out_arg, const u8 *in_arg,
aes->ID2R = INPUT_ENDIAN_SWAP(*((u32 *) in_arg + (i * 4) + 1));
aes->ID1R = INPUT_ENDIAN_SWAP(*((u32 *) in_arg + (i * 4) + 2));
aes->ID0R = INPUT_ENDIAN_SWAP(*((u32 *) in_arg + (i * 4) + 3)); /* start crypto */
while (aes->controlr.BUS) {
// this will not take long
}
@ -336,13 +336,13 @@ void ifx_deu_aes (void *ctx_arg, u8 *out_arg, const u8 *in_arg,
/*!
* \fn int ctr_rfc3686_aes_set_key (struct crypto_tfm *tfm, const uint8_t *in_key, unsigned int key_len)
* \ingroup IFX_AES_FUNCTIONS
* \brief sets RFC3686 key
* \param tfm linux crypto algo transform
* \param in_key input key
* \param key_len key lengths of 20, 28 and 36 bytes supported; last 4 bytes is nonce
* \brief sets RFC3686 key
* \param tfm linux crypto algo transform
* \param in_key input key
* \param key_len key lengths of 20, 28 and 36 bytes supported; last 4 bytes is nonce
* \return 0 - SUCCESS
* -EINVAL - bad key length
*/
*/
static int ctr_rfc3686_aes_set_key (struct crypto_tfm *tfm, const uint8_t *in_key, unsigned int key_len)
{
struct aes_ctx *ctx = crypto_tfm_ctx(tfm);
@ -360,7 +360,7 @@ static int ctr_rfc3686_aes_set_key (struct crypto_tfm *tfm, const uint8_t *in_ke
ctx->key_length = key_len;
ctx->use_tweak = 0;
memcpy ((u8 *) (ctx->buf), in_key, key_len);
return 0;
@ -384,13 +384,13 @@ static int ctr_rfc3686_aes_set_key_skcipher (struct crypto_skcipher *tfm, const
/*! \fn void ifx_deu_aes (void *ctx_arg, u8 *out_arg, const u8 *in_arg, u8 *iv_arg, u32 nbytes, int encdec, int mode)
* \ingroup IFX_AES_FUNCTIONS
* \brief main interface with deu hardware in DMA mode
* \param ctx_arg crypto algo context
* \param out_arg output bytestream
* \param in_arg input bytestream
* \param iv_arg initialization vector
* \param nbytes length of bytestream
* \param encdec 1 for encrypt; 0 for decrypt
* \param mode operation mode such as ebc, cbc, ctr
* \param ctx_arg crypto algo context
* \param out_arg output bytestream
* \param in_arg input bytestream
* \param iv_arg initialization vector
* \param nbytes length of bytestream
* \param encdec 1 for encrypt; 0 for decrypt
* \param mode operation mode such as ebc, cbc, ctr
*/
@ -404,15 +404,15 @@ static int ctr_rfc3686_aes_set_key_skcipher (struct crypto_skcipher *tfm, const
/*! \fn void ifx_deu_aes_ecb (void *ctx, uint8_t *dst, const uint8_t *src, uint8_t *iv, size_t nbytes, int encdec, int inplace)
* \ingroup IFX_AES_FUNCTIONS
* \brief sets AES hardware to ECB mode
* \param ctx crypto algo context
* \param dst output bytestream
* \param src input bytestream
* \param iv initialization vector
* \param nbytes length of bytestream
* \param encdec 1 for encrypt; 0 for decrypt
* \param inplace not used
*/
* \brief sets AES hardware to ECB mode
* \param ctx crypto algo context
* \param dst output bytestream
* \param src input bytestream
* \param iv initialization vector
* \param nbytes length of bytestream
* \param encdec 1 for encrypt; 0 for decrypt
* \param inplace not used
*/
static void ifx_deu_aes_ecb (void *ctx, uint8_t *dst, const uint8_t *src,
uint8_t *iv, size_t nbytes, int encdec, int inplace)
{
@ -421,15 +421,15 @@ static void ifx_deu_aes_ecb (void *ctx, uint8_t *dst, const uint8_t *src,
/*! \fn void ifx_deu_aes_cbc (void *ctx, uint8_t *dst, const uint8_t *src, uint8_t *iv, size_t nbytes, int encdec, int inplace)
* \ingroup IFX_AES_FUNCTIONS
* \brief sets AES hardware to CBC mode
* \param ctx crypto algo context
* \param dst output bytestream
* \param src input bytestream
* \param iv initialization vector
* \param nbytes length of bytestream
* \param encdec 1 for encrypt; 0 for decrypt
* \param inplace not used
*/
* \brief sets AES hardware to CBC mode
* \param ctx crypto algo context
* \param dst output bytestream
* \param src input bytestream
* \param iv initialization vector
* \param nbytes length of bytestream
* \param encdec 1 for encrypt; 0 for decrypt
* \param inplace not used
*/
static void ifx_deu_aes_cbc (void *ctx, uint8_t *dst, const uint8_t *src,
uint8_t *iv, size_t nbytes, int encdec, int inplace)
{
@ -438,15 +438,15 @@ static void ifx_deu_aes_cbc (void *ctx, uint8_t *dst, const uint8_t *src,
/*! \fn void ifx_deu_aes_ofb (void *ctx, uint8_t *dst, const uint8_t *src, uint8_t *iv, size_t nbytes, int encdec, int inplace)
* \ingroup IFX_AES_FUNCTIONS
* \brief sets AES hardware to OFB mode
* \param ctx crypto algo context
* \param dst output bytestream
* \param src input bytestream
* \param iv initialization vector
* \param nbytes length of bytestream
* \param encdec 1 for encrypt; 0 for decrypt
* \param inplace not used
*/
* \brief sets AES hardware to OFB mode
* \param ctx crypto algo context
* \param dst output bytestream
* \param src input bytestream
* \param iv initialization vector
* \param nbytes length of bytestream
* \param encdec 1 for encrypt; 0 for decrypt
* \param inplace not used
*/
static void ifx_deu_aes_ofb (void *ctx, uint8_t *dst, const uint8_t *src,
uint8_t *iv, size_t nbytes, int encdec, int inplace)
{
@ -455,15 +455,15 @@ static void ifx_deu_aes_ofb (void *ctx, uint8_t *dst, const uint8_t *src,
/*! \fn void ifx_deu_aes_cfb (void *ctx, uint8_t *dst, const uint8_t *src, uint8_t *iv, size_t nbytes, int encdec, int inplace)
* \ingroup IFX_AES_FUNCTIONS
* \brief sets AES hardware to CFB mode
* \param ctx crypto algo context
* \param dst output bytestream
* \param src input bytestream
* \param iv initialization vector
* \param nbytes length of bytestream
* \param encdec 1 for encrypt; 0 for decrypt
* \param inplace not used
*/
* \brief sets AES hardware to CFB mode
* \param ctx crypto algo context
* \param dst output bytestream
* \param src input bytestream
* \param iv initialization vector
* \param nbytes length of bytestream
* \param encdec 1 for encrypt; 0 for decrypt
* \param inplace not used
*/
static void ifx_deu_aes_cfb (void *ctx, uint8_t *dst, const uint8_t *src,
uint8_t *iv, size_t nbytes, int encdec, int inplace)
{
@ -472,15 +472,15 @@ static void ifx_deu_aes_cfb (void *ctx, uint8_t *dst, const uint8_t *src,
/*! \fn void ifx_deu_aes_ctr (void *ctx, uint8_t *dst, const uint8_t *src, uint8_t *iv, size_t nbytes, int encdec, int inplace)
* \ingroup IFX_AES_FUNCTIONS
* \brief sets AES hardware to CTR mode
* \param ctx crypto algo context
* \param dst output bytestream
* \param src input bytestream
* \param iv initialization vector
* \param nbytes length of bytestream
* \param encdec 1 for encrypt; 0 for decrypt
* \param inplace not used
*/
* \brief sets AES hardware to CTR mode
* \param ctx crypto algo context
* \param dst output bytestream
* \param src input bytestream
* \param iv initialization vector
* \param nbytes length of bytestream
* \param encdec 1 for encrypt; 0 for decrypt
* \param inplace not used
*/
static void ifx_deu_aes_ctr (void *ctx, uint8_t *dst, const uint8_t *src,
uint8_t *iv, size_t nbytes, int encdec, int inplace)
{
@ -555,7 +555,7 @@ static int ecb_aes_encrypt(struct skcipher_request *req)
while ((nbytes = enc_bytes = walk.nbytes)) {
enc_bytes -= (nbytes % AES_BLOCK_SIZE);
ifx_deu_aes_ecb(ctx, walk.dst.virt.addr, walk.src.virt.addr,
ifx_deu_aes_ecb(ctx, walk.dst.virt.addr, walk.src.virt.addr,
NULL, enc_bytes, CRYPTO_DIR_ENCRYPT, 0);
nbytes &= AES_BLOCK_SIZE - 1;
err = skcipher_walk_done(&walk, nbytes);
@ -581,7 +581,7 @@ static int ecb_aes_decrypt(struct skcipher_request *req)
while ((nbytes = dec_bytes = walk.nbytes)) {
dec_bytes -= (nbytes % AES_BLOCK_SIZE);
ifx_deu_aes_ecb(ctx, walk.dst.virt.addr, walk.src.virt.addr,
ifx_deu_aes_ecb(ctx, walk.dst.virt.addr, walk.src.virt.addr,
NULL, dec_bytes, CRYPTO_DIR_DECRYPT, 0);
nbytes &= AES_BLOCK_SIZE - 1;
err = skcipher_walk_done(&walk, nbytes);
@ -627,7 +627,7 @@ static int cbc_aes_encrypt(struct skcipher_request *req)
while ((nbytes = enc_bytes = walk.nbytes)) {
u8 *iv = walk.iv;
enc_bytes -= (nbytes % AES_BLOCK_SIZE);
ifx_deu_aes_cbc(ctx, walk.dst.virt.addr, walk.src.virt.addr,
ifx_deu_aes_cbc(ctx, walk.dst.virt.addr, walk.src.virt.addr,
iv, enc_bytes, CRYPTO_DIR_ENCRYPT, 0);
nbytes &= AES_BLOCK_SIZE - 1;
err = skcipher_walk_done(&walk, nbytes);
@ -654,7 +654,7 @@ static int cbc_aes_decrypt(struct skcipher_request *req)
while ((nbytes = dec_bytes = walk.nbytes)) {
u8 *iv = walk.iv;
dec_bytes -= (nbytes % AES_BLOCK_SIZE);
ifx_deu_aes_cbc(ctx, walk.dst.virt.addr, walk.src.virt.addr,
ifx_deu_aes_cbc(ctx, walk.dst.virt.addr, walk.src.virt.addr,
iv, dec_bytes, CRYPTO_DIR_DECRYPT, 0);
nbytes &= AES_BLOCK_SIZE - 1;
err = skcipher_walk_done(&walk, nbytes);
@ -704,7 +704,7 @@ static void ifx_deu_aes_xts (void *ctx_arg, u8 *out_arg, const u8 *in_arg,
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
u8 oldiv[16];
int i = 0;
int byte_cnt = nbytes;
int byte_cnt = nbytes;
CRTCL_SECT_START;
@ -828,7 +828,7 @@ static int xts_aes_encrypt(struct skcipher_request *req)
}
}
}
ifx_deu_aes_xts(ctx, walk.dst.virt.addr, walk.src.virt.addr,
ifx_deu_aes_xts(ctx, walk.dst.virt.addr, walk.src.virt.addr,
iv, enc_bytes, CRYPTO_DIR_ENCRYPT);
err = skcipher_walk_done(&walk, nbytes - enc_bytes);
processed += enc_bytes;
@ -838,7 +838,7 @@ static int xts_aes_encrypt(struct skcipher_request *req)
u8 *iv = walk.iv;
nbytes = req->cryptlen - processed;
scatterwalk_map_and_copy(ctx->lastbuffer, req->src, (req->cryptlen - nbytes), nbytes, 0);
ifx_deu_aes_xts(ctx, ctx->lastbuffer, ctx->lastbuffer,
ifx_deu_aes_xts(ctx, ctx->lastbuffer, ctx->lastbuffer,
iv, nbytes, CRYPTO_DIR_ENCRYPT);
scatterwalk_map_and_copy(ctx->lastbuffer, req->dst, (req->cryptlen - nbytes), nbytes, 1);
skcipher_request_complete(req, 0);
@ -884,7 +884,7 @@ static int xts_aes_decrypt(struct skcipher_request *req)
}
}
}
ifx_deu_aes_xts(ctx, walk.dst.virt.addr, walk.src.virt.addr,
ifx_deu_aes_xts(ctx, walk.dst.virt.addr, walk.src.virt.addr,
iv, dec_bytes, CRYPTO_DIR_DECRYPT);
err = skcipher_walk_done(&walk, nbytes - dec_bytes);
processed += dec_bytes;
@ -894,7 +894,7 @@ static int xts_aes_decrypt(struct skcipher_request *req)
u8 *iv = walk.iv;
nbytes = req->cryptlen - processed;
scatterwalk_map_and_copy(ctx->lastbuffer, req->src, (req->cryptlen - nbytes), nbytes, 0);
ifx_deu_aes_xts(ctx, ctx->lastbuffer, ctx->lastbuffer,
ifx_deu_aes_xts(ctx, ctx->lastbuffer, ctx->lastbuffer,
iv, nbytes, CRYPTO_DIR_DECRYPT);
scatterwalk_map_and_copy(ctx->lastbuffer, req->dst, (req->cryptlen - nbytes), nbytes, 1);
skcipher_request_complete(req, 0);
@ -969,7 +969,7 @@ static int ofb_aes_encrypt(struct skcipher_request *req)
while ((nbytes = enc_bytes = walk.nbytes) && (walk.nbytes >= AES_BLOCK_SIZE)) {
enc_bytes -= (nbytes % AES_BLOCK_SIZE);
ifx_deu_aes_ofb(ctx, walk.dst.virt.addr, walk.src.virt.addr,
ifx_deu_aes_ofb(ctx, walk.dst.virt.addr, walk.src.virt.addr,
walk.iv, enc_bytes, CRYPTO_DIR_ENCRYPT, 0);
nbytes &= AES_BLOCK_SIZE - 1;
err = skcipher_walk_done(&walk, nbytes);
@ -1002,7 +1002,7 @@ static int ofb_aes_decrypt(struct skcipher_request *req)
while ((nbytes = dec_bytes = walk.nbytes) && (walk.nbytes >= AES_BLOCK_SIZE)) {
dec_bytes -= (nbytes % AES_BLOCK_SIZE);
ifx_deu_aes_ofb(ctx, walk.dst.virt.addr, walk.src.virt.addr,
ifx_deu_aes_ofb(ctx, walk.dst.virt.addr, walk.src.virt.addr,
walk.iv, dec_bytes, CRYPTO_DIR_DECRYPT, 0);
nbytes &= AES_BLOCK_SIZE - 1;
err = skcipher_walk_done(&walk, nbytes);
@ -1057,7 +1057,7 @@ static int cfb_aes_encrypt(struct skcipher_request *req)
while ((nbytes = enc_bytes = walk.nbytes) && (walk.nbytes >= AES_BLOCK_SIZE)) {
enc_bytes -= (nbytes % AES_BLOCK_SIZE);
ifx_deu_aes_cfb(ctx, walk.dst.virt.addr, walk.src.virt.addr,
ifx_deu_aes_cfb(ctx, walk.dst.virt.addr, walk.src.virt.addr,
walk.iv, enc_bytes, CRYPTO_DIR_ENCRYPT, 0);
nbytes &= AES_BLOCK_SIZE - 1;
err = skcipher_walk_done(&walk, nbytes);
@ -1090,7 +1090,7 @@ static int cfb_aes_decrypt(struct skcipher_request *req)
while ((nbytes = dec_bytes = walk.nbytes) && (walk.nbytes >= AES_BLOCK_SIZE)) {
dec_bytes -= (nbytes % AES_BLOCK_SIZE);
ifx_deu_aes_cfb(ctx, walk.dst.virt.addr, walk.src.virt.addr,
ifx_deu_aes_cfb(ctx, walk.dst.virt.addr, walk.src.virt.addr,
walk.iv, dec_bytes, CRYPTO_DIR_DECRYPT, 0);
nbytes &= AES_BLOCK_SIZE - 1;
err = skcipher_walk_done(&walk, nbytes);
@ -1145,7 +1145,7 @@ static int ctr_basic_aes_encrypt(struct skcipher_request *req)
while ((nbytes = enc_bytes = walk.nbytes) && (walk.nbytes >= AES_BLOCK_SIZE)) {
enc_bytes -= (nbytes % AES_BLOCK_SIZE);
ifx_deu_aes_ctr(ctx, walk.dst.virt.addr, walk.src.virt.addr,
ifx_deu_aes_ctr(ctx, walk.dst.virt.addr, walk.src.virt.addr,
walk.iv, enc_bytes, CRYPTO_DIR_ENCRYPT, 0);
nbytes &= AES_BLOCK_SIZE - 1;
err = skcipher_walk_done(&walk, nbytes);
@ -1178,7 +1178,7 @@ static int ctr_basic_aes_decrypt(struct skcipher_request *req)
while ((nbytes = dec_bytes = walk.nbytes) && (walk.nbytes >= AES_BLOCK_SIZE)) {
dec_bytes -= (nbytes % AES_BLOCK_SIZE);
ifx_deu_aes_ctr(ctx, walk.dst.virt.addr, walk.src.virt.addr,
ifx_deu_aes_ctr(ctx, walk.dst.virt.addr, walk.src.virt.addr,
walk.iv, dec_bytes, CRYPTO_DIR_DECRYPT, 0);
nbytes &= AES_BLOCK_SIZE - 1;
err = skcipher_walk_done(&walk, nbytes);
@ -1233,7 +1233,7 @@ static int ctr_rfc3686_aes_encrypt(struct skcipher_request *req)
nbytes = walk.nbytes;
/* set up counter block */
memcpy(rfc3686_iv, ctx->nonce, CTR_RFC3686_NONCE_SIZE);
memcpy(rfc3686_iv, ctx->nonce, CTR_RFC3686_NONCE_SIZE);
memcpy(rfc3686_iv + CTR_RFC3686_NONCE_SIZE, walk.iv, CTR_RFC3686_IV_SIZE);
/* initialize counter portion of counter block */
@ -1242,7 +1242,7 @@ static int ctr_rfc3686_aes_encrypt(struct skcipher_request *req)
while ((nbytes = enc_bytes = walk.nbytes) && (walk.nbytes >= AES_BLOCK_SIZE)) {
enc_bytes -= (nbytes % AES_BLOCK_SIZE);
ifx_deu_aes_ctr(ctx, walk.dst.virt.addr, walk.src.virt.addr,
ifx_deu_aes_ctr(ctx, walk.dst.virt.addr, walk.src.virt.addr,
rfc3686_iv, enc_bytes, CRYPTO_DIR_ENCRYPT, 0);
nbytes &= AES_BLOCK_SIZE - 1;
err = skcipher_walk_done(&walk, nbytes);
@ -1276,7 +1276,7 @@ static int ctr_rfc3686_aes_decrypt(struct skcipher_request *req)
nbytes = walk.nbytes;
/* set up counter block */
memcpy(rfc3686_iv, ctx->nonce, CTR_RFC3686_NONCE_SIZE);
memcpy(rfc3686_iv, ctx->nonce, CTR_RFC3686_NONCE_SIZE);
memcpy(rfc3686_iv + CTR_RFC3686_NONCE_SIZE, walk.iv, CTR_RFC3686_IV_SIZE);
/* initialize counter portion of counter block */
@ -1285,7 +1285,7 @@ static int ctr_rfc3686_aes_decrypt(struct skcipher_request *req)
while ((nbytes = dec_bytes = walk.nbytes) && (walk.nbytes >= AES_BLOCK_SIZE)) {
dec_bytes -= (nbytes % AES_BLOCK_SIZE);
ifx_deu_aes_ctr(ctx, walk.dst.virt.addr, walk.src.virt.addr,
ifx_deu_aes_ctr(ctx, walk.dst.virt.addr, walk.src.virt.addr,
rfc3686_iv, dec_bytes, CRYPTO_DIR_DECRYPT, 0);
nbytes &= AES_BLOCK_SIZE - 1;
err = skcipher_walk_done(&walk, nbytes);
@ -1437,7 +1437,7 @@ static int aes_cbcmac_final_impl(struct shash_desc *desc, u8 *out, bool hash_fin
aes_set_key_hw (mctx);
aes->controlr.E_D = !CRYPTO_DIR_ENCRYPT; //encryption
aes->controlr.O = 1; //0 ECB 1 CBC 2 OFB 3 CFB 4 CTR
aes->controlr.O = 1; //0 ECB 1 CBC 2 OFB 3 CFB 4 CTR
//aes->controlr.F = 128; //default; only for CFB and OFB modes; change only for customer-specific apps
@ -1477,7 +1477,7 @@ static int aes_cbcmac_final_impl(struct shash_desc *desc, u8 *out, bool hash_fin
*((u32 *) mctx->hash + 3) = DEU_ENDIAN_SWAP(aes->IV0R);
if (hash_final && offset) {
aes->controlr.O = 0; //0 ECB 1 CBC 2 OFB 3 CFB 4 CTR
aes->controlr.O = 0; //0 ECB 1 CBC 2 OFB 3 CFB 4 CTR
crypto_xor(mctx->block, mctx->hash, offset);
memcpy(p, mctx->hash + offset, (AES_BLOCK_SIZE - offset));

View File

@ -33,7 +33,7 @@
\brief ARC4 encryption DEU driver file
*/
/*!
/*!
\defgroup IFX_ARC4_FUNCTIONS IFX_ARC4_FUNCTIONS
\ingroup IFX_DEU
\brief IFX deu driver functions
@ -59,7 +59,7 @@
#ifdef CONFIG_VR9
#include "ifxmips_deu_vr9.h"
#endif
static spinlock_t lock;
#define CRTCL_SECT_INIT spin_lock_init(&lock)
#define CRTCL_SECT_START spin_lock_irqsave(&lock, flag)
@ -78,7 +78,7 @@ extern char debug_level;
#define DPRINTF(level, format, args...)
#endif
/*
/*
* \brief arc4 private structure
*/
struct arc4_ctx {
@ -91,24 +91,24 @@ extern int disable_multiblock;
/*! \fn static void _deu_arc4 (void *ctx_arg, u8 *out_arg, const u8 *in_arg, u8 *iv_arg, u32 nbytes, int encdec, int mode)
\ingroup IFX_ARC4_FUNCTIONS
\brief main interface to ARC4 hardware
\param ctx_arg crypto algo context
\param out_arg output bytestream
\param in_arg input bytestream
\param iv_arg initialization vector
\param nbytes length of bytestream
\param encdec 1 for encrypt; 0 for decrypt
\param mode operation mode such as ebc, cbc, ctr
*/
\brief main interface to ARC4 hardware
\param ctx_arg crypto algo context
\param out_arg output bytestream
\param in_arg input bytestream
\param iv_arg initialization vector
\param nbytes length of bytestream
\param encdec 1 for encrypt; 0 for decrypt
\param mode operation mode such as ebc, cbc, ctr
*/
static void _deu_arc4 (void *ctx_arg, u8 *out_arg, const u8 *in_arg,
u8 *iv_arg, u32 nbytes, int encdec, int mode)
{
volatile struct arc4_t *arc4 = (struct arc4_t *) ARC4_START;
int i = 0;
unsigned long flag;
#if 1 // need to handle nbytes not multiple of 16
#if 1 // need to handle nbytes not multiple of 16
volatile u32 tmp_array32[4];
volatile u8 *tmp_ptr8;
int remaining_bytes, j;
@ -121,18 +121,18 @@ static void _deu_arc4 (void *ctx_arg, u8 *out_arg, const u8 *in_arg,
#if 1
while (i < nbytes) {
arc4->ID3R = *((u32 *) in_arg + (i>>2) + 0);
arc4->ID2R = *((u32 *) in_arg + (i>>2) + 1);
arc4->ID2R = *((u32 *) in_arg + (i>>2) + 1);
arc4->ID1R = *((u32 *) in_arg + (i>>2) + 2);
arc4->ID0R = *((u32 *) in_arg + (i>>2) + 3);
arc4->controlr.GO = 1;
arc4->ID0R = *((u32 *) in_arg + (i>>2) + 3);
arc4->controlr.GO = 1;
while (arc4->controlr.BUS) {
// this will not take long
}
#if 1
// need to handle nbytes not multiple of 16
// need to handle nbytes not multiple of 16
tmp_array32[0] = arc4->OD3R;
tmp_array32[1] = arc4->OD2R;
tmp_array32[2] = arc4->OD1R;
@ -141,11 +141,11 @@ static void _deu_arc4 (void *ctx_arg, u8 *out_arg, const u8 *in_arg,
remaining_bytes = nbytes - i;
if (remaining_bytes > 16)
remaining_bytes = 16;
tmp_ptr8 = (u8 *)&tmp_array32[0];
for (j = 0; j < remaining_bytes; j++)
*out_arg++ = *tmp_ptr8++;
#else
#else
*((u32 *) out_arg + (i>>2) + 0) = arc4->OD3R;
*((u32 *) out_arg + (i>>2) + 1) = arc4->OD2R;
*((u32 *) out_arg + (i>>2) + 2) = arc4->OD1R;
@ -163,8 +163,8 @@ static void _deu_arc4 (void *ctx_arg, u8 *out_arg, const u8 *in_arg,
/*! \fn arc4_chip_init (void)
\ingroup IFX_ARC4_FUNCTIONS
\brief initialize arc4 hardware
*/
\brief initialize arc4 hardware
*/
static void arc4_chip_init (void)
{
//do nothing
@ -172,18 +172,18 @@ static void arc4_chip_init (void)
/*! \fn static int arc4_set_key(struct crypto_tfm *tfm, const u8 *in_key, unsigned int key_len)
\ingroup IFX_ARC4_FUNCTIONS
\brief sets ARC4 key
\param tfm linux crypto algo transform
\param in_key input key
\param key_len key lengths less than or equal to 16 bytes supported
*/
\brief sets ARC4 key
\param tfm linux crypto algo transform
\param in_key input key
\param key_len key lengths less than or equal to 16 bytes supported
*/
static int arc4_set_key(struct crypto_tfm *tfm, const u8 *inkey,
unsigned int key_len)
{
//struct arc4_ctx *ctx = crypto_tfm_ctx(tfm);
volatile struct arc4_t *arc4 = (struct arc4_t *) ARC4_START;
u32 *in_key = (u32 *)inkey;
// must program all bits at one go?!!!
//#if 1
*IFX_ARC4_CON = ( (1<<31) | ((key_len - 1)<<27) | (1<<26) | (3<<16) );
@ -194,7 +194,7 @@ static int arc4_set_key(struct crypto_tfm *tfm, const u8 *inkey,
arc4->K1R = *((u32 *) in_key + 2);
arc4->K0R = *((u32 *) in_key + 3);
#if 0 // arc4 is a ugly state machine, KSAE can only be set once per session
#if 0 // arc4 is a ugly state machine, KSAE can only be set once per session
ctx->key_length = key_len;
memcpy ((u8 *) (ctx->buf), in_key, key_len);
@ -218,15 +218,15 @@ static int arc4_set_key_skcipher(struct crypto_skcipher *tfm, const u8 *inkey,
/*! \fn static void _deu_arc4_ecb(void *ctx, uint8_t *dst, const uint8_t *src, uint8_t *iv, size_t nbytes, int encdec, int inplace)
\ingroup IFX_ARC4_FUNCTIONS
\brief sets ARC4 hardware to ECB mode
\param ctx crypto algo context
\param dst output bytestream
\param src input bytestream
\param iv initialization vector
\param nbytes length of bytestream
\param encdec 1 for encrypt; 0 for decrypt
\param inplace not used
*/
\brief sets ARC4 hardware to ECB mode
\param ctx crypto algo context
\param dst output bytestream
\param src input bytestream
\param iv initialization vector
\param nbytes length of bytestream
\param encdec 1 for encrypt; 0 for decrypt
\param inplace not used
*/
static void _deu_arc4_ecb(void *ctx, uint8_t *dst, const uint8_t *src,
uint8_t *iv, size_t nbytes, int encdec, int inplace)
{
@ -235,11 +235,11 @@ static void _deu_arc4_ecb(void *ctx, uint8_t *dst, const uint8_t *src,
/*! \fn static void arc4_crypt(struct crypto_tfm *tfm, u8 *out, const u8 *in)
\ingroup IFX_ARC4_FUNCTIONS
\brief encrypt/decrypt ARC4_BLOCK_SIZE of data
\param tfm linux crypto algo transform
\param out output bytestream
\param in input bytestream
*/
\brief encrypt/decrypt ARC4_BLOCK_SIZE of data
\param tfm linux crypto algo transform
\param out output bytestream
\param in input bytestream
*/
static void arc4_crypt(struct crypto_tfm *tfm, u8 *out, const u8 *in)
{
struct arc4_ctx *ctx = crypto_tfm_ctx(tfm);
@ -288,7 +288,7 @@ static int ecb_arc4_encrypt(struct skcipher_request *req)
err = skcipher_walk_virt(&walk, req, false);
while ((nbytes = walk.nbytes)) {
_deu_arc4_ecb(ctx, walk.dst.virt.addr, walk.src.virt.addr,
_deu_arc4_ecb(ctx, walk.dst.virt.addr, walk.src.virt.addr,
NULL, nbytes, CRYPTO_DIR_ENCRYPT, 0);
nbytes &= ARC4_BLOCK_SIZE - 1;
err = skcipher_walk_done(&walk, nbytes);
@ -313,7 +313,7 @@ static int ecb_arc4_decrypt(struct skcipher_request *req)
err = skcipher_walk_virt(&walk, req, false);
while ((nbytes = walk.nbytes)) {
_deu_arc4_ecb(ctx, walk.dst.virt.addr, walk.src.virt.addr,
_deu_arc4_ecb(ctx, walk.dst.virt.addr, walk.src.virt.addr,
NULL, nbytes, CRYPTO_DIR_DECRYPT, 0);
nbytes &= ARC4_BLOCK_SIZE - 1;
err = skcipher_walk_done(&walk, nbytes);
@ -343,8 +343,8 @@ static struct skcipher_alg ifxdeu_ecb_arc4_alg = {
/*! \fn int ifxdeu_init_arc4(void)
\ingroup IFX_ARC4_FUNCTIONS
\brief initialize arc4 driver
*/
\brief initialize arc4 driver
*/
int ifxdeu_init_arc4(void)
{
int ret = -ENOSYS;
@ -376,8 +376,8 @@ ecb_arc4_err:
/*! \fn void ifxdeu_fini_arc4(void)
\ingroup IFX_ARC4_FUNCTIONS
\brief unregister arc4 driver
*/
\brief unregister arc4 driver
*/
void ifxdeu_fini_arc4(void)
{
crypto_unregister_alg (&ifxdeu_arc4_alg);

View File

@ -136,7 +136,7 @@ struct aes_container {
u32 nbytes;
struct ablkcipher_request arequest;
};
aes_priv_t *aes_queue;
@ -149,7 +149,7 @@ void hexdump(unsigned char *buf, unsigned int len)
buf, len, false);
}
/*! \fn void lq_deu_aes_core (void *ctx_arg, u8 *out_arg, const u8 *in_arg, u8 *iv_arg,
/*! \fn void lq_deu_aes_core (void *ctx_arg, u8 *out_arg, const u8 *in_arg, u8 *iv_arg,
size_t nbytes, int encdec, int mode)
* \ingroup IFX_AES_FUNCTIONS
* \brief main interface to AES hardware
@ -226,7 +226,7 @@ static int lq_deu_aes_core (void *ctx_arg, u8 *out_arg, const u8 *in_arg,
AES_DMA_MISC_CONFIG();
aes->controlr.E_D = !encdec; //encryption
aes->controlr.O = mode; //0 ECB 1 CBC 2 OFB 3 CFB 4 CTR
aes->controlr.O = mode; //0 ECB 1 CBC 2 OFB 3 CFB 4 CTR
//aes->controlr.F = 128; //default; only for CFB and OFB modes; change only for customer-specific apps
if (mode > 0) {
@ -240,8 +240,8 @@ static int lq_deu_aes_core (void *ctx_arg, u8 *out_arg, const u8 *in_arg,
/* Prepare Rx buf length used in dma psuedo interrupt */
deu_priv->deu_rx_buf = (u32 *)out_arg;
deu_priv->deu_rx_len = nbytes;
/* memory alignment issue */
/* memory alignment issue */
dword_mem_aligned_in = (u32 *) DEU_DWORD_REORDERING(in_arg, aes_buff_in, BUFFER_IN, nbytes);
dma->controlr.ALGO = 1; //AES
@ -274,16 +274,16 @@ static int lq_deu_aes_core (void *ctx_arg, u8 *out_arg, const u8 *in_arg,
*((u32 *) iv_arg + 2) = DEU_ENDIAN_SWAP(*((u32 *) iv_arg + 2));
*((u32 *) iv_arg + 3) = DEU_ENDIAN_SWAP(*((u32 *) iv_arg + 3));
}
return -EINPROGRESS;
return -EINPROGRESS;
}
/* \fn static int count_sgs(struct scatterlist *sl, unsigned int total_bytes)
* \ingroup IFX_AES_FUNCTIONS
* \brief Counts and return the number of scatterlists
* \brief Counts and return the number of scatterlists
* \param *sl Function pointer to the scatterlist
* \param total_bytes The total number of bytes that needs to be encrypted/decrypted
* \return The number of scatterlists
* \return The number of scatterlists
*/
static int count_sgs(struct scatterlist *sl, unsigned int total_bytes)
@ -302,7 +302,7 @@ static int count_sgs(struct scatterlist *sl, unsigned int total_bytes)
/* \fn void lq_sg_init(struct scatterlist *src,
* struct scatterlist *dst)
* \ingroup IFX_AES_FUNCTIONS
* \brief Maps the scatterlists into a source/destination page.
* \brief Maps the scatterlists into a source/destination page.
* \param *src Pointer to the source scatterlist
* \param *dst Pointer to the destination scatterlist
*/
@ -322,12 +322,12 @@ static void lq_sg_init(struct aes_container *aes_con,struct scatterlist *src,
}
/* \fn static void lq_sg_complete(struct aes_container *aes_con)
/* \fn static void lq_sg_complete(struct aes_container *aes_con)
* \ingroup IFX_AES_FUNCTIONS
* \brief Free the used up memory after encryt/decrypt.
*/
static void lq_sg_complete(struct aes_container *aes_con)
static void lq_sg_complete(struct aes_container *aes_con)
{
unsigned long queue_flag;
@ -355,9 +355,9 @@ static inline struct aes_container *aes_container_cast (
* \ingroup IFX_AES_FUNCTIONS
* \brief Process next packet to be encrypt/decrypt
* \param *aes_con AES container structure
* \param *areq Pointer to memory location where ablkcipher_request is located
* \param *areq Pointer to memory location where ablkcipher_request is located
* \param state The state of the current packet (part of scatterlist or new packet)
* \return -EINVAL: error, -EINPROGRESS: Crypto still running, 1: no more scatterlist
* \return -EINVAL: error, -EINPROGRESS: Crypto still running, 1: no more scatterlist
*/
static int process_next_packet(struct aes_container *aes_con, struct ablkcipher_request *areq,
@ -377,17 +377,17 @@ static int process_next_packet(struct aes_container *aes_con, struct ablkcipher_
dir = aes_con->encdec;
mode = aes_con->mode;
iv = aes_con->iv;
if (state & PROCESS_SCATTER) {
src = scatterwalk_sg_next(areq->src);
dst = scatterwalk_sg_next(areq->dst);
if (!src || !dst) {
spin_unlock_irqrestore(&aes_queue->lock, queue_flag);
return 1;
}
}
else if (state & PROCESS_NEW_PACKET) {
else if (state & PROCESS_NEW_PACKET) {
src = areq->src;
dst = areq->dst;
}
@ -404,7 +404,7 @@ static int process_next_packet(struct aes_container *aes_con, struct ablkcipher_
remain -= inc;
aes_con->nbytes = inc;
if (state & PROCESS_SCATTER) {
aes_con->src_buf += aes_con->nbytes;
aes_con->dst_buf += aes_con->nbytes;
@ -444,7 +444,7 @@ static int process_next_packet(struct aes_container *aes_con, struct ablkcipher_
* \ingroup IFX_AES_FUNCTIONS
* \brief tasklet to signal the dequeuing of the next packet to be processed
* \param unsigned long data Not used
* \return void
* \return void
*/
static void process_queue(unsigned long data)
@ -467,17 +467,17 @@ static int aes_crypto_thread (void *data)
struct ablkcipher_request *areq = NULL;
int err;
unsigned long queue_flag;
daemonize("lq_aes_thread");
printk("AES Queue Manager Starting\n");
while (1)
{
DEU_WAIT_EVENT(deu_dma_priv.deu_thread_wait, AES_ASYNC_EVENT,
DEU_WAIT_EVENT(deu_dma_priv.deu_thread_wait, AES_ASYNC_EVENT,
deu_dma_priv.aes_event_flags);
spin_lock_irqsave(&aes_queue->lock, queue_flag);
/* wait to prevent starting a crypto session before
* exiting the dma interrupt thread.
*/
@ -513,15 +513,15 @@ static int aes_crypto_thread (void *data)
if (aes_con->bytes_processed == 0) {
goto aes_done;
}
/* Process new packet or the next packet in a scatterlist */
if (aes_con->flag & PROCESS_NEW_PACKET) {
aes_con->flag = PROCESS_SCATTER;
err = process_next_packet(aes_con, areq, PROCESS_NEW_PACKET);
}
else
else
err = process_next_packet(aes_con, areq, PROCESS_SCATTER);
if (err == -EINVAL) {
areq->base.complete(&areq->base, err);
lq_sg_complete(aes_con);
@ -529,31 +529,31 @@ static int aes_crypto_thread (void *data)
}
else if (err > 0) {
printk("src/dst returned zero in func: %s\n", __func__);
goto aes_done;
goto aes_done;
}
continue;
aes_done:
//printk("debug line - %d, func: %s, qlen: %d\n", __LINE__, __func__, aes_queue->list.qlen);
areq->base.complete(&areq->base, 0);
areq->base.complete(&areq->base, 0);
lq_sg_complete(aes_con);
spin_lock_irqsave(&aes_queue->lock, queue_flag);
if (aes_queue->list.qlen > 0) {
spin_unlock_irqrestore(&aes_queue->lock, queue_flag);
tasklet_schedule(&aes_queue->aes_task);
tasklet_schedule(&aes_queue->aes_task);
}
else {
aes_queue->hw_status = AES_IDLE;
spin_unlock_irqrestore(&aes_queue->lock, queue_flag);
}
} //while(1)
return 0;
}
/* \fn static int lq_aes_queue_mgr(struct aes_ctx *ctx, struct ablkcipher_request *areq,
return 0;
}
/* \fn static int lq_aes_queue_mgr(struct aes_ctx *ctx, struct ablkcipher_request *areq,
u8 *iv, int dir, int mode)
* \ingroup IFX_AES_FUNCTIONS
* \brief starts the process of queuing DEU requests
@ -565,18 +565,18 @@ aes_done:
* \return 0 if success
*/
static int lq_aes_queue_mgr(struct aes_ctx *ctx, struct ablkcipher_request *areq,
static int lq_aes_queue_mgr(struct aes_ctx *ctx, struct ablkcipher_request *areq,
u8 *iv, int dir, int mode)
{
int err = -EINVAL;
int err = -EINVAL;
unsigned long queue_flag;
struct scatterlist *src = areq->src;
struct scatterlist *dst = areq->dst;
struct aes_container *aes_con = NULL;
u32 remain, inc, nbytes = areq->nbytes;
u32 chunk_bytes = src->length;
aes_con = (struct aes_container *)kmalloc(sizeof(struct aes_container),
GFP_KERNEL);
@ -600,15 +600,15 @@ static int lq_aes_queue_mgr(struct aes_ctx *ctx, struct ablkcipher_request *areq
//printk("debug - Line: %d, func: %s, reqsize: %d, scattersize: %d\n",
// __LINE__, __func__, nbytes, chunk_bytes);
if (remain > DEU_MAX_PACKET_SIZE)
if (remain > DEU_MAX_PACKET_SIZE)
inc = DEU_MAX_PACKET_SIZE;
else if (remain > chunk_bytes)
inc = chunk_bytes;
inc = chunk_bytes;
else
inc = remain;
remain -= inc;
lq_sg_init(aes_con, src, dst);
lq_sg_init(aes_con, src, dst);
if (remain <= 0)
aes_con->complete = 1;
@ -619,7 +619,7 @@ static int lq_aes_queue_mgr(struct aes_ctx *ctx, struct ablkcipher_request *areq
aes_con->iv = iv;
aes_con->mode = mode;
aes_con->encdec = dir;
spin_lock_irqsave(&aes_queue->lock, queue_flag);
if (aes_queue->hw_status == AES_STARTED || aes_queue->hw_status == AES_BUSY ||
@ -638,12 +638,12 @@ static int lq_aes_queue_mgr(struct aes_ctx *ctx, struct ablkcipher_request *areq
spin_unlock_irqrestore(&aes_queue->lock, queue_flag);
return -EINPROGRESS;
}
else if (aes_queue->hw_status == AES_IDLE)
else if (aes_queue->hw_status == AES_IDLE)
aes_queue->hw_status = AES_STARTED;
aes_con->flag = PROCESS_SCATTER;
aes_con->bytes_processed -= aes_con->nbytes;
/* or enqueue the whole structure so as to get back the info
/* or enqueue the whole structure so as to get back the info
* at the moment that it's queued. nbytes might be different */
err = ablkcipher_enqueue_request(&aes_queue->list, &aes_con->arequest);
@ -671,7 +671,7 @@ static int lq_aes_queue_mgr(struct aes_ctx *ctx, struct ablkcipher_request *areq
static int aes_setkey(struct crypto_ablkcipher *tfm, const u8 *in_key,
unsigned int keylen)
{
struct aes_ctx *ctx = crypto_ablkcipher_ctx(tfm);
struct aes_ctx *ctx = crypto_ablkcipher_ctx(tfm);
unsigned long *flags = (unsigned long *) &tfm->base.crt_flags;
DPRINTF(2, "set_key in %s\n", __FILE__);
@ -790,7 +790,7 @@ static int ecb_aes_encrypt (struct ablkcipher_request *areq)
* \brief Decrypt function for AES algo
* \param *areq Pointer to ablkcipher request in memory
* \return 0 is success, -EINPROGRESS if encryting, EINVAL if failure
*/
*/
static int ecb_aes_decrypt(struct ablkcipher_request *areq)
{
@ -864,7 +864,7 @@ static int cfb_aes_decrypt(struct ablkcipher_request *areq)
return lq_aes_queue_mgr(ctx, areq, areq->info, CRYPTO_DIR_DECRYPT, 3);
}
#endif
#endif
/* \fn static int ctr_aes_encrypt(struct ablkcipher_request *areq)
* \ingroup IFX_AES_FUNCTIONS
@ -877,7 +877,7 @@ static int ctr_aes_encrypt (struct ablkcipher_request *areq)
{
struct crypto_ablkcipher *cipher = crypto_ablkcipher_reqtfm(areq);
struct aes_ctx *ctx = crypto_ablkcipher_ctx(cipher);
return lq_aes_queue_mgr(ctx, areq, areq->info, CRYPTO_DIR_ENCRYPT, 4);
}
@ -998,7 +998,7 @@ static struct lq_aes_alg aes_drivers_alg[] = {
.min_keysize = AES_MIN_KEY_SIZE,
.max_keysize = AES_MAX_KEY_SIZE,
.ivsize = AES_BLOCK_SIZE,
}
}
}
},{
.alg = {
@ -1073,7 +1073,7 @@ static struct lq_aes_alg aes_drivers_alg[] = {
int __init lqdeu_async_aes_init (void)
{
int i, j, ret = -EINVAL;
int i, j, ret = -EINVAL;
#define IFX_DEU_DRV_VERSION "2.0.0"
printk(KERN_INFO "Lantiq Technologies DEU Driver version %s\n", IFX_DEU_DRV_VERSION);
@ -1090,16 +1090,16 @@ int __init lqdeu_async_aes_init (void)
CRTCL_SECT_INIT;
printk (KERN_NOTICE "Lantiq DEU AES initialized %s %s.\n",
printk (KERN_NOTICE "Lantiq DEU AES initialized %s %s.\n",
disable_multiblock ? "" : " (multiblock)", disable_deudma ? "" : " (DMA)");
return ret;
aes_err:
for (j = 0; j < i; j++)
for (j = 0; j < i; j++)
crypto_unregister_alg(&aes_drivers_alg[j].alg);
printk(KERN_ERR "Lantiq %s driver initialization failed!\n", (char *)&aes_drivers_alg[i].alg.cra_driver_name);
return ret;
@ -1119,15 +1119,15 @@ ctr_rfc3686_aes_err:
void __exit lqdeu_fini_async_aes (void)
{
int i;
for (i = 0; i < ARRAY_SIZE(aes_drivers_alg); i++)
crypto_unregister_alg(&aes_drivers_alg[i].alg);
aes_queue->hw_status = AES_COMPLETED;
DEU_WAKEUP_EVENT(deu_dma_priv.deu_thread_wait, AES_ASYNC_EVENT,
deu_dma_priv.aes_event_flags);
deu_dma_priv.aes_event_flags);
kfree(aes_queue);
kfree(aes_queue);
}

View File

@ -258,7 +258,7 @@ static int lq_deu_des_core (void *ctx_arg, u8 *out_arg, const u8 *in_arg,
/* memory alignment issue */
dword_mem_aligned_in = (u32 *) DEU_DWORD_REORDERING(in_arg, des_buff_in, BUFFER_IN, nbytes);
deu_priv->deu_rx_buf = (u32 *) out_arg;
deu_priv->deu_rx_len = nbytes;
@ -283,13 +283,13 @@ static int lq_deu_des_core (void *ctx_arg, u8 *out_arg, const u8 *in_arg,
outcopy = (u32 *) DEU_DWORD_REORDERING(out_arg, des_buff_out, BUFFER_OUT, nbytes);
deu_priv->outcopy = outcopy;
deu_priv->event_src = DES_ASYNC_EVENT;
if (mode > 0) {
*(u32 *) iv_arg = DEU_ENDIAN_SWAP(des->IVHR);
*((u32 *) iv_arg + 1) = DEU_ENDIAN_SWAP(des->IVLR);
};
CRTCL_SECT_END;
CRTCL_SECT_END;
return -EINPROGRESS;
@ -330,9 +330,9 @@ static inline struct des_container *des_container_cast(
static void lq_sg_complete(struct des_container *des_con)
{
unsigned long queue_flag;
spin_lock_irqsave(&des_queue->lock, queue_flag);
kfree(des_con);
kfree(des_con);
spin_unlock_irqrestore(&des_queue->lock, queue_flag);
}
@ -367,7 +367,7 @@ static void lq_sg_init(struct des_container *des_con, struct scatterlist *src,
*/
static int process_next_packet(struct des_container *des_con, struct ablkcipher_request *areq,
int state)
int state)
{
u8 *iv;
int mode, encdec, err = -EINVAL;
@ -401,7 +401,7 @@ static int process_next_packet(struct des_container *des_con, struct ablkcipher
remain = des_con->bytes_processed;
chunk_size = src->length;
//printk("debug ln: %d, func: %s, reqsize: %d, scattersize: %d\n",
//printk("debug ln: %d, func: %s, reqsize: %d, scattersize: %d\n",
// __LINE__, __func__, areq->nbytes, chunk_size);
if (remain > DEU_MAX_PACKET_SIZE)
@ -410,14 +410,14 @@ static int process_next_packet(struct des_container *des_con, struct ablkcipher
inc = chunk_size;
else
inc = remain;
remain -= inc;
des_con->nbytes = inc;
if (state & PROCESS_SCATTER) {
des_con->src_buf += des_con->nbytes;
des_con->dst_buf += des_con->nbytes;
}
}
lq_sg_init(des_con, src, dst);
@ -429,7 +429,7 @@ static int process_next_packet(struct des_container *des_con, struct ablkcipher
if (des_queue->hw_status == DES_IDLE) {
des_queue->hw_status = DES_STARTED;
}
des_con->bytes_processed -= des_con->nbytes;
err = ablkcipher_enqueue_request(&des_queue->list, &des_con->arequest);
if (err == -EBUSY) {
@ -441,7 +441,7 @@ static int process_next_packet(struct des_container *des_con, struct ablkcipher
spin_unlock_irqrestore(&des_queue->lock, queue_flag);
err = lq_deu_des_core(ctx, des_con->dst_buf, des_con->src_buf, iv, nbytes, encdec, mode);
return err;
}
@ -449,7 +449,7 @@ static int process_next_packet(struct des_container *des_con, struct ablkcipher
* \ingroup IFX_DES_FUNCTIONS
* \brief Process next packet in queue
* \param data not used
* \return
* \return
*/
static void process_queue(unsigned long data)
@ -474,17 +474,17 @@ static int des_crypto_thread(void *data)
unsigned long queue_flag;
daemonize("lq_des_thread");
while (1)
{
DEU_WAIT_EVENT(deu_dma_priv.deu_thread_wait, DES_ASYNC_EVENT,
{
DEU_WAIT_EVENT(deu_dma_priv.deu_thread_wait, DES_ASYNC_EVENT,
deu_dma_priv.des_event_flags);
spin_lock_irqsave(&des_queue->lock, queue_flag);
/* wait to prevent starting a crypto session before
/* wait to prevent starting a crypto session before
* exiting the dma interrupt thread.
*/
if (des_queue->hw_status == DES_STARTED) {
areq = ablkcipher_dequeue_request(&des_queue->list);
des_con = des_container_cast(areq);
@ -507,7 +507,7 @@ static int des_crypto_thread(void *data)
return 0;
}
spin_unlock_irqrestore(&des_queue->lock, queue_flag);
if ((des_con->bytes_processed == 0)) {
goto des_done;
}
@ -516,25 +516,25 @@ static int des_crypto_thread(void *data)
goto des_done;
}
if (des_con->flag & PROCESS_NEW_PACKET) {
if (des_con->flag & PROCESS_NEW_PACKET) {
des_con->flag = PROCESS_SCATTER;
err = process_next_packet(des_con, areq, PROCESS_NEW_PACKET);
err = process_next_packet(des_con, areq, PROCESS_NEW_PACKET);
}
else
err = process_next_packet(des_con, areq, PROCESS_SCATTER);
err = process_next_packet(des_con, areq, PROCESS_SCATTER);
if (err == -EINVAL) {
areq->base.complete(&areq->base, err);
lq_sg_complete(des_con);
printk("src/dst returned -EINVAL in func: %s\n", __func__);
}
else if (err > 0) {
else if (err > 0) {
printk("src/dst returned zero in func: %s\n", __func__);
goto des_done;
}
continue;
des_done:
//printk("debug line - %d, func: %s, qlen: %d\n", __LINE__, __func__, des_queue->list.qlen);
areq->base.complete(&areq->base, 0);
@ -544,13 +544,13 @@ des_done:
if (des_queue->list.qlen > 0) {
spin_unlock_irqrestore(&des_queue->lock, queue_flag);
tasklet_schedule(&des_queue->des_task);
}
}
else {
des_queue->hw_status = DES_IDLE;
spin_unlock_irqrestore(&des_queue->lock, queue_flag);
}
} // while(1)
return 0;
}
@ -567,7 +567,7 @@ des_done:
* \return 0 if success
*/
static int lq_queue_mgr(struct des_ctx *ctx, struct ablkcipher_request *areq,
static int lq_queue_mgr(struct des_ctx *ctx, struct ablkcipher_request *areq,
u8 *iv, int encdec, int mode)
{
int err = -EINVAL;
@ -577,8 +577,8 @@ static int lq_queue_mgr(struct des_ctx *ctx, struct ablkcipher_request *areq,
struct des_container *des_con = NULL;
u32 remain, inc, nbytes = areq->nbytes;
u32 chunk_bytes = src->length;
des_con = (struct des_container *)kmalloc(sizeof(struct des_container),
des_con = (struct des_container *)kmalloc(sizeof(struct des_container),
GFP_KERNEL);
if (!(des_con)) {
@ -586,7 +586,7 @@ static int lq_queue_mgr(struct des_ctx *ctx, struct ablkcipher_request *areq,
__func__, __LINE__);
return -ENOMEM;
}
/* DES encrypt/decrypt mode */
if (mode == 5) {
nbytes = DES_BLOCK_SIZE;
@ -598,26 +598,26 @@ static int lq_queue_mgr(struct des_ctx *ctx, struct ablkcipher_request *areq,
des_con->arequest = (*areq);
remain = nbytes;
//printk("debug - Line: %d, func: %s, reqsize: %d, scattersize: %d\n",
//printk("debug - Line: %d, func: %s, reqsize: %d, scattersize: %d\n",
// __LINE__, __func__, nbytes, chunk_bytes);
if (remain > DEU_MAX_PACKET_SIZE)
if (remain > DEU_MAX_PACKET_SIZE)
inc = DEU_MAX_PACKET_SIZE;
else if(remain > chunk_bytes)
inc = chunk_bytes;
else
else
inc = remain;
remain -= inc;
lq_sg_init(des_con, src, dst);
if (remain <= 0 ) {
if (remain <= 0 ) {
des_con->complete = 1;
}
else
else
des_con->complete = 0;
des_con->nbytes = inc;
des_con->nbytes = inc;
des_con->iv = iv;
des_con->mode = mode;
des_con->encdec = encdec;
@ -630,20 +630,20 @@ static int lq_queue_mgr(struct des_ctx *ctx, struct ablkcipher_request *areq,
des_con->flag = PROCESS_NEW_PACKET;
err = ablkcipher_enqueue_request(&des_queue->list, &des_con->arequest);
if (err == -EBUSY) {
spin_unlock_irqrestore(&des_queue->lock, queue_flag);
spin_unlock_irqrestore(&des_queue->lock, queue_flag);
printk("Fail to enqueue ablkcipher request ln: %d, err: %d\n",
__LINE__, err);
return err;
}
spin_unlock_irqrestore(&des_queue->lock, queue_flag);
spin_unlock_irqrestore(&des_queue->lock, queue_flag);
return -EINPROGRESS;
}
else if (des_queue->hw_status == DES_IDLE) {
des_queue->hw_status = DES_STARTED;
des_queue->hw_status = DES_STARTED;
}
des_con->flag = PROCESS_SCATTER;
des_con->bytes_processed -= des_con->nbytes;
@ -655,8 +655,8 @@ static int lq_queue_mgr(struct des_ctx *ctx, struct ablkcipher_request *areq,
spin_unlock_irqrestore(&des_queue->lock, queue_flag);
return err;
}
spin_unlock_irqrestore(&des_queue->lock, queue_flag);
spin_unlock_irqrestore(&des_queue->lock, queue_flag);
return lq_deu_des_core(ctx, des_con->dst_buf, des_con->src_buf, iv, inc, encdec, mode);
}
@ -667,7 +667,7 @@ static int lq_queue_mgr(struct des_ctx *ctx, struct ablkcipher_request *areq,
* \param *areq Pointer to ablkcipher request in memory
* \return 0 is success, -EINPROGRESS if encryting, EINVAL if failure
*/
static int lq_des_encrypt(struct ablkcipher_request *areq)
{
struct crypto_ablkcipher *cipher = crypto_ablkcipher_reqtfm(areq);
@ -761,7 +761,7 @@ static struct lq_des_alg des_drivers_alg [] = {
.alg = {
.cra_name = "des",
.cra_driver_name = "lqdeu-des",
.cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_KERN_DRIVER_ONLY | CRYPTO_ALG_ASYNC,
.cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_KERN_DRIVER_ONLY | CRYPTO_ALG_ASYNC,
.cra_blocksize = DES_BLOCK_SIZE,
.cra_ctxsize = sizeof(struct des_ctx),
.cra_type = &crypto_ablkcipher_type,
@ -782,7 +782,7 @@ static struct lq_des_alg des_drivers_alg [] = {
.alg = {
.cra_name = "ecb(des)",
.cra_driver_name = "lqdeu-ecb(des)",
.cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_KERN_DRIVER_ONLY | CRYPTO_ALG_ASYNC,
.cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_KERN_DRIVER_ONLY | CRYPTO_ALG_ASYNC,
.cra_blocksize = DES_BLOCK_SIZE,
.cra_ctxsize = sizeof(struct des_ctx),
.cra_type = &crypto_ablkcipher_type,
@ -802,7 +802,7 @@ static struct lq_des_alg des_drivers_alg [] = {
.alg = {
.cra_name = "cbc(des)",
.cra_driver_name = "lqdeu-cbc(des)",
.cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_KERN_DRIVER_ONLY | CRYPTO_ALG_ASYNC,
.cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_KERN_DRIVER_ONLY | CRYPTO_ALG_ASYNC,
.cra_blocksize = DES_BLOCK_SIZE,
.cra_ctxsize = sizeof(struct des_ctx),
.cra_type = &crypto_ablkcipher_type,
@ -822,7 +822,7 @@ static struct lq_des_alg des_drivers_alg [] = {
.alg = {
.cra_name = "des3_ede",
.cra_driver_name = "lqdeu-des3_ede",
.cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_KERN_DRIVER_ONLY | CRYPTO_ALG_ASYNC,
.cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_KERN_DRIVER_ONLY | CRYPTO_ALG_ASYNC,
.cra_blocksize = DES_BLOCK_SIZE,
.cra_ctxsize = sizeof(struct des_ctx),
.cra_type = &crypto_ablkcipher_type,
@ -842,7 +842,7 @@ static struct lq_des_alg des_drivers_alg [] = {
.alg = {
.cra_name = "ecb(des3_ede)",
.cra_driver_name = "lqdeu-ecb(des3_ede)",
.cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_KERN_DRIVER_ONLY | CRYPTO_ALG_ASYNC,
.cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_KERN_DRIVER_ONLY | CRYPTO_ALG_ASYNC,
.cra_blocksize = DES_BLOCK_SIZE,
.cra_ctxsize = sizeof(struct des_ctx),
.cra_type = &crypto_ablkcipher_type,
@ -857,12 +857,12 @@ static struct lq_des_alg des_drivers_alg [] = {
.max_keysize = DES3_EDE_KEY_SIZE,
.ivsize = DES3_EDE_BLOCK_SIZE,
}
}
}
},{
.alg = {
.cra_name = "cbc(des3_ede)",
.cra_driver_name = "lqdeu-cbc(des3_ede)",
.cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_KERN_DRIVER_ONLY | CRYPTO_ALG_ASYNC,
.cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_KERN_DRIVER_ONLY | CRYPTO_ALG_ASYNC,
.cra_blocksize = DES_BLOCK_SIZE,
.cra_ctxsize = sizeof(struct des_ctx),
.cra_type = &crypto_ablkcipher_type,
@ -878,7 +878,7 @@ static struct lq_des_alg des_drivers_alg [] = {
.ivsize = DES3_EDE_BLOCK_SIZE,
}
}
}
}
};
/*! \fn int __init lqdeu_async_des_init (void)
@ -895,7 +895,7 @@ int __init lqdeu_async_des_init (void)
if (ret)
goto des_err;
}
des_chip_init();
CRTCL_SECT_INIT;
@ -904,7 +904,7 @@ int __init lqdeu_async_des_init (void)
return ret;
des_err:
for (j = 0; j < i; j++)
for (j = 0; j < i; j++)
crypto_unregister_alg(&des_drivers_alg[i].alg);
printk(KERN_ERR "Lantiq %s driver initialization failed!\n", (char *)&des_drivers_alg[i].alg.cra_driver_name);
@ -914,7 +914,7 @@ cbc_des3_ede_err:
for (i = 0; i < ARRAY_SIZE(des_drivers_alg); i++) {
if (!strcmp((char *)&des_drivers_alg[i].alg.cra_name, "cbc(des3_ede)"))
crypto_unregister_alg(&des_drivers_alg[i].alg);
}
}
printk(KERN_ERR "Lantiq %s driver initialization failed!\n", (char *)&des_drivers_alg[i].alg.cra_driver_name);
return ret;
@ -927,14 +927,14 @@ cbc_des3_ede_err:
void __exit lqdeu_fini_async_des (void)
{
int i;
for (i = 0; i < ARRAY_SIZE(des_drivers_alg); i++)
crypto_unregister_alg(&des_drivers_alg[i].alg);
des_queue->hw_status = DES_COMPLETED;
DEU_WAKEUP_EVENT(deu_dma_priv.deu_thread_wait, DES_ASYNC_EVENT,
deu_dma_priv.des_event_flags);
deu_dma_priv.des_event_flags);
kfree(des_queue);
}

View File

@ -54,7 +54,7 @@
#include <crypto/internal/skcipher.h>
#include "ifxmips_deu.h"
#if defined(CONFIG_DANUBE)
#if defined(CONFIG_DANUBE)
#include "ifxmips_deu_danube.h"
extern int ifx_danube_pre_1_4;
#elif defined(CONFIG_AR9)
@ -68,9 +68,9 @@ extern int ifx_danube_pre_1_4;
/* DMA specific header and variables */
#if 0
#define CRTCL_SECT_INIT
#define CRTCL_SECT_START
#define CRTCL_SECT_END
#define CRTCL_SECT_INIT
#define CRTCL_SECT_START
#define CRTCL_SECT_END
#else
spinlock_t des_lock;
#define CRTCL_SECT_INIT spin_lock_init(&des_lock)
@ -121,11 +121,11 @@ extern int disable_deudma;
/*! \fn int des_setkey(struct crypto_tfm *tfm, const u8 *key, unsigned int keylen)
* \ingroup IFX_DES_FUNCTIONS
* \brief sets DES key
* \param tfm linux crypto algo transform
* \param key input key
* \param keylen key length
*/
* \brief sets DES key
* \param tfm linux crypto algo transform
* \param key input key
* \param keylen key length
*/
static int des_setkey(struct crypto_tfm *tfm, const u8 *key,
unsigned int keylen)
{
@ -168,15 +168,15 @@ static int des_setkey_skcipher (struct crypto_skcipher *tfm, const u8 *in_key, u
/*! \fn void ifx_deu_des(void *ctx_arg, u8 *out_arg, const u8 *in_arg, u8 *iv_arg, u32 nbytes, int encdec, int mode)
* \ingroup IFX_DES_FUNCTIONS
* \brief main interface to DES hardware
* \param ctx_arg crypto algo context
* \param out_arg output bytestream
* \param in_arg input bytestream
* \param iv_arg initialization vector
* \param nbytes length of bytestream
* \param encdec 1 for encrypt; 0 for decrypt
* \param mode operation mode such as ebc, cbc
*/
* \brief main interface to DES hardware
* \param ctx_arg crypto algo context
* \param out_arg output bytestream
* \param in_arg input bytestream
* \param iv_arg initialization vector
* \param nbytes length of bytestream
* \param encdec 1 for encrypt; 0 for decrypt
* \param mode operation mode such as ebc, cbc
*/
void ifx_deu_des (void *ctx_arg, u8 *out_arg, const u8 *in_arg,
u8 *iv_arg, u32 nbytes, int encdec, int mode)
@ -188,7 +188,7 @@ void ifx_deu_des (void *ctx_arg, u8 *out_arg, const u8 *in_arg,
int i = 0;
int nblocks = 0;
CRTCL_SECT_START;
des->controlr.M = dctx->controlr_M;
@ -242,10 +242,10 @@ void ifx_deu_des (void *ctx_arg, u8 *out_arg, const u8 *in_arg,
#ifdef CRYPTO_DEBUG
printk ("ihr: %x\n", (*((u32 *) in_arg + i)));
printk ("ilr: %x\n", (*((u32 *) in_arg + 1 + i)));
#endif
#endif
des->IHR = INPUT_ENDIAN_SWAP(*((u32 *) in_arg + i));
des->ILR = INPUT_ENDIAN_SWAP(*((u32 *) in_arg + 1 + i)); /* start crypto */
while (des->controlr.BUS) {
// this will not take long
}
@ -256,7 +256,7 @@ void ifx_deu_des (void *ctx_arg, u8 *out_arg, const u8 *in_arg,
}
if (mode > 0) {
*(u32 *) iv_arg = DEU_ENDIAN_SWAP(des->IVHR);
*((u32 *) iv_arg + 1) = DEU_ENDIAN_SWAP(des->IVLR);
@ -275,26 +275,26 @@ void ifx_deu_des (void *ctx_arg, u8 *out_arg, const u8 *in_arg,
/*! \fn void ifx_deu_des(void *ctx_arg, u8 *out_arg, const u8 *in_arg, u8 *iv_arg, u32 nbytes, int encdec, int mode)
* \ingroup IFX_DES_FUNCTIONS
* \brief main interface to DES hardware
* \param ctx_arg crypto algo context
* \param out_arg output bytestream
* \param in_arg input bytestream
* \param iv_arg initialization vector
* \param nbytes length of bytestream
* \param encdec 1 for encrypt; 0 for decrypt
* \param mode operation mode such as ebc, cbc
*/
* \brief main interface to DES hardware
* \param ctx_arg crypto algo context
* \param out_arg output bytestream
* \param in_arg input bytestream
* \param iv_arg initialization vector
* \param nbytes length of bytestream
* \param encdec 1 for encrypt; 0 for decrypt
* \param mode operation mode such as ebc, cbc
*/
/*! \fn void ifx_deu_des_ecb (void *ctx, uint8_t *dst, const uint8_t *src, uint8_t *iv, size_t nbytes, int encdec, int inplace)
* \ingroup IFX_DES_FUNCTIONS
* \brief sets DES hardware to ECB mode
* \param ctx crypto algo context
* \param dst output bytestream
* \param src input bytestream
* \param iv initialization vector
* \param nbytes length of bytestream
* \param encdec 1 for encrypt; 0 for decrypt
* \param inplace not used
* \brief sets DES hardware to ECB mode
* \param ctx crypto algo context
* \param dst output bytestream
* \param src input bytestream
* \param iv initialization vector
* \param nbytes length of bytestream
* \param encdec 1 for encrypt; 0 for decrypt
* \param inplace not used
*/
static void ifx_deu_des_ecb (void *ctx, uint8_t *dst, const uint8_t *src,
uint8_t *iv, size_t nbytes, int encdec, int inplace)
@ -304,15 +304,15 @@ static void ifx_deu_des_ecb (void *ctx, uint8_t *dst, const uint8_t *src,
/*! \fn void ifx_deu_des_cbc (void *ctx, uint8_t *dst, const uint8_t *src, uint8_t *iv, size_t nbytes, int encdec, int inplace)
* \ingroup IFX_DES_FUNCTIONS
* \brief sets DES hardware to CBC mode
* \param ctx crypto algo context
* \param dst output bytestream
* \param src input bytestream
* \param iv initialization vector
* \param nbytes length of bytestream
* \param encdec 1 for encrypt; 0 for decrypt
* \param inplace not used
*/
* \brief sets DES hardware to CBC mode
* \param ctx crypto algo context
* \param dst output bytestream
* \param src input bytestream
* \param iv initialization vector
* \param nbytes length of bytestream
* \param encdec 1 for encrypt; 0 for decrypt
* \param inplace not used
*/
static void ifx_deu_des_cbc (void *ctx, uint8_t *dst, const uint8_t *src,
uint8_t *iv, size_t nbytes, int encdec, int inplace)
{
@ -321,15 +321,15 @@ static void ifx_deu_des_cbc (void *ctx, uint8_t *dst, const uint8_t *src,
/*! \fn void ifx_deu_des_ofb (void *ctx, uint8_t *dst, const uint8_t *src, uint8_t *iv, size_t nbytes, int encdec, int inplace)
* \ingroup IFX_DES_FUNCTIONS
* \brief sets DES hardware to OFB mode
* \param ctx crypto algo context
* \param dst output bytestream
* \param src input bytestream
* \param iv initialization vector
* \param nbytes length of bytestream
* \param encdec 1 for encrypt; 0 for decrypt
* \param inplace not used
*/
* \brief sets DES hardware to OFB mode
* \param ctx crypto algo context
* \param dst output bytestream
* \param src input bytestream
* \param iv initialization vector
* \param nbytes length of bytestream
* \param encdec 1 for encrypt; 0 for decrypt
* \param inplace not used
*/
/*
static void ifx_deu_des_ofb (void *ctx, uint8_t *dst, const uint8_t *src,
uint8_t *iv, size_t nbytes, int encdec, int inplace)
@ -340,15 +340,15 @@ static void ifx_deu_des_ofb (void *ctx, uint8_t *dst, const uint8_t *src,
/*! \fn void ifx_deu_des_cfb (void *ctx, uint8_t *dst, const uint8_t *src, uint8_t *iv, size_t nbytes, int encdec, int inplace)
\ingroup IFX_DES_FUNCTIONS
\brief sets DES hardware to CFB mode
\param ctx crypto algo context
\param dst output bytestream
\param src input bytestream
\param iv initialization vector
\param nbytes length of bytestream
\param encdec 1 for encrypt; 0 for decrypt
\param inplace not used
*/
\brief sets DES hardware to CFB mode
\param ctx crypto algo context
\param dst output bytestream
\param src input bytestream
\param iv initialization vector
\param nbytes length of bytestream
\param encdec 1 for encrypt; 0 for decrypt
\param inplace not used
*/
/*
static void ifx_deu_des_cfb (void *ctx, uint8_t *dst, const uint8_t *src,
uint8_t *iv, size_t nbytes, int encdec, int inplace)
@ -359,15 +359,15 @@ static void ifx_deu_des_cfb (void *ctx, uint8_t *dst, const uint8_t *src,
/*! \fn void ifx_deu_des_ctr (void *ctx, uint8_t *dst, const uint8_t *src, uint8_t *iv, size_t nbytes, int encdec, int inplace)
* \ingroup IFX_DES_FUNCTIONS
* \brief sets DES hardware to CTR mode
* \param ctx crypto algo context
* \param dst output bytestream
* \param src input bytestream
* \param iv initialization vector
* \param nbytes length of bytestream
* \param encdec 1 for encrypt; 0 for decrypt
* \param inplace not used
*/
* \brief sets DES hardware to CTR mode
* \param ctx crypto algo context
* \param dst output bytestream
* \param src input bytestream
* \param iv initialization vector
* \param nbytes length of bytestream
* \param encdec 1 for encrypt; 0 for decrypt
* \param inplace not used
*/
/*
void ifx_deu_des_ctr (void *ctx, uint8_t *dst, const uint8_t *src,
uint8_t *iv, size_t nbytes, int encdec, int inplace)
@ -378,11 +378,11 @@ void ifx_deu_des_ctr (void *ctx, uint8_t *dst, const uint8_t *src,
/*! \fn void ifx_deu_des_encrypt (struct crypto_tfm *tfm, uint8_t *out, const uint8_t *in)
* \ingroup IFX_DES_FUNCTIONS
* \brief encrypt DES_BLOCK_SIZE of data
* \param tfm linux crypto algo transform
* \param out output bytestream
* \param in input bytestream
*/
* \brief encrypt DES_BLOCK_SIZE of data
* \param tfm linux crypto algo transform
* \param out output bytestream
* \param in input bytestream
*/
static void ifx_deu_des_encrypt (struct crypto_tfm *tfm, uint8_t * out, const uint8_t * in)
{
struct ifx_deu_des_ctx *ctx = crypto_tfm_ctx(tfm);
@ -393,11 +393,11 @@ static void ifx_deu_des_encrypt (struct crypto_tfm *tfm, uint8_t * out, const ui
/*! \fn void ifx_deu_des_decrypt (struct crypto_tfm *tfm, uint8_t *out, const uint8_t *in)
* \ingroup IFX_DES_FUNCTIONS
* \brief encrypt DES_BLOCK_SIZE of data
* \param tfm linux crypto algo transform
* \param out output bytestream
* \param in input bytestream
*/
* \brief encrypt DES_BLOCK_SIZE of data
* \param tfm linux crypto algo transform
* \param out output bytestream
* \param in input bytestream
*/
static void ifx_deu_des_decrypt (struct crypto_tfm *tfm, uint8_t * out, const uint8_t * in)
{
struct ifx_deu_des_ctx *ctx = crypto_tfm_ctx(tfm);
@ -421,11 +421,11 @@ static void ifx_deu_des_decrypt (struct crypto_tfm *tfm, uint8_t * out, const ui
/*! \fn int des3_ede_setkey(struct crypto_tfm *tfm, const u8 *key, unsigned int keylen)
* \ingroup IFX_DES_FUNCTIONS
* \brief sets 3DES key
* \param tfm linux crypto algo transform
* \param key input key
* \param keylen key length
*/
* \brief sets 3DES key
* \param tfm linux crypto algo transform
* \param key input key
* \param keylen key length
*/
static int des3_ede_setkey(struct crypto_tfm *tfm, const u8 *key,
unsigned int keylen)
{
@ -468,7 +468,7 @@ static int des3_ede_setkey_skcipher(struct crypto_skcipher *tfm, const u8 *key,
/*
* \brief DES function mappings
*/
*/
struct crypto_alg ifxdeu_des_alg = {
.cra_name = "des",
.cra_driver_name = "ifxdeu-des",
@ -489,7 +489,7 @@ struct crypto_alg ifxdeu_des_alg = {
/*
* \brief DES function mappings
*/
*/
struct crypto_alg ifxdeu_des3_ede_alg = {
.cra_name = "des3_ede",
.cra_driver_name = "ifxdeu-des3_ede",
@ -525,7 +525,7 @@ static int ecb_des_encrypt(struct skcipher_request *req)
while ((nbytes = enc_bytes = walk.nbytes)) {
enc_bytes -= (nbytes % DES_BLOCK_SIZE);
ifx_deu_des_ecb(ctx, walk.dst.virt.addr, walk.src.virt.addr,
ifx_deu_des_ecb(ctx, walk.dst.virt.addr, walk.src.virt.addr,
NULL, enc_bytes, CRYPTO_DIR_ENCRYPT, 0);
nbytes &= DES_BLOCK_SIZE - 1;
err = skcipher_walk_done(&walk, nbytes);
@ -552,7 +552,7 @@ static int ecb_des_decrypt(struct skcipher_request *req)
while ((nbytes = dec_bytes = walk.nbytes)) {
dec_bytes -= (nbytes % DES_BLOCK_SIZE);
ifx_deu_des_ecb(ctx, walk.dst.virt.addr, walk.src.virt.addr,
ifx_deu_des_ecb(ctx, walk.dst.virt.addr, walk.src.virt.addr,
NULL, dec_bytes, CRYPTO_DIR_DECRYPT, 0);
nbytes &= DES_BLOCK_SIZE - 1;
err = skcipher_walk_done(&walk, nbytes);
@ -618,7 +618,7 @@ static int cbc_des_encrypt(struct skcipher_request *req)
while ((nbytes = enc_bytes = walk.nbytes)) {
u8 *iv = walk.iv;
enc_bytes -= (nbytes % DES_BLOCK_SIZE);
ifx_deu_des_cbc(ctx, walk.dst.virt.addr, walk.src.virt.addr,
ifx_deu_des_cbc(ctx, walk.dst.virt.addr, walk.src.virt.addr,
iv, enc_bytes, CRYPTO_DIR_ENCRYPT, 0);
nbytes &= DES_BLOCK_SIZE - 1;
err = skcipher_walk_done(&walk, nbytes);
@ -646,7 +646,7 @@ static int cbc_des_decrypt(struct skcipher_request *req)
while ((nbytes = dec_bytes = walk.nbytes)) {
u8 *iv = walk.iv;
dec_bytes -= (nbytes % DES_BLOCK_SIZE);
ifx_deu_des_cbc(ctx, walk.dst.virt.addr, walk.src.virt.addr,
ifx_deu_des_cbc(ctx, walk.dst.virt.addr, walk.src.virt.addr,
iv, dec_bytes, CRYPTO_DIR_DECRYPT, 0);
nbytes &= DES_BLOCK_SIZE - 1;
err = skcipher_walk_done(&walk, nbytes);
@ -697,8 +697,8 @@ struct skcipher_alg ifxdeu_cbc_des3_ede_alg = {
/*! \fn int ifxdeu_init_des (void)
* \ingroup IFX_DES_FUNCTIONS
* \brief initialize des driver
*/
* \brief initialize des driver
*/
int ifxdeu_init_des (void)
{
int ret = -ENOSYS;
@ -765,8 +765,8 @@ cbc_des3_ede_err:
/*! \fn void ifxdeu_fini_des (void)
* \ingroup IFX_DES_FUNCTIONS
* \brief unregister des driver
*/
* \brief unregister des driver
*/
void ifxdeu_fini_des (void)
{
crypto_unregister_alg (&ifxdeu_des_alg);

View File

@ -65,7 +65,7 @@
#include "ifxmips_deu_ar9.h"
#elif defined(CONFIG_VR9) || defined(CONFIG_AR10)
#include "ifxmips_deu_vr9.h"
#else
#else
#error "Platform unknown!"
#endif /* CONFIG_xxxx */
@ -77,10 +77,10 @@ void chip_version(void);
/*! \fn static int __init deu_init (void)
* \ingroup IFX_DEU_FUNCTIONS
* \brief link all modules that have been selected in kernel config for ifx hw crypto support
* \return ret
*/
* \brief link all modules that have been selected in kernel config for ifx hw crypto support
* \return ret
*/
static int ltq_deu_probe(struct platform_device *pdev)
{
int ret = -ENOSYS;
@ -88,7 +88,7 @@ static int ltq_deu_probe(struct platform_device *pdev)
START_DEU_POWER;
CRTCL_SECT_HASH_INIT;
#define IFX_DEU_DRV_VERSION "2.0.0"
printk(KERN_INFO "Infineon Technologies DEU driver version %s \n", IFX_DEU_DRV_VERSION);
@ -141,8 +141,8 @@ static int ltq_deu_probe(struct platform_device *pdev)
/*! \fn static void __exit deu_fini (void)
* \ingroup IFX_DEU_FUNCTIONS
* \brief remove the loaded crypto algorithms
*/
* \brief remove the loaded crypto algorithms
*/
static void ltq_deu_remove(struct platform_device *pdev)
{
//#ifdef CONFIG_CRYPTO_DEV_PWR_SAVE_MODE

View File

@ -96,8 +96,8 @@
clc->DISR = 1; \
} while (0)
/*
* Not used anymore in UEIP (use IFX_DES_CON, IFX_AES_CON, etc instead)
/*
* Not used anymore in UEIP (use IFX_DES_CON, IFX_AES_CON, etc instead)
* #define DEU_BASE (KSEG1+0x1E103100)
* #define DES_CON (DEU_BASE+0x10)
* #define AES_CON (DEU_BASE+0x50)
@ -153,7 +153,7 @@ extern spinlock_t ltq_deu_hash_lock;
set_bit((event), &(flags)); \
wake_up_interruptible(&(queue)); \
}while (0)
#define DEU_WAIT_EVENT(queue, event, flags) \
do { \
wait_event_interruptible(queue, \
@ -184,7 +184,7 @@ typedef struct deu_drv_priv {
* @lock: spinlock lock
* @lock_flag: flag for spinlock activities
* @list: crypto queue API list
* @hw_status: DEU hw status flag
* @hw_status: DEU hw status flag
* @aes_wait_flag: flag for sleep queue
* @aes_wait_queue: queue attributes for aes
* @bytes_processed: number of bytes to process by DEU
@ -230,7 +230,7 @@ typedef struct {
struct tasklet_struct des_task;
} des_priv_t;
#endif /* IFXMIPS_DEU_H */

View File

@ -31,8 +31,8 @@
\brief ifx deu board specific driver file for ar9
*/
/*!
\defgroup BOARD_SPECIFIC_FUNCTIONS IFX_BOARD_SPECIFIC_FUNCTIONS
/*!
\defgroup BOARD_SPECIFIC_FUNCTIONS IFX_BOARD_SPECIFIC_FUNCTIONS
\ingroup IFX_DEU
\brief board specific functions
*/
@ -71,9 +71,9 @@ u8 *g_dma_block2 = NULL;
deu_drv_priv_t deu_dma_priv;
/*! \fn u32 endian_swap(u32 input)
/*! \fn u32 endian_swap(u32 input)
* \ingroup BOARD_SPECIFIC_FUNCTIONS
* \brief Swap data given to the function
* \brief Swap data given to the function
* \param input Data input to be swapped
* \return either the swapped data or the input data depending on whether it is in DMA mode or FPI mode
*/
@ -84,7 +84,7 @@ u32 endian_swap(u32 input)
/*! \fn u32 input_swap(u32 input)
* \ingroup BOARD_SPECIFIC_FUNCTIONS
* \brief Not used
* \brief Not used
* \return input
*/
@ -95,7 +95,7 @@ u32 input_swap(u32 input)
/*! \fn void aes_chip_init (void)
* \ingroup BOARD_SPECIFIC_FUNCTIONS
* \brief initialize AES hardware
* \brief initialize AES hardware
*/
void aes_chip_init (void)
@ -110,8 +110,8 @@ void aes_chip_init (void)
/*! \fn void des_chip_init (void)
* \ingroup BOARD_SPECIFIC_FUNCTIONS
* \brief initialize DES hardware
*/
*/
void des_chip_init (void)
{
volatile struct des_t *des = (struct des_t *) DES_3DES_START;
@ -123,12 +123,12 @@ void des_chip_init (void)
}
/*! \fn void chip_version(void)
/*! \fn void chip_version(void)
* \ingroup BOARD_SPECIFIC_FUNCTIONS
* \brief not used!
*/
*/
void chip_version(void)
void chip_version(void)
{
return;
}

View File

@ -65,9 +65,9 @@
#define INPUT_ENDIAN_SWAP(input) input_swap(input)
#define DEU_ENDIAN_SWAP(input) endian_swap(input)
#define DELAY_PERIOD 10
#define DELAY_PERIOD 10
#define FIND_DEU_CHIP_VERSION chip_version()
#define CLC_START IFX_DEU_CLK
#define CLC_START IFX_DEU_CLK
#define AES_INIT 0
#define DES_INIT 1
@ -79,7 +79,7 @@
#define AES_START IFX_AES_CON
#define DES_3DES_START IFX_DES_CON
#define WAIT_AES_DMA_READY() \
do { \
int i; \
@ -126,7 +126,7 @@
} while(0)
/* DEU Common Structures for AR9*/
struct clc_controlr_t {
u32 Res:26;
u32 FSOE:1;
@ -233,7 +233,7 @@ struct arc4_t {
u32 reserved3:1;
u32 ARS:1;
u32 SM:1;
u32 reserved4:4;
u32 reserved4:4;
} controlr;
u32 K3R; //104h
@ -247,7 +247,7 @@ struct arc4_t {
u32 ID2R; //11Ch
u32 ID1R; //120h
u32 ID0R; //124h
u32 OD3R; //128h
u32 OD2R; //12Ch
u32 OD1R; //130h
@ -257,14 +257,14 @@ struct arc4_t {
struct deu_hash_t {
struct hash_controlr {
u32 reserved1:5;
u32 KHS:1;
u32 KHS:1;
u32 GO:1;
u32 INIT:1;
u32 reserved2:6;
u32 NDC:1;
u32 ENDI:1;
u32 reserved3:7;
u32 DGRY:1;
u32 DGRY:1;
u32 BSY:1;
u32 reserved4:1;
u32 IRCL:1;

View File

@ -52,14 +52,14 @@
/* Function Declerations */
int aes_memory_allocate(int value);
int des_memory_allocate(int value);
void memory_release(u32 *addr);
void memory_release(u32 *addr);
int aes_chip_init (void);
void des_chip_init (void);
int deu_dma_init (void);
u32 endian_swap(u32 input);
u32* memory_alignment(const u8 *arg, u32 *buff_alloc, int in_out, int nbytes);
void dma_memory_copy(u32 *outcopy, u32 *out_dma, u8 *out_arg, int nbytes);
void chip_version(void);
void chip_version(void);
void deu_dma_priv_init(void);
void __exit ifxdeu_fini_dma(void);
@ -68,7 +68,7 @@ void __exit ifxdeu_fini_dma(void);
#define CLC_START IFX_DEU_CLK
/* Variables definition */
int ifx_danube_pre_1_4;
int ifx_danube_pre_1_4;
u8 *g_dma_page_ptr = NULL;
u8 *g_dma_block = NULL;
u8 *g_dma_block2 = NULL;
@ -76,7 +76,7 @@ u8 *g_dma_block2 = NULL;
deu_drv_priv_t deu_dma_priv;
/*! \fn u32 endian_swap(u32 input)
/*! \fn u32 endian_swap(u32 input)
* \ingroup BOARD_SPECIFIC_FUNCTIONS
* \brief function is not used
* \param input Data input to be swapped
@ -91,8 +91,8 @@ u32 endian_swap(u32 input)
/*! \fn u32 input_swap(u32 input)
* \ingroup BOARD_SPECIFIC_FUNCTIONS
* \brief Swap the input data if the current chip is Danube version
* 1.4 and do nothing to the data if the current chip is
* Danube version 1.3
* 1.4 and do nothing to the data if the current chip is
* Danube version 1.3
* \param input data that needs to be swapped
* \return input or swapped input
*/
@ -101,9 +101,9 @@ u32 input_swap(u32 input)
{
if (!ifx_danube_pre_1_4) {
u8 *ptr = (u8 *)&input;
return ((ptr[3] << 24) | (ptr[2] << 16) | (ptr[1] << 8) | ptr[0]);
return ((ptr[3] << 24) | (ptr[2] << 16) | (ptr[1] << 8) | ptr[0]);
}
else
else
return input;
}
@ -111,7 +111,7 @@ u32 input_swap(u32 input)
/*! \fn void aes_chip_init (void)
* \ingroup BOARD_SPECIFIC_FUNCTIONS
* \brief initialize AES hardware
* \brief initialize AES hardware
*/
int aes_chip_init (void)
@ -127,8 +127,8 @@ int aes_chip_init (void)
/*! \fn void des_chip_init (void)
* \ingroup BOARD_SPECIFIC_FUNCTIONS
* \brief initialize DES hardware
*/
*/
void des_chip_init (void)
{
volatile struct des_t *des = (struct des_t *) DES_3DES_START;
@ -142,11 +142,11 @@ void des_chip_init (void)
* \ingroup IFX_DES_FUNCTIONS
* \brief To find the version of the chip by looking at the chip ID
* \param ifx_danube_pre_1_4 (sets to 1 if Chip is Danube less than v1.4)
*/
*/
#define IFX_MPS (KSEG1 | 0x1F107000)
#define IFX_MPS_CHIPID ((volatile u32*)(IFX_MPS + 0x0344))
void chip_version(void)
void chip_version(void)
{
/* DANUBE PRE 1.4 SOFTWARE FIX */
@ -159,7 +159,7 @@ void chip_version(void)
printk("Danube Chip ver. 1.4 detected. \n");
}
else {
ifx_danube_pre_1_4 = 1;
ifx_danube_pre_1_4 = 1;
printk("Danube Chip ver. 1.3 or below detected. \n");
}

View File

@ -71,7 +71,7 @@
#define AES_INIT 0
#define DES_INIT 1
#define SHA1_INIT 2
#define SHA1_INIT 2
#define MD5_INIT 3
#define WAIT_AES_DMA_READY() \
@ -94,7 +94,7 @@
udelay(DELAY_PERIOD); \
while (dma->controlr.BSY) {}; \
while (des->controlr.BUS) {}; \
} while (0)
} while (0)
#define SHA_HASH_INIT \
do { \
@ -167,12 +167,12 @@ struct aes_t {
u32 PNK:1;
u32 GO:1;
u32 STP:1;
u32 reserved2:6;
u32 NDC:1;
u32 ENDI:1;
u32 ENDI:1;
u32 reserved3:2;
u32 F:3; //fbs
u32 O:3; //om
u32 BUS:1; //bsy
@ -209,14 +209,14 @@ struct aes_t {
struct deu_hash_t {
struct hash_controlr {
u32 reserved1:5;
u32 KHS:1;
u32 KHS:1;
u32 GO:1;
u32 INIT:1;
u32 reserved2:6;
u32 NDC:1;
u32 ENDI:1;
u32 reserved3:7;
u32 DGRY:1;
u32 DGRY:1;
u32 BSY:1;
u32 reserved4:1;
u32 IRCL:1;

View File

@ -29,7 +29,7 @@
/*!
\file ifxmips_deu_dma.c
\ingroup IFX_DEU
\brief DMA deu driver file
\brief DMA deu driver file
*/
/*!
@ -38,5 +38,5 @@
\brief deu-dma driver functions
*/
/* Project header files */
/* Project header files */

View File

@ -72,9 +72,9 @@ u8 *g_dma_block2 = NULL;
deu_drv_priv_t deu_dma_priv;
/*! \fn u32 endian_swap(u32 input)
/*! \fn u32 endian_swap(u32 input)
* \ingroup BOARD_SPECIFIC_FUNCTIONS
* \brief Swap data given to the function
* \brief Swap data given to the function
* \param input Data input to be swapped
* \return either the swapped data or the input data depending on whether it is in DMA mode or FPI mode
*/
@ -87,7 +87,7 @@ u32 endian_swap(u32 input)
/*! \fn u32 input_swap(u32 input)
* \ingroup BOARD_SPECIFIC_FUNCTIONS
* \brief Not used
* \brief Not used
* \return input
*/
@ -98,7 +98,7 @@ u32 input_swap(u32 input)
/*! \fn void aes_chip_init (void)
* \ingroup BOARD_SPECIFIC_FUNCTIONS
* \brief initialize AES hardware
* \brief initialize AES hardware
*/
void aes_chip_init (void)
@ -112,14 +112,14 @@ void aes_chip_init (void)
aes->controlr.ENDI = 1;
asm("sync");
aes->controlr.ARS = 0;
}
/*! \fn void des_chip_init (void)
* \ingroup IFX_AES_FUNCTIONS
* \brief initialize DES hardware
*/
*/
void des_chip_init (void)
{
volatile struct des_t *des = (struct des_t *) DES_3DES_START;
@ -129,7 +129,7 @@ void des_chip_init (void)
des->controlr.NDC = 1;
asm("sync");
des->controlr.ENDI = 1;
asm("sync");
asm("sync");
des->controlr.ARS = 0;
}
@ -137,7 +137,7 @@ void des_chip_init (void)
* \ingroup IFX_DES_FUNCTIONS
* \brief function not used in VR9
*/
void chip_version(void)
void chip_version(void)
{
return;
}

View File

@ -87,14 +87,14 @@
#define INPUT_ENDIAN_SWAP(input) input_swap(input)
#define DEU_ENDIAN_SWAP(input) endian_swap(input)
#define FIND_DEU_CHIP_VERSION chip_version()
#define FIND_DEU_CHIP_VERSION chip_version()
#if defined (CONFIG_AR10)
#define DELAY_PERIOD 30
#else
#define DELAY_PERIOD 10
#endif
#define WAIT_AES_DMA_READY() \
do { \
int i; \
@ -143,7 +143,7 @@
} while(0)
/* DEU Common Structures for AR9*/
struct clc_controlr_t {
u32 Res:26;
u32 FSOE:1;
@ -250,7 +250,7 @@ struct arc4_t {
u32 reserved3:1;
u32 ARS:1;
u32 SM:1;
u32 reserved4:4;
u32 reserved4:4;
} controlr;
u32 K3R; //104h
@ -264,7 +264,7 @@ struct arc4_t {
u32 ID2R; //11Ch
u32 ID1R; //120h
u32 ID0R; //124h
u32 OD3R; //128h
u32 OD2R; //12Ch
u32 OD1R; //130h
@ -274,14 +274,14 @@ struct arc4_t {
struct deu_hash_t {
struct hash_controlr {
u32 reserved1:5;
u32 KHS:1;
u32 KHS:1;
u32 GO:1;
u32 INIT:1;
u32 reserved2:6;
u32 NDC:1;
u32 ENDI:1;
u32 reserved3:7;
u32 DGRY:1;
u32 DGRY:1;
u32 BSY:1;
u32 reserved4:1;
u32 IRCL:1;

View File

@ -29,7 +29,7 @@
/*!
\file ifxmips_md5.c
\ingroup IFX_DEU
\brief MD5 encryption deu driver file
\brief MD5 encryption deu driver file
*/
/*!
@ -83,10 +83,10 @@ extern int disable_deudma;
/*! \fn static void md5_transform(u32 *hash, u32 const *in)
* \ingroup IFX_MD5_FUNCTIONS
* \brief main interface to md5 hardware
* \param hash current hash value
* \param in 64-byte block of input
*/
* \brief main interface to md5 hardware
* \param hash current hash value
* \param in 64-byte block of input
*/
static void md5_transform(struct md5_ctx *mctx, u32 *hash, u32 const *in)
{
int i;
@ -97,7 +97,7 @@ static void md5_transform(struct md5_ctx *mctx, u32 *hash, u32 const *in)
MD5_HASH_INIT;
if (mctx->started) {
if (mctx->started) {
hashs->D1R = *((u32 *) hash + 0);
hashs->D2R = *((u32 *) hash + 1);
hashs->D3R = *((u32 *) hash + 2);
@ -126,9 +126,9 @@ static void md5_transform(struct md5_ctx *mctx, u32 *hash, u32 const *in)
/*! \fn static inline void md5_transform_helper(struct md5_ctx *ctx)
* \ingroup IFX_MD5_FUNCTIONS
* \brief interfacing function for md5_transform()
* \param ctx crypto context
*/
* \brief interfacing function for md5_transform()
* \param ctx crypto context
*/
static inline void md5_transform_helper(struct md5_ctx *ctx)
{
//le32_to_cpu_array(ctx->block, sizeof(ctx->block) / sizeof(u32));
@ -137,9 +137,9 @@ static inline void md5_transform_helper(struct md5_ctx *ctx)
/*! \fn static void md5_init(struct crypto_tfm *tfm)
* \ingroup IFX_MD5_FUNCTIONS
* \brief initialize md5 hardware
* \param tfm linux crypto algo transform
*/
* \brief initialize md5 hardware
* \param tfm linux crypto algo transform
*/
static int md5_init(struct shash_desc *desc)
{
struct md5_ctx *mctx = shash_desc_ctx(desc);
@ -152,11 +152,11 @@ static int md5_init(struct shash_desc *desc)
/*! \fn static void md5_update(struct crypto_tfm *tfm, const u8 *data, unsigned int len)
* \ingroup IFX_MD5_FUNCTIONS
* \brief on-the-fly md5 computation
* \param tfm linux crypto algo transform
* \param data input data
* \param len size of input data
*/
* \brief on-the-fly md5 computation
* \param tfm linux crypto algo transform
* \param data input data
* \param len size of input data
*/
static int md5_update(struct shash_desc *desc, const u8 *data, unsigned int len)
{
struct md5_ctx *mctx = shash_desc_ctx(desc);
@ -190,10 +190,10 @@ static int md5_update(struct shash_desc *desc, const u8 *data, unsigned int len)
/*! \fn static void md5_final(struct crypto_tfm *tfm, u8 *out)
* \ingroup IFX_MD5_FUNCTIONS
* \brief compute final md5 value
* \param tfm linux crypto algo transform
* \param out final md5 output value
*/
* \brief compute final md5 value
* \param tfm linux crypto algo transform
* \param out final md5 output value
*/
static int md5_final(struct shash_desc *desc, u8 *out)
{
struct md5_ctx *mctx = shash_desc_ctx(desc);
@ -215,7 +215,7 @@ static int md5_final(struct shash_desc *desc, u8 *out)
mctx->block[14] = le32_to_cpu(mctx->byte_count << 3);
mctx->block[15] = le32_to_cpu(mctx->byte_count >> 29);
md5_transform(mctx, mctx->hash, mctx->block);
md5_transform(mctx, mctx->hash, mctx->block);
memcpy(out, mctx->hash, MD5_DIGEST_SIZE);
@ -246,8 +246,8 @@ static struct shash_alg ifxdeu_md5_alg = {
/*! \fn int ifxdeu_init_md5 (void)
* \ingroup IFX_MD5_FUNCTIONS
* \brief initialize md5 driver
*/
* \brief initialize md5 driver
*/
int ifxdeu_init_md5 (void)
{
int ret = -ENOSYS;
@ -266,9 +266,9 @@ md5_err:
/*! \fn void ifxdeu_fini_md5 (void)
* \ingroup IFX_MD5_FUNCTIONS
* \brief unregister md5 driver
*/
* \brief unregister md5 driver
*/
void ifxdeu_fini_md5 (void)
{
crypto_unregister_shash(&ifxdeu_md5_alg);

View File

@ -60,7 +60,7 @@
#define MD5_HMAC_BLOCK_SIZE 64
#define MD5_BLOCK_WORDS 16
#define MD5_HASH_WORDS 4
#define MD5_HMAC_DBN_TEMP_SIZE 1024 // size in dword, needed for dbn workaround
#define MD5_HMAC_DBN_TEMP_SIZE 1024 // size in dword, needed for dbn workaround
#define HASH_START IFX_HASH_CON
//#define CRYPTO_DEBUG
@ -91,10 +91,10 @@ static int md5_hmac_final_impl(struct shash_desc *desc, u8 *out, bool hash_final
/*! \fn static void md5_hmac_transform(struct crypto_tfm *tfm, u32 const *in)
* \ingroup IFX_MD5_HMAC_FUNCTIONS
* \brief save input block to context
* \param tfm linux crypto algo transform
* \param in 64-byte block of input
*/
* \brief save input block to context
* \param tfm linux crypto algo transform
* \param in 64-byte block of input
*/
static void md5_hmac_transform(struct shash_desc *desc, u32 const *in)
{
struct md5_hmac_ctx *mctx = crypto_shash_ctx(desc->tfm);
@ -111,12 +111,12 @@ static void md5_hmac_transform(struct shash_desc *desc, u32 const *in)
/*! \fn int md5_hmac_setkey(struct crypto_tfm *tfm, const u8 *key, unsigned int keylen)
* \ingroup IFX_MD5_HMAC_FUNCTIONS
* \brief sets md5 hmac key
* \param tfm linux crypto algo transform
* \param key input key
* \param keylen key length greater than 64 bytes IS NOT SUPPORTED
*/
static int md5_hmac_setkey(struct crypto_shash *tfm, const u8 *key, unsigned int keylen)
* \brief sets md5 hmac key
* \param tfm linux crypto algo transform
* \param key input key
* \param keylen key length greater than 64 bytes IS NOT SUPPORTED
*/
static int md5_hmac_setkey(struct crypto_shash *tfm, const u8 *key, unsigned int keylen)
{
struct md5_hmac_ctx *mctx = crypto_shash_ctx(tfm);
int err;
@ -146,25 +146,25 @@ static int md5_hmac_setkey(struct crypto_shash *tfm, const u8 *key, unsigned int
/*! \fn int md5_hmac_setkey_hw(const u8 *key, unsigned int keylen)
* \ingroup IFX_MD5_HMAC_FUNCTIONS
* \brief sets md5 hmac key into the hardware registers
* \param key input key
* \param keylen key length greater than 64 bytes IS NOT SUPPORTED
*/
* \brief sets md5 hmac key into the hardware registers
* \param key input key
* \param keylen key length greater than 64 bytes IS NOT SUPPORTED
*/
static int md5_hmac_setkey_hw(const u8 *key, unsigned int keylen)
{
volatile struct deu_hash_t *hash = (struct deu_hash_t *) HASH_START;
int i, j;
u32 *in_key = (u32 *)key;
u32 *in_key = (u32 *)key;
//printk("\nsetkey keylen: %d\n key: ", keylen);
hash->KIDX |= 0x80000000; // reset all 16 words of the key to '0'
j = 0;
for (i = 0; i < keylen; i+=4)
{
hash->KIDX = j;
asm("sync");
hash->KEY = *((u32 *) in_key + j);
hash->KEY = *((u32 *) in_key + j);
asm("sync");
j++;
}
@ -174,14 +174,14 @@ static int md5_hmac_setkey_hw(const u8 *key, unsigned int keylen)
/*! \fn void md5_hmac_init(struct crypto_tfm *tfm)
* \ingroup IFX_MD5_HMAC_FUNCTIONS
* \brief initialize md5 hmac context
* \param tfm linux crypto algo transform
*/
* \brief initialize md5 hmac context
* \param tfm linux crypto algo transform
*/
static int md5_hmac_init(struct shash_desc *desc)
{
struct md5_hmac_ctx *mctx = crypto_shash_ctx(desc->tfm);
mctx->dbn = 0; //dbn workaround
mctx->started = 0;
@ -189,21 +189,21 @@ static int md5_hmac_init(struct shash_desc *desc)
return 0;
}
/*! \fn void md5_hmac_update(struct crypto_tfm *tfm, const u8 *data, unsigned int len)
* \ingroup IFX_MD5_HMAC_FUNCTIONS
* \brief on-the-fly md5 hmac computation
* \param tfm linux crypto algo transform
* \param data input data
* \param len size of input data
*/
* \brief on-the-fly md5 hmac computation
* \param tfm linux crypto algo transform
* \param data input data
* \param len size of input data
*/
static int md5_hmac_update(struct shash_desc *desc, const u8 *data, unsigned int len)
{
struct md5_hmac_ctx *mctx = crypto_shash_ctx(desc->tfm);
const u32 avail = sizeof(mctx->block) - (mctx->byte_count & 0x3f);
mctx->byte_count += len;
if (avail > len) {
memcpy((char *)mctx->block + (sizeof(mctx->block) - avail),
data, len);
@ -225,15 +225,15 @@ static int md5_hmac_update(struct shash_desc *desc, const u8 *data, unsigned int
}
memcpy(mctx->block, data, len);
return 0;
return 0;
}
/*! \fn static int md5_hmac_final(struct crypto_tfm *tfm, u8 *out)
* \ingroup IFX_MD5_HMAC_FUNCTIONS
* \brief call md5_hmac_final_impl with hash_final true
* \param tfm linux crypto algo transform
* \param out final md5 hmac output value
*/
* \brief call md5_hmac_final_impl with hash_final true
* \param tfm linux crypto algo transform
* \param out final md5 hmac output value
*/
static int md5_hmac_final(struct shash_desc *desc, u8 *out)
{
return md5_hmac_final_impl(desc, out, true);
@ -241,11 +241,11 @@ static int md5_hmac_final(struct shash_desc *desc, u8 *out)
/*! \fn static int md5_hmac_final_impl(struct crypto_tfm *tfm, u8 *out, bool hash_final)
* \ingroup IFX_MD5_HMAC_FUNCTIONS
* \brief compute final or intermediate md5 hmac value
* \param tfm linux crypto algo transform
* \param out final md5 hmac output value
* \param in finalize or intermediate processing
*/
* \brief compute final or intermediate md5 hmac value
* \param tfm linux crypto algo transform
* \param out final md5 hmac output value
* \param in finalize or intermediate processing
*/
static int md5_hmac_final_impl(struct shash_desc *desc, u8 *out, bool hash_final)
{
struct md5_hmac_ctx *mctx = crypto_shash_ctx(desc->tfm);
@ -268,7 +268,7 @@ static int md5_hmac_final_impl(struct shash_desc *desc, u8 *out, bool hash_final
}
memset(p, 0, padding);
mctx->block[14] = le32_to_cpu((mctx->byte_count + 64) << 3); // need to add 512 bit of the IPAD operation
mctx->block[14] = le32_to_cpu((mctx->byte_count + 64) << 3); // need to add 512 bit of the IPAD operation
mctx->block[15] = 0x00000000;
md5_hmac_transform(desc, mctx->block);
@ -280,15 +280,15 @@ static int md5_hmac_final_impl(struct shash_desc *desc, u8 *out, bool hash_final
md5_hmac_setkey_hw(mctx->key, mctx->keylen);
//printk("\ndbn = %d\n", mctx->dbn);
//printk("\ndbn = %d\n", mctx->dbn);
if (hash_final) {
hashs->DBN = mctx->dbn;
} else {
hashs->DBN = mctx->dbn + 5;
}
asm("sync");
*IFX_HASH_CON = 0x0703002D; //khs, go, init, ndc, endi, kyue, hmen, md5
*IFX_HASH_CON = 0x0703002D; //khs, go, init, ndc, endi, kyue, hmen, md5
//wait for processing
while (hashs->controlr.BSY) {
@ -317,7 +317,7 @@ static int md5_hmac_final_impl(struct shash_desc *desc, u8 *out, bool hash_final
while (hashs->controlr.BSY) {
// this will not take long
}
in += 16;
}
@ -374,7 +374,7 @@ static void md5_hmac_exit_tfm(struct crypto_tfm *tfm)
kfree(mctx->desc);
}
/*
/*
* \brief MD5_HMAC function mappings
*/
static struct shash_alg ifxdeu_md5_hmac_alg = {
@ -399,8 +399,8 @@ static struct shash_alg ifxdeu_md5_hmac_alg = {
/*! \fn int ifxdeu_init_md5_hmac (void)
* \ingroup IFX_MD5_HMAC_FUNCTIONS
* \brief initialize md5 hmac driver
*/
* \brief initialize md5 hmac driver
*/
int ifxdeu_init_md5_hmac (void)
{
@ -420,8 +420,8 @@ md5_hmac_err:
/** \fn void ifxdeu_fini_md5_hmac (void)
* \ingroup IFX_MD5_HMAC_FUNCTIONS
* \brief unregister md5 hmac driver
*/
* \brief unregister md5 hmac driver
*/
void ifxdeu_fini_md5_hmac (void)
{
crypto_unregister_shash(&ifxdeu_md5_hmac_alg);

View File

@ -92,10 +92,10 @@ extern int disable_deudma;
/*! \fn static void sha1_transform1 (u32 *state, const u32 *in)
* \ingroup IFX_SHA1_FUNCTIONS
* \brief main interface to sha1 hardware
* \param state current state
* \param in 64-byte block of input
*/
* \brief main interface to sha1 hardware
* \param state current state
* \param in 64-byte block of input
*/
static void sha1_transform1 (struct sha1_ctx *sctx, u32 *state, const u32 *in)
{
int i = 0;
@ -107,7 +107,7 @@ static void sha1_transform1 (struct sha1_ctx *sctx, u32 *state, const u32 *in)
SHA_HASH_INIT;
/* For context switching purposes, the previous hash output
* is loaded back into the output register
* is loaded back into the output register
*/
if (sctx->started) {
hashs->D1R = *((u32 *) sctx->hash + 0);
@ -125,9 +125,9 @@ static void sha1_transform1 (struct sha1_ctx *sctx, u32 *state, const u32 *in)
while (hashs->controlr.BSY) {
// this will not take long
}
/* For context switching purposes, the output is saved into a
* context struct which can be used later on
/* For context switching purposes, the output is saved into a
* context struct which can be used later on
*/
*((u32 *) sctx->hash + 0) = hashs->D1R;
*((u32 *) sctx->hash + 1) = hashs->D2R;
@ -142,13 +142,13 @@ static void sha1_transform1 (struct sha1_ctx *sctx, u32 *state, const u32 *in)
/*! \fn static void sha1_init1(struct crypto_tfm *tfm)
* \ingroup IFX_SHA1_FUNCTIONS
* \brief initialize sha1 hardware
* \param tfm linux crypto algo transform
*/
* \brief initialize sha1 hardware
* \param tfm linux crypto algo transform
*/
static int sha1_init1(struct shash_desc *desc)
{
struct sha1_ctx *sctx = shash_desc_ctx(desc);
sctx->started = 0;
sctx->count = 0;
return 0;
@ -156,11 +156,11 @@ static int sha1_init1(struct shash_desc *desc)
/*! \fn static void sha1_update(struct crypto_tfm *tfm, const u8 *data, unsigned int len)
* \ingroup IFX_SHA1_FUNCTIONS
* \brief on-the-fly sha1 computation
* \param tfm linux crypto algo transform
* \param data input data
* \param len size of input data
*/
* \brief on-the-fly sha1 computation
* \param tfm linux crypto algo transform
* \param data input data
* \param len size of input data
*/
static int sha1_update(struct shash_desc * desc, const u8 *data,
unsigned int len)
{
@ -188,10 +188,10 @@ static int sha1_update(struct shash_desc * desc, const u8 *data,
/*! \fn static void sha1_final(struct crypto_tfm *tfm, u8 *out)
* \ingroup IFX_SHA1_FUNCTIONS
* \brief compute final sha1 value
* \param tfm linux crypto algo transform
* \param out final md5 output value
*/
* \brief compute final sha1 value
* \param tfm linux crypto algo transform
* \param out final md5 output value
*/
static int sha1_final(struct shash_desc *desc, u8 *out)
{
struct sha1_ctx *sctx = shash_desc_ctx(desc);
@ -235,7 +235,7 @@ static int sha1_final(struct shash_desc *desc, u8 *out)
return 0;
}
/*
/*
* \brief SHA1 function mappings
*/
static struct shash_alg ifxdeu_sha1_alg = {
@ -258,8 +258,8 @@ static struct shash_alg ifxdeu_sha1_alg = {
/*! \fn int ifxdeu_init_sha1 (void)
* \ingroup IFX_SHA1_FUNCTIONS
* \brief initialize sha1 driver
*/
* \brief initialize sha1 driver
*/
int ifxdeu_init_sha1 (void)
{
int ret = -ENOSYS;
@ -278,8 +278,8 @@ sha1_err:
/*! \fn void ifxdeu_fini_sha1 (void)
* \ingroup IFX_SHA1_FUNCTIONS
* \brief unregister sha1 driver
*/
* \brief unregister sha1 driver
*/
void ifxdeu_fini_sha1 (void)
{
crypto_unregister_shash(&ifxdeu_sha1_alg);

View File

@ -32,7 +32,7 @@
\brief SHA1-HMAC deu driver file
*/
/*!
/*!
\defgroup IFX_SHA1_HMAC_FUNCTIONS IFX_SHA1_HMAC_FUNCTIONS
\ingroup IFX_DEU
\brief ifx sha1 hmac functions
@ -67,7 +67,7 @@
#define SHA1_BLOCK_WORDS 16
#define SHA1_HASH_WORDS 5
#define SHA1_HMAC_BLOCK_SIZE 64
#define SHA1_HMAC_DBN_TEMP_SIZE 1024 // size in dword, needed for dbn workaround
#define SHA1_HMAC_DBN_TEMP_SIZE 1024 // size in dword, needed for dbn workaround
#define HASH_START IFX_HASH_CON
#define SHA1_HMAC_MAX_KEYLEN 64
@ -99,10 +99,10 @@ static int sha1_hmac_final_impl(struct shash_desc *desc, u8 *out, bool hash_fina
/*! \fn static void sha1_hmac_transform(struct crypto_tfm *tfm, u32 const *in)
* \ingroup IFX_SHA1_HMAC_FUNCTIONS
* \brief save input block to context
* \param tfm linux crypto algo transform
* \param in 64-byte block of input
*/
* \brief save input block to context
* \param tfm linux crypto algo transform
* \param in 64-byte block of input
*/
static int sha1_hmac_transform(struct shash_desc *desc, u32 const *in)
{
struct sha1_hmac_ctx *sctx = crypto_shash_ctx(desc->tfm);
@ -121,11 +121,11 @@ static int sha1_hmac_transform(struct shash_desc *desc, u32 const *in)
/*! \fn int sha1_hmac_setkey(struct crypto_tfm *tfm, const u8 *key, unsigned int keylen)
* \ingroup IFX_SHA1_HMAC_FUNCTIONS
* \brief sets sha1 hmac key
* \param tfm linux crypto algo transform
* \param key input key
* \param keylen key length greater than 64 bytes IS NOT SUPPORTED
*/
* \brief sets sha1 hmac key
* \param tfm linux crypto algo transform
* \param key input key
* \param keylen key length greater than 64 bytes IS NOT SUPPORTED
*/
static int sha1_hmac_setkey(struct crypto_shash *tfm, const u8 *key, unsigned int keylen)
{
struct sha1_hmac_ctx *sctx = crypto_shash_ctx(tfm);
@ -157,16 +157,16 @@ static int sha1_hmac_setkey(struct crypto_shash *tfm, const u8 *key, unsigned in
/*! \fn int sha1_hmac_setkey_hw(struct crypto_tfm *tfm, const u8 *key, unsigned int keylen)
* \ingroup IFX_SHA1_HMAC_FUNCTIONS
* \brief sets sha1 hmac key into hw registers
* \param tfm linux crypto algo transform
* \param key input key
* \param keylen key length greater than 64 bytes IS NOT SUPPORTED
*/
* \brief sets sha1 hmac key into hw registers
* \param tfm linux crypto algo transform
* \param key input key
* \param keylen key length greater than 64 bytes IS NOT SUPPORTED
*/
static int sha1_hmac_setkey_hw(const u8 *key, unsigned int keylen)
{
volatile struct deu_hash_t *hash = (struct deu_hash_t *) HASH_START;
int i, j;
u32 *in_key = (u32 *)key;
u32 *in_key = (u32 *)key;
j = 0;
@ -175,7 +175,7 @@ static int sha1_hmac_setkey_hw(const u8 *key, unsigned int keylen)
{
hash->KIDX = j;
asm("sync");
hash->KEY = *((u32 *) in_key + j);
hash->KEY = *((u32 *) in_key + j);
j++;
}
@ -184,9 +184,9 @@ static int sha1_hmac_setkey_hw(const u8 *key, unsigned int keylen)
/*! \fn void sha1_hmac_init(struct crypto_tfm *tfm)
* \ingroup IFX_SHA1_HMAC_FUNCTIONS
* \brief initialize sha1 hmac context
* \param tfm linux crypto algo transform
*/
* \brief initialize sha1 hmac context
* \param tfm linux crypto algo transform
*/
static int sha1_hmac_init(struct shash_desc *desc)
{
struct sha1_hmac_ctx *sctx = crypto_shash_ctx(desc->tfm);
@ -201,11 +201,11 @@ static int sha1_hmac_init(struct shash_desc *desc)
/*! \fn static void sha1_hmac_update(struct crypto_tfm *tfm, const u8 *data, unsigned int len)
* \ingroup IFX_SHA1_HMAC_FUNCTIONS
* \brief on-the-fly sha1 hmac computation
* \param tfm linux crypto algo transform
* \param data input data
* \param len size of input data
*/
* \brief on-the-fly sha1 hmac computation
* \param tfm linux crypto algo transform
* \param data input data
* \param len size of input data
*/
static int sha1_hmac_update(struct shash_desc *desc, const u8 *data,
unsigned int len)
{
@ -234,10 +234,10 @@ static int sha1_hmac_update(struct shash_desc *desc, const u8 *data,
/*! \fn static int sha1_hmac_final(struct crypto_tfm *tfm, u8 *out)
* \ingroup IFX_SHA1_HMAC_FUNCTIONS
* \brief call sha1_hmac_final_impl with hash_final true
* \param tfm linux crypto algo transform
* \param out final sha1 hmac output value
*/
* \brief call sha1_hmac_final_impl with hash_final true
* \param tfm linux crypto algo transform
* \param out final sha1 hmac output value
*/
static int sha1_hmac_final(struct shash_desc *desc, u8 *out)
{
return sha1_hmac_final_impl(desc, out, true);
@ -245,11 +245,11 @@ static int sha1_hmac_final(struct shash_desc *desc, u8 *out)
/*! \fn static int sha1_hmac_final_impl(struct crypto_tfm *tfm, u8 *out, bool hash_final)
* \ingroup IFX_SHA1_HMAC_FUNCTIONS
* \brief ompute final or intermediate sha1 hmac value
* \param tfm linux crypto algo transform
* \param out final sha1 hmac output value
* \param in finalize or intermediate processing
*/
* \brief ompute final or intermediate sha1 hmac value
* \param tfm linux crypto algo transform
* \param out final sha1 hmac output value
* \param in finalize or intermediate processing
*/
static int sha1_hmac_final_impl(struct shash_desc *desc, u8 *out, bool hash_final)
{
struct sha1_hmac_ctx *sctx = crypto_shash_ctx(desc->tfm);
@ -304,7 +304,7 @@ static int sha1_hmac_final_impl(struct shash_desc *desc, u8 *out, bool hash_fina
asm("sync");
//for vr9 change, ENDI = 1
*IFX_HASH_CON = HASH_CON_VALUE;
*IFX_HASH_CON = HASH_CON_VALUE;
//wait for processing
while (hashs->controlr.BSY) {
@ -334,7 +334,7 @@ static int sha1_hmac_final_impl(struct shash_desc *desc, u8 *out, bool hash_fina
while (hashs->controlr.BSY) {
// this will not take long
}
in += 16;
}
@ -395,7 +395,7 @@ static void sha1_hmac_exit_tfm(struct crypto_tfm *tfm)
kfree(sctx->desc);
}
/*
/*
* \brief SHA1_HMAC function mappings
*/
@ -421,8 +421,8 @@ static struct shash_alg ifxdeu_sha1_hmac_alg = {
/*! \fn int ifxdeu_init_sha1_hmac (void)
* \ingroup IFX_SHA1_HMAC_FUNCTIONS
* \brief initialize sha1 hmac driver
*/
* \brief initialize sha1 hmac driver
*/
int ifxdeu_init_sha1_hmac (void)
{
int ret = -ENOSYS;
@ -442,8 +442,8 @@ sha1_err:
/*! \fn void ifxdeu_fini_sha1_hmac (void)
* \ingroup IFX_SHA1_HMAC_FUNCTIONS
* \brief unregister sha1 hmac driver
*/
* \brief unregister sha1 hmac driver
*/
void ifxdeu_fini_sha1_hmac (void)
{

View File

@ -6,7 +6,7 @@
*
* This program 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)
* Software Foundation; either version 2 of the License, or (at your option)
* any later version.
*
*/

View File

@ -172,7 +172,7 @@ static void ptm_setup(struct net_device *dev, int ndev)
static struct net_device_stats *ptm_get_stats(struct net_device *dev)
{
struct net_device_stats *s;
if ( dev != g_net_dev[0] )
return NULL;
s = &g_ptm_priv_data.itf[0].stats;

View File

@ -1,21 +1,21 @@
/*
LzmaDecode.c
LZMA Decoder (optimized for Speed version)
LZMA SDK 4.40 Copyright (c) 1999-2006 Igor Pavlov (2006-05-01)
http://www.7-zip.org/
LZMA SDK is licensed under two licenses:
1) GNU Lesser General Public License (GNU LGPL)
2) Common Public License (CPL)
It means that you can select one of these two licenses and
It means that you can select one of these two licenses and
follow rules of that license.
SPECIAL EXCEPTION:
Igor Pavlov, as the author of this Code, expressly permits you to
statically or dynamically link your Code (or bind by name) to the
interfaces of this file without subjecting your linked Code to the
terms of the CPL or GNU LGPL. Any modifications or additions
Igor Pavlov, as the author of this Code, expressly permits you to
statically or dynamically link your Code (or bind by name) to the
interfaces of this file without subjecting your linked Code to the
terms of the CPL or GNU LGPL. Any modifications or additions
to this file, however, are subject to the LGPL or CPL terms.
*/
@ -46,7 +46,7 @@
#define RC_TEST { if (Buffer == BufferLim) return LZMA_RESULT_DATA_ERROR; }
#define RC_INIT(buffer, bufferSize) Buffer = buffer; BufferLim = buffer + bufferSize; RC_INIT2
#endif
#define RC_NORMALIZE if (Range < kTopValue) { RC_TEST; Range <<= 8; Code = (Code << 8) | RC_READ_BYTE; }
@ -57,9 +57,9 @@
#define RC_GET_BIT2(p, mi, A0, A1) IfBit0(p) \
{ UpdateBit0(p); mi <<= 1; A0; } else \
{ UpdateBit1(p); mi = (mi + mi) + 1; A1; }
#define RC_GET_BIT(p, mi) RC_GET_BIT2(p, mi, ; , ;)
{ UpdateBit1(p); mi = (mi + mi) + 1; A1; }
#define RC_GET_BIT(p, mi) RC_GET_BIT2(p, mi, ; , ;)
#define RangeDecoderBitTreeDecode(probs, numLevels, res) \
{ int i = numLevels; res = 1; \
@ -82,7 +82,7 @@
#define LenLow (LenChoice2 + 1)
#define LenMid (LenLow + (kNumPosStatesMax << kLenNumLowBits))
#define LenHigh (LenMid + (kNumPosStatesMax << kLenNumMidBits))
#define kNumLenProbs (LenHigh + kLenNumHighSymbols)
#define kNumLenProbs (LenHigh + kLenNumHighSymbols)
#define kNumStates 12
@ -168,7 +168,7 @@ int LzmaDecode(CLzmaDecoderState *vs,
int lc = vs->Properties.lc;
#ifdef _LZMA_OUT_READ
UInt32 Range = vs->Range;
UInt32 Code = vs->Code;
#ifdef _LZMA_IN_CB
@ -210,7 +210,7 @@ int LzmaDecode(CLzmaDecoderState *vs,
UInt32 numProbs = Literal + ((UInt32)LZMA_LIT_SIZE << (lc + vs->Properties.lp));
UInt32 i;
for (i = 0; i < numProbs; i++)
p[i] = kBitModelTotal >> 1;
p[i] = kBitModelTotal >> 1;
rep0 = rep1 = rep2 = rep3 = 1;
state = 0;
globalPos = 0;
@ -261,7 +261,7 @@ int LzmaDecode(CLzmaDecoderState *vs,
for (i = 0; i < numProbs; i++)
p[i] = kBitModelTotal >> 1;
}
#ifdef _LZMA_IN_CB
RC_INIT;
#else
@ -275,7 +275,7 @@ int LzmaDecode(CLzmaDecoderState *vs,
CProb *prob;
UInt32 bound;
int posState = (int)(
(nowPos
(nowPos
#ifdef _LZMA_OUT_READ
+ globalPos
#endif
@ -287,9 +287,9 @@ int LzmaDecode(CLzmaDecoderState *vs,
{
int symbol = 1;
UpdateBit0(prob)
prob = p + Literal + (LZMA_LIT_SIZE *
prob = p + Literal + (LZMA_LIT_SIZE *
(((
(nowPos
(nowPos
#ifdef _LZMA_OUT_READ
+ globalPos
#endif
@ -338,7 +338,7 @@ int LzmaDecode(CLzmaDecoderState *vs,
else if (state < 10) state -= 3;
else state -= 6;
}
else
else
{
UpdateBit1(prob);
prob = p + IsRep + state;
@ -365,14 +365,14 @@ int LzmaDecode(CLzmaDecoderState *vs,
UInt32 pos;
#endif
UpdateBit0(prob);
#ifdef _LZMA_OUT_READ
if (distanceLimit == 0)
#else
if (nowPos == 0)
#endif
return LZMA_RESULT_DATA_ERROR;
state = state < kNumLitStates ? 9 : 11;
#ifdef _LZMA_OUT_READ
pos = dictionaryPos - rep0;
@ -408,7 +408,7 @@ int LzmaDecode(CLzmaDecoderState *vs,
UpdateBit0(prob);
distance = rep1;
}
else
else
{
UpdateBit1(prob);
prob = p + IsRepG2 + state;
@ -469,7 +469,7 @@ int LzmaDecode(CLzmaDecoderState *vs,
int posSlot;
state += kNumLitStates;
prob = p + PosSlot +
((len < kNumLenToPosStates ? len : kNumLenToPosStates - 1) <<
((len < kNumLenToPosStates ? len : kNumLenToPosStates - 1) <<
kNumPosSlotBits);
RangeDecoderBitTreeDecode(prob, kNumPosSlotBits, posSlot);
if (posSlot >= kStartPosModelIndex)
@ -524,7 +524,7 @@ int LzmaDecode(CLzmaDecoderState *vs,
len += kMatchMinLen;
#ifdef _LZMA_OUT_READ
if (rep0 > distanceLimit)
if (rep0 > distanceLimit)
#else
if (rep0 > nowPos)
#endif

View File

@ -1,4 +1,4 @@
/*
/*
LzmaDecode.h
LZMA Decoder interface
@ -8,14 +8,14 @@
LZMA SDK is licensed under two licenses:
1) GNU Lesser General Public License (GNU LGPL)
2) Common Public License (CPL)
It means that you can select one of these two licenses and
It means that you can select one of these two licenses and
follow rules of that license.
SPECIAL EXCEPTION:
Igor Pavlov, as the author of this code, expressly permits you to
statically or dynamically link your code (or bind by name) to the
interfaces of this file without subjecting your linked code to the
terms of the CPL or GNU LGPL. Any modifications or additions
Igor Pavlov, as the author of this code, expressly permits you to
statically or dynamically link your code (or bind by name) to the
interfaces of this file without subjecting your linked code to the
terms of the CPL or GNU LGPL. Any modifications or additions
to this file, however, are subject to the LGPL or CPL terms.
*/
@ -31,7 +31,7 @@
/* Use read function for output data */
/* #define _LZMA_PROB32 */
/* It can increase speed on some 32-bit CPUs,
/* It can increase speed on some 32-bit CPUs,
but memory usage will be doubled in that case */
/* #define _LZMA_LOC_OPT */

View File

@ -1,5 +1,5 @@
/*
LzmaTypes.h
/*
LzmaTypes.h
Types for LZMA Decoder
@ -13,12 +13,12 @@ This file is part of LZMA SDK 4.40 (2006-05-01)
#ifndef _7ZIP_BYTE_DEFINED
#define _7ZIP_BYTE_DEFINED
typedef unsigned char Byte;
#endif
#endif
#ifndef _7ZIP_UINT16_DEFINED
#define _7ZIP_UINT16_DEFINED
typedef unsigned short UInt16;
#endif
#endif
#ifndef _7ZIP_UINT32_DEFINED
#define _7ZIP_UINT32_DEFINED
@ -27,7 +27,7 @@ typedef unsigned long UInt32;
#else
typedef unsigned int UInt32;
#endif
#endif
#endif
/* #define _LZMA_NO_SYSTEM_SIZE_T */
/* You can use it, if you don't want <stddef.h> */

View File

@ -54,9 +54,9 @@ int lzma_inflate(unsigned char *source, int s_len, unsigned char *dest, int *d_l
UInt32 outSizeHigh = 0;
SizeT outSizeFull;
unsigned char *outStream;
int waitEOS = 1;
/* waitEOS = 1, if there is no uncompressed size in headers,
int waitEOS = 1;
/* waitEOS = 1, if there is no uncompressed size in headers,
so decoder will wait EOS (End of Stream Marker) in compressed stream */
SizeT compressedSize;
@ -119,7 +119,7 @@ int lzma_inflate(unsigned char *source, int s_len, unsigned char *dest, int *d_l
else
outSizeHigh += (UInt32)(b) << ((i - 4) * 8);
}
if (waitEOS)
{
#if defined(DEBUG_ENABLE_BOOTSTRAP_PRINTF) || !defined(CFG_BOOTSTRAP_CODE)
@ -169,7 +169,7 @@ int lzma_inflate(unsigned char *source, int s_len, unsigned char *dest, int *d_l
inStream = source + rpos;
}
if (state.Probs == 0
if (state.Probs == 0
|| (outStream == 0 && outSizeFull != 0)
|| (inStream == 0 && compressedSize != 0)
)

View File

@ -5,21 +5,21 @@
* This package is an SSL implementation written
* by Eric Young (eay@cryptsoft.com).
* The implementation was written so as to conform with Netscapes SSL.
*
*
* This library is free for commercial and non-commercial use as long as
* the following conditions are aheared to. The following conditions
* apply to all code found in this distribution, be it the RC4, RSA,
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
* included with this distribution is covered by the same copyright terms
* except that the holder is Tim Hudson (tjh@cryptsoft.com).
*
*
* Copyright remains Eric Young's, and as such any Copyright notices in
* the code are not to be removed.
* If this package is used in a product, Eric Young should be given attribution
* as the author of the parts of the library used.
* This can be in the form of a textual message at program startup or
* in documentation (online or textual) provided with the package.
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@ -34,10 +34,10 @@
* Eric Young (eay@cryptsoft.com)"
* The word 'cryptographic' can be left out if the rouines from the library
* being used are not cryptographic related :-).
* 4. If you include any Windows specific code (or a derivative thereof) from
* 4. If you include any Windows specific code (or a derivative thereof) from
* the apps directory (application code) you must include an acknowledgement:
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
*
*
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@ -49,7 +49,7 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
*
* The licence and distribution terms for any publically available version or
* derivative of this code cannot be changed. i.e. this code cannot simply be
* copied and put under another distribution licence

View File

@ -13,9 +13,9 @@
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
*
* IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INCIDENTAL,
* INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER

View File

@ -13,9 +13,9 @@
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
*
* IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INCIDENTAL,
* INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER

View File

@ -13,9 +13,9 @@
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
*
* IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INCIDENTAL,
* INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER

View File

@ -362,7 +362,7 @@ hostapd_bss_get_status(struct ubus_context *ctx, struct ubus_object *obj,
if (hapd->conf->ssid.ssid_len < SSID_MAX_LEN)
ssid_len = hapd->conf->ssid.ssid_len;
ieee80211_freq_to_channel_ext(hapd->iface->freq,
hapd->iconf->secondary_channel,
hostapd_get_oper_chwidth(hapd->iconf),
@ -2060,7 +2060,7 @@ void hostapd_ubus_notify_bss_transition_response(
blobmsg_add_u8(&b, "bss-termination-delay", bss_termination_delay);
if (target_bssid)
blobmsg_add_macaddr(&b, "target-bssid", target_bssid);
hostapd_ubus_notify_bss_transition_add_candidate_list(candidate_list, candidate_list_len);
ubus_notify(ctx, &hapd->ubus.obj, "bss-transition-response", b.head, -1);

View File

@ -1,4 +1,4 @@
/*
/*
* Taken from fli4l 3.0
* Make sure you compile it against the same libpcap version used in OpenWrt
*/

View File

@ -249,16 +249,16 @@ int main(int argc, char **argv)
if ( init_led(&(currentrule->led), argv[i]) )
return 1;
if ( sscanf(argv[i+1], "%d", &(currentrule->minq)) != 1 )
return 1;
if ( sscanf(argv[i+2], "%d", &(currentrule->maxq)) != 1 )
return 1;
if ( sscanf(argv[i+3], "%d", &(currentrule->boffset)) != 1 )
return 1;
if ( sscanf(argv[i+4], "%d", &(currentrule->bfactor)) != 1 )
return 1;
}

View File

@ -139,7 +139,7 @@ static uint32_t strntoul(char *str, char **endptr, int base, size_t len) {
newstr = calloc(len + 1, sizeof(char));
if (newstr) {
strncpy(newstr, str, len);
strncpy(newstr, str, len);
res = strtoul(newstr, endptr, base);
free(newstr);
}
@ -258,7 +258,7 @@ trx_check(int imagefd, const char *mtd, char *buf, int *len)
}
headerCRC = crc32buf(buf, offsetof(struct bcm_tag, header_crc));
if (*(uint32_t *)(&tag->header_crc) != headerCRC) {
if (quiet < 2) {
fprintf(stderr, "Bad header CRC got %08x, calculated %08x\n",
*(uint32_t *)(&tag->header_crc), headerCRC);
@ -276,7 +276,7 @@ trx_check(int imagefd, const char *mtd, char *buf, int *len)
}
imageLen = strntoul(&tag->total_length[0], NULL, 10, IMAGE_LEN);
if(mtdsize < imageLen) {
fprintf(stderr, "Image too big for partition: %s\n", mtd);
close(fd);
@ -355,7 +355,7 @@ mtd_fixtrx(const char *mtd, size_t offset, size_t data_size)
rootfslen = strntoul(&tag->root_length[0], NULL, 10, IMAGE_LEN);
if (rootfslen == 0) {
if (quiet < 2)
if (quiet < 2)
fprintf(stderr, "Header already fixed, exiting\n");
close(fd);
return 0;
@ -390,9 +390,9 @@ mtd_fixtrx(const char *mtd, size_t offset, size_t data_size)
}
if (quiet < 2) {
fprintf(stderr, "New image crc32: 0x%x, rewriting block\n",
fprintf(stderr, "New image crc32: 0x%x, rewriting block\n",
*(uint32_t *)(&tag->image_crc));
fprintf(stderr, "New header crc32: 0x%x, rewriting block\n", headercrc);
fprintf(stderr, "New header crc32: 0x%x, rewriting block\n", headercrc);
}
if (pwrite(fd, buf, erasesize, block_offset) != erasesize) {

View File

@ -293,7 +293,7 @@ int mtd_write_jffs2(const char *mtd, const char *filename, const char *dir)
if (quiet < 2)
fprintf(stderr, "Appending %s to jffs2 partition %s\n", filename, mtd);
buf = malloc(erasesize);
if (!buf) {
fprintf(stderr, "Out of memory!\n");

View File

@ -16,7 +16,7 @@
#define JFFS2_SUPER_MAGIC 0x72b6
/* You must include something which defines the C99 uintXX_t types.
/* You must include something which defines the C99 uintXX_t types.
We don't do it from here because this file is used in too many
different environments. */

View File

@ -2,7 +2,7 @@
* fbtest - fbtest.c
* test program for the tuxbox-framebuffer device
* tests all GTX/eNX supported modes
*
*
* (c) 2003 Carsten Juttner (carjay@gmx.net)
*
* This program is free software; you can redistribute it and/or modify
@ -18,7 +18,7 @@
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*
******************************************************************************
* $Id: fbtest.c,v 1.5 2005/01/14 23:14:41 carjay Exp $
******************************************************************************/
@ -187,12 +187,12 @@ int setmode(int fbd, const struct pixelformat *pixf,const struct vidsize *vids){
int stat;
stat = ioctl (fbd, FBIOGET_VSCREENINFO,&var);
if (stat<0) return -2;
var.xres= vids->width;
var.xres_virtual = vids->width;
var.yres= vids->height;
var.yres_virtual = vids->height;
var.bits_per_pixel = pixf->bpp;
var.red = pixf->red;
var.green = pixf->green;
@ -254,7 +254,7 @@ void drawrect(void *videoram, struct rect *r, const struct pixelformat *pixf, co
pmem +=((vids->width*bpp)>>3); // skip one whole line, actually should be taken from "fix-info"
}
}
// create quick little test image, 4 colours from table
void draw4field(void *videoram, const struct pixelformat *pixf, const struct vidsize *vids){
struct rect r;
@ -314,7 +314,7 @@ int main (int argc,char **argv){
int optchar,fmode=-1,smode=-1,clear=1;
int i_cmap,i_size,i_pix;
extern char *optarg;
if (argc!=0&&argc>4) usage(argv[0]);
while ( (optchar = getopt (argc,argv,"f:s:n"))!= -1){
int i,height,width;
@ -359,7 +359,7 @@ int main (int argc,char **argv){
usage (argv[0]);
}
}
fbd = open (FBDEV, O_RDWR);
if (fbd<0){
perror ("Error opening framebuffer device");
@ -396,7 +396,7 @@ int main (int argc,char **argv){
printf ("%dx%d ",vidsizetable[i_size].width,vidsizetable[i_size].height);
fflush(stdout);
if ((i_size%4)==3) printf ("\n");
// try to set mode
stat = setmode(fbd,&pixelformattable[i_pix],&vidsizetable[i_size]);
if (stat==-2) perror ("fbtest: could not get fb_var-screeninfo from fb-device");

View File

@ -68,10 +68,10 @@ static void buffer_reverse(unsigned char *data, unsigned int top)
* or Z_OK if data was retrieved up to limit (*limit == original value).
*
* Return values (failure):
* Z_MEM_ERROR if memory could not be allocated for processing,
* Z_DATA_ERROR if the deflate data is invalid or incomplete,
* Z_VERSION_ERROR if the version of zlib.h and the version of the
* library linked do not match, or
* Z_MEM_ERROR if memory could not be allocated for processing,
* Z_DATA_ERROR if the deflate data is invalid or incomplete,
* Z_VERSION_ERROR if the version of zlib.h and the version of the
* library linked do not match, or
* Z_ERRNO if there is an error reading or writing the files.
*/
static int inflate_to_buffer(FILE *source, unsigned char *buf, size_t *limit)
@ -305,7 +305,7 @@ int main(int argc, char **argv)
buffer_reverse(buf, datasize - 1);
if (datasize <= skip) {
fprintf(stderr, "Failed to skip %u bytes, total data size is %u!\n",
fprintf(stderr, "Failed to skip %u bytes, total data size is %u!\n",
(unsigned int)skip, (unsigned int)datasize);
goto out_bad;
}

View File

@ -76,7 +76,7 @@ static void write_file(const char *path, size_t len, bool pem, bool cert)
fprintf(stderr, "No data to write\n");
exit(1);
}
if (cert)
mode |= S_IRGRP | S_IROTH;

View File

@ -18,7 +18,7 @@
* adapted from musl code:
*
* Copyright © 2005-2020 Rich Felker, et al.
*
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
@ -26,10 +26,10 @@
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.

View File

@ -49,7 +49,7 @@ typedef uint32_t flex_uint32_t;
typedef signed char flex_int8_t;
typedef short int flex_int16_t;
typedef int flex_int32_t;
typedef unsigned char flex_uint8_t;
typedef unsigned char flex_uint8_t;
typedef unsigned short int flex_uint16_t;
typedef unsigned int flex_uint32_t;
@ -160,7 +160,7 @@ extern FILE *yyin, *yyout;
#define EOB_ACT_CONTINUE_SCAN 0
#define EOB_ACT_END_OF_FILE 1
#define EOB_ACT_LAST_MATCH 2
/* Note: We specifically omit the test for yy_rule_can_match_eol because it requires
* access to the local variable yy_act. Since yyless() is a macro, it would break
* existing scanners that call yyless() from OUTSIDE yylex.
@ -182,7 +182,7 @@ extern FILE *yyin, *yyout;
if ( *p == '\n' )\
--yylineno;\
}while(0)
/* Return all but the first "n" matched characters back to the input stream. */
#define yyless(n) \
do \
@ -2240,9 +2240,9 @@ static const YY_CHAR yy_ec[256] =
/* Table of booleans, true if rule could match eol. */
static const flex_int32_t yy_rule_can_match_eol[65] =
{ 0,
0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1,
0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1,
0, 1, 1, 0, 0, };
extern int yy_flex_debug;
@ -2397,9 +2397,9 @@ extern int yywrap ( void );
#endif
#ifndef YY_NO_UNPUT
static void yyunput ( int c, char *buf_ptr );
#endif
#ifndef yytext_ptr
@ -2510,7 +2510,7 @@ YY_DECL
yy_state_type yy_current_state;
char *yy_cp, *yy_bp;
int yy_act;
if ( !(yy_init) )
{
(yy_init) = 1;
@ -2570,7 +2570,7 @@ yy_find_action:
int yyl;
for ( yyl = 0; yyl < yyleng; ++yyl )
if ( yytext[yyl] == '\n' )
yylineno++;
;
}
@ -3233,7 +3233,7 @@ static int yy_get_next_buffer (void)
{
yy_state_type yy_current_state;
char *yy_cp;
yy_current_state = (yy_start);
for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
@ -3252,7 +3252,7 @@ static int yy_get_next_buffer (void)
static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state )
{
int yy_is_jam;
yy_current_state = yy_nxt[yy_current_state][1];
yy_is_jam = (yy_current_state <= 0);
@ -3264,7 +3264,7 @@ static int yy_get_next_buffer (void)
static void yyunput (int c, char * yy_bp )
{
char *yy_cp;
yy_cp = (yy_c_buf_p);
/* undo effects of setting up yytext */
@ -3313,7 +3313,7 @@ static int yy_get_next_buffer (void)
{
int c;
*(yy_c_buf_p) = (yy_hold_char);
if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
@ -3375,7 +3375,7 @@ static int yy_get_next_buffer (void)
(yy_hold_char) = *++(yy_c_buf_p);
if ( c == '\n' )
yylineno++;
;
@ -3385,12 +3385,12 @@ static int yy_get_next_buffer (void)
/** Immediately switch to a different input stream.
* @param input_file A readable stream.
*
*
* @note This function does not reset the start condition to @c INITIAL .
*/
void yyrestart (FILE * input_file )
{
if ( ! YY_CURRENT_BUFFER ){
yyensure_buffer_stack ();
YY_CURRENT_BUFFER_LVALUE =
@ -3403,11 +3403,11 @@ static int yy_get_next_buffer (void)
/** Switch to a different input buffer.
* @param new_buffer The new input buffer.
*
*
*/
void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer )
{
/* TODO. We should be able to replace this entire function body
* with
* yypop_buffer_state();
@ -3447,13 +3447,13 @@ static void yy_load_buffer_state (void)
/** Allocate and initialize an input buffer state.
* @param file A readable stream.
* @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
*
*
* @return the allocated buffer state.
*/
YY_BUFFER_STATE yy_create_buffer (FILE * file, int size )
{
YY_BUFFER_STATE b;
b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) );
if ( ! b )
YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
@ -3476,11 +3476,11 @@ static void yy_load_buffer_state (void)
/** Destroy the buffer.
* @param b a buffer created with yy_create_buffer()
*
*
*/
void yy_delete_buffer (YY_BUFFER_STATE b )
{
if ( ! b )
return;
@ -3501,7 +3501,7 @@ static void yy_load_buffer_state (void)
{
int oerrno = errno;
yy_flush_buffer( b );
b->yy_input_file = file;
@ -3517,13 +3517,13 @@ static void yy_load_buffer_state (void)
}
b->yy_is_interactive = 0;
errno = oerrno;
}
/** Discard all buffered characters. On the next scan, YY_INPUT will be called.
* @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
*
*
*/
void yy_flush_buffer (YY_BUFFER_STATE b )
{
@ -3552,7 +3552,7 @@ static void yy_load_buffer_state (void)
* the current state. This function will allocate the stack
* if necessary.
* @param new_buffer The new state.
*
*
*/
void yypush_buffer_state (YY_BUFFER_STATE new_buffer )
{
@ -3582,7 +3582,7 @@ void yypush_buffer_state (YY_BUFFER_STATE new_buffer )
/** Removes and deletes the top of the stack, if present.
* The next element becomes the new top.
*
*
*/
void yypop_buffer_state (void)
{
@ -3606,7 +3606,7 @@ void yypop_buffer_state (void)
static void yyensure_buffer_stack (void)
{
yy_size_t num_to_alloc;
if (!(yy_buffer_stack)) {
/* First allocation is just for 2 elements, since we don't know if this
@ -3649,13 +3649,13 @@ static void yyensure_buffer_stack (void)
/** Setup the input buffer state to scan directly from a user-specified character buffer.
* @param base the character buffer
* @param size the size in bytes of the character buffer
*
*
* @return the newly allocated buffer state object.
*/
YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size )
{
YY_BUFFER_STATE b;
if ( size < 2 ||
base[size-2] != YY_END_OF_BUFFER_CHAR ||
base[size-1] != YY_END_OF_BUFFER_CHAR )
@ -3684,14 +3684,14 @@ YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size )
/** Setup the input buffer state to scan a string. The next call to yylex() will
* scan from a @e copy of @a str.
* @param yystr a NUL-terminated string to scan
*
*
* @return the newly allocated buffer state object.
* @note If you want to scan bytes that may contain NUL values, then use
* yy_scan_bytes() instead.
*/
YY_BUFFER_STATE yy_scan_string (const char * yystr )
{
return yy_scan_bytes( yystr, (int) strlen(yystr) );
}
@ -3699,7 +3699,7 @@ YY_BUFFER_STATE yy_scan_string (const char * yystr )
* scan from a @e copy of @a bytes.
* @param yybytes the byte buffer to scan
* @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
*
*
* @return the newly allocated buffer state object.
*/
YY_BUFFER_STATE yy_scan_bytes (const char * yybytes, int _yybytes_len )
@ -3708,7 +3708,7 @@ YY_BUFFER_STATE yy_scan_bytes (const char * yybytes, int _yybytes_len )
char *buf;
yy_size_t n;
int i;
/* Get memory for full buffer, including space for trailing EOB's. */
n = (yy_size_t) (_yybytes_len + 2);
buf = (char *) yyalloc( n );
@ -3762,16 +3762,16 @@ static void yynoreturn yy_fatal_error (const char* msg )
/* Accessor methods (get/set functions) to struct members. */
/** Get the current line number.
*
*
*/
int yyget_lineno (void)
{
return yylineno;
}
/** Get the input stream.
*
*
*/
FILE *yyget_in (void)
{
@ -3779,7 +3779,7 @@ FILE *yyget_in (void)
}
/** Get the output stream.
*
*
*/
FILE *yyget_out (void)
{
@ -3787,7 +3787,7 @@ FILE *yyget_out (void)
}
/** Get the length of the current token.
*
*
*/
int yyget_leng (void)
{
@ -3795,7 +3795,7 @@ int yyget_leng (void)
}
/** Get the current token.
*
*
*/
char *yyget_text (void)
@ -3805,18 +3805,18 @@ char *yyget_text (void)
/** Set the current line number.
* @param _line_number line number
*
*
*/
void yyset_lineno (int _line_number )
{
yylineno = _line_number;
}
/** Set the input stream. This does not discard the current
* input buffer.
* @param _in_str A readable stream.
*
*
* @see yy_switch_to_buffer
*/
void yyset_in (FILE * _in_str )
@ -3847,7 +3847,7 @@ static int yy_init_globals (void)
/* We do not touch yylineno unless the option is enabled. */
yylineno = 1;
(yy_buffer_stack) = NULL;
(yy_buffer_stack_top) = 0;
(yy_buffer_stack_max) = 0;
@ -3873,7 +3873,7 @@ static int yy_init_globals (void)
/* yylex_destroy is for both reentrant and non-reentrant scanners. */
int yylex_destroy (void)
{
/* Pop the buffer stack, destroying each element. */
while(YY_CURRENT_BUFFER){
yy_delete_buffer( YY_CURRENT_BUFFER );
@ -3899,7 +3899,7 @@ int yylex_destroy (void)
#ifndef yytext_ptr
static void yy_flex_strncpy (char* s1, const char * s2, int n )
{
int i;
for ( i = 0; i < n; ++i )
s1[i] = s2[i];
@ -3924,7 +3924,7 @@ void *yyalloc (yy_size_t size )
void *yyrealloc (void * ptr, yy_size_t size )
{
/* The cast to (char *) in the following accommodates both
* implementations that use char* generic pointers, and those
* that use void* generic pointers. It works with the latter

View File

@ -8,7 +8,7 @@
* intellectual property rights of others.
*----------------------------------------------------------------------------
* File Name : at45c.h
* Object :
* Object :
*
* 1.0 10/12/03 HIi : Creation.
* 1.01 03/05/04 HIi : Bug Fix in AT91F_DataFlashWaitReady() Function.
@ -28,7 +28,7 @@
/*----------------------------------------------------------------------------*/
void AT91F_SpiInit(void) {
/* Configure PIOs */
AT91C_BASE_PIOA->PIO_ASR = AT91C_PA3_NPCS0 | AT91C_PA4_NPCS1 |
AT91C_BASE_PIOA->PIO_ASR = AT91C_PA3_NPCS0 | AT91C_PA4_NPCS1 |
AT91C_PA1_MOSI | AT91C_PA5_NPCS2 |
AT91C_PA6_NPCS3 | AT91C_PA0_MISO |
AT91C_PA2_SPCK;
@ -88,7 +88,7 @@ static void AT91F_SpiEnable(int cs) {
static unsigned int AT91F_SpiWrite(AT91PS_DataflashDesc pDesc)
{
unsigned int timeout;
AT91C_BASE_SPI->SPI_PTCR = AT91C_PDC_TXTDIS + AT91C_PDC_RXTDIS;
/* Initialize the Transmit and Receive Pointer */
@ -138,7 +138,7 @@ static AT91S_DataFlashStatus AT91F_DataFlashSendCommand(
unsigned int adr;
/* process the address to obtain page address and byte address */
adr = ((DataflashAddress / (pDataFlash->pDevice->pages_size))
adr = ((DataflashAddress / (pDataFlash->pDevice->pages_size))
<< pDataFlash->pDevice->page_offset) +
(DataflashAddress % (pDataFlash->pDevice->pages_size));
@ -152,7 +152,7 @@ static AT91S_DataFlashStatus AT91F_DataFlashSendCommand(
pDataFlash->pDataFlashDesc->command[4] = (unsigned char)(adr & 0x000000FF);
}
else
{
{
pDataFlash->pDataFlashDesc->command[1] = (unsigned char)((adr & 0x00FF0000) >> 16);
pDataFlash->pDataFlashDesc->command[2] = (unsigned char)((adr & 0x0000FF00) >> 8);
pDataFlash->pDataFlashDesc->command[3] = (unsigned char)(adr & 0x000000FF) ;
@ -168,7 +168,7 @@ static AT91S_DataFlashStatus AT91F_DataFlashSendCommand(
pDataFlash->pDataFlashDesc->rx_cmd_pt = pDataFlash->pDataFlashDesc->command ;
pDataFlash->pDataFlashDesc->rx_cmd_size = CmdSize ;
return AT91F_SpiWrite(pDataFlash->pDataFlashDesc);
return AT91F_SpiWrite(pDataFlash->pDataFlashDesc);
}
@ -245,7 +245,7 @@ static AT91S_DataFlashStatus AT91F_DataFlashContinuousRead(
pDataFlash->pDataFlashDesc->rx_data_size = sizeToRead;
pDataFlash->pDataFlashDesc->tx_data_pt = dataBuffer;
pDataFlash->pDataFlashDesc->tx_data_size = sizeToRead;
status = AT91F_DataFlashSendCommand(pDataFlash, DB_CONTINUOUS_ARRAY_READ, 8, src);
/* Send the command to the dataflash */
return(status);
@ -325,7 +325,7 @@ static AT91S_DataFlashStatus AT91F_DataFlashWriteBuffer(
pDataFlash->pDataFlashDesc->command[4] = 0;
cmdsize = 4;
}
pDataFlash->pDataFlashDesc->tx_cmd_pt = pDataFlash->pDataFlashDesc->command ;
pDataFlash->pDataFlashDesc->tx_cmd_size = cmdsize ;
pDataFlash->pDataFlashDesc->rx_cmd_pt = pDataFlash->pDataFlashDesc->command ;
@ -341,7 +341,7 @@ static AT91S_DataFlashStatus AT91F_DataFlashWriteBuffer(
/*------------------------------------------------------------------------------*/
/* Function Name : AT91F_PageErase */
/* Function Name : AT91F_PageErase */
/* Object : Read a page in the SRAM Buffer 1 or 2 */
/* Input Parameters : DataFlash Service */
/* : Page concerned */
@ -353,10 +353,10 @@ static AT91S_DataFlashStatus AT91F_PageErase(
unsigned int page)
{
int cmdsize;
/* Test if the buffer command is legal */
/* Test if the buffer command is legal */
/* no data to transmit or receive */
pDataFlash->pDataFlashDesc->tx_data_size = 0;
cmdsize = 4;
if (pDataFlash->pDevice->pages_number >= 16384)
cmdsize = 5;
@ -419,11 +419,11 @@ static AT91S_DataFlashStatus AT91F_PartialPageWrite (
/* Read the contents of the page in the Sram Buffer */
AT91F_MainMemoryToBufferTransfer(pDataFlash, DB_PAGE_2_BUF1_TRF, page);
AT91F_DataFlashWaitReady(pDataFlash->pDataFlashDesc, AT91C_DATAFLASH_TIMEOUT);
/*Update the SRAM buffer */
AT91F_DataFlashWriteBuffer(pDataFlash, DB_BUF1_WRITE, src, AdrInPage, size);
AT91F_DataFlashWaitReady(pDataFlash->pDataFlashDesc, AT91C_DATAFLASH_TIMEOUT);
/* Erase page if a 128 Mbits device */
if (pDataFlash->pDevice->pages_number >= 16384)
{
@ -477,26 +477,26 @@ AT91S_DataFlashStatus AT91F_DataFlashWrite(
src += length;
}
while (( size - pDataFlash->pDevice->pages_size ) >= 0 )
while (( size - pDataFlash->pDevice->pages_size ) >= 0 )
{
/* program dataflash page */
/* program dataflash page */
page = (unsigned int)dest / (pDataFlash->pDevice->pages_size);
status = AT91F_DataFlashWriteBuffer(pDataFlash, DB_BUF1_WRITE, src,
0, pDataFlash->pDevice->pages_size);
AT91F_DataFlashWaitReady(pDataFlash->pDataFlashDesc, AT91C_DATAFLASH_TIMEOUT);
status = AT91F_PageErase(pDataFlash, page);
AT91F_DataFlashWaitReady(pDataFlash->pDataFlashDesc, AT91C_DATAFLASH_TIMEOUT);
if (!status)
return AT91C_DATAFLASH_ERROR;
status = AT91F_WriteBufferToMain (pDataFlash, DB_BUF1_PAGE_PGM, dest);
if(!status)
return AT91C_DATAFLASH_ERROR;
AT91F_DataFlashWaitReady(pDataFlash->pDataFlashDesc, AT91C_DATAFLASH_TIMEOUT);
/* Update size, source and destination pointers */
size -= pDataFlash->pDevice->pages_size ;
dest += pDataFlash->pDevice->pages_size ;
@ -578,7 +578,7 @@ AT91S_DataFlashStatus AT91F_DataFlashErase(AT91PS_DataFlash pDataFlash)
unsigned int status;
AT91F_SpiEnable(pDataFlash->pDevice->cs);
for(page=0; page < pDataFlash->pDevice->pages_number; page++)
{
/* Erase dataflash page */

View File

@ -8,7 +8,7 @@
* intellectual property rights of others.
*----------------------------------------------------------------------------
* File Name : com.c
* Object :
* Object :
* Creation : HIi 03/27/2003
*
*----------------------------------------------------------------------------
@ -98,9 +98,9 @@ int at91_serial_getc()
/*-----------------------------------------------------------------------------
* Function Name : AT91F_ReadLine()
* Object :
* Input Parameters :
* Return value :
* Object :
* Input Parameters :
* Return value :
*-----------------------------------------------------------------------------
*/
int AT91F_ReadLine (const char *const prompt, char *console_buffer)
@ -144,14 +144,14 @@ int AT91F_ReadLine (const char *const prompt, char *console_buffer)
/*
* Must be a normal character then
*/
if (n < (AT91C_CB_SIZE -2))
if (n < (AT91C_CB_SIZE -2))
{
++col; /* echo input */
putc(c);
*p++ = c;
++n;
}
else
}
else
{ /* Buffer full */
putc('\a');
}
@ -162,9 +162,9 @@ int AT91F_ReadLine (const char *const prompt, char *console_buffer)
/*-----------------------------------------------------------------------------
* Function Name : AT91F_WaitKeyPressed()
* Object :
* Input Parameters :
* Return value :
* Object :
* Input Parameters :
* Return value :
*-----------------------------------------------------------------------------
*/
void AT91F_WaitKeyPressed(void)
@ -244,7 +244,7 @@ static int number(int num, int base, int size,
num = -num;
size--;
}
i = 0;
if(num == 0)
tmp[i++] = digits[0];
@ -254,11 +254,11 @@ static int number(int num, int base, int size,
if(i > precision)
precision = i;
size -= precision;
if(!(type&(ZEROPAD+LEFT)))
while(size-->0)
putc(' ');
if(sign)
putc(sign);
@ -268,7 +268,7 @@ static int number(int num, int base, int size,
while (i < precision--)
putc('0');
while (i-- > 0)
putc(tmp[i]);
@ -332,18 +332,18 @@ int hvfprintf(const char *fmt, va_list va)
case '%' :
putc(*fmt);
done = true;
default:
default:
putc('%');
putc(*fmt);
done = true;
break;
}
}
} while(!done);
} else if(*fmt == '\\') {
fmt++;
if(*fmt == 'r') {
putc('\r');
} else if(*fmt == 'n') {
} else if(*fmt == 'n') {
putc('\n');
}
} else {
@ -351,7 +351,7 @@ int hvfprintf(const char *fmt, va_list va)
}
fmt++;
} while(*fmt != 0);
return 0;
}

View File

@ -8,7 +8,7 @@
* intellectual property rights of others.
*----------------------------------------------------------------------------
* File Name : com.h
* Object :
* Object :
*
* 1.0 27/03/03 HIi : Creation
*----------------------------------------------------------------------------

View File

@ -30,7 +30,7 @@ int AT91F_DataflashInit(void)
int i;
int dfcode;
int Nb_device = 0;
AT91F_SpiInit();
for (i = 0; i < CFG_MAX_DATAFLASH_BANKS; i++) {
@ -88,7 +88,7 @@ int AT91F_DataflashInit(void)
default:
break;
}
}
}
return (Nb_device);
}
@ -111,7 +111,7 @@ void AT91F_DataflashPrintInfo(void)
case AT45DB642:
printf ("642");
break;
case AT45DB128:
case AT45DB128:
printf ("128");
break;
}

View File

@ -22,7 +22,7 @@
#ifdef SPI_LOW_SPEED
#define AT91C_SPI_CLK 14976000/4
#else
#define AT91C_SPI_CLK 14976000
#define AT91C_SPI_CLK 14976000
#endif
/* AC characteristics */

View File

@ -382,7 +382,7 @@ extern char const *AT91F_PipeGetError(AT91S_PipeStatus msgId);
extern const unsigned char bit_rev[256];
extern void CalculateCrc32(const unsigned char *,unsigned int, unsigned int *);
extern void CalculateCrc16(const unsigned char *, unsigned int , unsigned short *);
extern void CalculateCrc16(const unsigned char *, unsigned int , unsigned short *);
extern void CalculateCrcHdlc(const unsigned char *, unsigned int, unsigned short *);
extern void CalculateCrc16ccitt(const unsigned char *, unsigned int , unsigned short *);
@ -490,7 +490,7 @@ typedef struct _AT91S_RomBoot {
const AT91PF_SVC_CRCHDLC CRCHDLC;
const AT91PF_SVC_CRC32 CRC32;
const AT91PS_SVC_CRC_BIT_REV Bit_Reverse_Array;
const AT91PS_SINE_TAB SineTab;
const AT91PS_SINE_TAB SineTab;
const AT91PF_Sinus Sine;
} AT91S_RomBoot, *AT91PS_RomBoot;

View File

@ -50,7 +50,7 @@ typedef unsigned int AT91S_MCIDeviceStatus;
#define AT91C_TIMEOUT_CMDRDY 30
/////////////////////////////////////////////////////////////////////////////////////////////////////
// MMC & SDCard Structures
// MMC & SDCard Structures
/////////////////////////////////////////////////////////////////////////////////////////////////////
/*-----------------------------------------------*/
@ -70,7 +70,7 @@ typedef struct _AT91S_MciDeviceFeatures
{
unsigned char Card_Inserted; // (0=AT91C_CARD_REMOVED) (1=AT91C_MMC_CARD_INSERTED) (2=AT91C_SD_CARD_INSERTED)
unsigned int Relative_Card_Address; // RCA
unsigned int Max_Read_DataBlock_Length; // 2^(READ_BL_LEN) in CSD
unsigned int Max_Read_DataBlock_Length; // 2^(READ_BL_LEN) in CSD
unsigned int Max_Write_DataBlock_Length; // 2^(WRITE_BL_LEN) in CSD
unsigned char Read_Partial; // READ_BL_PARTIAL
unsigned char Write_Partial; // WRITE_BL_PARTIAL
@ -79,7 +79,7 @@ typedef struct _AT91S_MciDeviceFeatures
unsigned char Write_Block_Misalignment; // WRITE_BLK_MISALIGN
unsigned char Sector_Size; // SECTOR_SIZE
unsigned int Memory_Capacity; // Size in bits of the device
} AT91S_MciDeviceFeatures, *AT91PS_MciDeviceFeatures ;
/*---------------------------------------------*/
@ -88,15 +88,15 @@ typedef struct _AT91S_MciDeviceFeatures
typedef struct _AT91S_MciDevice
{
AT91PS_MciDeviceDesc pMCI_DeviceDesc; // MCI device descriptor
AT91PS_MciDeviceFeatures pMCI_DeviceFeatures;// Pointer on a MCI device features array
AT91PS_MciDeviceFeatures pMCI_DeviceFeatures;// Pointer on a MCI device features array
}AT91S_MciDevice, *AT91PS_MciDevice;
/////////////////////////////////////////////////////////////////////////////////////////////////////
// MCI_CMD Register Value
// MCI_CMD Register Value
/////////////////////////////////////////////////////////////////////////////////////////////////////
#define AT91C_POWER_ON_INIT (0 | AT91C_MCI_TRCMD_NO | AT91C_MCI_SPCMD_INIT | AT91C_MCI_OPDCMD)
/////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////
// Class 0 & 1 commands: Basic commands and Read Stream commands
/////////////////////////////////////////////////////////////////
@ -137,7 +137,7 @@ typedef struct _AT91S_MciDevice
//*------------------------------------------------
//* Class 4 commands: Block oriented write commands
//*------------------------------------------------
#define AT91C_WRITE_BLOCK_CMD (24 | AT91C_MCI_SPCMD_NONE | AT91C_MCI_RSPTYP_48 | AT91C_MCI_TRCMD_START | (AT91C_MCI_TRTYP_BLOCK & ~(AT91C_MCI_TRDIR)) | AT91C_MCI_MAXLAT)
#define AT91C_WRITE_MULTIPLE_BLOCK_CMD (25 | AT91C_MCI_SPCMD_NONE | AT91C_MCI_RSPTYP_48 | AT91C_MCI_TRCMD_START | (AT91C_MCI_TRTYP_MULTIPLE & ~(AT91C_MCI_TRDIR)) | AT91C_MCI_MAXLAT)
#define AT91C_PROGRAM_CSD_CMD (27 | AT91C_MCI_RSPTYP_48 )
@ -278,14 +278,14 @@ typedef struct _AT91S_MciDevice
#define AT91C_SR_CARD_SELECTED (AT91C_SR_READY_FOR_DATA + AT91C_SR_TRAN)
/////////////////////////////////////////////////////////////////////////////////////////////////////
// MMC CSD register header File
// MMC CSD register header File
// AT91C_CSD_xxx_S for shift value
// AT91C_CSD_xxx_M for mask value
/////////////////////////////////////////////////////////////////////////////////////////////////////
// First Response INT <=> CSD[3] : bits 0 to 31
#define AT91C_CSD_BIT0_S 0 // [0:0]
#define AT91C_CSD_BIT0_M 0x01
#define AT91C_CSD_BIT0_S 0 // [0:0]
#define AT91C_CSD_BIT0_M 0x01
#define AT91C_CSD_CRC_S 1 // [7:1]
#define AT91C_CSD_CRC_M 0x7F
#define AT91C_CSD_MMC_ECC_S 8 // [9:8] reserved for MMC compatibility
@ -314,15 +314,15 @@ typedef struct _AT91S_MciDevice
#define AT91C_CSD_WP_GRP_EN_M 0x01
// Seconde Response INT <=> CSD[2] : bits 32 to 63
#define AT91C_CSD_v21_WP_GRP_SIZE_S 0 // [38:32]
#define AT91C_CSD_v21_WP_GRP_SIZE_M 0x7F
#define AT91C_CSD_v21_WP_GRP_SIZE_S 0 // [38:32]
#define AT91C_CSD_v21_WP_GRP_SIZE_M 0x7F
#define AT91C_CSD_v21_SECT_SIZE_S 7 // [45:39]
#define AT91C_CSD_v21_SECT_SIZE_M 0x7F
#define AT91C_CSD_v21_ER_BLEN_EN_S 14 // [46:46]
#define AT91C_CSD_v21_ER_BLEN_EN_M 0x01
#define AT91C_CSD_v22_WP_GRP_SIZE_S 0 // [36:32]
#define AT91C_CSD_v22_WP_GRP_SIZE_M 0x1F
#define AT91C_CSD_v22_WP_GRP_SIZE_S 0 // [36:32]
#define AT91C_CSD_v22_WP_GRP_SIZE_M 0x1F
#define AT91C_CSD_v22_ER_GRP_SIZE_S 5 // [41:37]
#define AT91C_CSD_v22_ER_GRP_SIZE_M 0x1F
#define AT91C_CSD_v22_SECT_SIZE_S 10 // [46:42]
@ -345,7 +345,7 @@ typedef struct _AT91S_MciDevice
#define AT91C_CSD_CSIZE_H_S 0 // [73:64] <=> 10 MSB of CSIZE
#define AT91C_CSD_CSIZE_H_M 0x03FF
// reserved 10 // [75:74]
// reserved 0x03
// reserved 0x03
#define AT91C_CSD_DSR_I_S 12 // [76:76]
#define AT91C_CSD_DSR_I_M 0x01
#define AT91C_CSD_RD_B_MIS_S 13 // [77:77]

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -21,7 +21,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*/
#ifndef __LED_H
#define __LED_H

View File

@ -298,7 +298,7 @@ static inline unsigned int AT91F_DBGU_GetInterruptMaskStatus( // \return DBGU In
//*----------------------------------------------------------------------------
//* \fn AT91F_DBGU_IsInterruptMasked
//* \brief Test if DBGU Interrupt is Masked
//* \brief Test if DBGU Interrupt is Masked
//*----------------------------------------------------------------------------
static inline int AT91F_DBGU_IsInterruptMasked(
AT91PS_DBGU pDbgu, // \arg pointer to a DBGU controller
@ -344,7 +344,7 @@ static inline unsigned int AT91F_RTC_GetInterruptMaskStatus( // \return RTC Inte
//*----------------------------------------------------------------------------
//* \fn AT91F_RTC_IsInterruptMasked
//* \brief Test if RTC Interrupt is Masked
//* \brief Test if RTC Interrupt is Masked
//*----------------------------------------------------------------------------
static inline int AT91F_RTC_IsInterruptMasked(
AT91PS_RTC pRtc, // \arg pointer to a RTC controller
@ -565,7 +565,7 @@ static inline unsigned int AT91F_SSC_GetInterruptMaskStatus( // \return SSC Inte
//*----------------------------------------------------------------------------
//* \fn AT91F_SSC_IsInterruptMasked
//* \brief Test if SSC Interrupt is Masked
//* \brief Test if SSC Interrupt is Masked
//*----------------------------------------------------------------------------
static inline int AT91F_SSC_IsInterruptMasked(
AT91PS_SSC pSsc, // \arg pointer to a SSC controller
@ -666,7 +666,7 @@ static inline void AT91F_SPI_Disable (
//*----------------------------------------------------------------------------
static inline void AT91F_SPI_CfgMode (
AT91PS_SPI pSPI, // pointer to a SPI controller
int mode) // mode register
int mode) // mode register
{
//* Write to the MR register
pSPI->SPI_MR = mode;
@ -679,7 +679,7 @@ static inline void AT91F_SPI_CfgMode (
static inline void AT91F_SPI_CfgPCS (
AT91PS_SPI pSPI, // pointer to a SPI controller
char PCS_Device) // PCS of the Device
{
{
//* Write to the MR register
pSPI->SPI_MR &= 0xFFF0FFFF;
pSPI->SPI_MR |= ( (PCS_Device<<16) & AT91C_SPI_PCS );
@ -785,7 +785,7 @@ static inline unsigned int AT91F_SPI_GetInterruptMaskStatus( // \return SPI Inte
//*----------------------------------------------------------------------------
//* \fn AT91F_SPI_IsInterruptMasked
//* \brief Test if SPI Interrupt is Masked
//* \brief Test if SPI Interrupt is Masked
//*----------------------------------------------------------------------------
static inline int AT91F_SPI_IsInterruptMasked(
AT91PS_SPI pSpi, // \arg pointer to a SPI controller
@ -831,7 +831,7 @@ static inline unsigned int AT91F_TC_GetInterruptMaskStatus( // \return TC Interr
//*----------------------------------------------------------------------------
//* \fn AT91F_TC_IsInterruptMasked
//* \brief Test if TC Interrupt is Masked
//* \brief Test if TC Interrupt is Masked
//*----------------------------------------------------------------------------
static inline int AT91F_TC_IsInterruptMasked(
AT91PS_TC pTc, // \arg pointer to a TC controller
@ -1107,7 +1107,7 @@ static inline void AT91F_PIO_ForceOutput(
//*----------------------------------------------------------------------------
static inline void AT91F_PIO_Enable(
AT91PS_PIO pPio, // \arg pointer to a PIO controller
unsigned int flag) // \arg pio to be enabled
unsigned int flag) // \arg pio to be enabled
{
pPio->PIO_PER = flag;
}
@ -1118,7 +1118,7 @@ static inline void AT91F_PIO_Enable(
//*----------------------------------------------------------------------------
static inline void AT91F_PIO_Disable(
AT91PS_PIO pPio, // \arg pointer to a PIO controller
unsigned int flag) // \arg pio to be disabled
unsigned int flag) // \arg pio to be disabled
{
pPio->PIO_PDR = flag;
}
@ -1232,9 +1232,9 @@ static inline int AT91F_PIO_IsInputFilterSet(
//*----------------------------------------------------------------------------
//* \fn AT91F_PIO_GetOutputDataStatus
//* \brief Return PIO Output Data Status
//* \brief Return PIO Output Data Status
//*----------------------------------------------------------------------------
static inline unsigned int AT91F_PIO_GetOutputDataStatus( // \return PIO Output Data Status
static inline unsigned int AT91F_PIO_GetOutputDataStatus( // \return PIO Output Data Status
AT91PS_PIO pPio) // \arg pointer to a PIO controller
{
return pPio->PIO_ODSR;
@ -1284,7 +1284,7 @@ static inline unsigned int AT91F_PIO_GetInterruptStatus( // \return PIO Interrup
//*----------------------------------------------------------------------------
//* \fn AT91F_PIO_IsInterruptMasked
//* \brief Test if PIO Interrupt is Masked
//* \brief Test if PIO Interrupt is Masked
//*----------------------------------------------------------------------------
static inline int AT91F_PIO_IsInterruptMasked(
AT91PS_PIO pPio, // \arg pointer to a PIO controller
@ -1349,7 +1349,7 @@ static inline int AT91F_PIO_IsMultiDriverSet(
//*----------------------------------------------------------------------------
//* \fn AT91F_PIO_A_RegisterSelection
//* \brief PIO A Register Selection
//* \brief PIO A Register Selection
//*----------------------------------------------------------------------------
static inline void AT91F_PIO_A_RegisterSelection(
AT91PS_PIO pPio, // \arg pointer to a PIO controller
@ -1360,11 +1360,11 @@ static inline void AT91F_PIO_A_RegisterSelection(
//*----------------------------------------------------------------------------
//* \fn AT91F_PIO_B_RegisterSelection
//* \brief PIO B Register Selection
//* \brief PIO B Register Selection
//*----------------------------------------------------------------------------
static inline void AT91F_PIO_B_RegisterSelection(
AT91PS_PIO pPio, // \arg pointer to a PIO controller
unsigned int flag) // \arg pio B register selection
unsigned int flag) // \arg pio B register selection
{
pPio->PIO_BSR = flag;
}
@ -1437,7 +1437,7 @@ static inline int AT91F_PIO_IsOutputWriteSet(
//* \fn AT91F_PIO_GetCfgPullup
//* \brief Return PIO Configuration Pullup
//*----------------------------------------------------------------------------
static inline unsigned int AT91F_PIO_GetCfgPullup( // \return PIO Configuration Pullup
static inline unsigned int AT91F_PIO_GetCfgPullup( // \return PIO Configuration Pullup
AT91PS_PIO pPio) // \arg pointer to a PIO controller
{
return pPio->PIO_PPUSR;
@ -1445,7 +1445,7 @@ static inline unsigned int AT91F_PIO_GetCfgPullup( // \return PIO Configuration
//*----------------------------------------------------------------------------
//* \fn AT91F_PIO_IsOutputDataStatusSet
//* \brief Test if PIO Output Data Status is Set
//* \brief Test if PIO Output Data Status is Set
//*----------------------------------------------------------------------------
static inline int AT91F_PIO_IsOutputDataStatusSet(
AT91PS_PIO pPio, // \arg pointer to a PIO controller
@ -1521,7 +1521,7 @@ static inline unsigned int AT91F_TWI_GetInterruptMaskStatus( // \return TWI Inte
//*----------------------------------------------------------------------------
//* \fn AT91F_TWI_IsInterruptMasked
//* \brief Test if TWI Interrupt is Masked
//* \brief Test if TWI Interrupt is Masked
//*----------------------------------------------------------------------------
static inline int AT91F_TWI_IsInterruptMasked(
AT91PS_TWI pTwi, // \arg pointer to a TWI controller
@ -2329,7 +2329,7 @@ static inline unsigned int AT91F_UDP_GetInterruptMaskStatus( // \return UDP Inte
//*----------------------------------------------------------------------------
//* \fn AT91F_UDP_IsInterruptMasked
//* \brief Test if UDP Interrupt is Masked
//* \brief Test if UDP Interrupt is Masked
//*----------------------------------------------------------------------------
static inline int AT91F_UDP_IsInterruptMasked(
AT91PS_UDP pUdp, // \arg pointer to a UDP controller
@ -2390,7 +2390,7 @@ static inline unsigned int AT91F_ST_GetInterruptMaskStatus( // \return ST Interr
//*----------------------------------------------------------------------------
//* \fn AT91F_ST_IsInterruptMasked
//* \brief Test if ST Interrupt is Masked
//* \brief Test if ST Interrupt is Masked
//*----------------------------------------------------------------------------
static inline int AT91F_ST_IsInterruptMasked(
AT91PS_ST pSt, // \arg pointer to a ST controller

View File

@ -21,7 +21,7 @@
//* \fn AT91F_DataAbort
//* \brief This function reports an Abort
//*----------------------------------------------------------------------------
static void AT91F_SpuriousHandler()
static void AT91F_SpuriousHandler()
{
puts("ISI");
while (1);
@ -32,7 +32,7 @@ static void AT91F_SpuriousHandler()
//* \fn AT91F_DataAbort
//* \brief This function reports an Abort
//*----------------------------------------------------------------------------
static void AT91F_DataAbort()
static void AT91F_DataAbort()
{
puts("IDA");
while (1);
@ -52,7 +52,7 @@ static void AT91F_FetchAbort()
//* \fn AT91F_UndefHandler
//* \brief This function reports that no handler have been set for current IT
//*----------------------------------------------------------------------------
static void AT91F_UndefHandler()
static void AT91F_UndefHandler()
{
puts("IUD");
while (1);
@ -68,47 +68,47 @@ static void AT91F_UndefHandler()
static void AT91F_InitSdram()
{
int *pRegister;
//* Configure PIOC as peripheral (D16/D31)
AT91F_PIO_CfgPeriph(
AT91C_BASE_PIOC, // PIO controller base address
0xFFFF0030,
0
);
//*Init SDRAM
pRegister = (int *)0xFFFFFF98;
*pRegister = 0x2188c155;
*pRegister = 0x2188c155;
pRegister = (int *)0xFFFFFF90;
*pRegister = 0x2;
*pRegister = 0x2;
pRegister = (int *)0x20000000;
*pRegister = 0;
*pRegister = 0;
pRegister = (int *)0xFFFFFF90;
*pRegister = 0x4;
*pRegister = 0x4;
pRegister = (int *)0x20000000;
*pRegister = 0;
*pRegister = 0;
*pRegister = 0;
*pRegister = 0;
*pRegister = 0;
*pRegister = 0;
*pRegister = 0;
*pRegister = 0;
*pRegister = 0;
*pRegister = 0;
*pRegister = 0;
*pRegister = 0;
*pRegister = 0;
*pRegister = 0;
*pRegister = 0;
*pRegister = 0;
pRegister = (int *)0xFFFFFF90;
*pRegister = 0x3;
*pRegister = 0x3;
pRegister = (int *)0x20000080;
*pRegister = 0;
*pRegister = 0;
pRegister = (int *)0xFFFFFF94;
*pRegister = 0x2e0;
*pRegister = 0x2e0;
pRegister = (int *)0x20000000;
*pRegister = 0;
*pRegister = 0;
pRegister = (int *)0xFFFFFF90;
*pRegister = 0x00;
*pRegister = 0x00;
pRegister = (int *)0x20000000;
*pRegister = 0;
*pRegister = 0;
}
@ -127,7 +127,7 @@ static void AT91F_InitMemories()
//* CS0 cs for flash
pEbi = (int *)0xFFFFFF70;
*pEbi = 0x00003284;
AT91F_InitSdram();
}
@ -150,7 +150,7 @@ void AT91F_LowLevelInit(void)
AT91F_SpuriousHandler, // AIC spurious handler
0); // Protect mode
// Perform 8 End Of Interrupt Command to make sýre AIC will not Lock out nIRQ
// Perform 8 End Of Interrupt Command to make sýre AIC will not Lock out nIRQ
for(i=0; i<8; i++)
AT91F_AIC_AcknowledgeIt(AT91C_BASE_AIC);

View File

@ -85,7 +85,7 @@ void LED_blink(unsigned int led)
for(j= 0; j < 200000; j++);
LED_set(0);
for(j= 0; j < 200000; j++);
}
}
}

View File

@ -8,7 +8,7 @@
* intellectual property rights of others.
*----------------------------------------------------------------------------
* File Name : main.c
* Object :
* Object :
* Creation : HIi 10/10/2003
* Modif : HIi 15/06/2004 : add crc32 to verify the download
* from dataflash
@ -107,7 +107,7 @@ AT91S_CtlTempo ctlTempo;
//*--------------------------------------------------------------------------------------
//* Function Name : GetTickCount()
//* Object : Return the number of systimer tick
//* Object : Return the number of systimer tick
//* Input Parameters :
//* Output Parameters :
//*--------------------------------------------------------------------------------------
@ -141,10 +141,10 @@ static void XmodemProtocol(AT91S_PipeStatus status, void *pVoid)
{
AT91PS_SBuffer pSBuffer = (AT91PS_SBuffer) xmodemPipe.pBuffer->pChild;
AT91PS_USART pUsart = svcXmodem.pUsart;
if (pSBuffer->szRdBuffer == 0) {
/* Start a tempo to wait the Xmodem protocol complete */
svcXmodem.tempo.Start(&(svcXmodem.tempo), 10, 0, AT91_XmodemComplete, pUsart);
svcXmodem.tempo.Start(&(svcXmodem.tempo), 10, 0, AT91_XmodemComplete, pUsart);
}
}
#endif
@ -161,7 +161,7 @@ void AT91F_ST_HANDLER(void)
#ifdef XMODEM
unsigned int error;
#endif
if (AT91C_BASE_ST->ST_SR & 0x01) {
StTick++;
ctlTempo.CtlTempoTick(&ctlTempo);
@ -177,9 +177,9 @@ void AT91F_ST_HANDLER(void)
AT91F_US_EnableIt((AT91PS_USART)AT91C_BASE_DBGU, AT91C_US_RXRDY);
}
else if (csr & (AT91C_US_TXRDY | AT91C_US_ENDTX | AT91C_US_TXEMPTY |
AT91C_US_RXRDY | AT91C_US_ENDRX | AT91C_US_TIMEOUT |
else if (csr & (AT91C_US_TXRDY | AT91C_US_ENDTX | AT91C_US_TXEMPTY |
AT91C_US_RXRDY | AT91C_US_ENDRX | AT91C_US_TIMEOUT |
AT91C_US_RXBUFF)) {
if ( !(svcXmodem.eot) )
svcXmodem.Handler(&svcXmodem, csr);
@ -190,9 +190,9 @@ void AT91F_ST_HANDLER(void)
//*-----------------------------------------------------------------------------
//* Function Name : AT91F_DisplayMenu()
//* Object :
//* Input Parameters :
//* Return value :
//* Object :
//* Input Parameters :
//* Return value :
//*-----------------------------------------------------------------------------
static int AT91F_DisplayMenu(void)
{
@ -204,30 +204,30 @@ static int AT91F_DisplayMenu(void)
puts(menu_dataflash[i]);
}
return mci_present;
}
}
//*-----------------------------------------------------------------------------
//* Function Name : AsciiToHex()
//* Object : ascii to hexa conversion
//* Input Parameters :
//* Return value :
//* Input Parameters :
//* Return value :
//*-----------------------------------------------------------------------------
static unsigned int AsciiToHex(char *s, unsigned int *val)
{
int n;
*val=0;
if(s[0] == '0' && ((s[1] == 'x') || (s[1] == 'X')))
s+=2;
n = 0;
n = 0;
while((n < 8) && (s[n] !=0))
{
*val <<= 4;
if ( (s[n] >= '0') && (s[n] <='9'))
*val += (s[n] - '0');
else
else
if ((s[n] >= 'a') && (s[n] <='f'))
*val += (s[n] - 0x57);
else
@ -238,7 +238,7 @@ static unsigned int AsciiToHex(char *s, unsigned int *val)
n++;
}
return 1;
return 1;
}
@ -246,8 +246,8 @@ static unsigned int AsciiToHex(char *s, unsigned int *val)
//*-----------------------------------------------------------------------------
//* Function Name : AT91F_MemoryDisplay()
//* Object : Display the content of the dataflash
//* Input Parameters :
//* Return value :
//* Input Parameters :
//* Return value :
//*-----------------------------------------------------------------------------
static int AT91F_MemoryDisplay(unsigned int addr, unsigned int length)
{
@ -265,7 +265,7 @@ static int AT91F_MemoryDisplay(unsigned int addr, unsigned int length)
// uip = (unsigned int *)linebuf;
// usp = (unsigned short *)linebuf;
ucp = (unsigned char *)linebuf;
printf("%08x:", addr);
linebytes = (nbytes > DISP_LINE_LEN)?DISP_LINE_LEN:nbytes;
if((addr & 0xF0000000) == 0x20000000) {
@ -277,7 +277,7 @@ static int AT91F_MemoryDisplay(unsigned int addr, unsigned int length)
}
for (i=0; i<linebytes; i++)
{
/* if (size == 4)
/* if (size == 4)
printf(" %08x", *uip++);
else if (size == 2)
printf(" %04x", *usp++);
@ -321,7 +321,7 @@ static unsigned int AT91F_SetPLL(void)
pCkgr->CKGR_PLLAR = AT91C_PLLA_VALUE;
while (!(*AT91C_PMC_SR & AT91C_PMC_LOCKA));
/* - Switch Master Clock from PLLB to PLLA/3 */
tmp = pPmc->PMC_MCKR;
/* See Atmel Errata #27 and #28 */
@ -336,7 +336,7 @@ static unsigned int AT91F_SetPLL(void)
while (!(*AT91C_PMC_SR & AT91C_PMC_MCKRDY));
}
return 1;
return 1;
}
@ -387,7 +387,7 @@ static int AT91F_LoadBoot(void)
volatile unsigned int AddressToDownload = AT91C_BOOT_ADDR;
#if 0
/* Read vector 6 to extract size to load */
/* Read vector 6 to extract size to load */
if (read_dataflash(AT91C_BOOT_DATAFLASH_ADDR, 32,
(char *)AddressToDownload) != AT91C_DATAFLASH_OK)
{
@ -397,7 +397,7 @@ static int AT91F_LoadBoot(void)
/* calculate the size to download */
SizeToDownload = *(int *)(AddressToDownload + AT91C_OFFSET_VECT6);
#endif
// printf("\nLoad UBOOT from dataflash[%x] to SDRAM[%x]\n",
// AT91C_BOOT_DATAFLASH_ADDR, AT91C_BOOT_ADDR);
if (read_dataflash(AT91C_BOOT_DATAFLASH_ADDR, SizeToDownload + 8,
@ -417,7 +417,7 @@ static int AT91F_LoadBoot(void)
/* Restore the value of Vector 6 */
*(int *)(AddressToDownload + AT91C_OFFSET_VECT6) =
*(int *)(AddressToDownload + SizeToDownload + 4);
if (crc1 != crc2) {
printf("DF CRC bad %x != %x\n",crc1,crc2);
return IMAGE_CRC_ERROR;
@ -543,11 +543,11 @@ int main(void)
#endif
AT91S_SvcTempo svcBootTempo; // Link to a AT91S_Tempo object
unsigned int ix;
volatile unsigned int AddressToDownload, SizeToDownload;
volatile unsigned int AddressToDownload, SizeToDownload;
unsigned int DeviceAddress = 0;
char command = 0;
#ifdef XMODEM
volatile int i = 0;
volatile int i = 0;
unsigned int crc1 = 0, crc2 = 0;
volatile int device;
int NbPage;
@ -568,7 +568,7 @@ int main(void)
/* Tempo Initialisation */
pAT91->OpenCtlTempo(&ctlTempo, (void *) &(pAT91->SYSTIMER_DESC));
ctlTempo.CtlTempoStart((void *) &(pAT91->SYSTIMER_DESC));
// Attach the tempo to a tempo controler
ctlTempo.CtlTempoCreate(&ctlTempo, &svcBootTempo);
// LED_init();
@ -607,11 +607,11 @@ int main(void)
AddressToDownload = AT91C_DOWNLOAD_BASE_ADDRESS;
SizeToDownload = AT91C_DOWNLOAD_MAX_SIZE;
DeviceAddress = 0;
/* try to detect Dataflash */
if (!Nb_Device)
Nb_Device = AT91F_DataflashInit();
Nb_Device = AT91F_DataflashInit();
mci_present = AT91F_DisplayMenu();
#ifdef PRODTEST
@ -631,10 +631,10 @@ int main(void)
command = message[0];
for(ix = 1; (message[ix] == ' ') && (ix < 12); ix++); // Skip some whitespace
if(!AsciiToHex(&message[ix], &DeviceAddress) )
DeviceAddress = 0; // Illegal DeviceAddress
switch(command)
{
#ifdef XMODEM
@ -661,7 +661,7 @@ int main(void)
device = 0;
break;
case CFG_DATAFLASH_LOGIC_ADDR_CS3:
if (dataflash_info[1].id == 0){
printf("No DF");
@ -670,7 +670,7 @@ int main(void)
}
device = 1;
break;
default:
command = 0;
break;
@ -691,7 +691,7 @@ int main(void)
#ifdef MEMDISP
case '6':
do
do
{
AT91F_MemoryDisplay(DeviceAddress, 256);
AT91F_ReadLine (NULL, message);
@ -736,9 +736,9 @@ int main(void)
#ifdef XMODEM
for(i = 0; i <= AT91C_DOWNLOAD_MAX_SIZE; i++)
*(unsigned char *)(AddressToDownload + i) = 0;
xmodemPipe.Read(&xmodemPipe, (char *)AddressToDownload,
SizeToDownload, XmodemProtocol, 0);
SizeToDownload, XmodemProtocol, 0);
while(XmodemComplete !=1);
SizeToDownload = (unsigned int)((svcXmodem.pData) -
(unsigned int)AddressToDownload);
@ -753,21 +753,21 @@ int main(void)
i = (SizeToDownload / 512)+1 + (NbPage << 13) +
(dataflash_info[device].Device.pages_size << 17); //+4 to add crc32
SizeToDownload = 512 * (i &0xFF);
}
}
else
{
/* Save the contents of vector 6 ==> will be restored
/* Save the contents of vector 6 ==> will be restored
* at boot time (AT91F_StartBoot) */
*(int *)(AddressToDownload + SizeToDownload + 4) =
*(int *)(AddressToDownload + AT91C_OFFSET_VECT6);
/* Modify Vector 6 to contain the size of the
* file to copy (Dataflash -> SDRAM)*/
i = SizeToDownload;
}
i = SizeToDownload;
}
*(int *)(AddressToDownload + AT91C_OFFSET_VECT6) = i;
// printf("\nModification of Arm Vector 6 :%x\n", i);
// printf("\nWrite %d bytes in DataFlash [0x%x]\n",SizeToDownload, DeviceAddress);
crc1 = 0;
pAT91->CRC32((const unsigned char *)AddressToDownload, SizeToDownload , &crc1);
@ -784,13 +784,13 @@ int main(void)
/* clear the buffer before read */
for(i=0; i <= SizeToDownload; i++)
*(unsigned char *)(AddressToDownload + i) = 0;
/* Read dataflash to check the validity of the data */
read_dataflash (DeviceAddress, (SizeToDownload + 4), (char *)(AddressToDownload));
printf("VFY: ");
printf("VFY: ");
crc2 = 0;
pAT91->CRC32((const unsigned char *)AddressToDownload, SizeToDownload , &crc2);
crc1 = (int)(*(char *)(AddressToDownload + SizeToDownload)) +
(int)(*(char *)(AddressToDownload + SizeToDownload + 1) << 8) +
@ -801,7 +801,7 @@ int main(void)
printf("ERR");
else
printf("OK");
command = 0;
XmodemComplete = 0;
AT91F_WaitKeyPressed();

View File

@ -12,7 +12,7 @@
//*
//* 1.0 27/03/03 HIi : Creation
//* 1.01 03/05/04 HIi : AT9C_VERSION incremented to 1.01
//* 1.02 15/06/04 HIi : AT9C_VERSION incremented to 1.02 ==>
//* 1.02 15/06/04 HIi : AT9C_VERSION incremented to 1.02 ==>
//* Add crc32 to verify dataflash download
//* 1.03 18/04/05 MLC : AT91C_VERSION incremented to 1.03g
//* Repeat boot on CRC Failure

View File

@ -94,7 +94,7 @@ int AT91F_MCI_SDCard_SendAppCommand (
status = AT91C_BASE_MCI->MCI_SR;
//tick++;
}
while( !(status & AT91C_MCI_CMDRDY) );//&& (tick<100) );
while( !(status & AT91C_MCI_CMDRDY) );//&& (tick<100) );
// if an error occurs
if (((AT91C_BASE_MCI->MCI_SR) & AT91C_MCI_SR_ERROR) != 0 )
@ -134,16 +134,16 @@ void AT91F_MCI_Device_Handler(
{
AT91C_BASE_MCI->MCI_IDR = AT91C_MCI_TXBUFE;
AT91C_BASE_PDC_MCI->PDC_PTCR = AT91C_PDC_TXTDIS;
pMCI_Device->pMCI_DeviceDesc->state = AT91C_MCI_IDLE;
} // End of if AT91C_MCI_TXBUFF
} // End of if AT91C_MCI_TXBUFF
// If End of Rx Buffer Full interrupt occurred
if ( status & AT91C_MCI_RXBUFF )
{
{
AT91C_BASE_MCI->MCI_IDR = AT91C_MCI_RXBUFF;
AT91C_BASE_PDC_MCI->PDC_PTCR = AT91C_PDC_RXTDIS;
pMCI_Device->pMCI_DeviceDesc->state = AT91C_MCI_IDLE;
} // End of if AT91C_MCI_RXBUFF
@ -175,30 +175,30 @@ int AT91F_MCI_ReadBlock(
////////////////////////////////////////////////////////////////////////////////////////////
if(pMCI_Device->pMCI_DeviceDesc->state != AT91C_MCI_IDLE)
return AT91C_READ_ERROR;
if( (AT91F_MCI_GetStatus(pMCI_Device,pMCI_Device->pMCI_DeviceFeatures->Relative_Card_Address) & AT91C_SR_READY_FOR_DATA) != AT91C_SR_READY_FOR_DATA)
return AT91C_READ_ERROR;
if ( (src + sizeToRead) > pMCI_Device->pMCI_DeviceFeatures->Memory_Capacity )
return AT91C_READ_ERROR;
// If source does not fit a begin of a block
if ( (src % pMCI_Device->pMCI_DeviceFeatures->Max_Read_DataBlock_Length) != 0 )
return AT91C_READ_ERROR;
// Test if the MMC supports Partial Read Block
// ALWAYS SUPPORTED IN SD Memory Card
if( (sizeToRead < pMCI_Device->pMCI_DeviceFeatures->Max_Read_DataBlock_Length)
if( (sizeToRead < pMCI_Device->pMCI_DeviceFeatures->Max_Read_DataBlock_Length)
&& (pMCI_Device->pMCI_DeviceFeatures->Read_Partial == 0x00) )
return AT91C_READ_ERROR;
if( sizeToRead > pMCI_Device->pMCI_DeviceFeatures->Max_Read_DataBlock_Length)
return AT91C_READ_ERROR;
////////////////////////////////////////////////////////////////////////////////////////////
// Init Mode Register
AT91C_BASE_MCI->MCI_MR |= ((pMCI_Device->pMCI_DeviceFeatures->Max_Read_DataBlock_Length << 16) | AT91C_MCI_PDCMODE);
if (sizeToRead %4)
sizeToRead = (sizeToRead /4)+1;
else
@ -219,7 +219,7 @@ int AT91F_MCI_ReadBlock(
// (PDC) Receiver Transfer Enable
AT91C_BASE_PDC_MCI->PDC_PTCR = AT91C_PDC_RXTEN;
return AT91C_READ_OK;
}
@ -238,29 +238,29 @@ int AT91F_MCI_WriteBlock(
////////////////////////////////////////////////////////////////////////////////////////////
if( pMCI_Device->pMCI_DeviceDesc->state != AT91C_MCI_IDLE)
return AT91C_WRITE_ERROR;
if( (AT91F_MCI_GetStatus(pMCI_Device,pMCI_Device->pMCI_DeviceFeatures->Relative_Card_Address) & AT91C_SR_READY_FOR_DATA) != AT91C_SR_READY_FOR_DATA)
return AT91C_WRITE_ERROR;
if ( (dest + sizeToWrite) > pMCI_Device->pMCI_DeviceFeatures->Memory_Capacity )
return AT91C_WRITE_ERROR;
// If source does not fit a begin of a block
if ( (dest % pMCI_Device->pMCI_DeviceFeatures->Max_Read_DataBlock_Length) != 0 )
return AT91C_WRITE_ERROR;
// Test if the MMC supports Partial Write Block
if( (sizeToWrite < pMCI_Device->pMCI_DeviceFeatures->Max_Write_DataBlock_Length)
// Test if the MMC supports Partial Write Block
if( (sizeToWrite < pMCI_Device->pMCI_DeviceFeatures->Max_Write_DataBlock_Length)
&& (pMCI_Device->pMCI_DeviceFeatures->Write_Partial == 0x00) )
return AT91C_WRITE_ERROR;
if( sizeToWrite > pMCI_Device->pMCI_DeviceFeatures->Max_Write_DataBlock_Length )
return AT91C_WRITE_ERROR;
////////////////////////////////////////////////////////////////////////////////////////////
// Init Mode Register
AT91C_BASE_MCI->MCI_MR |= ((pMCI_Device->pMCI_DeviceFeatures->Max_Write_DataBlock_Length << 16) | AT91C_MCI_PDCMODE);
if (sizeToWrite %4)
sizeToWrite = (sizeToWrite /4)+1;
else
@ -279,10 +279,10 @@ int AT91F_MCI_WriteBlock(
// Enable AT91C_MCI_TXBUFE Interrupt
AT91C_BASE_MCI->MCI_IER = AT91C_MCI_TXBUFE;
// Enables TX for PDC transfert requests
AT91C_BASE_PDC_MCI->PDC_PTCR = AT91C_PDC_TXTEN;
return AT91C_WRITE_OK;
}
#endif
@ -295,7 +295,7 @@ int AT91F_MCI_WriteBlock(
int AT91F_MCI_MMC_SelectCard(AT91PS_MciDevice pMCI_Device, unsigned int relative_card_address)
{
int status;
//* Check if the MMC card chosen is already the selected one
status = AT91F_MCI_GetStatus(pMCI_Device,relative_card_address);
@ -328,17 +328,17 @@ int AT91F_MCI_MMC_SelectCard(AT91PS_MciDevice pMCI_Device, unsigned int relative
//*----------------------------------------------------------------------------
int AT91F_MCI_GetCSD (AT91PS_MciDevice pMCI_Device, unsigned int relative_card_address , unsigned int * response)
{
if(AT91F_MCI_SendCommand(pMCI_Device,
AT91C_SEND_CSD_CMD,
(relative_card_address << 16)) != AT91C_CMD_SEND_OK)
return AT91C_CMD_SEND_ERROR;
response[0] = AT91C_BASE_MCI->MCI_RSPR[0];
response[1] = AT91C_BASE_MCI->MCI_RSPR[1];
response[2] = AT91C_BASE_MCI->MCI_RSPR[2];
response[3] = AT91C_BASE_MCI->MCI_RSPR[3];
return AT91C_CMD_SEND_OK;
}
@ -359,7 +359,7 @@ int AT91F_MCI_SetBlocklength(AT91PS_MciDevice pMCI_Device,unsigned int length)
int AT91F_MCI_MMC_GetAllOCR (AT91PS_MciDevice pMCI_Device)
{
unsigned int response =0x0;
while(1)
{
response = AT91F_MCI_SendCommand(pMCI_Device,
@ -367,11 +367,11 @@ int AT91F_MCI_MMC_GetAllOCR (AT91PS_MciDevice pMCI_Device)
AT91C_MMC_HOST_VOLTAGE_RANGE);
if (response != AT91C_CMD_SEND_OK)
return AT91C_INIT_ERROR;
response = AT91C_BASE_MCI->MCI_RSPR[0];
if ( (response & AT91C_CARD_POWER_UP_BUSY) == AT91C_CARD_POWER_UP_BUSY)
return(response);
return(response);
}
}
#endif
@ -384,7 +384,7 @@ int AT91F_MCI_MMC_GetAllOCR (AT91PS_MciDevice pMCI_Device)
int AT91F_MCI_MMC_GetAllCID (AT91PS_MciDevice pMCI_Device, unsigned int *response)
{
int Nb_Cards_Found=-1;
while(1)
{
if(AT91F_MCI_SendCommand(pMCI_Device,
@ -392,18 +392,18 @@ int AT91F_MCI_MMC_GetAllCID (AT91PS_MciDevice pMCI_Device, unsigned int *respons
AT91C_NO_ARGUMENT) != AT91C_CMD_SEND_OK)
return Nb_Cards_Found;
else
{
{
Nb_Cards_Found = 0;
//* Assignation of the relative address to the MMC CARD
pMCI_Device->pMCI_DeviceFeatures[Nb_Cards_Found].Relative_Card_Address = Nb_Cards_Found + AT91C_FIRST_RCA;
//* Set the insert flag
pMCI_Device->pMCI_DeviceFeatures[Nb_Cards_Found].Card_Inserted = AT91C_MMC_CARD_INSERTED;
if (AT91F_MCI_SendCommand(pMCI_Device,
AT91C_MMC_SET_RELATIVE_ADDR_CMD,
(Nb_Cards_Found + AT91C_FIRST_RCA) << 16) != AT91C_CMD_SEND_OK)
return AT91C_CMD_SEND_ERROR;
//* If no error during assignation address ==> Increment Nb_cards_Found
Nb_Cards_Found++ ;
}
@ -438,7 +438,7 @@ int AT91F_MCI_MMC_Init (AT91PS_MciDevice pMCI_Device)
if (AT91F_MCI_GetCSD(pMCI_Device,
pMCI_Device->pMCI_DeviceFeatures[i].Relative_Card_Address,
tab_response) != AT91C_CMD_SEND_OK)
pMCI_Device->pMCI_DeviceFeatures[i].Relative_Card_Address = 0;
pMCI_Device->pMCI_DeviceFeatures[i].Relative_Card_Address = 0;
else
{
pMCI_Device->pMCI_DeviceFeatures[i].Max_Read_DataBlock_Length = 1 << ((tab_response[1] >> AT91C_CSD_RD_B_LEN_S) & AT91C_CSD_RD_B_LEN_M );
@ -446,10 +446,10 @@ int AT91F_MCI_MMC_Init (AT91PS_MciDevice pMCI_Device)
pMCI_Device->pMCI_DeviceFeatures[i].Sector_Size = 1 + ((tab_response[2] >> AT91C_CSD_v22_SECT_SIZE_S) & AT91C_CSD_v22_SECT_SIZE_M );
pMCI_Device->pMCI_DeviceFeatures[i].Read_Partial = (tab_response[1] >> AT91C_CSD_RD_B_PAR_S) & AT91C_CSD_RD_B_PAR_M;
pMCI_Device->pMCI_DeviceFeatures[i].Write_Partial = (tab_response[3] >> AT91C_CSD_WBLOCK_P_S) & AT91C_CSD_WBLOCK_P_M;
// None in MMC specification version 2.2
pMCI_Device->pMCI_DeviceFeatures[i].Erase_Block_Enable = 0;
pMCI_Device->pMCI_DeviceFeatures[i].Read_Block_Misalignment = (tab_response[1] >> AT91C_CSD_RD_B_MIS_S) & AT91C_CSD_RD_B_MIS_M;
pMCI_Device->pMCI_DeviceFeatures[i].Write_Block_Misalignment = (tab_response[1] >> AT91C_CSD_WR_B_MIS_S) & AT91C_CSD_WR_B_MIS_M;
@ -463,10 +463,10 @@ int AT91F_MCI_MMC_Init (AT91PS_MciDevice pMCI_Device)
pMCI_Device->pMCI_DeviceFeatures[i].Memory_Capacity = pMCI_Device->pMCI_DeviceFeatures[i].Max_Read_DataBlock_Length * blocknr;
//// End of Compute Memory Capacity
} // end of else
} // end of else
} // end of for
return AT91C_INIT_OK;
} // end of if
@ -484,7 +484,7 @@ int AT91F_MCI_SDCard_GetOCR (AT91PS_MciDevice pMCI_Device)
// The RCA to be used for CMD55 in Idle state shall be the card's default RCA=0x0000.
pMCI_Device->pMCI_DeviceFeatures->Relative_Card_Address = 0x0;
while( (response & AT91C_CARD_POWER_UP_BUSY) != AT91C_CARD_POWER_UP_BUSY )
{
response = AT91F_MCI_SDCard_SendAppCommand(pMCI_Device,
@ -492,10 +492,10 @@ int AT91F_MCI_SDCard_GetOCR (AT91PS_MciDevice pMCI_Device)
AT91C_MMC_HOST_VOLTAGE_RANGE);
if (response != AT91C_CMD_SEND_OK)
return AT91C_INIT_ERROR;
response = AT91C_BASE_MCI->MCI_RSPR[0];
}
return(AT91C_BASE_MCI->MCI_RSPR[0]);
}
@ -509,12 +509,12 @@ int AT91F_MCI_SDCard_GetCID (AT91PS_MciDevice pMCI_Device, unsigned int *respons
AT91C_ALL_SEND_CID_CMD,
AT91C_NO_ARGUMENT) != AT91C_CMD_SEND_OK)
return AT91C_CMD_SEND_ERROR;
response[0] = AT91C_BASE_MCI->MCI_RSPR[0];
response[1] = AT91C_BASE_MCI->MCI_RSPR[1];
response[2] = AT91C_BASE_MCI->MCI_RSPR[2];
response[3] = AT91C_BASE_MCI->MCI_RSPR[3];
return AT91C_CMD_SEND_OK;
}
@ -594,7 +594,7 @@ int AT91F_MCI_SDCard_Init (AT91PS_MciDevice pMCI_Device)
printf("SD-Card: %d Bytes\n\r", pMCI_Device->pMCI_DeviceFeatures->Memory_Capacity);
if( AT91F_MCI_SDCard_SetBusWidth(pMCI_Device) == AT91C_CMD_SEND_OK )
{
{
if (AT91F_MCI_SetBlocklength(pMCI_Device,pMCI_Device->pMCI_DeviceFeatures->Max_Read_DataBlock_Length) == AT91C_CMD_SEND_OK)
return AT91C_INIT_OK;
}
@ -621,10 +621,10 @@ void AT91F_CfgDevice(void)
MCI_Device_Features.Erase_Block_Enable = 0;
MCI_Device_Features.Sector_Size = 0;
MCI_Device_Features.Memory_Capacity = 0;
MCI_Device_Desc.state = AT91C_MCI_IDLE;
MCI_Device_Desc.SDCard_bus_width = AT91C_MCI_SCDBUS;
// Init AT91S_DataFlash Global Structure, by default AT45DB choosen !!!
MCI_Device.pMCI_DeviceDesc = &MCI_Device_Desc;
MCI_Device.pMCI_DeviceFeatures = &MCI_Device_Features;
@ -645,9 +645,9 @@ int AT91F_MCI_Init(void)
// Set up PIO SDC_TYPE to switch on MMC/SDCard and not DataFlash Card
AT91F_PIO_CfgOutput(AT91C_BASE_PIOB,AT91C_PIO_PB7);
AT91F_PIO_SetOutput(AT91C_BASE_PIOB,AT91C_PIO_PB7);
// Init MCI for MMC and SDCard interface
AT91F_MCI_CfgPIO();
AT91F_MCI_CfgPIO();
AT91F_MCI_CfgPMC();
AT91F_PDC_Open(AT91C_BASE_PDC_MCI);
@ -657,7 +657,7 @@ int AT91F_MCI_Init(void)
// Init MCI Device Structures
AT91F_CfgDevice();
// Configure MCI interrupt
// Configure MCI interrupt
AT91F_AIC_ConfigureIt(AT91C_BASE_AIC,
AT91C_ID_MCI,
AT91C_AIC_PRIOR_HIGHEST,
@ -674,7 +674,7 @@ int AT91F_MCI_Init(void)
AT91C_MCI_DTOR_1MEGA_CYCLES,
AT91C_MCI_MR_PDCMODE, // 15MHz for MCK = 60MHz (CLKDIV = 1)
AT91C_MCI_SDCARD_4BITS_SLOTA);
if(AT91F_MCI_SDCard_Init(&MCI_Device) != AT91C_INIT_OK)
return FALSE;
else
@ -689,13 +689,13 @@ int AT91F_MCI_Init(void)
void AT91F_MCIDeviceWaitReady(unsigned int timeout)
{
volatile int status;
do
{
status = AT91C_BASE_MCI->MCI_SR;
timeout--;
}
while( !(status & AT91C_MCI_NOTBUSY) && (timeout>0) );
while( !(status & AT91C_MCI_NOTBUSY) && (timeout>0) );
}
unsigned int swab32(unsigned int data)
@ -725,7 +725,7 @@ int AT91F_MCI_ReadBlockSwab(
//* Read Block 1
for(i=0;i<BUFFER_SIZE_MCI_DEVICE;i++)
*buf++ = 0x00;
*buf++ = 0x00;
AT91F_MCI_ReadBlock(&MCI_Device,src,databuffer,sizeToRead);
//* Wait end of Read

View File

@ -34,13 +34,13 @@
gpios = <&gpio 12 GPIO_ACTIVE_LOW>;
default-state = "on";
};
internet {
function = LED_FUNCTION_WAN_ONLINE;
color = <LED_COLOR_ID_BLUE>;
gpios = <&gpio 11 GPIO_ACTIVE_LOW>;
};
wan {
function = LED_FUNCTION_WAN;
color = <LED_COLOR_ID_BLUE>;
@ -53,7 +53,7 @@
color = <LED_COLOR_ID_BLUE>;
gpios = <&gpio 19 GPIO_ACTIVE_LOW>;
};
lan2 {
function = LED_FUNCTION_LAN;
function-enumerator = <2>;
@ -108,7 +108,7 @@
reg = <0xff0000 0x010000>;
read-only;
nvmem-layout {
compatible = "fixed-layout";
#address-cells = <1>;
@ -141,7 +141,7 @@
};
&gpio {
};
&builtin_switch {

View File

@ -17,7 +17,7 @@
gpio-export,output = <1>;
gpios = <&gpio 20 GPIO_ACTIVE_HIGH>;
};
buzzer {
gpio-export,name = "buzzer";
gpio-export,output = <1>;

View File

@ -59,7 +59,7 @@
gpios = <&gpio 22 GPIO_ACTIVE_LOW>;
};
};
watchdog {
compatible = "linux,wdt-gpio";

View File

@ -159,7 +159,7 @@
reg = <1>;
spi-max-frequency = <25000000>;
status = "disabled";
nand_partitions: partitions {
compatible = "fixed-partitions";
#address-cells = <1>;

View File

@ -89,7 +89,7 @@
gpios = <&gpio 12 GPIO_ACTIVE_LOW>;
};
};
virtual_flash {
compatible = "mtd-concat";
@ -197,7 +197,7 @@
&wmac {
status = "okay";
nvmem-cells = <&calibration_wmac>, <&macaddr_uboot_3ff80 1>;
nvmem-cell-names = "calibration", "mac-address";
};

View File

@ -41,7 +41,7 @@
color = <LED_COLOR_ID_GREEN>;
gpios = <&gpio 4 GPIO_ACTIVE_LOW>;
};
led_power_red: power-red {
function = LED_FUNCTION_POWER;
color = <LED_COLOR_ID_RED>;
@ -113,7 +113,7 @@
*
* We can not support this with OpenWrt, as this
* would require us to influence the pinmux based on the CS.
*
*
* We force-select Bank 1. Remember to blame Aruba for that.
*/
cs0_pin5: spi-cs0-pin5 {

View File

@ -55,7 +55,7 @@
watchdog {
compatible = "linux,wdt-gpio";
gpios = <&gpio 17 GPIO_ACTIVE_LOW>;
hw_algo = "toggle";
hw_margin_ms = <1200>;

View File

@ -171,7 +171,7 @@
&eth0 {
status = "okay";
pll-data = <0x03000101 0x00000101 0x00001919>;
phy-mode = "sgmii";

View File

@ -1,21 +1,21 @@
/*
LzmaDecode.c
LZMA Decoder (optimized for Speed version)
LZMA SDK 4.40 Copyright (c) 1999-2006 Igor Pavlov (2006-05-01)
http://www.7-zip.org/
LZMA SDK is licensed under two licenses:
1) GNU Lesser General Public License (GNU LGPL)
2) Common Public License (CPL)
It means that you can select one of these two licenses and
It means that you can select one of these two licenses and
follow rules of that license.
SPECIAL EXCEPTION:
Igor Pavlov, as the author of this Code, expressly permits you to
statically or dynamically link your Code (or bind by name) to the
interfaces of this file without subjecting your linked Code to the
terms of the CPL or GNU LGPL. Any modifications or additions
Igor Pavlov, as the author of this Code, expressly permits you to
statically or dynamically link your Code (or bind by name) to the
interfaces of this file without subjecting your linked Code to the
terms of the CPL or GNU LGPL. Any modifications or additions
to this file, however, are subject to the LGPL or CPL terms.
*/
@ -46,7 +46,7 @@
#define RC_TEST { if (Buffer == BufferLim) return LZMA_RESULT_DATA_ERROR; }
#define RC_INIT(buffer, bufferSize) Buffer = buffer; BufferLim = buffer + bufferSize; RC_INIT2
#endif
#define RC_NORMALIZE if (Range < kTopValue) { RC_TEST; Range <<= 8; Code = (Code << 8) | RC_READ_BYTE; }
@ -57,9 +57,9 @@
#define RC_GET_BIT2(p, mi, A0, A1) IfBit0(p) \
{ UpdateBit0(p); mi <<= 1; A0; } else \
{ UpdateBit1(p); mi = (mi + mi) + 1; A1; }
#define RC_GET_BIT(p, mi) RC_GET_BIT2(p, mi, ; , ;)
{ UpdateBit1(p); mi = (mi + mi) + 1; A1; }
#define RC_GET_BIT(p, mi) RC_GET_BIT2(p, mi, ; , ;)
#define RangeDecoderBitTreeDecode(probs, numLevels, res) \
{ int i = numLevels; res = 1; \
@ -82,7 +82,7 @@
#define LenLow (LenChoice2 + 1)
#define LenMid (LenLow + (kNumPosStatesMax << kLenNumLowBits))
#define LenHigh (LenMid + (kNumPosStatesMax << kLenNumMidBits))
#define kNumLenProbs (LenHigh + kLenNumHighSymbols)
#define kNumLenProbs (LenHigh + kLenNumHighSymbols)
#define kNumStates 12
@ -168,7 +168,7 @@ int LzmaDecode(CLzmaDecoderState *vs,
int lc = vs->Properties.lc;
#ifdef _LZMA_OUT_READ
UInt32 Range = vs->Range;
UInt32 Code = vs->Code;
#ifdef _LZMA_IN_CB
@ -210,7 +210,7 @@ int LzmaDecode(CLzmaDecoderState *vs,
UInt32 numProbs = Literal + ((UInt32)LZMA_LIT_SIZE << (lc + vs->Properties.lp));
UInt32 i;
for (i = 0; i < numProbs; i++)
p[i] = kBitModelTotal >> 1;
p[i] = kBitModelTotal >> 1;
rep0 = rep1 = rep2 = rep3 = 1;
state = 0;
globalPos = 0;
@ -261,7 +261,7 @@ int LzmaDecode(CLzmaDecoderState *vs,
for (i = 0; i < numProbs; i++)
p[i] = kBitModelTotal >> 1;
}
#ifdef _LZMA_IN_CB
RC_INIT;
#else
@ -275,7 +275,7 @@ int LzmaDecode(CLzmaDecoderState *vs,
CProb *prob;
UInt32 bound;
int posState = (int)(
(nowPos
(nowPos
#ifdef _LZMA_OUT_READ
+ globalPos
#endif
@ -287,9 +287,9 @@ int LzmaDecode(CLzmaDecoderState *vs,
{
int symbol = 1;
UpdateBit0(prob)
prob = p + Literal + (LZMA_LIT_SIZE *
prob = p + Literal + (LZMA_LIT_SIZE *
(((
(nowPos
(nowPos
#ifdef _LZMA_OUT_READ
+ globalPos
#endif
@ -338,7 +338,7 @@ int LzmaDecode(CLzmaDecoderState *vs,
else if (state < 10) state -= 3;
else state -= 6;
}
else
else
{
UpdateBit1(prob);
prob = p + IsRep + state;
@ -365,14 +365,14 @@ int LzmaDecode(CLzmaDecoderState *vs,
UInt32 pos;
#endif
UpdateBit0(prob);
#ifdef _LZMA_OUT_READ
if (distanceLimit == 0)
#else
if (nowPos == 0)
#endif
return LZMA_RESULT_DATA_ERROR;
state = state < kNumLitStates ? 9 : 11;
#ifdef _LZMA_OUT_READ
pos = dictionaryPos - rep0;
@ -408,7 +408,7 @@ int LzmaDecode(CLzmaDecoderState *vs,
UpdateBit0(prob);
distance = rep1;
}
else
else
{
UpdateBit1(prob);
prob = p + IsRepG2 + state;
@ -469,7 +469,7 @@ int LzmaDecode(CLzmaDecoderState *vs,
int posSlot;
state += kNumLitStates;
prob = p + PosSlot +
((len < kNumLenToPosStates ? len : kNumLenToPosStates - 1) <<
((len < kNumLenToPosStates ? len : kNumLenToPosStates - 1) <<
kNumPosSlotBits);
RangeDecoderBitTreeDecode(prob, kNumPosSlotBits, posSlot);
if (posSlot >= kStartPosModelIndex)
@ -524,7 +524,7 @@ int LzmaDecode(CLzmaDecoderState *vs,
len += kMatchMinLen;
#ifdef _LZMA_OUT_READ
if (rep0 > distanceLimit)
if (rep0 > distanceLimit)
#else
if (rep0 > nowPos)
#endif

View File

@ -1,4 +1,4 @@
/*
/*
LzmaDecode.h
LZMA Decoder interface
@ -8,14 +8,14 @@
LZMA SDK is licensed under two licenses:
1) GNU Lesser General Public License (GNU LGPL)
2) Common Public License (CPL)
It means that you can select one of these two licenses and
It means that you can select one of these two licenses and
follow rules of that license.
SPECIAL EXCEPTION:
Igor Pavlov, as the author of this code, expressly permits you to
statically or dynamically link your code (or bind by name) to the
interfaces of this file without subjecting your linked code to the
terms of the CPL or GNU LGPL. Any modifications or additions
Igor Pavlov, as the author of this code, expressly permits you to
statically or dynamically link your code (or bind by name) to the
interfaces of this file without subjecting your linked code to the
terms of the CPL or GNU LGPL. Any modifications or additions
to this file, however, are subject to the LGPL or CPL terms.
*/
@ -31,7 +31,7 @@
/* Use read function for output data */
/* #define _LZMA_PROB32 */
/* It can increase speed on some 32-bit CPUs,
/* It can increase speed on some 32-bit CPUs,
but memory usage will be doubled in that case */
/* #define _LZMA_LOC_OPT */

View File

@ -1,5 +1,5 @@
/*
LzmaTypes.h
/*
LzmaTypes.h
Types for LZMA Decoder
@ -13,12 +13,12 @@ This file is part of LZMA SDK 4.40 (2006-05-01)
#ifndef _7ZIP_BYTE_DEFINED
#define _7ZIP_BYTE_DEFINED
typedef unsigned char Byte;
#endif
#endif
#ifndef _7ZIP_UINT16_DEFINED
#define _7ZIP_UINT16_DEFINED
typedef unsigned short UInt16;
#endif
#endif
#ifndef _7ZIP_UINT32_DEFINED
#define _7ZIP_UINT32_DEFINED
@ -27,7 +27,7 @@ typedef unsigned long UInt32;
#else
typedef unsigned int UInt32;
#endif
#endif
#endif
/* #define _LZMA_NO_SYSTEM_SIZE_T */
/* You can use it, if you don't want <stddef.h> */

View File

@ -1,21 +1,21 @@
/*
LzmaDecode.c
LZMA Decoder
LZMA SDK 4.05 Copyright (c) 1999-2004 Igor Pavlov (2004-08-25)
http://www.7-zip.org/
LZMA SDK is licensed under two licenses:
1) GNU Lesser General Public License (GNU LGPL)
2) Common Public License (CPL)
It means that you can select one of these two licenses and
It means that you can select one of these two licenses and
follow rules of that license.
SPECIAL EXCEPTION:
Igor Pavlov, as the author of this code, expressly permits you to
statically or dynamically link your code (or bind by name) to the
interfaces of this file without subjecting your linked code to the
terms of the CPL or GNU LGPL. Any modifications or additions
Igor Pavlov, as the author of this code, expressly permits you to
statically or dynamically link your code (or bind by name) to the
interfaces of this file without subjecting your linked code to the
terms of the CPL or GNU LGPL. Any modifications or additions
to this file, however, are subject to the LGPL or CPL terms.
*/
@ -89,7 +89,7 @@ void RangeDecoderInit(CRangeDecoder *rd,
rd->Code = (rd->Code << 8) | ReadByte;
}
#define RC_INIT_VAR UInt32 range = rd->Range; UInt32 code = rd->Code;
#define RC_INIT_VAR UInt32 range = rd->Range; UInt32 code = rd->Code;
#define RC_FLUSH_VAR rd->Range = range; rd->Code = code;
#define RC_NORMALIZE if (range < kTopValue) { range <<= 8; code = (code << 8) | ReadByte; }
@ -157,7 +157,7 @@ int RangeDecoderBitDecode(CProb *prob, CRangeDecoder *rd)
{ A1; range -= bound; code -= bound; *prob -= (*prob) >> kNumMoveBits; mi = (mi + mi) + 1; } \
RC_NORMALIZE
#define RC_GET_BIT(prob, mi) RC_GET_BIT2(prob, mi, ; , ;)
#define RC_GET_BIT(prob, mi) RC_GET_BIT2(prob, mi, ; , ;)
int RangeDecoderBitTreeDecode(CProb *probs, int numLevels, CRangeDecoder *rd)
{
@ -207,7 +207,7 @@ int RangeDecoderReverseBitTreeDecode(CProb *probs, int numLevels, CRangeDecoder
}
Byte LzmaLiteralDecode(CProb *probs, CRangeDecoder *rd)
{
{
int symbol = 1;
#ifdef _LZMA_LOC_OPT
RC_INIT_VAR
@ -229,7 +229,7 @@ Byte LzmaLiteralDecode(CProb *probs, CRangeDecoder *rd)
}
Byte LzmaLiteralDecodeMatch(CProb *probs, CRangeDecoder *rd, Byte matchByte)
{
{
int symbol = 1;
#ifdef _LZMA_LOC_OPT
RC_INIT_VAR
@ -284,7 +284,7 @@ Byte LzmaLiteralDecodeMatch(CProb *probs, CRangeDecoder *rd, Byte matchByte)
#define LenLow (LenChoice2 + 1)
#define LenMid (LenLow + (kNumPosStatesMax << kLenNumLowBits))
#define LenHigh (LenMid + (kNumPosStatesMax << kLenNumMidBits))
#define kNumLenProbs (LenHigh + kLenNumHighSymbols)
#define kNumLenProbs (LenHigh + kLenNumHighSymbols)
int LzmaLenDecode(CProb *p, CRangeDecoder *rd, int posState)
{
@ -294,7 +294,7 @@ int LzmaLenDecode(CProb *p, CRangeDecoder *rd, int posState)
if(RangeDecoderBitDecode(p + LenChoice2, rd) == 0)
return kLenNumLowSymbols + RangeDecoderBitTreeDecode(p + LenMid +
(posState << kLenNumMidBits), kLenNumMidBits, rd);
return kLenNumLowSymbols + kLenNumMidSymbols +
return kLenNumLowSymbols + kLenNumMidSymbols +
RangeDecoderBitTreeDecode(p + LenHigh, kLenNumHighBits, rd);
}
@ -377,8 +377,8 @@ int LzmaDecoderInit(
vs->RemainLen = 0;
dictionary[dictionarySize - 1] = 0;
for (i = 0; i < numProbs; i++)
p[i] = kBitModelTotal >> 1;
RangeDecoderInit(&vs->RangeDecoder,
p[i] = kBitModelTotal >> 1;
RangeDecoderInit(&vs->RangeDecoder,
#ifdef _LZMA_IN_CB
inCallback
#else
@ -388,7 +388,7 @@ int LzmaDecoderInit(
return LZMA_RESULT_OK;
}
int LzmaDecode(unsigned char *buffer,
int LzmaDecode(unsigned char *buffer,
unsigned char *outStream, UInt32 outSize,
UInt32 *outSizeProcessed)
{
@ -458,8 +458,8 @@ int LzmaDecode(
if (bufferSize < numProbs * sizeof(CProb))
return LZMA_RESULT_NOT_ENOUGH_MEM;
for (i = 0; i < numProbs; i++)
p[i] = kBitModelTotal >> 1;
RangeDecoderInit(&rd,
p[i] = kBitModelTotal >> 1;
RangeDecoderInit(&rd,
#ifdef _LZMA_IN_CB
inCallback
#else
@ -472,7 +472,7 @@ int LzmaDecode(
while(nowPos < outSize)
{
int posState = (int)(
(nowPos
(nowPos
#ifdef _LZMA_OUT_READ
+ globalPos
#endif
@ -486,9 +486,9 @@ int LzmaDecode(
return LZMA_RESULT_DATA_ERROR;
if (RangeDecoderBitDecode(p + IsMatch + (state << kNumPosBitsMax) + posState, &rd) == 0)
{
CProb *probs = p + Literal + (LZMA_LIT_SIZE *
CProb *probs = p + Literal + (LZMA_LIT_SIZE *
(((
(nowPos
(nowPos
#ifdef _LZMA_OUT_READ
+ globalPos
#endif
@ -521,7 +521,7 @@ int LzmaDecode(
dictionaryPos = 0;
#endif
}
else
else
{
previousIsMatch = 1;
if (RangeDecoderBitDecode(p + IsRep + state, &rd) == 1)
@ -534,7 +534,7 @@ int LzmaDecode(
UInt32 pos;
#endif
if (
(nowPos
(nowPos
#ifdef _LZMA_OUT_READ
+ globalPos
#endif
@ -562,7 +562,7 @@ int LzmaDecode(
UInt32 distance;
if(RangeDecoderBitDecode(p + IsRepG1 + state, &rd) == 0)
distance = rep1;
else
else
{
if(RangeDecoderBitDecode(p + IsRepG2 + state, &rd) == 0)
distance = rep2;
@ -588,7 +588,7 @@ int LzmaDecode(
state = state < 7 ? 7 : 10;
len = LzmaLenDecode(p + LenCoder, &rd, posState);
posSlot = RangeDecoderBitTreeDecode(p + PosSlot +
((len < kNumLenToPosStates ? len : kNumLenToPosStates - 1) <<
((len < kNumLenToPosStates ? len : kNumLenToPosStates - 1) <<
kNumPosSlotBits), kNumPosSlotBits, &rd);
if (posSlot >= kStartPosModelIndex)
{
@ -601,7 +601,7 @@ int LzmaDecode(
}
else
{
rep0 += RangeDecoderDecodeDirectBits(&rd,
rep0 += RangeDecoderDecodeDirectBits(&rd,
numDirectBits - kNumAlignBits) << kNumAlignBits;
rep0 += RangeDecoderReverseBitTreeDecode(p + Align, kNumAlignBits, &rd);
}
@ -616,7 +616,7 @@ int LzmaDecode(
len = -1;
break;
}
if (rep0 > nowPos
if (rep0 > nowPos
#ifdef _LZMA_OUT_READ
+ globalPos
#endif

View File

@ -1,4 +1,4 @@
/*
/*
LzmaDecode.h
LZMA Decoder interface
@ -8,14 +8,14 @@
LZMA SDK is licensed under two licenses:
1) GNU Lesser General Public License (GNU LGPL)
2) Common Public License (CPL)
It means that you can select one of these two licenses and
It means that you can select one of these two licenses and
follow rules of that license.
SPECIAL EXCEPTION:
Igor Pavlov, as the author of this code, expressly permits you to
statically or dynamically link your code (or bind by name) to the
interfaces of this file without subjecting your linked code to the
terms of the CPL or GNU LGPL. Any modifications or additions
Igor Pavlov, as the author of this code, expressly permits you to
statically or dynamically link your code (or bind by name) to the
interfaces of this file without subjecting your linked code to the
terms of the CPL or GNU LGPL. Any modifications or additions
to this file, however, are subject to the LGPL or CPL terms.
*/
@ -29,7 +29,7 @@
/* Use read function for output data */
/* #define _LZMA_PROB32 */
/* It can increase speed on some 32-bit CPUs,
/* It can increase speed on some 32-bit CPUs,
but memory usage will be doubled in that case */
/* #define _LZMA_LOC_OPT */
@ -63,10 +63,10 @@ typedef struct _ILzmaInCallback
#define LZMA_BASE_SIZE 1846
#define LZMA_LIT_SIZE 768
/*
/*
bufferSize = (LZMA_BASE_SIZE + (LZMA_LIT_SIZE << (lc + lp)))* sizeof(CProb)
bufferSize += 100 in case of _LZMA_OUT_READ
by default CProb is unsigned short,
by default CProb is unsigned short,
but if specify _LZMA_PROB_32, CProb will be UInt32(unsigned int)
*/
@ -84,7 +84,7 @@ int LzmaDecoderInit(
#endif
int LzmaDecode(
unsigned char *buffer,
unsigned char *buffer,
#ifndef _LZMA_OUT_READ
UInt32 bufferSize,
int lc, int lp, int pb,

View File

@ -106,10 +106,10 @@ static int read_byte(void *object, unsigned char **buffer, UInt32 *bufferSize)
val = *(unsigned int *)data;
data += 4;
}
*bufferSize = 1;
*buffer = ((unsigned char *)&val) + (offset++ & 3);
return LZMA_RESULT_OK;
}
@ -117,12 +117,12 @@ static __inline__ unsigned char get_byte(void)
{
unsigned char *buffer;
UInt32 fake;
return read_byte(0, &buffer, &fake), *buffer;
}
/* should be the first function */
void entry(unsigned long icache_size, unsigned long icache_lsize,
void entry(unsigned long icache_size, unsigned long icache_lsize,
unsigned long dcache_size, unsigned long dcache_lsize,
unsigned long fw_arg0, unsigned long fw_arg1,
unsigned long fw_arg2, unsigned long fw_arg3)
@ -145,7 +145,7 @@ void entry(unsigned long icache_size, unsigned long icache_lsize,
if (((struct trx_header *)data)->magic == EDIMAX_PS_HEADER_MAGIC)
data += EDIMAX_PS_HEADER_LEN;
/* compressed kernel is in the partition 0 or 1 */
if (((struct trx_header *)data)->offsets[1] > 65536)
if (((struct trx_header *)data)->offsets[1] > 65536)
data += ((struct trx_header *)data)->offsets[0];
else
data += ((struct trx_header *)data)->offsets[1];
@ -168,7 +168,7 @@ void entry(unsigned long icache_size, unsigned long icache_lsize,
((unsigned int)get_byte() << 24);
/* skip rest of the header (upper half of uncompressed size) */
for (i = 0; i < 4; i++)
for (i = 0; i < 4; i++)
get_byte();
/* decompress kernel */

View File

@ -16,7 +16,7 @@
keys {
compatible = "gpio-keys-polled";
poll-interval = <100>;
reset {
label = "reset";
gpios = <&gpio 32 GPIO_ACTIVE_LOW>;
@ -180,7 +180,7 @@
&pinctrl {
pinctrl_leds: leds {
function = "led";
pins = "gpio1", "gpio8",
pins = "gpio1", "gpio8",
"gpio9", "gpio10",
"gpio11", "gpio12",
"gpio14", "gpio15",

View File

@ -12,11 +12,11 @@
led-running = &led_power_green;
led-upgrade = &led_power_green;
};
keys {
compatible = "gpio-keys-polled";
poll-interval = <100>;
wlan {
label = "wlan";
gpios = <&gpio 9 GPIO_ACTIVE_LOW>;
@ -38,7 +38,7 @@
debounce-interval = <60>;
};
};
bcm43217-sprom {
compatible = "brcm,bcma-sprom";
@ -182,7 +182,7 @@
function = LED_FUNCTION_USB;
color = <LED_COLOR_ID_GREEN>;
};
led@16 {
reg = <16>;
active-low;

View File

@ -63,7 +63,7 @@
&leds {
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_leds>;
@ -213,7 +213,7 @@
nvmem-cells = <&macaddr_cfe_6a0 1>, <&cal_data_1000>;
nvmem-cell-names = "mac-address", "calibration";
#gpio-cells = <2>;
gpio-controller;
};

View File

@ -1610,7 +1610,7 @@ static int bcm6348_emac_probe(struct platform_device *pdev)
GFP_KERNEL);
if (IS_ERR_OR_NULL(emac->reset))
return PTR_ERR(emac->reset);
}
for (i = 0; i < emac->num_resets; i++) {
emac->reset[i] = devm_reset_control_get_by_index(dev, i);

View File

@ -1,21 +1,21 @@
/*
LzmaDecode.c
LZMA Decoder (optimized for Speed version)
LZMA SDK 4.40 Copyright (c) 1999-2006 Igor Pavlov (2006-05-01)
http://www.7-zip.org/
LZMA SDK is licensed under two licenses:
1) GNU Lesser General Public License (GNU LGPL)
2) Common Public License (CPL)
It means that you can select one of these two licenses and
It means that you can select one of these two licenses and
follow rules of that license.
SPECIAL EXCEPTION:
Igor Pavlov, as the author of this Code, expressly permits you to
statically or dynamically link your Code (or bind by name) to the
interfaces of this file without subjecting your linked Code to the
terms of the CPL or GNU LGPL. Any modifications or additions
Igor Pavlov, as the author of this Code, expressly permits you to
statically or dynamically link your Code (or bind by name) to the
interfaces of this file without subjecting your linked Code to the
terms of the CPL or GNU LGPL. Any modifications or additions
to this file, however, are subject to the LGPL or CPL terms.
*/
@ -46,7 +46,7 @@
#define RC_TEST { if (Buffer == BufferLim) return LZMA_RESULT_DATA_ERROR; }
#define RC_INIT(buffer, bufferSize) Buffer = buffer; BufferLim = buffer + bufferSize; RC_INIT2
#endif
#define RC_NORMALIZE if (Range < kTopValue) { RC_TEST; Range <<= 8; Code = (Code << 8) | RC_READ_BYTE; }
@ -57,9 +57,9 @@
#define RC_GET_BIT2(p, mi, A0, A1) IfBit0(p) \
{ UpdateBit0(p); mi <<= 1; A0; } else \
{ UpdateBit1(p); mi = (mi + mi) + 1; A1; }
#define RC_GET_BIT(p, mi) RC_GET_BIT2(p, mi, ; , ;)
{ UpdateBit1(p); mi = (mi + mi) + 1; A1; }
#define RC_GET_BIT(p, mi) RC_GET_BIT2(p, mi, ; , ;)
#define RangeDecoderBitTreeDecode(probs, numLevels, res) \
{ int i = numLevels; res = 1; \
@ -82,7 +82,7 @@
#define LenLow (LenChoice2 + 1)
#define LenMid (LenLow + (kNumPosStatesMax << kLenNumLowBits))
#define LenHigh (LenMid + (kNumPosStatesMax << kLenNumMidBits))
#define kNumLenProbs (LenHigh + kLenNumHighSymbols)
#define kNumLenProbs (LenHigh + kLenNumHighSymbols)
#define kNumStates 12
@ -168,7 +168,7 @@ int LzmaDecode(CLzmaDecoderState *vs,
int lc = vs->Properties.lc;
#ifdef _LZMA_OUT_READ
UInt32 Range = vs->Range;
UInt32 Code = vs->Code;
#ifdef _LZMA_IN_CB
@ -210,7 +210,7 @@ int LzmaDecode(CLzmaDecoderState *vs,
UInt32 numProbs = Literal + ((UInt32)LZMA_LIT_SIZE << (lc + vs->Properties.lp));
UInt32 i;
for (i = 0; i < numProbs; i++)
p[i] = kBitModelTotal >> 1;
p[i] = kBitModelTotal >> 1;
rep0 = rep1 = rep2 = rep3 = 1;
state = 0;
globalPos = 0;
@ -261,7 +261,7 @@ int LzmaDecode(CLzmaDecoderState *vs,
for (i = 0; i < numProbs; i++)
p[i] = kBitModelTotal >> 1;
}
#ifdef _LZMA_IN_CB
RC_INIT;
#else
@ -275,7 +275,7 @@ int LzmaDecode(CLzmaDecoderState *vs,
CProb *prob;
UInt32 bound;
int posState = (int)(
(nowPos
(nowPos
#ifdef _LZMA_OUT_READ
+ globalPos
#endif
@ -287,9 +287,9 @@ int LzmaDecode(CLzmaDecoderState *vs,
{
int symbol = 1;
UpdateBit0(prob)
prob = p + Literal + (LZMA_LIT_SIZE *
prob = p + Literal + (LZMA_LIT_SIZE *
(((
(nowPos
(nowPos
#ifdef _LZMA_OUT_READ
+ globalPos
#endif
@ -338,7 +338,7 @@ int LzmaDecode(CLzmaDecoderState *vs,
else if (state < 10) state -= 3;
else state -= 6;
}
else
else
{
UpdateBit1(prob);
prob = p + IsRep + state;
@ -365,14 +365,14 @@ int LzmaDecode(CLzmaDecoderState *vs,
UInt32 pos;
#endif
UpdateBit0(prob);
#ifdef _LZMA_OUT_READ
if (distanceLimit == 0)
#else
if (nowPos == 0)
#endif
return LZMA_RESULT_DATA_ERROR;
state = state < kNumLitStates ? 9 : 11;
#ifdef _LZMA_OUT_READ
pos = dictionaryPos - rep0;
@ -408,7 +408,7 @@ int LzmaDecode(CLzmaDecoderState *vs,
UpdateBit0(prob);
distance = rep1;
}
else
else
{
UpdateBit1(prob);
prob = p + IsRepG2 + state;
@ -469,7 +469,7 @@ int LzmaDecode(CLzmaDecoderState *vs,
int posSlot;
state += kNumLitStates;
prob = p + PosSlot +
((len < kNumLenToPosStates ? len : kNumLenToPosStates - 1) <<
((len < kNumLenToPosStates ? len : kNumLenToPosStates - 1) <<
kNumPosSlotBits);
RangeDecoderBitTreeDecode(prob, kNumPosSlotBits, posSlot);
if (posSlot >= kStartPosModelIndex)
@ -524,7 +524,7 @@ int LzmaDecode(CLzmaDecoderState *vs,
len += kMatchMinLen;
#ifdef _LZMA_OUT_READ
if (rep0 > distanceLimit)
if (rep0 > distanceLimit)
#else
if (rep0 > nowPos)
#endif

View File

@ -1,4 +1,4 @@
/*
/*
LzmaDecode.h
LZMA Decoder interface
@ -8,14 +8,14 @@
LZMA SDK is licensed under two licenses:
1) GNU Lesser General Public License (GNU LGPL)
2) Common Public License (CPL)
It means that you can select one of these two licenses and
It means that you can select one of these two licenses and
follow rules of that license.
SPECIAL EXCEPTION:
Igor Pavlov, as the author of this code, expressly permits you to
statically or dynamically link your code (or bind by name) to the
interfaces of this file without subjecting your linked code to the
terms of the CPL or GNU LGPL. Any modifications or additions
Igor Pavlov, as the author of this code, expressly permits you to
statically or dynamically link your code (or bind by name) to the
interfaces of this file without subjecting your linked code to the
terms of the CPL or GNU LGPL. Any modifications or additions
to this file, however, are subject to the LGPL or CPL terms.
*/
@ -31,7 +31,7 @@
/* Use read function for output data */
/* #define _LZMA_PROB32 */
/* It can increase speed on some 32-bit CPUs,
/* It can increase speed on some 32-bit CPUs,
but memory usage will be doubled in that case */
/* #define _LZMA_LOC_OPT */

View File

@ -1,5 +1,5 @@
/*
LzmaTypes.h
/*
LzmaTypes.h
Types for LZMA Decoder
@ -13,12 +13,12 @@ This file is part of LZMA SDK 4.40 (2006-05-01)
#ifndef _7ZIP_BYTE_DEFINED
#define _7ZIP_BYTE_DEFINED
typedef unsigned char Byte;
#endif
#endif
#ifndef _7ZIP_UINT16_DEFINED
#define _7ZIP_UINT16_DEFINED
typedef unsigned short UInt16;
#endif
#endif
#ifndef _7ZIP_UINT32_DEFINED
#define _7ZIP_UINT32_DEFINED
@ -27,7 +27,7 @@ typedef unsigned long UInt32;
#else
typedef unsigned int UInt32;
#endif
#endif
#endif
/* #define _LZMA_NO_SYSTEM_SIZE_T */
/* You can use it, if you don't want <stddef.h> */

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2018 Paweł Dembicki <paweldembicki@gmail.com>
* Copyright (C) 2018 Paweł Dembicki <paweldembicki@gmail.com>
*
* Based on: mtdsplit_uimage.c
* Copyright (C) 2013 Gabor Juhos <juhosg@openwrt.org>

View File

@ -84,7 +84,7 @@ struct adm6996_priv {
u16 vlan_id[ADM_NUM_VLANS];
u8 vlan_table[ADM_NUM_VLANS]; /* bitmap, 1 = port is member */
u8 vlan_tagged[ADM_NUM_VLANS]; /* bitmap, 1 = tagged member */
struct mutex mib_lock;
char buf[2048];
@ -805,12 +805,12 @@ adm6996_get_port_link(struct switch_dev *dev, int port,
struct switch_port_link *link)
{
struct adm6996_priv *priv = to_adm(dev);
u16 reg = 0;
if (port >= ADM_NUM_PORTS)
return -EINVAL;
switch (port) {
case 0:
reg = r16(priv, ADM_PS0);
@ -838,7 +838,7 @@ adm6996_get_port_link(struct switch_dev *dev, int port,
default:
return -EINVAL;
}
link->link = reg & ADM_PS_LS;
if (!link->link)
return 0;
@ -1003,9 +1003,9 @@ static int adm6996_switch_init(struct adm6996_priv *priv, const char *alias, str
w16(priv, ADM_VID_CHECK, test);
test ^= r16(priv, ADM_VID_CHECK);
if (test & (1 << 12)) {
/*
* Bit 12 of this register is read-only.
* This is the FC model.
/*
* Bit 12 of this register is read-only.
* This is the FC model.
*/
priv->model = ADM6996FC;
} else {

View File

@ -7,7 +7,7 @@
* under the terms of the GNU General Public License v2 as published by the
* Free Software Foundation.
*
* The switch programming done in this driver follows the
* The switch programming done in this driver follows the
* "Ethernet Traffic Separation using VLAN" Application Note as
* published by Lantiq.
*/

View File

@ -587,7 +587,7 @@ rtl_attr_get_port_int(struct switch_dev *dev, const struct switch_attr *attr, st
return rtl_attr_get_int(dev, attr, val);
}
static int
static int
rtl_get_port_link(struct switch_dev *dev, int port, struct switch_port_link *link)
{
if (port >= RTL8306_NUM_PORTS)

View File

@ -1,21 +1,21 @@
/*
LzmaDecode.c
LZMA Decoder (optimized for Speed version)
LZMA SDK 4.22 Copyright (c) 1999-2005 Igor Pavlov (2005-06-10)
http://www.7-zip.org/
LZMA SDK is licensed under two licenses:
1) GNU Lesser General Public License (GNU LGPL)
2) Common Public License (CPL)
It means that you can select one of these two licenses and
It means that you can select one of these two licenses and
follow rules of that license.
SPECIAL EXCEPTION:
Igor Pavlov, as the author of this Code, expressly permits you to
statically or dynamically link your Code (or bind by name) to the
interfaces of this file without subjecting your linked Code to the
terms of the CPL or GNU LGPL. Any modifications or additions
Igor Pavlov, as the author of this Code, expressly permits you to
statically or dynamically link your Code (or bind by name) to the
interfaces of this file without subjecting your linked Code to the
terms of the CPL or GNU LGPL. Any modifications or additions
to this file, however, are subject to the LGPL or CPL terms.
*/
@ -50,7 +50,7 @@
#define RC_TEST { if (Buffer == BufferLim) return LZMA_RESULT_DATA_ERROR; }
#define RC_INIT(buffer, bufferSize) Buffer = buffer; BufferLim = buffer + bufferSize; RC_INIT2
#endif
#define RC_NORMALIZE if (Range < kTopValue) { RC_TEST; Range <<= 8; Code = (Code << 8) | RC_READ_BYTE; }
@ -61,9 +61,9 @@
#define RC_GET_BIT2(p, mi, A0, A1) IfBit0(p) \
{ UpdateBit0(p); mi <<= 1; A0; } else \
{ UpdateBit1(p); mi = (mi + mi) + 1; A1; }
#define RC_GET_BIT(p, mi) RC_GET_BIT2(p, mi, ; , ;)
{ UpdateBit1(p); mi = (mi + mi) + 1; A1; }
#define RC_GET_BIT(p, mi) RC_GET_BIT2(p, mi, ; , ;)
#define RangeDecoderBitTreeDecode(probs, numLevels, res) \
{ int i = numLevels; res = 1; \
@ -86,7 +86,7 @@
#define LenLow (LenChoice2 + 1)
#define LenMid (LenLow + (kNumPosStatesMax << kLenNumLowBits))
#define LenHigh (LenMid + (kNumPosStatesMax << kLenNumMidBits))
#define kNumLenProbs (LenHigh + kLenNumHighSymbols)
#define kNumLenProbs (LenHigh + kLenNumHighSymbols)
#define kNumStates 12
@ -174,7 +174,7 @@ int LzmaDecode(CLzmaDecoderState *vs,
int lc = vs->Properties.lc;
#ifdef _LZMA_OUT_READ
UInt32 Range = vs->Range;
UInt32 Code = vs->Code;
#ifdef _LZMA_IN_CB
@ -216,7 +216,7 @@ int LzmaDecode(CLzmaDecoderState *vs,
UInt32 numProbs = Literal + ((UInt32)LZMA_LIT_SIZE << (lc + vs->Properties.lp));
UInt32 i;
for (i = 0; i < numProbs; i++)
p[i] = kBitModelTotal >> 1;
p[i] = kBitModelTotal >> 1;
rep0 = rep1 = rep2 = rep3 = 1;
state = 0;
globalPos = 0;
@ -267,7 +267,7 @@ int LzmaDecode(CLzmaDecoderState *vs,
for (i = 0; i < numProbs; i++)
p[i] = kBitModelTotal >> 1;
}
#ifdef _LZMA_IN_CB
RC_INIT;
#else
@ -281,7 +281,7 @@ int LzmaDecode(CLzmaDecoderState *vs,
CProb *prob;
UInt32 bound;
int posState = (int)(
(nowPos
(nowPos
#ifdef _LZMA_OUT_READ
+ globalPos
#endif
@ -293,9 +293,9 @@ int LzmaDecode(CLzmaDecoderState *vs,
{
int symbol = 1;
UpdateBit0(prob)
prob = p + Literal + (LZMA_LIT_SIZE *
prob = p + Literal + (LZMA_LIT_SIZE *
(((
(nowPos
(nowPos
#ifdef _LZMA_OUT_READ
+ globalPos
#endif
@ -344,7 +344,7 @@ int LzmaDecode(CLzmaDecoderState *vs,
else if (state < 10) state -= 3;
else state -= 6;
}
else
else
{
UpdateBit1(prob);
prob = p + IsRep + state;
@ -371,14 +371,14 @@ int LzmaDecode(CLzmaDecoderState *vs,
UInt32 pos;
#endif
UpdateBit0(prob);
#ifdef _LZMA_OUT_READ
if (distanceLimit == 0)
#else
if (nowPos == 0)
#endif
return LZMA_RESULT_DATA_ERROR;
state = state < kNumLitStates ? 9 : 11;
#ifdef _LZMA_OUT_READ
pos = dictionaryPos - rep0;
@ -414,7 +414,7 @@ int LzmaDecode(CLzmaDecoderState *vs,
UpdateBit0(prob);
distance = rep1;
}
else
else
{
UpdateBit1(prob);
prob = p + IsRepG2 + state;
@ -475,7 +475,7 @@ int LzmaDecode(CLzmaDecoderState *vs,
int posSlot;
state += kNumLitStates;
prob = p + PosSlot +
((len < kNumLenToPosStates ? len : kNumLenToPosStates - 1) <<
((len < kNumLenToPosStates ? len : kNumLenToPosStates - 1) <<
kNumPosSlotBits);
RangeDecoderBitTreeDecode(prob, kNumPosSlotBits, posSlot);
if (posSlot >= kStartPosModelIndex)
@ -530,7 +530,7 @@ int LzmaDecode(CLzmaDecoderState *vs,
len += kMatchMinLen;
#ifdef _LZMA_OUT_READ
if (rep0 > distanceLimit)
if (rep0 > distanceLimit)
#else
if (rep0 > nowPos)
#endif

View File

@ -1,4 +1,4 @@
/*
/*
LzmaDecode.h
LZMA Decoder interface
@ -8,14 +8,14 @@
LZMA SDK is licensed under two licenses:
1) GNU Lesser General Public License (GNU LGPL)
2) Common Public License (CPL)
It means that you can select one of these two licenses and
It means that you can select one of these two licenses and
follow rules of that license.
SPECIAL EXCEPTION:
Igor Pavlov, as the author of this code, expressly permits you to
statically or dynamically link your code (or bind by name) to the
interfaces of this file without subjecting your linked code to the
terms of the CPL or GNU LGPL. Any modifications or additions
Igor Pavlov, as the author of this code, expressly permits you to
statically or dynamically link your code (or bind by name) to the
interfaces of this file without subjecting your linked code to the
terms of the CPL or GNU LGPL. Any modifications or additions
to this file, however, are subject to the LGPL or CPL terms.
*/
@ -29,7 +29,7 @@
/* Use read function for output data */
/* #define _LZMA_PROB32 */
/* It can increase speed on some 32-bit CPUs,
/* It can increase speed on some 32-bit CPUs,
but memory usage will be doubled in that case */
/* #define _LZMA_LOC_OPT */

View File

@ -92,11 +92,11 @@ static __inline__ unsigned char get_byte(void)
{
unsigned char *buffer;
UInt32 fake;
return read_byte(0, &buffer, &fake), *buffer;
}
/* This puts lzma workspace 128k below RAM end.
/* This puts lzma workspace 128k below RAM end.
* That should be enough for both lzma and stack
*/
static char *buffer = (char *)(RAMSTART + RAMSIZE - 0x00020000);
@ -104,7 +104,7 @@ extern char lzma_start[];
extern char lzma_end[];
/* should be the first function */
void entry(unsigned long icache_size, unsigned long icache_lsize,
void entry(unsigned long icache_size, unsigned long icache_lsize,
unsigned long dcache_size, unsigned long dcache_lsize)
{
unsigned int i; /* temp value */
@ -141,7 +141,7 @@ void entry(unsigned long icache_size, unsigned long icache_lsize,
((unsigned int)get_byte() << 24);
/* skip rest of the header (upper half of uncompressed size) */
for (i = 0; i < 4; i++)
for (i = 0; i < 4; i++)
get_byte();
/* decompress kernel */

View File

@ -27,9 +27,9 @@ static const char theFatalMsg[] = "fatal error in lp_Print!";
* A low level printf() function.
*/
void
lp_Print(void (*output)(void *, char *, int),
lp_Print(void (*output)(void *, char *, int),
void * arg,
char *fmt,
char *fmt,
va_list ap)
{
@ -40,7 +40,7 @@ lp_Print(void (*output)(void *, char *, int),
(*output)(arg, s, l); \
} \
}
char buf[LP_MAX_BUF];
char c;
@ -57,7 +57,7 @@ lp_Print(void (*output)(void *, char *, int),
int length;
for(;;) {
{
{
/* scan for the next '%' */
char *fmtStart = fmt;
while ( (*fmt != '\0') && (*fmt != '%')) {
@ -73,7 +73,7 @@ lp_Print(void (*output)(void *, char *, int),
/* we found a '%' */
fmt ++;
/* check for long */
if (*fmt == 'l') {
longFlag = 1;
@ -119,9 +119,9 @@ lp_Print(void (*output)(void *, char *, int),
negFlag = 0;
switch (*fmt) {
case 'b':
if (longFlag) {
num = va_arg(ap, long int);
} else {
if (longFlag) {
num = va_arg(ap, long int);
} else {
num = va_arg(ap, int);
}
length = PrintNum(buf, num, 2, 0, width, ladjust, padc, 0);
@ -130,10 +130,10 @@ lp_Print(void (*output)(void *, char *, int),
case 'd':
case 'D':
if (longFlag) {
if (longFlag) {
num = va_arg(ap, long int);
} else {
num = va_arg(ap, int);
} else {
num = va_arg(ap, int);
}
if (num < 0) {
num = - num;
@ -145,10 +145,10 @@ lp_Print(void (*output)(void *, char *, int),
case 'o':
case 'O':
if (longFlag) {
if (longFlag) {
num = va_arg(ap, long int);
} else {
num = va_arg(ap, int);
} else {
num = va_arg(ap, int);
}
length = PrintNum(buf, num, 8, 0, width, ladjust, padc, 0);
OUTPUT(arg, buf, length);
@ -156,30 +156,30 @@ lp_Print(void (*output)(void *, char *, int),
case 'u':
case 'U':
if (longFlag) {
if (longFlag) {
num = va_arg(ap, long int);
} else {
num = va_arg(ap, int);
} else {
num = va_arg(ap, int);
}
length = PrintNum(buf, num, 10, 0, width, ladjust, padc, 0);
OUTPUT(arg, buf, length);
break;
case 'x':
if (longFlag) {
if (longFlag) {
num = va_arg(ap, long int);
} else {
num = va_arg(ap, int);
} else {
num = va_arg(ap, int);
}
length = PrintNum(buf, num, 16, 0, width, ladjust, padc, 0);
OUTPUT(arg, buf, length);
break;
case 'X':
if (longFlag) {
if (longFlag) {
num = va_arg(ap, long int);
} else {
num = va_arg(ap, int);
} else {
num = va_arg(ap, int);
}
length = PrintNum(buf, num, 16, 0, width, ladjust, padc, 1);
OUTPUT(arg, buf, length);
@ -219,7 +219,7 @@ int
PrintChar(char * buf, char c, int length, int ladjust)
{
int i;
if (length < 1) length = 1;
if (ladjust) {
*buf = c;
@ -251,7 +251,7 @@ PrintString(char * buf, char* s, int length, int ladjust)
}
int
PrintNum(char * buf, unsigned long u, int base, int negFlag,
PrintNum(char * buf, unsigned long u, int base, int negFlag,
int length, int ladjust, char padc, int upcase)
{
/* algorithm :
@ -298,7 +298,7 @@ PrintNum(char * buf, unsigned long u, int base, int negFlag,
} else {
for (i = actualLength; i< length; i++) buf[i] = padc;
}
/* prepare to reverse the string */
{

View File

@ -28,9 +28,9 @@
* output function cannot assume the buffer is null-terminated after
* l number of chars.
*/
void lp_Print(void (*output)(void *, char *, int),
void lp_Print(void (*output)(void *, char *, int),
void * arg,
char *fmt,
char *fmt,
va_list ap);
#endif

View File

@ -19,7 +19,7 @@ static void myoutput(void *arg, char *s, int l)
// special termination call
if ((l==1) && (s[0] == '\0')) return;
for (i=0; i< l; i++) {
Uart16550Put(s[i]);
if (s[i] == '\n') Uart16550Put('\r');

View File

@ -52,12 +52,12 @@ void Uart16550Init(uint32 baud, uint8 data, uint8 parity, uint8 stop)
UART16550_WRITE(OFS_INTR_ENABLE, 0);
/* set up buad rate */
{
{
uint32 divisor;
/* set DIAB bit */
UART16550_WRITE(OFS_LINE_CONTROL, 0x80);
/* set divisor */
divisor = MAX_BAUD / baud;
UART16550_WRITE(OFS_DIVISOR_LSB, divisor & 0xff);

View File

@ -113,7 +113,7 @@
reg = <0x1957000 0x100>;
qcom,wifi_noc_memtype_m0_m2 = <TCSR_WIFI_NOC_MEMTYPE_M0_M2>;
};
};
};
@ -320,7 +320,7 @@
label = "boarddata1";
reg = <0x00d00000 0x00080000>;
read-only;
nvmem-layout {
compatible = "fixed-layout";
#address-cells = <1>;

View File

@ -40,7 +40,7 @@
compatible = "gpio-keys";
pinctrl-0 = <&button_pins>;
pinctrl-names = "default";
reset {
label = "reset";
gpios = <&qcom_pinmux 56 GPIO_ACTIVE_LOW>;
@ -157,7 +157,7 @@
pins = "gpio6", "gpio7";
};
};
usb_pwr_en_pins: usb_pwr_en_pins {
mux {
pins = "gpio22";

View File

@ -57,7 +57,7 @@
gpios = <&qcom_pinmux 22 GPIO_ACTIVE_LOW>;
};
led_power_orange: power_orange {
led_power_orange: power_orange {
function = LED_FUNCTION_POWER;
color = <LED_COLOR_ID_ORANGE>;
gpios = <&qcom_pinmux 23 GPIO_ACTIVE_LOW>;
@ -304,7 +304,7 @@
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
ubi@0 {
label = "ubi";
reg = <0x0000000 0x20000000>;

View File

@ -96,7 +96,7 @@
};
phy13: ethernet-phy@13 {
reg = <0x13>;
leds {
#address-cells = <1>;
#size-cells = <0>;

View File

@ -32,23 +32,23 @@
nvmem-cell-names = "mac-address";
brcm,sprom = "brcm/bcm43222-sprom.bin";
brcm,sprom-fixups = <2 0x04d2>,
brcm,sprom-fixups = <2 0x04d2>,
<65 0x1308>, <68 0x0402>,
<70 0x1cc6>, <71 0x3c49>,
<72 0x1132>, <87 0x0315>,
<88 0x0315>, <96 0x2048>,
<97 0xfeed>, <98 0x153e>,
<99 0xfb1f>, <100 0x3e54>,
<101 0x3848>, <102 0xfea0>,
<101 0x3848>, <102 0xfea0>,
<103 0x145c>, <104 0xfaf0>,
<105 0xfe6e>, <106 0x110c>,
<107 0xfb7e>, <108 0xff00>,
<109 0x13c4>, <110 0xfb30>,
<111 0x0000>, <112 0x204c>,
<113 0xfeb8>, <114 0x1508>,
<109 0x13c4>, <110 0xfb30>,
<111 0x0000>, <112 0x204c>,
<113 0xfeb8>, <114 0x1508>,
<115 0xfacb>, <116 0x3e48>,
<117 0x3848>, <118 0xfeb2>,
<119 0x156e>, <120 0xfabf>,
<117 0x3848>, <118 0xfeb2>,
<119 0x156e>, <120 0xfabf>,
<121 0xfe57>, <122 0x1139>,
<123 0xfb6d>, <124 0xff38>,
<125 0x13ee>, <126 0xfb6d>,

View File

@ -1,21 +1,21 @@
/*
LzmaDecode.c
LZMA Decoder (optimized for Speed version)
LZMA SDK 4.40 Copyright (c) 1999-2006 Igor Pavlov (2006-05-01)
http://www.7-zip.org/
LZMA SDK is licensed under two licenses:
1) GNU Lesser General Public License (GNU LGPL)
2) Common Public License (CPL)
It means that you can select one of these two licenses and
It means that you can select one of these two licenses and
follow rules of that license.
SPECIAL EXCEPTION:
Igor Pavlov, as the author of this Code, expressly permits you to
statically or dynamically link your Code (or bind by name) to the
interfaces of this file without subjecting your linked Code to the
terms of the CPL or GNU LGPL. Any modifications or additions
Igor Pavlov, as the author of this Code, expressly permits you to
statically or dynamically link your Code (or bind by name) to the
interfaces of this file without subjecting your linked Code to the
terms of the CPL or GNU LGPL. Any modifications or additions
to this file, however, are subject to the LGPL or CPL terms.
*/
@ -46,7 +46,7 @@
#define RC_TEST { if (Buffer == BufferLim) return LZMA_RESULT_DATA_ERROR; }
#define RC_INIT(buffer, bufferSize) Buffer = buffer; BufferLim = buffer + bufferSize; RC_INIT2
#endif
#define RC_NORMALIZE if (Range < kTopValue) { RC_TEST; Range <<= 8; Code = (Code << 8) | RC_READ_BYTE; }
@ -57,9 +57,9 @@
#define RC_GET_BIT2(p, mi, A0, A1) IfBit0(p) \
{ UpdateBit0(p); mi <<= 1; A0; } else \
{ UpdateBit1(p); mi = (mi + mi) + 1; A1; }
#define RC_GET_BIT(p, mi) RC_GET_BIT2(p, mi, ; , ;)
{ UpdateBit1(p); mi = (mi + mi) + 1; A1; }
#define RC_GET_BIT(p, mi) RC_GET_BIT2(p, mi, ; , ;)
#define RangeDecoderBitTreeDecode(probs, numLevels, res) \
{ int i = numLevels; res = 1; \
@ -82,7 +82,7 @@
#define LenLow (LenChoice2 + 1)
#define LenMid (LenLow + (kNumPosStatesMax << kLenNumLowBits))
#define LenHigh (LenMid + (kNumPosStatesMax << kLenNumMidBits))
#define kNumLenProbs (LenHigh + kLenNumHighSymbols)
#define kNumLenProbs (LenHigh + kLenNumHighSymbols)
#define kNumStates 12
@ -168,7 +168,7 @@ int LzmaDecode(CLzmaDecoderState *vs,
int lc = vs->Properties.lc;
#ifdef _LZMA_OUT_READ
UInt32 Range = vs->Range;
UInt32 Code = vs->Code;
#ifdef _LZMA_IN_CB
@ -210,7 +210,7 @@ int LzmaDecode(CLzmaDecoderState *vs,
UInt32 numProbs = Literal + ((UInt32)LZMA_LIT_SIZE << (lc + vs->Properties.lp));
UInt32 i;
for (i = 0; i < numProbs; i++)
p[i] = kBitModelTotal >> 1;
p[i] = kBitModelTotal >> 1;
rep0 = rep1 = rep2 = rep3 = 1;
state = 0;
globalPos = 0;
@ -261,7 +261,7 @@ int LzmaDecode(CLzmaDecoderState *vs,
for (i = 0; i < numProbs; i++)
p[i] = kBitModelTotal >> 1;
}
#ifdef _LZMA_IN_CB
RC_INIT;
#else
@ -275,7 +275,7 @@ int LzmaDecode(CLzmaDecoderState *vs,
CProb *prob;
UInt32 bound;
int posState = (int)(
(nowPos
(nowPos
#ifdef _LZMA_OUT_READ
+ globalPos
#endif
@ -287,9 +287,9 @@ int LzmaDecode(CLzmaDecoderState *vs,
{
int symbol = 1;
UpdateBit0(prob)
prob = p + Literal + (LZMA_LIT_SIZE *
prob = p + Literal + (LZMA_LIT_SIZE *
(((
(nowPos
(nowPos
#ifdef _LZMA_OUT_READ
+ globalPos
#endif
@ -338,7 +338,7 @@ int LzmaDecode(CLzmaDecoderState *vs,
else if (state < 10) state -= 3;
else state -= 6;
}
else
else
{
UpdateBit1(prob);
prob = p + IsRep + state;
@ -365,14 +365,14 @@ int LzmaDecode(CLzmaDecoderState *vs,
UInt32 pos;
#endif
UpdateBit0(prob);
#ifdef _LZMA_OUT_READ
if (distanceLimit == 0)
#else
if (nowPos == 0)
#endif
return LZMA_RESULT_DATA_ERROR;
state = state < kNumLitStates ? 9 : 11;
#ifdef _LZMA_OUT_READ
pos = dictionaryPos - rep0;
@ -408,7 +408,7 @@ int LzmaDecode(CLzmaDecoderState *vs,
UpdateBit0(prob);
distance = rep1;
}
else
else
{
UpdateBit1(prob);
prob = p + IsRepG2 + state;
@ -469,7 +469,7 @@ int LzmaDecode(CLzmaDecoderState *vs,
int posSlot;
state += kNumLitStates;
prob = p + PosSlot +
((len < kNumLenToPosStates ? len : kNumLenToPosStates - 1) <<
((len < kNumLenToPosStates ? len : kNumLenToPosStates - 1) <<
kNumPosSlotBits);
RangeDecoderBitTreeDecode(prob, kNumPosSlotBits, posSlot);
if (posSlot >= kStartPosModelIndex)
@ -524,7 +524,7 @@ int LzmaDecode(CLzmaDecoderState *vs,
len += kMatchMinLen;
#ifdef _LZMA_OUT_READ
if (rep0 > distanceLimit)
if (rep0 > distanceLimit)
#else
if (rep0 > nowPos)
#endif

View File

@ -1,4 +1,4 @@
/*
/*
LzmaDecode.h
LZMA Decoder interface
@ -8,14 +8,14 @@
LZMA SDK is licensed under two licenses:
1) GNU Lesser General Public License (GNU LGPL)
2) Common Public License (CPL)
It means that you can select one of these two licenses and
It means that you can select one of these two licenses and
follow rules of that license.
SPECIAL EXCEPTION:
Igor Pavlov, as the author of this code, expressly permits you to
statically or dynamically link your code (or bind by name) to the
interfaces of this file without subjecting your linked code to the
terms of the CPL or GNU LGPL. Any modifications or additions
Igor Pavlov, as the author of this code, expressly permits you to
statically or dynamically link your code (or bind by name) to the
interfaces of this file without subjecting your linked code to the
terms of the CPL or GNU LGPL. Any modifications or additions
to this file, however, are subject to the LGPL or CPL terms.
*/
@ -31,7 +31,7 @@
/* Use read function for output data */
/* #define _LZMA_PROB32 */
/* It can increase speed on some 32-bit CPUs,
/* It can increase speed on some 32-bit CPUs,
but memory usage will be doubled in that case */
/* #define _LZMA_LOC_OPT */

View File

@ -1,5 +1,5 @@
/*
LzmaTypes.h
/*
LzmaTypes.h
Types for LZMA Decoder
@ -13,12 +13,12 @@ This file is part of LZMA SDK 4.40 (2006-05-01)
#ifndef _7ZIP_BYTE_DEFINED
#define _7ZIP_BYTE_DEFINED
typedef unsigned char Byte;
#endif
#endif
#ifndef _7ZIP_UINT16_DEFINED
#define _7ZIP_UINT16_DEFINED
typedef unsigned short UInt16;
#endif
#endif
#ifndef _7ZIP_UINT32_DEFINED
#define _7ZIP_UINT32_DEFINED
@ -27,7 +27,7 @@ typedef unsigned long UInt32;
#else
typedef unsigned int UInt32;
#endif
#endif
#endif
/* #define _LZMA_NO_SYSTEM_SIZE_T */
/* You can use it, if you don't want <stddef.h> */

View File

@ -148,7 +148,7 @@
label = "Factory";
reg = <0x50000 0x10000>;
read-only;
nvmem-layout {
compatible = "fixed-layout";
#address-cells = <1>;

View File

@ -215,7 +215,7 @@
#nvmem-cell-cells = <1>;
};
};
};
partition@69c0000 {

View File

@ -195,7 +195,7 @@
reg = <0x380000 0x200000>;
read-only;
};
partition@580000 {
label = "ubi";
reg = <0x580000 0x7a80000>;

View File

@ -1,4 +1,4 @@
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
/dts-v1/;

Some files were not shown because too many files have changed in this diff Show More