Converted u8_t to uint8_t and u16_t to uint16_t in the cpu directory.

This commit is contained in:
Nicholas J Humfrey 2012-02-20 18:42:51 +00:00 committed by Mariano Alvira
parent 372de7d08a
commit 1cda3da17e
46 changed files with 208 additions and 206 deletions

View File

@ -44,7 +44,7 @@
#if CTK_CONF_MOUSE_SUPPORT
static struct mouse_pos pos;
static u8_t okay;
static uint8_t okay;
/*-----------------------------------------------------------------------------------*/
void

View File

@ -77,7 +77,7 @@ AUTOSTART_PROCESSES(&dhcp_process);
/*-----------------------------------------------------------------------------------*/
static char *
makebyte(u8_t byte, char *str)
makebyte(uint8_t byte, char *str)
{
if(byte >= 100) {
*str++ = (byte / 100 ) % 10 + '0';

View File

@ -48,7 +48,7 @@ static char * CC_FASTCALL
ipaddrtoa(uip_ipaddr_t *ipaddr, char *buffer)
{
char *ptr = buffer;
u8_t i;
uint8_t i;
for(i = 0; i < 4; ++i) {
*ptr = '.';

View File

@ -44,7 +44,7 @@
PROCESS(ethernet_process, "Ethernet driver");
/*---------------------------------------------------------------------------*/
u8_t
uint8_t
ethernet_output(void)
{
uip_arp_out();

View File

@ -37,12 +37,12 @@
#include "contiki.h"
struct ethernet_config {
u16_t addr;
uint16_t addr;
char name[12+1];
};
PROCESS_NAME(ethernet_process);
u8_t ethernet_output(void);
uint8_t ethernet_output(void);
#endif /* __ETHERNET_DRV_H__ */

View File

@ -46,11 +46,11 @@
struct {
char signature[4];
struct uip_eth_addr ethernet_address;
u8_t *buffer;
u16_t buffer_size;
void __fastcall__ (* init)(u16_t reg);
u16_t (* poll)(void);
void __fastcall__ (* send)(u16_t len);
uint8_t *buffer;
uint16_t buffer_size;
void __fastcall__ (* init)(uint16_t reg);
uint16_t (* poll)(void);
void __fastcall__ (* send)(uint16_t len);
void (* exit)(void);
} *module;
@ -63,7 +63,7 @@ ethernet_init(struct ethernet_config *config)
#ifndef ETHERNET
struct mod_ctrl module_control = {cfs_read};
u8_t byte;
uint8_t byte;
module_control.callerdata = cfs_open(config->name, CFS_READ);
if(module_control.callerdata < 0) {
@ -103,7 +103,7 @@ ethernet_init(struct ethernet_config *config)
uip_setethaddr(module->ethernet_address);
}
/*---------------------------------------------------------------------------*/
u16_t
uint16_t
ethernet_poll(void)
{
return module->poll();

View File

@ -37,7 +37,7 @@
#define __ETHERNET_H__
void CC_FASTCALL ethernet_init(struct ethernet_config *config);
u16_t ethernet_poll(void);
uint16_t ethernet_poll(void);
void ethernet_send(void);
void ethernet_exit(void);

View File

@ -43,7 +43,7 @@
/*-----------------------------------------------------------------------------------*/
#pragma optimize(push, off)
void
uip_add32(u8_t *op32, u16_t op16)
uip_add32(uint8_t *op32, uint16_t op16)
{
asm("ldy #3");
asm("jsr ldaxysp");
@ -71,12 +71,12 @@ uip_add32(u8_t *op32, u16_t op16)
}
#pragma optimize(pop)
/*-----------------------------------------------------------------------------------*/
static u16_t chksum_ptr, chksum_len, chksum_tmp;
static u8_t chksum_protocol;
static u16_t chksum(void);
static uint16_t chksum_ptr, chksum_len, chksum_tmp;
static uint8_t chksum_protocol;
static uint16_t chksum(void);
/*-----------------------------------------------------------------------------------*/
#pragma optimize(push, off)
u16_t
uint16_t
chksum(void) {
asm("lda #0");
@ -172,14 +172,14 @@ chksum(void) {
}
#pragma optimize(pop)
/*-----------------------------------------------------------------------------------*/
u16_t
uip_chksum(u16_t *buf, u16_t len)
uint16_t
uip_chksum(uint16_t *buf, uint16_t len)
{
/* unsigned long sum;
sum = 0;
chksum_ptr = (u16_t)buf;
chksum_ptr = (uint16_t)buf;
while(len >= 256) {
chksum_len = 256;
sum += chksum();
@ -199,28 +199,28 @@ uip_chksum(u16_t *buf, u16_t len)
return sum;*/
chksum_len = len;
chksum_ptr = (u16_t)buf;
chksum_ptr = (uint16_t)buf;
return chksum();
}
/*-----------------------------------------------------------------------------------*/
u16_t
uint16_t
uip_ipchksum(void)
{
chksum_ptr = (u16_t)uip_buf + UIP_LLH_LEN;
chksum_ptr = (uint16_t)uip_buf + UIP_LLH_LEN;
chksum_len = UIP_IPH_LEN;
return chksum();
}
/*-----------------------------------------------------------------------------------*/
#pragma optimize(push, off)
static u16_t
transport_chksum(u8_t protocol)
static uint16_t
transport_chksum(uint8_t protocol)
{
chksum_protocol = protocol;
chksum_ptr = (u16_t)&uip_buf[UIP_LLH_LEN + UIP_IPH_LEN];
chksum_ptr = (uint16_t)&uip_buf[UIP_LLH_LEN + UIP_IPH_LEN];
chksum_len = UIP_TCPH_LEN;
chksum_tmp = chksum();
chksum_ptr = (u16_t)uip_appdata;
chksum_ptr = (uint16_t)uip_appdata;
asm("lda _uip_aligned_buf+3+%b", UIP_LLH_LEN);
asm("sec");
asm("sbc #%b", UIP_IPTCPH_LEN);
@ -313,16 +313,16 @@ transport_chksum(u8_t protocol)
#pragma optimize(pop)
/*-----------------------------------------------------------------------------------*/
u16_t
uint16_t
uip_tcpchksum(void)
{
return transport_chksum(IP_PROTO_TCP);
#if 0
chksum_ptr = (u16_t)&uip_buf[UIP_LLH_LEN + UIP_IPH_LEN];
chksum_ptr = (uint16_t)&uip_buf[UIP_LLH_LEN + UIP_IPH_LEN];
chksum_len = UIP_TCPH_LEN;
chksum_tmp = chksum();
chksum_ptr = (u16_t)uip_appdata;
chksum_ptr = (uint16_t)uip_appdata;
asm("lda _uip_buf+3+%b", UIP_LLH_LEN);
asm("sec");
asm("sbc #%b", UIP_IPTCPH_LEN);
@ -416,16 +416,16 @@ uip_tcpchksum(void)
/*-----------------------------------------------------------------------------------*/
#if UIP_UDP_CHECKSUMS
u16_t
uint16_t
uip_udpchksum(void)
{
return transport_chksum(IP_PROTO_UDP);
#if 0
chksum_ptr = (u16_t)&uip_buf[20 + UIP_LLH_LEN];
chksum_ptr = (uint16_t)&uip_buf[20 + UIP_LLH_LEN];
chksum_len = 20;
chksum_tmp = chksum();
chksum_ptr = (u16_t)uip_appdata;
chksum_ptr = (uint16_t)uip_appdata;
asm("lda _uip_buf+3+%b", UIP_LLH_LEN);
asm("sec");
asm("sbc #40");

View File

@ -106,18 +106,18 @@ static const char *err_msgs[] =
#define UDPDATASIZE 32
struct codeprop_udphdr {
u16_t id;
u16_t type;
uint16_t id;
uint16_t type;
#define TYPE_DATA 0x0001
#define TYPE_NACK 0x0002
u16_t addr;
u16_t len;
u8_t data[UDPDATASIZE];
uint16_t addr;
uint16_t len;
uint8_t data[UDPDATASIZE];
};
struct codeprop_tcphdr {
u16_t len;
u16_t pad;
uint16_t len;
uint16_t pad;
};
static void uipcall(void *state);
@ -125,19 +125,19 @@ static void uipcall(void *state);
PROCESS(codeprop_process, "Code propagator");
struct codeprop_state {
u8_t state;
uint8_t state;
#define STATE_NONE 0
#define STATE_RECEIVING_TCPDATA 1
#define STATE_RECEIVING_UDPDATA 2
#define STATE_SENDING_UDPDATA 3
u16_t count;
u16_t addr;
u16_t len;
u16_t id;
uint16_t count;
uint16_t addr;
uint16_t len;
uint16_t id;
struct etimer sendtimer;
struct timer nacktimer, timer, starttimer;
u8_t received;
u8_t send_counter;
uint8_t received;
uint8_t send_counter;
struct pt tcpthread_pt;
struct pt udpthread_pt;
struct pt recv_udpthread_pt;
@ -200,10 +200,10 @@ PROCESS_THREAD(codeprop_process, ev, data)
PROCESS_END();
}
/*---------------------------------------------------------------------*/
static u16_t
static uint16_t
send_udpdata(struct codeprop_udphdr *uh)
{
u16_t len;
uint16_t len;
uh->type = UIP_HTONS(TYPE_DATA);
uh->addr = uip_htons(s.addr);

View File

@ -46,7 +46,7 @@ init_recv_buffer()
recv_buffer.flags = USB_BUFFER_SHORT_END | USB_BUFFER_NOTIFY;
}
u8_t
uint8_t
usbeth_send(void)
{
if ((xmit_buffer[0].flags & USB_BUFFER_SUBMITTED)) return UIP_FW_DROPPED;

View File

@ -315,7 +315,7 @@ static uip_ipaddr_t bcast_addr;
static void
send_offer(struct uip_udp_conn *conn, struct dhcps_client_lease *lease)
{
u8_t *end;
uint8_t *end;
struct dhcp_msg *m = (struct dhcp_msg *)uip_appdata;
create_msg(m);
@ -327,13 +327,13 @@ send_offer(struct uip_udp_conn *conn, struct dhcps_client_lease *lease)
end = add_config(end);
end = add_end(end);
uip_ipaddr_copy(&conn->ripaddr, &bcast_addr);
uip_send(uip_appdata, (int)(end - (u8_t *)uip_appdata));
uip_send(uip_appdata, (int)(end - (uint8_t *)uip_appdata));
}
static void
send_ack(struct uip_udp_conn *conn, struct dhcps_client_lease *lease)
{
u8_t *end;
uint8_t *end;
uip_ipaddr_t ciaddr;
struct dhcp_msg *m = (struct dhcp_msg *)uip_appdata;
@ -347,13 +347,13 @@ send_ack(struct uip_udp_conn *conn, struct dhcps_client_lease *lease)
end = add_end(end);
memcpy(&ciaddr, &lease->ipaddr,4);
uip_ipaddr_copy(&conn->ripaddr, &bcast_addr);
uip_send(uip_appdata, (int)(end - (u8_t *)uip_appdata));
uip_send(uip_appdata, (int)(end - (uint8_t *)uip_appdata));
printf("ACK\n");
}
static void
send_nack(struct uip_udp_conn *conn)
{
u8_t *end;
uint8_t *end;
struct dhcp_msg *m = (struct dhcp_msg *)uip_appdata;
create_msg(m);
@ -364,7 +364,7 @@ send_nack(struct uip_udp_conn *conn)
end = add_end(end);
uip_ipaddr_copy(&conn->ripaddr, &bcast_addr);
uip_send(uip_appdata, (int)(end - (u8_t *)uip_appdata));
uip_send(uip_appdata, (int)(end - (uint8_t *)uip_appdata));
printf("NACK\n");
}

View File

@ -476,17 +476,17 @@
#define MSBV(bit) (1 << ((bit) - 8))
#define nic_outlb(addr, val) (*(volatile u8_t *)(addr) = (val))
#define nic_outhb(addr, val) (*(volatile u8_t *)((addr) + 1) = (val))
#define nic_outwx(addr, val) (*(volatile u16_t *)(addr) = (val))
#define nic_outlb(addr, val) (*(volatile uint8_t *)(addr) = (val))
#define nic_outhb(addr, val) (*(volatile uint8_t *)((addr) + 1) = (val))
#define nic_outwx(addr, val) (*(volatile uint16_t *)(addr) = (val))
#define nic_outw(addr, val) { \
*(volatile u8_t *)(addr) = (u8_t)(val); \
*((volatile u8_t *)(addr) + 1) = (u8_t)((val) >> 8); \
*(volatile uint8_t *)(addr) = (uint8_t)(val); \
*((volatile uint8_t *)(addr) + 1) = (uint8_t)((val) >> 8); \
}
#define nic_inlb(addr) (*(volatile u8_t *)(addr))
#define nic_inhb(addr) (*(volatile u8_t *)((addr) + 1))
#define nic_inw(addr) (*(volatile u16_t *)(addr))
#define nic_inlb(addr) (*(volatile uint8_t *)(addr))
#define nic_inhb(addr) (*(volatile uint8_t *)((addr) + 1))
#define nic_inw(addr) (*(volatile uint16_t *)(addr))
#define nic_bs(bank) nic_outlb(NIC_BSR, bank)
@ -513,11 +513,11 @@
*
* \return Contents of the PHY interface rgister.
*/
static u8_t NicPhyRegSelect(u8_t reg, u8_t we)
static uint8_t NicPhyRegSelect(uint8_t reg, uint8_t we)
{
u8_t rs;
u8_t msk;
u8_t i;
uint8_t rs;
uint8_t msk;
uint8_t i;
nic_bs(3);
rs = (nic_inlb(NIC_MGMT) & ~(MGMT_MCLK | MGMT_MDO)) | MGMT_MDOE;
@ -577,11 +577,11 @@ static u8_t NicPhyRegSelect(u8_t reg, u8_t we)
*
* \return Contents of the specified register.
*/
static u16_t NicPhyRead(u8_t reg)
static uint16_t NicPhyRead(uint8_t reg)
{
u16_t rc = 0;
u8_t rs;
u8_t i;
uint16_t rc = 0;
uint8_t rs;
uint8_t i;
/* Select register for reading. */
rs = NicPhyRegSelect(reg, 0);
@ -613,10 +613,10 @@ static u16_t NicPhyRead(u8_t reg)
* \param reg PHY register number.
* \param val Value to write.
*/
static void NicPhyWrite(u8_t reg, u16_t val)
static void NicPhyWrite(uint8_t reg, uint16_t val)
{
u16_t msk;
u8_t rs;
uint16_t msk;
uint8_t rs;
/* Select register for writing. */
rs = NicPhyRegSelect(reg, 1);
@ -649,10 +649,10 @@ static void NicPhyWrite(u8_t reg, u16_t val)
*/
static int NicPhyConfig(void)
{
u16_t phy_sor;
u16_t phy_sr;
u16_t phy_to;
u16_t mode;
uint16_t phy_sor;
uint16_t phy_sr;
uint16_t phy_to;
uint16_t mode;
/*
* Reset the PHY and wait until this self clearing bit
@ -739,7 +739,7 @@ static int NicPhyConfig(void)
*
* \return 0 on success or -1 on timeout.
*/
static INLINE int NicMmuWait(u16_t tmo)
static INLINE int NicMmuWait(uint16_t tmo)
{
while (tmo--) {
if ((nic_inlb(NIC_MMUCR) & MMUCR_BUSY) == 0)
@ -803,9 +803,9 @@ static int NicReset(void)
*
* \param mac Six byte unique MAC address.
*/
static int NicStart(CONST u8_t * mac)
static int NicStart(CONST uint8_t * mac)
{
u8_t i;
uint8_t i;
if (NicReset())
return -1;
@ -843,8 +843,8 @@ static int NicStart(CONST u8_t * mac)
#if 0
static void NicInterrupt(void *arg)
{
u8_t isr;
u8_t imr;
uint8_t isr;
uint8_t imr;
NICINFO *ni = (NICINFO *) ((NUTDEVICE *) arg)->dev_dcb;
ni->ni_interrupts++;
@ -912,11 +912,11 @@ static void NicInterrupt(void *arg)
/*
* Write data block to the NIC.
*/
static void NicWrite(u8_t * buf, u16_t len)
static void NicWrite(uint8_t * buf, uint16_t len)
{
register u16_t l = len - 1;
register u8_t ih = (u16_t) l >> 8;
register u8_t il = (u8_t) l;
register uint16_t l = len - 1;
register uint8_t ih = (uint16_t) l >> 8;
register uint8_t il = (uint8_t) l;
if (!len)
return;
@ -931,11 +931,11 @@ static void NicWrite(u8_t * buf, u16_t len)
/*
* Read data block from the NIC.
*/
static void NicRead(u8_t * buf, u16_t len)
static void NicRead(uint8_t * buf, uint16_t len)
{
register u16_t l = len - 1;
register u8_t ih = (u16_t) l >> 8;
register u8_t il = (u8_t) l;
register uint16_t l = len - 1;
register uint8_t ih = (uint16_t) l >> 8;
register uint8_t il = (uint8_t) l;
if (!len)
return;
@ -960,9 +960,9 @@ static void NicRead(u8_t * buf, u16_t len)
static NETBUF *NicGetPacket(void)
{
NETBUF *nb = 0;
//u8_t *buf;
u16_t fsw;
u16_t fbc;
//uint8_t *buf;
uint16_t fsw;
uint16_t fbc;
/* Check the fifo empty bit. If it is set, then there is
nothing in the receiver fifo. */
@ -1028,9 +1028,9 @@ static NETBUF *NicGetPacket(void)
#if 0
static int NicPutPacket(NETBUF * nb)
{
u16_t sz;
u8_t odd = 0;
u8_t imsk;
uint16_t sz;
uint8_t odd = 0;
uint8_t imsk;
//printf("[P]");
/*
@ -1130,7 +1130,7 @@ PROCESS_THREAD(lanc111_process, ev, data)
IFNET *ifn;
NICINFO *ni;
NETBUF *nb;*/
u8_t imsk;
uint8_t imsk;
static struct etimer et;
/* dev = arg;

View File

@ -42,7 +42,7 @@
PROCESS(rtl8019_process, "RTL8019 driver");
/*---------------------------------------------------------------------------*/
u8_t
uint8_t
rtl8019_output(void)
{
uip_arp_out();

View File

@ -41,6 +41,6 @@
PROCESS_NAME(rtl8019_process);
u8_t rtl8019_output(void);
uint8_t rtl8019_output(void);
#endif /* __RTL8019_DRV_H__ */

View File

@ -73,7 +73,7 @@ FDEV_SETUP_STREAM(slip_putchar, NULL, _FDEV_SETUP_WRITE);
void
slip_arch_init(unsigned long ubr)
{
u8_t dummy;
uint8_t dummy;
spl_t s = splhigh();
UBRR1L = ubr;

View File

@ -47,7 +47,7 @@ void
mtarch_start(struct mtarch_thread *t,
void (*function)(void *), void *data)
{
u16_t i;
uint16_t i;
for(i = 0; i < MTARCH_STACKSIZE; i++) {
t->stack[i] = i;
@ -57,15 +57,15 @@ mtarch_start(struct mtarch_thread *t,
/* A parameter for method for thread function. */
*t->sp = (u16_t)data;
*t->sp = (uint16_t)data;
--t->sp;
/* This will be a return address of thread function. */
*t->sp = (u16_t)mt_exit;
*t->sp = (uint16_t)mt_exit;
--t->sp;
/* The thread function, is used as a return address of mtarch_switch. */
*t->sp = (u16_t)function;
*t->sp = (uint16_t)function;
--t->sp;
/*
@ -82,7 +82,7 @@ mtarch_start(struct mtarch_thread *t,
}
/*--------------------------------------------------------------------------*/
static struct mtarch_thread *running_thread;
static u16_t *sptmp;
static uint16_t *sptmp;
static void
mtarch_switch()
{
@ -180,7 +180,7 @@ mtarch_pstart()
int
mtarch_stack_usage(struct mtarch_thread *t)
{
u16_t i;
uint16_t i;
for (i = 0; i < MTARCH_STACKSIZE; i++) {
if (t->stack[i] != i) {
return MTARCH_STACKSIZE - i;

View File

@ -48,12 +48,12 @@ struct mtarch_thread {
* On top of the mtarch_thread must be the address for the stack pointer.
* See details at mtarch_switch in mtarch.c
*/
u16_t *sp;
uint16_t *sp;
/*
* Stack is 2-byte wide, so please note that you need 2 * MTARCH_STACKSIZE
* bytes for the stack area for each thread.
*/
u16_t stack[MTARCH_STACKSIZE];
uint16_t stack[MTARCH_STACKSIZE];
};
/*

View File

@ -27,7 +27,7 @@
.area _CODE
;; ---------------------------------
;; void uip_add32(u8_t *op32, u16_t op16);
;; void uip_add32(uint8_t *op32, uint16_t op16);
;; Stack; retl reth op32l op32h op16l op16h
;; ABCDEHL____
;; return void
@ -102,7 +102,7 @@ _uip_add32_nocarry0:
_uip_add32_end::
;; ---------------------------------
;; static u16_t chksum(u16_t sum, const u8_t *data, u16_t len)
;; static uint16_t chksum(uint16_t sum, const uint8_t *data, uint16_t len)
;; Stack; retl reth suml sumh datal datah lenl lenh
;; ABCDEHL____
;; return HL
@ -188,11 +188,11 @@ _uip_arch_chksum_loop_exit:
_uip_arch_chksum_end::
;; ---------------------------------
;; u16_t uip_chksum(void);
;; uint16_t uip_chksum(void);
;; Stack; retl reth datal datah lenl lenh
;; ABCDEHL____
;; return HL
;; return htons(chksum(0, (u8_t *)data, len));
;; return htons(chksum(0, (uint8_t *)data, len));
;; ---------------------------------
_uip_chksum_start::
_uip_chksum:

View File

@ -41,15 +41,15 @@
#include <stddef.h>
#include "uip_arch.h"
static const u16_t sizeof_uip_ipaddr_t = sizeof(uip_ipaddr_t);
static const u16_t offset_tcpip_hdr_len = offsetof(struct uip_tcpip_hdr, len);
static const u16_t offset_tcpip_hdr_srcipaddr = offsetof(struct uip_tcpip_hdr, srcipaddr);
static const uint16_t sizeof_uip_ipaddr_t = sizeof(uip_ipaddr_t);
static const uint16_t offset_tcpip_hdr_len = offsetof(struct uip_tcpip_hdr, len);
static const uint16_t offset_tcpip_hdr_srcipaddr = offsetof(struct uip_tcpip_hdr, srcipaddr);
/*--------------------------------------------------------------------------*/
static void upper_layer_chksum() {
__asm
;; ---------------------------------
;; static u16_t upper_layer_chksum(u8_t proto);
;; static uint16_t upper_layer_chksum(uint8_t proto);
;; Stack; retl reth
;; @param C proto
;; ABCDEHL____
@ -142,12 +142,12 @@ __endasm;
}
/*--------------------------------------------------------------------------*/
u16_t
uint16_t
uip_ipchksum(void)
{
__asm
;; ---------------------------------
;; u16_t uip_ipchksum(void);
;; uint16_t uip_ipchksum(void);
;; Stack; retl reth
;; ABCDEHL____
;; return HL
@ -164,12 +164,12 @@ __endasm;
/*--------------------------------------------------------------------------*/
#if UIP_CONF_IPV6
u16_t
uint16_t
uip_icmp6chksum(void)
{
__asm
;; ---------------------------------
;; u16_t uip_icmp6chksum(void);
;; uint16_t uip_icmp6chksum(void);
;; Stack; retl reth
;; ABCDEHL____
;; return HL
@ -181,12 +181,12 @@ __endasm;
#endif /* UIP_CONF_IPV6 */
/*--------------------------------------------------------------------------*/
u16_t
uint16_t
uip_tcpchksum(void)
{
__asm
;; ---------------------------------
;; u16_t uip_tcpchksum(void);
;; uint16_t uip_tcpchksum(void);
;; Stack; retl reth
;; ABCDEHL____
;; return HL
@ -198,12 +198,12 @@ __endasm;
/*--------------------------------------------------------------------------*/
#if UIP_UDP_CHKSUMS
u16_t
uint16_t
uip_udpchksum(void)
{
__asm
;; ---------------------------------
;; u16_t uip_udpchksum(void);
;; uint16_t uip_udpchksum(void);
;; Stack; retl reth
;; ABCDEHL____
;; return HL

View File

@ -47,12 +47,14 @@ typedef int32_t s32_t;
/* Pre-allocated memory for loadable modules heap space (in bytes)*/
#define MMEM_CONF_SIZE 256
typedef uint32_t clock_time_t;
/* These names are deprecated, use C99 names. */
typedef unsigned char u8_t;
typedef unsigned short u16_t;
typedef unsigned long u32_t;
typedef unsigned short uip_stats_t;
typedef uint32_t clock_time_t;
void clock_delay(unsigned int us2);
void clock_wait(int ms10);
void clock_set_seconds(unsigned long s);

View File

@ -35,8 +35,8 @@
#define BUTTON_MSG_TYPE 1
struct button_msg {
u8_t type;
u8_t value;
uint8_t type;
uint8_t value;
};
void button_init(struct process *proc);

View File

@ -42,18 +42,18 @@
/*---------------------------------------------------------------------------*/
#ifdef UIP_ARCH_IPCHKSUM
#ifdef __IAR_SYSTEMS_ICC__
u16_t
uint16_t
uip_ipchksum(void)
{
return 0;
}
#else
u16_t
uint16_t
uip_ipchksum(void)
{
/* Assumes proper alignement of uip_buf. */
u16_t *p = (u16_t *)&uip_buf[UIP_LLH_LEN];
register u16_t sum;
uint16_t *p = (uint16_t *)&uip_buf[UIP_LLH_LEN];
register uint16_t sum;
sum = p[0];
asmv("add %[p], %[sum]": [sum] "+r" (sum): [p] "m" (p[1]));

View File

@ -48,7 +48,7 @@ PROCESS(tapdev_process, "TAP driver");
/*---------------------------------------------------------------------------*/
#if !UIP_CONF_IPV6
u8_t
uint8_t
tapdev_output(void)
{
uip_arp_out();

View File

@ -38,6 +38,6 @@
PROCESS_NAME(tapdev_process);
u8_t tapdev_output(void);
uint8_t tapdev_output(void);
#endif /* __TAPDEV_DRV_H__ */

View File

@ -122,7 +122,7 @@ tapdev_init(void)
lasttime = 0;
}
/*---------------------------------------------------------------------------*/
u16_t
uint16_t
tapdev_poll(void)
{
fd_set fdset;

View File

@ -38,7 +38,7 @@
#define __TAPDEV_H__
void tapdev_init(void);
u16_t tapdev_poll(void);
uint16_t tapdev_poll(void);
void tapdev_send(void);
void tapdev_exit(void);

View File

@ -77,17 +77,17 @@ static unsigned long lasttime;
#define DEBUG 0
#if DEBUG
#define PRINTF(...) printf(__VA_ARGS__)
#define PRINT6ADDR(addr) PRINTF("%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x", ((u8_t *)addr)[0], ((u8_t *)addr)[1], ((u8_t *)addr)[2], ((u8_t *)addr)[3], ((u8_t *)addr)[4], ((u8_t *)addr)[5], ((u8_t *)addr)[6], ((u8_t *)addr)[7], ((u8_t *)addr)[8], ((u8_t *)addr)[9], ((u8_t *)addr)[10], ((u8_t *)addr)[11], ((u8_t *)addr)[12], ((u8_t *)addr)[13], ((u8_t *)addr)[14], ((u8_t *)addr)[15])
#define PRINT6ADDR(addr) PRINTF("%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x", ((uint8_t *)addr)[0], ((uint8_t *)addr)[1], ((uint8_t *)addr)[2], ((uint8_t *)addr)[3], ((uint8_t *)addr)[4], ((uint8_t *)addr)[5], ((uint8_t *)addr)[6], ((uint8_t *)addr)[7], ((uint8_t *)addr)[8], ((uint8_t *)addr)[9], ((uint8_t *)addr)[10], ((uint8_t *)addr)[11], ((uint8_t *)addr)[12], ((uint8_t *)addr)[13], ((uint8_t *)addr)[14], ((uint8_t *)addr)[15])
#else
#define PRINTF(...)
#define PRINT6ADDR(addr)
#endif
static void do_send(void);
u8_t tapdev_send(uip_lladdr_t *lladdr);
uint8_t tapdev_send(uip_lladdr_t *lladdr);
u16_t
uint16_t
tapdev_poll(void)
{
fd_set fdset;
@ -192,7 +192,7 @@ do_send(void)
}
}
/*---------------------------------------------------------------------------*/
u8_t tapdev_send(uip_lladdr_t *lladdr)
uint8_t tapdev_send(uip_lladdr_t *lladdr)
{
/*
* If L3 dest is multicast, build L2 multicast address

View File

@ -40,8 +40,8 @@
#include "contiki-net.h"
void tapdev_init(void);
u8_t tapdev_send(uip_lladdr_t *lladdr);
u16_t tapdev_poll(void);
uint8_t tapdev_send(uip_lladdr_t *lladdr);
uint16_t tapdev_poll(void);
void tapdev_do_send(void);
void tapdev_exit(void); //math
#endif /* __TAPDEV_H__ */

View File

@ -65,7 +65,7 @@ PROCESS(wpcap_process, "WinPcap driver");
/*---------------------------------------------------------------------------*/
#if !UIP_CONF_IPV6
u8_t
uint8_t
wpcap_output(void)
{
uip_arp_out();

View File

@ -38,6 +38,6 @@
PROCESS_NAME(wpcap_process);
u8_t wpcap_output(void);
uint8_t wpcap_output(void);
#endif /* __WPCAP_DRV_H__ */

View File

@ -185,7 +185,7 @@ init(void)
/* Nothing to do here */
}
/*---------------------------------------------------------------------------*/
u8_t wfall_send(uip_lladdr_t *lladdr);
uint8_t wfall_send(uip_lladdr_t *lladdr);
#if FALLBACK_HAS_ETHERNET_HEADERS
#undef IPBUF
#define IPBUF ((struct uip_tcpip_hdr *)&uip_buf[14])
@ -597,7 +597,7 @@ wpcap_init(void)
}
/*---------------------------------------------------------------------------*/
u16_t
uint16_t
wpcap_poll(void)
{
struct pcap_pkthdr *packet_header;
@ -656,12 +656,12 @@ wpcap_poll(void)
}
// PRINTF("SIN: %lu\n", packet_header->caplen);
CopyMemory(uip_buf, packet, packet_header->caplen);
return (u16_t)packet_header->caplen;
return (uint16_t)packet_header->caplen;
}
#ifdef UIP_FALLBACK_INTERFACE
u16_t
uint16_t
wfall_poll(void)
{
struct pcap_pkthdr *packet_header;
@ -699,7 +699,7 @@ wfall_poll(void)
}
PRINTF("FIN: %lu\n", packet_header->caplen);
CopyMemory(uip_buf, packet, packet_header->caplen);
return (u16_t)packet_header->caplen;
return (uint16_t)packet_header->caplen;
}
@ -707,7 +707,7 @@ wfall_poll(void)
/*---------------------------------------------------------------------------*/
#if UIP_CONF_IPV6
u8_t
uint8_t
wpcap_send(uip_lladdr_t *lladdr)
{
if(lladdr == NULL) {
@ -744,7 +744,7 @@ wpcap_send(uip_lladdr_t *lladdr)
return 0;
}
#ifdef UIP_FALLBACK_INTERFACE
u8_t
uint8_t
wfall_send(uip_lladdr_t *lladdr)
{
#if FALLBACK_HAS_ETHERNET_HEADERS

View File

@ -37,11 +37,11 @@
#define __WPCAP_H__
void wpcap_init(void);
u16_t wpcap_poll(void);
u16_t wfall_poll(void);
uint16_t wpcap_poll(void);
uint16_t wfall_poll(void);
#if UIP_CONF_IPV6
u8_t wpcap_send(uip_lladdr_t *lladdr);
u8_t wfall_send(uip_lladdr_t *lladdr);
uint8_t wpcap_send(uip_lladdr_t *lladdr);
uint8_t wfall_send(uip_lladdr_t *lladdr);
#else
void wpcap_send(void);
#endif

View File

@ -525,7 +525,7 @@ void stm32w_flash_write(int32u address, const void * data, int32u length)
halInternalFlashWrite(curr_page, (int16u *)buf, FLASH_PAGE_SIZE/2);
ENERGEST_OFF(ENERGEST_TYPE_FLASH_WRITE);
data = (u8_t *)data + next_page - i;
data = (uint8_t *)data + next_page - i;
i = next_page;
}

View File

@ -227,7 +227,7 @@ static int stm32w_radio_init(void)
return 0;
}
/*---------------------------------------------------------------------------*/
int stm32w_radio_set_channel(u8_t channel)
int stm32w_radio_set_channel(uint8_t channel)
{
if (ST_RadioSetChannel(channel) == ST_SUCCESS)
return 0;
@ -300,7 +300,7 @@ static int stm32w_radio_transmit(unsigned short payload_len)
PRINTF("stm32w: sending %d bytes\r\n", payload_len);
#if DEBUG > 1
for(u8_t c=1; c <= stm32w_txbuf[0]-2; c++){
for(uint8_t c=1; c <= stm32w_txbuf[0]-2; c++){
PRINTF("%x:",stm32w_txbuf[c]);
}
PRINTF("\r\n");
@ -503,7 +503,7 @@ PROCESS_THREAD(stm32w_radio_process, ev, data)
PRINTF("stm32w_radio_process: calling receiver callback\r\n");
#if DEBUG > 1
for(u8_t c=1; c <= RCVD_PACKET_LEN; c++){
for(uint8_t c=1; c <= RCVD_PACKET_LEN; c++){
PRINTF("%x",stm32w_rxbuf[c]);
}
PRINTF("\r\n");

View File

@ -46,7 +46,7 @@
#include "hal/hal.h"
#include "simplemac/include/phy-library.h"
int stm32w_radio_set_channel(u8_t channel);
int stm32w_radio_set_channel(uint8_t channel);
short last_packet_rssi();
#define STM32W_MAX_PACKET_LEN 127

View File

@ -138,8 +138,8 @@ uart1_init(unsigned long ubr)
GPIO_PBCFGL &= 0xF00F;
GPIO_PBCFGL |= 0x0490;
u16_t uartper = (u32_t)24e6/(2*ubr);
u32_t rest = (u32_t)24e6%(2*ubr);
uint16_t uartper = (uint32_t)24e6/(2*ubr);
uint32_t rest = (uint32_t)24e6%(2*ubr);
SC1_UARTFRAC = 0;

View File

@ -49,7 +49,7 @@
int rand(void)
{
u16_t rand_num;
uint16_t rand_num;
ST_RadioGetRandomNumbers(&rand_num, 1);

View File

@ -55,12 +55,12 @@
static u32_t time_msb = 0; // Most significant bits of the current time.
static uint32_t time_msb = 0; // Most significant bits of the current time.
// time of the next rtimer event. Initially is set to the max value.
static rtimer_clock_t next_rtimer_time = 0;
static u16_t saved_TIM1CFG;
static uint16_t saved_TIM1CFG;
/*---------------------------------------------------------------------------*/
@ -150,7 +150,7 @@ void
rtimer_arch_schedule(rtimer_clock_t t)
{
PRINTF("rtimer_arch_schedule time %4x\r\n", /*((u32_t*)&t)+1,*/(u32_t)t);
PRINTF("rtimer_arch_schedule time %4x\r\n", /*((uint32_t*)&t)+1,*/(uint32_t)t);
next_rtimer_time = t;

View File

@ -49,7 +49,7 @@
/*-----------------------------------------------------------------------------------*/
#if UIP_TCP
void
uip_add32(u8_t *op32, u16_t op16)
uip_add32(uint8_t *op32, uint16_t op16)
{
uint32_t op32_align, uip_acc32_align;

View File

@ -47,7 +47,7 @@
/*---------------------------------------------------------------------------*/
static void scroll() {
unsigned char y;
u16_t src, dst;
uint16_t src, dst;
for (y = 0; y < LIBCONIO_CONF_SCREEN_HEIGHT - 1; y++) {
dst = LIBCONIO_VRAM_OFFSET(0, y);
src = LIBCONIO_VRAM_OFFSET(0, y + 1);
@ -85,7 +85,7 @@ void ctk_arch_draw_char(char c,
unsigned char ypos,
unsigned char reversed,
unsigned char color) {
u16_t off;
uint16_t off;
adjust(&xpos, &ypos);
off = LIBCONIO_VRAM_OFFSET(xpos, ypos);

View File

@ -50,9 +50,9 @@ mef_load(unsigned char* offset)
{
unsigned char* start = offset;
unsigned char areasize = load_byte();
u16_t relocsize;
uint16_t relocsize;
unsigned int i, j;
u16_t checksum = 0;
uint16_t checksum = 0;
unsigned char* buf;
struct Relocation reloc;
@ -94,12 +94,12 @@ mef_reloc(unsigned char* offset, struct Relocation *reloc)
}
offset += reloc->address;
if (reloc->mode & MEF_RELOC_MSB_BYTE) {
*offset = (unsigned char) ((reloc->data + (u16_t) offset) >> 8);
*offset = (unsigned char) ((reloc->data + (uint16_t) offset) >> 8);
} else if (reloc->mode & MEF_RELOC_LSB_BYTE) {
*offset = (unsigned char) ((reloc->data + (u16_t) offset) & 0xff);
*offset = (unsigned char) ((reloc->data + (uint16_t) offset) & 0xff);
} else { /* word */
*offset++ = (unsigned char) ((reloc->data + (u16_t) offset) & 0xff);
*offset = (unsigned char) ((reloc->data + (u16_t) offset) >> 8);
*offset++ = (unsigned char) ((reloc->data + (uint16_t) offset) & 0xff);
*offset = (unsigned char) ((reloc->data + (uint16_t) offset) >> 8);
}
}

View File

@ -66,8 +66,8 @@
struct Area {
unsigned char mode;
u16_t size;
u16_t checksum;
uint16_t size;
uint16_t checksum;
};
/*
@ -82,8 +82,8 @@ struct Area {
struct Relocation {
unsigned char mode;
u16_t address;
u16_t data;
uint16_t address;
uint16_t data;
};
unsigned char load_byte();

View File

@ -47,7 +47,7 @@ void
mtarch_start(struct mtarch_thread *t,
void (*function)(void *), void *data)
{
u16_t i;
uint16_t i;
for(i = 0; i < MTARCH_STACKSIZE; i++) {
t->stack[i] = i;
@ -57,15 +57,15 @@ mtarch_start(struct mtarch_thread *t,
/* A parameter for method for thread function. */
*t->sp = (u16_t)data;
*t->sp = (uint16_t)data;
--t->sp;
/* This will be a return address of thread function. */
*t->sp = (u16_t)mt_exit;
*t->sp = (uint16_t)mt_exit;
--t->sp;
/* The thread function, is used as a return address of mtarch_switch. */
*t->sp = (u16_t)function;
*t->sp = (uint16_t)function;
--t->sp;
/*
@ -82,7 +82,7 @@ mtarch_start(struct mtarch_thread *t,
}
/*--------------------------------------------------------------------------*/
static struct mtarch_thread *running_thread;
static u16_t *sptmp;
static uint16_t *sptmp;
static void
mtarch_switch()
{
@ -180,7 +180,7 @@ mtarch_pstart()
int
mtarch_stack_usage(struct mtarch_thread *t)
{
u16_t i;
uint16_t i;
for (i = 0; i < MTARCH_STACKSIZE; i++) {
if (t->stack[i] != i) {
return MTARCH_STACKSIZE - i;

View File

@ -48,12 +48,12 @@ struct mtarch_thread {
* On top of the mtarch_thread must be the address for the stack pointer.
* See details at mtarch_switch in mtarch.c
*/
u16_t *sp;
uint16_t *sp;
/*
* Stack is 2-byte wide, so please note that you need 2 * MTARCH_STACKSIZE
* bytes for the stack area for each thread.
*/
u16_t stack[MTARCH_STACKSIZE];
uint16_t stack[MTARCH_STACKSIZE];
};
/*

View File

@ -27,7 +27,7 @@
.area _CODE
;; ---------------------------------
;; void uip_add32(u8_t *op32, u16_t op16);
;; void uip_add32(uint8_t *op32, uint16_t op16);
;; Stack; retl reth op32l op32h op16l op16h
;; ABCDEHL____
;; return void
@ -102,7 +102,7 @@ _uip_add32_nocarry0:
_uip_add32_end::
;; ---------------------------------
;; static u16_t chksum(u16_t sum, const u8_t *data, u16_t len)
;; static uint16_t chksum(uint16_t sum, const uint8_t *data, uint16_t len)
;; Stack; retl reth suml sumh datal datah lenl lenh
;; ABCDEHL____
;; return HL
@ -188,11 +188,11 @@ _uip_arch_chksum_loop_exit:
_uip_arch_chksum_end::
;; ---------------------------------
;; u16_t uip_chksum(void);
;; uint16_t uip_chksum(void);
;; Stack; retl reth datal datah lenl lenh
;; ABCDEHL____
;; return HL
;; return htons(chksum(0, (u8_t *)data, len));
;; return htons(chksum(0, (uint8_t *)data, len));
;; ---------------------------------
_uip_chksum_start::
_uip_chksum:

View File

@ -41,15 +41,15 @@
#include <stddef.h>
#include "uip_arch.h"
static const u16_t sizeof_uip_ipaddr_t = sizeof(uip_ipaddr_t);
static const u16_t offset_tcpip_hdr_len = offsetof(struct uip_tcpip_hdr, len);
static const u16_t offset_tcpip_hdr_srcipaddr = offsetof(struct uip_tcpip_hdr, srcipaddr);
static const uint16_t sizeof_uip_ipaddr_t = sizeof(uip_ipaddr_t);
static const uint16_t offset_tcpip_hdr_len = offsetof(struct uip_tcpip_hdr, len);
static const uint16_t offset_tcpip_hdr_srcipaddr = offsetof(struct uip_tcpip_hdr, srcipaddr);
/*--------------------------------------------------------------------------*/
static void upper_layer_chksum() {
__asm
;; ---------------------------------
;; static u16_t upper_layer_chksum(u8_t proto);
;; static uint16_t upper_layer_chksum(uint8_t proto);
;; Stack; retl reth
;; @param C proto
;; ABCDEHL____
@ -142,12 +142,12 @@ __endasm;
}
/*--------------------------------------------------------------------------*/
u16_t
uint16_t
uip_ipchksum(void)
{
__asm
;; ---------------------------------
;; u16_t uip_ipchksum(void);
;; uint16_t uip_ipchksum(void);
;; Stack; retl reth
;; ABCDEHL____
;; return HL
@ -164,12 +164,12 @@ __endasm;
/*--------------------------------------------------------------------------*/
#if UIP_CONF_IPV6
u16_t
uint16_t
uip_icmp6chksum(void)
{
__asm
;; ---------------------------------
;; u16_t uip_icmp6chksum(void);
;; uint16_t uip_icmp6chksum(void);
;; Stack; retl reth
;; ABCDEHL____
;; return HL
@ -181,12 +181,12 @@ __endasm;
#endif /* UIP_CONF_IPV6 */
/*--------------------------------------------------------------------------*/
u16_t
uint16_t
uip_tcpchksum(void)
{
__asm
;; ---------------------------------
;; u16_t uip_tcpchksum(void);
;; uint16_t uip_tcpchksum(void);
;; Stack; retl reth
;; ABCDEHL____
;; return HL
@ -198,12 +198,12 @@ __endasm;
/*--------------------------------------------------------------------------*/
#if UIP_UDP_CHKSUMS
u16_t
uint16_t
uip_udpchksum(void)
{
__asm
;; ---------------------------------
;; u16_t uip_udpchksum(void);
;; uint16_t uip_udpchksum(void);
;; Stack; retl reth
;; ABCDEHL____
;; return HL