OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站
点击跳转“创龙科技服务通”

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 10671|回复: 0
打印 上一主题 下一主题

[未解决] OMAPL138如何在Linux下使用EDMA3驱动

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , ~7 q" M" L! }& K, E% p$ ~1 ]
  1. [code]EDMA sample test application' A6 z. F) B5 f* Z5 c" K8 D( U* A
  2. /*
    ! ^7 G, e; q, Q/ E
  3. * edma_test.c
    + I# f: |5 [  H- s- C
  4. *
    9 r9 r' y. A5 }8 l$ c6 L5 f
  5. * brief  EDMA3 Test Application/ W7 y  ]. H' X) f, C
  6. *
    $ g( k; Q( _2 Z8 ^
  7. *   This file contains EDMA3 Test code.
    , L, d1 ^  Q/ m* {
  8. *
    , f% T# M" ~9 K8 L4 L0 T$ _& d
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    / ]: H+ S, y2 I, b3 c
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ) h5 v9 s; m  w$ U' ]4 `( N  ]
  11. *         TO CHANGE.
    * Z* P6 y* c. [$ z. b# ~/ w
  12. *' K6 a3 ]4 Z/ s
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    1 q( |/ C$ D! s' b/ t4 k. d
  14. *
    + m# B5 M% h. G: m( c1 e
  15. * This program is free software; you can redistribute it and/or
    * V0 E  W. f5 N4 I6 }
  16. * modify it under the terms of the GNU General Public License as4 x' Z4 G, d3 D6 V  _! [
  17. * published by the Free Software Foundation version 2.0 J# U& @: J1 ^& u
  18. *; s& {3 P; c7 T" {5 J# s9 a; d
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any2 R' S" K& q0 m
  20. * kind, whether express or implied; without even the implied warranty
    # Y0 Z" I8 V0 v
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the$ X; U. @$ l+ Y2 B6 d
  22. * GNU General Public License for more details.# a1 \( T) D2 o8 |
  23. */3 V/ x4 t* m; x1 ~& H2 Z* x

  24. % _0 T! O3 z2 w. j
  25. #include <linux/module.h>
    : C0 ]; @/ T" ^, q
  26. #include <linux/init.h>
    0 a6 a6 q0 `/ E9 V. ?: ?# ^
  27. #include <linux/errno.h>. F5 Q  ^9 O5 s0 e6 r  B
  28. #include <linux/types.h>2 o2 ^* Z! I, c- V
  29. #include <linux/interrupt.h>
    . B! u; [( v5 n
  30. #include <asm/io.h>
    " Q2 R1 q& x6 I
  31. #include <linux/moduleparam.h>
    ( X9 S' U% n# C5 c1 v+ d
  32. #include <linux/sysctl.h>
    ; v9 {, w/ u" U# x" P
  33. #include <linux/mm.h>4 l4 R$ j/ |* e! ^
  34. #include <linux/dma-mapping.h>! K  z/ }9 x% |5 p

  35. " y4 B" b+ I' e3 V
  36. #include <mach/memory.h>3 ?3 p% [! D- L1 C8 N, ^( H# L
  37. #include <mach/hardware.h>
    * z9 D. J+ F/ n- T# n+ s" m9 L
  38. #include <mach/irqs.h>: U4 a9 b* T5 p$ m8 f! @; n& i
  39. #include <asm/hardware/edma.h>/ B* f% G4 w5 C
  40. 4 S% L0 [/ E+ E- V6 |( X3 N! q# T
  41. #undef EDMA3_DEBUG! s, g+ ]8 k3 b# ^1 B; b
  42. /*#define EDMA3_DEBUG*/7 p, A6 j- ^$ z$ E; S

  43. % N! d# `4 w( d2 d, j
  44. #ifdef EDMA3_DEBUG
    " Z5 l) q. @3 O9 ^) Y& k. H
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); ?* j4 \, ?/ ]' o) n
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ [6 X7 j/ P! H& y' e! x1 V
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ( J$ o% `3 }/ }- c
  48. #else
    + Y5 n/ s' \5 q7 P$ A- `) p
  49. #define DMA_PRINTK( x... )
    % Y$ f) q- [. {' W- G
  50. #define DMA_FN_IN( X) i# _2 M5 M
  51. #define DMA_FN_OUT
    $ r3 l5 {: j' {/ l
  52. #endif
    $ Q3 h! @5 m9 }+ ~

  53. ( S  F6 z" H$ x7 F
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    - k2 t/ B& F9 D
  55. #define STATIC_SHIFT                3
    ! w! w! v- m* k
  56. #define TCINTEN_SHIFT               206 H! I7 \! k: c
  57. #define ITCINTEN_SHIFT              21, i, o6 _0 D  N
  58. #define TCCHEN_SHIFT                22
    , X4 p- i& O& l; M# X2 R
  59. #define ITCCHEN_SHIFT               23; \; V- |& ]9 r& [/ c0 ~9 m) l' ]
  60. / {3 G% N2 U( ]) l3 B
  61. static volatile int irqraised1 = 0;
    ' c) R, H) g& w  f
  62. static volatile int irqraised2 = 0;
    ( J6 [( m* ~) q8 x

  63. : K. O/ }& I- W0 d( @/ @% q3 f! Q
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " @2 H+ J! X4 I4 J0 E/ a8 [% M
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 d0 Z$ t! Y/ t& f# g
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 M4 x9 j" S# s0 M5 F9 t
  67. 5 q+ m0 A- e9 ~4 C* m! F
  68. dma_addr_t dmaphyssrc1 = 0;: {, h' Q  }8 M! x
  69. dma_addr_t dmaphyssrc2 = 0;* i* D/ y$ \8 j5 l5 [
  70. dma_addr_t dmaphysdest1 = 0;! g9 m0 `6 A7 ], M. T
  71. dma_addr_t dmaphysdest2 = 0;. A4 V/ A( S7 ^1 }! g: g) W6 _

  72. 1 C# i1 J9 x( ]& L, H0 [/ \; X" q
  73. char *dmabufsrc1 = NULL;" N, {# z! i5 q6 _* x
  74. char *dmabufsrc2 = NULL;
    , A7 ~: T( q5 r
  75. char *dmabufdest1 = NULL;
    5 q0 P9 l- J! n: B
  76. char *dmabufdest2 = NULL;: b& n& y' i. }5 `; f' n

  77. : J- }' Z+ o$ G* h$ v
  78. static int acnt = 512;
    2 A8 ?" \1 p# g4 T0 O
  79. static int bcnt = 8;
      x; d0 n4 q+ r/ \
  80. static int ccnt = 8;2 S, W% K; h  P" i+ m  a# s

  81. 2 T+ t1 o/ e  @% N+ D, _/ [% H
  82. module_param(acnt, int, S_IRUGO);
    ( \  }7 F5 S+ c- _# p' m' P- e; I) r
  83. module_param(bcnt, int, S_IRUGO);4 m5 z5 Z: a" H: \  ]3 G
  84. module_param(ccnt, int, S_IRUGO);
复制代码
- T. Z+ ?& f) v

6 [, t; W8 [5 ~, @( h/ z      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- z9 m6 ^) N- B( l% `+ L9 U) w
arm-none-linux-gnueabi-gcc  -I /home/tl/omapl138/linux-3.3/arch/arm/include -I /home/tl/omapl138/linux-3.3/include  EDMA3test.cpp -o EDMA3这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
: z3 S- e1 g5 z, Y8 t" |) X, D4 D     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 ~& o0 x# M' Y) Y1 t. L. r; e+ m4 F
$ e- M, g6 g! L5 I: Q& D7 @% G
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

点击跳转“创龙科技服务通”

QQ|手机版|小黑屋|嵌入式开发者社区 ( 粤ICP备15055271号

GMT+8, 2026-1-29 06:11 , Processed in 0.038868 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

快速回复 返回顶部 返回列表