initial changes
This commit is contained in:
@@ -0,0 +1,99 @@
|
||||
#ifndef __ALT_PRIV_ALARM_H__
|
||||
#define __ALT_PRIV_ALARM_H__
|
||||
|
||||
/******************************************************************************
|
||||
* *
|
||||
* License Agreement *
|
||||
* *
|
||||
* Copyright (c) 2017,2004 Altera Corporation, San Jose, California, USA. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a *
|
||||
* copy of this software and associated documentation files (the "Software"), *
|
||||
* to deal in the Software without restriction, including without limitation *
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
|
||||
* and/or sell copies of the Software, and to permit persons to whom the *
|
||||
* Software is furnished to do so, subject to the following conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in *
|
||||
* all copies or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *
|
||||
* DEALINGS IN THE SOFTWARE. *
|
||||
* *
|
||||
* This agreement shall be governed in all respects by the laws of the State *
|
||||
* of California and by the laws of the United States of America. *
|
||||
* *
|
||||
* Altera does not recommend, suggest or require that this reference design *
|
||||
* file be used in conjunction or combination with any other product. *
|
||||
******************************************************************************/
|
||||
|
||||
/******************************************************************************
|
||||
* *
|
||||
* THIS IS A LIBRARY READ-ONLY SOURCE FILE. DO NOT EDIT. *
|
||||
* *
|
||||
******************************************************************************/
|
||||
|
||||
#include "alt_types.h"
|
||||
|
||||
/*
|
||||
* This header provides the internal definitions required by the public
|
||||
* interface alt_alarm.h. These variables and structures are not guaranteed to
|
||||
* exist in future implementations of the HAL.
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/*
|
||||
* "alt_alarm_s" is a structure type used to maintain lists of alarm callback
|
||||
* functions.
|
||||
*/
|
||||
|
||||
struct alt_alarm_s
|
||||
{
|
||||
alt_llist llist; /* linked list */
|
||||
alt_u64 time; /* time in system ticks of the callback */
|
||||
alt_u32 (*callback) (void* context); /* callback function. The return
|
||||
* value is the period for the next callback; where
|
||||
* zero indicates that the alarm should be removed
|
||||
* from the list.
|
||||
*/
|
||||
void* context; /* Argument for the callback */
|
||||
};
|
||||
|
||||
/*
|
||||
* "_alt_tick_rate" is a global variable used to store the system clock rate
|
||||
* in ticks per second. This is initialised to zero, which coresponds to there
|
||||
* being no system clock available.
|
||||
*
|
||||
* It is then set to it's final value by the system clock driver through a call
|
||||
* to alt_sysclk_init().
|
||||
*/
|
||||
|
||||
extern alt_u32 _alt_tick_rate;
|
||||
|
||||
/*
|
||||
* "_alt_nticks" is a global variable which records the elapsed number of
|
||||
* system clock ticks since the last call to settimeofday() or since reset if
|
||||
* settimeofday() has not been called.
|
||||
*/
|
||||
|
||||
extern volatile alt_u64 _alt_nticks;
|
||||
|
||||
/* The list of registered alarms. */
|
||||
|
||||
extern alt_llist alt_alarm_list;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ALT_PRIV_ALARM_H__ */
|
||||
@@ -0,0 +1,35 @@
|
||||
#ifndef __ALT_BUSY_SLEEP_H
|
||||
#define __ALT_BUSY_SLEEP_H
|
||||
|
||||
/*
|
||||
* Copyright (c) 2003 Altera Corporation, San Jose, California, USA.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal in the Software without restriction, including without limitation the
|
||||
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
* sell copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The function alt_busy_sleep provides a busy loop implementation of usleep.
|
||||
* This is used to provide usleep for the standalone HAL, or when the timer is
|
||||
* unavailable in uC/OS-II.
|
||||
*/
|
||||
|
||||
extern unsigned int alt_busy_sleep (unsigned int us);
|
||||
|
||||
#endif /* __ALT_BUSY_SLEEP_H */
|
||||
@@ -0,0 +1,77 @@
|
||||
#ifndef __ALT_DEV_LLIST_H__
|
||||
#define __ALT_DEV_LLIST_H__
|
||||
|
||||
/******************************************************************************
|
||||
* *
|
||||
* License Agreement *
|
||||
* *
|
||||
* Copyright (c) 2004 Altera Corporation, San Jose, California, USA. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a *
|
||||
* copy of this software and associated documentation files (the "Software"), *
|
||||
* to deal in the Software without restriction, including without limitation *
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
|
||||
* and/or sell copies of the Software, and to permit persons to whom the *
|
||||
* Software is furnished to do so, subject to the following conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in *
|
||||
* all copies or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *
|
||||
* DEALINGS IN THE SOFTWARE. *
|
||||
* *
|
||||
* This agreement shall be governed in all respects by the laws of the State *
|
||||
* of California and by the laws of the United States of America. *
|
||||
* *
|
||||
* Altera does not recommend, suggest or require that this reference design *
|
||||
* file be used in conjunction or combination with any other product. *
|
||||
******************************************************************************/
|
||||
|
||||
/******************************************************************************
|
||||
* *
|
||||
* THIS IS A LIBRARY READ-ONLY SOURCE FILE. DO NOT EDIT. *
|
||||
* *
|
||||
******************************************************************************/
|
||||
|
||||
#include "sys/alt_llist.h"
|
||||
#include "alt_types.h"
|
||||
|
||||
/*
|
||||
* This header provides the internal defenitions required to control file
|
||||
* access. These variables and functions are not guaranteed to exist in
|
||||
* future implementations of the HAL.
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/*
|
||||
* The alt_dev_llist is an internal structure used to form a common base
|
||||
* class for all device types. The use of this structure allows common code
|
||||
* to be used to manipulate the various device lists.
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
alt_llist llist;
|
||||
const char* name;
|
||||
} alt_dev_llist;
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
|
||||
extern int alt_dev_llist_insert (alt_dev_llist* dev, alt_llist* list);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ALT_DEV_LLIST_H__ */
|
||||
@@ -0,0 +1,39 @@
|
||||
#ifndef __ALT_EXCEPTION_HANDLER_REGISTRY_H__
|
||||
#define __ALT_EXCEPTION_HANDLER_REGISTRY_H__
|
||||
|
||||
/******************************************************************************
|
||||
* *
|
||||
* License Agreement *
|
||||
* *
|
||||
* Copyright (c) 2008 Altera Corporation, San Jose, California, USA. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a *
|
||||
* copy of this software and associated documentation files (the "Software"), *
|
||||
* to deal in the Software without restriction, including without limitation *
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
|
||||
* and/or sell copies of the Software, and to permit persons to whom the *
|
||||
* Software is furnished to do so, subject to the following conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in *
|
||||
* all copies or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *
|
||||
* DEALINGS IN THE SOFTWARE. *
|
||||
* *
|
||||
* This agreement shall be governed in all respects by the laws of the State *
|
||||
* of California and by the laws of the United States of America. *
|
||||
* *
|
||||
******************************************************************************/
|
||||
#include "sys/alt_exceptions.h"
|
||||
|
||||
/* Function pointer to exception callback routine */
|
||||
extern alt_exception_result (*alt_instruction_exception_handler)
|
||||
(alt_exception_cause, alt_u32, alt_u32);
|
||||
|
||||
#endif /* __ALT_EXCEPTION_HANDLER_REGISTRY_H__ */
|
||||
@@ -0,0 +1,179 @@
|
||||
#ifndef __ALT_FILE_H__
|
||||
#define __ALT_FILE_H__
|
||||
|
||||
/******************************************************************************
|
||||
* *
|
||||
* License Agreement *
|
||||
* *
|
||||
* Copyright (c) 2004 Altera Corporation, San Jose, California, USA. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a *
|
||||
* copy of this software and associated documentation files (the "Software"), *
|
||||
* to deal in the Software without restriction, including without limitation *
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
|
||||
* and/or sell copies of the Software, and to permit persons to whom the *
|
||||
* Software is furnished to do so, subject to the following conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in *
|
||||
* all copies or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *
|
||||
* DEALINGS IN THE SOFTWARE. *
|
||||
* *
|
||||
* This agreement shall be governed in all respects by the laws of the State *
|
||||
* of California and by the laws of the United States of America. *
|
||||
* *
|
||||
* Altera does not recommend, suggest or require that this reference design *
|
||||
* file be used in conjunction or combination with any other product. *
|
||||
******************************************************************************/
|
||||
|
||||
/******************************************************************************
|
||||
* *
|
||||
* THIS IS A LIBRARY READ-ONLY SOURCE FILE. DO NOT EDIT. *
|
||||
* *
|
||||
******************************************************************************/
|
||||
|
||||
#include "sys/alt_dev.h"
|
||||
#include "sys/alt_llist.h"
|
||||
#include "os/alt_sem.h"
|
||||
|
||||
#include "alt_types.h"
|
||||
|
||||
/*
|
||||
* This header provides the internal defenitions required to control file
|
||||
* access. These variables and functions are not guaranteed to exist in
|
||||
* future implementations of the HAL.
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/*
|
||||
* The function alt_find_dev() is used to search the device list "list" to
|
||||
* locate a device named "name". If a match is found, then a pointer to the
|
||||
* device is returned, otherwise NULL is returned.
|
||||
*/
|
||||
|
||||
extern alt_dev* alt_find_dev (const char* name, alt_llist* list);
|
||||
|
||||
/*
|
||||
* alt_find_file() is used to search the list of registered file systems to
|
||||
* find the filesystem that the file named "name" belongs to. If a match is
|
||||
* found, then a pointer to the filesystems alt_dev structure is returned,
|
||||
* otherwise NULL is returned.
|
||||
*
|
||||
* Note that a match does not indicate that the file exists, only that a
|
||||
* filesystem exists that is registered for a partition that could contain
|
||||
* the file. The filesystems open() function would need to be called in order
|
||||
* to determine if the file exists.
|
||||
*/
|
||||
|
||||
extern alt_dev* alt_find_file (const char* name);
|
||||
|
||||
/*
|
||||
* alt_get_fd() is used to allocate a file descriptor for the device or
|
||||
* filesystem "dev". A negative return value indicates an error, otherwise the
|
||||
* return value is the index of the file descriptor within the file descriptor
|
||||
* pool.
|
||||
*/
|
||||
|
||||
extern int alt_get_fd (alt_dev* dev);
|
||||
|
||||
/*
|
||||
* alt_release_fd() is called to free the file descriptor with index "fd".
|
||||
*/
|
||||
|
||||
extern void alt_release_fd (int fd);
|
||||
|
||||
/*
|
||||
* alt_fd_lock() is called by ioctl() to mark the file descriptor "fd" as
|
||||
* being open for exclusive access. Subsequent calls to open() for the device
|
||||
* associated with "fd" will fail. A device is unlocked by either calling
|
||||
* close() for "fd", or by an alternate call to ioctl() (see ioctl.c for
|
||||
* details).
|
||||
*/
|
||||
|
||||
extern int alt_fd_lock (alt_fd* fd);
|
||||
|
||||
/*
|
||||
* alt_fd_unlock() is called by ioctl() to unlock a descriptor previously
|
||||
* locked by a call to alt_fd_lock().
|
||||
*/
|
||||
|
||||
extern int alt_fd_unlock (alt_fd* fd);
|
||||
|
||||
/*
|
||||
* "alt_fd_list" is the pool of file descriptors.
|
||||
*/
|
||||
|
||||
extern alt_fd alt_fd_list[];
|
||||
|
||||
/*
|
||||
* flags used by alt_fd.
|
||||
*
|
||||
* ALT_FD_EXCL is used to mark a file descriptor as locked for exclusive
|
||||
* access, i.e. further calls to open() for the associated device should
|
||||
* fail.
|
||||
*
|
||||
* ALT_FD_DEV marks a dile descriptor as belonging to a device as oposed to a
|
||||
* filesystem.
|
||||
*/
|
||||
|
||||
#define ALT_FD_EXCL 0x80000000
|
||||
#define ALT_FD_DEV 0x40000000
|
||||
|
||||
#define ALT_FD_FLAGS_MASK (ALT_FD_EXCL | ALT_FD_DEV)
|
||||
|
||||
/*
|
||||
* "alt_dev_list" is the head of the linked list of registered devices.
|
||||
*/
|
||||
|
||||
extern alt_llist alt_dev_list;
|
||||
|
||||
/*
|
||||
* "alt_fs_list" is the head of the linked list of registered filesystems.
|
||||
*/
|
||||
|
||||
extern alt_llist alt_fs_list;
|
||||
|
||||
/*
|
||||
* "alt_fd_list_lock" is a semaphore used to ensure that access to the pool
|
||||
* of file descriptors is thread safe.
|
||||
*/
|
||||
|
||||
ALT_EXTERN_SEM(alt_fd_list_lock)
|
||||
|
||||
/*
|
||||
* "alt_max_fd" is a 'high water mark'. It indicates the highest file
|
||||
* descriptor allocated. Use of this can save searching the entire pool
|
||||
* for active file descriptors, which helps avoid contention on access
|
||||
* to the file descriptor pool.
|
||||
*/
|
||||
|
||||
extern alt_32 alt_max_fd;
|
||||
|
||||
/*
|
||||
* alt_io_redirect() is called at startup to redirect stdout, stdin, and
|
||||
* stderr to the devices named in the input arguments. By default these streams
|
||||
* are directed at /dev/null, and are then redirected using this function once
|
||||
* all of the devices have been registered within the system.
|
||||
*/
|
||||
|
||||
extern void alt_io_redirect(const char* stdout_dev,
|
||||
const char* stdin_dev,
|
||||
const char* stderr_dev);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ALT_FILE_H__ */
|
||||
@@ -0,0 +1,39 @@
|
||||
#ifndef __ALT_IIC_ISR_REGISTER_H_
|
||||
#define __ALT_IIC_ISR_REGISTER_H_
|
||||
|
||||
/******************************************************************************
|
||||
* *
|
||||
* License Agreement *
|
||||
* *
|
||||
* Copyright (c) 2009 Altera Corporation, San Jose, California, USA. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a *
|
||||
* copy of this software and associated documentation files (the "Software"), *
|
||||
* to deal in the Software without restriction, including without limitation *
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
|
||||
* and/or sell copies of the Software, and to permit persons to whom the *
|
||||
* Software is furnished to do so, subject to the following conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in *
|
||||
* all copies or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *
|
||||
* DEALINGS IN THE SOFTWARE. *
|
||||
* *
|
||||
* This agreement shall be governed in all respects by the laws of the State *
|
||||
* of California and by the laws of the United States of America. *
|
||||
* *
|
||||
******************************************************************************/
|
||||
#include "alt_types.h"
|
||||
#include "sys/alt_irq.h"
|
||||
|
||||
extern int alt_iic_isr_register(alt_u32 ic_id, alt_u32 irq, alt_isr_func isr,
|
||||
void *isr_context, void *flags);
|
||||
|
||||
#endif /* __ALT_IIC_ISR_REGISTER_H_ */
|
||||
@@ -0,0 +1,59 @@
|
||||
#ifndef __ALT_IRQ_TABLE_H__
|
||||
#define __ALT_IRQ_TABLE_H__
|
||||
|
||||
/******************************************************************************
|
||||
* *
|
||||
* License Agreement *
|
||||
* *
|
||||
* Copyright (c) 2009 Altera Corporation, San Jose, California, USA. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a *
|
||||
* copy of this software and associated documentation files (the "Software"), *
|
||||
* to deal in the Software without restriction, including without limitation *
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
|
||||
* and/or sell copies of the Software, and to permit persons to whom the *
|
||||
* Software is furnished to do so, subject to the following conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in *
|
||||
* all copies or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *
|
||||
* DEALINGS IN THE SOFTWARE. *
|
||||
* *
|
||||
* This agreement shall be governed in all respects by the laws of the State *
|
||||
* of California and by the laws of the United States of America. *
|
||||
* *
|
||||
******************************************************************************/
|
||||
|
||||
/******************************************************************************
|
||||
* *
|
||||
* THIS IS A LIBRARY READ-ONLY SOURCE FILE. DO NOT EDIT. *
|
||||
* *
|
||||
******************************************************************************/
|
||||
|
||||
/*
|
||||
* Definition of a table describing each interrupt handler. The index into
|
||||
* the array is the interrupt id associated with the handler.
|
||||
*
|
||||
* When an interrupt occurs, the associated handler is called with
|
||||
* the argument stored in the context member.
|
||||
*
|
||||
* The table is physically created in alt_irq_handler.c
|
||||
*/
|
||||
extern struct ALT_IRQ_HANDLER
|
||||
{
|
||||
#ifdef ALT_ENHANCED_INTERRUPT_API_PRESENT
|
||||
void (*handler)(void*);
|
||||
#else
|
||||
void (*handler)(void*, alt_u32);
|
||||
#endif
|
||||
void *context;
|
||||
} alt_irq[ALT_NIRQ];
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,158 @@
|
||||
#ifndef __ALT_LEGACY_IRQ_H__
|
||||
#define __ALT_LEGACY_IRQ_H__
|
||||
|
||||
/******************************************************************************
|
||||
* *
|
||||
* License Agreement *
|
||||
* *
|
||||
* Copyright (c) 2009 Altera Corporation, San Jose, California, USA. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a *
|
||||
* copy of this software and associated documentation files (the "Software"), *
|
||||
* to deal in the Software without restriction, including without limitation *
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
|
||||
* and/or sell copies of the Software, and to permit persons to whom the *
|
||||
* Software is furnished to do so, subject to the following conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in *
|
||||
* all copies or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *
|
||||
* DEALINGS IN THE SOFTWARE. *
|
||||
* *
|
||||
* This agreement shall be governed in all respects by the laws of the State *
|
||||
* of California and by the laws of the United States of America. *
|
||||
* *
|
||||
******************************************************************************/
|
||||
|
||||
/*
|
||||
* This file provides prototypes and inline implementations of certain routines
|
||||
* used by the legacy interrupt API. Do not include this in your driver or
|
||||
* application source files, use "sys/alt_irq.h" instead to access the proper
|
||||
* public API.
|
||||
*/
|
||||
|
||||
#include <errno.h>
|
||||
#include "system.h"
|
||||
|
||||
#ifndef NIOS2_EIC_PRESENT
|
||||
|
||||
#include "nios2.h"
|
||||
#include "alt_types.h"
|
||||
|
||||
#include "sys/alt_irq.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/*
|
||||
* alt_irq_register() can be used to register an interrupt handler. If the
|
||||
* function is succesful, then the requested interrupt will be enabled upon
|
||||
* return.
|
||||
*/
|
||||
extern int alt_irq_register (alt_u32 id,
|
||||
void* context,
|
||||
alt_isr_func handler);
|
||||
|
||||
/*
|
||||
* alt_irq_disable() disables the individual interrupt indicated by "id".
|
||||
*/
|
||||
static ALT_INLINE int ALT_ALWAYS_INLINE alt_irq_disable (alt_u32 id)
|
||||
{
|
||||
alt_irq_context status;
|
||||
extern volatile alt_u32 alt_irq_active;
|
||||
|
||||
status = alt_irq_disable_all ();
|
||||
|
||||
alt_irq_active &= ~(1 << id);
|
||||
NIOS2_WRITE_IENABLE (alt_irq_active);
|
||||
|
||||
alt_irq_enable_all(status);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* alt_irq_enable() enables the individual interrupt indicated by "id".
|
||||
*/
|
||||
static ALT_INLINE int ALT_ALWAYS_INLINE alt_irq_enable (alt_u32 id)
|
||||
{
|
||||
alt_irq_context status;
|
||||
extern volatile alt_u32 alt_irq_active;
|
||||
|
||||
status = alt_irq_disable_all ();
|
||||
|
||||
alt_irq_active |= (1 << id);
|
||||
NIOS2_WRITE_IENABLE (alt_irq_active);
|
||||
|
||||
alt_irq_enable_all(status);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifndef ALT_EXCEPTION_STACK
|
||||
/*
|
||||
* alt_irq_initerruptable() should only be called from within an ISR. It is used
|
||||
* to allow higer priority interrupts to interrupt the current ISR. The input
|
||||
* argument, "priority", is the priority, i.e. interrupt number of the current
|
||||
* interrupt.
|
||||
*
|
||||
* If this function is called, then the ISR is required to make a call to
|
||||
* alt_irq_non_interruptible() before returning. The input argument to
|
||||
* alt_irq_non_interruptible() is the return value from alt_irq_interruptible().
|
||||
*
|
||||
* Care should be taken when using this pair of functions, since they increasing
|
||||
* the system overhead associated with interrupt handling.
|
||||
*
|
||||
* If you are using an exception stack then nested interrupts won't work, so
|
||||
* these functions are not available in that case.
|
||||
*/
|
||||
static ALT_INLINE alt_u32 ALT_ALWAYS_INLINE alt_irq_interruptible (alt_u32 priority)
|
||||
{
|
||||
extern volatile alt_u32 alt_priority_mask;
|
||||
extern volatile alt_u32 alt_irq_active;
|
||||
|
||||
alt_u32 old_priority;
|
||||
|
||||
old_priority = alt_priority_mask;
|
||||
alt_priority_mask = (1 << priority) - 1;
|
||||
|
||||
NIOS2_WRITE_IENABLE (alt_irq_active & alt_priority_mask);
|
||||
|
||||
NIOS2_WRITE_STATUS (1);
|
||||
|
||||
return old_priority;
|
||||
}
|
||||
|
||||
/*
|
||||
* See Comments above for alt_irq_interruptible() for an explanation of the use of this
|
||||
* function.
|
||||
*/
|
||||
static ALT_INLINE void ALT_ALWAYS_INLINE alt_irq_non_interruptible (alt_u32 mask)
|
||||
{
|
||||
extern volatile alt_u32 alt_priority_mask;
|
||||
extern volatile alt_u32 alt_irq_active;
|
||||
|
||||
NIOS2_WRITE_STATUS (0);
|
||||
|
||||
alt_priority_mask = mask;
|
||||
|
||||
NIOS2_WRITE_IENABLE (mask & alt_irq_active);
|
||||
}
|
||||
#endif /* ALT_EXCEPTION_STACK */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* NIOS2_EIC_PRESENT */
|
||||
|
||||
#endif /* __ALT_LEGACY_IRQ_H__ */
|
||||
@@ -0,0 +1,77 @@
|
||||
#ifndef __ALT_NO_ERROR_H__
|
||||
#define __ALT_NO_ERROR_H__
|
||||
|
||||
/******************************************************************************
|
||||
* *
|
||||
* License Agreement *
|
||||
* *
|
||||
* Copyright (c) 2004 Altera Corporation, San Jose, California, USA. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a *
|
||||
* copy of this software and associated documentation files (the "Software"), *
|
||||
* to deal in the Software without restriction, including without limitation *
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
|
||||
* and/or sell copies of the Software, and to permit persons to whom the *
|
||||
* Software is furnished to do so, subject to the following conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in *
|
||||
* all copies or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *
|
||||
* DEALINGS IN THE SOFTWARE. *
|
||||
* *
|
||||
* This agreement shall be governed in all respects by the laws of the State *
|
||||
* of California and by the laws of the United States of America. *
|
||||
* *
|
||||
* Altera does not recommend, suggest or require that this reference design *
|
||||
* file be used in conjunction or combination with any other product. *
|
||||
******************************************************************************/
|
||||
|
||||
/******************************************************************************
|
||||
* *
|
||||
* THIS IS A LIBRARY READ-ONLY SOURCE FILE. DO NOT EDIT. *
|
||||
* *
|
||||
******************************************************************************/
|
||||
|
||||
#include "alt_types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/*
|
||||
* alt_no_error() is a dummy function used by alt_sem.h and alt_flag.h. It
|
||||
* substitutes for functions that have a return code by creating a function
|
||||
* that always returns zero.
|
||||
*
|
||||
* This may seem a little obscure, but what happens is that the compiler can
|
||||
* then optomise away the call to this function, and any code written which
|
||||
* handles the error path (i.e. non zero return values).
|
||||
*
|
||||
* This allows code to be written which correctly use the uC/OS-II semaphore
|
||||
* and flag utilities, without the use of those utilities impacting on
|
||||
* excutables built for a single threaded HAL environment.
|
||||
*
|
||||
* This function is considered to be part of the internal implementation of
|
||||
* the HAL, and should not be called directly by application code or device
|
||||
* drivers. It is not guaranteed to be preserved in future versions of the
|
||||
* HAL.
|
||||
*/
|
||||
|
||||
static ALT_INLINE int ALT_ALWAYS_INLINE alt_no_error (void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ALT_NO_ERROR_H__ */
|
||||
@@ -0,0 +1,47 @@
|
||||
/******************************************************************************
|
||||
* *
|
||||
* License Agreement *
|
||||
* *
|
||||
* Copyright (c) 2003 Altera Corporation, San Jose, California, USA. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a *
|
||||
* copy of this software and associated documentation files (the "Software"), *
|
||||
* to deal in the Software without restriction, including without limitation *
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
|
||||
* and/or sell copies of the Software, and to permit persons to whom the *
|
||||
* Software is furnished to do so, subject to the following conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in *
|
||||
* all copies or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *
|
||||
* DEALINGS IN THE SOFTWARE. *
|
||||
* *
|
||||
* This agreement shall be governed in all respects by the laws of the State *
|
||||
* of California and by the laws of the United States of America. *
|
||||
* *
|
||||
******************************************************************************/
|
||||
#ifndef NIOS2_GMON_DATA_H
|
||||
#define NIOS2_GMON_DATA_H
|
||||
|
||||
#define GMON_DATA_SIG 0
|
||||
#define GMON_DATA_WORDS 1
|
||||
#define GMON_DATA_PROFILE_DATA 2
|
||||
#define GMON_DATA_PROFILE_LOWPC 3
|
||||
#define GMON_DATA_PROFILE_HIGHPC 4
|
||||
#define GMON_DATA_PROFILE_BUCKET 5
|
||||
#define GMON_DATA_PROFILE_RATE 6
|
||||
#define GMON_DATA_MCOUNT_START 7
|
||||
#define GMON_DATA_MCOUNT_LIMIT 8
|
||||
|
||||
#define GMON_DATA_SIZE 9
|
||||
|
||||
extern unsigned int alt_gmon_data[GMON_DATA_SIZE];
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user