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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! q+ q4 c4 u. \) Y: j+ p0 i, a
  1. [code]EDMA sample test application
    3 O' w1 T( c1 `( f2 ^  K: V
  2. /*, ~' k: Y( J* N
  3. * edma_test.c/ ]8 A  \5 m$ v' G/ l' M
  4. *; S1 W. J/ u2 r6 w" U" Q
  5. * brief  EDMA3 Test Application* H. s$ @: l2 Z: r
  6. *  F0 ?$ {4 G% N- ?* r: Q
  7. *   This file contains EDMA3 Test code.
    $ M/ x. h/ U- }' N+ k
  8. ** Q3 M# `% z# w7 }* [1 |' ~
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 M$ Y+ Q6 ~3 A' C+ k  F( Q
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ B( z6 l# r/ t) V8 C. p
  11. *         TO CHANGE., c6 ?  x% z- }
  12. *# }; r0 B& f+ g- t3 _, {: U0 J
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" ^% ]9 i* d, f( G7 J/ ~  R
  14. *
    # w$ @0 s! |) _7 Z0 ]: Z/ t! Q, M, m
  15. * This program is free software; you can redistribute it and/or) e: h* i- G, L: V. Q! h, y
  16. * modify it under the terms of the GNU General Public License as1 V4 r& }8 A4 D2 ]) \, i2 z) E
  17. * published by the Free Software Foundation version 2.
    # x8 ]: d3 i' }1 U
  18. *
    ) a! y/ U9 n; T! h0 ~
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    5 s2 f+ {2 U6 q4 A+ b" V
  20. * kind, whether express or implied; without even the implied warranty9 A# g% q2 _. _3 q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ' ~; A5 L4 q. u
  22. * GNU General Public License for more details.
    " g! ?0 B/ S* p2 f! v. {& q
  23. */
    & {, a/ s% p5 @4 H8 }

  24. 9 T# D/ u; E9 H
  25. #include <linux/module.h>
    2 D1 P* r! g  f
  26. #include <linux/init.h>8 I( Z# y# U! a( b* H2 \" L
  27. #include <linux/errno.h>1 S" ?3 i5 n( V6 J& @! d* [
  28. #include <linux/types.h>, Z* F, W$ H- M  P
  29. #include <linux/interrupt.h>
    $ Y- [1 m1 R: |1 B% f: \0 E6 u% Q
  30. #include <asm/io.h>
    & B: [  U0 l( A: b5 p  \4 J
  31. #include <linux/moduleparam.h>. o8 L% Q5 K" G8 i7 ?  X9 y
  32. #include <linux/sysctl.h>9 m# d5 o6 Q3 i+ n# X6 L, i
  33. #include <linux/mm.h>
      a6 m+ f/ q* j4 e1 }% c) |& q
  34. #include <linux/dma-mapping.h>
    $ Y* o! u% d3 K6 |" k$ }
  35. 5 ]  \% K, R* a5 E# q* I
  36. #include <mach/memory.h>
    ; ^, ]2 m  n' \3 E# v2 k
  37. #include <mach/hardware.h>! @2 f7 a% u8 ~3 ]4 p) M3 M  i7 n+ E
  38. #include <mach/irqs.h>5 E$ z. i3 S% [! w. E
  39. #include <asm/hardware/edma.h>
    9 J6 N3 i: g0 K" ~7 T
  40. 8 A+ n2 J! d+ N/ M9 C% s9 E6 j
  41. #undef EDMA3_DEBUG
    ! H/ _# B, b, U8 {4 V
  42. /*#define EDMA3_DEBUG*/1 ]6 X( c) H9 u* S8 j+ U
  43. . q8 a0 L! }. }, t* Y$ c9 U. V* Z/ T
  44. #ifdef EDMA3_DEBUG
    ' ]" c/ z( y3 d8 a* G9 ]& [' j
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 s2 `( f% v. g
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    # q' _! L+ Q- x3 i. i5 r% [  |
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)% d# X) O3 N6 \
  48. #else
    % G' a/ l# U+ b3 `6 X5 G( x/ q
  49. #define DMA_PRINTK( x... )* [" e8 W1 T/ \2 c/ L
  50. #define DMA_FN_IN- ~+ k1 X$ i+ t1 o% K" F
  51. #define DMA_FN_OUT
    + u/ H( T( a0 E: [- ]
  52. #endif
    ' x; [  D4 N! k! A8 h
  53. + K" b9 X( ?+ f8 I3 u& b; q
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768); i8 W0 G- n; u
  55. #define STATIC_SHIFT                3( W0 J. Z, E5 a* U  Z0 b6 w% Q6 l
  56. #define TCINTEN_SHIFT               20) V6 E% ]4 \+ N: y
  57. #define ITCINTEN_SHIFT              212 W" ], w7 z6 e& y, c
  58. #define TCCHEN_SHIFT                227 f1 M1 E5 b7 V# ?( Z
  59. #define ITCCHEN_SHIFT               23/ e  X  G# @* S1 |
  60. ) q  A- m6 T" z5 S
  61. static volatile int irqraised1 = 0;
    - |( C9 f+ [) n, i. [
  62. static volatile int irqraised2 = 0;, g5 _. J2 T; s' Q- t

  63.   t9 i% x6 F4 [1 L( W8 o* Q
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& m8 m" ?; e0 `1 S. l6 E  P
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; r- y- [/ N6 Y! e) W. S
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " v0 ?  V0 [/ `# J& L: L
  67. ) B* r5 A; K2 U7 P
  68. dma_addr_t dmaphyssrc1 = 0;* G9 E- @' T3 N8 ]
  69. dma_addr_t dmaphyssrc2 = 0;  j* w( P1 r/ [1 [1 m0 k) J$ |
  70. dma_addr_t dmaphysdest1 = 0;
    ) H$ J: K  T' f( ]) G9 b
  71. dma_addr_t dmaphysdest2 = 0;
    3 l! m5 X. U5 w1 _& h5 J/ l

  72. $ T$ i, s  f) y" `  l/ G) n5 H* J
  73. char *dmabufsrc1 = NULL;) i( Y( V3 k4 @' L9 f8 L9 R- c! k
  74. char *dmabufsrc2 = NULL;
    + E  y6 v" i4 g+ q+ x+ ~' s9 y7 t
  75. char *dmabufdest1 = NULL;) D; k0 L3 S) d8 m
  76. char *dmabufdest2 = NULL;% a! \- [1 I' H: p- T, {5 V0 R

  77. 3 Q9 L# F2 g- I6 q0 L" R/ E0 o! p
  78. static int acnt = 512;
    - G. Y) }% J1 y- f
  79. static int bcnt = 8;" v* a" ~7 p) l$ c% g& f. a
  80. static int ccnt = 8;
    * a( m( T2 D% k& o
  81. 0 |; w/ }" c  A8 `
  82. module_param(acnt, int, S_IRUGO);
    - R: y# I% q, w8 ]$ [2 ^4 f
  83. module_param(bcnt, int, S_IRUGO);
    : q1 U& I$ R4 `1 X! P7 W
  84. module_param(ccnt, int, S_IRUGO);
复制代码

9 c& u. q' Q( g7 q1 t2 s4 G
- m, s  j, y' K  s      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
! E3 d/ Z* m, H" x! Tarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* M, \- e5 d" o. J9 X% J     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) i7 F/ {! U2 Q
, A4 Q/ r. u2 p8 x7 a  z9 \, r' ^: @0 Q0 |) M# C  Y4 O  v
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-20 09:00 , Processed in 0.043878 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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