]> Git Repo - qemu.git/blobdiff - hw/tc58128.c
arm_gic: Add cpu nr to Raised IRQ message
[qemu.git] / hw / tc58128.c
index 2cd176b945e83fd1e568982b81a5322b538569db..4ce80b18f3f6bc7fd618d64434673c52b1a9c825 100644 (file)
@@ -1,7 +1,6 @@
-#include <assert.h>
 #include "hw.h"
 #include "sh.h"
-#include "sysemu.h"
+#include "loader.h"
 
 #define CE1  0x0100
 #define CE2  0x0200
@@ -26,17 +25,13 @@ static tc58128_dev tc58128_devs[2];
 
 #define FLASH_SIZE (16*1024*1024)
 
-void init_dev(tc58128_dev * dev, char *filename)
+static void init_dev(tc58128_dev * dev, const char *filename)
 {
     int ret, blocks;
 
     dev->state = WAIT;
-    dev->flash_contents = qemu_mallocz(FLASH_SIZE);
+    dev->flash_contents = g_malloc(FLASH_SIZE);
     memset(dev->flash_contents, 0xff, FLASH_SIZE);
-    if (!dev->flash_contents) {
-       fprintf(stderr, "could not alloc memory for flash\n");
-       exit(1);
-    }
     if (filename) {
        /* Load flash image skipping the first block */
        ret = load_image(filename, dev->flash_contents + 528 * 32);
@@ -58,7 +53,7 @@ void init_dev(tc58128_dev * dev, char *filename)
     }
 }
 
-void handle_command(tc58128_dev * dev, uint8_t command)
+static void handle_command(tc58128_dev * dev, uint8_t command)
 {
     switch (command) {
     case 0xff:
@@ -82,11 +77,11 @@ void handle_command(tc58128_dev * dev, uint8_t command)
        break;
     default:
        fprintf(stderr, "unknown flash command 0x%02x\n", command);
-       assert(0);
+        abort();
     }
 }
 
-void handle_address(tc58128_dev * dev, uint8_t data)
+static void handle_address(tc58128_dev * dev, uint8_t data)
 {
     switch (dev->state) {
     case READ1:
@@ -110,16 +105,16 @@ void handle_address(tc58128_dev * dev, uint8_t data)
            break;
        default:
            /* Invalid data */
-           assert(0);
+            abort();
        }
        dev->address_cycle++;
        break;
     default:
-       assert(0);
+        abort();
     }
 }
 
-uint8_t handle_read(tc58128_dev * dev)
+static uint8_t handle_read(tc58128_dev * dev)
 {
 #if 0
     if (dev->address % 0x100000 == 0)
@@ -131,9 +126,9 @@ uint8_t handle_read(tc58128_dev * dev)
 /* We never mark the device as busy, so interrupts cannot be triggered
    XXXXX */
 
-int tc58128_cb(uint16_t porta, uint16_t portb,
-              uint16_t * periph_pdtra, uint16_t * periph_portadir,
-              uint16_t * periph_pdtrb, uint16_t * periph_portbdir)
+static int tc58128_cb(uint16_t porta, uint16_t portb,
+                      uint16_t * periph_pdtra, uint16_t * periph_portadir,
+                      uint16_t * periph_pdtrb, uint16_t * periph_portbdir)
 {
     int dev;
 
@@ -164,7 +159,7 @@ int tc58128_cb(uint16_t porta, uint16_t portb,
        *periph_pdtra &= 0xff00;
        *periph_pdtra |= handle_read(&tc58128_devs[dev]);
     } else {
-       assert(0);
+        abort();
     }
     return 1;
 }
@@ -175,7 +170,7 @@ static sh7750_io_device tc58128 = {
     tc58128_cb                 /* Callback */
 };
 
-int tc58128_init(struct SH7750State *s, char *zone1, char *zone2)
+int tc58128_init(struct SH7750State *s, const char *zone1, const char *zone2)
 {
     init_dev(&tc58128_devs[0], zone1);
     init_dev(&tc58128_devs[1], zone2);
This page took 0.028898 seconds and 4 git commands to generate.