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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & ^0 V% O6 L! [4 n/ E$ m3 y  n: {& u
  1. [code]EDMA sample test application
    , q4 B6 M8 g9 I6 Z$ I1 b2 w
  2. /*
    6 `2 R4 c9 Y1 c3 o; u1 p. N' ]& y, M
  3. * edma_test.c5 j8 f- Y9 `2 j2 n# O' A
  4. *0 f: |; P8 l) n  T; B2 X. [
  5. * brief  EDMA3 Test Application/ |3 H' r% l$ e) N; Y
  6. *
    & [5 c. X  l1 m3 Y0 l- O2 A0 L& Z% `
  7. *   This file contains EDMA3 Test code.
    / q+ q7 j# ?9 t: o" c7 f: @
  8. *& A8 J4 a1 A4 {9 g5 ]
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 l* n2 u% ]- d- `
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    , y0 b) p/ }+ `+ J* E( v
  11. *         TO CHANGE.1 i) ~3 M) d" N1 s7 ^* y
  12. *
    , w3 e' i1 E5 z: d7 m9 G
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    $ I+ D# j' J- A3 J+ }
  14. *
    2 ~' J$ c9 J# L) U4 @
  15. * This program is free software; you can redistribute it and/or( _  @8 h. n  Q- Y
  16. * modify it under the terms of the GNU General Public License as
    + l: `# y5 ]  X
  17. * published by the Free Software Foundation version 2.
    0 r+ [: z/ p$ Y' Z
  18. *
    ! z9 C/ K3 o, d8 s
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 N/ e; _! E: f: ?2 Z+ F
  20. * kind, whether express or implied; without even the implied warranty+ e- b, Y6 P# k+ N" C) [
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the% b! a: R; F. k; c
  22. * GNU General Public License for more details.2 i9 o' ~0 D- N# y/ _
  23. */1 B+ W+ {3 ^0 E0 n  v  k, V$ A
  24. + @1 x+ I3 i( L$ D( ]# p* k& [
  25. #include <linux/module.h>
      ]$ w( B& Y, T7 I' w( r
  26. #include <linux/init.h>0 A4 E' f( g5 a  J: d
  27. #include <linux/errno.h>3 ~7 T, I8 }. U3 W
  28. #include <linux/types.h>' J; ], }; Y- N) |( @
  29. #include <linux/interrupt.h>! w/ U9 F) ?" Q
  30. #include <asm/io.h>
    2 q% M1 e$ s1 J: ?/ w# ~6 a' E+ |
  31. #include <linux/moduleparam.h>
    . M/ q' X" }) r+ G# g' ]
  32. #include <linux/sysctl.h>5 u% S. J! m) R  P4 s, z7 t( B8 ?
  33. #include <linux/mm.h>
    ( X+ I1 D( ^3 `7 @
  34. #include <linux/dma-mapping.h>
    , q* `/ n& Z- N8 n* |- r
  35. 8 Q2 X/ l' A* l
  36. #include <mach/memory.h>4 S2 E1 \2 h9 w+ |: R9 l
  37. #include <mach/hardware.h>
    6 ]/ P! R4 x8 X2 h& q6 z$ C
  38. #include <mach/irqs.h>0 T% e2 k/ Q5 Q& c. K. o% E5 Q
  39. #include <asm/hardware/edma.h>1 b! i! P* t$ V) R0 [
  40. ( J- k( b( u# B7 z: ?
  41. #undef EDMA3_DEBUG
      w# Y2 x% k" g0 _3 P
  42. /*#define EDMA3_DEBUG*/
    7 [  g/ u) X: b8 d# }) B

  43. , J: ?* Q6 S2 n" S* p: ^) O' h
  44. #ifdef EDMA3_DEBUG
    % L9 v3 f  T4 Q0 m- `
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ) {, i2 L( I- V1 M( L. e
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( p" h: ~1 V7 `: g6 l
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ r7 `- ~3 i% H. F4 p0 b# s9 W
  48. #else
    $ M# K: [6 \! A) I
  49. #define DMA_PRINTK( x... )) o5 v: ]. k$ I$ b
  50. #define DMA_FN_IN
    ; l5 R) J; a  a( \( C: U; ^2 ~
  51. #define DMA_FN_OUT) s0 }2 R, w/ t1 D) O# y
  52. #endif
    6 {- S' r$ U! s  {1 L$ j; h: ]
  53. 0 a9 e7 L( o, Q
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    & s# F8 c" r6 f1 {$ D8 g
  55. #define STATIC_SHIFT                3) |+ _, w) |4 S7 s/ r5 f
  56. #define TCINTEN_SHIFT               20
    : L$ g3 Y" V# r" {6 d
  57. #define ITCINTEN_SHIFT              21! v- v. |5 k) }
  58. #define TCCHEN_SHIFT                22
    4 t! C) V" g2 C7 X; y% H
  59. #define ITCCHEN_SHIFT               23
    * ^' s1 V& N, g- h0 |
  60. 3 L. h+ z' R9 M% c* y
  61. static volatile int irqraised1 = 0;) h# ?' ~% `# o' c: }
  62. static volatile int irqraised2 = 0;/ l- E! N1 r: @6 j, C8 Q: e0 V

  63. . a) ~$ j: k' ?# B
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% t9 u. L8 Q) M, e
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 U8 ~; T8 r2 s5 I' ?7 N
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! ^0 H4 G, U, t

  67. % h5 `9 Q2 D8 h9 p
  68. dma_addr_t dmaphyssrc1 = 0;" e9 y. s) e- j/ ^
  69. dma_addr_t dmaphyssrc2 = 0;
    ! L+ [' P; a* r  A
  70. dma_addr_t dmaphysdest1 = 0;; \: m; Y- d( b4 w* j1 N  _
  71. dma_addr_t dmaphysdest2 = 0;" x# f9 I9 y8 \2 y* a8 a
  72. ) F5 G) m) a( _. t0 y
  73. char *dmabufsrc1 = NULL;
    " n  o. X6 i: I; H
  74. char *dmabufsrc2 = NULL;% w( g' H" {& i- t( V1 p+ X
  75. char *dmabufdest1 = NULL;
    . l9 C  {& M! ]9 [
  76. char *dmabufdest2 = NULL;
    # F1 ^3 @: Y) P  _9 y' ^: C) J( K: [
  77. ( m% Y8 F( k# B( A
  78. static int acnt = 512;
    - W, h4 o7 i3 l0 G" l. J& Y/ z
  79. static int bcnt = 8;! P5 X6 H9 q! f& M: S
  80. static int ccnt = 8;( S7 q, g5 T# W- A: b* O
  81. + p5 `: j, B) w4 n
  82. module_param(acnt, int, S_IRUGO);& d- a0 j' [( u. j( ]% z) H
  83. module_param(bcnt, int, S_IRUGO);6 K  z; h& T1 W+ q
  84. module_param(ccnt, int, S_IRUGO);
复制代码
2 E& p" U- U- y* ~8 d3 {. Z
) z8 o8 I7 |. ?2 k! n* J/ {
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 l1 S1 S; S, D  a& {! Q9 X
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。# s$ n7 T% j5 @: r" G- v1 `0 O
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% Q# s$ S+ r# O- S, e! K
6 r" K" a4 ~# w, I3 F! Y# q$ V- L8 r. a* b4 D) L6 Z7 X
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-17 16:16 , Processed in 0.039783 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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