1 /* Copyright 2018 Espressif Systems (Shanghai) PTE LTD
2  *
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 /*
16  * FreeModbus Libary: ESP32 Demo Application
17  * Copyright (C) 2010 Christian Walter <cwalter@embedded-solutions.at>
18  *
19  *
20  * Redistribution and use in source and binary forms, with or without
21  * modification, are permitted provided that the following conditions
22  * are met:
23  * 1. Redistributions of source code must retain the above copyright
24  *   notice, this list of conditions and the following disclaimer.
25  * 2. Redistributions in binary form must reproduce the above copyright
26  *   notice, this list of conditions and the following disclaimer in the
27  *   documentation and/or other materials provided with the distribution.
28  * 3. The name of the author may not be used to endorse or promote products
29  *   derived from this software without specific prior written permission.
30  *
31  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
32  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
33  * IF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
34  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
35  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
36  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
37  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
38  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
39  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
40  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
41  *
42  * File: $Id: portother.c,v 1.1 2010/06/06 13:07:20 wolti Exp $
43  */
44 
45 /* ----------------------- System includes ----------------------------------*/
46 #include <stdlib.h>
47 #include <freertos/FreeRTOS.h>
48 #include <freertos/task.h>
49 
50 /* ----------------------- Modbus includes ----------------------------------*/
51 #include "mb.h"
52 #include "mbport.h"
53 
54 /* ----------------------- Modbus includes ----------------------------------*/
55 
56 /* ----------------------- Variables ----------------------------------------*/
57 
58 /* ----------------------- Start implementation -----------------------------*/
59 
60 BOOL
bMBPortIsWithinException(void)61 bMBPortIsWithinException( void )
62 {
63     BOOL bIsWithinException = xPortInIsrContext();
64     return bIsWithinException;
65 }
66 
67 void
vMBPortClose(void)68 vMBPortClose( void )
69 {
70     extern void     vMBPortSerialClose( void );
71     extern void     vMBPortTimerClose( void );
72     extern void     vMBPortEventClose( void );
73     vMBPortSerialClose(  );
74     vMBPortTimerClose(  );
75     vMBPortEventClose(  );
76 }
77