Commit 2764a8ee authored by Damien George's avatar Damien George
Browse files

stmhal: Remove std.h. It's not needed anymore.

parent f53a8e71
......@@ -15,12 +15,16 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include <std.h>
#include <string.h>
#include "cc3000_common.h"
#include "socket.h"
#include "inet_ntop.h"
// We can't include stdio.h because it defines _types_fd_set, but we
// need to use the CC3000 version of this type. So we must provide
// our own declaration of snprintf. Grrr.
int snprintf(char *str, size_t size, const char *fmt, ...);
#define IN6ADDRSZ 16
#define INADDRSZ 4
#define INT16SZ 2
......
......@@ -24,10 +24,6 @@
* THE SOFTWARE.
*/
// We can't include stdio.h because it defines _types_fd_set, but we
// need to use the CC3000 version of this type.
#include <std.h>
#include <string.h>
#include <stdarg.h>
#include <errno.h>
......@@ -531,9 +527,9 @@ STATIC mp_obj_t cc3k_ifconfig(mp_obj_t self_in) {
mod_network_convert_ipv4_endianness(ipconfig.aucDHCPServer);
// render MAC address
char mac_str[18];
VSTR_FIXED(mac_vstr, 18);
const uint8_t *mac = ipconfig.uaMacAddr;
mp_uint_t mac_len = snprintf(mac_str, 18, "%02X:%02x:%02x:%02x:%02x:%02x", mac[5], mac[4], mac[3], mac[2], mac[1], mac[0]);
vstr_printf(&mac_vstr, "%02x:%02x:%02x:%02x:%02x:%02x", mac[5], mac[4], mac[3], mac[2], mac[1], mac[0]);
// create and return tuple with ifconfig info
mp_obj_t tuple[7] = {
......@@ -542,7 +538,7 @@ STATIC mp_obj_t cc3k_ifconfig(mp_obj_t self_in) {
mod_network_format_ipv4_addr(ipconfig.aucDefaultGateway),
mod_network_format_ipv4_addr(ipconfig.aucDNSServer),
mod_network_format_ipv4_addr(ipconfig.aucDHCPServer),
mp_obj_new_str(mac_str, mac_len, false),
mp_obj_new_str(mac_vstr.buf, mac_vstr.len, false),
mp_obj_new_str((const char*)ipconfig.uaSSID, strlen((const char*)ipconfig.uaSSID), false),
};
return mp_obj_new_tuple(MP_ARRAY_SIZE(tuple), tuple);
......@@ -566,7 +562,7 @@ STATIC mp_obj_t cc3k_patch_program(mp_obj_t self_in, mp_obj_t key_in) {
if (key[0] == 'p' && key[1] == 'g' && key[2] == 'm' && key[3] == '\0') {
patch_prog_start();
} else {
printf("pass 'pgm' as argument in order to program\n");
mp_print_str(&mp_plat_print, "pass 'pgm' as argument in order to program\n");
}
return mp_const_none;
}
......
/*
* This file is part of the Micro Python project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2013, 2014 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
typedef unsigned int size_t;
void *memcpy(void *dest, const void *src, size_t n);
void *memmove(void *dest, const void *src, size_t n);
void *memset(void *s, int c, size_t n);
size_t strlen(const char *str);
int strcmp(const char *s1, const char *s2);
int strncmp(const char *s1, const char *s2, size_t n);
char *strcpy(char *dest, const char *src);
char *strcat(char *dest, const char *src);
char *strchr(const char *s, int c);
char *strstr(const char *haystack, const char *needle);
int printf(const char *fmt, ...);
int snprintf(char *str, size_t size, const char *fmt, ...);
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment