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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- ]/ x' d- c* ]0 b' j- V/ u
  1. [code]EDMA sample test application0 M) b9 t) K( \  e3 E4 A
  2. /*
    % Y( U" ?$ `) ]8 Z
  3. * edma_test.c( t) l, Z8 s! r# A' D: j3 M
  4. *
    2 Y" P9 Z, j' P6 G) A/ _4 p
  5. * brief  EDMA3 Test Application5 F6 Y9 t+ M5 \/ q, _4 `
  6. *( u6 F9 Q  a3 @9 t8 s# X% R3 w
  7. *   This file contains EDMA3 Test code./ T) F) h# r/ `+ f4 `5 c# H- q+ y/ s
  8. *
    9 N) o9 \. ^/ F
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 W& @4 f. A# N( B4 B: c9 l
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    3 Q. T7 {: x) B; p0 f6 r8 F
  11. *         TO CHANGE., x9 ~1 n7 P1 T, M7 f- _
  12. *5 V2 i* {0 c. t! L7 o  W& E$ O$ q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    1 {; J9 N8 l; H* n' r
  14. *
    ) \: T/ x" l4 n+ V8 E1 G! ^  p* D; n
  15. * This program is free software; you can redistribute it and/or7 K5 U! [! W  |0 E4 S: Q
  16. * modify it under the terms of the GNU General Public License as
    7 S6 Q3 z- W3 f
  17. * published by the Free Software Foundation version 2.* Z" ~- n- }0 X6 f; w
  18. ** g% K2 Q) i3 P8 B
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    1 F$ w- R4 O3 i5 q3 j2 c
  20. * kind, whether express or implied; without even the implied warranty
      }9 H# L" o) M% \/ Y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    & G$ q: T' j. Q2 \& ?+ P
  22. * GNU General Public License for more details.
    7 b' {! s, X" {
  23. */
    7 h, W7 y, x/ n0 c. t5 q5 U
  24. ! [3 U0 ~  X) @3 ]& B" w
  25. #include <linux/module.h>5 R0 Y/ v2 @6 ^9 `' d+ u
  26. #include <linux/init.h>
    , M+ o. e* i' o  l/ s* C! h
  27. #include <linux/errno.h>7 n. Q/ j1 @5 p. q) J6 e8 a7 z
  28. #include <linux/types.h>, ]: k3 B4 Q2 y- x7 K! l9 S$ W* n' ?
  29. #include <linux/interrupt.h>2 M1 ^, x7 j5 N  H/ c7 C2 V
  30. #include <asm/io.h>
    + q6 j/ X, y& q  d  @# ~5 O
  31. #include <linux/moduleparam.h>
    / l0 U" f1 h* w% w; q% X$ O! f
  32. #include <linux/sysctl.h>6 A) M7 ^% h7 l- o* p: Q4 S& i
  33. #include <linux/mm.h>& l  I2 p& i* a( |
  34. #include <linux/dma-mapping.h>
    0 J" ]2 Y/ t7 K9 n8 H" I, B8 x7 C/ o

  35. ( B7 R0 F. C; q/ @
  36. #include <mach/memory.h>3 Y+ Z! S  z+ m
  37. #include <mach/hardware.h>
    8 @- t& o$ W% r: T4 B* J8 X3 c. ?
  38. #include <mach/irqs.h>3 G  S* z; s3 B1 v
  39. #include <asm/hardware/edma.h>
    ( l6 l7 J  M8 H7 }  \; b+ V" D8 U4 S
  40. ' K. {3 @9 c7 k' ~
  41. #undef EDMA3_DEBUG
    # w, w' U% M7 V( g5 U$ M
  42. /*#define EDMA3_DEBUG*/8 G7 C. \: ^0 @3 C

  43. ( T# |- D6 r1 |" a
  44. #ifdef EDMA3_DEBUG* Q8 V9 C1 n# ]! M8 Q% O0 h
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). n) R" l, m9 H/ m- D" @
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    4 T* R% A6 V" N6 e
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    $ i4 {* H) p0 w
  48. #else. ^/ S; z5 m7 u* }" V" |
  49. #define DMA_PRINTK( x... )8 I2 ^% E% {  n7 C
  50. #define DMA_FN_IN1 O; ~5 m+ T' S0 o
  51. #define DMA_FN_OUT, N. D9 z5 E  s
  52. #endif
    - K) n0 A" E; R8 r+ D

  53. $ m; R+ U0 v3 Q5 v+ N! Y4 T8 s
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)1 u4 ~3 k/ L- J5 \
  55. #define STATIC_SHIFT                3- U' A7 Q: R5 \0 s( b
  56. #define TCINTEN_SHIFT               20, w, i0 ~7 F' a8 ~7 B1 {. u
  57. #define ITCINTEN_SHIFT              21) V) B, k+ r; n( C6 `2 _
  58. #define TCCHEN_SHIFT                22/ A& j( |* d1 |7 D8 A
  59. #define ITCCHEN_SHIFT               23
    ' f1 v4 B' L, K& X
  60. ( m6 i! i+ Q0 F' I) _4 E
  61. static volatile int irqraised1 = 0;
    * A; e2 i' G' P& ^- v# g
  62. static volatile int irqraised2 = 0;
    - C' i+ J- H2 H/ }

  63. 2 p  ~( P$ V& m
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 O) T6 e0 \& ^. r
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / D  j9 R. M4 ?4 F, ]1 e# H5 g
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % o" c) U. a2 S2 e

  67. 3 z! _1 Z3 d9 n- q1 K+ {7 \  u
  68. dma_addr_t dmaphyssrc1 = 0;
    2 d) W8 ^* k1 t( G4 k7 M
  69. dma_addr_t dmaphyssrc2 = 0;+ s( u+ D- _. T8 A( I1 N
  70. dma_addr_t dmaphysdest1 = 0;
      p' @0 |0 Q/ N2 Q  U/ T+ k9 {
  71. dma_addr_t dmaphysdest2 = 0;/ D% l2 d8 [: Y: \9 ]- h* n

  72. 5 |3 q! w3 f+ R
  73. char *dmabufsrc1 = NULL;9 Q0 `& K" ~# k4 ~3 Z
  74. char *dmabufsrc2 = NULL;& L" R' z! I, m3 m: i
  75. char *dmabufdest1 = NULL;, |9 \: Q# a9 K4 S$ ^" c
  76. char *dmabufdest2 = NULL;
    + Z+ G% h+ Q+ d/ ?
  77. + d- z3 O* I4 @) u2 ^& G/ I7 L$ m
  78. static int acnt = 512;
    ' [0 r. }4 M# d3 x7 |' W
  79. static int bcnt = 8;1 l( [& f) b. z3 t' y; J
  80. static int ccnt = 8;4 u1 i3 r0 `4 Z) J0 J7 t0 I

  81. 7 c; l0 R* W8 B
  82. module_param(acnt, int, S_IRUGO);
    0 O: G3 `4 z: c: K
  83. module_param(bcnt, int, S_IRUGO);& X* k4 W( P3 `8 L9 F7 [
  84. module_param(ccnt, int, S_IRUGO);
复制代码
0 z$ o$ u% H! ?0 v; c
  n8 \+ p$ R; o# }+ e9 f4 H6 m
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, @( }+ T! J$ k3 N  |' R! t% V
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。3 J: w. Y- U* V/ f7 d4 @
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 A2 x% m5 h  y2 A9 Y' O

( p7 @, ?: s) P* g" M
7 h6 E# N" ^8 T
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-4 19:11 , Processed in 0.040507 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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