diff options
Diffstat (limited to 'nuttx/arch/z80/src')
-rw-r--r-- | nuttx/arch/z80/src/common/up_allocateheap.c | 11 | ||||
-rw-r--r-- | nuttx/arch/z80/src/ez80/ez80_i2c.c | 13 | ||||
-rw-r--r-- | nuttx/arch/z80/src/z8/z8_i2c.c | 6 |
3 files changed, 19 insertions, 11 deletions
diff --git a/nuttx/arch/z80/src/common/up_allocateheap.c b/nuttx/arch/z80/src/common/up_allocateheap.c index 734d678e7..c3e06ef12 100644 --- a/nuttx/arch/z80/src/common/up_allocateheap.c +++ b/nuttx/arch/z80/src/common/up_allocateheap.c @@ -85,9 +85,14 @@ * Name: up_allocate_heap * * Description: - * The heap may be statically allocated by defining CONFIG_HEAP_BASE and - * CONFIG_HEAP_SIZE. If these are not defined, then this function will be - * called to dynamically set aside the heap region. + * This function will be called to dynamically set aside the heap region. + * + * For the kernel build (CONFIG_NUTTX_KERNEL=y) with both kernel- and + * user-space heaps (CONFIG_MM_KERNEL_HEAP=y), this function provides the + * size of the unprotected, user-space heap. + * + * If a protected kernel-space heap is provided, the kernel heap must be + * allocated (and protected) by an analogous up_allocate_kheap(). * ****************************************************************************/ diff --git a/nuttx/arch/z80/src/ez80/ez80_i2c.c b/nuttx/arch/z80/src/ez80/ez80_i2c.c index dbc817442..6668704dc 100644 --- a/nuttx/arch/z80/src/ez80/ez80_i2c.c +++ b/nuttx/arch/z80/src/ez80/ez80_i2c.c @@ -1,7 +1,7 @@ /**************************************************************************** * arch/z80/src/ez80/ez80_i2c.c * - * Copyright(C) 2009, 2011 Gregory Nutt. All rights reserved. + * Copyright(C) 2009, 2011, 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> * * Redistribution and use in source and binary forms, with or without @@ -48,6 +48,7 @@ #include <debug.h> #include <nuttx/i2c.h> +#include <nuttx/kmalloc.h> #include <arch/io.h> #include <arch/board/board.h> @@ -747,10 +748,10 @@ static int i2c_read(FAR struct i2c_dev_s *dev, uint8_t *buffer, int buflen) for (retry = 0; retry < 100; retry++) { - /* Enter MASTER TRANSMIT mode by setting the STA bit in the I2C_CTL - * register to 1. The I2C then tests the I2C bus and transmits a START - * condition when the bus is free. - */ + /* Enter MASTER TRANSMIT mode by setting the STA bit in the I2C_CTL + * register to 1. The I2C then tests the I2C bus and transmits a START + * condition when the bus is free. + */ i2c_start(); @@ -920,7 +921,7 @@ FAR struct i2c_dev_s *up_i2cinitialize(int port) /* Now, allocate an I2C instance for this caller */ - i2c = (FAR struct ez80_i2cdev_s *)malloc(sizeof(FAR struct ez80_i2cdev_s)); + i2c = (FAR struct ez80_i2cdev_s *)kmalloc(sizeof(FAR struct ez80_i2cdev_s)); if (i2c) { /* Initialize the allocated instance */ diff --git a/nuttx/arch/z80/src/z8/z8_i2c.c b/nuttx/arch/z80/src/z8/z8_i2c.c index e90bd4036..59cd2fc2b 100644 --- a/nuttx/arch/z80/src/z8/z8_i2c.c +++ b/nuttx/arch/z80/src/z8/z8_i2c.c @@ -1,7 +1,7 @@ /**************************************************************************** * arch/z80/src/z8/z8_i2c.c * - * Copyright(C) 2009, 2011 Gregory Nutt. All rights reserved. + * Copyright(C) 2009, 2011, 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> * * Redistribution and use in source and binary forms, with or without @@ -48,6 +48,7 @@ #include <debug.h> #include <nuttx/i2c.h> +#include <nuttx/kmalloc.h> #include <arch/board/board.h> #include <eZ8.h> /* eZ8 Register definitions */ @@ -592,7 +593,7 @@ FAR struct i2c_dev_s *up_i2cinitialize(int port) /* Now, allocate an I2C instance for this caller */ - i2c = (FAR struct z8_i2cdev_s *)malloc(sizeof(FAR struct z8_i2cdev_s)); + i2c = (FAR struct z8_i2cdev_s *)kmalloc(sizeof(FAR struct z8_i2cdev_s)); if (i2c) { /* Initialize the allocated instance */ @@ -600,5 +601,6 @@ FAR struct i2c_dev_s *up_i2cinitialize(int port) i2c->ops = &g_ops; i2c->brg = g_currbrg; } + return (FAR struct i2c_dev_s *)i2c; } |