Back to home page

LXR

 
 

    


File indexing completed on 2025-05-11 08:23:50

0001 /* SPDX-License-Identifier: BSD-2-Clause */
0002 
0003 /**
0004  * @file
0005  *
0006  * @ingroup RTEMSBSPsMIPSHurricane
0007  *
0008  * @brief Global BSP definitions.
0009  */
0010 
0011 /*
0012  *  COPYRIGHT (c) 1989-2012.
0013  *  On-Line Applications Research Corporation (OAR).
0014  *
0015  * Redistribution and use in source and binary forms, with or without
0016  * modification, are permitted provided that the following conditions
0017  * are met:
0018  * 1. Redistributions of source code must retain the above copyright
0019  *    notice, this list of conditions and the following disclaimer.
0020  * 2. Redistributions in binary form must reproduce the above copyright
0021  *    notice, this list of conditions and the following disclaimer in the
0022  *    documentation and/or other materials provided with the distribution.
0023  *
0024  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
0025  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
0026  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
0027  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
0028  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
0029  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
0030  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
0031  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
0032  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
0033  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
0034  * POSSIBILITY OF SUCH DAMAGE.
0035  */
0036 
0037 #ifndef LIBBSP_MIPS_HURRICANE_BSP_H
0038 #define LIBBSP_MIPS_HURRICANE_BSP_H
0039 
0040 /**
0041  * @defgroup RTEMSBSPsMIPSHurricane Hurricane
0042  *
0043  * @ingroup RTEMSBSPsMIPS
0044  *
0045  * @brief Hurricane Board Support Package.
0046  *
0047  * @{
0048  */
0049 
0050 #ifndef ASM
0051 
0052 #include <bspopts.h>
0053 #include <bsp/default-initial-extension.h>
0054 
0055 #include <rtems.h>
0056 #include <libcpu/rm5231.h>
0057 
0058 #ifdef __cplusplus
0059 extern "C" {
0060 #endif
0061 
0062 extern void WriteDisplay( char * string );
0063 
0064 extern uint32_t mips_get_timer( void );
0065 
0066 #define BSP_FEATURE_IRQ_EXTENSION
0067 #define BSP_SHARED_HANDLER_SUPPORT      1
0068 
0069 #define CPU_CLOCK_RATE_MHZ     (200)
0070 #define CLOCKS_PER_MICROSECOND ( CPU_CLOCK_RATE_MHZ ) /* equivalent to CPU clock speed in MHz */
0071 
0072 /*
0073  *  Simple spin delay in microsecond units for device drivers.
0074  *  This is very dependent on the clock speed of the target.
0075  *
0076  *  NOTE: This macro generates a warning like "integer constant out
0077  *        of range" which is safe to ignore.  In 64 bit mode, unsigned32
0078  *        types are actually 64 bits long so that comparisons between
0079  *        unsigned32 types and pointers are valid.  The warning is caused
0080  *        by code in the delay macro that is necessary for 64 bit mode.
0081  */
0082 
0083 #define rtems_bsp_delay( microseconds ) \
0084   { \
0085      uint32_t _end_clock = \
0086           mips_get_timer() + microseconds * CLOCKS_PER_MICROSECOND; \
0087      _end_clock %= 0x100000000;  /* make sure result is 32 bits */ \
0088      \
0089      /* handle timer overflow, if necessary */ \
0090      while ( _end_clock < mips_get_timer() );  \
0091      \
0092      while ( _end_clock > mips_get_timer() ); \
0093   }
0094 
0095 /* Constants */
0096 
0097 #define RAM_START 0
0098 #define RAM_END   0x100000
0099 
0100 /*
0101  * Prototypes for methods called from .S for dependency tracking
0102  */
0103 void init_tlb(void);
0104 void resettlb(int i);
0105 
0106 #ifdef __cplusplus
0107 }
0108 #endif
0109 
0110 #endif /* !ASM */
0111 
0112 /** @} */
0113 
0114 #endif  /* __HURRICANE_BSP_h */