From 21391e0bdbe676ab766204eaa0eddd46e529c849 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Mon, 28 Sep 2015 17:00:51 +0200 Subject: convert from u_int*_t to uint*_t --- firmware/src/picc/adc.c | 6 +++--- firmware/src/picc/da.h | 2 +- firmware/src/picc/decoder.c | 10 +++++----- firmware/src/picc/decoder.h | 16 ++++++++-------- firmware/src/picc/decoder_miller.c | 14 +++++++------- firmware/src/picc/decoder_nrzl.c | 12 ++++++------ firmware/src/picc/iso14443a_manchester.c | 18 +++++++++--------- firmware/src/picc/load_modulation.c | 2 +- firmware/src/picc/load_modulation.h | 2 +- firmware/src/picc/main_openpicc.c | 20 ++++++++++---------- firmware/src/picc/openpicc.c | 12 ++++++------ firmware/src/picc/opicc_reg.h | 6 +++--- firmware/src/picc/piccsim.h | 6 +++--- firmware/src/picc/pll.c | 2 +- firmware/src/picc/poti.c | 2 +- firmware/src/picc/poti.h | 2 +- firmware/src/picc/ssc_picc.c | 18 +++++++++--------- firmware/src/picc/tc_cdiv_sync.c | 6 +++--- firmware/src/picc/tc_fdt.c | 6 +++--- firmware/src/picc/tc_fdt.h | 2 +- 20 files changed, 82 insertions(+), 82 deletions(-) (limited to 'firmware/src/picc') diff --git a/firmware/src/picc/adc.c b/firmware/src/picc/adc.c index f350a49..7950cce 100644 --- a/firmware/src/picc/adc.c +++ b/firmware/src/picc/adc.c @@ -57,7 +57,7 @@ static struct adc_state adc_state; static void adc_irq(void) { - u_int32_t sr = adc->ADC_SR; + uint32_t sr = adc->ADC_SR; struct req_ctx *rctx = adc_state.rctx; DEBUGADC("adc_irq(SR=0x%08x, IMR=0x%08x, state=%u): ", @@ -102,12 +102,12 @@ static void adc_irq(void) } #if 0 -u_int16_t adc_read_fieldstr(void) +uint16_t adc_read_fieldstr(void) { return adc->ADC_CDR4; } -u_int16_T adc_read_pll_dem(void) +uint16_T adc_read_pll_dem(void) { return adc } diff --git a/firmware/src/picc/da.h b/firmware/src/picc/da.h index e264e2b..45e9a99 100644 --- a/firmware/src/picc/da.h +++ b/firmware/src/picc/da.h @@ -1,7 +1,7 @@ #ifndef _DA_H #define _DA_H -extern void da_comp_carr(u_int8_t position); +extern void da_comp_carr(uint8_t position); extern void da_init(void); #endif diff --git a/firmware/src/picc/decoder.c b/firmware/src/picc/decoder.c index bdd910e..0d2909f 100644 --- a/firmware/src/picc/decoder.c +++ b/firmware/src/picc/decoder.c @@ -25,10 +25,10 @@ static struct decoder_algo *decoder_algo[DECODER_NUM_ALGOS]; -static int get_next_data(struct decoder_state *st, u_int8_t *data) +static int get_next_data(struct decoder_state *st, uint8_t *data) { - u_int8_t parity_sample; - u_int32_t bytesample; + uint8_t parity_sample; + uint32_t bytesample; bytesample = st->algo->get_next_bytesample(st, &parity_sample); @@ -36,7 +36,7 @@ static int get_next_data(struct decoder_state *st, u_int8_t *data) } /* iterate over sample buffer (size N bytes) and decode data */ -int decoder_decode(u_int8_t algo, const char *sample_buf, +int decoder_decode(uint8_t algo, const char *sample_buf, int sample_buf_size, char *data_buf) { int i, ret; @@ -46,7 +46,7 @@ int decoder_decode(u_int8_t algo, const char *sample_buf, return -EINVAL; st.buf = sample_buf; - st.buf32 = (u_int32_t *) st.buf; + st.buf32 = (uint32_t *) st.buf; st.bit_ofs = 0; st.algo = decoder_algo[algo]; diff --git a/firmware/src/picc/decoder.h b/firmware/src/picc/decoder.h index aef0e20..06ff42e 100644 --- a/firmware/src/picc/decoder.h +++ b/firmware/src/picc/decoder.h @@ -4,22 +4,22 @@ struct decoder_state; struct decoder_algo { - u_int8_t oversampling_rate; - u_int8_t bits_per_sampled_char; - u_int32_t bytesample_mask; - int (*decode_sample)(const u_int32_t sample, u_int8_t data); - u_int32_t (*get_next_bytesample)(struct decoder_state *st, u_int8_t *parity_sample); + uint8_t oversampling_rate; + uint8_t bits_per_sampled_char; + uint32_t bytesample_mask; + int (*decode_sample)(const uint32_t sample, uint8_t data); + uint32_t (*get_next_bytesample)(struct decoder_state *st, uint8_t *parity_sample); }; struct decoder_state { struct decoder_algo *algo; - u_int8_t bit_ofs; + uint8_t bit_ofs; const char *buf; - const u_int32_t *buf32; + const uint32_t *buf32; }; extern int decoder_register(int algnum, struct decoder_algo *algo); -extern int decoder_decode(u_int8_t algo, const char *sample_buf, +extern int decoder_decode(uint8_t algo, const char *sample_buf, int sample_buf_size, char *data_buf); #define DECODER_MILLER 0 diff --git a/firmware/src/picc/decoder_miller.c b/firmware/src/picc/decoder_miller.c index cc62672..96c9bed 100644 --- a/firmware/src/picc/decoder_miller.c +++ b/firmware/src/picc/decoder_miller.c @@ -55,7 +55,7 @@ #define SEQ_Z 0x1 /* decode a single sampled bit */ -static u_int8_t miller_decode_sampled_bit(u_int32_t sampled_bit) +static uint8_t miller_decode_sampled_bit(uint32_t sampled_bit) { switch (sampled_bit) { case SEQ_X: @@ -73,13 +73,13 @@ static u_int8_t miller_decode_sampled_bit(u_int32_t sampled_bit) } /* decode a single 32bit data sample of an 8bit miller encoded word */ -static int miller_decode_sample(u_int32_t sample, u_int8_t *data) +static int miller_decode_sample(uint32_t sample, uint8_t *data) { - u_int8_t ret = 0; + uint8_t ret = 0; unsigned int i; for (i = 0; i < sizeof(sample)/OVERSAMPLING_RATE; i++) { - u_int8_t bit = miller_decode_sampled_bit(sample & 0xf); + uint8_t bit = miller_decode_sampled_bit(sample & 0xf); if (bit == 1) ret |= 1; @@ -98,10 +98,10 @@ static int miller_decode_sample(u_int32_t sample, u_int8_t *data) return ret; } -static u_int32_t get_next_bytesample(struct decoder_state *ms, - u_int8_t *parity_sample) +static uint32_t get_next_bytesample(struct decoder_state *ms, + uint8_t *parity_sample) { - u_int32_t ret = 0; + uint32_t ret = 0; /* get remaining bits from the current word */ ret = *(ms->buf32) >> ms->bit_ofs; diff --git a/firmware/src/picc/decoder_nrzl.c b/firmware/src/picc/decoder_nrzl.c index 136a9c8..8307bcd 100644 --- a/firmware/src/picc/decoder_nrzl.c +++ b/firmware/src/picc/decoder_nrzl.c @@ -60,12 +60,12 @@ /* currently this code will only work with oversampling_rate == 1 */ #define OVERSAMPLING_RATE 1 -static u_int32_t get_next_bytesample(struct decoder_state *st, - u_int8_t *parity_sample) +static uint32_t get_next_bytesample(struct decoder_state *st, + uint8_t *parity_sample) { - u_int32_t ret = 0; - u_int8_t bits_per_sampled_char = st->algo->bits_per_sampled_char; - u_int8_t bytesample_mask = st->algo->bytesample_mask; + uint32_t ret = 0; + uint8_t bits_per_sampled_char = st->algo->bits_per_sampled_char; + uint8_t bytesample_mask = st->algo->bytesample_mask; /* FIXME: shift start and stop bit into parity_sample and just * return plain 8-bit data word */ @@ -83,7 +83,7 @@ static u_int32_t get_next_bytesample(struct decoder_state *st, return ret & bytesample_mask; } -static int nrzl_decode_sample(const u_int32_t sample, u_int8_t *data) +static int nrzl_decode_sample(const uint32_t sample, uint8_t *data) { *data = (sample >> 1) & 0xff; diff --git a/firmware/src/picc/iso14443a_manchester.c b/firmware/src/picc/iso14443a_manchester.c index f9eba1e..15a61ac 100644 --- a/firmware/src/picc/iso14443a_manchester.c +++ b/firmware/src/picc/iso14443a_manchester.c @@ -46,7 +46,7 @@ #define MANCHESTER_SEQ_E 0x5500 #define MANCHESTER_SEQ_F 0x5555 -static u_int32_t manchester_sample_size(u_int8_t frame_bytelen) +static uint32_t manchester_sample_size(uint8_t frame_bytelen) { /* 16 bits (2 bytes) per bit => 16 bytes samples per data byte, * plus 16bit (2 bytes) parity per data byte @@ -60,13 +60,13 @@ static u_int32_t manchester_sample_size(u_int8_t frame_bytelen) struct manch_enc_state { const char *data; char *samples; - u_int16_t *samples16; + uint16_t *samples16; }; -static void manchester_enc_byte(struct manch_enc_state *mencs, u_int8_t data) +static void manchester_enc_byte(struct manch_enc_state *mencs, uint8_t data) { int i; - u_int8_t sum_1 = 0; + uint8_t sum_1 = 0; /* append 8 sample blobs, one for each bit */ for (i = 0; i < 8; i++) { @@ -86,8 +86,8 @@ static void manchester_enc_byte(struct manch_enc_state *mencs, u_int8_t data) mencs->samples16++ } -int manchester_encode(char *sample_buf, u_int16_t sample_buf_len, - const char *data, u_int8_t data_len) +int manchester_encode(char *sample_buf, uint16_t sample_buf_len, + const char *data, uint8_t data_len) { int i, enc_size; struct manch_enc_state mencs @@ -112,10 +112,10 @@ int manchester_encode(char *sample_buf, u_int16_t sample_buf_len, #define BPSK_SPEED_212 -static u_int32_t bpsk_sample_size(u_int8_t frame_bytelen) +static uint32_t bpsk_sample_size(uint8_t frame_bytelen) -int bpsk_encode(char *sample_buf, u_int16_t sample_buf_len, - const char *data, u_int8_t data_len) +int bpsk_encode(char *sample_buf, uint16_t sample_buf_len, + const char *data, uint8_t data_len) { /* burst of 32 sub carrier cycles */ memset(sample_buf, 0x55, 8); diff --git a/firmware/src/picc/load_modulation.c b/firmware/src/picc/load_modulation.c index 576bc74..acefe98 100644 --- a/firmware/src/picc/load_modulation.c +++ b/firmware/src/picc/load_modulation.c @@ -23,7 +23,7 @@ #include "../openpcd.h" -void load_mod_level(u_int8_t level) +void load_mod_level(uint8_t level) { if (level > 3) level = 3; diff --git a/firmware/src/picc/load_modulation.h b/firmware/src/picc/load_modulation.h index 71f9d6f..59fc9cb 100644 --- a/firmware/src/picc/load_modulation.h +++ b/firmware/src/picc/load_modulation.h @@ -1,7 +1,7 @@ #ifndef _LOAD_MODULATION_H #define _LOAD_MODULATION_H -extern void load_mod_level(u_int8_t level); +extern void load_mod_level(uint8_t level); extern void load_mod_init(void); #endif diff --git a/firmware/src/picc/main_openpicc.c b/firmware/src/picc/main_openpicc.c index 93ca4b6..da9378f 100644 --- a/firmware/src/picc/main_openpicc.c +++ b/firmware/src/picc/main_openpicc.c @@ -35,15 +35,15 @@ #include #include -static const u_int16_t cdivs[] = { 8192, 2048, 1024, 512, 128, 64, 32, 16 }; -static u_int8_t cdiv_idx = 6; +static const uint16_t cdivs[] = { 8192, 2048, 1024, 512, 128, 64, 32, 16 }; +static uint8_t cdiv_idx = 6; -static u_int16_t duty_percent = 22; +static uint16_t duty_percent = 22; #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) -static u_int32_t pwm_freq[] = { 105937, 211875, 423750, 847500 }; -static u_int8_t pwm_freq_idx = 0; +static uint32_t pwm_freq[] = { 105937, 211875, 423750, 847500 }; +static uint8_t pwm_freq_idx = 0; -static u_int8_t load_mod = 0; +static uint8_t load_mod = 0; #define DA_BASELINE 192 @@ -88,10 +88,10 @@ static void help(void) int _main_dbgu(char key) { - static u_int8_t poti = DA_BASELINE; - static u_int8_t pll_inh = 1; - static u_int8_t ssc_mode = 1; - static u_int8_t sync_enabled = 0; + static uint8_t poti = DA_BASELINE; + static uint8_t pll_inh = 1; + static uint8_t ssc_mode = 1; + static uint8_t sync_enabled = 0; DEBUGPCRF("main_dbgu"); diff --git a/firmware/src/picc/openpicc.c b/firmware/src/picc/openpicc.c index 54139a9..61db217 100644 --- a/firmware/src/picc/openpicc.c +++ b/firmware/src/picc/openpicc.c @@ -16,7 +16,7 @@ #ifdef DEBUG /* Our registers, including their power-up default values */ -static u_int16_t opicc_regs[_OPICC_NUM_REGS] = { +static uint16_t opicc_regs[_OPICC_NUM_REGS] = { [OPICC_REG_14443A_UIDLEN] = 4, [OPICC_REG_14443A_FDT0] = 1236, [OPICC_REG_14443A_FDT1] = 1172, @@ -30,14 +30,14 @@ static u_int16_t opicc_regs[_OPICC_NUM_REGS] = { [OPICC_REG_RX_COMP_LEVEL] = 0, }; -u_int16_t opicc_reg_read(enum opicc_reg reg) +uint16_t opicc_reg_read(enum opicc_reg reg) { if (reg < _OPICC_NUM_REGS) return opicc_regs[reg]; return 0; } -void opicc_reg_write(enum opicc_reg reg, u_int16_t val) +void opicc_reg_write(enum opicc_reg reg, uint16_t val) { if (reg < _OPICC_NUM_REGS) opicc_regs[reg] = val; @@ -52,7 +52,7 @@ void opicc_reg_write(enum opicc_reg reg, u_int16_t val) static int opicc_reg_usb_in(struct req_ctx *rctx) { struct openpcd_hdr *poh = (struct openpcd_hdr *) &rctx->data[0]; - u_int16_t *val16 = (u_int16_t *) poh->data; + uint16_t *val16 = (uint16_t *) poh->data; poh->val = 0; rctx->tot_len = sizeof(*poh); @@ -60,11 +60,11 @@ static int opicc_reg_usb_in(struct req_ctx *rctx) switch (poh->cmd) { case OPENPCD_CMD_PICC_REG_READ: *val16 = opicc_reg_read(poh->reg); - rctx->tot_len += sizeof(u_int16_t); + rctx->tot_len += sizeof(uint16_t); poh->flags |= OPENPCD_FLAG_RESPOND; break; case OPENPCD_CMD_PICC_REG_WRITE: - if (rctx->tot_len < sizeof(*poh) + sizeof(u_int16_t)) { + if (rctx->tot_len < sizeof(*poh) + sizeof(uint16_t)) { /* we only have an 8bit write */ opicc_reg_write(poh->reg, poh->val); } else diff --git a/firmware/src/picc/opicc_reg.h b/firmware/src/picc/opicc_reg.h index adc9305..3402057 100644 --- a/firmware/src/picc/opicc_reg.h +++ b/firmware/src/picc/opicc_reg.h @@ -5,10 +5,10 @@ #include #ifdef DEBUG -u_int16_t opicc_reg_read(enum opicc_reg reg); -void opicc_reg_write(enum opicc_reg reg, u_int16_t val); +uint16_t opicc_reg_read(enum opicc_reg reg); +void opicc_reg_write(enum opicc_reg reg, uint16_t val); #else -u_int16_t opicc_regs[_OPICC_NUM_REGS]; +uint16_t opicc_regs[_OPICC_NUM_REGS]; #define opicc_reg_read(x) (opicc_regs[x]) #define opicc_reg_write(x, y) (opicc_regs[x] = y) #endif diff --git a/firmware/src/picc/piccsim.h b/firmware/src/picc/piccsim.h index 3cf6514..ddbb224 100644 --- a/firmware/src/picc/piccsim.h +++ b/firmware/src/picc/piccsim.h @@ -4,19 +4,19 @@ struct piccsim_state { enum rfid_layer2_id l2prot; unsigned char uid[10]; - u_int8_t uid_len; + uint8_t uid_len; union { struct { enum iso14443a_state state; enum iso14443a_level level; - u_int32_t flags; + uint32_t flags; } iso14443a; struct { } iso14443b; } l2; union { - u_int32_t flags; + uint32_t flags; } proto; } diff --git a/firmware/src/picc/pll.c b/firmware/src/picc/pll.c index e48911d..9a413a8 100644 --- a/firmware/src/picc/pll.c +++ b/firmware/src/picc/pll.c @@ -38,7 +38,7 @@ int pll_is_locked(void) return AT91F_PIO_IsInputSet(AT91C_BASE_PIOA, OPENPICC_PIO_PLL_LOCK); } -static void pll_lock_change_cb(u_int32_t pio) +static void pll_lock_change_cb(uint32_t pio) { DEBUGPCRF("PLL LOCK: %d", pll_is_locked()); #if 1 diff --git a/firmware/src/picc/poti.c b/firmware/src/picc/poti.c index e5701dc..1901124 100644 --- a/firmware/src/picc/poti.c +++ b/firmware/src/picc/poti.c @@ -25,7 +25,7 @@ static const AT91PS_SPI spi = AT91C_BASE_SPI; -void poti_comp_carr(u_int8_t position) +void poti_comp_carr(uint8_t position) { volatile int i; diff --git a/firmware/src/picc/poti.h b/firmware/src/picc/poti.h index 92ec00d..0d238a3 100644 --- a/firmware/src/picc/poti.h +++ b/firmware/src/picc/poti.h @@ -1,7 +1,7 @@ #ifndef _POTI_H #define _POTI_H -extern void poti_comp_carr(u_int8_t position); +extern void poti_comp_carr(uint8_t position); extern void poti_init(void); #endif diff --git a/firmware/src/picc/ssc_picc.c b/firmware/src/picc/ssc_picc.c index 8ec6f79..b7455e5 100644 --- a/firmware/src/picc/ssc_picc.c +++ b/firmware/src/picc/ssc_picc.c @@ -62,7 +62,7 @@ struct ssc_state { }; static struct ssc_state ssc_state; -static const u_int16_t ssc_dmasize[] = { +static const uint16_t ssc_dmasize[] = { [SSC_MODE_NONE] = 16, [SSC_MODE_14443A_SHORT] = 16, /* 64 bytes */ [SSC_MODE_14443A_STANDARD] = 16, /* 64 bytes */ @@ -91,8 +91,8 @@ static const u_int16_t ssc_dmasize[] = { void ssc_rx_mode_set(enum ssc_mode ssc_mode) { - u_int8_t data_len, num_data, sync_len; - u_int32_t start_cond; + uint8_t data_len, num_data, sync_len; + uint32_t start_cond; /* disable Rx and all Rx interrupt sources */ AT91F_SSC_DisableRx(AT91C_BASE_SSC); @@ -151,8 +151,8 @@ out_set_mode: static void ssc_tx_mode_set(enum ssc_mode ssc_mode) { - u_int8_t data_len, num_data, sync_len; - u_int32_t start_cond; + uint8_t data_len, num_data, sync_len; + uint32_t start_cond; /* disable Tx */ AT91F_SSC_DisableTx(AT91C_BASE_SSC); @@ -308,7 +308,7 @@ static int8_t ssc_rx_refill(void) static void __ramfunc ssc_irq(void) { - u_int32_t ssc_sr = ssc->SSC_SR; + uint32_t ssc_sr = ssc->SSC_SR; int i, *tmp, emptyframe = 0; DEBUGP("ssc_sr=0x%08x, mode=%u: ", ssc_sr, ssc_state.mode); @@ -327,7 +327,7 @@ static void __ramfunc ssc_irq(void) /* Experimental start SSC on frame, stop on FFFFFFFF */ if (ssc_state.mode == SSC_MODE_CONTINUOUS) { //ssc->SSC_RCMR = (ssc->SSC_RCMR & ~AT91C_SSC_START) | AT91C_SSC_START_CONTINOUS; - tmp = (u_int32_t*)ssc_state.rx_ctx[0]->data; + tmp = (uint32_t*)ssc_state.rx_ctx[0]->data; for(i = ssc_state.rx_ctx[0]->size / 4; i >= 0 ; i--) { if( *tmp++ == 0xFFFFFFFF ) { *(tmp-1) = 0xAAAAAAAA; // debug marker @@ -345,7 +345,7 @@ static void __ramfunc ssc_irq(void) #endif /* Ignore empty frames */ if (ssc_state.mode == SSC_MODE_CONTINUOUS) { - tmp = (u_int32_t*)ssc_state.rx_ctx[0]->data + MAX_HDRSIZE; + tmp = (uint32_t*)ssc_state.rx_ctx[0]->data + MAX_HDRSIZE; emptyframe = 1; for(i = (ssc_state.rx_ctx[0]->size-MAX_HDRSIZE) / 4 - 8/*WTF?*/; i > 0; i--) { if( *tmp++ != 0xFFFFFFFF ) { @@ -417,7 +417,7 @@ static void __ramfunc ssc_irq(void) if (ssc_sr & AT91C_SSC_RXSYN) DEBUGP("RXSYN "); if (ssc_sr & AT91C_SSC_RXRDY) { - u_int32_t sample = ssc->SSC_RHR; + uint32_t sample = ssc->SSC_RHR; DEBUGP("RXRDY=0x%08x ", sample); /* Try to set FDT compare register ASAP */ if (sample == REQA) { diff --git a/firmware/src/picc/tc_cdiv_sync.c b/firmware/src/picc/tc_cdiv_sync.c index e83ae88..6d6e1e9 100644 --- a/firmware/src/picc/tc_cdiv_sync.c +++ b/firmware/src/picc/tc_cdiv_sync.c @@ -7,9 +7,9 @@ //#define USE_IRQ -static u_int8_t enabled; +static uint8_t enabled; -static void pio_data_change(u_int32_t pio) +static void pio_data_change(uint32_t pio) { DEBUGP("PIO_FRAME_IRQ: "); /* we get one interrupt for each change. If now, after the @@ -46,7 +46,7 @@ static void __ramfunc cdsync_cb(void) void tc_cdiv_sync_reset(void) { if (enabled) { - u_int32_t tmp = *AT91C_PIOA_ISR; + uint32_t tmp = *AT91C_PIOA_ISR; volatile int i; DEBUGPCRF("CDIV_SYNC_FLOP"); diff --git a/firmware/src/picc/tc_fdt.c b/firmware/src/picc/tc_fdt.c index 1651b32..8b4b867 100644 --- a/firmware/src/picc/tc_fdt.c +++ b/firmware/src/picc/tc_fdt.c @@ -39,7 +39,7 @@ static AT91PS_TC tcfdt = AT91C_BASE_TC2; -void tc_fdt_set(u_int16_t count) +void tc_fdt_set(uint16_t count) { tcfdt->TC_RA = count; } @@ -47,14 +47,14 @@ void tc_fdt_set(u_int16_t count) /* 'count' number of carrier cycles after the last modulation pause, * we deem the frame to have ended */ -void tc_frame_end_set(u_int16_t count) +void tc_frame_end_set(uint16_t count) { tcfdt->TC_RB = count; } static void tc_fdt_irq(void) { - u_int32_t sr = tcfdt->TC_SR; + uint32_t sr = tcfdt->TC_SR; DEBUGP("tc_fdt_irq: TC2_SR=0x%08x TC2_CV=0x%08x ", sr, tcfdt->TC_CV); diff --git a/firmware/src/picc/tc_fdt.h b/firmware/src/picc/tc_fdt.h index b39b935..db0a5c2 100644 --- a/firmware/src/picc/tc_fdt.h +++ b/firmware/src/picc/tc_fdt.h @@ -4,6 +4,6 @@ #include extern void tc_fdt_init(void); -extern void tc_fdt_set(u_int16_t count); +extern void tc_fdt_set(uint16_t count); #endif -- cgit v1.2.3