📄 flsystem.h
字号:
/******************************************************************************/
/* */
/* Copyright (C), 1995-2006, msystems Ltd. 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. Neither the name of msystems nor the names of its contributors may be */
/* used to endorse or promote products derived from this software without */
/* specific prior written permission. */
/* */
/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
/* "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 COPYRIGHT */
/* OWNER OR CONTRIBUTORS 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. */
/* */
/******************************************************************************/
/*******************************************************************************
* *
* Module: FLSYSTEM *
* *
* This module implements VxWorks-to-TFFS bindings. *
* *
*******************************************************************************/
/*
* $Log: V:/PVCSDB/DiskOnChip/archives/Embedded/OS/VxWorks/1.0/examples/drivers/vxworks/system/flsystem.h-arc $
*
* Rev 1.0 Aug 20 2006 14:11:24 Alexander.Geller
* Initial revision.
*
* Rev 1.1 Aug 03 2004 20:24:22 andrayk
* tffsRAMxxx macros removed
*
* Rev 1.0 12 Aug 2003 01:58:12 andrayk
* Initial revision.
*/
#ifndef FLSYSTEM_H
#define FLSYSTEM_H
#ifdef __cplusplus
extern "C" {
#endif
/* VxWorks #includes */
#include <vxWorks.h>
#include <tickLib.h>
#include <sysLib.h>
#include <semLib.h>
#include <ioLib.h>
#include <errnoLib.h>
#include <taskLib.h>
#include <memLib.h>
/* ANSI C #includes */
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
#include <ctype.h>
/* CPU target
*
* Use compiler switches or insert a #pragma here to select the CPU type
* you are targeting.
*
* If the target is an Intel 80386 or above, also uncomment the CPU_i386
* definition.
*/
/* defined in Makefile */
/* NULL constant
*
* Some compilers require a different definition for the NULL pointer
*/
/* using VxWorks default */
/* Little-endian/big-endian
*
* If your machine uses the big-endian (Motorola) format, uncomment the
* following line.
*
* This compilation flag makes sure that FAT and translation layer structures
* will be written in little-endian (Intel) format for integers. It also
* affects the way DiskOnChip 16 bits registers are analized.
*/
/* using VxWorks #define _BYTE_ORDER here */
#ifndef _BYTE_ORDER
#error "byte order is not defined"
#else /* _BYTE_ORDER */
#if (_BYTE_ORDER == _BIG_ENDIAN)
#define FL_BIG_ENDIAN
#else /* (_BYTE_ORDER == _BIG_ENDIAN) */
#undef FL_BIG_ENDIAN
#endif /* (_BYTE_ORDER == _BIG_ENDIAN) */
#endif /* _BYTE_ORDER */
/* Far pointers
*
* Specify here which pointers may be far, if any.
* Far pointers are usually relevant only to 80x86 architectures.
*
* Specify FAR_LEVEL:
* 0 - if using a flat memory model or having no far pointers.
* 1 - if only the socket window may be far
* 2 - if only the socket window and caller's read/write buffers
* may be far.
* 3 - if socket window, caller's read/write buffers and the
* caller's I/O request packet may be far
*/
#define FAR_LEVEL 0
/*
* Routines for 32-bit transfers to/from DiskOnChip I/O window
*/
#define tffscpy flcpy32
#define tffscmp flcmp32
#define tffsset flset32
extern void* flcpy32 (void *dest, const void *src, size_t count); /* flsysvxw.c */
extern void* flset32 (void *dest, int val, size_t count); /* flsysvxw.c */
extern int flcmp32 (const void *dest, const void *src, size_t count); /* flsysvxw.c */
/* Pointer arithmetic
*
* The following macros define machine- and compiler-dependent macros for
* handling pointers to physical window addresses. The definitions below are
* for PC real-mode Borland-C.
*
* 'physicalToPointer' translates a physical flat address to a (far) pointer.
* Note that if when your processor uses virtual memory, the code should
* map the physical address to virtual memory, and return a pointer to that
* memory (the size parameter tells how much memory should be mapped).
*
* 'addToFarPointer' adds an increment to a pointer and returns a new
* pointer. The increment may be as large as your window size. The code
* below assumes that the increment may be larger than 64 KB and so performs
* huge pointer arithmetic.
*/
#define physicalToPointer(physical,size,drive) ((void *) (physical))
#define pointerToPhysical(ptr) ((unsigned long)(ptr))
#define addToFarPointer(base,increment) ((void *) ((unsigned char *) (base) + (increment)))
#define freePointer(ptr,size) { /* not used */ }
#define subFromFarPointer(base,increment) ((void *) &(((unsigned char *)(base))[-increment]))
#define distanceBetweenFarPointers(ptr1, ptr2) (((unsigned long)(ptr1)) - ((unsigned long)(ptr2)))
/*
* signed/unsigned char
*
* It is assumed that 'char' is signed. If this is not your compiler
* default, use compiler switches, or insert a #pragma here to define this.
*
*/
/* char is signed by default in GNU C */
/* Mutex type
*
* If you intend to access the FLite API in a multi-tasking environment,
* you may need to implement some resource management and mutual-exclusion
* of FLite with mutex & semaphore services that are available to you. In
* this case, define here the Mutex type you will use, and provide your own
* implementation of the Mutex functions incustom.c
*
* By default, a Mutex is defined as a simple counter, and the Mutex
* functions in custom.c implement locking and unlocking by incrementing
* and decrementing the counter. This will work well on all single-tasking
* environment, as well as on many multi-tasking environments.
*/
typedef SEM_ID FLMutex;
/* Memory allocation
*
* The translation layers (e.g. FTL, NFTL, INFTL, SAFTL) need to allocate
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -