Initial commit

This commit is contained in:
Tobias Mädel 2021-05-22 22:46:18 +02:00
commit d02335886d
No known key found for this signature in database
GPG Key ID: 494E2F56C30460E1
13 changed files with 751 additions and 0 deletions

13
.gitignore vendored Normal file
View File

@ -0,0 +1,13 @@
# Build files
/build-fx
/build-cg
/*.g1a
/*.g3a
# Python bytecode
__pycache__/
# Common IDE files
*.sublime-project
*.sublime-workspace
.vscode

181
Makefile Normal file
View File

@ -0,0 +1,181 @@
#! /usr/bin/make -f
# Default Makefile for fxSDK add-ins. This file was probably copied there by
# the [fxsdk] program.
#---
#
# Configuration
#
include project.cfg
# Compiler flags
CFLAGSFX = $(CFLAGS) $(CFLAGS_FX) $(INCLUDE_FX)
CFLAGSCG = $(CFLAGS) $(CFLAGS_CG) $(INCLUDE_CG)
# Linker flags
LDFLAGSFX := $(LDFLAGS) $(LDFLAGS_FX)
LDFLAGSCG := $(LDFLAGS) $(LDFLAGS_CG)
# Dependency list generation flags
depflags = -MMD -MT $@ -MF $(@:.o=.d) -MP
# ELF to binary flags
BINFLAGS := -R .bss -R .gint_bss
# G1A and G3A generation flags
NAME_G1A ?= $(NAME)
NAME_G3A ?= $(NAME)
G1AF := -i "$(ICON_FX)" -n "$(NAME_G1A)" --internal="$(INTERNAL)"
G3AF := -n basic:"$(NAME_G3A)" -i uns:"$(ICON_CG_UNS)" -i sel:"$(ICON_CG_SEL)"
ifeq "$(TOOLCHAIN_FX)" ""
TOOLCHAIN_FX := sh3eb-elf
endif
ifeq "$(TOOLCHAIN_CG)" ""
TOOLCHAIN_CG := sh4eb-elf
endif
# fxconv flags
FXCONVFX := --fx --toolchain=$(TOOLCHAIN_FX)
FXCONVCG := --cg --toolchain=$(TOOLCHAIN_CG)
# Determine the compiler install and include path
GCC_BASE_FX := $(shell $(TOOLCHAIN_FX)-gcc --print-search-dirs | grep install | sed 's/install: //')
GCC_BASE_CG := $(shell $(TOOLCHAIN_CG)-gcc --print-search-dirs | grep install | sed 's/install: //')
GCC_INCLUDE_FX := $(GCC_BASE_FX)/include
GCC_INCLUDE_CG := $(GCC_BASE_CG)/include
#
# File listings
#
NULL :=
TARGET := $(subst $(NULL) $(NULL),-,$(NAME))
ifeq "$(TARGET_FX)" ""
TARGET_FX := $(TARGET).g1a
endif
ifeq "$(TARGET_CG)" ""
TARGET_CG := $(TARGET).g3a
endif
ELF_FX := build-fx/$(shell basename "$(TARGET_FX)" .g1a).elf
BIN_FX := $(ELF_FX:.elf=.bin)
ELF_CG := build-cg/$(shell basename "$(TARGET_CG)" .g3a).elf
BIN_CG := $(ELF_CG:.elf=.bin)
# Source files
src := $(shell find src/ -name '*.[csS]')
assets-fx := $(shell find assets-fx/*/ -type f -not -name 'fxconv-metadata.txt')
assets-cg := $(shell find assets-cg/*/ -type f -not -name 'fxconv-metadata.txt')
meta-fx := $(shell find assets-fx -name 'fxconv-metadata.txt')
meta-cg := $(shell find assets-cg -name 'fxconv-metadata.txt')
# Object files
obj-fx := $(src:%=build-fx/%.o) $(assets-fx:assets-fx/%=build-fx/assets/%.o)
obj-cg := $(src:%=build-cg/%.o) $(assets-cg:assets-cg/%=build-cg/assets/%.o)
# Additional dependencies
deps-fx := $(ICON_FX)
deps-cg := $(ICON_CG_UNS) $(ICON_CG_SEL)
# All targets
all :=
ifneq "$(wildcard build-fx)" ""
all += all-fx
endif
ifneq "$(wildcard build-cg)" ""
all += all-cg
endif
#
# Build rules
#
all: $(all)
all-fx: $(TARGET_FX)
all-cg: $(TARGET_CG)
$(TARGET_FX): $(obj-fx) $(deps-fx)
@ mkdir -p $(dir $@)
$(TOOLCHAIN_FX)-gcc -o $(ELF_FX) $(obj-fx) $(CFLAGSFX) $(LDFLAGSFX)
$(TOOLCHAIN_FX)-objcopy -O binary $(BINFLAGS) $(ELF_FX) $(BIN_FX)
fxg1a $(BIN_FX) -o $@ $(G1AF)
$(TARGET_CG): $(obj-cg) $(deps-cg)
@ mkdir -p $(dir $@)
$(TOOLCHAIN_CG)-gcc -o $(ELF_CG) $(obj-cg) $(CFLAGSCG) $(LDFLAGSCG)
$(TOOLCHAIN_CG)-objcopy -O binary $(BINFLAGS) $(ELF_CG) $(BIN_CG)
mkg3a $(G3AF) $(BIN_CG) $@
# C sources
build-fx/%.c.o: %.c
@ mkdir -p $(dir $@)
$(TOOLCHAIN_FX)-gcc -c $< -o $@ $(CFLAGSFX) $(depflags)
build-cg/%.c.o: %.c
@ mkdir -p $(dir $@)
$(TOOLCHAIN_CG)-gcc -c $< -o $@ $(CFLAGSCG) $(depflags)
# Assembler sources
build-fx/%.s.o: %.s
@ mkdir -p $(dir $@)
$(TOOLCHAIN_FX)-gcc -c $< -o $@ -Wa,--dsp
build-cg/%.s.o: %.s
@ mkdir -p $(dir $@)
$(TOOLCHAIN_CG)-gcc -c $< -o $@ -Wa,--dsp
# Preprocessed assembler sources
build-fx/%.S.o: %.S
@ mkdir -p $(dir $@)
$(TOOLCHAIN_FX)-gcc -c $< -o $@ $(INCLUDE_FX) -Wa,--dsp
build-cg/%.S.o: %.S
@ mkdir -p $(dir $@)
$(TOOLCHAIN_CG)-gcc -c $< -o $@ $(INCLUDE_CG) -Wa,--dsp
# Assets
build-fx/assets/%.o: assets-fx/% $(meta-fx)
@ mkdir -p $(dir $@)
fxconv $< -o $@ $(FXCONVFX)
build-cg/assets/%.o: assets-cg/% $(meta-cg)
@ mkdir -p $(dir $@)
fxconv $< -o $@ $(FXCONVCG)
#
# Cleaning and utilities
#
# Dependency information
-include $(shell find build* -name *.d 2> /dev/null)
build-fx/%.d: ;
build-cg/%.d: ;
.PRECIOUS: build-fx build-cg build-fx/%.d build-cg/%.d %/
clean-fx:
@ rm -rf build-fx/
clean-cg:
@ rm -rf build-cg/
distclean-fx: clean-fx
@ rm -f $(TARGET_FX)
distclean-cg: clean-cg
@ rm -f $(TARGET_CG)
clean: clean-fx clean-cg
distclean: distclean-fx distclean-cg
install-fx: $(TARGET_FX)
p7 send -f $<
install-cg: $(TARGET_CG)
@ while [[ ! -h /dev/Prizm1 ]]; do sleep 0.25; done
@ while ! mount /dev/Prizm1; do sleep 0.25; done
@ rm -f /mnt/prizm/$<
@ cp $< /mnt/prizm
@ umount /dev/Prizm1
@- eject /dev/Prizm1
.PHONY: all all-fx all-cg clean distclean install-fx install-cg

BIN
assets-cg/icon-sel.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.2 KiB

BIN
assets-cg/icon-uns.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

BIN
assets-cg/img/example.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

View File

@ -0,0 +1,3 @@
example.png:
type: bopti-image
name: img_example

BIN
assets-fx/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

BIN
assets-fx/img/example.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

View File

@ -0,0 +1,3 @@
example.png:
type: bopti-image
name: img_example

88
project.cfg Normal file
View File

@ -0,0 +1,88 @@
#---
# fxSDK project configuration file for Fxip
#---
# Project name, should be at most 8 bytes long.
# (You can also specify NAME_G1A or NAME_G3A to override individually.)
NAME := Fxip
# Internal name, should be '@' followed by at most 7 uppercase letters.
# WARNING: If this convention is not followed, the add-in might not appear in
# the main menu of the calculator!
INTERNAL := @FXIP
# Output file name. The default is to take <NAME>, replace spaces with dashes,
# and add .g1a (or .g3a). You can specify a different folder if you want.
TARGET_FX :=
TARGET_CG :=
# fx-9860G icon location
ICON_FX = assets-fx/icon.png
# fx-CG 50 icon locations
ICON_CG_UNS = assets-cg/icon-uns.png
ICON_CG_SEL = assets-cg/icon-sel.png
#---
# Toolchain selection
#---
# Toolchain for fx9860g. Please see also CFLAGS_FX below.
TOOLCHAIN_FX := sh-elf
# Toolchain for fxcg50. Please see also CFLAGS_CG below.
TOOLCHAIN_CG := sh-elf
#---
# Compiler flags
#---
# Base compiler flags for the fxSDK, you usually want to keep these.
CFLAGS := -mb -ffreestanding -nostdlib -fstrict-volatile-bitfields
# Platform-specific compiler flags.
# <> If you are using sh3eb-elf, use -m3. (You can do this on both FX and CG.)
# <> If you are using sh4eb-elf, use -m4-nofpu. (Not ideal on FX but works.)
# <> If you are using sh4eb-nofpu-elf, then your compiler will likely use the
# FPU and cause problems on the calculator. Consider another configuration.
# <> If you are using an sh-elf with several targets, specify whichever you
# support. I recommend -m3 on FX and -m4-nofpu on CG.
# Please see also TOOLCHAIN_FX and TOOLCHAIN_CG above.
CFLAGS_FX := -D FX9860G -D TARGET_FX9860G -m3
CFLAGS_CG := -D FXCG50 -D TARGET_FXCG50 -m4-nofpu
# Additional compiler flags, change to your own taste!
CFLAGS += -Wall -Wextra -Wno-missing-field-initializers -Os
# Include paths. Add one -I option for each folder from which you want to
# be able to include files with #include<>. The Makefile provides a variable
# GCC_INCLUDE_FX/GCC_INCLUDE_CG that represents the default include folder,
# which is useful for some libraries such as OpenLibm.
INCLUDE_FX = -I include
INCLUDE_CG = -I include
# Libraries. Add one -l option for each library you are using, and also
# suitable -L options if you have library files in custom folders. To use
# fxlib, add libfx.a to the project directory and use "-L . -lfx".
LIBS_FX :=
LIBS_CG :=
# Base linker flags for the fxSDK, you usually want to keep these.
LDFLAGS_FX := -T fx9860g.ld -lgint-fx $(LIBS_FX) -lgint-fx -lgcc
LDFLAGS_CG := -T fxcg50.ld -lgint-cg $(LIBS_CG) -lgint-cg -lgcc
# Additional linker flags, if you need any.
LDFLAGS :=
# Additional platform-specific linker flags.
LDFLAGS_FX += -Wl,-Map=build-fx/map
LDFLAGS_CG += -Wl,-Map=build-cg/map
#---
# File conversion parameters
#---
# Here you can add fxconv options for each converted file, individually.
# The syntax is "<type>.<file>". For example, to specify the parameters for a
# font named "hexa.png", you might write:
#
# FONT.hexa.png = charset:print grid.size:3x5 grid.padding:1

162
src/main.c Normal file
View File

@ -0,0 +1,162 @@
#include <gint/display.h>
#include <gint/keyboard.h>
#include <gint/gint.h>
#include <gint/std/stdio.h>
#include <gint/std/string.h>
#include <gint/std/stdlib.h>
/*
int Serial_ReadByte (unsigned char *dest); 0x040C
int Serial_ReadBytes (unsigned char *dest, int max, short *size); 0x040D
int Serial_WriteByte (unsigned char byte); 0x040E
int Serial_WriteBytes (unsigned char *src, int size); 0x040F
int Serial_GetRxBufferSize (void); 0x0411
int Serial_GetTxBufferFreeCapacity (void); 0x0412
int Serial_ClearReceiveBuffer (void); 0x0413
int Serial_ClearTransmitBuffer (void); 0x0414
0x1BB7 int Serial_Open( unsigned char *mode ); - 0x0418
0x1BB8 int Serial_Close( int mode ); - 0x0419
0x1BB9 int Serial_ReadOneByte( unsigned char*result ); - 0x040C
0x1BBA int Serial_ReadNBytes( unsigned char*result, int max_size, short*actually_transferred ); - 0x040D
0x1BBB int Serial_SpyNthByte( int byteno_to_spy, unsigned char*result ); - 0x0422
0x1BBC int Serial_BufferedTransmitOneByte( unsigned char byte_to_transmit ); - 0x040E
0x1BBD int Serial_DirectTransmitOneByte( unsigned char byte_to_transmit ); - 0x0410
0x1BBE int Serial_BufferedTransmitNBytes( unsigned char*bytes_to_transmit, int requested_count ); - 0x040F
0x1BBF int Serial_GetReceivedBytesAvailable( void ); - 0x0411
0x1BC0 int Serial_GetFreeTransmitSpace( void ); - 0x0412
0x1BC1 int Serial_ClearReceiveBuffer( void ); - 0x0413
0x1BC2 int Serial_ClearTransmitBuffer( void ); - 0x0414
In the documentation of syscall Serial_ReadBytes, dest is not a pointer, but this is unlikely. The same phenomenon occurs for the src parameter of syscall Serial_WriteBytes.
*/
int __Serial_Open (unsigned char *mode);
int __Serial_Close (int mode);
int __Serial_ReadByte (unsigned char *dest);
int __Serial_ReadBytes (unsigned char *dest, int max, short *size);
int __Serial_WriteByte (unsigned char byte);
int __Serial_WriteBytes (unsigned char *src, int size);
int __Serial_GetRxBufferSize (void);
int __Serial_GetTxBufferFreeCapacity (void);
int __Serial_ClearReceiveBuffer (void);
int __Serial_ClearTransmitBuffer (void);
void __OS_InnerWait_ms ( int delay_ms );
int serial_tx_bufsize = 0;
void casioos_serial_write_and_block(unsigned char *src, int size)
{
for (int i = 0; i < size; ++i)
{
while (__Serial_WriteByte(src[i]) != 0)
{
}
while (__Serial_GetTxBufferFreeCapacity() != serial_tx_bufsize)
{
__OS_InnerWait_ms(1);
}
}
}
static int casioos_Serial_Init()
{
unsigned char settings[5]={0,9,0,0,0};
__Serial_Open(settings);
serial_tx_bufsize = __Serial_GetTxBufferFreeCapacity();
return 0;
}
static void casioos_slip_init(void)
{
slipdev_init();
}
int numbytes;
static int casioos_slip_poll(void)
{
numbytes = slipdev_poll();
}
static void casioos_slip_send(void)
{
slipdev_send();
}
void slipdev_char_put(unsigned char c)
{
while (__Serial_WriteByte(c) != 0)
{
}
while (__Serial_GetTxBufferFreeCapacity() != serial_tx_bufsize)
{
__OS_InnerWait_ms(1);
}
}
int slipdev_char_poll(unsigned char *c)
{
return !__Serial_ReadByte(c);
}
char printfbuffer[100];
#define UIP_LLH_LEN 0
#define UIP_BUFSIZE 1900
extern uint16_t uip_len;
extern uint8_t uip_buf[UIP_BUFSIZE];
const char testdata[] = "\x45\x00\x00\x80\x9f\x21\x40\x00\x40\x01\x73\x45\x0a\x0a\x0a\x01" \
"\x0a\x0a\x0a\x02\x08\x00\x63\x84\x00\x07\x00\x02\xd1\x5f\xa9\x60" \
"\x00\x00\x00\x00\xa7\x24\x0f\x00\x00\x00\x00\x00\x10\x11\x12\x13" \
"\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f\x20\x21\x22\x23" \
"\x24\x25\x26\x27\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f\x30\x31\x32\x33" \
"\x34\x35\x36\x37\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f\x40\x41\x42\x43" \
"\x44\x45\x46\x47\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f\x50\x51\x52\x53" \
"\x54\x55\x56\x57\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f\x60\x61\x62\x63";
int main(void)
{
dclear(C_WHITE);
dtext(1, 1, C_BLACK, __TIMESTAMP__);
dupdate();
gint_world_switch(GINT_CALL(casioos_Serial_Init));
gint_world_switch(GINT_CALL(casioos_slip_init));
while (true)
{
/*gint_world_switch(GINT_CALL(casioos_slip_poll));
if (numbytes != 0)
{
snprintf(printfbuffer, sizeof(printfbuffer), "read: %d bytes", numbytes);
dclear(C_WHITE);
dtext(1, 20, C_BLACK, printfbuffer);
dupdate();
}*/
uip_len = sizeof(testdata);
memcpy(uip_buf, testdata, sizeof(testdata));
gint_world_switch(GINT_CALL(casioos_slip_send));
getkey();
}
getkey();
return 1;
}

214
src/slipdev.c Normal file
View File

@ -0,0 +1,214 @@
/*
* Copyright (c) 2001, Adam Dunkels.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote
* products derived from this software without specific prior
* written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This file is part of the uIP TCP/IP stack.
*
*
*/
/**
* \file
* SLIP protocol implementation
* \author Adam Dunkels <adam@dunkels.com>
*/
/**
* \addtogroup uip
* @{
*/
/**
* \defgroup slip Serial Line IP (SLIP) protocol
* @{
*
* The SLIP protocol is a very simple way to transmit IP packets over
* a serial line. It does not provide any framing or error control,
* and is therefore not very widely used today.
*
* This SLIP implementation requires two functions for accessing the
* serial device: slipdev_char_poll() and slipdev_char_put(). These
* must be implemented specifically for the system on which the SLIP
* protocol is to be run.
*/
/*
* This is a generic implementation of the SLIP protocol over an RS232
* (serial) device.
*
* Huge thanks to Ullrich von Bassewitz <uz@cc65.org> of cc65 fame for
* and endless supply of bugfixes, insightsful comments and
* suggestions, and improvements to this code!
*/
#include "slipdev.h"
#include <gint/std/string.h> /* For memcpy() */
#define SLIP_END 0xC0
#define SLIP_ESC 0xDB
#define SLIP_ESC_END 0xDC
#define SLIP_ESC_ESC 0xDE
#define UIP_LLH_LEN 0
#define UIP_BUFSIZE 1900
uint16_t uip_len;
uint8_t uip_buf[UIP_BUFSIZE] = {0};
static uint8_t slip_buf[UIP_BUFSIZE];
static uint16_t len, tmplen;
static uint8_t lastc;
/*-----------------------------------------------------------------------------------*/
/**
* Send the packet in the uip_buf and uip_appdata buffers using the
* SLIP protocol.
*
* The first 40 bytes of the packet (the IP and TCP headers) are read
* from the uip_buf buffer, and the following bytes (the application
* data) are read from the uip_appdata buffer.
*
* \return This function will always return 0.
*/
/*-----------------------------------------------------------------------------------*/
uint8_t
slipdev_send(void)
{
uint16_t i;
uint8_t *ptr;
uint8_t c;
slipdev_char_put(SLIP_END);
ptr = &uip_buf[UIP_LLH_LEN];
for(i = 0; i < uip_len; ++i) {
c = *ptr++;
switch(c) {
case SLIP_END:
slipdev_char_put(SLIP_ESC);
slipdev_char_put(SLIP_ESC_END);
break;
case SLIP_ESC:
slipdev_char_put(SLIP_ESC);
slipdev_char_put(SLIP_ESC_ESC);
break;
default:
slipdev_char_put(c);
break;
}
}
slipdev_char_put(SLIP_END);
return 0;
}
/*-----------------------------------------------------------------------------------*/
/**
* Poll the SLIP device for an available packet.
*
* This function will poll the SLIP device to see if a packet is
* available. It uses a buffer in which all avaliable bytes from the
* RS232 interface are read into. When a full packet has been read
* into the buffer, the packet is copied into the uip_buf buffer and
* the length of the packet is returned.
*
* \return The length of the packet placed in the uip_buf buffer, or
* zero if no packet is available.
*/
/*-----------------------------------------------------------------------------------*/
uint16_t
slipdev_poll(void)
{
uint8_t c;
while(slipdev_char_poll(&c)) {
switch(c) {
case SLIP_ESC:
lastc = c;
break;
case SLIP_END:
lastc = c;
/* End marker found, we copy our input buffer to the uip_buf
buffer and return the size of the packet we copied. */
memcpy(&uip_buf[UIP_LLH_LEN], slip_buf, len);
tmplen = len;
len = 0;
return tmplen;
default:
if(lastc == SLIP_ESC) {
lastc = c;
/* Previous read byte was an escape byte, so this byte will be
interpreted differently from others. */
switch(c) {
case SLIP_ESC_END:
c = SLIP_END;
break;
case SLIP_ESC_ESC:
c = SLIP_ESC;
break;
}
} else {
lastc = c;
}
slip_buf[len] = c;
++len;
if(len > UIP_BUFSIZE) {
len = 0;
}
break;
}
}
return 0;
}
/*-----------------------------------------------------------------------------------*/
/**
* Initialize the SLIP module.
*
* This function does not initialize the underlying RS232 device, but
* only the SLIP part.
*/
/*-----------------------------------------------------------------------------------*/
void
slipdev_init(void)
{
lastc = len = 0;
}
/*-----------------------------------------------------------------------------------*/
/** @} */
/** @} */

87
src/slipdev.h Normal file
View File

@ -0,0 +1,87 @@
/*
* Copyright (c) 2001, Adam Dunkels.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote
* products derived from this software without specific prior
* written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This file is part of the uIP TCP/IP stack.
*
*
*/
/**
* \file
* SLIP header file.
* \author Adam Dunkels <adam@dunkels.com>
*/
/**
* \addtogroup slip
* @{
*/
#ifndef SLIPDEV_H_
#define SLIPDEV_H_
#include "stdint.h"
/**
* Put a character on the serial device.
*
* This function is used by the SLIP implementation to put a character
* on the serial device. It must be implemented specifically for the
* system on which the SLIP implementation is to be run.
*
* \param c The character to be put on the serial device.
*/
void slipdev_char_put(uint8_t c);
/**
* Poll the serial device for a character.
*
* This function is used by the SLIP implementation to poll the serial
* device for a character. It must be implemented specifically for the
* system on which the SLIP implementation is to be run.
*
* The function should return immediately regardless if a character is
* available or not. If a character is available it should be placed
* at the memory location pointed to by the pointer supplied by the
* argument c.
*
* \param c A pointer to a byte that is filled in by the function with
* the received character, if available.
*
* \retval 0 If no character is available.
* \retval Non-zero If a character is available.
*/
uint8_t slipdev_char_poll(uint8_t *c);
void slipdev_init(void);
uint8_t slipdev_send(void);
uint16_t slipdev_poll(void);
#endif /* SLIPDEV_H_ */
/** @} */