Converted u8_t to uint8_t and u16_t to uint16_t in the rest of core (specifically ctk/vnc, slip and the loader code)

This commit is contained in:
Nicholas J Humfrey 2012-02-19 14:29:59 +00:00 committed by Mariano Alvira
parent d44396f883
commit 372de7d08a
9 changed files with 149 additions and 149 deletions

View file

@ -240,9 +240,9 @@ vnc_server_update_remove(struct vnc_server_state *vs,
*/
/*-----------------------------------------------------------------------------------*/
static void
update_area(u8_t x, u8_t y, u8_t w, u8_t h)
update_area(uint8_t x, uint8_t y, uint8_t w, uint8_t h)
{
u8_t i;
uint8_t i;
if(h == 0 || w == 0) {
return;
@ -266,7 +266,7 @@ update_area(u8_t x, u8_t y, u8_t w, u8_t h)
static struct vnc_server_state *
alloc_state(void)
{
u8_t i;
uint8_t i;
for(i = 0; i < CTK_VNCSERVER_CONF_NUMCONNS; ++i) {
if(conns[i].state == VNC_DEALLOCATED) {
return &conns[i];

View file

@ -70,14 +70,14 @@
#define BGR(b,g,r) (((b) << 6) | (g) << 3 | (r))
static const u8_t menucolor[] = {
static const uint8_t menucolor[] = {
BGR(3,7,7), /* Background. */
BGR(2,6,6), /* Anti-alias font color. */
BGR(0,0,0), /* Font color. */
};
static const u8_t activemenucolor[] = {
static const uint8_t activemenucolor[] = {
BGR(0,0,0), /* Background. */
BGR(2,5,5), /* Anti-alias font color. */
BGR(3,7,7), /* Font color. */
@ -160,7 +160,7 @@ static const unsigned char iconcol_w[] =
static const u8_t * const colortheme[] =
static const uint8_t * const colortheme[] =
{
backgroundcolor,
@ -193,15 +193,15 @@ static const u8_t * const colortheme[] =
static int mouse_x, mouse_y, mouse_button;
#ifdef CTK_VNCSERVER_CONF_SCREEN
static u8_t *screen = CTK_VNCSERVER_CONF_SCREEN;
static uint8_t *screen = CTK_VNCSERVER_CONF_SCREEN;
#else
static u8_t screen[CHARS_WIDTH * CHARS_HEIGHT];
static uint8_t screen[CHARS_WIDTH * CHARS_HEIGHT];
#endif
#ifdef CTK_VNCSERVER_CONF_COLORSCREEN
staitc u8_t *colorscreen = CTK_VNCSERVER_CONF_COLORSCREEN;
staitc uint8_t *colorscreen = CTK_VNCSERVER_CONF_COLORSCREEN;
#else
static u8_t colorscreen[CHARS_WIDTH * CHARS_HEIGHT];
static uint8_t colorscreen[CHARS_WIDTH * CHARS_HEIGHT];
#endif
@ -214,7 +214,7 @@ struct ctk_icon *icons[MAX_ICONS];
unsigned char
vnc_out_add_icon(struct ctk_icon *icon)
{
u8_t i;
uint8_t i;
signed int empty;
empty = -1;
@ -238,14 +238,14 @@ vnc_out_add_icon(struct ctk_icon *icon)
void
vnc_out_init(void)
{
u16_t i;
uint16_t i;
for(i = 0; i < CHARS_WIDTH * CHARS_HEIGHT; ++i) {
screen[i] = 0x20;
}
}
void
vnc_out_update_screen(u8_t xpos, u8_t ypos, u8_t c, u8_t color)
vnc_out_update_screen(uint8_t xpos, uint8_t ypos, uint8_t c, uint8_t color)
{
screen[xpos + ypos * CHARS_WIDTH] = c;
colorscreen[xpos + ypos * CHARS_WIDTH] = color;
@ -253,9 +253,9 @@ vnc_out_update_screen(u8_t xpos, u8_t ypos, u8_t c, u8_t color)
/*-----------------------------------------------------------------------------------*/
void
vnc_out_update_area(struct vnc_server_state *vs,
u8_t x, u8_t y, u8_t w, u8_t h)
uint8_t x, uint8_t y, uint8_t w, uint8_t h)
{
u8_t x2, y2, ax2, ay2;
uint8_t x2, y2, ax2, ay2;
register struct vnc_server_update *a, *b;
PRINTF(("update_area_connection: should update (%d:%d) (%d:%d)\n",
@ -420,21 +420,21 @@ check_updates(CC_REGISTER_ARG struct vnc_server_state *vs)
}
}
/*-----------------------------------------------------------------------------------*/
static u8_t tmp[CTK_VNCFONT_WIDTH * CTK_VNCFONT_HEIGHT];
static uint8_t tmp[CTK_VNCFONT_WIDTH * CTK_VNCFONT_HEIGHT];
static void
makechar(CC_REGISTER_ARG char *ptr, u8_t x, u8_t y)
makechar(CC_REGISTER_ARG char *ptr, uint8_t x, uint8_t y)
{
u8_t i, *tmpptr;
register u8_t *colorscheme;
uint8_t i, *tmpptr;
register uint8_t *colorscheme;
unsigned char *bitmap;
u8_t b, b2;
u8_t xmove, ymove;
uint8_t b, b2;
uint8_t xmove, ymove;
unsigned char c, color;
color = colorscreen[x + y * CHARS_WIDTH];
c = screen[x + y * CHARS_WIDTH];
colorscheme = (u8_t *)colortheme[color];
colorscheme = (uint8_t *)colortheme[color];
/* First check if the character is a special icon character. These
are to be interpreted in a special manner: the first character of
@ -457,7 +457,7 @@ makechar(CC_REGISTER_ARG char *ptr, u8_t x, u8_t y)
if(bitmap != NULL) {
bitmap = bitmap + ymove * 8*3;
colorscheme = (u8_t *)colortheme[VNC_OUT_ICONCOLOR + (c >> 6)];
colorscheme = (uint8_t *)colortheme[VNC_OUT_ICONCOLOR + (c >> 6)];
switch(xmove) {
case 0:
for(i = 0; i < CTK_VNCFONT_HEIGHT; ++i) {
@ -523,7 +523,7 @@ makechar(CC_REGISTER_ARG char *ptr, u8_t x, u8_t y)
void
vnc_out_new(CC_REGISTER_ARG struct vnc_server_state *vs)
{
u8_t i;
uint8_t i;
vs->width = SCREEN_WIDTH;
vs->height = SCREEN_HEIGHT;
@ -545,9 +545,9 @@ void
vnc_out_send_blank(CC_REGISTER_ARG struct vnc_server_state *vs)
{
register struct rfb_fb_update *umsg;
u8_t *ptr;
u16_t len;
u8_t msglen;
uint8_t *ptr;
uint16_t len;
uint8_t msglen;
vs->x = vs->y = 0;
vs->x2 = vs->y2 = 0;
@ -557,7 +557,7 @@ vnc_out_send_blank(CC_REGISTER_ARG struct vnc_server_state *vs)
umsg->type = RFB_FB_UPDATE;
umsg->rects = UIP_HTONS(2);
ptr = (u8_t *)umsg + sizeof(struct rfb_fb_update);
ptr = (uint8_t *)umsg + sizeof(struct rfb_fb_update);
len = sizeof(struct rfb_fb_update);
msglen = vnc_server_draw_rect(ptr, 0, 0,
@ -590,15 +590,15 @@ static short tmpbuf[30];
void
vnc_out_send_update(CC_REGISTER_ARG struct vnc_server_state *vs)
{
u8_t x, y, x0;
u8_t msglen;
u16_t len, n;
u8_t *ptr;
uint8_t x, y, x0;
uint8_t msglen;
uint16_t len, n;
uint8_t *ptr;
struct rfb_fb_update *umsg;
register struct rfb_fb_update_rect_hdr *recthdr;
struct rfb_rre_hdr *rrehdr;
u8_t c, color, lastcolor;
u8_t numblanks;
uint8_t c, color, lastcolor;
uint8_t numblanks;
/* First, check if we need to feed the update function with a new
pending update. */
@ -615,7 +615,7 @@ vnc_out_send_update(CC_REGISTER_ARG struct vnc_server_state *vs)
x0 = vs->x1;
n = 0;
msglen = 0;
ptr = (u8_t *)umsg + sizeof(struct rfb_fb_update);
ptr = (uint8_t *)umsg + sizeof(struct rfb_fb_update);
len = sizeof(struct rfb_fb_update);
/* Loop over all characters that are covered by this update. */
@ -741,7 +741,7 @@ vnc_out_send_update(CC_REGISTER_ARG struct vnc_server_state *vs)
recthdr->encoding[2] = 0;
recthdr->encoding[3] = RFB_ENC_RAW;
makechar((u8_t *)recthdr +
makechar((uint8_t *)recthdr +
sizeof(struct rfb_fb_update_rect_hdr),
x, y);
}
@ -837,7 +837,7 @@ void
vnc_out_pointer_event(struct vnc_server_state *vs)
{
struct rfb_pointer_event *ev;
u16_t evx, evy;
uint16_t evx, evy;
ev = (struct rfb_pointer_event *)uip_appdata;

View file

@ -51,12 +51,12 @@ void vnc_out_acked(struct vnc_server_state *vs);
void vnc_out_poll(struct vnc_server_state *vs);
void vnc_out_update_screen(u8_t x, u8_t y, u8_t c, u8_t color);
void vnc_out_update_screen(uint8_t x, uint8_t y, uint8_t c, uint8_t color);
char vnc_out_getkey(void);
char vnc_out_keyavail(void);
void vnc_out_update_area(struct vnc_server_state *vs,
u8_t x, u8_t y, u8_t w, u8_t h);
uint8_t x, uint8_t y, uint8_t w, uint8_t h);
#include "ctk/ctk.h"

View file

@ -65,10 +65,10 @@
#define RFB_SERVER_VERSION_STRING rfb_server_version_string
/* "RFB 003.003" */
static u8_t rfb_server_version_string[12] = {82,70,66,32,48,48,51,46,48,48,51,10};
static uint8_t rfb_server_version_string[12] = {82,70,66,32,48,48,51,46,48,48,51,10};
/* uVNC */
static u8_t uvnc_name[4] = {117,86,78,67};
static uint8_t uvnc_name[4] = {117,86,78,67};
#if 1
#define PRINTF(x)
#else
@ -76,8 +76,8 @@ static u8_t uvnc_name[4] = {117,86,78,67};
#endif
/*-----------------------------------------------------------------------------------*/
u8_t
vnc_server_draw_rect(u8_t *ptr, u16_t x, u16_t y, u16_t w, u16_t h, u8_t c)
uint8_t
vnc_server_draw_rect(uint8_t *ptr, uint16_t x, uint16_t y, uint16_t w, uint16_t h, uint8_t c)
{
register struct rfb_fb_update_rect_hdr *recthdr;
struct rfb_rre_hdr *rrehdr;
@ -244,16 +244,16 @@ vnc_pointer_event(struct vnc_server_state *vs)
}
}
/*-----------------------------------------------------------------------------------*/
static u8_t
static uint8_t
vnc_read_data(CC_REGISTER_ARG struct vnc_server_state *vs)
{
u8_t *appdata;
u16_t len;
uint8_t *appdata;
uint16_t len;
struct rfb_fb_update_request *req;
/* u8_t niter;*/
/* uint8_t niter;*/
len = uip_datalen();
appdata = (u8_t *)uip_appdata;
appdata = (uint8_t *)uip_appdata;
/* First, check if there is data left to discard since last read. */
if(vs->readlen > 0) {

View file

@ -37,9 +37,9 @@
/*struct vnc_server_updatearea {
u8_t active;
u8_t x, y;
u8_t w, h;
uint8_t active;
uint8_t x, y;
uint8_t w, h;
};*/
struct vnc_server_update {
@ -49,29 +49,29 @@ struct vnc_server_update {
#define VNC_SERVER_UPDATE_PARTS 1
#define VNC_SERVER_UPDATE_FULL 2
u8_t type;
uint8_t type;
u8_t x, y;
u8_t w, h;
uint8_t x, y;
uint8_t w, h;
};
struct vnc_server_state {
u16_t counter;
u8_t type;
u8_t state;
u16_t height, width;
uint16_t counter;
uint8_t type;
uint8_t state;
uint16_t height, width;
u8_t update_requested;
uint8_t update_requested;
/* Variables used when sending screen updates. */
u8_t x, y, x1, y1, x2, y2;
u8_t w, h;
uint8_t x, y, x1, y1, x2, y2;
uint8_t w, h;
u16_t readlen;
u8_t sendmsg;
u8_t button;
uint16_t readlen;
uint8_t sendmsg;
uint8_t button;
struct vnc_server_update *updates_current;
@ -131,30 +131,30 @@ enum {
#include "contiki-net.h"
void vnc_server_send_data(struct vnc_server_state *vs);
u8_t vnc_server_draw_rect(u8_t *ptr, u16_t x, u16_t y, u16_t w, u16_t h, u8_t c);
uint8_t vnc_server_draw_rect(uint8_t *ptr, uint16_t x, uint16_t y, uint16_t w, uint16_t h, uint8_t c);
/* Generic rectangle - x, y coordinates, width and height. */
struct rfb_rect {
u16_t x;
u16_t y;
u16_t w;
u16_t h;
uint16_t x;
uint16_t y;
uint16_t w;
uint16_t h;
};
/* Pixel format definition. */
struct rfb_pixel_format {
u8_t bps; /* Bits per pixel: 8, 16 or 32. */
u8_t depth; /* Color depth: 8-32 */
u8_t endian; /* 1 - big endian (motorola), 0 - little endian
uint8_t bps; /* Bits per pixel: 8, 16 or 32. */
uint8_t depth; /* Color depth: 8-32 */
uint8_t endian; /* 1 - big endian (motorola), 0 - little endian
(x86) */
u8_t truecolor; /* 1 - true color is used, 0 - true color is not used. */
uint8_t truecolor; /* 1 - true color is used, 0 - true color is not used. */
/* The following fields are only used if true color is used. */
u16_t red_max, green_max, blue_max;
u8_t red_shift, green_shift, blue_shift;
u8_t pad1;
u16_t pad2;
uint16_t red_max, green_max, blue_max;
uint8_t red_shift, green_shift, blue_shift;
uint8_t pad1;
uint16_t pad2;
};
@ -197,100 +197,100 @@ struct rfb_pixel_format {
/* Server to client messages. */
struct rfb_server_init {
u16_t width;
u16_t height;
uint16_t width;
uint16_t height;
struct rfb_pixel_format format;
u8_t namelength[4];
uint8_t namelength[4];
/* Followed by name. */
};
struct rfb_fb_update {
u8_t type;
u8_t pad;
u16_t rects; /* Number of rectanges (struct rfb_fb_update_rect_hdr +
uint8_t type;
uint8_t pad;
uint16_t rects; /* Number of rectanges (struct rfb_fb_update_rect_hdr +
data) that follows. */
};
struct rfb_fb_update_rect_hdr {
struct rfb_rect rect;
u8_t encoding[4];
uint8_t encoding[4];
};
struct rfb_copy_rect {
u16_t srcx;
u16_t srcy;
uint16_t srcx;
uint16_t srcy;
};
struct rfb_rre_hdr {
u16_t subrects[2]; /* Number of subrectangles (struct
uint16_t subrects[2]; /* Number of subrectangles (struct
rfb_rre_subrect) to follow. */
u8_t bgpixel;
uint8_t bgpixel;
};
struct rfb_rre_subrect {
u8_t pixel;
uint8_t pixel;
struct rfb_rect rect;
};
struct rfb_corre_rect {
u8_t x;
u8_t y;
u8_t w;
u8_t h;
uint8_t x;
uint8_t y;
uint8_t w;
uint8_t h;
};
/* Client to server messages. */
struct rfb_set_pixel_format {
u8_t type;
u8_t pad;
u16_t pad2;
uint8_t type;
uint8_t pad;
uint16_t pad2;
struct rfb_pixel_format format;
};
struct rfb_fix_colormap_entries {
u8_t type;
u8_t pad;
u16_t firstcolor;
u16_t colors;
uint8_t type;
uint8_t pad;
uint16_t firstcolor;
uint16_t colors;
};
struct rfb_set_encoding {
u8_t type;
u8_t pad;
u16_t encodings;
uint8_t type;
uint8_t pad;
uint16_t encodings;
};
struct rfb_fb_update_request {
u8_t type;
u8_t incremental;
u16_t x;
u16_t y;
u16_t w;
u16_t h;
uint8_t type;
uint8_t incremental;
uint16_t x;
uint16_t y;
uint16_t w;
uint16_t h;
};
struct rfb_key_event {
u8_t type;
u8_t down;
u16_t pad;
u8_t key[4];
uint8_t type;
uint8_t down;
uint16_t pad;
uint8_t key[4];
};
#define RFB_BUTTON_MASK1 1
#define RFB_BUTTON_MASK2 2
#define RFB_BUTTON_MASK3 4
struct rfb_pointer_event {
u8_t type;
u8_t buttonmask;
u16_t x;
u16_t y;
uint8_t type;
uint8_t buttonmask;
uint16_t x;
uint16_t y;
};
struct rfb_client_cut_text {
u8_t type;
u8_t pad[3];
u8_t len[4];
uint8_t type;
uint8_t pad[3];
uint8_t len[4];
};
#endif /* __VNC_SERVER_H__ */

View file

@ -51,12 +51,12 @@
PROCESS(slip_process, "SLIP driver");
u8_t slip_active;
uint8_t slip_active;
#if 1
#define SLIP_STATISTICS(statement)
#else
u16_t slip_rubbish, slip_twopackets, slip_overflow, slip_ip_drop;
uint16_t slip_rubbish, slip_twopackets, slip_overflow, slip_ip_drop;
#define SLIP_STATISTICS(statement) statement
#endif
@ -81,10 +81,10 @@ enum {
* they are discarded.
*/
static u8_t state = STATE_TWOPACKETS;
static u16_t begin, end;
static u8_t rxbuf[RX_BUFSIZE];
static u16_t pkt_end; /* SLIP_END tracker. */
static uint8_t state = STATE_TWOPACKETS;
static uint16_t begin, end;
static uint8_t rxbuf[RX_BUFSIZE];
static uint16_t pkt_end; /* SLIP_END tracker. */
static void (* input_callback)(void) = NULL;
/*---------------------------------------------------------------------------*/
@ -98,19 +98,19 @@ slip_set_input_callback(void (*c)(void))
* was used in slip-bridge.c
*/
//#if WITH_UIP
u8_t
uint8_t
slip_send(void)
{
u16_t i;
u8_t *ptr;
u8_t c;
uint16_t i;
uint8_t *ptr;
uint8_t c;
slip_arch_writeb(SLIP_END);
ptr = &uip_buf[UIP_LLH_LEN];
for(i = 0; i < uip_len; ++i) {
if(i == UIP_TCPIP_HLEN) {
ptr = (u8_t *)uip_appdata;
ptr = (uint8_t *)uip_appdata;
}
c = *ptr++;
if(c == SLIP_END) {
@ -128,12 +128,12 @@ slip_send(void)
}
//#endif /* WITH_UIP */
/*---------------------------------------------------------------------------*/
u8_t
uint8_t
slip_write(const void *_ptr, int len)
{
const u8_t *ptr = _ptr;
u16_t i;
u8_t c;
const uint8_t *ptr = _ptr;
uint16_t i;
uint8_t c;
slip_arch_writeb(SLIP_END);
@ -161,8 +161,8 @@ rxbuf_init(void)
}
/*---------------------------------------------------------------------------*/
/* Upper half does the polling. */
static u16_t
slip_poll_handler(u8_t *outbuf, u16_t blen)
static uint16_t
slip_poll_handler(uint8_t *outbuf, uint16_t blen)
{
/* This is a hack and won't work across buffer edge! */
if(rxbuf[begin] == 'C') {
@ -212,7 +212,7 @@ slip_poll_handler(u8_t *outbuf, u16_t blen)
* If pkt_end != begin it will not change again.
*/
if(begin != pkt_end) {
u16_t len;
uint16_t len;
if(begin < pkt_end) {
len = pkt_end - begin;
@ -275,12 +275,12 @@ PROCESS_THREAD(slip_process, ev, data)
}
slip_write(buf, 8);
} else if(uip_len > 0
&& uip_len == (((u16_t)(BUF->len[0]) << 8) + BUF->len[1])
&& uip_len == (((uint16_t)(BUF->len[0]) << 8) + BUF->len[1])
&& uip_ipchksum() == 0xffff) {
#define IP_DF 0x40
if(BUF->ipid[0] == 0 && BUF->ipid[1] == 0 && BUF->ipoffset[0] & IP_DF) {
static u16_t ip_id;
u16_t nid = ip_id++;
static uint16_t ip_id;
uint16_t nid = ip_id++;
BUF->ipid[0] = nid >> 8;
BUF->ipid[1] = nid;
nid = uip_htons(nid);

View file

@ -42,7 +42,7 @@ PROCESS_NAME(slip_process);
/**
* Send an IP packet from the uIP buffer with SLIP.
*/
u8_t slip_send(void);
uint8_t slip_send(void);
/**
* Input a SLIP byte.
@ -63,13 +63,13 @@ u8_t slip_send(void);
*/
int slip_input_byte(unsigned char c);
u8_t slip_write(const void *ptr, int len);
uint8_t slip_write(const void *ptr, int len);
/* Did we receive any bytes lately? */
extern u8_t slip_active;
extern uint8_t slip_active;
/* Statistics. */
extern u16_t slip_rubbish, slip_twopackets, slip_overflow, slip_ip_drop;
extern uint16_t slip_rubbish, slip_twopackets, slip_overflow, slip_ip_drop;
/**
* Set a function to be called when there is activity on the SLIP

View file

@ -37,9 +37,9 @@
*/
/* These typedefs limits object file size! */
typedef u16_t cle_off; /* Offset from start of file. */
typedef u16_t cle_word;
typedef u16_t cle_half;
typedef uint16_t cle_off; /* Offset from start of file. */
typedef uint16_t cle_word;
typedef uint16_t cle_half;
/* Also used for address arithmetic (can't be void *). */
#ifdef __AVR__

View file

@ -305,7 +305,7 @@ elfloader_arch_relocate(int fd, unsigned int sectionoffset,
*/
/* new solution */
instr[2] = (u8_t) ((int)addr) & 0xff;
instr[2] = (uint8_t) ((int)addr) & 0xff;
instr[3] = ((int)addr) >> 8;
cfs_write(fd, instr, 4);
break;