diff options
author | Harald Welte <laforge@gnumonks.org> | 2015-09-28 17:00:51 +0200 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2015-09-28 17:02:22 +0200 |
commit | 21391e0bdbe676ab766204eaa0eddd46e529c849 (patch) | |
tree | a47c5305e5363c4dff8d4dabdc82750dc877a64b /firmware/src/pcd | |
parent | 5a40e2fed18ed75c7b8d62f52cf4a7c660a8e026 (diff) |
convert from u_int*_t to uint*_t
Diffstat (limited to 'firmware/src/pcd')
-rw-r--r-- | firmware/src/pcd/main_librfid.c | 28 | ||||
-rw-r--r-- | firmware/src/pcd/main_mifare.c | 30 | ||||
-rw-r--r-- | firmware/src/pcd/main_presence.c | 20 | ||||
-rw-r--r-- | firmware/src/pcd/main_pwm.c | 22 | ||||
-rw-r--r-- | firmware/src/pcd/main_reqa.c | 16 | ||||
-rw-r--r-- | firmware/src/pcd/rc632.c | 80 | ||||
-rw-r--r-- | firmware/src/pcd/rc632.h | 14 | ||||
-rw-r--r-- | firmware/src/pcd/rc632_highlevel.c | 22 | ||||
-rw-r--r-- | firmware/src/pcd/rc632_highlevel.h | 6 |
9 files changed, 119 insertions, 119 deletions
diff --git a/firmware/src/pcd/main_librfid.c b/firmware/src/pcd/main_librfid.c index a5a488d..a04c446 100644 --- a/firmware/src/pcd/main_librfid.c +++ b/firmware/src/pcd/main_librfid.c @@ -59,30 +59,30 @@ int _main_dbgu(char key) } struct openpcd_l2_connectinfo { - u_int32_t proto_supported; + uint32_t proto_supported; - u_int8_t speed_rx; - u_int8_t speed_tx; + uint8_t speed_rx; + uint8_t speed_tx; - u_int8_t uid_len; - u_int8_t uid[10]; + uint8_t uid_len; + uint8_t uid[10]; } __attribute__ ((packed)); struct openpcd_proto_connectinfo { } __attribute__ ((packed)); struct openpcd_proto_tcl_connectinfo { - u_int8_t fsc; - u_int8_t fsd; - u_int8_t ta; - u_int8_t sfgt; + uint8_t fsc; + uint8_t fsd; + uint8_t ta; + uint8_t sfgt; - u_int8_t flags; - u_int8_t cid; - u_int8_t nad; + uint8_t flags; + uint8_t cid; + uint8_t nad; - u_int8_t ats_tot_len; - u_int8_t ats_snippet[0]; + uint8_t ats_tot_len; + uint8_t ats_snippet[0]; } __attribute__ ((packed)); static int init_proto(void) diff --git a/firmware/src/pcd/main_mifare.c b/firmware/src/pcd/main_mifare.c index 43729a5..8dd6420 100644 --- a/firmware/src/pcd/main_mifare.c +++ b/firmware/src/pcd/main_mifare.c @@ -40,7 +40,7 @@ static struct rfid_reader_handle *rh; static struct rfid_layer2_handle *l2h; static struct rfid_protocol_handle *ph; -static u_int8_t sector = 0; +static uint8_t sector = 0; void _init_func(void) { @@ -74,30 +74,30 @@ int _main_dbgu(char key) } struct openpcd_l2_connectinfo { - u_int32_t proto_supported; + uint32_t proto_supported; - u_int8_t speed_rx; - u_int8_t speed_tx; + uint8_t speed_rx; + uint8_t speed_tx; - u_int8_t uid_len; - u_int8_t uid[10]; + uint8_t uid_len; + uint8_t uid[10]; } __attribute__ ((packed)); struct openpcd_proto_connectinfo { } __attribute__ ((packed)); struct openpcd_proto_tcl_connectinfo { - u_int8_t fsc; - u_int8_t fsd; - u_int8_t ta; - u_int8_t sfgt; + uint8_t fsc; + uint8_t fsd; + uint8_t ta; + uint8_t sfgt; - u_int8_t flags; - u_int8_t cid; - u_int8_t nad; + uint8_t flags; + uint8_t cid; + uint8_t nad; - u_int8_t ats_tot_len; - u_int8_t ats_snippet[0]; + uint8_t ats_tot_len; + uint8_t ats_snippet[0]; } __attribute__ ((packed)); /* mifare classic helper */ diff --git a/firmware/src/pcd/main_presence.c b/firmware/src/pcd/main_presence.c index 4ead264..cca2cac 100644 --- a/firmware/src/pcd/main_presence.c +++ b/firmware/src/pcd/main_presence.c @@ -37,7 +37,7 @@ #define RAH NULL -u_int32_t delay_scan,delay_blink,last_uid,last_polled_uid; +uint32_t delay_scan,delay_blink,last_uid,last_polled_uid; static struct rfid_reader_handle *rh; static struct rfid_layer2_handle *l2h; @@ -54,10 +54,10 @@ static int usb_presence_rx(struct req_ctx *rctx) if(last_polled_uid) { rctx->tot_len += 4; - poh->data[0]=(u_int8_t)(last_polled_uid>>24); - poh->data[1]=(u_int8_t)(last_polled_uid>>16); - poh->data[2]=(u_int8_t)(last_polled_uid>> 8); - poh->data[3]=(u_int8_t)(last_polled_uid ); + poh->data[0]=(uint8_t)(last_polled_uid>>24); + poh->data[1]=(uint8_t)(last_polled_uid>>16); + poh->data[2]=(uint8_t)(last_polled_uid>> 8); + poh->data[3]=(uint8_t)(last_polled_uid ); last_polled_uid=0; } break; @@ -124,16 +124,16 @@ int _main_dbgu(char key) void _main_func(void) { - u_int32_t uid; + uint32_t uid; int status; status = rfid_layer2_open(l2h); if (status >= 0 && l2h->uid_len==4) { - uid=((u_int32_t)l2h->uid[0]) | - ((u_int32_t)l2h->uid[1])<< 8| - ((u_int32_t)l2h->uid[2])<<16| - ((u_int32_t)l2h->uid[3])<<24; + uid=((uint32_t)l2h->uid[0]) | + ((uint32_t)l2h->uid[1])<< 8| + ((uint32_t)l2h->uid[2])<<16| + ((uint32_t)l2h->uid[3])<<24; delay_scan=100; diff --git a/firmware/src/pcd/main_pwm.c b/firmware/src/pcd/main_pwm.c index 50fd363..271daaf 100644 --- a/firmware/src/pcd/main_pwm.c +++ b/firmware/src/pcd/main_pwm.c @@ -39,14 +39,14 @@ #define RAH NULL -static u_int8_t force_100ask = 1; -static u_int8_t mod_conductance = 0x3f; -static u_int8_t cw_conductance = 0x3f; -static u_int16_t duty_percent = 22; +static uint8_t force_100ask = 1; +static uint8_t mod_conductance = 0x3f; +static uint8_t cw_conductance = 0x3f; +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 void rc632_modulate_mfin() { @@ -61,11 +61,11 @@ static void rc632_modulate_mfin() #define COND_MANT(x) (x & 0x0f) #define COND_EXP(x) ((x & 0x30) >> 4) -static const u_int16_t rsrel_expfact[] = { 1000, 1925, 3706, 7133 }; +static const uint16_t rsrel_expfact[] = { 1000, 1925, 3706, 7133 }; -static u_int32_t calc_conduct_rel(u_int8_t inp) +static uint32_t calc_conduct_rel(uint8_t inp) { - u_int32_t cond_rel; + uint32_t cond_rel; cond_rel = COND_MANT(inp) * rsrel_expfact[COND_EXP(inp)]; cond_rel = cond_rel / 1000; @@ -73,14 +73,14 @@ static u_int32_t calc_conduct_rel(u_int8_t inp) return cond_rel; } -static const u_int8_t rsrel_table[] = { +static const uint8_t rsrel_table[] = { 0, 16, 32, 48, 1, 17, 2, 3, 33, 18, 4, 5, 19, 6, 7, 49, 34, 20, 8, 9, 21, 10, 11, 35, 22, 12, 13, 23, 14, 50, 36, 15, 24, 25, 37, 26, 27, 51, 38, 28, 29, 39, 30, 52, 31, 40, 41, 53, 42, 43, 54, 44, 45, 55, 46, 47, 56, 57, 58, 59, 60, 61, 62, 63 }; -static const u_int16_t cdivs[] = { 128, 64, 32, 16 }; +static const uint16_t cdivs[] = { 128, 64, 32, 16 }; static int cdiv_idx = 0; static void help(void) diff --git a/firmware/src/pcd/main_reqa.c b/firmware/src/pcd/main_reqa.c index 717926a..ae4b4a1 100644 --- a/firmware/src/pcd/main_reqa.c +++ b/firmware/src/pcd/main_reqa.c @@ -83,25 +83,25 @@ static const char frame_14443a[] = { 0x00, 0xff, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, }; -static void reg_inc(u_int8_t reg) +static void reg_inc(uint8_t reg) { - u_int8_t val; + uint8_t val; opcd_rc632_reg_read(RAH, reg, &val); opcd_rc632_reg_write(RAH, reg, val++); DEBUGPCRF("reg 0x%02x = 0x%02x", reg, val); } -static void reg_dec(u_int8_t reg) +static void reg_dec(uint8_t reg) { - u_int8_t val; + uint8_t val; opcd_rc632_reg_read(RAH, reg, &val); opcd_rc632_reg_write(RAH, reg, val--); DEBUGPCRF("reg 0x%02x = 0x%02x", reg, val); } -static u_int8_t ana_out_sel; -static u_int8_t mfout_sel; -static u_int8_t speed_idx; +static uint8_t ana_out_sel; +static uint8_t mfout_sel; +static uint8_t speed_idx; static void help(void) { @@ -114,7 +114,7 @@ static void help(void) "{: dev cdiv }: inc cdiv"); } -static u_int16_t cdivs[] = { 128, 64, 32, 16 }; +static uint16_t cdivs[] = { 128, 64, 32, 16 }; int _main_dbgu(char key) { diff --git a/firmware/src/pcd/rc632.c b/firmware/src/pcd/rc632.c index 731574c..41fee19 100644 --- a/firmware/src/pcd/rc632.c +++ b/firmware/src/pcd/rc632.c @@ -72,7 +72,7 @@ static const AT91PS_SPI pSPI = AT91C_BASE_SPI; /* SPI irq handler */ static void spi_irq(void) { - u_int32_t status = pSPI->SPI_SR; + uint32_t status = pSPI->SPI_SR; DEBUGPSPIIRQ("spi_irq: 0x%08x ", status); @@ -95,8 +95,8 @@ static void spi_irq(void) } #ifdef SPI_USES_DMA -static int spi_transceive(const u_int8_t *tx_data, u_int16_t tx_len, - u_int8_t *rx_data, u_int16_t *rx_len) +static int spi_transceive(const uint8_t *tx_data, uint16_t tx_len, + uint8_t *rx_data, uint16_t *rx_len) { DEBUGPSPI("DMA Xfer tx=%s\r\n", hexdump(tx_data, tx_len)); if (*rx_len < tx_len) { @@ -129,12 +129,12 @@ static int spi_transceive(const u_int8_t *tx_data, u_int16_t tx_len, } #else /* stupid polling transceiver routine */ -static int spi_transceive(const u_int8_t *tx_data, u_int16_t tx_len, - u_int8_t *rx_data, u_int16_t *rx_len) +static int spi_transceive(const uint8_t *tx_data, uint16_t tx_len, + uint8_t *rx_data, uint16_t *rx_len) { - u_int16_t tx_cur = 0; - u_int16_t rx_len_max = 0; - u_int16_t rx_cnt = 0; + uint16_t tx_cur = 0; + uint16_t rx_len_max = 0; + uint16_t rx_cnt = 0; /* disable RC632 interrupt because it wants to do SPI transactions */ AT91F_AIC_DisableIt(AT91C_BASE_AIC, OPENPCD_IRQ_RC632); @@ -148,8 +148,8 @@ static int spi_transceive(const u_int8_t *tx_data, u_int16_t tx_len, //AT91F_SPI_Enable(pSPI); while (1) { - u_int32_t sr = pSPI->SPI_SR; - u_int8_t tmp; + uint32_t sr = pSPI->SPI_SR; + uint8_t tmp; if (sr & AT91C_SPI_RDRF) { tmp = pSPI->SPI_RDR; rx_cnt++; @@ -181,8 +181,8 @@ static int spi_transceive(const u_int8_t *tx_data, u_int16_t tx_len, /* static buffers used by RC632 access primitives below. * Since we only have one */ -static u_int8_t spi_outbuf[SPI_MAX_XFER_LEN]; -static u_int8_t spi_inbuf[SPI_MAX_XFER_LEN]; +static uint8_t spi_outbuf[SPI_MAX_XFER_LEN]; +static uint8_t spi_inbuf[SPI_MAX_XFER_LEN]; #define FIFO_ADDR (RC632_REG_FIFO_DATA << 1) @@ -191,9 +191,9 @@ static u_int8_t spi_inbuf[SPI_MAX_XFER_LEN]; /* RC632 access primitives */ int opcd_rc632_reg_write(struct rfid_asic_handle *hdl, - u_int8_t addr, u_int8_t data) + uint8_t addr, uint8_t data) { - u_int16_t rx_len = 2; + uint16_t rx_len = 2; DEBUG632("[0x%02x] <= 0x%02x", addr, data); @@ -208,13 +208,13 @@ int opcd_rc632_reg_write(struct rfid_asic_handle *hdl, #define RC632_REGSET_START 0x10 #define RC632_REGSET_END 0x3f #define RC632_REGSET_MAXSIZE (RC632_REGSET_END-RC632_REGSET_START) -static u_int8_t regset_buf[RC632_REGSET_MAXSIZE * 2]; +static uint8_t regset_buf[RC632_REGSET_MAXSIZE * 2]; int opcd_rc632_reg_write_set(struct rfid_asic_handle *hdl, - u_int8_t *regs, int len) + uint8_t *regs, int len) { - u_int8_t i, j = 0; - u_int16_t rx_len; + uint8_t i, j = 0; + uint16_t rx_len; if (len > RC632_REGSET_MAXSIZE) return -E2BIG; @@ -232,9 +232,9 @@ int opcd_rc632_reg_write_set(struct rfid_asic_handle *hdl, } int opcd_rc632_fifo_write(struct rfid_asic_handle *hdl, - u_int8_t len, u_int8_t *data, u_int8_t flags) + uint8_t len, uint8_t *data, uint8_t flags) { - u_int16_t rx_len = sizeof(spi_inbuf); + uint16_t rx_len = sizeof(spi_inbuf); if (len > sizeof(spi_outbuf)-1) len = sizeof(spi_outbuf)-1; @@ -247,9 +247,9 @@ int opcd_rc632_fifo_write(struct rfid_asic_handle *hdl, } int opcd_rc632_reg_read(struct rfid_asic_handle *hdl, - u_int8_t addr, u_int8_t *val) + uint8_t addr, uint8_t *val) { - u_int16_t rx_len = 2; + uint16_t rx_len = 2; addr = (addr << 1) & 0x7e; @@ -265,12 +265,12 @@ int opcd_rc632_reg_read(struct rfid_asic_handle *hdl, } int opcd_rc632_fifo_read(struct rfid_asic_handle *hdl, - u_int8_t max_len, u_int8_t *data) + uint8_t max_len, uint8_t *data) { int ret; - u_int8_t fifo_length; - u_int8_t i; - u_int16_t rx_len; + uint8_t fifo_length; + uint8_t i; + uint16_t rx_len; ret = opcd_rc632_reg_read(hdl, RC632_REG_FIFO_LENGTH, &fifo_length); if (ret < 0) @@ -296,9 +296,9 @@ int opcd_rc632_fifo_read(struct rfid_asic_handle *hdl, } int opcd_rc632_set_bits(struct rfid_asic_handle *hdl, - u_int8_t reg, u_int8_t bits) + uint8_t reg, uint8_t bits) { - u_int8_t val; + uint8_t val; int ret; ret = opcd_rc632_reg_read(hdl, reg, &val); @@ -311,9 +311,9 @@ int opcd_rc632_set_bits(struct rfid_asic_handle *hdl, } int opcd_rc632_clear_bits(struct rfid_asic_handle *hdl, - u_int8_t reg, u_int8_t bits) + uint8_t reg, uint8_t bits) { - u_int8_t val; + uint8_t val; int ret; ret = opcd_rc632_reg_read(hdl, reg, &val); @@ -331,7 +331,7 @@ static void rc632_irq(void) { struct req_ctx *irq_rctx; struct openpcd_hdr *irq_opcdh; - u_int8_t cause; + uint8_t cause; /* CL RC632 has interrupted us */ opcd_rc632_reg_read(NULL, RC632_REG_INTERRUPT_RQ, &cause); @@ -392,7 +392,7 @@ void rc632_unthrottle(void) AT91F_AIC_EnableIt(AT91C_BASE_AIC, OPENPCD_IRQ_RC632); } -void rc632_power(u_int8_t up) +void rc632_power(uint8_t up) { DEBUGPCRF("powering %s RC632", up ? "up" : "down"); if (up) @@ -414,7 +414,7 @@ void rc632_reset(void) /* wait for startup phase to finish */ while (1) { - u_int8_t val; + uint8_t val; opcd_rc632_reg_read(NULL, RC632_REG_COMMAND, &val); if (val == 0x00) break; @@ -427,7 +427,7 @@ void rc632_reset(void) static int rc632_usb_in(struct req_ctx *rctx) { struct openpcd_hdr *poh = (struct openpcd_hdr *) rctx->data; - u_int16_t len = rctx->tot_len-sizeof(*poh); + uint16_t len = rctx->tot_len-sizeof(*poh); /* initialize transmit length to header length */ rctx->tot_len = sizeof(*poh); @@ -443,7 +443,7 @@ static int rc632_usb_in(struct req_ctx *rctx) /* FIFO read always has to provoke a response */ poh->flags &= OPENPCD_FLAG_RESPOND; { - u_int16_t req_len = poh->val, remain_len = req_len, pih_len; + uint16_t req_len = poh->val, remain_len = req_len, pih_len; #if 0 if (req_len > MAX_PAYLOAD_LEN) { pih_len = MAX_PAYLOAD_LEN; @@ -598,9 +598,9 @@ void rc632_exit(void) #ifdef DEBUG static int rc632_reg_write_verify(struct rfid_asic_handle *hdl, - u_int8_t reg, u_int8_t val) + uint8_t reg, uint8_t val) { - u_int8_t tmp; + uint8_t tmp; opcd_rc632_reg_write(hdl, reg, val); opcd_rc632_reg_read(hdl, reg, &tmp); @@ -612,11 +612,11 @@ static int rc632_reg_write_verify(struct rfid_asic_handle *hdl, int rc632_dump(void) { - u_int8_t i; - u_int16_t rx_len = sizeof(spi_inbuf); + uint8_t i; + uint16_t rx_len = sizeof(spi_inbuf); for (i = 0; i <= 0x3f; i++) { - u_int8_t reg = i; + uint8_t reg = i; if (reg == RC632_REG_FIFO_DATA) reg = 0x3e; diff --git a/firmware/src/pcd/rc632.h b/firmware/src/pcd/rc632.h index 5081f42..d9dfecd 100644 --- a/firmware/src/pcd/rc632.h +++ b/firmware/src/pcd/rc632.h @@ -7,17 +7,17 @@ #include <librfid/rfid_asic.h> extern int opcd_rc632_reg_write(struct rfid_asic_handle *hdl, - u_int8_t addr, u_int8_t data); + uint8_t addr, uint8_t data); extern int opcd_rc632_fifo_write(struct rfid_asic_handle *hdl, - u_int8_t len, u_int8_t *data, u_int8_t flags); + uint8_t len, uint8_t *data, uint8_t flags); extern int opcd_rc632_reg_read(struct rfid_asic_handle *hdl, - u_int8_t addr, u_int8_t *val); + uint8_t addr, uint8_t *val); extern int opcd_rc632_fifo_read(struct rfid_asic_handle *hdl, - u_int8_t max_len, u_int8_t *data); + uint8_t max_len, uint8_t *data); extern int opcd_rc632_clear_bits(struct rfid_asic_handle *hdl, - u_int8_t reg, u_int8_t bits); + uint8_t reg, uint8_t bits); extern int opcd_rc632_set_bits(struct rfid_asic_handle *hdl, - u_int8_t reg, u_int8_t bits); + uint8_t reg, uint8_t bits); extern void rc632_init(void); extern void rc632_exit(void); @@ -27,6 +27,6 @@ extern void rc632_unthrottle(void); extern int rc632_test(struct rfid_asic_handle *hdl); extern int rc632_dump(void); -extern void rc632_power(u_int8_t up); +extern void rc632_power(uint8_t up); #endif diff --git a/firmware/src/pcd/rc632_highlevel.c b/firmware/src/pcd/rc632_highlevel.c index 14a2a2a..af101b7 100644 --- a/firmware/src/pcd/rc632_highlevel.c +++ b/firmware/src/pcd/rc632_highlevel.c @@ -49,10 +49,10 @@ struct rfid_asic rc632; static int rc632_set_bit_mask(struct rfid_asic_handle *handle, - u_int8_t reg, u_int8_t mask, u_int8_t val) + uint8_t reg, uint8_t mask, uint8_t val) { int ret; - u_int8_t tmp; + uint8_t tmp; ret = opcd_rc632_reg_read(handle, reg, &tmp); if (ret < 0) @@ -98,10 +98,10 @@ rc632_power_down(struct rfid_asic_handle *handle) int rc632_write_eeprom(struct rfid_asic_handle *handle, - u_int16_t addr, u_int8_t len, u_int8_t *data) + uint16_t addr, uint8_t len, uint8_t *data) { - u_int8_t sndbuf[MAX_WRITE_LEN + 2]; - u_int8_t reg; + uint8_t sndbuf[MAX_WRITE_LEN + 2]; + uint8_t reg; int ret; if (len > MAX_WRITE_LEN) @@ -146,11 +146,11 @@ rc632_write_eeprom(struct rfid_asic_handle *handle, } int -rc632_read_eeprom(struct rfid_asic_handle *handle, u_int16_t addr, u_int8_t len, - u_int8_t *recvbuf) +rc632_read_eeprom(struct rfid_asic_handle *handle, uint16_t addr, uint8_t len, + uint8_t *recvbuf) { - u_int8_t sndbuf[3]; - u_int8_t err; + uint8_t sndbuf[3]; + uint8_t err; int ret; sndbuf[0] = (addr & 0xff); @@ -187,8 +187,8 @@ rc632_read_eeprom(struct rfid_asic_handle *handle, u_int16_t addr, u_int8_t len, #define RC632_E2_RS_MAX_P 14 int rc632_get_serial(struct rfid_asic_handle *handle, - u_int32_t *serial) + uint32_t *serial) { return rc632_read_eeprom(handle, RC632_E2_PRODUCT_SERIAL, - 4, (u_int8_t *)serial); + 4, (uint8_t *)serial); } diff --git a/firmware/src/pcd/rc632_highlevel.h b/firmware/src/pcd/rc632_highlevel.h index 40e80e0..169f47a 100644 --- a/firmware/src/pcd/rc632_highlevel.h +++ b/firmware/src/pcd/rc632_highlevel.h @@ -11,9 +11,9 @@ int rc632_turn_off_rf(struct rfid_asic_handle *handle); int -rc632_read_eeprom(struct rfid_asic_handle *handle, u_int16_t addr, u_int8_t len, - u_int8_t *recvbuf); +rc632_read_eeprom(struct rfid_asic_handle *handle, uint16_t addr, uint8_t len, + uint8_t *recvbuf); int rc632_get_serial(struct rfid_asic_handle *handle, - u_int32_t *serial); + uint32_t *serial); #endif /* _RC632_HIGHLEVEL_H */ |