]> git.sur5r.net Git - u-boot/blobdiff - examples/api/glue.c
arm: socfpga: Fix with the correct polling on bit is set
[u-boot] / examples / api / glue.c
index eff6a7e62f515806036efb3f6f9b7ea5a73b5054..575c1e55f33395aefb3b72e623c67eb17a2c1687 100644 (file)
@@ -1,24 +1,7 @@
 /*
  * (C) Copyright 2007-2008 Semihalf, Rafal Jaworowski <raj@semihalf.com>
  *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- *
+ * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <common.h>
@@ -94,7 +77,7 @@ int ub_getc(void)
 {
        int c;
 
-       if (!syscall(API_GETC, NULL, (uint32_t)&c))
+       if (!syscall(API_GETC, NULL, &c))
                return -1;
 
        return c;
@@ -104,7 +87,7 @@ int ub_tstc(void)
 {
        int t;
 
-       if (!syscall(API_TSTC, NULL, (uint32_t)&t))
+       if (!syscall(API_TSTC, NULL, &t))
                return -1;
 
        return t;
@@ -112,12 +95,12 @@ int ub_tstc(void)
 
 void ub_putc(char c)
 {
-       syscall(API_PUTC, NULL, (uint32_t)&c);
+       syscall(API_PUTC, NULL, &c);
 }
 
 void ub_puts(const char *s)
 {
-       syscall(API_PUTS, NULL, (uint32_t)s);
+       syscall(API_PUTS, NULL, s);
 }
 
 /****************************************
@@ -143,7 +126,7 @@ struct sys_info * ub_get_sys_info(void)
        si.mr_no = UB_MAX_MR;
        memset(&mr, 0, sizeof(mr));
 
-       if (!syscall(API_GET_SYS_INFO, &err, (u_int32_t)&si))
+       if (!syscall(API_GET_SYS_INFO, &err, &si))
                return NULL;
 
        return ((err) ? NULL : &si);
@@ -361,7 +344,7 @@ char * ub_env_get(const char *name)
 {
        char *value;
 
-       if (!syscall(API_ENV_GET, NULL, (uint32_t)name, (uint32_t)&value))
+       if (!syscall(API_ENV_GET, NULL, name, &value))
                return NULL;
 
        return value;
@@ -369,7 +352,7 @@ char * ub_env_get(const char *name)
 
 void ub_env_set(const char *name, char *value)
 {
-       syscall(API_ENV_SET, NULL, (uint32_t)name, (uint32_t)value);
+       syscall(API_ENV_SET, NULL, name, value);
 }
 
 static char env_name[256];
@@ -386,7 +369,7 @@ const char * ub_env_enum(const char *last)
         * 'name=val' string), since the API_ENUM_ENV call uses envmatch()
         * internally, which handles such case
         */
-       if (!syscall(API_ENV_ENUM, NULL, (uint32_t)last, (uint32_t)&env))
+       if (!syscall(API_ENV_ENUM, NULL, last, &env))
                return NULL;
 
        if (!env)
@@ -402,3 +385,46 @@ const char * ub_env_enum(const char *last)
 
        return env_name;
 }
+
+/****************************************
+ *
+ * display
+ *
+ ****************************************/
+
+int ub_display_get_info(int type, struct display_info *di)
+{
+       int err = 0;
+
+       if (!syscall(API_DISPLAY_GET_INFO, &err, type, di))
+               return API_ESYSC;
+
+       return err;
+}
+
+int ub_display_draw_bitmap(ulong bitmap, int x, int y)
+{
+       int err = 0;
+
+       if (!syscall(API_DISPLAY_DRAW_BITMAP, &err, bitmap, x, y))
+               return API_ESYSC;
+
+       return err;
+}
+
+void ub_display_clear(void)
+{
+       syscall(API_DISPLAY_CLEAR, NULL);
+}
+
+__weak void *memcpy(void *dest, const void *src, size_t size)
+{
+       unsigned char *dptr = dest;
+       const unsigned char *ptr = src;
+       const unsigned char *end = src + size;
+
+       while (ptr < end)
+               *dptr++ = *ptr++;
+
+       return dest;
+}