Nut/OS  5.0.5
API Reference
icc.h File Reference
#include <stddef.h>
#include <macros.h>
#include <eeprom.h>
#include <iom103v.h>
#include <string.h>
Include dependency graph for icc.h:

Go to the source code of this file.

Defines

#define CONST   const
 Specify enhanced AVR target.
#define INLINE
 Disable inline keyword.
#define printf   printf_M
 Redefined standard library routines.
#define puts   puts_M
#define sprintf   sprintf_M
#define vprintf   vprintf_M
#define scanf   scanf_M
#define gets   gets_M
#define malloc   malloc_M
#define calloc   calloc_M
#define realloc   realloc_M
#define free   free_M
#define cprintf   printf_P
 Redirected stdio routines.
#define csprintf   sprintf_P
#define cscanf   scanf_P
#define csscanf   sscanf_P
#define memcpy_P(dst, src_P, n)   cmemcpy(dst, src_P, n)
#define strcat_P(s1, s2_P)   cstrcat(s1, s2_P)
#define strcmp_P(s1, s2_P)   (-cstrcmp(s2_P, s1))
#define strlen_P(s_P)   cstrlen(s_P)
#define strncat_P(s1, s2_P, n)   cstrncat(s1, s2_P, n)
#define strncmp_P(s1_P, s2, n)   cstrncmp(s1_P, s2, n)
#define strcpy_P(dst, src_P)   cstrcpy(dst, src_P)
#define strncpy_P(x, y, z)   cstrncpy(x,y,z)
#define strcasecmp(s1, s2)   strcmp(s1, s2)
 Case insensitive string comparisions.
#define strncasecmp(s1, s2, n)   strncmp(s1, s2, n)
#define __heap_start   _bss_end
 Start of heap area.
#define __attribute__(x)
 Object attribute support.
#define PSTR(p)   (p)
 Declare static pointer to strings in program space.
#define PRG_RDB(p)   (*((__flash char *)(p)))
 Read byte from program space.
#define prog_char   __flash char
 Character in program space.
#define prog_int   __flash int
 Integer in program space.
#define PGM_P   prog_char *
 Pointer to character in program space.
#define wdt_enable(tmo)
#define wdt_disable()
#define wdt_reset()
#define __SFR_OFFSET   0
#define SFR_IO_ADDR(sfr)   ((sfr) - __SFR_OFFSET)
#define SFR_MEM_ADDR(sfr)   (sfr)
#define SFR_IO_REG_P(sfr)   ((sfr) < 0x40 + __SFR_OFFSET)
#define _SFR_MEM8(addr)   (addr)
#define _SFR_MEM16(addr)   (addr)
#define BV(x)   BIT(x)
#define _BV(x)   BIT(x)
#define cli()   CLI()
#define sei()   SEI()
#define cbi(reg, bit)   (reg &= ~BIT(bit))
#define sbi(reg, bit)   (reg |= BIT(bit))
#define loop_until_bit_is_set(reg, bit)   while((reg & BIT(bit)) == 0)
#define bit_is_clear(reg, bit)   ((reg & BIT(bit)) == 0)
#define bit_is_set(reg, bit)   ((reg & BIT(bit)) != 0)
#define parity_even_bit(x)   (0)
#define SIGNAL(x)   void x(void)
#define outb(reg, val)   (reg = val)
#define inb(reg)   (reg)
#define __AVR_ATmega103__
#define DOR   OVR
#define RAMEND   0x0FFF
#define WDCE   WDTOE
#define eeprom_read_block(dst, addr, size)   EEPROMReadBytes((int)addr, dst, size)
#define eeprom_write_byte(addr, src)   EEPROMwrite((int)addr, src)
#define eeprom_read_byte(addr)   EEPROMread((int)addr)

Functions

void * calloc (size_t num, size_t size)
 Allocate space for an array.
char * strdup (const char *str)
 Create a copy of a string.

Define Documentation

#define CONST   const

Specify enhanced AVR target.

For backward compatibility this macro is automatically defined if _MCU_enhanced is defined.

Disable const keyword.

ICCAVR doesn't allow to mark function parameters unmodifable by the 'const' modifier. Even worse, the compiler redefines the meaning as a program memory attribute.

#define INLINE

Disable inline keyword.

ICCAVR doesn't allow to explicitly mark a function for inline code generation.

#define printf   printf_M

Redefined standard library routines.

ImageCraft has a multipass linker, which is fine for complicated dependencies in most cases. However, there is the potential risk, that standard library calls with the same name are linked from the wrong library. To avoid this, an additional postfix is added to routines, which are implemented in Nut/OS libraries.

Examples:
caltime/caltime.c, editconf/editconf.c, ftpd/ftpserv.c, httpd/httpserv.c, httpd_simple/httpd_simple.c, httpd_upnp/httpserv.c, icmp-udp/icmp-udp.c, inetq/inetq.c, logtime/logtime.c, pingnet/pingnet.c, pppc/pppc.c, snmpd/snmpd.c, tcps/tcps.c, and timers/timers.c.

Referenced by ARM_COMMON_Handler_crash(), At24cRead(), At24cWrite(), emulation_options_parse(), LuaThread(), main(), MmCardMount(), NutFtpProcessPwd(), NutFtpProcessRequest(), NutFtpProcessSystem(), NutFtpRespondBad(), NutFtpRespondOk(), NutFtpSendMode(), NutFtpServerSession(), NutFtpTransferFile(), NutThreadCreate(), NutUnixRaiseInterrupt(), PhatVolMount(), print_udp_icmp_error(), ptrace_dump_regs(), ptrace_stackdump_from(), Sc16is752UsartDeinit(), Sc16is752UsartDisable(), Sc16is752UsartEnable(), Sc16is752UsartGetClockMode(), Sc16is752UsartGetDataBits(), Sc16is752UsartGetFlowControl(), Sc16is752UsartGetParity(), Sc16is752UsartGetSpeed(), Sc16is752UsartGetStatus(), Sc16is752UsartGetStopBits(), Sc16is752UsartInit(), Sc16is752UsartRxStart(), Sc16is752UsartSetClockMode(), Sc16is752UsartSetDataBits(), Sc16is752UsartSetFlowControl(), Sc16is752UsartSetParity(), Sc16is752UsartSetSpeed(), Sc16is752UsartSetStatus(), Sc16is752UsartSetStopBits(), Sc16is752UsartTxStart(), Service(), ShowHardwareConfiguration(), Sleeper1(), Sleeper2(), Sleeper3(), Sleeper4(), SpiMmcMount(), StreamInit(), TimerEvent1(), TimerEvent2(), TimerEvent3(), TimerEvent4(), UDPReceiver(), unix_eeprom_acces(), UnixDevIOCTL(), upnp_Init(), X12Init(), X12RtcReadRegs(), and X12RtcWrite().

#define sprintf   sprintf_M
#define vprintf   vprintf_M
#define scanf   scanf_M
Examples:
caltime/caltime.c.
#define gets   gets_M
#define malloc   malloc_M
#define realloc   realloc_M
#define free   free_M
#define cprintf   printf_P

Redirected stdio routines.

Native stdio routines with format strings in program space are redirected to their Nut/OS implementation.

#define csprintf   sprintf_P
#define cscanf   scanf_P
#define csscanf   sscanf_P
#define memcpy_P (   dst,
  src_P,
 
)    cmemcpy(dst, src_P, n)
#define strcat_P (   s1,
  s2_P 
)    cstrcat(s1, s2_P)
#define strcmp_P (   s1,
  s2_P 
)    (-cstrcmp(s2_P, s1))
#define strlen_P (   s_P)    cstrlen(s_P)
#define strncat_P (   s1,
  s2_P,
 
)    cstrncat(s1, s2_P, n)
#define strncmp_P (   s1_P,
  s2,
 
)    cstrncmp(s1_P, s2, n)
#define strcpy_P (   dst,
  src_P 
)    cstrcpy(dst, src_P)
#define strncpy_P (   x,
  y,
 
)    cstrncpy(x,y,z)
#define strcasecmp (   s1,
  s2 
)    strcmp(s1, s2)

Case insensitive string comparisions.

Not supported by ICCAVR and temporarly redirected to the case sensitive routines.

Bug:
Case insensitive string comparisions fail with ICCAVR.
#define strncasecmp (   s1,
  s2,
 
)    strncmp(s1, s2, n)
#define __attribute__ (   x)

Object attribute support.

Not supported by ICCAVR.

#define PSTR (   p)    (p)

Declare static pointer to strings in program space.

No chance with ICCAVR.

#define PRG_RDB (   p)    (*((__flash char *)(p)))

Read byte from program space.

#define prog_char   __flash char

Character in program space.

#define prog_int   __flash int

Integer in program space.

#define PGM_P   prog_char *

Pointer to character in program space.

#define wdt_enable (   tmo)
Value:
{ \
    register unsigned char s = _BV(WDCE) | _BV(WDE); \
    register unsigned char r = tmo | _BV(WDE); \
    asm("in R0, 0x3F\n"     \
        "cli\n"             \
        "wdr\n"             \
        "out 0x21, %s\n"    \
        "out 0x21, %r\n"    \
        "out 0x3F, R0\n");  \
}

Referenced by AvrWatchDogEnable(), and AvrWatchDogStart().

#define wdt_disable ( )
Value:
{ \
    register unsigned char s = _BV(WDCE) | _BV(WDE); \
    register unsigned char r = 0;  \
    asm("in R0, $3F\n"      \
        "cli\n"             \
        "out 0x21, %s\n"    \
        "out 0x21, %r\n"    \
        "out 0x3F, R0\n");  \
}

Referenced by AvrWatchDogDisable().

#define wdt_reset ( )
Value:
{ \
    _WDR(); \
}

Referenced by AvrWatchDogRestart(), and AvrWatchDogStart().

#define __SFR_OFFSET   0
#define SFR_IO_ADDR (   sfr)    ((sfr) - __SFR_OFFSET)
#define SFR_MEM_ADDR (   sfr)    (sfr)
#define SFR_IO_REG_P (   sfr)    ((sfr) < 0x40 + __SFR_OFFSET)
#define _SFR_MEM8 (   addr)    (addr)
#define _SFR_MEM16 (   addr)    (addr)
#define BV (   x)    BIT(x)
#define _BV (   x)    BIT(x)
#define cli ( )    CLI()

Referenced by CSRead16(), CSReadPP32(), and CSWrite16().

#define sei ( )    SEI()

Referenced by CSRead16(), CSReadPP32(), and CSWrite16().

#define cbi (   reg,
  bit 
)    (reg &= ~BIT(bit))
#define sbi (   reg,
  bit 
)    (reg |= BIT(bit))
#define loop_until_bit_is_set (   reg,
  bit 
)    while((reg & BIT(bit)) == 0)

Referenced by AtCanInit(), and Sppi0Byte().

#define bit_is_clear (   reg,
  bit 
)    ((reg & BIT(bit)) == 0)
#define bit_is_set (   reg,
  bit 
)    ((reg & BIT(bit)) != 0)
#define parity_even_bit (   x)    (0)
#define SIGNAL (   x)    void x(void)
#define outb (   reg,
  val 
)    (reg = val)
#define inb (   reg)    (reg)
#define __AVR_ATmega103__
#define DOR   OVR
#define RAMEND   0x0FFF
#define WDCE   WDTOE
#define eeprom_read_block (   dst,
  addr,
  size 
)    EEPROMReadBytes((int)addr, dst, size)

Referenced by NutNvMemLoad(), and OnChipNvMemLoad().

#define eeprom_write_byte (   addr,
  src 
)    EEPROMwrite((int)addr, src)

Referenced by NutNvMemSave(), and OnChipNvMemSave().

#define eeprom_read_byte (   addr)    EEPROMread((int)addr)

Referenced by NutNvMemSave(), and OnChipNvMemSave().