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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ |1 G$ H7 y0 O' y
  1. [code]EDMA sample test application0 u+ U) b7 v( `& W$ K5 l! O* |
  2. /*
    7 \/ w7 E5 u- G# W
  3. * edma_test.c) |8 \6 ~5 p* U0 ?
  4. *, C$ Q2 ^, L: A" l  x+ D
  5. * brief  EDMA3 Test Application
    ( }5 t$ z; s4 R+ p; h" ^- b
  6. *
    5 `0 z! [8 _/ E$ ~9 w" R
  7. *   This file contains EDMA3 Test code.
      i* ]" R4 s. p1 u0 J' j
  8. *# [- I9 n. p5 K# h  M
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& L# ]/ \; f8 [' s# \
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& `7 N; I0 k( P. @
  11. *         TO CHANGE.
    3 g% f: N2 |  H% U" r
  12. *
    7 Q0 ~, K" `& j* ?, D3 {0 p! j
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& _; q1 x6 @  ~1 d5 w% E$ p
  14. *
    2 j* {- |+ R1 C9 e8 J
  15. * This program is free software; you can redistribute it and/or; ]  S$ m: i! g
  16. * modify it under the terms of the GNU General Public License as* c3 c: e) @9 k' {' G7 X; G
  17. * published by the Free Software Foundation version 2.
    - g- K3 M' _. w5 K- m3 M5 H% K% F" z
  18. *7 C+ a# e9 F( m! X: y
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    % O3 X5 D$ B0 o; d1 q
  20. * kind, whether express or implied; without even the implied warranty
    9 e+ e4 T& ?1 m* U8 T9 I2 C
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the4 \" }+ O) ~" q: w, C" Q0 a( N
  22. * GNU General Public License for more details.
    4 J- C) L" L7 e- _6 X& V$ d
  23. */7 j8 V2 _8 t  u9 s

  24. : D2 N! q9 N* V' X
  25. #include <linux/module.h>
    ) ~8 z- X% O- e) K+ ]
  26. #include <linux/init.h>5 l9 m$ m+ M* Z5 p
  27. #include <linux/errno.h>
    # ^6 q; y9 Z; n3 Y5 o
  28. #include <linux/types.h>
    4 M% p. ?# g5 B! m0 V
  29. #include <linux/interrupt.h>2 |& f9 a% Z. B  M
  30. #include <asm/io.h>
    ' S7 n' N# O3 n7 `1 t
  31. #include <linux/moduleparam.h>
    8 K6 ^5 X0 c! ]* `: j& K& \  b0 L# A& r! l
  32. #include <linux/sysctl.h>5 q' F7 O" z( l; R/ I
  33. #include <linux/mm.h>
    . P+ V# l% p* c
  34. #include <linux/dma-mapping.h>
    8 n3 T( Q/ l: N. E

  35.   d9 v7 e: `. ?& t( r# S6 ^
  36. #include <mach/memory.h>7 y# Q- H( S8 O; o: V: a# X* p2 n
  37. #include <mach/hardware.h>- Z4 o# u1 i# p
  38. #include <mach/irqs.h>
    , u7 D* u: J+ ~4 n8 c1 W& b
  39. #include <asm/hardware/edma.h>
    ' w+ w* Y1 ~7 f! p' k8 G" u& _

  40. ) n& W+ X; I. M* o! K
  41. #undef EDMA3_DEBUG8 Q% r0 K# \% Q* Y5 p/ s1 C5 D
  42. /*#define EDMA3_DEBUG*/4 `1 {7 K& E" G& j+ V
  43. 8 }' W: n" \, v3 R" y; L, ]6 n
  44. #ifdef EDMA3_DEBUG! m' m/ |. u9 d3 G
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    0 g0 K3 ?* Q' J, Y
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' i# `% W# d' _  ?) ^
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* R/ p  w$ x# g% ?
  48. #else
    8 H' W- m, R# a1 i! _2 N
  49. #define DMA_PRINTK( x... )
    5 k7 O3 t5 E# Z2 W$ n
  50. #define DMA_FN_IN
    * X! m+ ?8 p& F
  51. #define DMA_FN_OUT, E5 D: N7 a0 ]( @- P" C" ?
  52. #endif% \7 o( I) [/ P
  53. " b3 C# Y/ V$ F7 u  s! e& Q
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)7 M/ i5 p! J7 E. G$ B
  55. #define STATIC_SHIFT                36 E! B7 f$ F( s! ?
  56. #define TCINTEN_SHIFT               20
    . D1 j2 _9 c& J, g
  57. #define ITCINTEN_SHIFT              21% \4 C, o  H8 J7 `; d* {
  58. #define TCCHEN_SHIFT                22: T0 V) y0 O- s! N$ U; ^, V
  59. #define ITCCHEN_SHIFT               23
    ; Z# E7 n6 I3 t/ r' c
  60. : ]9 _9 N4 {7 Z
  61. static volatile int irqraised1 = 0;
    ) P% N# k6 h5 l9 N
  62. static volatile int irqraised2 = 0;* c5 ]4 ]9 M4 l! ^4 }
  63. 5 [6 u4 X. J. `0 x
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; _/ o& G6 @- X$ s; q3 F! P
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 W6 V. A1 P* b
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" |& n3 u6 t- K6 k: [  x6 Y, T

  67. ) @" s; X+ y( a3 B
  68. dma_addr_t dmaphyssrc1 = 0;# _. B$ |7 d, K0 z
  69. dma_addr_t dmaphyssrc2 = 0;
    + J( n8 H( i5 m3 ~# ]
  70. dma_addr_t dmaphysdest1 = 0;
      U: b/ u: i! I! X1 ]+ e
  71. dma_addr_t dmaphysdest2 = 0;
    2 K& u9 Y6 Y4 L$ g" c! O

  72. ; _; o; [' Q% @* j
  73. char *dmabufsrc1 = NULL;  p6 m& C. Y1 V3 J' f. o4 Z% |
  74. char *dmabufsrc2 = NULL;
    * S* t- a2 ?! ?, Y+ x) k
  75. char *dmabufdest1 = NULL;' k3 I7 O  T. G/ v! @% x
  76. char *dmabufdest2 = NULL;
    - V, T" j' B9 V7 ]8 P) ], b

  77. * n: M7 }. H( S
  78. static int acnt = 512;
    1 T% ^, d# A- S' ^
  79. static int bcnt = 8;, ?3 p& S7 d! T8 X; l
  80. static int ccnt = 8;
    ) z. k0 B5 \6 K3 o
  81. . R, K( |" n7 I% w+ t1 M) C) |7 R3 K) l
  82. module_param(acnt, int, S_IRUGO);
    ! J6 D# q; A; f7 y2 L) A! Y
  83. module_param(bcnt, int, S_IRUGO);
    . p5 x1 u* {! O* }/ W8 F
  84. module_param(ccnt, int, S_IRUGO);
复制代码

3 B  c+ n. \, }, }( C1 J  O7 g* n
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' {/ A. n% L3 G" r
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
. i7 z# f8 S5 J3 S     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 x) Y8 \7 D* f, X1 J7 x: D0 |6 X6 c; \  H' E) n8 o

8 `  |8 s) b4 L
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-1 21:09 , Processed in 0.042846 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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