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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 z1 K) Y# E- b* }3 I
  1. [code]EDMA sample test application) b, N+ L& t- ^
  2. /*
    5 l; y2 `- U( K
  3. * edma_test.c
    2 Y5 m7 H, {$ l; i
  4. *0 G6 y6 J' m5 Q
  5. * brief  EDMA3 Test Application- t4 _+ t6 C' M% E9 a2 t& y
  6. */ O2 n' j8 Y) ]* v: y
  7. *   This file contains EDMA3 Test code.
    9 p* ]+ N7 ~; }2 O+ {$ q, a; n
  8. *: {* c( f% L$ k2 w0 H8 H9 H
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    " e( f* R: b. N9 Q8 o, Q5 n
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 x) u* y6 Z. I7 m' H; t& g
  11. *         TO CHANGE.
    5 e" G, B" f- c- L: X
  12. *+ o5 }( I( o$ P+ F- ]) _  v
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    2 ?$ U7 o" E1 ], J% B
  14. *
      ~7 L4 p( q% @7 X% O; K! Q
  15. * This program is free software; you can redistribute it and/or
    ) w! g, d; n/ `6 R$ g
  16. * modify it under the terms of the GNU General Public License as
    7 L1 B! p+ U! O0 f& v$ S
  17. * published by the Free Software Foundation version 2.! ]+ {1 d+ N& n$ o
  18. *
    $ C* x1 |9 u. }0 E+ g8 m* R0 H. B
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any0 i, S+ v# r# L% x+ J8 Q9 V1 o
  20. * kind, whether express or implied; without even the implied warranty( M& _+ H+ A+ T
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the: u/ `: Z& G; @( h6 B
  22. * GNU General Public License for more details.% e3 V( ~- G- b' ^" u' q) p3 \5 ?
  23. */2 o# c8 n! y6 _: X0 i) K3 c8 ?
  24. 3 @' e2 M' }, K2 L6 {- C. |* }# N5 H
  25. #include <linux/module.h>/ H% R6 J' B: |2 p/ [
  26. #include <linux/init.h>
    2 S$ U. X6 H( ]  }
  27. #include <linux/errno.h>4 F0 W3 `3 e- ?  D
  28. #include <linux/types.h>
    2 i, q& y9 P! V, {* Q' ^
  29. #include <linux/interrupt.h>
    ) K7 M! K  K' f6 I
  30. #include <asm/io.h>
    + A3 D, y' ^! I% G7 I) \) n4 y
  31. #include <linux/moduleparam.h>! L7 L& l! ]5 n; M" M
  32. #include <linux/sysctl.h>. U9 `$ ?; y1 Y& x# s
  33. #include <linux/mm.h>8 p' Y8 x) {5 l: p/ n
  34. #include <linux/dma-mapping.h>
    4 \$ N. @. w* {, w

  35. / T6 P8 t; {* S
  36. #include <mach/memory.h>: \# Z, f* O  a( m* y& H
  37. #include <mach/hardware.h>8 }' \0 u$ F3 B5 b% B
  38. #include <mach/irqs.h>
    # `9 _& q$ u( j0 w( N" Z
  39. #include <asm/hardware/edma.h>
    ( _9 [% R- E: {" [. |4 J9 I- e) ^6 \

  40. : j/ ]! V2 [; w1 B; d: g' A
  41. #undef EDMA3_DEBUG
    - Q0 S1 q: \9 T" U0 o
  42. /*#define EDMA3_DEBUG*/
    # M% Y  U4 c0 d$ _+ y  U- }
  43. ! o$ v/ C) P- S
  44. #ifdef EDMA3_DEBUG  I$ o) R& k. s0 W
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    $ K3 p) Y5 P( g1 s, W/ I9 c$ i% Q
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
      ^2 K# q/ E. |7 b) }
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 E! q# W9 `% H3 m
  48. #else
    % o6 a; Z, d1 b( m5 r' |& D6 h
  49. #define DMA_PRINTK( x... )
    2 {0 j: u6 x% e- a8 d+ O" V/ O
  50. #define DMA_FN_IN; s# b! N" ^8 e: @' L7 f& t
  51. #define DMA_FN_OUT% @' z* u! ]4 {7 r3 e4 j
  52. #endif( J7 P+ j" |* a1 v
  53.   R" m$ ^+ `* g3 F) j! g( e( A
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)4 g5 x" A: k, d1 R" A3 J
  55. #define STATIC_SHIFT                38 O! o3 c& k6 p8 F- f( j4 k1 R
  56. #define TCINTEN_SHIFT               20
    6 W7 c( y% |# E! n& K
  57. #define ITCINTEN_SHIFT              21" A# C5 S* E! i0 m1 K2 \3 o8 e9 Y
  58. #define TCCHEN_SHIFT                22' H6 m0 ^7 w# @4 o
  59. #define ITCCHEN_SHIFT               23, X" l3 e; Q6 H+ X( Q8 h& i, H
  60. ; n1 e) F1 _! f( q' M4 r
  61. static volatile int irqraised1 = 0;5 k! J* L  V+ V2 P0 W$ M; V
  62. static volatile int irqraised2 = 0;5 z2 Y6 X) D1 l, }" o) u  N0 T* u1 C

  63. * O2 A( D& {$ ?& U2 p' m, ~+ p. C
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- @8 |! s$ W5 A0 [  I
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      m; t% o, ]5 _: e
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " ?& }. s* f3 L

  67. & T, [0 \" S0 }, J8 g0 d
  68. dma_addr_t dmaphyssrc1 = 0;
    ( [2 j' o# U5 }( E7 Q2 |/ b
  69. dma_addr_t dmaphyssrc2 = 0;' R2 L7 O' b  X  P
  70. dma_addr_t dmaphysdest1 = 0;
      |2 K( Q% m/ |6 ~
  71. dma_addr_t dmaphysdest2 = 0;
    7 I( j' G. F" K* p1 I* w! @$ P

  72. 2 S4 b6 Y* W# A. r
  73. char *dmabufsrc1 = NULL;
    2 D! i0 Y' w2 z; V
  74. char *dmabufsrc2 = NULL;
    ; A! Y& c+ f2 X* @
  75. char *dmabufdest1 = NULL;
    ; _) o5 D7 T: I. y9 n/ y, M
  76. char *dmabufdest2 = NULL;+ n" X0 M( @! H! T, a4 e
  77. 1 I' [, \- y7 y3 Z
  78. static int acnt = 512;
    ; {. n+ e$ f2 d8 p6 |' \4 k4 E, T$ i
  79. static int bcnt = 8;: ~; \/ H) b* P% N" T5 T
  80. static int ccnt = 8;
      ]0 p9 X) |  d

  81. , d4 F% L8 T7 A" x% U* a& K9 ^4 r
  82. module_param(acnt, int, S_IRUGO);
    ; S) N: C2 E3 R* c0 a
  83. module_param(bcnt, int, S_IRUGO);% T4 y, X- D. ]6 l1 E; T
  84. module_param(ccnt, int, S_IRUGO);
复制代码

) @. ?3 V3 q, ^- W: I/ B( n2 W" G
5 Y; I" {$ ]4 O8 Q1 P& N      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) y; Q5 Y! F8 E% S' L' l2 Y1 L& o7 {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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' w' L7 l- `+ D" v! U; t8 r2 C* F
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 L, Q. s4 h) i- A: A  W5 b, }/ Z0 f( M1 o# X3 z
6 f7 K+ D% f* `* N9 p3 g
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-9 19:52 , Processed in 0.041823 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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