From 3dc307c52b638551452889078d4d0281afcab9d3 Mon Sep 17 00:00:00 2001 From: zhangyanhua Date: Wed, 15 Feb 2023 20:56:44 +0800 Subject: [PATCH] add gpio mapper for atlas 200DK Signed-off-by: zhangyanhua --- mappers/gpio-atlas200/Dockerfile | 11 + mappers/gpio-atlas200/Makefile | 16 + mappers/gpio-atlas200/cmd/main.go | 12 + .../crd_example/gpio-deployment.yaml | 60 ++ .../crd_example/gpio-device-instance.yaml | 78 +++ .../crd_example/gpio-device-model.yaml | 26 + mappers/gpio-atlas200/driver/driver.go | 132 +++++ mappers/gpio-atlas200/driver/gpio.go | 514 ++++++++++++++++++ .../gpio-atlas200/hack/make-rules/mapper.sh | 190 +++++++ mappers/gpio-atlas200/res/ca.crt | 22 + mappers/gpio-atlas200/res/client.crt | 20 + mappers/gpio-atlas200/res/client.key | 27 + mappers/gpio-atlas200/res/config.yaml | 14 + mappers/gpio-atlas200/res/server.crt | 20 + mappers/gpio-atlas200/res/server.key | 27 + 15 files changed, 1169 insertions(+) create mode 100644 mappers/gpio-atlas200/Dockerfile create mode 100644 mappers/gpio-atlas200/Makefile create mode 100644 mappers/gpio-atlas200/cmd/main.go create mode 100644 mappers/gpio-atlas200/crd_example/gpio-deployment.yaml create mode 100644 mappers/gpio-atlas200/crd_example/gpio-device-instance.yaml create mode 100644 mappers/gpio-atlas200/crd_example/gpio-device-model.yaml create mode 100644 mappers/gpio-atlas200/driver/driver.go create mode 100644 mappers/gpio-atlas200/driver/gpio.go create mode 100644 mappers/gpio-atlas200/hack/make-rules/mapper.sh create mode 100644 mappers/gpio-atlas200/res/ca.crt create mode 100644 mappers/gpio-atlas200/res/client.crt create mode 100644 mappers/gpio-atlas200/res/client.key create mode 100644 mappers/gpio-atlas200/res/config.yaml create mode 100644 mappers/gpio-atlas200/res/server.crt create mode 100644 mappers/gpio-atlas200/res/server.key diff --git a/mappers/gpio-atlas200/Dockerfile b/mappers/gpio-atlas200/Dockerfile new file mode 100644 index 00000000..7201c0a8 --- /dev/null +++ b/mappers/gpio-atlas200/Dockerfile @@ -0,0 +1,11 @@ +FROM ubuntu:20.04 +WORKDIR /usr/local/bin +COPY ./res /usr/local/res +COPY ./bin /usr/local/bin +#RUN echo "HwHiAiUser:x:1000:1000::/home/HwHiAiUser:" >> /etc/passwd ; \ +#echo "HwHiAiUser:x:1024:" >> /etc/group ; \ +#echo "HwHiAiUser:!:17795:0:99999:7:::" >> /etc/shadow ; \ +#chown -R 1000:1000 /usr/local/bin; \ +#chown -R 1000:1000 /usr/local/res; +USER 0 +ENTRYPOINT ["./gpio","--v","4"] diff --git a/mappers/gpio-atlas200/Makefile b/mappers/gpio-atlas200/Makefile new file mode 100644 index 00000000..992acb50 --- /dev/null +++ b/mappers/gpio-atlas200/Makefile @@ -0,0 +1,16 @@ +.PHONY: build test clean docker +help: + # + # Usage: + # make build : compile main.go + # make clean : clean binaries + # make docker : pack binaries to image + @echo +build: + go build -o ./bin/gpio ./cmd/main.go + @echo "[INFO] go build successful" + @echo "[INFO] you can cd ./bin to execute it" +clean: + rm -rf ./bin/* +docker: + docker build -f ./Dockerfile -t mapper-gpio-device:v0.0.1 . diff --git a/mappers/gpio-atlas200/cmd/main.go b/mappers/gpio-atlas200/cmd/main.go new file mode 100644 index 00000000..13d8ad0f --- /dev/null +++ b/mappers/gpio-atlas200/cmd/main.go @@ -0,0 +1,12 @@ +package main + +import ( + "github.com/kubeedge/mappers-go/mapper-sdk-go/pkg/service" + "github.com/kubeedge/mappers-go/mappers/gpio-atlas200/driver" +) + +// main gpio device program entry +func main() { + gpio := &driver.GPIO{} + service.Bootstrap("GPIO", gpio) +} diff --git a/mappers/gpio-atlas200/crd_example/gpio-deployment.yaml b/mappers/gpio-atlas200/crd_example/gpio-deployment.yaml new file mode 100644 index 00000000..52b87967 --- /dev/null +++ b/mappers/gpio-atlas200/crd_example/gpio-deployment.yaml @@ -0,0 +1,60 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: gpio-deploy-edge-line +spec: + replicas: 1 + selector: + matchLabels: + app: gpio-line1 + template: + metadata: + labels: + app: gpio-line1 + spec: + hostNetwork: true + nodeSelector: + kubernetes.io/hostname: edge-a200-00 + containers: + - name: gpio-container + image: gpio-mapper-arm64:v1.0 + imagePullPolicy: IfNotPresent + ports: + - containerPort: 1215 + hostPort: 1215 + hostIP: 0.0.0.0 + securityContext: + privileged: true + volumeMounts: + - name: config-volume + mountPath: /opt/kubeedge/ + - name: gpio0-direction + mountPath: /sys/class/gpio/gpio504/direction + - name: gpio1-direction + mountPath: /sys/class/gpio/gpio444/direction + - name: gpio0-value + mountPath: /sys/class/gpio/gpio504/value + - name: gpio1-value + mountPath: /sys/class/gpio/gpio444/value + - name: i2c-path + mountPath: /dev/i2c-1 + volumes: + - name: config-volume + configMap: + name: device-profile-config-edge-a200-00 + - name: gpio0-direction + hostPath: + path: /sys/class/gpio/gpio504/direction + - name: gpio1-direction + hostPath: + path: /sys/class/gpio/gpio444/direction + - name: gpio0-value + hostPath: + path: /sys/class/gpio/gpio504/value + - name: gpio1-value + hostPath: + path: /sys/class/gpio/gpio444/value + - name: i2c-path + hostPath: + path: /dev/i2c-1 + restartPolicy: Always diff --git a/mappers/gpio-atlas200/crd_example/gpio-device-instance.yaml b/mappers/gpio-atlas200/crd_example/gpio-device-instance.yaml new file mode 100644 index 00000000..8f544d85 --- /dev/null +++ b/mappers/gpio-atlas200/crd_example/gpio-device-instance.yaml @@ -0,0 +1,78 @@ +apiVersion: devices.kubeedge.io/v1alpha2 +kind: Device +metadata: + name: led-instance-01 + labels: + model: led-model +spec: + deviceModelRef: + name: led-model + protocol: + customizedProtocol: + protocolName: GPIO + nodeSelector: + nodeSelectorTerms: + - matchExpressions: + - key: '' + operator: In + values: + - edge-a200-00 #pls give your edge node name + propertyVisitors: + - propertyName: red-power-status + collectCycle: 10000000000 #Mapper 从设备收集数据的频率 + reportCycle: 1000000000 #Mapper 报告数据的频率 + customizedProtocol: + protocolName: GPIO + configData: + pin: 0 #pls give your red light's Pin + - propertyName: green-power-status + collectCycle: 10000000000 #Mapper 从设备收集数据的频率 + reportCycle: 1000000000 #Mapper 报告数据的频率 + customizedProtocol: + protocolName: GPIO + configData: + pin: 1 #pls give your green light's Pin + - propertyName: yellow-power-status + collectCycle: 10000000000 #Mapper 从设备收集数据的频率 + reportCycle: 1000000000 #Mapper 报告数据的频率 + customizedProtocol: + protocolName: GPIO + configData: + pin: 3 #pls give your yellow light's Pin, pin 2 is not vaild for atlas200dk + +status: + twins: + - propertyName: red-power-status + reported: + metadata: + timestamp: '1550049403598' + type: string + value: "OFF" + desired: + metadata: + timestamp: '1550049403598' + type: string + value: "OFF" + - propertyName: green-power-status + reported: + metadata: + timestamp: '1550049403598' + type: string + value: "OFF" + desired: + metadata: + timestamp: '1550049403598' + type: string + value: "ON" + - propertyName: yellow-power-status + reported: + metadata: + timestamp: '1550049403598' + type: string + value: "OFF" + desired: + metadata: + timestamp: '1550049403598' + type: string + value: "OFF" + diff --git a/mappers/gpio-atlas200/crd_example/gpio-device-model.yaml b/mappers/gpio-atlas200/crd_example/gpio-device-model.yaml new file mode 100644 index 00000000..60594b23 --- /dev/null +++ b/mappers/gpio-atlas200/crd_example/gpio-device-model.yaml @@ -0,0 +1,26 @@ +apiVersion: devices.kubeedge.io/v1alpha2 +kind: DeviceModel +metadata: + name: led-model + namespace: default +spec: + properties: + - name: red-power-status + description: red + type: + string: + accessMode: ReadWrite + defaultValue: "OFF" + - name: green-power-status + description: green + type: + string: + accessMode: ReadWrite + defaultValue: "OFF" + - name: yellow-power-status + description: yellow + type: + string: + accessMode: ReadWrite + defaultValue: "ON" + \ No newline at end of file diff --git a/mappers/gpio-atlas200/driver/driver.go b/mappers/gpio-atlas200/driver/driver.go new file mode 100644 index 00000000..6253eb9e --- /dev/null +++ b/mappers/gpio-atlas200/driver/driver.go @@ -0,0 +1,132 @@ +package driver + +import ( + "encoding/json" + "fmt" + "strings" + "sync" +) + +type GPIOProtocolConfig struct { + ProtocolName string `json:"protocolName"` + ProtocolConfigData `json:"configData"` +} + +type ProtocolConfigData struct { +} + +type GPIOProtocolCommonConfig struct { + CommonCustomizedValues `json:"customizedValues"` +} + +type CommonCustomizedValues struct { +} +type GPIOVisitorConfig struct { + ProtocolName string `json:"protocolName"` + VisitorConfigData `json:"configData"` +} + +type VisitorConfigData struct { + Pin int `json:"pin"` +} + +// GPIO Realize the structure of random number +type GPIO struct { + mutex sync.Mutex + protocolConfig GPIOProtocolConfig + protocolCommonConfig GPIOProtocolCommonConfig + visitorConfig GPIOVisitorConfig +} + +// InitDevice Sth that need to do in the first +// If you need mount a persistent connection, you should provide parameters in configmap's protocolCommon. +// and handle these parameters in the following function +func (d *GPIO) InitDevice(protocolCommon []byte) (err error) { + if protocolCommon != nil { + if err = json.Unmarshal(protocolCommon, &d.protocolCommonConfig); err != nil { + fmt.Printf("Unmarshal ProtocolCommonConfig error: %v\n", err) + return err + } + } + fmt.Println("GPIO devices do not need to be initialized") + return nil +} + +// SetConfig Parse the configmap's raw json message +func (d *GPIO) SetConfig(protocolCommon, visitor, protocol []byte) (pin int, err error) { + d.mutex.Lock() + defer d.mutex.Unlock() + if protocolCommon != nil { + if err = json.Unmarshal(protocolCommon, &d.protocolCommonConfig); err != nil { + fmt.Printf("Unmarshal ProtocolCommonConfig error: %v\n", err) + return 0, err + } + } + if visitor != nil { + if err = json.Unmarshal(visitor, &d.visitorConfig); err != nil { + fmt.Printf("Unmarshal visitorConfig error: %v\n", err) + return 0, err + } + } + if protocol != nil { + if err = json.Unmarshal(protocol, &d.protocolConfig); err != nil { + fmt.Printf("Unmarshal ProtocolConfig error: %v\n", err) + return 0, err + } + } + return d.visitorConfig.Pin, nil +} + +// ReadDeviceData is an interface that reads data from a specific device, data is a type of string +func (d *GPIO) ReadDeviceData(protocolCommon, visitor, protocol []byte) (data interface{}, err error) { + // Parse raw json message to get a virtualDevice instance + pin, err := d.SetConfig(protocolCommon, visitor, protocol) + if err != nil { + return nil, err + } + pinClient := Pin(pin) + if pinClient.Read() == '0' { + return "OFF", nil + } + return "ON", nil +} + +// WriteDeviceData is an interface that write data to a specific device, data's DataType is Consistent with configmap +func (d *GPIO) WriteDeviceData(data interface{}, protocolCommon, visitor, protocol []byte) (err error) { + // Parse raw json message to get a virtualDevice instance + pin, err := d.SetConfig(protocolCommon, visitor, protocol) + if err != nil { + return err + } + status := data.(string) + pinClient := Pin(pin) + if strings.ToUpper(status) == "OFF" { + pinClient.SetOutPut() + pinClient.SetLow() + + } else if strings.ToUpper(status) == "ON" { + pinClient.SetOutPut() + pinClient.SetHight() + } else { + fmt.Println("the command should be \"ON\" or \"OFF\"") + } + return nil +} + +// StopDevice is an interface to disconnect a specific device +// This function is called when mapper stops serving +func (d *GPIO) StopDevice() (err error) { + // in this func, u can get ur device-instance in the client map, and give a safety exit + fmt.Println("----------Stop gpio Device Successful----------") + return nil +} + +// GetDeviceStatus is an interface to get the device status true is OK , false is DISCONNECTED +func (d *GPIO) GetDeviceStatus(protocolCommon, visitor, protocol []byte) (status bool) { + err := Open() + defer Close() + if err != nil { + return false + } + return true +} diff --git a/mappers/gpio-atlas200/driver/gpio.go b/mappers/gpio-atlas200/driver/gpio.go new file mode 100644 index 00000000..b2c560fb --- /dev/null +++ b/mappers/gpio-atlas200/driver/gpio.go @@ -0,0 +1,514 @@ +/* + Atlas 200DK A1 PIN define + +------+---------+-------++------+---------+-------+ + | pin | Name |voltage|| pin | Name |voltage| + +-----+-----------+------++----+---------+-----+ + | 1 | +3.3v | 3.3V || 2 | +5.0v | 5.0V | + | 3 | SDA | 3.3V || 4 | +5.0v | 5.0V | + | 5 | SCL | 3.3V || 6 | GND | - | + | 7 | GPIO-0 | 3.3V || 8 | TXD0 | 3.3V | + | 9 | GND | - || 10 | RXD0 | 3.3V | + | 11 | GPIO-1 | 3.3V || 12 | NC | - | + | 13 | NC | 3.3V || 14 | GND | - | + | 15 | GPIO-2 | 3.3V || 16 | TXD1 | 3.3V | + | 17 | +3.3v | 3.3V || 18 | RXD1 | 3.3V | + | 19 | SPI-MOSI| 3.3V || 20 | GND | - | + | 21 | SPI-MISO| 3.3V || 22 | NC | - | + | 23 | SPI-CLK | 3.3V || 24 | SPI-CS | 3.3V | + | 25 | GND | - || 26 | NC | - | + | 27 | CAN-H | - || 28 | CAN-1 | - | + | 29 | GPIO-3 | 3.3V || 30 | GND | - | + | 31 | GPIO-4 | 3.3V || 32 | NC | - | + | 33 | GPIO-5 | 3.3V || 34 | GND | - | + | 35 | GPIO-6 | 3.3V || 36 | +1.8V | 1.8V | + | 37 | GPIO-7 | 3.3V || 38 | TXD-3559| 3.3V | + | 39 | GND | 3.3V || 40 | RXD-3559| 3.3V | + +------+---------+-------++------+---------+-------+ +gpio 0~1 are directly derived from the Ascend AI processor, +gpio 2 is not available for user +gpio 3~7 are derived from PCA6416,controlled by i2c +*/ + +package driver + +import ( + "fmt" + "io/fs" + "k8s.io/klog/v2" + "os" + "syscall" + "unsafe" +) + +type Mode uint8 +type Pin uint8 +type State uint8 +type i2c_msg struct { + addr uint16 + flags uint16 + len uint16 + __padding uint16 + buf uintptr +} + +type i2c_ctrl struct { + msgs uintptr + msg_num uint32 +} + +const ( + ascend_gpio_0_dir = "/sys/class/gpio/gpio504/direction" + ascend_gpio_1_dir = "/sys/class/gpio/gpio444/direction" + ascend_gpio_0_val = "/sys/class/gpio/gpio504/value" + ascend_gpio_1_val = "/sys/class/gpio/gpio444/value" +) +const ( + i2c_device_name = "/dev/i2c-1" + i2c_retres = 0x0701 + i2c_timeout = 0x0702 + i2c_slave = 0x0703 + i2c_rdwr = 0x0707 + i2c_m_rd = 0x01 + + pca6416_slave_addr = 0x20 + pca6416_gpio_cfg_reg = 0x07 + pca6416_gpio_porarity_reg = 0x05 + pca6416_gpio_out_reg = 0x03 + pca6416_gpio_in_reg = 0x01 + + //GPIO MASK + + gpio3_mask = 0x10 + gpio4_mask = 0x20 + gpio5_mask = 0x40 + gpio6_mask = 0x80 + gpio7_mask = 0x08 +) + +// Generic ioctl constants +const ( + IOC_NONE = 0x0 + IOC_WRITE = 0x1 + IOC_READ = 0x2 + + IOC_NRBITS = 8 + IOC_TYPEBITS = 8 + + IOC_SIZEBITS = 14 + IOC_DIRBITS = 2 + + IOC_NRSHIFT = 0 + IOC_TYPESHIFT = IOC_NRSHIFT + IOC_NRBITS //8 + 0 + IOC_SIZESHIFT = IOC_TYPESHIFT + IOC_TYPEBITS //8 + 8 + IOC_DIRSHIFT = IOC_SIZESHIFT + IOC_SIZEBITS //16 + 14 + + IOC_NRMASK = ((1 << IOC_NRBITS) - 1) + IOC_TYPEMASK = ((1 << IOC_TYPEBITS) - 1) + IOC_SIZEMASK = ((1 << IOC_SIZEBITS) - 1) + IOC_DIRMASK = ((1 << IOC_DIRBITS) - 1) +) + +// Some useful additional ioctl constanst +const ( + IOC_IN = IOC_WRITE << IOC_DIRSHIFT + IOC_OUT = IOC_READ << IOC_DIRSHIFT + IOC_INOUT = (IOC_WRITE | IOC_READ) << IOC_DIRSHIFT + IOCSIZE_MASK = IOC_SIZEMASK << IOC_SIZESHIFT + IOCSIZE_SHIFT = IOC_SIZESHIFT +) + +const ( + Input Mode = iota + Output +) + +// State of pin, High / Low +const ( + Low uint8 = iota + High +) + +// setInput: Set pin as InputPin +func (pin Pin) SetInPut() { + setPinMode(pin, Input) +} + +// setOutput: Set pin as Output +func (pin Pin) SetOutPut() { + setPinMode(pin, Output) +} + +// setHight: Set pin Hight +func (pin Pin) SetHight() { + gpioSetValue(pin, High) +} + +// setLow: Set pin as Low +func (pin Pin) SetLow() { + gpioSetValue(pin, Low) +} + +// Write: Set pin state (high/low) +func (pin Pin) Write(val uint8) { + WritePin(pin, val) +} + +// Read pin state (high/low) +func (pin Pin) Read() uint8 { + return ReadPin(pin) +} + +func WritePin(pin Pin, val uint8) { + gpioSetValue(pin, val) +} + +func ReadPin(pin Pin) uint8 { + var val uint8 + err := gpioGetValue(pin, &val) + if err != nil { + return 0 + } + return val +} + +// Spi mode should not be set by this directly, use SpiBegin instead. +func setPinMode(pin Pin, mode Mode) { + f := uint8(0) + const in uint8 = 0 // 000 + const out uint8 = 1 // 001 + + switch mode { + case Input: + f = in + case Output: + f = out + } + gpioSetDirection(pin, f) +} + +func Open() (err error) { + return nil +} +func Close() (err error) { + return nil +} +func isPca6416Pin(pin Pin) bool { + if pin >= 3 && pin <= 7 { + return true + } + return false +} + +// IOCTL send ioctl +func IOCTL(f *os.File, flag, data uintptr) error { + _, _, err := syscall.Syscall(syscall.SYS_IOCTL, uintptr(f.Fd()), flag, uintptr(data)) + if err != 0 { + return syscall.Errno(err) + } + return nil +} + +func i2c_read(slave uint8, reg uint8, data *uint8) error { + regs := []uint8{reg, reg} + msg := []i2c_msg{ + { + addr: uint16(slave), + flags: 0, + len: uint16(1), //the length of reg addr is 1 + buf: uintptr(unsafe.Pointer(®s[0])), + }, + { + addr: uint16(slave), + flags: i2c_m_rd, + len: uint16(1), + buf: uintptr(unsafe.Pointer(data)), + }, + } + ssm_msg := i2c_ctrl{ + msgs: uintptr(unsafe.Pointer(&msg[0])), + msg_num: uint32(len(msg)), + } + + perm := fs.FileMode(0644) //-rw-r--r-- + flag := int(os.O_RDWR | os.O_CREATE | os.O_TRUNC) + f, err := os.OpenFile(i2c_device_name, flag, perm) + defer f.Close() + if err != nil { + return err + } + + err = IOCTL(f, i2c_rdwr, uintptr(unsafe.Pointer(&ssm_msg))) + return err +} + +func i2c_write(slave uint8, reg uint8, data uint8) error { + buf := []uint8{reg, data} + msg := []i2c_msg{ + { + addr: uint16(slave), + flags: 0, + len: uint16(len(buf)), + buf: uintptr(unsafe.Pointer(&buf[0])), + }, + } + + ssm_msg := i2c_ctrl{ + msgs: uintptr(unsafe.Pointer(&msg[0])), + msg_num: uint32(1), + } + + perm := fs.FileMode(666) // -rw-rw-rw- + flag := int(os.O_RDWR | os.O_CREATE | os.O_TRUNC) + f, err := os.OpenFile(i2c_device_name, flag, perm) + defer f.Close() + if err != nil { + return err + } + err = IOCTL(f, i2c_rdwr, uintptr(unsafe.Pointer(&ssm_msg))) + return err +} + +func pca6416GpioSetDirection(pin Pin, dir uint8) error { + var err error + var data uint8 + var reg uint8 + var slave uint8 + var gpio_mask = []uint8{0, 0, 0, gpio3_mask, gpio4_mask, gpio5_mask, gpio6_mask, gpio7_mask} + + if false == isPca6416Pin(pin) { + err = fmt.Errorf("pin number is incorrect,must be 3 to 7") + return err + } + slave = pca6416_slave_addr + reg = pca6416_gpio_cfg_reg + data = 0 + err = i2c_read(slave, reg, &data) + if err != nil { + klog.Errorf("pca6416GpioSetDirection read fail, pin %v err = %v.", pin, err) + return err + } + if dir == 0 { + data |= gpio_mask[pin] + } else { + data &= ^gpio_mask[pin] + } + err = i2c_write(slave, reg, data) + if err != nil { + klog.Errorf("pca6416GpioSetDirection write fail pin %v err = %v.", pin, err) + } + return err +} +func pca6416GpioSetValue(pin Pin, val uint8) error { + var err error + var data uint8 + var reg uint8 + var slave uint8 + var gpio_mask = []uint8{0, 0, 0, gpio3_mask, gpio4_mask, gpio5_mask, gpio6_mask, gpio7_mask} + + if false == isPca6416Pin(pin) { + err = fmt.Errorf("pin number is incorrect,must be 3 to 7") + return err + } + slave = pca6416_slave_addr + reg = pca6416_gpio_out_reg + data = 0 + err = i2c_read(slave, reg, &data) + if err != nil { + klog.Errorf("pca6416GpioSetValue read fail, pin %v err = %v.", pin, err) + return err + } + if val == 0 { + data &= ^gpio_mask[pin] + } else { + data |= gpio_mask[pin] + } + + err = i2c_write(slave, reg, data) + if err != nil { + klog.Errorf("pca6416GpioSetValue write fail pin %v err = %v.", pin, err) + } + return err +} +func pca6416GpioGetValue(pin Pin, val *uint8) error { + var err error + var data uint8 + var reg uint8 + var slave uint8 + var gpio_mask = []uint8{0, 0, 0, gpio3_mask, gpio4_mask, gpio5_mask, gpio6_mask, gpio7_mask} + + if false == isPca6416Pin(pin) { + err = fmt.Errorf("pin number is incorrect,must be 3 to 7") + return err + } + slave = pca6416_slave_addr + reg = pca6416_gpio_in_reg + data = 0 + err = i2c_read(slave, reg, &data) + if err != nil { + klog.Errorf("pca6416GpioSetValue read fail, pin %v err = %v.", pin, err) + return err + } + data &= gpio_mask[pin] + if data > 0 { + *val = '1' + } else { + *val = '0' + } + return nil +} + +func AscendGpioSetDirection(pin Pin, dir uint8) error { + var fileName string + var direction string + var err error + + if pin == 0 { + fileName = ascend_gpio_0_dir + } else if pin == 1 { + fileName = ascend_gpio_1_dir + } else { + err = fmt.Errorf("pin number is incorrect,must be 0 or 1") + return err + } + direction = "out" + if dir == 0 { + direction = "in" + } + err = os.WriteFile(fileName, []byte(direction), 0644) + if err != nil { + klog.Errorf("os.WriteFile fileName= %v err = %v ", fileName, err) + return err + } + + return nil +} + +func AscendGpioSetValue(pin Pin, val uint8) error { + var fileName string + var err error + if pin == 0 { + fileName = ascend_gpio_0_val + } else if pin == 1 { + fileName = ascend_gpio_1_val + } else { + err = fmt.Errorf("pin number is incorrect,must be 0 or 1") + return err + } + klog.V(3).Infof("AscendGpioSetValue pin %v val = %v fileName = %v", pin, val, fileName) + buff := []byte{val + '0'} + err = os.WriteFile(fileName, buff, 0644) + if err != nil { + klog.Errorf("os.WriteFile fileName= %v err = %v ", fileName, err) + } + return err +} + +func AscendGpioGetValue(pin Pin, val *uint8) error { + var fileName string + if pin == 0 { + fileName = ascend_gpio_0_val + } else if pin == 1 { + fileName = ascend_gpio_1_val + } else { + err := fmt.Errorf("pin number is incorrect,the correct num is must be 0,1") + return err + } + readFile, err := os.ReadFile(fileName) + *val = readFile[0] + if err != nil { + klog.Errorf("AscendGpioGetValue pin %v err = %v.", pin, err) + } + klog.V(5).Infof("AscendGpioGetValue pin %v val = %v.", pin, *val) + return err +} +func isAscendPin(pin Pin) bool { + if pin == 0 || pin == 1 { + return true + } + return false +} + +// set gpio direction ,0-- in ,1--out +func gpioSetDirection(pin Pin, direction uint8) error { + var result error + if true == isAscendPin(pin) { + result = AscendGpioSetDirection(pin, direction) + } else { + result = pca6416GpioSetDirection(pin, direction) + } + + if nil != result { + klog.V(3).Infof("gpioSetDirection fail, pin= %v direction= %v result = %v", pin, direction, result) + } else { + klog.V(5).Infof("gpioSetDirection ok, pin= %v direction = %v", pin, direction) + } + return result +} + +func gpioSetValue(pin Pin, val uint8) error { + var result error + + if true == isAscendPin(pin) { + result = AscendGpioSetValue(pin, val) + } else { + result = pca6416GpioSetValue(pin, val) + } + if nil != result { + klog.V(3).Infof("gpioSetValue fail, pin= %v val= %v result = %v", pin, val, result) + } else { + klog.V(5).Infof("gpioSetValue ok, pin= %v val = %v", pin, val) + } + return result +} +func gpioGetValue(pin Pin, val *uint8) error { + var result error + + if true == isAscendPin(pin) { + result = AscendGpioGetValue(pin, val) + } else { + result = pca6416GpioGetValue(pin, val) + } + + if nil != result { + klog.V(3).Infof("gpioGetValue fail, pin= %v result = %v", pin, result) + } else { + klog.V(5).Infof("gpioGetValue ok, pin= %v val = %v", pin, *val) + } + return result +} + +/* +func Gpio_test() { + var value uint8 = 0 + var pin Pin + var result error + + for pin = 1; pin <= 8; pin++ { + + fmt.Printf("\r\n\r\n gpioSetDirection pin %v Direction = %v ", pin, 1) + result = gpioSetDirection(pin, 1) + + value = 0 + fmt.Printf("\r\n\r\n gpioSetValue pin %v val = %v", pin, value) + result = gpioSetValue(pin, value) + time.Sleep(10 * (time.Millisecond)) + + result = gpioGetValue(pin, &value) + fmt.Printf("\r\n \r\n gpioGetValue pin %v val = %v", pin, value) + fmt.Printf("\r\n result = %v ", result) + time.Sleep(10 * (time.Millisecond)) + + value = 1 + fmt.Printf("\r\n\r\n gpioSetValue pin %v val = %v", pin, value) + result = gpioSetValue(pin, value) + time.Sleep(10 * (time.Millisecond)) + + result = gpioGetValue(pin, &value) + fmt.Printf("\r\n \r\n gpioGetValue pin %v val = %v", pin, value) + fmt.Printf("\r\n result = %v ", result) + time.Sleep(10 * (time.Millisecond)) + + fmt.Printf("\r\n ") + } +} +*/ diff --git a/mappers/gpio-atlas200/hack/make-rules/mapper.sh b/mappers/gpio-atlas200/hack/make-rules/mapper.sh new file mode 100644 index 00000000..74715aa0 --- /dev/null +++ b/mappers/gpio-atlas200/hack/make-rules/mapper.sh @@ -0,0 +1,190 @@ +#!/usr/bin/env bash + +set -o errexit +set -o nounset +set -o pipefail + +CURR_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd -P)" +ROOT_DIR="$(cd "${CURR_DIR}/../.." && pwd -P)" +source "${ROOT_DIR}/hack/lib/init.sh" + +mkdir -p "${CURR_DIR}/bin" +mkdir -p "${CURR_DIR}/dist" + +function mod() { + [[ "${2:-}" != "only" ]] + local mapper="${1}" + + # the mapper is sharing the vendor with root + pushd "${ROOT_DIR}" >/dev/null || exist 1 + echo "downloading dependencies for mapper ${mapper}..." + + if [[ "$(go env GO111MODULE)" == "off" ]]; then + echo "go mod has been disabled by GO111MODULE=off" + else + echo "tidying" + go mod tidy + echo "vending" + go mod vendor + fi + + echo "...done" + popd >/dev/null || return +} + +function lint() { + [[ "${2:-}" != "only" ]] && mod "$@" + local mapper="${1}" + + echo "fmt and linting mapper ${mapper}..." + + gofmt -s -w "${CURR_DIR}/" + golangci-lint run "${CURR_DIR}/..." + + echo "...done" +} + +function build() { + [[ "${2:-}" != "only" ]] && lint "$@" + local mapper="${1}" + + local flags=" -w -s " + local ext_flags=" -extldflags '-static' " + local os="${OS:-$(go env GOOS)}" + local arch="${ARCH:-$(go env GOARCH)}" + + local platform + if [[ "${ARM:-false}" == "true" ]]; then + echo "crossed packaging for linux/arm" + platform=("linux/arm") + elif [[ "${ARM64:-false}" == "true" ]]; then + echo "crossed packaging for linux/arm64" + platform=("linux/arm64") + else + local os="${OS:-$(go env GOOS)}" + local arch="${ARCH:-$(go env GOARCH)}" + platform=("${os}/${arch}") + fi + + echo "building ${platform}" + + local os_arch + IFS="/" read -r -a os_arch <<<"${platform}" + local os=${os_arch[0]} + local arch=${os_arch[1]} + GOOS=${os} GOARCH=${arch} CGO_ENABLED=0 go build \ + -ldflags "${flags} ${ext_flags}" \ + -o "${CURR_DIR}/bin/${mapper}_${os}_${arch}" \ + "${CURR_DIR}/cmd/main.go" + + cp ${CURR_DIR}/bin/${mapper}_${os}_${arch} ${CURR_DIR}/bin/${mapper} + echo "...done" +} + +function package() { + [[ "${2:-}" != "only" ]] && build "$@" + local mapper="${1}" + + echo "packaging mapper ${mapper}..." + + local image_name="${mapper}-mapper" + local tag=v1.0 + + local platform + if [[ "${ARM:-false}" == "true" ]]; then + echo "crossed packaging for linux/arm" + platform=("linux/arm") + elif [[ "${ARM64:-false}" == "true" ]]; then + echo "crossed packaging for linux/arm64" + platform=("linux/arm64") + else + local os="${OS:-$(go env GOOS)}" + local arch="${ARCH:-$(go env GOARCH)}" + platform=("${os}/${arch}") + fi + + pushd "${CURR_DIR}" >/dev/null 2>&1 + if [[ "${platform}" =~ darwin/* ]]; then + echo "package into Darwin OS image is unavailable, please use CROSS=true env to containerize multiple arch images or use OS=linux ARCH=amd64 env to containerize linux/amd64 image" + fi + + local image_tag="${image_name}:${tag}-${platform////-}" + echo "packaging ${image_tag}" + sudo docker build \ + --platform "${platform}" \ + -t "${image_tag}" . + popd >/dev/null 2>&1 + + echo "...done" +} + +function test() { + [[ "${2:-}" != "only" ]] && build "$@" + local mapper="${1}" + + echo "running unit tests for mapper ${mapper}..." + + local unit_test_targets=( + "${CURR_DIR}/config/..." + "${CURR_DIR}/configmap/..." + "${CURR_DIR}/device/..." + "${CURR_DIR}/driver/..." + ) + + local os="${OS:-$(go env GOOS)}" + local arch="${ARCH:-$(go env GOARCH)}" + if [[ "${arch}" == "arm" ]]; then + # NB(thxCode): race detector doesn't support `arm` arch, ref to: + # - https://golang.org/doc/articles/race_detector.html#Supported_Systems + GOOS=${os} GOARCH=${arch} CGO_ENABLED=1 go test \ + -cover -coverprofile "${CURR_DIR}/dist/coverage_${mapper}_${os}_${arch}.out" \ + "${unit_test_targets[@]}" + else + GOOS=${os} GOARCH=${arch} CGO_ENABLED=1 go test \ + -race \ + -cover -coverprofile "${CURR_DIR}/dist/coverage_${mapper}_${os}_${arch}.out" \ + "${unit_test_targets[@]}" + fi + + echo "...done" +} + +function clean() { + local mapper="${1}" + + echo "cleanup mapper ${mapper}..." + + rm -rf "${CURR_DIR}/bin/*" + + echo "...done" +} + +function entry() { + local mapper="${1:-}" + shift 1 + + local stages="${1:-build}" + shift $(($# > 0 ? 1 : 0)) + + IFS="," read -r -a stages <<<"${stages}" + local commands=$* + if [[ ${#stages[@]} -ne 1 ]]; then + commands="only" + fi + + for stage in "${stages[@]}"; do + echo "# make mapper ${mapper} ${stage} ${commands}" + case ${stage} in + m | mod) mod "${mapper}" "${commands}" ;; + l | lint) lint "${mapper}" "${commands}" ;; + b | build) build "${mapper}" "${commands}" ;; + p | pkg | package) package "${mapper}" "${commands}" ;; + t | test) test "${mapper}" "${commands}" ;; + c | clean) clean "${mapper}" "${commands}" ;; + *) echo "unknown action '${stage}', select from mod,lint,build,test,clean" ;; + esac + done +} + +echo $@ +entry "$@" diff --git a/mappers/gpio-atlas200/res/ca.crt b/mappers/gpio-atlas200/res/ca.crt new file mode 100644 index 00000000..af78724e --- /dev/null +++ b/mappers/gpio-atlas200/res/ca.crt @@ -0,0 +1,22 @@ +-----BEGIN CERTIFICATE----- +MIIDlzCCAn+gAwIBAgIUF91PMfNuLjHukTsoNwZBGJ0iYewwDQYJKoZIhvcNAQEL +BQAwWzELMAkGA1UEBhMCQ04xDjAMBgNVBAgMBUh1YmVpMQ4wDAYDVQQHDAVXdWhh +bjEMMAoGA1UECgwDV1VUMQswCQYDVQQLDAJDUzERMA8GA1UEAwwIS3ViZWVkZ2Uw +HhcNMjIwNDIwMTUyOTAwWhcNMzIwNDE3MTUyOTAwWjBbMQswCQYDVQQGEwJDTjEO +MAwGA1UECAwFSHViZWkxDjAMBgNVBAcMBVd1aGFuMQwwCgYDVQQKDANXVVQxCzAJ +BgNVBAsMAkNTMREwDwYDVQQDDAhLdWJlZWRnZTCCASIwDQYJKoZIhvcNAQEBBQAD +ggEPADCCAQoCggEBAKgrfTmQYy/Dn8Aob8kaJ+4mbdgLJTB2kh/bw71ZRxgjZ16C +aBz024B0E0xbe8+SE2EtyAle/cBlOthPI9mAFpved0MdoCzmLBJqntHwKeWI/UtF +JAB+Wc5T612eg3V07NUniumWefOwsyzwZi+obmKMI4Lvg3D2ETmA8UlKg+ZRMZ3U +IVre26cx0Ur5ItBaLhhtlS3HGzeSDnZgEvm1sBrBXSICd16pl/bOnpNBUR7tQGpf +PXMAybR3taZXq46sFNeViDuHvGQErIl6ChdOE6bryfNNREBR4DvXDri1+yTh+44d +O4o6GOnd2zMzSIo2kYD5NtrIIF4i84Ok0l7R1cMCAwEAAaNTMFEwHQYDVR0OBBYE +FAJq+Rjj0tqDNRrW9fX1BXCUkHE6MB8GA1UdIwQYMBaAFAJq+Rjj0tqDNRrW9fX1 +BXCUkHE6MA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQELBQADggEBACl8N9+A +SVKM7MhFyjgaXKvnBImwFO4uCFhkHzRn7vph5hzQh5GfzIsPTdGkbDwCSI8VETf6 +8X1VBK0eqTLb0ID8+c4ye3Y1trl8Hi08uaJj0vPlVW9ZdFz1aGoLRHMuwvDWB7bZ +9anVvICXhNtx1x35rmYFl/I58Ly9ZArBVg5Msuhb+rfiFr2FA5VcyJZ1jp4jdXOj +bsW57AW9/tyDjCxTillC0rX8yZqTBn/4/2Joa4v/310+LpLEJNxYPqnqs0xclJpC +R7AwZjXEmxGFEmF86OM/jws8XpYVp1qyt21xenM0/mQGmxmsdQaM8Refp0+VYM6k +NWOq2Y2zIUEdv8U= +-----END CERTIFICATE----- diff --git a/mappers/gpio-atlas200/res/client.crt b/mappers/gpio-atlas200/res/client.crt new file mode 100644 index 00000000..7c44ceee --- /dev/null +++ b/mappers/gpio-atlas200/res/client.crt @@ -0,0 +1,20 @@ +-----BEGIN CERTIFICATE----- +MIIDNjCCAh4CFCArzrOzAh/rekUggX82gk68OY/WMA0GCSqGSIb3DQEBCwUAMFsx +CzAJBgNVBAYTAkNOMQ4wDAYD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res/client.key b/mappers/gpio-atlas200/res/client.key new file mode 100644 index 00000000..e484df85 --- /dev/null +++ b/mappers/gpio-atlas200/res/client.key @@ -0,0 +1,27 @@ +-----BEGIN RSA PRIVATE KEY----- +MIIEowIBAAKCAQEAweqfGDeiyMp80Gqyig6cx0D8l/mjS5/fejG93t5chg02dTK8 +Mhn2SC3QhAfJqafYE0N8zIN9fPrAcO4VX3v4m3ItLVMtEw/iAZYZH8kL6IY0/RMY +S1oRzC/ufWdFKSDqPcVYSsC9SFZTRWWx7swHQZd6+p7N8OlIt4ksm9nnnYLtIFN8 +vMFs0+F3aOgn+8l8obPl/86J4a+GLv/RaY/McfhGpP2r+9rnoUg7gy4SOGlGaD04 +CwH8QBo6L1AUwPatCRtF8DbaFcDw8aoyrU8CdHAFRpZvCfA80abmtV4ExB8jgPz8 +kD5Bidces0xtKMJwXBmYwjAL9O3Bn8aPAdImawIDAQABAoIBAFDEB79ubL50l8e2 +qOYXb/UNfCdQMlMtI0chsJNCygaLOkNV/kxfw9QMQOy80aF35ucfFLuZiIqlZcGj +aAN8/u6/f1GBcySdWOSQP6addfhC7Y76hQPdX8xLqmlQud2HeAiCSWPZIv0d91DQ +KmvrTppjHTWFLwFIKKFI4OuIto9DXxpEXExwYrHFJhbKtLuAKZiG2BJ0P4qP30EE +XHpgOOJisZpISoN6/2PpgoOb96Y1YAtUdLe1isLHuPbvDvePhiYNQN0WkXCfbabS +Jf2AMr9QpnARB6paJPyKgMp0vYjayuk7oDmHw7O+RjsX8pMH+ZIq3OgJ2wajuE8Q +FcXE2AECgYEA4/rj1JsOMLYAapNkQpTqdKb2XgaH+dLfvpvnqB6rZX4pd5kaNyOh +8Bs8x0phj01c6VJb6HlK2nEZCpjp3nnO8lUm/2OAyb2pWAKhT3SfOsVjJIYN13M7 +mICLW+LjVAz3NpEncYjzVlytXJo8W6Sux9v7um2Tz2tKtESwfLnEXGECgYEA2b/2 +zEnMAKxceYO5zyKMc31v8fpcTXFn2NKvcaH1BzDF6vxW9OJf9IhcubndD/Pt/j3n +UA4q9ENG2l3m6C91yAGAqmRGlYdaPVbgjT27CDar4tifeoVIJ9sEKHy+cRz3uK2/ +PuaBRA2h3JIG78zBm6Z9dum0hGk8bARGC3lS1ksCgYBXa/7vqSHQ5gnU1H5O1eHu +J5QzzBdaYlWwNwKnQlOBUNa/6PLXkA9qDlfJKCmvFQB67D0YMWLVzybGHIsZ5+XG +oYaZymM5eUQ13pRS7qqck9KHz+wA4UxKF4jZDHEV6v7latYQQG7ngBRufSqGDemD +9ERcYeabVE5KQEjZGzdEIQKBgQDFOEbyFMz+tx4yuQor/6CyYaRoyFedlN931Ksv +An+JebVo9hBUUEyUkIVbemosrsSaB7tgGNTy05Ry56XiGkpVUncU3SnI+QTUlcFg +a87gy5O3LHiVYe5OmuITQZjDnncH/+Y9tEzUNHyr6F78Bro8nfj5IQds/lvJgb1n +WwWaLQKBgDCgRxPLWUv08gaKHoDR383IbbDW+noFYRJa5y03ZmW4qPicLZ/SNcAT +oOAS0uyWJWBB00ZGIGd6kcOZ6ipvaI5472LbAQL//UATQ7iHoIFc/YD659NOea9o +eolNFDKalPzfmg5xCHxKDtoO79EXlFvovPitePv+7IeVncCX7oHY +-----END RSA PRIVATE KEY----- diff --git a/mappers/gpio-atlas200/res/config.yaml b/mappers/gpio-atlas200/res/config.yaml new file mode 100644 index 00000000..e2145a3f --- /dev/null +++ b/mappers/gpio-atlas200/res/config.yaml @@ -0,0 +1,14 @@ +mqtt: + server: mqtt://127.0.0.1:1884 + servername: 127.0.0.1 + username: "" + password: "" + clientId: "" + certification: "" + privatekey: + caCert: +http: + certification: "" + privatekey: "" + caCert: "" +configmap: /opt/kubeedge/deviceProfile.json diff --git a/mappers/gpio-atlas200/res/server.crt b/mappers/gpio-atlas200/res/server.crt new file mode 100644 index 00000000..c4587c40 --- /dev/null +++ b/mappers/gpio-atlas200/res/server.crt @@ -0,0 +1,20 @@ +-----BEGIN CERTIFICATE----- +MIIDVDCCAjygAwIBAgIUIC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+Nu0ptX4epLFqtLF3tw7Qkb/fSJf +Xsc1kkuaAVUw9N31wsYg+rOwUpRk2hGlkMQ1OCMBHiIHP+U03G9xgA== +-----END CERTIFICATE----- diff --git a/mappers/gpio-atlas200/res/server.key b/mappers/gpio-atlas200/res/server.key new file mode 100644 index 00000000..ff2ed566 --- /dev/null +++ b/mappers/gpio-atlas200/res/server.key @@ -0,0 +1,27 @@ +-----BEGIN RSA PRIVATE KEY----- +MIIEowIBAAKCAQEAuFP9A4QEDFi7Drlst0KcmGAivD8RrlPWmJZe0OKGVMTQtXGe +h5yZVtH11SeADj3VO+F2wpg0A6uH58im9TNIzCgkiV50rMVY1KHU7GfM8Os86Knn +fjt+KANk9FCqWZDPW3ziLIEHZcgcP00uRwZsDSsIBN8Ixa00EMPlkpnglMlXD8lM +aYw+4eOPfNZmZMoLmhq3S/1uYfb+Kd6AABsh+QR8GmidTuBVF0cqrLBpRhN7sBZ4 +l3aOzHfCwHqr7EB0ntLmQni2fuT8JvqLt7+ny808EdzK3rzjN1VLpAqGKvxvLcEL +Ho7/UWpCBuhxrMTa6v23JzsoO13Tuo2fVc1sOQIDAQABAoIBAQCavs/bYrovT1KC +swJk+4QRnCutE9mZG4M+CIdDH9kcUzrQCLnJKZvFunCCaS3lRt277rVP+o04Q4nN ++bLIiSxlUJITzPtwjCDeKZpieWYhH6u7u9+/JtzrZKYdQZcxqBOcv8P1DsGSHiQw +tG/UarzNdUG/LSrlIVpjdMJHh+11mgE3EtqmUkq/3qHg1iyaucB7eLwbt4+ZrHof +kCWW7XrjwWaFH5lLJYwmC99iGcNusF9R3gC3y+iNtdXCo97FFkb821rJFGJGaUK9 +S11GnooN/8dQbAa69bJfqABCxmuXgMHRegRdm7bF37lI0BqOEPaAPHaTbtC/uNBV +Ss0pcBENAoGBANzVZoOMv3TVXl9ZxVC2gx5Nmr9nI0uegHbyDWENwXjIi9pUaR3o +y+i/Figd35RhgbyqOHOAXL7lwuAxqXVoTqgYnc4I8AqVx8I6sTC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