r_sfma_sys.h 23.3 KB
Newer Older
hu's avatar
hu committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740
/*
****************************************************************************
PROJECT : SFMA driver
FILE    : $Id: r_sfma_sys.h 14751 2017-09-25 04:27:33Z shinya.tomari $
============================================================================
DESCRIPTION
SFMA support functions
============================================================================
                            C O P Y R I G H T
============================================================================
                           Copyright (c) 2013 - 2017
                                  by
                       Renesas Electronics (Europe) GmbH.
                           Arcadiastrasse 10
                          D-40472 Duesseldorf
                               Germany
                          All rights reserved.
============================================================================
Purpose: only for testing, not for mass production

DISCLAIMER

LICENSEE has read, understood and accepted the terms and conditions defined in
the license agreement, especially the usage rights. In any case, it is
LICENSEE's responsibility to make sure that any user of the software complies
with the terms and conditions of the signed license agreement.

SAMPLE CODE is not part of the licensed software, as such it must not be used in
mass-production applications. It can only be used for evaluation and
demonstration purposes at customer's premises listed in the signed license
agreement.

****************************************************************************
*/

/***************************************************************************
  Title: SFMA Driver support functions

  SFMA (Serial Flash Memory Interface A) driver support functions

  The generic SFMA driver uses these functions. They have to be implemented 
  within the driver library for a concrete device. (e.g. D1L, D1M)

  Support functions are functions that are not part of the driver itself 
  but they must be provided to integrate the driver on a particular board.
*/

#ifndef R_SFMA_SYS_H
#define R_SFMA_SYS_H

#ifdef __cplusplus
extern "C" {
#endif


/***************************************************************************
  Section: Global Types
*/
/***********************************************************
  typedef: r_sfma_SpiConfig_t

  Description:
  This type describes the configuration of the SPI.

  Struct members:
  MemoryNum    - The parameter specifies the number of the connecting serial flash memories.
                 One serial flash memory is connected.<0uL>
                 Two serial flash memories are connected.<1uL>
  MaxClock     - The parameter specifies the maximum clock of connected the 
                 serial flash memory (Hz).
  PageSize     - The parameter specifies the page size of connected serial flash memory (Byte).
  EraseSectorSize  - The parameter specifies the erase sector size of connected
                     serial flash memory (Byte).
  FlashSize    - Size of connected the serial flash memory (byte).
  Command      - See <r_sfma_FlashCommand_t>.
  DataWidth    - The parameter specifies the data bus width.
                 1 bit data bus width.<0uL>
                 2 bits data bus width.<1uL>
                 4 bits data bus width.<2uL>

  TransferMode - The parameter specifies the transfer mode.
                 SDR transfer.<0uL>
                 DDR transfer.<1uL>
  AddressMode  - The parameter specifies the format of address output to the serial flash memory.
                 24 bit address output.<0x07uL>
                 32 bit address output.<0x0fuL>
  Cachemode    - R_SFMA_CACHE_OFF - SFMA cache off.
                 R_SFMA_CACHE_BL1 .. BL16 - SFMA cache on, with set burst length
                 (BL1 = 1 data unit of 64bit, BL16 = 16 data units of 64bit)
  PerformanceEnMode - The parameter specifies if performance enhance mode should be used
                      The setting value of performance enhance mode to be disabled.<0uL>
                      The setting value of performance enhance mode to be enabled.<1uL>
  Mode         - The parameter specifies operating mode.
                 External address space read mode.<0uL>
                 SPI operating mode.<1uL>
*/
typedef struct
{
    uint32_t              MemoryNum;
    uint32_t              MaxClock;
    uint32_t              PageSize;
    uint32_t              EraseSectorSize;
    uint64_t              FlashSize;
    /* Flash memory control command. */
    r_sfma_FlashCommand_t Command;
    uint8_t               DataWidth;
    uint8_t               TransferMode;
    uint8_t               AddressMode;
    uint32_t              Cachemode;
    uint32_t              PerformanceEnMode;
    uint32_t              Mode;
} r_sfma_SpiConfig_t;

    
/***************************************************************************
  typedef: r_sfma_Dev_t

  Description:
  This type describes the information of the SFMA driver.

  Struct members:
  Mode         - See <r_sfma_Mode_t>
  AccessAddr   - The parameter specifies the access address of the serial flash memory.
  AccessRange  - See <r_sfma_AccessRange_t>
  SpiConfig    - See <r_sfma_SpiConfig_t>
*/
typedef struct
{
    /* Driver information. */
    r_sfma_Mode_t        Mode;
    /* External address space mode information. */
    uint64_t             AccessAddr;
    r_sfma_AccessRange_t AccessRange;
    /* SPI configuration information. */
    r_sfma_SpiConfig_t   SpiConfig;
} r_sfma_Dev_t;

    
/***************************************************************************
  Section: Global Functions
*/
/***************************************************************************
  Group: SFMA driver Basic interface functions
*/

/***************************************************************************
  Function: R_SFMA_Sys_Init

  Description:
  This function initializes environment-dependent part.
  This function is called from <R_SFMA_Init>.

  This function is empty as default.

  Customizing Points:
  It is NOT necessary to modify this function in general use-case.
  If you want to add the initialization code of environment-depend (e.g. clock control), 
  please implement to this function.

  Parameter:
  Unit   - Instance number.

  Return value:
  R_SFMA_ERR_OK               - No error has occurred.
  R_SFMA_ERR_RANGE_UNIT       - Unit number is out of range.
  R_SFMA_ERR_FATAL_HW         - Fatal error has occurred at H/W.

  See <r_sfma_Error_t>.
*/
r_sfma_Error_t R_SFMA_Sys_Init(const uint32_t Unit);


/***************************************************************************
  Function: R_SFMA_Sys_DeInit

  Description:
  This function de-initializes environment-dependent part.
  This function is called from <R_SFMA_DeInit>.

  This function is empty as default.

  Customizing Points:
  It is NOT necessary to modify this function in general use-case.
  If you want to add the de-initialization code of environment-depend (e.g. clock control), 
  please implement to this function.

  Parameter:
  Unit   - Instance number.

  Return value:
  R_SFMA_ERR_OK               - No error has occurred.
  R_SFMA_ERR_RANGE_UNIT       - Unit number is out of range.
  R_SFMA_ERR_FATAL_HW         - Fatal error has occurred at H/W.

  See <r_sfma_Error_t>.
*/
r_sfma_Error_t R_SFMA_Sys_DeInit(const uint32_t Unit);


/***************************************************************************
  Function: R_SFMA_Sys_BaseAddrGet

  Description:
  This function gives back base address of dedicated macro.
  This function is called from several SFMA APIs.

  This function executes the following processing.
  * Returns the base address of SFMA H/W macro's register.

  Customizing Points:
  It is NOT necessary to modify this function in general use-case.

  Parameter:
  Unit   - Instance number.

  Return value:
  Macro base address.
*/
uint32_t R_SFMA_Sys_BaseAddrGet(const uint32_t Unit);


/***************************************************************************
  Function: R_SFMA_Sys_ClockGet

  Description:
  This function gives back clock frequency of dedicated clock input.
  This function is called from <R_SFMA_Open> and <R_SFMA_JEDECRead>.

  This function executes the following processing.
  * Returns the clock frequency which is inputting to SFMAx macro.

  Customizing Points:
  It is NOT necessary to modify this function in general use-case.

  Parameter:
  Unit   - Instance number.

  Return value:
  The clock frequency (Hz).
*/
uint32_t R_SFMA_Sys_ClockGet(const uint32_t Unit);

    
/***************************************************************************
  Function: R_SFMA_Sys_CalibSetting

  Description:
  This function sets the calibration of the SFMA macro.
  This function is called from <R_SFMA_Open>.

  This function executes the following processing.
  * Adjustment between input/output data and sampling clocks 
    (refer to Section 17.5.14 Adjustment between input/output data and sampling clocks 
     in RH850/D1L/D1M Group User's Manual: Hardware)

  Customizing Points:
  This function is sample code for MX25L51245G.
  If you use other Serial flash, it must be changed according to the connected device
  specification.

  Parameter:
  Unit   - Instance number.
  Config - This is a pointer to the <r_sfma_Config_t> structure to the
           configuration of the unit.

  Return value:
  R_SFMA_ERR_OK               - No error has occurred.
  R_SFMA_ERR_RANGE_UNIT       - Unit number is out of range.
  R_SFMA_ERR_PARAM_INCORRECT  - A parameter is incorrect.
  R_SFMA_ERR_FATAL_HW         - Fatal error has occurred at H/W.

  See <r_sfma_Error_t>.
*/
r_sfma_Error_t R_SFMA_Sys_CalibSetting(const uint32_t Unit,
                                       const r_sfma_Config_t * const Config);

    
/***************************************************************************
  Function:  R_SFMA_Sys_Close

  Description:
  This function closes the SFMA in external address space.
  This function is called from <R_SFMA_Close>

  This function executes the following processing.
  * Set negate bit of DRCR register due to terminate any transfers from external address space. 

  Customizing Points:
  It is NOT necessary to modify this function in general use-case.

  Parameter:
  Unit   - Instance number.

  Return value:
  R_SFMA_ERR_OK               - No error has occurred.
  R_SFMA_ERR_RANGE_UNIT       - Unit number is out of range.
  R_SFMA_ERR_FATAL_HW         - Fatal error has occurred at H/W.

  See <r_sfma_Error_t>.
*/
r_sfma_Error_t R_SFMA_Sys_Close(const uint32_t Unit);

    
/***************************************************************************
  Function: R_SFMA_Sys_DDREnable

  Description:
  This function returns valid / invalid of the memory access mode (DDR or SDR).
  This function is called from <R_SFMA_Open>.

  This function executes the following processing.
  * If LSI is supported DDR mode, this function should return R_TRUE.

  Customizing Points:
  It is NOT necessary to modify this function in general use-case.

  Parameter:
  None.

  Return value:
  R_TRUE or R_FALSE.
*/
uint8_t R_SFMA_Sys_DDREnable(void);

    
/***************************************************************************
  Function: R_SFMA_Sys_BusWidth8BitEnable

  Description:
  This function returns valid / invalid of the bus width 8bits mode (4bits or 8bits).
  This function is called from <R_SFMA_Open>.

  This function executes the following processing.
  * If LSI and specified unit are supported the bus width 8bits mode, this function should return 
    R_TRUE.

  Customizing Points:
  It is NOT necessary to modify this function in general use-case.

  Parameter:
  Unit   - Instance number.

  Return value:
  R_TRUE or R_FALSE.
*/
uint8_t R_SFMA_Sys_BusWidth8BitEnable(const uint32_t Unit);

    
/***************************************************************************
  Function: R_SFMA_Sys_SyncPeripheral

  Description:
  This function performs synchronization processing to reflect updated
  contents of the control register.
  This function is called from several SFMA APIs.

  This function executes the following processing.
  * SYNCP instruction of RH850 is executed.

  Customizing Points:
  It is NOT necessary to modify this function in general use-case.

  Parameter:
  None.

  Return value:
  void.
*/
void R_SFMA_Sys_SyncPeripheral(void);

    
/***************************************************************************
  Function: R_SFMA_Sys_NumberOfUnitGet

  Description:
  This function retrieves the number of SFMA unit in this LSI.
  This function is called from several SFMA APIs.

  This function executes the following processing.
  * Returns the number of SFMA unit in this LSI.
    (As for number of SFMA unit of LSI, please refer to Table 17.1 Units in RH850/D1L/D1M Group 
     User's Manual: Hardware)

  Customizing Points:
  It is NOT necessary to modify this function in general use-case.

  Parameter:
  None.

  Return value:
  Number of Unit.
*/
uint32_t R_SFMA_Sys_NumberOfUnitGet(void);

    
/***************************************************************************
  Function: R_SFMA_Sys_ExclusiveUnitGet

  Description:
  This function retrieves the exclusive unit for specified unit.
  If exclusive unit does not exist, this function retrieves unit out of range.
  This function is called from <R_SFMA_Init>.

  This function executes the following processing.
  * Returns the exclusive unit number in this LSI.
    (As for exclusive unit number of SFMA in this LSI, please refer to Table 1.5 Flash memory and
     Video output VO0 connection options for D1M1-V2 and D1M1A devices in RH850/D1L/D1M Group 
     User's Manual: Hardware)

  Parameter:
  Unit   - Instance number.

  Return value:
  Exclusive unit.
*/
uint32_t R_SFMA_Sys_ExclusiveUnitGet(const uint32_t Unit);

    
/***************************************************************************
  Function: R_SFMA_Sys_GetDevInfo

  Description:
  This function retrieves the pointer to <r_sfma_Dev_t> information.
  This function is called from several SFMA APIs.

  This function executes the following processing.
  * Returns the pointer to <r_sfma_Dev_t> information of specified unit.

  Customizing Points:
  It is NOT necessary to modify this function in general use-case.

  If you use SFMA only 1 unit, you can reduce RAM size by changing LOC_SYS_DEV_NUM definition from 
  2 to 1. In that case, please change the processing of this function appropriately.

  Parameter:
  Unit   - Instance number.

  Return value:
  Pointer to <r_sfma_Dev_t>.
*/
r_sfma_Dev_t* R_SFMA_Sys_GetDevInfo(const uint32_t Unit);

    
/***************************************************************************
  Function: R_SFMA_Sys_GetCal

  Description:
  This function retrieves the calibration value from the CKDLY register
  This function is called from <R_SFMA_GetCal>.

  This function executes the following processing.
  * Returns value of CKDLY register. If unit number is wrong, please returns 0xFFFFFFFF.

  Customizing Points:
  It is NOT necessary to modify this function in general use-case.

  Parameter:
  Unit   - Instance number.

  Return value:
  uint32_t - Calibration value
*/
uint32_t R_SFMA_Sys_GetCal(const uint32_t Unit);

    
/***************************************************************************
  Function: R_SFMA_Sys_MinClockDivGet

  Description:
  This function gives back the minimum clock divider.
  This function is called from <R_SFMA_Open> and <R_SFMA_JEDECRead>.

  This function executes the following processing.
  * Calculates the minimum clock division and returns it.
    The minimum clock division is calculated by the following formula.

  (code)
    minimum clock division = (SMFAn clock + (SPBCLK - 1)) / SPBCLK
  (end)

  Note: Calculate with round-up (to avoid returning too small value.)

  Customizing Points:
  It is NOT necessary to modify this function in general use-case.

  Parameter:
  Unit         - Instance number.
  Clock        - The parameter specifies the internal bus clock frequency(Hz).
  TransferMode - The parameter specifies the transfer mode.
                 SDR transfer.<0uL>
                 DDR transfer.<1uL>

  Return value:
  The clock division ratio.
*/
uint32_t R_SFMA_Sys_MinClockDivGet(const uint32_t Unit, const uint32_t Clock, const uint8_t TransferMode);


/***************************************************************************
  Group: SFMA driver port interface functions
*/

/***************************************************************************
  Function: R_SFMA_Sys_SpibscPortSet

  Description:
  This function sets the I/O signals of the SFMA.
  This function is called from <R_SFMA_Open> and <R_SFMA_JEDECRead>.

  This function is empty as default.

  Customizing Points:
  If BSP does NOT setup the pin for SFMA H/W macro, please implement the pin setup process for SFMA H/W macro.

  Parameter:
  DataBusWidth - The parameter specifies the data bus width.
  Bsz          - The parameter specifies the number of serial flash memories to be connected.

  Return value:
  R_SFMA_ERR_OK               - No error has occurred.
  R_SFMA_ERR_RANGE_UNIT       - Unit number is out of range.
  R_SFMA_ERR_PARAM_INCORRECT  - A parameter is incorrect.
  R_SFMA_ERR_FATAL_HW         - Fatal error has occurred at H/W.

  See <r_sfma_Error_t>.
*/
r_sfma_Error_t R_SFMA_Sys_SpibscPortSet(const uint8_t  DataBusWidth,
                                        const uint32_t Bsz);


/***************************************************************************
  Group: SFMA driver OS interface functions
*/

/***************************************************************************
  Function: R_SFMA_Sys_Lock

  Description:
  This function locks the SFMA driver access to the specified unit from other threads.
  This function is called from several SFMA APIs.
  
  This function is empty as default.
  
  Customizing Points:
  Please implement the lock process by mutex or semaphore if SFMA API is called from 
  multi-thread.

  Parameter:
  Unit   - Instance number.

  Return value:
  R_SFMA_ERR_OK               - No error has occurred.
  R_SFMA_ERR_RANGE_UNIT       - Unit number is out of range.
  R_SFMA_ERR_PARAM_INCORRECT  - A parameter is incorrect.
  R_SFMA_ERR_FATAL_OS         - Fatal error has occurred at OS interface.

  See <r_sfma_Error_t>.
*/
r_sfma_Error_t R_SFMA_Sys_Lock(const uint32_t Unit);


/***************************************************************************
  Function: R_SFMA_Sys_Unlock

  Description:
  This function unlocks the SFMA driver access to the specified unit from other threads.
  This function is called from several SFMA APIs.

  This function is empty as default.

  Customizing Points:
  Please implement the unlock process depending on <R_SFMA_Sys_Lock>.

  Parameter:
  Unit   - Instance number.

  Return value:
  R_SFMA_ERR_OK               - No error has occurred.
  R_SFMA_ERR_RANGE_UNIT       - Unit number is out of range.
  R_SFMA_ERR_PARAM_INCORRECT  - A parameter is incorrect.
  R_SFMA_ERR_FATAL_OS         - Fatal error has occurred at OS interface.

  See <r_sfma_Error_t>.
*/
r_sfma_Error_t R_SFMA_Sys_Unlock(const uint32_t Unit);

    
/***************************************************************************
  Function: R_SFMA_Sys_AllLock

  Description:
  This function locks the SFMA driver access to all unit for other threads.
  This function is called from several SFMA APIs.

  This function is empty as default.

  Customizing Points:
  Please implement the lock process of all unit by mutex or semaphore 
  if SFMA API is called from multi-thread.

  Return value:
  R_SFMA_ERR_OK               - No error has occurred.
  R_SFMA_ERR_FATAL_OS         - Fatal error has occurred at OS interface.

  See <r_sfma_Error_t>.
*/
r_sfma_Error_t R_SFMA_Sys_AllLock(void);


/***************************************************************************
  Function: R_SFMA_Sys_AllUnlock

  Description:
  This function unlocks the SFMA driver access to all unit for other threads.
  This function is called from several SFMA APIs.

  This function is empty as default.

  Customizing Points:
  Please implement the unlock process of all unit depending on <R_SFMA_Sys_AllLock>.

  Return value:
  R_SFMA_ERR_OK               - No error has occurred.
  R_SFMA_ERR_FATAL_OS         - Fatal error has occurred at OS interface.

  See <r_sfma_Error_t>.
*/
r_sfma_Error_t R_SFMA_Sys_AllUnlock(void);


/***************************************************************************
  Function: R_SFMA_Sys_Relax

  Description:
  This function relaxes CPU to avoid blocking.
  This function is called from <R_SFMA_DataErase>, <R_SFMA_DataWrite> and <R_SFMA_DataRead>.

  This function is empty as default.

  Customizing Points:
  Please implement the relaxing or re-scheduling process if necessary.

  Parameter:
  Unit - The parameter specifies the instance number.

  Return value:
  R_SFMA_ERR_OK               - No error has occurred.
  R_SFMA_ERR_RANGE_UNIT       - Unit number is out of range.
  R_SFMA_ERR_FATAL_OS         - Fatal error has occurred at OS interface.

  See <r_sfma_Error_t>.
*/
r_sfma_Error_t R_SFMA_Sys_Relax(const uint32_t Unit);
    
    
/***************************************************************************
  Group: SFMA driver SWAP interface functions
  Note:  This function does NOT support current RGL. 
*/

/***************************************************************************
  Function: R_SFMA_Sys_UnitWindowSelect

  Description:
  This function flips the access able space which mapped to CPU address space
  in SFMA0 and SFMA1 by specifying the unit number and the Window.
  This function is called from <R_SFMA_UnitWindowSelect>.
 
  Customizing Points:
  It is NOT necessary to modify this function in general use-case.

  Parameter:
  Unit   - Instance number.
  Window - The parameter specifies the window for SFMA.
           See r_sfma_WindowMode_t.

  Return value:
  R_SFMA_ERR_OK               - No error has occurred.
  R_SFMA_ERR_RANGE_UNIT       - Unit number is out of range.
  R_SFMA_ERR_PARAM_INCORRECT  - A parameter is incorrect.
  R_SFMA_ERR_FATAL_HW         - Fatal error has occurred at H/W.

  See <r_sfma_Error_t>.
*/
r_sfma_Error_t R_SFMA_Sys_UnitWindowSelect(const uint32_t Unit,
                                           const r_sfma_WindowMode_t Window);


/***************************************************************************
  Function: R_SFMA_Sys_SwapUnitGet

  Description:
  This function retrieves the unit to be swapped for specified unit.
  This function is called from <R_SFMA_UnitWindowSelect>.

  Customizing Points:
  It is NOT necessary to modify this function in general use-case.

  Parameter:
  Unit   - Instance number.

  Return value:
  Unit to be swapped.
*/
uint32_t R_SFMA_Sys_SwapUnitGet(const uint32_t Unit);


/***************************************************************************
  Function: R_SFMA_Sys_UnitNumberGet

  Description:
  This function retrieves the unit number of specifying Window for SFMA.
  This function is called from <R_SFMA_UnitNumberGet>.

  Customizing Points:
  It is NOT necessary to modify this function in general use-case.

  Parameter:
  Window - The parameter specifies the window for SFMA.
           See r_sfma_WindowMode_t.
  Unit   - Instance number.

  Return value:
  R_SFMA_ERR_OK               - No error has occurred.
  R_SFMA_ERR_RANGE_UNIT       - Unit number is out of range.
  R_SFMA_ERR_PARAM_INCORRECT  - A parameter is incorrect.
  R_SFMA_ERR_FATAL_HW         - Fatal error has occurred at H/W.

  See <r_sfma_Error_t>.
*/
r_sfma_Error_t R_SFMA_Sys_UnitNumberGet(const r_sfma_WindowMode_t Window,
                                        uint32_t * const Unit);


#ifdef __cplusplus
}
#endif

#endif /* R_SFMA_SYS_H */