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/dfu/dfu.c | 74 ++++++++++++++--------------- firmware/src/dfu/dfu.h | 8 ++-- firmware/src/os/blinkcode.c | 2 +- firmware/src/os/dbgu.c | 2 +- firmware/src/os/fifo.c | 14 +++--- firmware/src/os/fifo.h | 26 +++++------ firmware/src/os/flash.c | 18 +++---- firmware/src/os/flash.h | 2 +- firmware/src/os/pcd_enumerate.c | 20 ++++---- firmware/src/os/pio_irq.c | 28 +++++------ firmware/src/os/pio_irq.h | 10 ++-- firmware/src/os/pit.c | 10 ++-- firmware/src/os/pit.h | 2 +- firmware/src/os/pwm.c | 20 ++++---- firmware/src/os/pwm.h | 4 +- firmware/src/os/req_ctx.c | 6 +-- firmware/src/os/req_ctx.h | 10 ++-- firmware/src/os/system_irq.c | 4 +- firmware/src/os/system_irq.h | 2 +- firmware/src/os/tc_cdiv.c | 2 +- firmware/src/os/tc_cdiv.h | 2 +- firmware/src/os/usb_handler.c | 4 +- firmware/src/os/usb_handler.h | 4 +- firmware/src/os/usbcmd_generic.c | 12 ++--- firmware/src/os/usbcmd_generic.h | 4 +- firmware/src/os/wdt.c | 2 +- firmware/src/pcd.h | 10 ++-- firmware/src/pcd/main_librfid.c | 28 +++++------ firmware/src/pcd/main_mifare.c | 30 ++++++------ firmware/src/pcd/main_presence.c | 20 ++++---- firmware/src/pcd/main_pwm.c | 22 ++++----- firmware/src/pcd/main_reqa.c | 16 +++---- firmware/src/pcd/rc632.c | 80 ++++++++++++++++---------------- firmware/src/pcd/rc632.h | 14 +++--- firmware/src/pcd/rc632_highlevel.c | 22 ++++----- firmware/src/pcd/rc632_highlevel.h | 6 +-- 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 +- firmware/src/simtrace/iso7816_uart.c | 56 +++++++++++----------- firmware/src/simtrace/main_factory.c | 2 +- firmware/src/simtrace/prod_info.c | 20 ++++---- firmware/src/simtrace/prod_info.h | 4 +- firmware/src/simtrace/sim_switch.c | 4 +- firmware/src/simtrace/spi_flash.c | 64 ++++++++++++------------- firmware/src/simtrace/spi_flash.h | 10 ++-- firmware/src/simtrace/tc_etu.c | 14 +++--- firmware/src/simtrace/tc_etu.h | 4 +- 65 files changed, 441 insertions(+), 441 deletions(-) (limited to 'firmware/src') diff --git a/firmware/src/dfu/dfu.c b/firmware/src/dfu/dfu.c index 9d1ad10..da5635d 100644 --- a/firmware/src/dfu/dfu.c +++ b/firmware/src/dfu/dfu.c @@ -72,9 +72,9 @@ static int past_manifest = 0; static int switch_to_ram = 0; /* IRQ handler requests main to jump to RAM */ -static u_int16_t usb_if_nr = 0; /* last SET_INTERFACE */ -static u_int16_t usb_if_alt_nr = 0; /* last SET_INTERFACE AltSetting */ -static u_int16_t usb_if_alt_nr_dnload = 0; /* AltSetting during last dnload */ +static uint16_t usb_if_nr = 0; /* last SET_INTERFACE */ +static uint16_t usb_if_alt_nr = 0; /* last SET_INTERFACE AltSetting */ +static uint16_t usb_if_alt_nr_dnload = 0; /* AltSetting during last dnload */ static void __dfufunc udp_init(void) { @@ -96,11 +96,11 @@ static void __dfufunc udp_init(void) static void __dfufunc udp_ep0_send_zlp(void); /* Send Data through the control endpoint */ -static void __dfufunc udp_ep0_send_data(const char *pData, u_int32_t length, - u_int32_t window_length) +static void __dfufunc udp_ep0_send_data(const char *pData, uint32_t length, + uint32_t window_length) { AT91PS_UDP pUdp = AT91C_BASE_UDP; - u_int32_t cpt = 0, len_remain; + uint32_t cpt = 0, len_remain; AT91_REG csr; len_remain = MIN(length, window_length); @@ -147,12 +147,12 @@ static void __dfufunc udp_ep0_send_data(const char *pData, u_int32_t length, } /* receive data from EP0 */ -static int __dfufunc udp_ep0_recv_data(u_int8_t *data, u_int16_t len) +static int __dfufunc udp_ep0_recv_data(uint8_t *data, uint16_t len) { AT91PS_UDP pUdp = AT91C_BASE_UDP; AT91_REG csr; - u_int16_t i, num_rcv; - u_int32_t num_rcv_total = 0; + uint16_t i, num_rcv; + uint32_t num_rcv_total = 0; do { /* FIXME: do we need to check whether we've been interrupted @@ -206,10 +206,10 @@ static void __dfufunc udp_ep0_send_stall(void) static int first_download = 1; -static u_int8_t *ptr, *ptr_max; -static __dfudata u_int8_t dfu_status; -__dfudata u_int32_t dfu_state = DFU_STATE_appIDLE; -static u_int32_t pagebuf32[AT91C_IFLASH_PAGE_SIZE/4]; +static uint8_t *ptr, *ptr_max; +static __dfudata uint8_t dfu_status; +__dfudata uint32_t dfu_state = DFU_STATE_appIDLE; +static uint32_t pagebuf32[AT91C_IFLASH_PAGE_SIZE/4]; static void chk_first_dnload_set_ptr(void) { @@ -218,25 +218,25 @@ static void chk_first_dnload_set_ptr(void) switch (usb_if_alt_nr) { case 0: - ptr = (u_int8_t *) AT91C_IFLASH + SAM7DFU_SIZE; + ptr = (uint8_t *) AT91C_IFLASH + SAM7DFU_SIZE; ptr_max = AT91C_IFLASH + AT91C_IFLASH_SIZE - ENVIRONMENT_SIZE; break; case 1: - ptr = (u_int8_t *) AT91C_IFLASH; + ptr = (uint8_t *) AT91C_IFLASH; ptr_max = AT91C_IFLASH + SAM7DFU_SIZE; break; case 2: - ptr = (u_int8_t *) AT91C_ISRAM + SAM7DFU_RAM_SIZE; + ptr = (uint8_t *) AT91C_ISRAM + SAM7DFU_RAM_SIZE; ptr_max = AT91C_ISRAM + AT91C_ISRAM_SIZE; break; } first_download = 0; } -static int __dfufunc handle_dnload_flash(u_int16_t __unused val, u_int16_t len) +static int __dfufunc handle_dnload_flash(uint16_t __unused val, uint16_t len) { - volatile u_int32_t *p; - u_int8_t *pagebuf = (u_int8_t *) pagebuf32; + volatile uint32_t *p; + uint8_t *pagebuf = (uint8_t *) pagebuf32; int i; DEBUGE("download "); @@ -257,7 +257,7 @@ static int __dfufunc handle_dnload_flash(u_int16_t __unused val, u_int16_t len) return RET_STALL; } chk_first_dnload_set_ptr(); - p = (volatile u_int32_t *)ptr; + p = (volatile uint32_t *)ptr; if (len == 0) { DEBUGP("zero-size write -> MANIFEST_SYNC "); @@ -293,13 +293,13 @@ static int __dfufunc handle_dnload_flash(u_int16_t __unused val, u_int16_t len) flash_page(p-1); } } - ptr = (u_int8_t *) p; + ptr = (uint8_t *) p; #endif return RET_ZLP; } -static int __dfufunc handle_dnload_ram(u_int16_t __unused val, u_int16_t len) +static int __dfufunc handle_dnload_ram(uint16_t __unused val, uint16_t len) { DEBUGE("download "); @@ -339,7 +339,7 @@ static int __dfufunc handle_dnload_ram(u_int16_t __unused val, u_int16_t len) return RET_ZLP; } -static int __dfufunc handle_dnload(u_int16_t val, u_int16_t len) +static int __dfufunc handle_dnload(uint16_t val, uint16_t len) { usb_if_alt_nr_dnload = usb_if_alt_nr; switch (usb_if_alt_nr) { @@ -350,8 +350,8 @@ static int __dfufunc handle_dnload(u_int16_t val, u_int16_t len) } } -#define AT91C_IFLASH_END ((u_int8_t *)AT91C_IFLASH + AT91C_IFLASH_SIZE) -static __dfufunc int handle_upload(u_int16_t __unused val, u_int16_t len) +#define AT91C_IFLASH_END ((uint8_t *)AT91C_IFLASH + AT91C_IFLASH_SIZE) +static __dfufunc int handle_upload(uint16_t __unused val, uint16_t len) { DEBUGE("upload "); if (len > AT91C_IFLASH_PAGE_SIZE) { @@ -364,7 +364,7 @@ static __dfufunc int handle_upload(u_int16_t __unused val, u_int16_t len) chk_first_dnload_set_ptr(); if (ptr + len > AT91C_IFLASH_END) { - len = AT91C_IFLASH_END - (u_int8_t *)ptr; + len = AT91C_IFLASH_END - (uint8_t *)ptr; first_download = 1; } @@ -377,7 +377,7 @@ static __dfufunc int handle_upload(u_int16_t __unused val, u_int16_t len) static __dfufunc void handle_getstatus(void) { struct dfu_status dstat; - u_int32_t fsr = AT91F_MC_EFC_GetStatus(AT91C_BASE_MC); + uint32_t fsr = AT91F_MC_EFC_GetStatus(AT91C_BASE_MC); DEBUGE("getstatus(fsr=0x%08x) ", fsr); @@ -416,15 +416,15 @@ static __dfufunc void handle_getstatus(void) static void __dfufunc handle_getstate(void) { - u_int8_t u8 = dfu_state; + uint8_t u8 = dfu_state; DEBUGE("getstate "); udp_ep0_send_data((char *)&u8, sizeof(u8), sizeof(u8)); } /* callback function for DFU requests */ -int __dfufunc dfu_ep0_handler(u_int8_t __unused req_type, u_int8_t req, - u_int16_t val, u_int16_t len) +int __dfufunc dfu_ep0_handler(uint8_t __unused req_type, uint8_t req, + uint16_t val, uint16_t len) { int rc, ret = RET_NOTHING; @@ -473,11 +473,11 @@ int __dfufunc dfu_ep0_handler(u_int8_t __unused req_type, u_int8_t req, goto out; } dfu_state = DFU_STATE_dfuDNLOAD_SYNC; - ptr = (u_int8_t *) AT91C_IFLASH + SAM7DFU_SIZE; + ptr = (uint8_t *) AT91C_IFLASH + SAM7DFU_SIZE; ret = handle_dnload(val, len); break; case USB_REQ_DFU_UPLOAD: - ptr = (u_int8_t *) AT91C_IFLASH + SAM7DFU_SIZE; + ptr = (uint8_t *) AT91C_IFLASH + SAM7DFU_SIZE; dfu_state = DFU_STATE_dfuUPLOAD_IDLE; handle_upload(val, len); break; @@ -652,7 +652,7 @@ out: return 0; } -static u_int8_t cur_config; +static uint8_t cur_config; /* USB DFU Device descriptor in DFU mode */ __dfustruct const struct usb_device_descriptor dfu_dev_descriptor = { @@ -749,9 +749,9 @@ __dfustruct const struct _dfu_desc dfu_cfg_descriptor = { static __dfufunc void dfu_udp_ep0_handler(void) { AT91PS_UDP pUDP = AT91C_BASE_UDP; - u_int8_t bmRequestType, bRequest; - u_int16_t wValue, wIndex, wLength, wStatus; - u_int32_t csr = pUDP->UDP_CSR[0]; + uint8_t bmRequestType, bRequest; + uint16_t wValue, wIndex, wLength, wStatus; + uint32_t csr = pUDP->UDP_CSR[0]; DEBUGE("CSR=0x%04x ", csr); @@ -798,7 +798,7 @@ static __dfufunc void dfu_udp_ep0_handler(void) /* Handle supported standard device request Cf Table 9-3 in USB * speciication Rev 1.1 */ switch ((bRequest << 8) | bmRequestType) { - u_int8_t desc_type, desc_index; + uint8_t desc_type, desc_index; case STD_GET_DESCRIPTOR: DEBUGE("GET_DESCRIPTOR "); desc_type = wValue >> 8; diff --git a/firmware/src/dfu/dfu.h b/firmware/src/dfu/dfu.h index 27c63b5..fa07281 100644 --- a/firmware/src/dfu/dfu.h +++ b/firmware/src/dfu/dfu.h @@ -124,13 +124,13 @@ struct _dfu_desc { struct dfuapi { void (*udp_init)(void); - void (*ep0_send_data)(const char *data, u_int32_t len, u_int32_t wlen); + void (*ep0_send_data)(const char *data, uint32_t len, uint32_t wlen); void (*ep0_send_zlp)(void); void (*ep0_send_stall)(void); - int (*dfu_ep0_handler)(u_int8_t req_type, u_int8_t req, - u_int16_t val, u_int16_t len); + int (*dfu_ep0_handler)(uint8_t req_type, uint8_t req, + uint16_t val, uint16_t len); void (*dfu_switch)(void); - u_int32_t *dfu_state; + uint32_t *dfu_state; const struct usb_device_descriptor *dfu_dev_descriptor; const struct _dfu_desc *dfu_cfg_descriptor; }; diff --git a/firmware/src/os/blinkcode.c b/firmware/src/os/blinkcode.c index 22d4b25..9e88716 100644 --- a/firmware/src/os/blinkcode.c +++ b/firmware/src/os/blinkcode.c @@ -28,7 +28,7 @@ struct blinker { enum blinkcode_state state; int num; int cur; - u_int8_t led; + uint8_t led; }; static struct blinker blink_state[NUM_LEDS]; diff --git a/firmware/src/os/dbgu.c b/firmware/src/os/dbgu.c index 72eaa88..7f1df44 100644 --- a/firmware/src/os/dbgu.c +++ b/firmware/src/os/dbgu.c @@ -78,7 +78,7 @@ static void Send_reset(void) //* Object : C handler interrupt function called by the sysirq //* demultiplexer //*---------------------------------------------------------------------------- -static void DBGU_irq_handler(u_int32_t sr) +static void DBGU_irq_handler(uint32_t sr) { static char value; diff --git a/firmware/src/os/fifo.c b/firmware/src/os/fifo.c index c30ba10..40aa0d0 100644 --- a/firmware/src/os/fifo.c +++ b/firmware/src/os/fifo.c @@ -58,7 +58,7 @@ void fifo_check_raise_int(struct fifo *fifo) } -u_int16_t fifo_data_put(struct fifo *fifo, u_int16_t len, u_int8_t *data) +uint16_t fifo_data_put(struct fifo *fifo, uint16_t len, uint8_t *data) { if (len > fifo_available(fifo)) { len = fifo_available(fifo); @@ -71,7 +71,7 @@ u_int16_t fifo_data_put(struct fifo *fifo, u_int16_t len, u_int8_t *data) fifo->producer += len; } else { /* difficult: wrap around */ - u_int16_t chunk_len; + uint16_t chunk_len; chunk_len = fifo->size - fifo->producer; memcpy(&fifo->data[fifo->producer], data, chunk_len); @@ -86,9 +86,9 @@ u_int16_t fifo_data_put(struct fifo *fifo, u_int16_t len, u_int8_t *data) } -u_int16_t fifo_data_get(struct fifo *fifo, u_int16_t len, u_int8_t *data) +uint16_t fifo_data_get(struct fifo *fifo, uint16_t len, uint8_t *data) { - u_int16_t avail = fifo_available(fifo); + uint16_t avail = fifo_available(fifo); if (avail < len) len = avail; @@ -98,7 +98,7 @@ u_int16_t fifo_data_get(struct fifo *fifo, u_int16_t len, u_int8_t *data) memcpy(data, &fifo->data[fifo->consumer], len); } else { /* difficult case: wrap */ - u_int16_t chunk_len = fifo->size - fifo->consumer; + uint16_t chunk_len = fifo->size - fifo->consumer; memcpy(data, &fifo->data[fifo->consumer], chunk_len); memcpy(data+chunk_len, &fifo->data[0], len - chunk_len); } @@ -108,8 +108,8 @@ u_int16_t fifo_data_get(struct fifo *fifo, u_int16_t len, u_int8_t *data) return len; } -int fifo_init(struct fifo *fifo, u_int16_t size, - void (*cb)(struct fifo *fifo, u_int8_t event, void *data), void *cb_data) +int fifo_init(struct fifo *fifo, uint16_t size, + void (*cb)(struct fifo *fifo, uint8_t event, void *data), void *cb_data) { if (size > sizeof(fifo->data)) return -EINVAL; diff --git a/firmware/src/os/fifo.h b/firmware/src/os/fifo.h index d91c6c2..0b2f8e7 100644 --- a/firmware/src/os/fifo.h +++ b/firmware/src/os/fifo.h @@ -6,23 +6,23 @@ #define FIFO_SIZE 1024 struct fifo { - u_int16_t size; /* actual FIFO size, can be smaller than 'data' */ - u_int16_t producer; /* index of producer */ - u_int16_t consumer; /* index of consumer */ - u_int16_t watermark; - u_int8_t irq; - u_int8_t irq_en; - u_int8_t status; - void (*callback)(struct fifo *fifo, u_int8_t event, void *data); + uint16_t size; /* actual FIFO size, can be smaller than 'data' */ + uint16_t producer; /* index of producer */ + uint16_t consumer; /* index of consumer */ + uint16_t watermark; + uint8_t irq; + uint8_t irq_en; + uint8_t status; + void (*callback)(struct fifo *fifo, uint8_t event, void *data); void *cb_data; - u_int8_t data[FIFO_SIZE]; + uint8_t data[FIFO_SIZE]; }; -extern int fifo_init(struct fifo *fifo, u_int16_t size, - void (*callback)(struct fifo *fifo, u_int8_t event, void *data), void *cb_data); -extern u_int16_t fifo_data_get(struct fifo *fifo, u_int16_t len, u_int8_t *data); -extern u_int16_t fifo_data_put(struct fifo *fifo, u_int16_t len, u_int8_t *data); +extern int fifo_init(struct fifo *fifo, uint16_t size, + void (*callback)(struct fifo *fifo, uint8_t event, void *data), void *cb_data); +extern uint16_t fifo_data_get(struct fifo *fifo, uint16_t len, uint8_t *data); +extern uint16_t fifo_data_put(struct fifo *fifo, uint16_t len, uint8_t *data); extern int fifo_available(struct fifo *fifo); #endif diff --git a/firmware/src/os/flash.c b/firmware/src/os/flash.c index c729ff8..dabc033 100644 --- a/firmware/src/os/flash.c +++ b/firmware/src/os/flash.c @@ -13,34 +13,34 @@ #define EFCS_CMD_CLEAR_NVM_BIT 0xd #define EFCS_CMD_SET_SECURITY_BIT 0xf -static u_int16_t page_from_ramaddr(const void *addr) +static uint16_t page_from_ramaddr(const void *addr) { - u_int32_t ramaddr = (u_int32_t) addr; - ramaddr -= (u_int32_t) AT91C_IFLASH; + uint32_t ramaddr = (uint32_t) addr; + ramaddr -= (uint32_t) AT91C_IFLASH; return ((ramaddr >> AT91C_IFLASH_PAGE_SHIFT)); } #define PAGES_PER_LOCKREGION (AT91C_IFLASH_LOCK_REGION_SIZE>>AT91C_IFLASH_PAGE_SHIFT) #define IS_FIRST_PAGE_OF_LOCKREGION(x) ((x % PAGES_PER_LOCKREGION) == 0) #define LOCKREGION_FROM_PAGE(x) (x / PAGES_PER_LOCKREGION) -static int is_page_locked(u_int16_t page) +static int is_page_locked(uint16_t page) { - u_int16_t lockregion = LOCKREGION_FROM_PAGE(page); + uint16_t lockregion = LOCKREGION_FROM_PAGE(page); return (AT91C_BASE_MC->MC_FSR & (lockregion << 16)); } -static void unlock_page(u_int16_t page) +static void unlock_page(uint16_t page) { page &= 0x3ff; AT91F_MC_EFC_PerformCmd(AT91C_BASE_MC, AT91C_MC_FCMD_UNLOCK | AT91C_MC_CORRECT_KEY | (page << 8)); } -void flash_page(u_int8_t *addr) +void flash_page(uint8_t *addr) { - u_int16_t page = page_from_ramaddr(addr) & 0x3ff; - u_int32_t fsr = AT91F_MC_EFC_GetStatus(AT91C_BASE_MC); + uint16_t page = page_from_ramaddr(addr) & 0x3ff; + uint32_t fsr = AT91F_MC_EFC_GetStatus(AT91C_BASE_MC); DEBUGP("flash_page(0x%x=%u) ", addr, page); if (is_page_locked(page)) { diff --git a/firmware/src/os/flash.h b/firmware/src/os/flash.h index b812714..b31d167 100644 --- a/firmware/src/os/flash.h +++ b/firmware/src/os/flash.h @@ -1,5 +1,5 @@ #ifndef _FLASH_H #define _FLASH_H -extern void flash_page(u_int8_t *addr); +extern void flash_page(uint8_t *addr); extern void flash_init(void); #endif diff --git a/firmware/src/os/pcd_enumerate.c b/firmware/src/os/pcd_enumerate.c index 403cef9..0daa2c8 100644 --- a/firmware/src/os/pcd_enumerate.c +++ b/firmware/src/os/pcd_enumerate.c @@ -94,8 +94,8 @@ static const struct dfuapi *dfu = DFU_API_LOCATION; static struct udp_pcd upcd; struct epstate { - u_int32_t state_busy; - u_int32_t state_pending; + uint32_t state_busy; + uint32_t state_pending; }; static const struct epstate epstate[] = { @@ -140,7 +140,7 @@ void udp_unthrottle(void) int udp_refill_ep(int ep) { - u_int16_t i; + uint16_t i; AT91PS_UDP pUDP = upcd.pUdp; struct req_ctx *rctx; unsigned int start, end; @@ -231,7 +231,7 @@ int udp_refill_ep(int ep) static void udp_irq(void) { - u_int32_t csr; + uint32_t csr; AT91PS_UDP pUDP = upcd.pUdp; AT91_REG isr = pUDP->UDP_ISR; @@ -270,8 +270,8 @@ static void udp_irq(void) udp_ep0_handler(); } if (isr & AT91C_UDP_EPINT1) { - u_int32_t cur_rcv_bank = upcd.cur_rcv_bank; - u_int16_t i, pkt_size; + uint32_t cur_rcv_bank = upcd.cur_rcv_bank; + uint16_t i, pkt_size; struct req_ctx *rctx; csr = pUDP->UDP_CSR[1]; @@ -471,9 +471,9 @@ void udp_reset(void) static void udp_ep0_handler(void) { AT91PS_UDP pUDP = upcd.pUdp; - u_int8_t bmRequestType, bRequest; - u_int16_t wValue, wIndex, wLength, wStatus; - u_int32_t csr = pUDP->UDP_CSR[0]; + uint8_t bmRequestType, bRequest; + uint16_t wValue, wIndex, wLength, wStatus; + uint32_t csr = pUDP->UDP_CSR[0]; DEBUGE("CSR=0x%04x ", csr); @@ -521,7 +521,7 @@ static void udp_ep0_handler(void) /* Handle supported standard device request Cf Table 9-3 in USB * speciication Rev 1.1 */ switch ((bRequest << 8) | bmRequestType) { - u_int8_t desc_type, desc_index; + uint8_t desc_type, desc_index; case STD_GET_DESCRIPTOR: DEBUGE("GET_DESCRIPTOR(wValue=0x%04x, wIndex=0x%04x) ", wValue, wIndex); diff --git a/firmware/src/os/pio_irq.c b/firmware/src/os/pio_irq.c index d11bd47..921fdf3 100644 --- a/firmware/src/os/pio_irq.c +++ b/firmware/src/os/pio_irq.c @@ -27,17 +27,17 @@ struct pioirq_state { irq_handler_t *handlers[NR_PIO]; - u_int32_t usbmask; - u_int32_t usb_throttled; /* atomic? */ + uint32_t usbmask; + uint32_t usb_throttled; /* atomic? */ }; static struct pioirq_state pirqs; /* low-level handler, used by Cstartup_app.S PIOA fast forcing and * by regular interrupt handler below */ -void __ramfunc __pio_irq_demux(u_int32_t pio) +void __ramfunc __pio_irq_demux(uint32_t pio) { - u_int8_t send_usb = 0; + uint8_t send_usb = 0; int i; //DEBUGPCRF("PIO_ISR_STATUS = 0x%08x", pio); @@ -59,15 +59,15 @@ void __ramfunc __pio_irq_demux(u_int32_t pio) pirqs.usb_throttled = 1; } else { struct openpcd_hdr *opcdh; - u_int32_t *regmask; + uint32_t *regmask; opcdh = (struct openpcd_hdr *) irq_rctx->data; - regmask = (u_int32_t *) (irq_rctx->data + sizeof(*opcdh)); + regmask = (uint32_t *) (irq_rctx->data + sizeof(*opcdh)); opcdh->cmd = OPENPCD_CMD_PIO_IRQ; opcdh->reg = 0x00; opcdh->flags = 0x00; opcdh->val = 0x00; - irq_rctx->tot_len = sizeof(*opcdh) + sizeof(u_int32_t); + irq_rctx->tot_len = sizeof(*opcdh) + sizeof(uint32_t); req_ctx_set_state(irq_rctx, RCTX_STATE_UDP_EP3_PENDING); } } @@ -78,23 +78,23 @@ void __ramfunc __pio_irq_demux(u_int32_t pio) /* regular interrupt handler, in case fast forcing for PIOA disabled */ static void pio_irq_demux(void) { - u_int32_t pio = AT91F_PIO_GetInterruptStatus(AT91C_BASE_PIOA); + uint32_t pio = AT91F_PIO_GetInterruptStatus(AT91C_BASE_PIOA); __pio_irq_demux(pio); } -void pio_irq_enable(u_int32_t pio) +void pio_irq_enable(uint32_t pio) { AT91F_PIO_InterruptEnable(AT91C_BASE_PIOA, pio); } -void pio_irq_disable(u_int32_t pio) +void pio_irq_disable(uint32_t pio) { AT91F_PIO_InterruptDisable(AT91C_BASE_PIOA, pio); } -int pio_irq_register(u_int32_t pio, irq_handler_t *handler) +int pio_irq_register(uint32_t pio, irq_handler_t *handler) { - u_int8_t num = ffs(pio); + uint8_t num = ffs(pio); if (num == 0) return -EINVAL; @@ -111,9 +111,9 @@ int pio_irq_register(u_int32_t pio, irq_handler_t *handler) return 0; } -void pio_irq_unregister(u_int32_t pio) +void pio_irq_unregister(uint32_t pio) { - u_int8_t num = ffs(pio); + uint8_t num = ffs(pio); if (num == 0) return; diff --git a/firmware/src/os/pio_irq.h b/firmware/src/os/pio_irq.h index 33f4656..b782821 100644 --- a/firmware/src/os/pio_irq.h +++ b/firmware/src/os/pio_irq.h @@ -2,12 +2,12 @@ #define _PIO_IRQ_H #define NR_PIO 32 -typedef void irq_handler_t(u_int32_t pio); +typedef void irq_handler_t(uint32_t pio); -extern void pio_irq_enable(u_int32_t pio); -extern void pio_irq_disable(u_int32_t pio); -extern int pio_irq_register(u_int32_t pio, irq_handler_t *func); -extern void pio_irq_unregister(u_int32_t pio); +extern void pio_irq_enable(uint32_t pio); +extern void pio_irq_disable(uint32_t pio); +extern int pio_irq_register(uint32_t pio, irq_handler_t *func); +extern void pio_irq_unregister(uint32_t pio); extern void pio_irq_init(void); #endif diff --git a/firmware/src/os/pit.c b/firmware/src/os/pit.c index 50ec19f..e442265 100644 --- a/firmware/src/os/pit.c +++ b/firmware/src/os/pit.c @@ -103,7 +103,7 @@ void timer_add(struct timer_list *tl) local_irq_restore(flags); } -static void pit_irq(u_int32_t sr) +static void pit_irq(uint32_t sr) { struct timer_list *tl, *next; @@ -125,21 +125,21 @@ static void pit_irq(u_int32_t sr) } } -void pit_mdelay(u_int32_t ms) +void pit_mdelay(uint32_t ms) { - u_int32_t end; + uint32_t end; end = (AT91F_PITGetPIIR(AT91C_BASE_PITC) + ms) % 20; while (end < AT91F_PITGetPIIR(AT91C_BASE_PITC)) { } } -void mdelay(u_int32_t ms) +void mdelay(uint32_t ms) { return pit_mdelay(ms); } -void usleep(u_int32_t us) +void usleep(uint32_t us) { return; return pit_mdelay(us/1000); diff --git a/firmware/src/os/pit.h b/firmware/src/os/pit.h index 4a25cc1..4ac717e 100644 --- a/firmware/src/os/pit.h +++ b/firmware/src/os/pit.h @@ -20,6 +20,6 @@ extern void timer_add(struct timer_list *timer); extern int timer_del(struct timer_list *timer); extern void pit_init(void); -extern void pit_mdelay(u_int32_t ms); +extern void pit_mdelay(uint32_t ms); #endif diff --git a/firmware/src/os/pwm.c b/firmware/src/os/pwm.c index 70858bb..14b9b6c 100644 --- a/firmware/src/os/pwm.c +++ b/firmware/src/os/pwm.c @@ -42,7 +42,7 @@ static AT91PS_PWMC pwm = AT91C_BASE_PWMC; /* find highest bit set. returns bit (32..1) or 0 in case no bit set */ -static int fhs(u_int32_t val) +static int fhs(uint32_t val) { int i; @@ -55,16 +55,16 @@ static int fhs(u_int32_t val) } /* set frequency of PWM signal to freq */ -int pwm_freq_set(int channel, u_int32_t freq) +int pwm_freq_set(int channel, uint32_t freq) { /* in order to get maximum resolution, the pre-scaler must be set to * something like freq << 16. However, the mimimum pre-scaled frequency * we can get is MCLK (48MHz), the minimum is MCLK/(1024*255) = * 48MHz/261120 = 183Hz */ - u_int32_t overall_div; - u_int32_t presc_total; - u_int8_t cpre = 0; - u_int16_t cprd; + uint32_t overall_div; + uint32_t presc_total; + uint8_t cpre = 0; + uint16_t cprd; if (freq > MCLK) return -ERANGE; @@ -104,9 +104,9 @@ void pwm_stop(int channel) AT91F_PWMC_StopChannel(AT91C_BASE_PWMC, (1 << channel)); } -void pwm_duty_set_percent(int channel, u_int16_t duty) +void pwm_duty_set_percent(int channel, uint16_t duty) { - u_int32_t tmp = pwm->PWMC_CH[channel].PWMC_CPRDR & 0xffff; + uint32_t tmp = pwm->PWMC_CH[channel].PWMC_CPRDR & 0xffff; tmp = tmp << 16; /* extend value by 2^16 */ tmp = tmp / 100; /* tmp = 1 % of extended cprd */ @@ -120,7 +120,7 @@ void pwm_duty_set_percent(int channel, u_int16_t duty) static int pwm_usb_in(struct req_ctx *rctx) { struct openpcd_hdr *poh = (struct openpcd_hdr *) rctx->data; - u_int32_t *freq; + uint32_t *freq; switch (poh->cmd) { case OPENPCD_CMD_PWM_ENABLE: @@ -138,7 +138,7 @@ static int pwm_usb_in(struct req_ctx *rctx) case OPENPCD_CMD_PWM_FREQ_SET: if (rctx->tot_len < sizeof(*poh)+4) break; - freq = (u_int32_t *) ((unsigned char *) poh) + sizeof(*poh); + freq = (uint32_t *) ((unsigned char *) poh) + sizeof(*poh); pwm_freq_set(0, *freq); break; case OPENPCD_CMD_PWM_FREQ_GET: diff --git a/firmware/src/os/pwm.h b/firmware/src/os/pwm.h index 8836c32..bde34f6 100644 --- a/firmware/src/os/pwm.h +++ b/firmware/src/os/pwm.h @@ -1,10 +1,10 @@ #ifndef _PWM_H #define _PWM_H -extern void pwm_freq_set(int channel, u_int32_t freq); +extern void pwm_freq_set(int channel, uint32_t freq); extern void pwm_start(int channel); extern void pwm_stop(int channel); -extern void pwm_duty_set_percent(int channel, u_int16_t duty); +extern void pwm_duty_set_percent(int channel, uint16_t duty); extern void pwm_init(void); extern void pwm_fini(void); diff --git a/firmware/src/os/req_ctx.c b/firmware/src/os/req_ctx.c index 722c099..9aba813 100644 --- a/firmware/src/os/req_ctx.c +++ b/firmware/src/os/req_ctx.c @@ -38,8 +38,8 @@ #define NUM_REQ_CTX (NUM_RCTX_SMALL+NUM_RCTX_LARGE) -static u_int8_t rctx_data[NUM_RCTX_SMALL][RCTX_SIZE_SMALL]; -static u_int8_t rctx_data_large[NUM_RCTX_LARGE][RCTX_SIZE_LARGE]; +static uint8_t rctx_data[NUM_RCTX_SMALL][RCTX_SIZE_SMALL]; +static uint8_t rctx_data_large[NUM_RCTX_LARGE][RCTX_SIZE_LARGE]; static struct req_ctx req_ctx[NUM_REQ_CTX]; @@ -79,7 +79,7 @@ struct req_ctx __ramfunc *req_ctx_find_get(int large, return toReturn; } -u_int8_t req_ctx_num(struct req_ctx *ctx) +uint8_t req_ctx_num(struct req_ctx *ctx) { return ctx - req_ctx; } diff --git a/firmware/src/os/req_ctx.h b/firmware/src/os/req_ctx.h index 92c21a7..2b7ca60 100644 --- a/firmware/src/os/req_ctx.h +++ b/firmware/src/os/req_ctx.h @@ -13,11 +13,11 @@ #include struct req_ctx { - volatile u_int32_t state; + volatile uint32_t state; volatile struct req_ctx *prev, *next; - u_int16_t size; - u_int16_t tot_len; - u_int8_t *data; + uint16_t size; + uint16_t tot_len; + uint8_t *data; }; #define RCTX_STATE_FREE 0 @@ -45,7 +45,7 @@ extern struct req_ctx __ramfunc *req_ctx_find_get(int large, unsigned long old_s extern struct req_ctx *req_ctx_find_busy(void); extern void req_ctx_set_state(struct req_ctx *ctx, unsigned long new_state); extern void req_ctx_put(struct req_ctx *ctx); -extern u_int8_t req_ctx_num(struct req_ctx *ctx); +extern uint8_t req_ctx_num(struct req_ctx *ctx); unsigned int req_ctx_count(unsigned long state); #endif /* _REQ_CTX_H */ diff --git a/firmware/src/os/system_irq.c b/firmware/src/os/system_irq.c index 4c1da31..5f76ea8 100644 --- a/firmware/src/os/system_irq.c +++ b/firmware/src/os/system_irq.c @@ -31,9 +31,9 @@ static sysirq_hdlr *sysirq_hdlrs[AT91SAM7_SYSIRQ_COUNT]; -void sys_irq(u_int32_t previous_pc) +void sys_irq(uint32_t previous_pc) { - u_int32_t sr; + uint32_t sr; /* Somehow Atmel decided to do really stupid interrupt sharing * for commonly-used interrupts such as the timer irq */ diff --git a/firmware/src/os/system_irq.h b/firmware/src/os/system_irq.h index 195b7b9..150c378 100644 --- a/firmware/src/os/system_irq.h +++ b/firmware/src/os/system_irq.h @@ -14,7 +14,7 @@ enum sysirqs { AT91SAM7_SYSIRQ_COUNT }; -typedef void sysirq_hdlr(u_int32_t sr); +typedef void sysirq_hdlr(uint32_t sr); extern void sysirq_register(enum sysirqs irq, sysirq_hdlr *hdlr); extern void sysirq_init(void); diff --git a/firmware/src/os/tc_cdiv.c b/firmware/src/os/tc_cdiv.c index 6f06ba5..bc9d5dd 100644 --- a/firmware/src/os/tc_cdiv.c +++ b/firmware/src/os/tc_cdiv.c @@ -31,7 +31,7 @@ static AT91PS_TCB tcb = AT91C_BASE_TCB; /* set carrier divider to a specific */ -void tc_cdiv_set_divider(u_int16_t div) +void tc_cdiv_set_divider(uint16_t div) { tcb->TCB_TC0.TC_RC = div; diff --git a/firmware/src/os/tc_cdiv.h b/firmware/src/os/tc_cdiv.h index 4f2bc02..86882fb 100644 --- a/firmware/src/os/tc_cdiv.h +++ b/firmware/src/os/tc_cdiv.h @@ -7,7 +7,7 @@ static AT91PS_TCB tcb; extern void tc_cdiv_phase_add(int16_t inc); -extern void tc_cdiv_set_divider(u_int16_t div); +extern void tc_cdiv_set_divider(uint16_t div); static inline void tc_cdiv_phase_inc(void) { diff --git a/firmware/src/os/usb_handler.c b/firmware/src/os/usb_handler.c index 029891a..52abd64 100644 --- a/firmware/src/os/usb_handler.c +++ b/firmware/src/os/usb_handler.c @@ -33,13 +33,13 @@ static usb_cmd_fn *cmd_hdlrs[16]; -int usb_hdlr_register(usb_cmd_fn *hdlr, u_int8_t class) +int usb_hdlr_register(usb_cmd_fn *hdlr, uint8_t class) { cmd_hdlrs[class] = hdlr; return 0; } -void usb_hdlr_unregister(u_int8_t class) +void usb_hdlr_unregister(uint8_t class) { cmd_hdlrs[class] = NULL; } diff --git a/firmware/src/os/usb_handler.h b/firmware/src/os/usb_handler.h index 9d5ad48..52814fd 100644 --- a/firmware/src/os/usb_handler.h +++ b/firmware/src/os/usb_handler.h @@ -18,8 +18,8 @@ enum usbapi_err { typedef int usb_cmd_fn(struct req_ctx *rctx); -extern int usb_hdlr_register(usb_cmd_fn *hdlr, u_int8_t class); -extern void usb_hdlr_unregister(u_int8_t class); +extern int usb_hdlr_register(usb_cmd_fn *hdlr, uint8_t class); +extern void usb_hdlr_unregister(uint8_t class); extern void usb_in_process(void); extern void usb_out_process(void); diff --git a/firmware/src/os/usbcmd_generic.c b/firmware/src/os/usbcmd_generic.c index aff13eb..c76bcc1 100644 --- a/firmware/src/os/usbcmd_generic.c +++ b/firmware/src/os/usbcmd_generic.c @@ -18,14 +18,14 @@ #define OPENPCD_API_VERSION (0x01) #define CONFIG_AREA_ADDR ((void*)(AT91C_IFLASH + AT91C_IFLASH_SIZE - ENVIRONMENT_SIZE)) -#define CONFIG_AREA_WORDS ( AT91C_IFLASH_PAGE_SIZE/sizeof(u_int32_t) ) +#define CONFIG_AREA_WORDS ( AT91C_IFLASH_PAGE_SIZE/sizeof(uint32_t) ) -volatile u_int32_t config_stack[ CONFIG_AREA_WORDS ]; +volatile uint32_t config_stack[ CONFIG_AREA_WORDS ]; static int gen_setenv(const void* buffer,int len) { volatile unsigned int i; - u_int32_t *dst; + uint32_t *dst; if( len >= sizeof(config_stack) ) len=sizeof(config_stack); @@ -35,7 +35,7 @@ static int gen_setenv(const void* buffer,int len) /* retrieve current content to allow partial flashing */ /* flash changes */ - dst=(u_int32_t*)CONFIG_AREA_ADDR; + dst=(uint32_t*)CONFIG_AREA_ADDR; for(i=0;idata; struct openpcd_compile_version *ver = (struct openpcd_compile_version *)poh->data; - u_int32_t len = rctx->tot_len-sizeof(*poh); + uint32_t len = rctx->tot_len-sizeof(*poh); /* initialize transmit length to header length */ rctx->tot_len = sizeof(*poh); @@ -107,7 +107,7 @@ static int gen_usb_rx(struct req_ctx *rctx) poh->flags |= OPENPCD_FLAG_RESPOND; #ifdef PCD rctx->tot_len += 4; - if (rc632_get_serial(NULL, (u_int32_t *)poh->data) < 0) { + if (rc632_get_serial(NULL, (uint32_t *)poh->data) < 0) { DEBUGP("ERROR) "); return USB_ERR(USB_ERR_CMD_NOT_IMPL); } diff --git a/firmware/src/os/usbcmd_generic.h b/firmware/src/os/usbcmd_generic.h index 4dd0456..61fbd36 100644 --- a/firmware/src/os/usbcmd_generic.h +++ b/firmware/src/os/usbcmd_generic.h @@ -1,6 +1,6 @@ #ifndef _USBAPI_GENERIC_H #define _USBAPI_GENERIC_H extern void usbcmd_gen_init(void); -extern int gen_setenv(void* data,u_int32_t pos,u_int32_t length); -extern int gen_getenv(void* data,u_int32_t pos,u_int32_t length); +extern int gen_setenv(void* data,uint32_t pos,uint32_t length); +extern int gen_getenv(void* data,uint32_t pos,uint32_t length); #endif diff --git a/firmware/src/os/wdt.c b/firmware/src/os/wdt.c index d5c19a3..6e5248e 100644 --- a/firmware/src/os/wdt.c +++ b/firmware/src/os/wdt.c @@ -30,7 +30,7 @@ #undef WDT_DEBUG #endif/*WDT_DEBUG*/ -static void wdt_irq(u_int32_t sr) +static void wdt_irq(uint32_t sr) { if (sr & 1) AT91F_DBGU_Frame("================> WATCHDOG EXPIRED !!!!!\n\r"); diff --git a/firmware/src/pcd.h b/firmware/src/pcd.h index 77c99b2..0a5585f 100644 --- a/firmware/src/pcd.h +++ b/firmware/src/pcd.h @@ -7,9 +7,9 @@ #include struct opcd_cmd_hdr { - u_int8_t cmd; - u_int8_t arg1; - u_int16_t arg2; + uint8_t cmd; + uint8_t arg1; + uint16_t arg2; } __attribute__ ((packed)); enum opcd_cmd { @@ -28,8 +28,8 @@ enum opcd_cmd { }; struct opcd_status_hdr { - u_int8_t cause, /* interrupt cause register RC632 */ - u_int8_t prim_status, /* primary status register RC632 */ + uint8_t cause, /* interrupt cause register RC632 */ + uint8_t prim_status, /* primary status register RC632 */ } __attribute__ ((packed)); #endif /* _OPENPCD_H */ 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 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 */ 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 diff --git a/firmware/src/simtrace/iso7816_uart.c b/firmware/src/simtrace/iso7816_uart.c index 9e8ace9..aa85d6e 100644 --- a/firmware/src/simtrace/iso7816_uart.c +++ b/firmware/src/simtrace/iso7816_uart.c @@ -85,22 +85,22 @@ enum pts_state { struct iso7816_3_handle { enum iso7816_3_state state; - u_int8_t fi; - u_int8_t di; - u_int8_t wi; - u_int32_t waiting_time; + uint8_t fi; + uint8_t di; + uint8_t wi; + uint32_t waiting_time; enum atr_state atr_state; - u_int8_t atr_idx; - u_int8_t atr_hist_len; - u_int8_t atr_last_td; - u_int8_t atr[64]; + uint8_t atr_idx; + uint8_t atr_hist_len; + uint8_t atr_last_td; + uint8_t atr[64]; - u_int16_t prot_t_supported; + uint16_t prot_t_supported; enum pts_state pts_state; - u_int8_t pts_req[6]; - u_int8_t pts_resp[6]; + uint8_t pts_req[6]; + uint8_t pts_resp[6]; struct simtrace_hdr sh; @@ -114,13 +114,13 @@ struct iso7816_3_handle isoh; /* Table 6 from ISO 7816-3 */ -static const u_int16_t fi_table[] = { +static const uint16_t fi_table[] = { 372, 372, 558, 744, 1116, 1488, 1860, 0, 0, 512, 768, 1024, 1536, 2048, 0, 0 }; /* Table 7 from ISO 7816-3 */ -static const u_int8_t di_table[] = { +static const uint8_t di_table[] = { 0, 1, 2, 4, 8, 16, 32, 64, 12, 20, 2, 4, 8, 16, 32, 64, }; @@ -154,9 +154,9 @@ struct simtrace_stats *iso_uart_stats_get(void) } /* compute the F/D ratio based on Fi and Di values */ -static int compute_fidi_ratio(u_int8_t fi, u_int8_t di) +static int compute_fidi_ratio(uint8_t fi, uint8_t di) { - u_int16_t f, d; + uint16_t f, d; int ret; if (fi >= ARRAY_SIZE(fi_table) || @@ -314,7 +314,7 @@ transition_to_tck(struct iso7816_3_handle *ih) } /* determine the next ATR state based on received interface byte */ -static enum atr_state next_intb_state(struct iso7816_3_handle *ih, u_int8_t ch) +static enum atr_state next_intb_state(struct iso7816_3_handle *ih, uint8_t ch) { switch (ih->atr_state) { case ATR_S_WAIT_TD: @@ -359,7 +359,7 @@ from_tc: /* process an incomng ATR byte */ static enum iso7816_3_state -process_byte_atr(struct iso7816_3_handle *ih, u_int8_t byte) +process_byte_atr(struct iso7816_3_handle *ih, uint8_t byte) { /* add byte to ATR buffer */ ih->atr[ih->atr_idx] = byte; @@ -412,9 +412,9 @@ static void set_pts_state(struct iso7816_3_handle *ih, enum pts_state new_ptss) /* Determine the next PTS state */ static enum pts_state next_pts_state(struct iso7816_3_handle *ih) { - u_int8_t is_resp = ih->pts_state & 0x10; - u_int8_t sstate = ih->pts_state & 0x0f; - u_int8_t *pts_ptr; + uint8_t is_resp = ih->pts_state & 0x10; + uint8_t sstate = ih->pts_state & 0x0f; + uint8_t *pts_ptr; if (!is_resp) pts_ptr = ih->pts_req; @@ -453,7 +453,7 @@ from_pts3: } static enum iso7816_3_state -process_byte_pts(struct iso7816_3_handle *ih, u_int8_t byte) +process_byte_pts(struct iso7816_3_handle *ih, uint8_t byte) { switch (ih->pts_state) { case PTS_S_WAIT_REQ_PTSS: @@ -510,7 +510,7 @@ process_byte_pts(struct iso7816_3_handle *ih, u_int8_t byte) return ISO7816_S_IN_PTS; } -static void process_byte(struct iso7816_3_handle *ih, u_int8_t byte) +static void process_byte(struct iso7816_3_handle *ih, uint8_t byte) { int new_state = -1; struct req_ctx *rctx; @@ -589,7 +589,7 @@ void iso_uart_flush(void) void iso_uart_idleflush(void) { static struct req_ctx *last_req = NULL; - static u_int16_t last_len = 0; + static uint16_t last_len = 0; if (last_req == isoh.rctx && last_len == isoh.rctx->tot_len && @@ -603,8 +603,8 @@ void iso_uart_idleflush(void) static __ramfunc void usart_irq(void) { - u_int32_t csr = usart->US_CSR; - u_int8_t octet; + uint32_t csr = usart->US_CSR; + uint8_t octet; //DEBUGP("USART IRQ, CSR=0x%08x\n", csr); @@ -620,7 +620,7 @@ static __ramfunc void usart_irq(void) } if (csr & (AT91C_US_PARE|AT91C_US_FRAME|AT91C_US_OVRE)) { - u_int8_t nb_err = usart->US_NER; + uint8_t nb_err = usart->US_NER; /* FIXME: some error has occurrerd */ //DEBUGP("NER=%02x ", nb_err); /* clear the status */ @@ -641,7 +641,7 @@ static __ramfunc void usart_irq(void) } /* handler for the RST input pin state change */ -static void reset_pin_irq(u_int32_t pio) +static void reset_pin_irq(uint32_t pio) { if (!AT91F_PIO_IsInputSet(AT91C_BASE_PIOA, pio)) { /* make sure to flush pending req_ctx */ @@ -659,7 +659,7 @@ static void reset_pin_irq(u_int32_t pio) void iso_uart_dump(void) { - u_int32_t csr = usart->US_CSR; + uint32_t csr = usart->US_CSR; DEBUGPCR("USART CSR=0x%08x", csr); } diff --git a/firmware/src/simtrace/main_factory.c b/firmware/src/simtrace/main_factory.c index 7a491ed..502feb2 100644 --- a/firmware/src/simtrace/main_factory.c +++ b/firmware/src/simtrace/main_factory.c @@ -72,7 +72,7 @@ int _main_dbgu(char key) break; case 'P': { - u_int32_t version; + uint32_t version; int rc = prod_info_get(&version, NULL); if (rc >= 0) DEBUGPCR("Version: 0x%08x\n", version); diff --git a/firmware/src/simtrace/prod_info.c b/firmware/src/simtrace/prod_info.c index 87ef6e2..ef2e8eb 100644 --- a/firmware/src/simtrace/prod_info.c +++ b/firmware/src/simtrace/prod_info.c @@ -38,17 +38,17 @@ struct simtrace_prod_info { /* magic value */ - u_int32_t magic; + uint32_t magic; /* unix timestamp of production date (0=unknown) */ - u_int32_t production_ts; + uint32_t production_ts; /* hardware version */ - u_int32_t version; + uint32_t version; /* re-works applied */ - u_int32_t reworks; + uint32_t reworks; } __attribute__((packed)); -int prod_info_write(u_int32_t ts, u_int32_t version, u_int32_t reworks) +int prod_info_write(uint32_t ts, uint32_t version, uint32_t reworks) { struct simtrace_prod_info pi = { .magic = PRODINFO_MAGIC, @@ -56,8 +56,8 @@ int prod_info_write(u_int32_t ts, u_int32_t version, u_int32_t reworks) .version = version, .reworks = reworks, }; - u_int8_t *pi8 = (u_int8_t *) π - u_int32_t addr = OTP_ADDR(OTP_REGION_PRODINFO); + uint8_t *pi8 = (uint8_t *) π + uint32_t addr = OTP_ADDR(OTP_REGION_PRODINFO); unsigned int rc; int i; @@ -80,12 +80,12 @@ int prod_info_write(u_int32_t ts, u_int32_t version, u_int32_t reworks) return rc; } -int prod_info_get(u_int32_t *ver, u_int32_t *reworks) +int prod_info_get(uint32_t *ver, uint32_t *reworks) { struct simtrace_prod_info pi; - u_int32_t addr = OTP_ADDR(OTP_REGION_PRODINFO); + uint32_t addr = OTP_ADDR(OTP_REGION_PRODINFO); - spiflash_otp_read(addr, (u_int8_t *) &pi, sizeof(pi)); + spiflash_otp_read(addr, (uint8_t *) &pi, sizeof(pi)); if (pi.magic != PRODINFO_MAGIC) return -1; diff --git a/firmware/src/simtrace/prod_info.h b/firmware/src/simtrace/prod_info.h index 7a12421..796ee7a 100644 --- a/firmware/src/simtrace/prod_info.h +++ b/firmware/src/simtrace/prod_info.h @@ -6,7 +6,7 @@ ((c & 0xff) << 0)) -int prod_info_write(u_int32_t ts, u_int32_t version, u_int32_t reworks); -int prod_info_get(u_int32_t *ver, u_int32_t *reworks); +int prod_info_write(uint32_t ts, uint32_t version, uint32_t reworks); +int prod_info_get(uint32_t *ver, uint32_t *reworks); #endif diff --git a/firmware/src/simtrace/sim_switch.c b/firmware/src/simtrace/sim_switch.c index 90067ac..36f9f0c 100644 --- a/firmware/src/simtrace/sim_switch.c +++ b/firmware/src/simtrace/sim_switch.c @@ -48,7 +48,7 @@ void sim_switch_mode(int connect_io, int connect_misc) AT91F_PIO_SetOutput(AT91C_BASE_PIOA, SIMTRACE_PIO_SC_SW); } -static void sw_sim_irq(u_int32_t pio) +static void sw_sim_irq(uint32_t pio) { if (!AT91F_PIO_IsInputSet(AT91C_BASE_PIOA, SIMTRACE_PIO_SW_SIM)) @@ -57,7 +57,7 @@ static void sw_sim_irq(u_int32_t pio) DEBUGPCR("SIM card removed"); } -static void vcc_phone_irq(u_int32_t pio) +static void vcc_phone_irq(uint32_t pio) { if (!AT91F_PIO_IsInputSet(AT91C_BASE_PIOA, SIMTRACE_PIO_VCC_PHONE)) { DEBUGPCR("VCC_PHONE off"); diff --git a/firmware/src/simtrace/spi_flash.c b/firmware/src/simtrace/spi_flash.c index ffda1b2..10c6fa7 100644 --- a/firmware/src/simtrace/spi_flash.c +++ b/firmware/src/simtrace/spi_flash.c @@ -88,15 +88,15 @@ void spiflash_write_protect(int on) static __ramfunc void spi_irq(void) { - u_int32_t status = pSPI->SPI_SR; + uint32_t status = pSPI->SPI_SR; AT91F_AIC_ClearIt(AT91C_BASE_AIC, AT91C_ID_SPI); } -static const u_int8_t chipid_s25fl032p[3] = { 0x01, 0x02, 0x15 }; +static const uint8_t chipid_s25fl032p[3] = { 0x01, 0x02, 0x15 }; -static u_int8_t chip_id[3]; -static u_int32_t otp_supported; +static uint8_t chip_id[3]; +static uint32_t otp_supported; void spiflash_init(void) { @@ -141,13 +141,13 @@ void spiflash_init(void) otp_supported = 1; } -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, u_int16_t rx_skip) +static int spi_transceive(const uint8_t *tx_data, uint16_t tx_len, + uint8_t *rx_data, uint16_t *rx_len, uint16_t rx_skip) { - u_int16_t tx_cur = 0; - u_int16_t rx_len_max = 0; - u_int16_t rx_cnt = 0; - u_int8_t tmp; + uint16_t tx_cur = 0; + uint16_t rx_len_max = 0; + uint16_t rx_cnt = 0; + uint8_t tmp; DEBUGPSPI("spi_transceive: enter(tx_len=%u) ", tx_len); @@ -161,7 +161,7 @@ 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; + uint32_t sr = pSPI->SPI_SR; if (sr & AT91C_SPI_RDRF) { tmp = pSPI->SPI_RDR; rx_cnt++; @@ -199,11 +199,11 @@ static int spi_transceive(const u_int8_t *tx_data, u_int16_t tx_len, return 0; } -void spiflash_get_id(u_int8_t *id) +void spiflash_get_id(uint8_t *id) { - const u_int8_t tx_data[] = { SPIF_CMD_RDID, 0, 0, 0 }; - u_int8_t rx_data[] = { 0,0,0,0 }; - u_int16_t rx_len = sizeof(rx_data); + const uint8_t tx_data[] = { SPIF_CMD_RDID, 0, 0, 0 }; + uint8_t rx_data[] = { 0,0,0,0 }; + uint16_t rx_len = sizeof(rx_data); spi_transceive(tx_data, sizeof(tx_data), rx_data, &rx_len, 1); DEBUGPSPI("SPI ID: %02x %02x %02x\r\n", @@ -213,9 +213,9 @@ void spiflash_get_id(u_int8_t *id) int spiflash_read_status(void) { - const u_int8_t tx_data[] = { SPIF_CMD_RDSR, 0 }; - u_int8_t rx_data[1]; - u_int16_t rx_len = sizeof(rx_data); + const uint8_t tx_data[] = { SPIF_CMD_RDSR, 0 }; + uint8_t rx_data[1]; + uint16_t rx_len = sizeof(rx_data); spi_transceive(tx_data, sizeof(tx_data), rx_data, &rx_len, 1); @@ -226,14 +226,14 @@ int spiflash_read_status(void) void spiflash_clear_status(void) { - const u_int8_t tx_data[] = { SPIF_CMD_CLSR }; + const uint8_t tx_data[] = { SPIF_CMD_CLSR }; spi_transceive(tx_data, sizeof(tx_data), NULL, 0, 0); } int spiflash_write_enable(int enable) { - u_int8_t tx_data[1]; + uint8_t tx_data[1]; if (enable) tx_data[0] = SPIF_CMD_WREN; @@ -245,9 +245,9 @@ int spiflash_write_enable(int enable) return 0; } -int spiflash_otp_read(u_int32_t otp_addr, u_int8_t *out, u_int16_t rx_len) +int spiflash_otp_read(uint32_t otp_addr, uint8_t *out, uint16_t rx_len) { - u_int8_t tx_data[] = { SPIF_CMD_OTPR, 0, 0, 0, 0 }; + uint8_t tx_data[] = { SPIF_CMD_OTPR, 0, 0, 0, 0 }; if (!otp_supported) { DEBUGP("OTP not supported!\r\n"); @@ -269,9 +269,9 @@ int spiflash_otp_read(u_int32_t otp_addr, u_int8_t *out, u_int16_t rx_len) return rx_len; } -int spiflash_otp_write(u_int32_t otp_addr, u_int8_t data) +int spiflash_otp_write(uint32_t otp_addr, uint8_t data) { - u_int8_t tx_data[] = { SPIF_CMD_OTPP, 0, 0, 0, 0 }; + uint8_t tx_data[] = { SPIF_CMD_OTPP, 0, 0, 0, 0 }; if (!otp_supported) { DEBUGP("OTP not supported!\r\n"); @@ -293,7 +293,7 @@ int spiflash_otp_write(u_int32_t otp_addr, u_int8_t data) return 0; } -static int otp_region2addr(u_int8_t region) +static int otp_region2addr(uint8_t region) { /* see Figure 10.1 of S25FL032P data sheet */ if (region > 31 || region < 1) @@ -308,7 +308,7 @@ static int otp_region2addr(u_int8_t region) return 0x112; } -static int otp_region2bit(u_int8_t region) +static int otp_region2bit(uint8_t region) { /* see Figure 10.1 of S25FL032P data sheet */ if (region > 31 || region < 1) @@ -323,10 +323,10 @@ static int otp_region2bit(u_int8_t region) return region - 1; } -int spiflash_otp_get_lock(u_int8_t region) +int spiflash_otp_get_lock(uint8_t region) { - u_int32_t addr; - u_int8_t bit, data; + uint32_t addr; + uint8_t bit, data; if (region > 31 || region < 1) return -1; @@ -342,10 +342,10 @@ int spiflash_otp_get_lock(u_int8_t region) return 0; } -int spiflash_otp_set_lock(u_int8_t region) +int spiflash_otp_set_lock(uint8_t region) { - u_int32_t addr; - u_int8_t bit; + uint32_t addr; + uint8_t bit; if (region > 31 || region < 1) return -1; diff --git a/firmware/src/simtrace/spi_flash.h b/firmware/src/simtrace/spi_flash.h index d823130..1654eec 100644 --- a/firmware/src/simtrace/spi_flash.h +++ b/firmware/src/simtrace/spi_flash.h @@ -6,14 +6,14 @@ #define OTP_ADDR(x) (0x114 + ( ((x) - 1) * 16 ) ) void spiflash_init(void); -void spiflash_get_id(u_int8_t *id); +void spiflash_get_id(uint8_t *id); int spiflash_read_status(void); void spiflash_clear_status(void); void spiflash_write_protect(int on); int spiflash_write_enable(int enable); -int spiflash_otp_read(u_int32_t otp_addr, u_int8_t *out, u_int16_t rx_len); -int spiflash_otp_write(u_int32_t otp_addr, u_int8_t data); -int spiflash_otp_get_lock(u_int8_t region); -int spiflash_otp_set_lock(u_int8_t region); +int spiflash_otp_read(uint32_t otp_addr, uint8_t *out, uint16_t rx_len); +int spiflash_otp_write(uint32_t otp_addr, uint8_t data); +int spiflash_otp_get_lock(uint8_t region); +int spiflash_otp_set_lock(uint8_t region); #endif diff --git a/firmware/src/simtrace/tc_etu.c b/firmware/src/simtrace/tc_etu.c index fc52033..88be665 100644 --- a/firmware/src/simtrace/tc_etu.c +++ b/firmware/src/simtrace/tc_etu.c @@ -26,14 +26,14 @@ static AT91PS_TCB tcb; static AT91PS_TC tcetu = AT91C_BASE_TC0; -static u_int16_t waiting_time = 9600; -static u_int16_t clocks_per_etu = 372; -static u_int16_t wait_events; +static uint16_t waiting_time = 9600; +static uint16_t clocks_per_etu = 372; +static uint16_t wait_events; static __ramfunc void tc_etu_irq(void) { - u_int32_t sr = tcetu->TC_SR; - static u_int16_t nr_events; + uint32_t sr = tcetu->TC_SR; + static uint16_t nr_events; if (sr & AT91C_TC_ETRGS) { /* external trigger, i.e. we have seen a bit on I/O */ @@ -73,14 +73,14 @@ static void recalc_nr_events(void) tcetu->TC_RC = clocks_per_etu * 12; } -void tc_etu_set_wtime(u_int16_t wtime) +void tc_etu_set_wtime(uint16_t wtime) { waiting_time = wtime; recalc_nr_events(); //DEBUGPCR("wtime=%u, actually waiting %u", wtime, wait_events * 12); } -void tc_etu_set_etu(u_int16_t etu) +void tc_etu_set_etu(uint16_t etu) { clocks_per_etu = etu; recalc_nr_events(); diff --git a/firmware/src/simtrace/tc_etu.h b/firmware/src/simtrace/tc_etu.h index 59d9031..ee1458d 100644 --- a/firmware/src/simtrace/tc_etu.h +++ b/firmware/src/simtrace/tc_etu.h @@ -1,4 +1,4 @@ -void tc_etu_set_wtime(u_int16_t wtime); -void tc_etu_set_etu(u_int16_t etu); +void tc_etu_set_wtime(uint16_t wtime); +void tc_etu_set_etu(uint16_t etu); void tc_etu_init(void); -- cgit v1.2.3