mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-09-02 04:13:54 -04:00
Update SuperH port to include WEB server.
This commit is contained in:
parent
bbe10cf550
commit
92ae2d0724
32 changed files with 3612 additions and 137 deletions
94
Demo/SuperH_SH7216_Renesas/RTOSDemo/RenesasCode/compiler.h
Normal file
94
Demo/SuperH_SH7216_Renesas/RTOSDemo/RenesasCode/compiler.h
Normal file
|
@ -0,0 +1,94 @@
|
|||
/******************************************************************************
|
||||
* File Name : compiler.h
|
||||
* Version : 1.0
|
||||
* Device(s) : Renesas
|
||||
* Tool-Chain : Renesas SH2A V9+
|
||||
* OS : None
|
||||
* H/W Platform : SH2A
|
||||
* Description : Compiler specific defines for abstraction
|
||||
*******************************************************************************
|
||||
* History : DD.MM.YYYY Ver. Description
|
||||
* : 01.08.2009 1.00 MAB First Release
|
||||
******************************************************************************/
|
||||
|
||||
/******************************************************************************
|
||||
* DISCLAIMER
|
||||
* This software is supplied by Renesas Technology Corp. and is only
|
||||
* intended for use with Renesas products. No other uses are authorized.
|
||||
* This software is owned by Renesas Technology Corp. and is protected under
|
||||
* all applicable laws, including copyright laws.
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES
|
||||
* REGARDING THIS SOFTWARE, WHETHER EXPRESS, IMPLIED OR STATUTORY,
|
||||
* INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
||||
* PARTICULAR PURPOSE AND NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY
|
||||
* DISCLAIMED.
|
||||
* TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY LAW, NEITHER RENESAS
|
||||
* TECHNOLOGY CORP. NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES
|
||||
* FOR ANY REASON RELATED TO THE THIS SOFTWARE, EVEN IF RENESAS OR ITS
|
||||
* AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
* Renesas reserves the right, without notice, to make changes to this
|
||||
* software and to discontinue the availability of this software.
|
||||
* By using this software, you agree to the additional terms and
|
||||
* conditions found by accessing the following link:
|
||||
* http://www.renesas.com/disclaimer
|
||||
******************************************************************************/
|
||||
/* Copyright (C) 2008. Renesas Technology Corp., All Rights Reserved. */
|
||||
/* Copyright (C) 2009. Renesas Technology Europe Ltd., All Rights Reserved. */
|
||||
/*****************************************************************************/
|
||||
|
||||
#ifndef COMPILER_H_INCLUDED
|
||||
#define COMPILER_H_INCLUDED
|
||||
|
||||
/******************************************************************************
|
||||
Defines
|
||||
******************************************************************************/
|
||||
|
||||
/* Embedded CPU data type definitions */
|
||||
|
||||
/* Set a few #defines for potential compilers used */
|
||||
#define MCS 0 /* Hitachi */
|
||||
#define GNU 1 /* Hitachi + many other devices */
|
||||
#define IAR 2 /* Hitachi + some other devices */
|
||||
#define MSV 3 /* Microsoft Visual C */
|
||||
|
||||
/* Test the compiler intrinisic defs */
|
||||
#ifdef __GNUC__ /* GNU compiler - C mode */
|
||||
#define COMPILER GNU
|
||||
|
||||
#elif defined(__GNUG__) /* GNU compiler - C++ mode */
|
||||
#define COMPILER GNU
|
||||
|
||||
#elif defined __IAR_SYSTEMS_ICC /* IAR compiler */
|
||||
#define COMPILER IAR
|
||||
|
||||
#elif defined _MSC_VER /* Microsoft c compiler */
|
||||
#define COMPILER MSV
|
||||
#else
|
||||
|
||||
#define COMPILER MCS /* MCS compiler */
|
||||
/* MCS compiler has MSB first even in little
|
||||
endian mode unless #pragma or command
|
||||
line switch used to change it */
|
||||
#define _BITFIELDS_MSB_FIRST_
|
||||
#endif
|
||||
|
||||
/******************************************************************************
|
||||
Pragma macros
|
||||
******************************************************************************/
|
||||
/* Visual Cpp */
|
||||
#if COMPILER == MSV
|
||||
#define PACK1 pack(1)
|
||||
#define UNPACK pack()
|
||||
#else
|
||||
/* MCS SH & H8S series recently got unified
|
||||
pragma syntax */
|
||||
#define PACK1 # ## pragma pack 1
|
||||
#define UNPACK # ## pragma unpack
|
||||
#endif
|
||||
|
||||
#endif /* COMPILER_H_INCLUDED */
|
||||
|
||||
/******************************************************************************
|
||||
End Of File
|
||||
******************************************************************************/
|
152
Demo/SuperH_SH7216_Renesas/RTOSDemo/RenesasCode/hwEthernet.h
Normal file
152
Demo/SuperH_SH7216_Renesas/RTOSDemo/RenesasCode/hwEthernet.h
Normal file
|
@ -0,0 +1,152 @@
|
|||
/******************************************************************************
|
||||
* DISCLAIMER
|
||||
* Please refer to http://www.renesas.com/disclaimer
|
||||
******************************************************************************
|
||||
Copyright (C) 2008. Renesas Technology Corp., All Rights Reserved.
|
||||
*******************************************************************************
|
||||
* File Name : hwEthernet.h
|
||||
* Version : 1.00
|
||||
* Description : Ethernet module device driver
|
||||
******************************************************************************
|
||||
* History : DD.MM.YYYY Version Description
|
||||
* : 06.10.2009 1.00 First Release
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef HWETHERNET_H_INCLUDED
|
||||
#define HWETHERNET_H_INCLUDED
|
||||
|
||||
/******************************************************************************
|
||||
Includes <System Includes> , "Project Includes"
|
||||
******************************************************************************/
|
||||
|
||||
#include "typedefine.h"
|
||||
|
||||
/******************************************************************************
|
||||
Typedef definitions
|
||||
******************************************************************************/
|
||||
typedef struct Discript
|
||||
{
|
||||
uint32_t status;
|
||||
ushort16_t bufsize;
|
||||
ushort16_t size;
|
||||
char8_t *buf_p;
|
||||
struct Discript *next;
|
||||
} ethfifo;
|
||||
|
||||
/******************************************************************************
|
||||
Macro definitions
|
||||
******************************************************************************/
|
||||
#define BUFSIZE 256
|
||||
#define ENTRY 8
|
||||
|
||||
#define ACT 0x80000000
|
||||
#define DL 0x40000000
|
||||
#define FP1 0x20000000
|
||||
#define FP0 0x10000000
|
||||
#define FE 0x08000000
|
||||
|
||||
#define RFOVER 0x00000200
|
||||
#define RMAF 0x00000080
|
||||
#define RRF 0x00000010
|
||||
#define RTLF 0x00000008
|
||||
#define RTSF 0x00000004
|
||||
#define PRE 0x00000002
|
||||
#define CERF 0x00000001
|
||||
|
||||
#define ITF 0x00000010
|
||||
#define CND 0x00000008
|
||||
#define DLC 0x00000004
|
||||
#define CD 0x00000002
|
||||
#define TRO 0x00000001
|
||||
|
||||
/**
|
||||
* Renesas Ethernet API return defines
|
||||
**/
|
||||
#define R_ETHER_OK 0
|
||||
#define R_ETHER_ERROR -1
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
Variable Externs
|
||||
******************************************************************************/
|
||||
|
||||
/******************************************************************************
|
||||
Functions Prototypes
|
||||
******************************************************************************/
|
||||
/**
|
||||
* Renesas Ethernet API prototypes
|
||||
**/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern int32_t R_Ether_Open(uint32_t ch, uint8_t mac_addr[]);
|
||||
extern int32_t R_Ether_Close(uint32_t ch);
|
||||
extern int32_t R_Ether_Write(uint32_t ch, void *buf, uint32_t len);
|
||||
extern int32_t R_Ether_Read(uint32_t ch, void *buf);
|
||||
|
||||
/* Added for the FreeRTOS demo project. */
|
||||
unsigned long ulEMACRead( void );
|
||||
void vEMACWrite( void );
|
||||
void vInitEmac( void );
|
||||
long lEMACWaitForLink( void );
|
||||
|
||||
/* Extension of the API functions added to allow PnP link */
|
||||
|
||||
/* R_Ether_OpenEx opens irrispective of link status */
|
||||
extern int32_t R_Ether_OpenEx(uint32_t ch, uint8_t mac_addr[]);
|
||||
/* Enables/disables operation for the current link */
|
||||
extern int32_t R_Ether_EnableEx(uint32_t ch, int iEnable);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************/
|
||||
/* Ethernet statistic collection data */
|
||||
struct enet_stats
|
||||
{
|
||||
uint32_t rx_packets; /* total packets received */
|
||||
uint32_t tx_packets; /* total packets transmitted */
|
||||
uint32_t rx_errors; /* bad packets received */
|
||||
uint32_t tx_errors; /* packet transmit problems */
|
||||
uint32_t rx_dropped; /* no space in buffers */
|
||||
uint32_t tx_dropped; /* no space available */
|
||||
uint32_t multicast; /* multicast packets received */
|
||||
uint32_t collisions;
|
||||
|
||||
/* detailed rx_errors: */
|
||||
uint32_t rx_length_errors;
|
||||
uint32_t rx_over_errors; /* receiver ring buffer overflow */
|
||||
uint32_t rx_crc_errors; /* recved pkt with crc error */
|
||||
uint32_t rx_frame_errors; /* recv'd frame alignment error */
|
||||
uint32_t rx_fifo_errors; /* recv'r fifo overrun */
|
||||
uint32_t rx_missed_errors; /* receiver missed packet */
|
||||
|
||||
/* detailed tx_errors */
|
||||
uint32_t tx_aborted_errors;
|
||||
uint32_t tx_carrier_errors;
|
||||
uint32_t tx_fifo_errors;
|
||||
uint32_t tx_heartbeat_errors;
|
||||
uint32_t tx_window_errors;
|
||||
};
|
||||
|
||||
struct ei_device
|
||||
{
|
||||
const char8_t *name;
|
||||
uchar8_t open;
|
||||
uchar8_t Tx_act;
|
||||
uchar8_t Rx_act;
|
||||
uchar8_t txing; /* Transmit Active */
|
||||
uchar8_t irqlock; /* EDMAC's interrupt disabled when '1'. */
|
||||
uchar8_t dmaing; /* EDMAC Active */
|
||||
ethfifo *rxcurrent; /* current receive discriptor */
|
||||
ethfifo *txcurrent; /* current transmit discriptor */
|
||||
uchar8_t save_irq; /* Original dev->irq value. */
|
||||
struct enet_stats stat;
|
||||
uchar8_t mac_addr[6];
|
||||
};
|
||||
|
||||
#endif /* HWETHERNET_H_INCLUDED */
|
||||
|
|
@ -0,0 +1,91 @@
|
|||
/******************************************************************************
|
||||
* File Name : hwEthernetPhy.h
|
||||
* Version : 1.0
|
||||
* Device(s) : Renesas
|
||||
* Tool-Chain : Renesas SH2A V9+
|
||||
* OS : None
|
||||
* H/W Platform : SH2A
|
||||
* Description : Hardware driver for the LAN8700 PHY
|
||||
*******************************************************************************
|
||||
* History : DD.MM.YYYY Ver. Description
|
||||
* : 01.08.2009 1.00 MAB First Release
|
||||
******************************************************************************/
|
||||
|
||||
/******************************************************************************
|
||||
* DISCLAIMER
|
||||
* This software is supplied by Renesas Technology Corp. and is only
|
||||
* intended for use with Renesas products. No other uses are authorized.
|
||||
* This software is owned by Renesas Technology Corp. and is protected under
|
||||
* all applicable laws, including copyright laws.
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES
|
||||
* REGARDING THIS SOFTWARE, WHETHER EXPRESS, IMPLIED OR STATUTORY,
|
||||
* INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
||||
* PARTICULAR PURPOSE AND NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY
|
||||
* DISCLAIMED.
|
||||
* TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY LAW, NEITHER RENESAS
|
||||
* TECHNOLOGY CORP. NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES
|
||||
* FOR ANY REASON RELATED TO THE THIS SOFTWARE, EVEN IF RENESAS OR ITS
|
||||
* AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
* Renesas reserves the right, without notice, to make changes to this
|
||||
* software and to discontinue the availability of this software.
|
||||
* By using this software, you agree to the additional terms and
|
||||
* conditions found by accessing the following link:
|
||||
* http://www.renesas.com/disclaimer
|
||||
******************************************************************************/
|
||||
/* Copyright (C) 2008. Renesas Technology Corp., All Rights Reserved. */
|
||||
/* Copyright (C) 2009. Renesas Technology Europe Ltd., All Rights Reserved. */
|
||||
/*****************************************************************************/
|
||||
|
||||
#ifndef HWETHERNETPHY_H_INCLUDED
|
||||
#define HWETHERNETPHY_H_INCLUDED
|
||||
|
||||
/*****************************************************************************
|
||||
Enumerated Types
|
||||
******************************************************************************/
|
||||
|
||||
typedef enum _NETLNK
|
||||
{
|
||||
PHY_NO_LINK = 0,
|
||||
PHY_LINK_10H,
|
||||
PHY_LINK_10F,
|
||||
PHY_LINK_100H,
|
||||
PHY_LINK_100F
|
||||
|
||||
} NETLNK;
|
||||
|
||||
/*****************************************************************************
|
||||
Public Functions
|
||||
******************************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*****************************************************************************
|
||||
Function Name: phyReset
|
||||
Description: Executes software reset of PHY and sets to auto negotiate link
|
||||
Parameters: None
|
||||
Return value: 0 for success -1 on error
|
||||
******************************************************************************/
|
||||
|
||||
extern int phyReset(void);
|
||||
|
||||
/*****************************************************************************
|
||||
Function Name: phyStatus
|
||||
Description: Function to reurn the type of physical link
|
||||
Parameters: none
|
||||
Return value: The link type
|
||||
*****************************************************************************/
|
||||
|
||||
extern NETLNK phyStatus(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* HWETHERNETPHY_H_INCLUDED */
|
||||
|
||||
/*****************************************************************************
|
||||
End Of File
|
||||
******************************************************************************/
|
|
@ -0,0 +1,435 @@
|
|||
/******************************************************************************
|
||||
* File Name : hwEthernetPhy.c
|
||||
* Version : 1.0
|
||||
* Device(s) : Renesas
|
||||
* Tool-Chain : Renesas SH2A V9+
|
||||
* OS : None
|
||||
* H/W Platform : SH2A
|
||||
* Description : Hardware driver for the LAN8700 PHY
|
||||
*******************************************************************************
|
||||
* History : DD.MM.YYYY Ver. Description
|
||||
* : 01.08.2009 1.00 MAB First Release
|
||||
******************************************************************************/
|
||||
|
||||
/******************************************************************************
|
||||
* DISCLAIMER
|
||||
* This software is supplied by Renesas Technology Corp. and is only
|
||||
* intended for use with Renesas products. No other uses are authorized.
|
||||
* This software is owned by Renesas Technology Corp. and is protected under
|
||||
* all applicable laws, including copyright laws.
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES
|
||||
* REGARDING THIS SOFTWARE, WHETHER EXPRESS, IMPLIED OR STATUTORY,
|
||||
* INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
||||
* PARTICULAR PURPOSE AND NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY
|
||||
* DISCLAIMED.
|
||||
* TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY LAW, NEITHER RENESAS
|
||||
* TECHNOLOGY CORP. NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES
|
||||
* FOR ANY REASON RELATED TO THE THIS SOFTWARE, EVEN IF RENESAS OR ITS
|
||||
* AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
* Renesas reserves the right, without notice, to make changes to this
|
||||
* software and to discontinue the availability of this software.
|
||||
* By using this software, you agree to the additional terms and
|
||||
* conditions found by accessing the following link:
|
||||
* http://www.renesas.com/disclaimer
|
||||
******************************************************************************/
|
||||
/* Copyright (C) 2008. Renesas Technology Corp., All Rights Reserved. */
|
||||
/* Copyright (C) 2009. Renesas Technology Europe Ltd., All Rights Reserved. */
|
||||
/*****************************************************************************/
|
||||
|
||||
/*****************************************************************************
|
||||
System Includes
|
||||
******************************************************************************/
|
||||
|
||||
#include <stdio.h>
|
||||
/* Header file for sleep() and nop() functions */
|
||||
#include <machine.h>
|
||||
|
||||
/*****************************************************************************
|
||||
User Includes
|
||||
******************************************************************************/
|
||||
|
||||
/* Defines for I/O registers */
|
||||
#include "iodefine.h"
|
||||
/* rsk7216def.h provides common defines for widely used items. */
|
||||
#include "rsk7216def.h"
|
||||
/* Physical layer functions */
|
||||
#include "hwEthernetPhy.h"
|
||||
#include "Trace.h"
|
||||
|
||||
#include "FreeRTOS.h"
|
||||
#include "task.h"
|
||||
|
||||
/*****************************************************************************
|
||||
Constant Macros
|
||||
******************************************************************************/
|
||||
|
||||
/* Preamble */
|
||||
#define PHY_ST 0x0001
|
||||
/* Operation to be executed on PHY registers */
|
||||
#define PHY_READ 0x0002
|
||||
#define PHY_WRITE 0x0001
|
||||
/* Physical address of PHY device */
|
||||
#define PHY_ADDR 0x001F
|
||||
|
||||
/* Description of PHY data registers */
|
||||
#define PHY_BASIC_MODE_CONTROL 0x0000
|
||||
#define PHY_BASIC_MODE_STATUS 0x0001
|
||||
#define PHY_IDENTIFIER1 0x0002
|
||||
#define PHY_IDENTIFIER2 0x0003
|
||||
#define PHY_AN_ADVERTISEMENT 0x0004
|
||||
#define PHY_AN_LINK_PARTNER_ABILITY 0x0005
|
||||
|
||||
/* Definitions of some configuration bits */
|
||||
#define PHY_RESET 0x8000
|
||||
#define PHY_AN_ENABLE 0x1200
|
||||
/* Bits for auto negotiation for 100, 10 half and full duplex set */
|
||||
#define PHY_AN_10_100_F_H 0xDE1
|
||||
/* Link partner ability register bits for establising the result of the
|
||||
auto negotiation */
|
||||
#define PHY_AN_100F BIT_8
|
||||
#define PHY_AN_100H BIT_7
|
||||
#define PHY_AN_10F BIT_6
|
||||
#define PHY_AN_10H BIT_5
|
||||
|
||||
/*****************************************************************************
|
||||
Function Prototypes
|
||||
******************************************************************************/
|
||||
|
||||
static USHORT phyReadReg(USHORT usRegAddr);
|
||||
static void phyWriteReg(USHORT usRegAddr, USHORT usData);
|
||||
static void phyPreamble(void);
|
||||
static void phyMiiWrite1(void);
|
||||
static void phyMiiWrite0(void);
|
||||
static void phyRegSet(USHORT usRegAddr, long lOption);
|
||||
static void phyRegRead(PUSHORT pusData);
|
||||
static void phyRegWrite(USHORT usData);
|
||||
static void phyTaZ0(void);
|
||||
static void phyTa10(void);
|
||||
static void phyDelay(void);
|
||||
|
||||
/*****************************************************************************
|
||||
Public Functions
|
||||
******************************************************************************/
|
||||
|
||||
/*****************************************************************************
|
||||
Function Name: phyReset
|
||||
Description: Executes software reset of PHY and sets to auto negotiate link
|
||||
Parameters: None
|
||||
Return value: 0 for success -1 on error
|
||||
******************************************************************************/
|
||||
int phyReset(void)
|
||||
{
|
||||
/* One second of attempting to reset the PHY */
|
||||
int iCount = 1000;
|
||||
/* Set software reset */
|
||||
phyWriteReg(PHY_BASIC_MODE_CONTROL, PHY_RESET);
|
||||
while (iCount--)
|
||||
{
|
||||
USHORT usData;
|
||||
|
||||
vTaskDelay( 2 / portTICK_RATE_MS );
|
||||
|
||||
/* Read the status of the PHY */
|
||||
usData = phyReadReg(PHY_BASIC_MODE_CONTROL);
|
||||
/* Wait for the reset flag to be cleared */
|
||||
if ((usData & PHY_RESET) == 0)
|
||||
{
|
||||
/* Set auto negoatiation for 10,100 full and half duplex */
|
||||
phyWriteReg(PHY_AN_ADVERTISEMENT, PHY_AN_10_100_F_H);
|
||||
/* Set auto negotiate and restart auto negotiate bits */
|
||||
phyWriteReg(PHY_BASIC_MODE_CONTROL, PHY_AN_ENABLE);
|
||||
|
||||
/* Auto negotiation will now take place wait for two seconds */
|
||||
vTaskDelay( 2000 / portTICK_RATE_MS );
|
||||
|
||||
/* Success */
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
/* Phy did not respond to software reset */
|
||||
return -1;
|
||||
}
|
||||
/*****************************************************************************
|
||||
End of function phyReset
|
||||
******************************************************************************/
|
||||
|
||||
/*****************************************************************************
|
||||
Function Name: phyStatus
|
||||
Description: Function to reurn the type of physical link
|
||||
Parameters: none
|
||||
Return value: The link type
|
||||
*****************************************************************************/
|
||||
NETLNK phyStatus(void)
|
||||
{
|
||||
/* The state of this flag depens on the hardware connection to the MAC */
|
||||
if (!EtherC.PSR.BIT.LMON)
|
||||
{
|
||||
/* Read the auto negotiation link partner ability register to establish
|
||||
the type of link */
|
||||
USHORT usData = phyReadReg(PHY_AN_LINK_PARTNER_ABILITY);
|
||||
if (usData & PHY_AN_100F)
|
||||
{
|
||||
return PHY_LINK_100F;
|
||||
}
|
||||
if (usData & PHY_AN_100H)
|
||||
{
|
||||
return PHY_LINK_100H;
|
||||
}
|
||||
if (usData & PHY_AN_10F)
|
||||
{
|
||||
return PHY_LINK_10F;
|
||||
}
|
||||
if (usData & PHY_AN_10H)
|
||||
{
|
||||
return PHY_LINK_10H;
|
||||
}
|
||||
}
|
||||
return PHY_NO_LINK;
|
||||
}
|
||||
/*****************************************************************************
|
||||
End of function phyStatus
|
||||
******************************************************************************/
|
||||
|
||||
/*****************************************************************************
|
||||
Private Functions
|
||||
******************************************************************************/
|
||||
|
||||
/*****************************************************************************
|
||||
Function Name: phyReadReg
|
||||
Description: Reads data from a register with the address usRegAddr
|
||||
Parameters: (USHORT) usRegAddr - address to be read;
|
||||
Return value: (USHORT) - value from read register;
|
||||
******************************************************************************/
|
||||
static USHORT phyReadReg(USHORT usRegAddr)
|
||||
{
|
||||
USHORT usData;
|
||||
phyPreamble();
|
||||
phyRegSet(usRegAddr, PHY_READ);
|
||||
phyTaZ0();
|
||||
phyRegRead(&usData);
|
||||
phyTaZ0();
|
||||
return usData;
|
||||
}
|
||||
/*****************************************************************************
|
||||
End of function phyReadReg
|
||||
******************************************************************************/
|
||||
|
||||
/*****************************************************************************
|
||||
Function Name: phyWriteReg
|
||||
Description: Write data to register with the address usRegAddr
|
||||
Parameters: (USHORT) usRegAddr - address of register where to be written;
|
||||
(USHORT) usData - value to write;
|
||||
Return value: None
|
||||
******************************************************************************/
|
||||
static void phyWriteReg(USHORT usRegAddr, USHORT usData)
|
||||
{
|
||||
phyPreamble();
|
||||
phyRegSet(usRegAddr, PHY_WRITE);
|
||||
phyTa10();
|
||||
phyRegWrite(usData);
|
||||
phyTaZ0();
|
||||
}
|
||||
/*****************************************************************************
|
||||
End of function phyWriteReg
|
||||
******************************************************************************/
|
||||
|
||||
/*****************************************************************************
|
||||
Function Name: phyPreamble
|
||||
Description: Writing 32 bits of '1'
|
||||
Parameters: None
|
||||
Return value: None
|
||||
******************************************************************************/
|
||||
static void phyPreamble(void)
|
||||
{
|
||||
int iCount = 32;
|
||||
while (iCount--)
|
||||
{
|
||||
phyMiiWrite1();
|
||||
}
|
||||
}
|
||||
/*****************************************************************************
|
||||
End of function phyPreamble
|
||||
******************************************************************************/
|
||||
|
||||
/*****************************************************************************
|
||||
Function Name: phyRegSet
|
||||
Description: Sets the address of register
|
||||
Parameters: (USHORT) usRegAddr - address to be set;
|
||||
(long) lOption - PHY_READ or PHY_WRITE;
|
||||
Return value: None
|
||||
******************************************************************************/
|
||||
static void phyRegSet(USHORT usRegAddr, long lOption)
|
||||
{
|
||||
int iBit = 14;
|
||||
USHORT usData;
|
||||
|
||||
/* Format of PHY Address Set Transmission */
|
||||
/* ST R/W PAddress Address */
|
||||
/* 1 10 11111 xxxx 00 */ //Read
|
||||
/* 1 01 11111 xxxx 00 */ //Write
|
||||
|
||||
usData = 0;
|
||||
/* ST code */
|
||||
usData = (PHY_ST << 14);
|
||||
if (lOption == PHY_READ)
|
||||
{
|
||||
/* Option code (RD) */
|
||||
usData |= (PHY_READ << 12);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Option code (WT) */
|
||||
usData |= (PHY_WRITE << 12);
|
||||
}
|
||||
/* PHY Address */
|
||||
usData |= ((BYTE)PHY_ADDR << 7);
|
||||
/* Reg Address */
|
||||
usData |= (USHORT)(usRegAddr << 2);
|
||||
|
||||
while (iBit--)
|
||||
{
|
||||
if ((usData & 0x8000) == 0)
|
||||
{
|
||||
phyMiiWrite0();
|
||||
}
|
||||
else
|
||||
{
|
||||
phyMiiWrite1();
|
||||
}
|
||||
usData <<= 1;
|
||||
}
|
||||
}
|
||||
/*****************************************************************************
|
||||
End of function phyRegSet
|
||||
******************************************************************************/
|
||||
|
||||
/*****************************************************************************
|
||||
Function Name: phyRegRead
|
||||
Description: Read data from register
|
||||
Parameters: IN pusDest - value to be read;
|
||||
Return value: None
|
||||
******************************************************************************/
|
||||
static void phyRegRead(PUSHORT pusDest)
|
||||
{
|
||||
USHORT usData = 0;
|
||||
int iBit = 16;
|
||||
while (iBit--)
|
||||
{
|
||||
EtherC.PIR.LONG = 0x00UL;
|
||||
EtherC.PIR.LONG = 0x01UL;
|
||||
usData <<= 1;
|
||||
|
||||
/* MDI read */
|
||||
usData |= (USHORT)((EtherC.PIR.LONG & 0x08UL) >> 3);
|
||||
|
||||
EtherC.PIR.LONG = 0x01UL;
|
||||
EtherC.PIR.LONG = 0x00UL;
|
||||
}
|
||||
*pusDest = usData;
|
||||
}
|
||||
/*****************************************************************************
|
||||
End of function phyRegRead
|
||||
******************************************************************************/
|
||||
|
||||
/*****************************************************************************
|
||||
Function Name: phyRegWrite
|
||||
Description: Write 2 bytes (16 bit) to MII
|
||||
Parameters: IN usData - value to be written;
|
||||
Return value: None
|
||||
******************************************************************************/
|
||||
static void phyRegWrite(USHORT usData)
|
||||
{
|
||||
int iBit = 16;
|
||||
while (iBit--)
|
||||
{
|
||||
if ((usData & 0x8000) == 0)
|
||||
{
|
||||
phyMiiWrite0();
|
||||
}
|
||||
else
|
||||
{
|
||||
phyMiiWrite1();
|
||||
}
|
||||
usData <<= 1;
|
||||
}
|
||||
}
|
||||
/*****************************************************************************
|
||||
End of function phyRegWrite
|
||||
******************************************************************************/
|
||||
|
||||
/*****************************************************************************
|
||||
Function Name: phyTaZ0
|
||||
Description: Set bus to high Z
|
||||
Parameters: None
|
||||
Return value: None
|
||||
******************************************************************************/
|
||||
static void phyTaZ0(void)
|
||||
{
|
||||
EtherC.PIR.LONG = 0x00UL;
|
||||
EtherC.PIR.LONG = 0x01UL;
|
||||
EtherC.PIR.LONG = 0x01UL;
|
||||
EtherC.PIR.LONG = 0x00UL;
|
||||
}
|
||||
/*****************************************************************************
|
||||
End of function phyTaZ0
|
||||
******************************************************************************/
|
||||
|
||||
/*****************************************************************************
|
||||
Function Name: phyTa10
|
||||
Description: Set bus to output
|
||||
Parameters: None
|
||||
Return value: None
|
||||
******************************************************************************/
|
||||
static void phyTa10(void)
|
||||
{
|
||||
EtherC.PIR.LONG = 0x06UL;
|
||||
EtherC.PIR.LONG = 0x07UL;
|
||||
EtherC.PIR.LONG = 0x07UL;
|
||||
EtherC.PIR.LONG = 0x06UL;
|
||||
EtherC.PIR.LONG = 0x02UL;
|
||||
EtherC.PIR.LONG = 0x03UL;
|
||||
EtherC.PIR.LONG = 0x03UL;
|
||||
EtherC.PIR.LONG = 0x02UL;
|
||||
}
|
||||
/*****************************************************************************
|
||||
End of function phyTa10
|
||||
******************************************************************************/
|
||||
|
||||
/*****************************************************************************
|
||||
Function Name: phyMiiWrite1
|
||||
Description: Write 1 to MII
|
||||
Parameters: None
|
||||
Return value: None
|
||||
******************************************************************************/
|
||||
static void phyMiiWrite1(void)
|
||||
{
|
||||
EtherC.PIR.LONG = 0x06UL;
|
||||
EtherC.PIR.LONG = 0x07UL;
|
||||
EtherC.PIR.LONG = 0x07UL;
|
||||
EtherC.PIR.LONG = 0x06UL;
|
||||
}
|
||||
/*****************************************************************************
|
||||
End of function phyMiiWrite1
|
||||
******************************************************************************/
|
||||
|
||||
/*****************************************************************************
|
||||
Function Name: phyMiiWrite0
|
||||
Description: Write 0 to MII
|
||||
Parameters: None
|
||||
Return value: None
|
||||
******************************************************************************/
|
||||
static void phyMiiWrite0(void)
|
||||
{
|
||||
EtherC.PIR.LONG = 0x02UL;
|
||||
EtherC.PIR.LONG = 0x03UL;
|
||||
EtherC.PIR.LONG = 0x03UL;
|
||||
EtherC.PIR.LONG = 0x02UL;
|
||||
}
|
||||
/*****************************************************************************
|
||||
End of function phyMiiWrite0
|
||||
******************************************************************************/
|
||||
|
||||
/*****************************************************************************
|
||||
End Of File
|
||||
******************************************************************************/
|
106
Demo/SuperH_SH7216_Renesas/RTOSDemo/RenesasCode/rsk7216def.h
Normal file
106
Demo/SuperH_SH7216_Renesas/RTOSDemo/RenesasCode/rsk7216def.h
Normal file
|
@ -0,0 +1,106 @@
|
|||
/******************************************************************************
|
||||
* File Name : rsk7670def.h
|
||||
* Version : 1.0
|
||||
* Device(s) : SH2A/7670
|
||||
* Tool-Chain : Renesas SH2A V9+
|
||||
* OS : None
|
||||
* H/W Platform : RSK+SH7670
|
||||
* Description : Defines for RSK2+SH7670 kit.
|
||||
*******************************************************************************
|
||||
* History : DD.MM.YYYY Ver. Description
|
||||
* : 01.08.2009 1.00 MAB First Release
|
||||
******************************************************************************/
|
||||
|
||||
/******************************************************************************
|
||||
* DISCLAIMER
|
||||
* This software is supplied by Renesas Technology Corp. and is only
|
||||
* intended for use with Renesas products. No other uses are authorized.
|
||||
* This software is owned by Renesas Technology Corp. and is protected under
|
||||
* all applicable laws, including copyright laws.
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES
|
||||
* REGARDING THIS SOFTWARE, WHETHER EXPRESS, IMPLIED OR STATUTORY,
|
||||
* INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
||||
* PARTICULAR PURPOSE AND NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY
|
||||
* DISCLAIMED.
|
||||
* TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY LAW, NEITHER RENESAS
|
||||
* TECHNOLOGY CORP. NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES
|
||||
* FOR ANY REASON RELATED TO THE THIS SOFTWARE, EVEN IF RENESAS OR ITS
|
||||
* AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
* Renesas reserves the right, without notice, to make changes to this
|
||||
* software and to discontinue the availability of this software.
|
||||
* By using this software, you agree to the additional terms and
|
||||
* conditions found by accessing the following link:
|
||||
* http://www.renesas.com/disclaimer
|
||||
******************************************************************************/
|
||||
/* Copyright (C) 2008. Renesas Technology Corp., All Rights Reserved. */
|
||||
/* Copyright (C) 2009. Renesas Technology Europe Ltd., All Rights Reserved. */
|
||||
/*****************************************************************************/
|
||||
|
||||
#ifndef RSK7216DEF_H
|
||||
#define RSK7216DEF_H
|
||||
|
||||
/******************************************************************************
|
||||
Macro Defines
|
||||
******************************************************************************/
|
||||
|
||||
/* General Values */
|
||||
#define LED_ON (1)
|
||||
#define LED_OFF (0)
|
||||
#define SET_BIT_HIGH (1)
|
||||
#define SET_BIT_LOW (0)
|
||||
#define SET_BYTE_HIGH (0xFF)
|
||||
#define SET_BYTE_LOW (0x00)
|
||||
|
||||
/* Define switches to be polled if not available as interrupts */
|
||||
#define SW_ACTIVE FALSE
|
||||
|
||||
#define SW1 PORT.PDDRL.BIT.PD16DR //"IRQ0" PD16
|
||||
#define SW2 PORT.PADRL.BIT.PA20DR //"IRQ6" PA20
|
||||
|
||||
|
||||
/* LEDs */
|
||||
#define LED0 PE.DR.BIT.B9
|
||||
#define LED1 PE.DR.BIT.B11
|
||||
#define LED2 PE.DR.BIT.B12
|
||||
#define LED3 PE.DR.BIT.B13
|
||||
#define LED4 PE.DR.BIT.B14
|
||||
#define LED5 PE.DR.BIT.B15
|
||||
|
||||
#define ID_LED1 1
|
||||
#define ID_LED2 2
|
||||
#define ID_LED3 4
|
||||
#define ID_LED4 8
|
||||
#define ID_LED5 16
|
||||
#define ID_LED6 32
|
||||
#define ID_LED_ALL (ID_LED1 | ID_LED2 | ID_LED3 | ID_LED4 | ID_LED5 | ID_LED6)
|
||||
|
||||
#define PERIPHERAL_CLOCK_FREQUENCY 50000000UL
|
||||
|
||||
/******************************************************************************
|
||||
Constant Macros
|
||||
******************************************************************************/
|
||||
|
||||
#define BOARD_NAME "SH7216 CPU BOARD"
|
||||
|
||||
/******************************************************************************
|
||||
Public Functions
|
||||
******************************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern void led_init(void);
|
||||
extern void led_on(unsigned short ledno);
|
||||
extern void led_off(unsigned short ledno);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* RSK7216DEF_H */
|
||||
|
||||
/******************************************************************************
|
||||
End Of File
|
||||
******************************************************************************/
|
104
Demo/SuperH_SH7216_Renesas/RTOSDemo/RenesasCode/trace.h
Normal file
104
Demo/SuperH_SH7216_Renesas/RTOSDemo/RenesasCode/trace.h
Normal file
|
@ -0,0 +1,104 @@
|
|||
/******************************************************************************
|
||||
* File Name : trace.h
|
||||
* Version : 1.0
|
||||
* Device(s) : Renesas
|
||||
* Tool-Chain : Renesas SH2A V9+
|
||||
* OS : None
|
||||
* H/W Platform : SH2A
|
||||
* Description : Debug formatted output routine
|
||||
* TRACE print function enabled with define _TRACE_ON_
|
||||
*******************************************************************************
|
||||
* History : DD.MM.YYYY Ver. Description
|
||||
* : 01.08.2009 1.00 MAB First Release
|
||||
******************************************************************************/
|
||||
|
||||
/******************************************************************************
|
||||
* DISCLAIMER
|
||||
* This software is supplied by Renesas Technology Corp. and is only
|
||||
* intended for use with Renesas products. No other uses are authorized.
|
||||
* This software is owned by Renesas Technology Corp. and is protected under
|
||||
* all applicable laws, including copyright laws.
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES
|
||||
* REGARDING THIS SOFTWARE, WHETHER EXPRESS, IMPLIED OR STATUTORY,
|
||||
* INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
||||
* PARTICULAR PURPOSE AND NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY
|
||||
* DISCLAIMED.
|
||||
* TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY LAW, NEITHER RENESAS
|
||||
* TECHNOLOGY CORP. NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES
|
||||
* FOR ANY REASON RELATED TO THE THIS SOFTWARE, EVEN IF RENESAS OR ITS
|
||||
* AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
* Renesas reserves the right, without notice, to make changes to this
|
||||
* software and to discontinue the availability of this software.
|
||||
* By using this software, you agree to the additional terms and
|
||||
* conditions found by accessing the following link:
|
||||
* http://www.renesas.com/disclaimer
|
||||
******************************************************************************/
|
||||
/* Copyright (C) 2008. Renesas Technology Corp., All Rights Reserved. */
|
||||
/* Copyright (C) 2009. Renesas Technology Europe Ltd., All Rights Reserved. */
|
||||
/*****************************************************************************/
|
||||
|
||||
#ifndef TRACE_H_INCLUDED
|
||||
#define TRACE_H_INCLUDED
|
||||
|
||||
/******************************************************************************
|
||||
User Includes
|
||||
******************************************************************************/
|
||||
|
||||
#include "types.h"
|
||||
|
||||
/******************************************************************************
|
||||
Function Macros
|
||||
******************************************************************************/
|
||||
|
||||
/* Some function macros for TRACE output
|
||||
NOTE: debugging TRACE statements require double braces
|
||||
so the debug strings can be removed from the output load module:
|
||||
TRACE(("My Variable = %u\r\n", uiMyVariable));
|
||||
See ANSI C formatted output for more detail on the format specifiers */
|
||||
|
||||
#ifdef _TRACE_ON_ /* Trace ON */
|
||||
#define TRACE(_x_) Trace _x_
|
||||
#else /* _NO_TRACE_ON_ */
|
||||
#define TRACE(_x_) /* TRACE REMOVED */
|
||||
#endif /* _TRACE_ON_ */
|
||||
|
||||
/******************************************************************************
|
||||
Public Functions
|
||||
******************************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/******************************************************************************
|
||||
Function Name: Trace
|
||||
Description: Function to perform a formatted print output for debugging
|
||||
Parameters: IN pszFormat - Pointer to a null terminated format string
|
||||
I/O ... - The parameters
|
||||
Return value: The number of chars output
|
||||
******************************************************************************/
|
||||
#ifdef _TRACE_ON_ /* Trace ON */
|
||||
extern int Trace(const char *pszFormat, ...);
|
||||
#endif
|
||||
|
||||
/******************************************************************************
|
||||
Function Name: dbgPrintBuffer
|
||||
Description: Function to print a data buffer in hex format
|
||||
Parameters: IN pbyBuffer - Pointer to the buffer
|
||||
IN stLength - The length of the buffer
|
||||
Return value: none
|
||||
******************************************************************************/
|
||||
#ifdef _TRACE_ON_ /* Trace ON */
|
||||
extern void dbgPrintBuffer(PBYTE pbyBuffer, size_t stLength);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* TRACE_H_INCLUDED */
|
||||
|
||||
/******************************************************************************
|
||||
End Of File
|
||||
******************************************************************************/
|
476
Demo/SuperH_SH7216_Renesas/RTOSDemo/RenesasCode/types.h
Normal file
476
Demo/SuperH_SH7216_Renesas/RTOSDemo/RenesasCode/types.h
Normal file
|
@ -0,0 +1,476 @@
|
|||
/******************************************************************************
|
||||
* File Name : types.h
|
||||
* Version : 1.0
|
||||
* Device(s) : Renesas
|
||||
* Tool-Chain : Renesas SH2A V9+
|
||||
* OS : None
|
||||
* H/W Platform : SH2A
|
||||
* Description : User Defined Type Definition File
|
||||
*******************************************************************************
|
||||
* History : DD.MM.YYYY Ver. Description
|
||||
* : 01.08.2009 1.00 MAB First Release
|
||||
******************************************************************************/
|
||||
|
||||
/******************************************************************************
|
||||
* DISCLAIMER
|
||||
* This software is supplied by Renesas Technology Corp. and is only
|
||||
* intended for use with Renesas products. No other uses are authorized.
|
||||
* This software is owned by Renesas Technology Corp. and is protected under
|
||||
* all applicable laws, including copyright laws.
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES
|
||||
* REGARDING THIS SOFTWARE, WHETHER EXPRESS, IMPLIED OR STATUTORY,
|
||||
* INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
||||
* PARTICULAR PURPOSE AND NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY
|
||||
* DISCLAIMED.
|
||||
* TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY LAW, NEITHER RENESAS
|
||||
* TECHNOLOGY CORP. NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES
|
||||
* FOR ANY REASON RELATED TO THE THIS SOFTWARE, EVEN IF RENESAS OR ITS
|
||||
* AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
* Renesas reserves the right, without notice, to make changes to this
|
||||
* software and to discontinue the availability of this software.
|
||||
* By using this software, you agree to the additional terms and
|
||||
* conditions found by accessing the following link:
|
||||
* http://www.renesas.com/disclaimer
|
||||
******************************************************************************/
|
||||
/* Copyright (C) 2008. Renesas Technology Corp., All Rights Reserved. */
|
||||
/* Copyright (C) 2009. Renesas Technology Europe Ltd., All Rights Reserved. */
|
||||
/*****************************************************************************/
|
||||
|
||||
#ifndef TYPES_H_INCLUDED
|
||||
#define TYPES_H_INCLUDED
|
||||
|
||||
/******************************************************************************
|
||||
User Includes
|
||||
******************************************************************************/
|
||||
|
||||
#include "Compiler.h"
|
||||
|
||||
/******************************************************************************
|
||||
Function Macros
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef SWAPWORD
|
||||
#define SWAPWORD(x) (WORD)((((x) & 0xFF) << 8) | (((x) >> 8) & 0xFF))
|
||||
#endif
|
||||
|
||||
#ifndef LOBYTE
|
||||
#define LOBYTE(x) (BYTE)(x)
|
||||
#endif
|
||||
|
||||
#ifndef HIBYTE
|
||||
#define HIBYTE(x) (BYTE)((x) >> 8)
|
||||
#endif
|
||||
|
||||
#ifndef MAKEWORD
|
||||
#define MAKEWORD(a, b) ((WORD) (((BYTE) (a)) |\
|
||||
((WORD) ((BYTE) (b))) << 8))
|
||||
#endif
|
||||
|
||||
/******************************************************************************
|
||||
Typedefs
|
||||
******************************************************************************/
|
||||
|
||||
/* Generic definitions */
|
||||
#ifndef NULL /* set null ((void *)0) */
|
||||
#define NULL 0
|
||||
#endif
|
||||
|
||||
#ifndef PNULL
|
||||
#define PNULL ((PVOID)0)
|
||||
#endif
|
||||
|
||||
#ifndef BIT_0 /* set bits */
|
||||
#define BIT_0 0x1
|
||||
#define BIT_1 0x2
|
||||
#define BIT_2 0x4
|
||||
#define BIT_3 0x8
|
||||
#define BIT_4 0x10
|
||||
#define BIT_5 0x20
|
||||
#define BIT_6 0x40
|
||||
#define BIT_7 0x80
|
||||
|
||||
#define BIT_8 0x100
|
||||
#define BIT_9 0x200
|
||||
#define BIT_10 0x400
|
||||
#define BIT_11 0x800
|
||||
#define BIT_12 0x1000
|
||||
#define BIT_13 0x2000
|
||||
#define BIT_14 0x4000
|
||||
#define BIT_15 0x8000
|
||||
|
||||
#define BIT_16 0x10000L
|
||||
#define BIT_17 0x20000L
|
||||
#define BIT_18 0x40000L
|
||||
#define BIT_19 0x80000L
|
||||
#define BIT_20 0x100000L
|
||||
#define BIT_21 0x200000L
|
||||
#define BIT_22 0x400000L
|
||||
#define BIT_23 0x800000L
|
||||
|
||||
#define BIT_24 0x1000000L
|
||||
#define BIT_25 0x2000000L
|
||||
#define BIT_26 0x4000000L
|
||||
#define BIT_27 0x8000000L
|
||||
#define BIT_28 0x10000000L
|
||||
#define BIT_29 0x20000000L
|
||||
#define BIT_30 0x40000000L
|
||||
#define BIT_31 0x80000000L
|
||||
#endif
|
||||
|
||||
#ifndef TRUE /* true and false */
|
||||
#define TRUE (BOOL)1
|
||||
#endif
|
||||
|
||||
#ifndef FALSE
|
||||
#define FALSE (BOOL)0
|
||||
#endif
|
||||
|
||||
#if defined(WIN32_SH4) && defined(__cplusplus)
|
||||
#define _SIZE_T
|
||||
#else
|
||||
#ifndef _SIZE_T
|
||||
#define _SIZE_T
|
||||
typedef unsigned long size_t;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef BOOL
|
||||
#define BOOL BOOL
|
||||
typedef unsigned char BOOL;
|
||||
#endif
|
||||
|
||||
#ifndef PBOOL
|
||||
#define PBOOL PBOOL
|
||||
typedef unsigned char *PBOOL;
|
||||
#endif
|
||||
|
||||
#ifndef TCHAR
|
||||
#define TCHAR TCHAR
|
||||
typedef char TCHAR;
|
||||
#endif
|
||||
|
||||
#ifndef PTCHAR
|
||||
#define PTCHAR PTCHAR
|
||||
typedef char *PTCHAR;
|
||||
#endif
|
||||
|
||||
#ifndef PCTCHAR
|
||||
#define PCTCHAR PCTCHAR
|
||||
typedef char *const PCTCHAR;
|
||||
#endif
|
||||
|
||||
#ifndef CPCTCHAR
|
||||
#define CPCTCHAR CPCTCHAR
|
||||
typedef const char *const CPCTCHAR;
|
||||
#endif
|
||||
|
||||
#ifndef CHAR
|
||||
#define CHAR CHAR
|
||||
typedef char CHAR;
|
||||
#endif
|
||||
|
||||
#ifndef CCHAR
|
||||
#define CCHAR CCHAR
|
||||
typedef const char CCHAR;
|
||||
#endif
|
||||
|
||||
#ifndef PCHAR
|
||||
#define PCHAR PCHAR
|
||||
typedef char *PCHAR;
|
||||
#endif
|
||||
|
||||
#ifndef CPCHAR
|
||||
#define CPCHAR CPCHAR
|
||||
typedef const char *CPCHAR;
|
||||
#endif
|
||||
|
||||
#ifndef PCCHAR
|
||||
#define PCCHAR PCCHAR
|
||||
typedef char *const PCCHAR;
|
||||
#endif
|
||||
|
||||
#ifndef CPCCHAR
|
||||
#define CPCCHAR CPCCHAR
|
||||
typedef const char *const CPCCHAR;
|
||||
#endif
|
||||
|
||||
#ifndef PTSTR
|
||||
#define PTSTR PTSTR
|
||||
typedef const char *PTSTR;
|
||||
#endif
|
||||
|
||||
#ifndef PCTSTR
|
||||
#define PCTSTR PCTSTR
|
||||
typedef char *const PCTSTR;
|
||||
#endif
|
||||
|
||||
#ifndef PCTSTR
|
||||
#define PCTSTR PCTSTR
|
||||
typedef const char *PCTSTR;
|
||||
#endif
|
||||
|
||||
#ifndef PTSTR
|
||||
#define PTSTR PTSTR
|
||||
typedef char *PTSTR;
|
||||
#endif
|
||||
|
||||
#ifndef BYTE
|
||||
#define BYTE BYTE
|
||||
typedef unsigned char BYTE;
|
||||
#endif
|
||||
|
||||
#ifndef PBYTE
|
||||
#define PBYTE PBYTE
|
||||
typedef unsigned char *PBYTE;
|
||||
#endif
|
||||
|
||||
#ifndef PCBYTE
|
||||
#define PCBYTE PCBYTE
|
||||
typedef unsigned char *const PCBYTE;
|
||||
#endif
|
||||
|
||||
#ifndef CPBYTE
|
||||
#define CPBYTE CPBYTE
|
||||
typedef const unsigned char *CPBYTE;
|
||||
#endif
|
||||
|
||||
#ifndef SHORT
|
||||
#define SHORT SHORT
|
||||
typedef short SHORT;
|
||||
#endif
|
||||
|
||||
#ifndef PSHORT
|
||||
#define PSHORT PSHORT
|
||||
typedef short *PSHORT;
|
||||
#endif
|
||||
|
||||
#ifndef PCSHORT
|
||||
#define PCSHORT PCSHORT
|
||||
typedef short *const PCSHORT;
|
||||
#endif
|
||||
|
||||
#ifndef CPSHORT
|
||||
#define CPSHORT CPSHORT
|
||||
typedef const short *CPSHORT;
|
||||
#endif
|
||||
|
||||
#ifndef USHORT
|
||||
#define USHORT USHORT
|
||||
typedef unsigned short USHORT;
|
||||
#endif
|
||||
|
||||
#ifndef PUSHORT
|
||||
#define PUSHORT PUSHORT
|
||||
typedef unsigned short *PUSHORT;
|
||||
#endif
|
||||
|
||||
#ifndef PCUSHORT
|
||||
#define PCUSHORT PCUSHORT
|
||||
typedef unsigned short *const PCUSHORT;
|
||||
#endif
|
||||
|
||||
#ifndef CPUSHORT
|
||||
#define CPUSHORT CPUSHORT
|
||||
typedef const unsigned short *CPUSHORT;
|
||||
#endif
|
||||
|
||||
#ifndef WORD
|
||||
#define WORD WORD
|
||||
typedef unsigned short WORD;
|
||||
#endif
|
||||
|
||||
#ifndef PWORD
|
||||
#define PWORD PWORD
|
||||
typedef unsigned short *PWORD;
|
||||
#endif
|
||||
|
||||
#ifndef PCWORD
|
||||
#define PCWORD PCWORD
|
||||
typedef unsigned short *const PCWORD;
|
||||
#endif
|
||||
|
||||
#ifndef INT
|
||||
#define INT INT
|
||||
typedef int INT;
|
||||
#endif
|
||||
|
||||
#ifndef CINT
|
||||
#define CINT CINT
|
||||
typedef const int CINT;
|
||||
#endif
|
||||
|
||||
#ifndef PINT
|
||||
#define PINT PINT
|
||||
typedef int *PINT;
|
||||
#endif
|
||||
|
||||
#ifndef PCINT
|
||||
#define PCINT PCINT
|
||||
typedef int *const PCINT;
|
||||
#endif
|
||||
|
||||
#ifndef CPINT
|
||||
#define CPINT CPINT
|
||||
typedef const int *CPINT;
|
||||
#endif
|
||||
|
||||
#ifndef UINT
|
||||
#define UINT UINT
|
||||
typedef unsigned int UINT;
|
||||
#endif
|
||||
|
||||
#ifndef PUINT
|
||||
#define PUINT PUINT
|
||||
typedef unsigned int *PUINT;
|
||||
#endif
|
||||
|
||||
#ifndef PCUINT
|
||||
#define PCUINT PCUINT
|
||||
typedef unsigned int *const PCUINT;
|
||||
#endif
|
||||
|
||||
#ifndef CPUINT
|
||||
#define CPUINT CPUINT
|
||||
typedef const unsigned int *CPUINT;
|
||||
#endif
|
||||
|
||||
#ifndef DWORD
|
||||
#define DWORD DWORD
|
||||
typedef unsigned long DWORD;
|
||||
#endif
|
||||
|
||||
#ifndef PDWORD
|
||||
#define PDWORD PDWORD
|
||||
typedef unsigned long *PDWORD;
|
||||
#endif
|
||||
|
||||
#ifndef PCDWORD
|
||||
#define PCDWORD PCDWORD
|
||||
typedef unsigned long *const PCDWORD;
|
||||
#endif
|
||||
|
||||
#ifndef CPDWORD
|
||||
#define CPDWORD CPDWORD
|
||||
typedef const unsigned long *CPDWORD;
|
||||
#endif
|
||||
|
||||
#ifndef LONG
|
||||
#define LONG LONG
|
||||
typedef long LONG;
|
||||
#endif
|
||||
|
||||
#ifndef PLONG
|
||||
#define PLONG PLONG
|
||||
typedef long *PLONG;
|
||||
#endif
|
||||
|
||||
#ifndef PCLONG
|
||||
#define PCLONG PCLONG
|
||||
typedef long *const PCLONG;
|
||||
#endif
|
||||
|
||||
#ifndef CPLONG
|
||||
#define CPLONG CPLONG
|
||||
typedef const long *CPLONG;
|
||||
#endif
|
||||
|
||||
#ifndef ULONG
|
||||
#define ULONG ULONG
|
||||
typedef unsigned long ULONG;
|
||||
#endif
|
||||
|
||||
#ifndef PULONG
|
||||
#define PULONG PULONG
|
||||
typedef unsigned long *PULONG;
|
||||
#endif
|
||||
|
||||
#ifndef PCULONG
|
||||
#define PCULONG PCULONG
|
||||
typedef unsigned long *const PCULONG;
|
||||
#endif
|
||||
|
||||
#ifndef CPULONG
|
||||
#define CPULONG CPULONG
|
||||
typedef const unsigned long *CPULONG;
|
||||
#endif
|
||||
|
||||
#ifndef FLOAT
|
||||
#define FLOAT FLOAT
|
||||
typedef float FLOAT;
|
||||
#endif
|
||||
|
||||
#ifndef DOUBLE
|
||||
#define DOUBLE DOUBLE
|
||||
typedef long double DOUBLE;
|
||||
#endif
|
||||
|
||||
#ifndef PDOUBLE
|
||||
#define PDOUBLE PDOUBLE
|
||||
typedef long double *PDOUBLE;
|
||||
#endif
|
||||
|
||||
#ifndef CPDOUBLE
|
||||
#define CPDOUBLE CPDOUBLE
|
||||
typedef const long double *CPDOUBLE;
|
||||
#endif
|
||||
|
||||
#ifndef PCDOUBLE
|
||||
#define PCDOUBLE PCDOUBLE
|
||||
typedef long double *const PCDOUBLE;
|
||||
#endif
|
||||
|
||||
#ifndef PVOID
|
||||
#define PVOID PVOID
|
||||
typedef void *PVOID;
|
||||
#endif
|
||||
|
||||
#ifndef VOID
|
||||
#define VOID VOID
|
||||
typedef void VOID;
|
||||
#endif
|
||||
|
||||
#ifndef IOID
|
||||
#define IOID IOID
|
||||
typedef unsigned short IOID;
|
||||
#endif
|
||||
|
||||
#ifndef PIOID
|
||||
#define PIOID PIOID
|
||||
typedef unsigned short *PIOID;
|
||||
#endif
|
||||
|
||||
#ifndef BBYTE
|
||||
#define BBYTE BBYTE
|
||||
typedef union {
|
||||
unsigned char BYTE; /*lint -e46 */
|
||||
/* this is correct */
|
||||
struct {
|
||||
#ifdef _BITFIELDS_MSB_FIRST_
|
||||
unsigned char B7:1;
|
||||
unsigned char B6:1;
|
||||
unsigned char B5:1;
|
||||
unsigned char B4:1;
|
||||
unsigned char B3:1;
|
||||
unsigned char B2:1;
|
||||
unsigned char B1:1;
|
||||
unsigned char B0:1;
|
||||
#else
|
||||
unsigned char B0:1;
|
||||
unsigned char B1:1;
|
||||
unsigned char B2:1;
|
||||
unsigned char B3:1;
|
||||
unsigned char B4:1;
|
||||
unsigned char B5:1;
|
||||
unsigned char B6:1;
|
||||
unsigned char B7:1;
|
||||
#endif
|
||||
} BIT;
|
||||
} BBYTE;
|
||||
#endif
|
||||
|
||||
#endif /* TYPES_H_INCLUDED */
|
||||
|
||||
/******************************************************************************
|
||||
End Of File
|
||||
******************************************************************************/
|
Loading…
Add table
Add a link
Reference in a new issue