Sound Generator Library
Fork of Sound_Generator by
Embed:
(wiki syntax)
Show/hide line numbers
devdrv_sdg.h
00001 /******************************************************************************* 00002 * DISCLAIMER 00003 * This software is supplied by Renesas Electronics Corporation and is only 00004 * intended for use with Renesas products. No other uses are authorized. This 00005 * software is owned by Renesas Electronics Corporation and is protected under 00006 * all applicable laws, including copyright laws. 00007 * THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING 00008 * THIS SOFTWARE, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT 00009 * LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE 00010 * AND NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED. 00011 * TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY LAW, NEITHER RENESAS 00012 * ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE 00013 * FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR 00014 * ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR ITS AFFILIATES HAVE 00015 * BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 00016 * Renesas reserves the right, without notice, to make changes to this software 00017 * and to discontinue the availability of this software. By using this software, 00018 * you agree to the additional terms and conditions found by accessing the 00019 * following link: 00020 * http://www.renesas.com/disclaimer 00021 * Copyright (C) 2012 - 2015 Renesas Electronics Corporation. All rights reserved. 00022 *******************************************************************************/ 00023 00024 #ifndef DEVDRV_SDG_H 00025 #define DEVDRV_SDG_H 00026 00027 /****************************************************************************** 00028 Includes <System Includes> , "Project Includes" 00029 ******************************************************************************/ 00030 00031 00032 /****************************************************************************** 00033 Typedef definitions 00034 ******************************************************************************/ 00035 /* selects SGCLK */ 00036 typedef enum 00037 { 00038 R_SDG_CLOCK_2 = 0, 00039 R_SDG_CLOCK_4 = 1, 00040 R_SDG_CLOCK_8 = 2, 00041 R_SDG_CLOCK_16 = 3, 00042 } R_SDG_CLOCK; 00043 00044 00045 /* Attenuation */ 00046 typedef enum 00047 { 00048 R_SDG_ATT_OFF = 0, 00049 R_SDG_ATT_1 = 1, 00050 R_SDG_ATT_2 = 2, 00051 R_SDG_ATT_4 = 3, 00052 R_SDG_ATT_8 = 4, 00053 R_SDG_ATT_16 = 5, 00054 R_SDG_ATT_32 = 6, 00055 } R_SDG_ATTENUATION; 00056 00057 00058 /* callback: now, no implement */ 00059 typedef void(*callback)(uint32_t channel); 00060 00061 /* a note */ 00062 typedef struct { 00063 uint8_t tone; /* tone value (0 < tone <= 127 ) */ 00064 uint8_t sfs; /* SFS value (0 < SFS <= 255 )*/ 00065 uint8_t loud; /* LD value (0 <= LD <= 255 ) */ 00066 uint8_t attenuation; /* Attenuation value */ 00067 } NOTE; 00068 00069 00070 /****************************************************************************** 00071 Macro definitions 00072 ******************************************************************************/ 00073 #define SDG_CH_TOTAL (SDG_COUNT) /* units of sound generator */ 00074 #define SDG_TONE_MAX (127) /* maximum value of tone */ 00075 00076 /****************************************************************************** 00077 Variable Externs 00078 ******************************************************************************/ 00079 00080 00081 /****************************************************************************** 00082 Functions Prototypes 00083 ******************************************************************************/ 00084 /* ==== API functions ==== */ 00085 int32_t R_SDG_Open(uint32_t channel, R_SDG_CLOCK clock); 00086 int32_t R_SDG_Close(uint32_t channel); 00087 int32_t R_SDG_Tone(uint32_t channel, NOTE *note); 00088 00089 /* ==== User-defined functions ==== */ 00090 int32_t Userdef_SDG0_Open(void); 00091 int32_t Userdef_SDG1_Open(void); 00092 int32_t Userdef_SDG2_Open(void); 00093 int32_t Userdef_SDG3_Open(void); 00094 00095 int32_t Userdef_SDG0_Close(void); 00096 int32_t Userdef_SDG1_Close(void); 00097 int32_t Userdef_SDG2_Close(void); 00098 int32_t Userdef_SDG3_Close(void); 00099 00100 00101 #endif /* DEVDRV_SDG_H */ 00102 00103 /* End of File */
Generated on Fri Jul 15 2022 04:21:34 by
1.7.2
