Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Basics of inter core communication on STM32 #386

Merged
merged 6 commits into from
Jun 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@
// #define EMBOT_ENABLE_hw_timer_emulated

// #define EMBOT_ENABLE_hw_IcacheDcache

#define EMBOT_ENABLE_hw_mtx
#define EMBOT_ENABLE_hw_icc_sig
#define EMBOT_ENABLE_hw_icc_mem
#define EMBOT_ENABLE_hw_icc_ltr

#else
#error this is the bsp config of STM32HAL_BOARD_AMC ...
Expand Down
210 changes: 210 additions & 0 deletions emBODY/eBcode/arch-arm/board/amc/bsp/embot_hw_icc_bsp_amc.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,210 @@

/*
* Copyright (C) 2023 iCub Tech - Istituto Italiano di Tecnologia
* Author: Marco Accame
* email: [email protected]
*/


// --------------------------------------------------------------------------------------------------------------------
// - public interface
// --------------------------------------------------------------------------------------------------------------------

#include "embot_hw_icc_bsp_amc.h"

// --------------------------------------------------------------------------------------------------------------------
// - external dependencies
// --------------------------------------------------------------------------------------------------------------------

#include <cstring>
#include <vector>
#include <array>

#include "embot_core_binary.h"
#include "embot_core.h"

#if defined(USE_STM32HAL)
#include "stm32hal.h"
#else
#warning this implementation is only for stm32hal
#endif


using namespace std;
using namespace embot::core::binary;

// --------------------------------------------------------------------------------------------------------------------
// - configuration of peripherals and chips. it is done board by board. it contains a check vs correct STM32HAL_BOARD_*
// --------------------------------------------------------------------------------------------------------------------

#include "embot_hw_bsp_amc_config.h"


// --------------------------------------------------------------------------------------------------------------------
// - support maps
// --------------------------------------------------------------------------------------------------------------------


// - support map: begin of embot::hw::icc::sig

#include "embot_hw_icc_sig_bsp.h"

#if !defined(EMBOT_ENABLE_hw_icc_sig)

namespace embot::hw::icc::sig::bsp {

// -- SIG

constexpr BSP thebsp {};
void BSP::init(embot::hw::icc::SIG h) const {}
const BSP & getBSPsig() { return thebsp; }

}

#elif defined(EMBOT_ENABLE_hw_icc_sig)

namespace embot::hw::icc::sig::bsp {

// -- SIG

constexpr PROP sig01 = { embot::hw::MTX::five };
constexpr PROP sig02 = { embot::hw::MTX::six };
constexpr PROP sig03 = { embot::hw::MTX::seven };
constexpr PROP sig04 = { embot::hw::MTX::eight };


constexpr BSP thebsp {
// maskofsupported
mask::pos2mask<uint32_t>(SIG::one) | mask::pos2mask<uint32_t>(SIG::two) |
mask::pos2mask<uint32_t>(SIG::three) | mask::pos2mask<uint32_t>(SIG::four),
// properties
{{
&sig01, &sig02, &sig03, &sig04
}}
};


void BSP::init(embot::hw::icc::SIG h) const { }

const BSP & getBSP() { return thebsp; }

}

#endif // #elif defined(EMBOT_ENABLE_hw_icc_sig)


// - support map: begin of embot::hw::icc::mem

#include "embot_hw_icc_mem_bsp.h"

#if !defined(EMBOT_ENABLE_hw_icc_mem)

namespace embot::hw::icc::mem::bsp {

// -- MEM

constexpr BSP thebsp {};
void BSP::init(embot::hw::icc::MEM h) const {}
const BSP & getBSP() { return thebsp; }

}

#elif defined(EMBOT_ENABLE_hw_icc_mem)

namespace embot::hw::icc::mem::bsp {

// -- MEM

constexpr uint32_t startmemory {0x38001000};
constexpr uint32_t memsize {256};

static const PROP mm1 = {
reinterpret_cast<void*>(startmemory),
memsize,
MTX::nine
};
static const PROP mm2 = {
reinterpret_cast<void*>(startmemory+1*memsize),
memsize,
MTX::ten
};
static const PROP mm3 = {
reinterpret_cast<void*>(startmemory+2*memsize),
memsize,
MTX::eleven
};
static const PROP mm4 = {
reinterpret_cast<void*>(startmemory+3*memsize),
memsize,
MTX::twelve
};

constexpr BSP thebsp {
// maskofsupported
mask::pos2mask<uint32_t>(MEM::one) | mask::pos2mask<uint32_t>(MEM::two) |
mask::pos2mask<uint32_t>(MEM::three) | mask::pos2mask<uint32_t>(MEM::four),
// properties
{{
&mm1, &mm2, &mm3, &mm4
}}
};

void BSP::init(embot::hw::icc::MEM h) const { }

const BSP & getBSP() { return thebsp; }

} // namespace embot::hw::icc::mem::bsp {

#endif // #elif defined(EMBOT_ENABLE_hw_icc_mem)


// - support map: begin of embot::hw::icc::ltr

#include "embot_hw_icc_ltr_bsp.h"

#if !defined(EMBOT_ENABLE_hw_icc_ltr)

namespace embot::hw::icc::ltr::bsp {

// -- LTR

constexpr BSP thebsp {};
void BSP::init(embot::hw::icc::LTR h) const {}
const BSP & getBSP() { return thebsp; }

}

#elif defined(EMBOT_ENABLE_hw_icc_ltr)

namespace embot::hw::icc::ltr::bsp {

// LTR

constexpr PROP ltr01 = { embot::hw::icc::MEM::four, embot::hw::icc::SIG::four, embot::hw::icc::SIG::three };

constexpr BSP thebsp {
// maskofsupported
mask::pos2mask<uint32_t>(LTR::one),
// properties
{{
&ltr01
}}
};


void BSP::init(embot::hw::icc::LTR h) const { }

const BSP & getBSP()
{
return thebsp;
}

} // namespace embot::hw::icc::ltr::bsp {

#endif // #elif defined(EMBOT_ENABLE_hw_icc_ltr)




// - end-of-file (leave a blank line after)----------------------------------------------------------------------------

26 changes: 26 additions & 0 deletions emBODY/eBcode/arch-arm/board/amc/bsp/embot_hw_icc_bsp_amc.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@

/*
* Copyright (C) 2023 iCub Tech - Istituto Italiano di Tecnologia
* Author: Marco Accame
* email: [email protected]
*/

// - include guard ----------------------------------------------------------------------------------------------------

#ifndef __EMBOT_HW_ICC_BSP_AMC_H_
#define __EMBOT_HW_ICC_BSP_AMC_H_

#include "embot_hw_bsp.h"
#include "embot_hw_icc.h"

namespace embot::hw::icc::bsp {

}

#endif // include-guard


// - end-of-file (leave a blank line after)----------------------------------------------------------------------------



Loading