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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # V% M; V! m' X. V
  1. [code]EDMA sample test application  V: u' q* U. X1 J. W5 l2 R
  2. /*
    ( ~7 R# o, E" s2 h% B( n
  3. * edma_test.c- B1 a( L1 t# s2 L& k; t
  4. *% _( u# f3 J, c, G% X9 m8 o5 @1 ?) H
  5. * brief  EDMA3 Test Application  c% a7 `, D; m7 W
  6. *
    7 A1 s" Q9 _+ f5 S' v
  7. *   This file contains EDMA3 Test code.
    0 ]( a8 ^: m( T) g" P: z, |" C6 N
  8. *( u! b/ Z" A& ~) e9 a+ S' p, |
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ; O* p, b. ?6 O# L$ Y7 ?
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    / p8 X; g9 f7 I2 f. U$ l' h
  11. *         TO CHANGE.
    ; h7 l& R7 z) E* x4 v' l
  12. *
    / I3 Z1 E* }1 f+ x8 u( C
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    , ]& ~2 r! B2 S$ r
  14. *
    + [6 ]/ t& a- N: q
  15. * This program is free software; you can redistribute it and/or# L8 {0 H- _, C: r+ h1 r  N4 G
  16. * modify it under the terms of the GNU General Public License as  F1 u6 ^0 Y$ S( ?3 w
  17. * published by the Free Software Foundation version 2.% t% h7 x% F9 X; f' W
  18. *; m, a4 E0 x6 P4 f+ l" N3 U9 J4 w6 e
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    7 Q8 j" `  H& q, ^7 s
  20. * kind, whether express or implied; without even the implied warranty
    + n8 D, Q0 j( N) x$ q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the& [9 k6 `+ m2 G! \% D7 |. j2 ]% z
  22. * GNU General Public License for more details.; w2 R- H# Q+ o
  23. */
    ) R0 U) ^" `% F" Q* R4 L

  24. - q0 c6 L+ Y1 m1 \1 b5 y2 i: b
  25. #include <linux/module.h>9 H/ D7 P0 n9 W5 o
  26. #include <linux/init.h>5 f* S- d* `+ ^+ U* |
  27. #include <linux/errno.h>
    0 Z$ r' h1 R' ^9 P1 z2 f
  28. #include <linux/types.h>7 `- ^1 B0 H' c  X( p
  29. #include <linux/interrupt.h>
    ( O/ W2 C0 q% i7 A6 t9 [
  30. #include <asm/io.h>: |5 g% O+ h" c* |2 N
  31. #include <linux/moduleparam.h>
    7 }. b0 P+ V% g' W3 t/ |# v! m2 F, s) E
  32. #include <linux/sysctl.h>
    2 c: t7 D# ^0 }
  33. #include <linux/mm.h>
    % R7 |3 C) u2 f7 }6 Q7 r
  34. #include <linux/dma-mapping.h>
    # n: L" Z, V0 k

  35. 7 t8 K& o/ t3 g) F7 d8 X
  36. #include <mach/memory.h>) U) `7 A; B, C  b; a. G# N5 r
  37. #include <mach/hardware.h>
    4 t- E4 b9 @$ t( `
  38. #include <mach/irqs.h>6 |- |3 I/ C8 d; S
  39. #include <asm/hardware/edma.h>; u  o; ]9 S. f) t6 y% E* R  U
  40. 7 k6 A  {# w- K: e2 X
  41. #undef EDMA3_DEBUG8 ~7 C& N+ q0 n5 k5 U9 u; j& N
  42. /*#define EDMA3_DEBUG*/
      [+ @- \. W# g% O
  43. 5 D0 T$ j1 J1 n
  44. #ifdef EDMA3_DEBUG
    3 @9 ?$ {3 t- m- U
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), W0 K7 p$ D# w) d! a6 W( B
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    3 Q" K0 X( [. ~4 _. h" X% S$ B4 K
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ {. F2 R/ s+ n- U9 ]- l5 P
  48. #else# F/ I  Q  _/ k9 P- l
  49. #define DMA_PRINTK( x... )0 C% e- c+ N" i$ }( {% ^6 C3 w
  50. #define DMA_FN_IN5 h& g2 O4 M! y# H) t9 T$ c+ A' F; a
  51. #define DMA_FN_OUT
    2 t4 u# D; ?" o* G6 [
  52. #endif
    $ F" n7 W# G& t
  53. " T: E) ?& F! z! H
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    5 k7 B2 z  X) V- d
  55. #define STATIC_SHIFT                3
    % N4 x6 O- z3 K6 h
  56. #define TCINTEN_SHIFT               20" B- V! U+ e0 D% E
  57. #define ITCINTEN_SHIFT              21
    5 U$ u" v; n+ \! ^- Y9 J3 V
  58. #define TCCHEN_SHIFT                22
    ) C; ]" |) F4 R% Y, P7 f7 D
  59. #define ITCCHEN_SHIFT               238 |2 n! h6 Y$ l% s9 i

  60. 7 d: J1 m7 J- ^$ n
  61. static volatile int irqraised1 = 0;
    ' x$ U5 K# \& K* |# n
  62. static volatile int irqraised2 = 0;7 t* U. u) v' ?' p- Z
  63. 8 n* Q2 p6 g  ~) E, c. V% r
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ N: B3 D) |! j) f5 g$ \$ l
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 J8 O, _& v7 D' U) V2 g
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) t, s6 {8 E- ?! x/ h7 G: \: A; Y
  67. 4 Z! Y" }2 c% }6 W, j2 L1 {8 H) X3 ]
  68. dma_addr_t dmaphyssrc1 = 0;4 V9 \9 x% p8 Z) V( O& @7 \
  69. dma_addr_t dmaphyssrc2 = 0;* ^- b/ g% q2 y6 F& e- f3 h& k
  70. dma_addr_t dmaphysdest1 = 0;) u0 `+ c, R2 P8 W2 ^) w0 B+ J
  71. dma_addr_t dmaphysdest2 = 0;
    - @1 ?/ |' a# }8 a4 y9 w4 I# p
  72. * q# V  {* P% B
  73. char *dmabufsrc1 = NULL;
    0 e$ A8 j& t3 F0 g# }
  74. char *dmabufsrc2 = NULL;
    5 o- O3 {0 g2 c- ]1 i9 c
  75. char *dmabufdest1 = NULL;% {/ ?0 |) v( G/ E# k, R
  76. char *dmabufdest2 = NULL;, Y4 w' k' b$ n  @
  77. 5 t/ g1 U( }. H" w- ]3 @( r
  78. static int acnt = 512;0 ^/ D) N8 ~/ k2 i
  79. static int bcnt = 8;, z4 x5 {2 V2 X, K, K( h! Z7 F
  80. static int ccnt = 8;
    " T/ {/ W- C% z: O

  81. + h$ R, y# W3 y' u/ M
  82. module_param(acnt, int, S_IRUGO);
    1 U6 ~& l* }2 e8 c, e% q; y" U
  83. module_param(bcnt, int, S_IRUGO);/ m; n, l  b9 u
  84. module_param(ccnt, int, S_IRUGO);
复制代码

! a9 Y( u! D2 @  T/ g6 }6 {- O7 H8 u
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ l2 u: m# {3 v) T: w: j( w9 Jarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 K# N4 G% y  B4 _' Q5 ?! P& x
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% X  v$ c- J+ `! t- B7 J' F
+ ?4 I! \6 r5 j7 v; S: {; l/ e8 a1 D; d/ B
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-2 03:31 , Processed in 0.041222 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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