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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 b3 {1 M" I5 w% s# B: [
  1. [code]EDMA sample test application
    % \2 j, L2 x" Y" x+ T! S+ N3 h
  2. /*
    : M7 I7 B. J) g- B+ k& [8 z
  3. * edma_test.c  _! q- H% p' X  U- b8 U. |+ [
  4. *
    8 ]8 h) B- a& m( Q9 Z/ f3 L
  5. * brief  EDMA3 Test Application+ p% ~" s0 P' e; G& C. E- a, z
  6. *% B1 g# L5 p2 }0 N6 w9 c( |
  7. *   This file contains EDMA3 Test code.
    9 U) j" t8 P* n( p% X
  8. *2 M, f+ @: l- u7 a
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    / U8 c/ f+ ^  G; a6 C0 H) Y5 N2 p
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    % X  V/ Z0 Q0 n$ u& D. ?
  11. *         TO CHANGE.
    9 R1 |3 ~( y0 v4 l1 C# ^* Q& I
  12. *
    + Q& w% F3 h8 C5 c
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    & h3 J8 K9 W8 o
  14. ** ?" F7 G1 `9 Y8 y/ t
  15. * This program is free software; you can redistribute it and/or
    5 d, W2 q" y2 I/ r+ e1 a2 T
  16. * modify it under the terms of the GNU General Public License as: P, s$ I7 L8 o/ j! i
  17. * published by the Free Software Foundation version 2." _( Z( M% \: E0 V
  18. *' D1 E  |! |0 y& A4 E& r
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ o! N6 _4 |) N0 U& J# W
  20. * kind, whether express or implied; without even the implied warranty
    1 y+ r: Q7 Z& d1 Y4 R; a5 l
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the- C; q9 U, u. P. N7 _
  22. * GNU General Public License for more details.+ P+ e( ~& }! e  W
  23. */- {: k' M& y/ N- B) J  K

  24. 2 G0 k2 W8 j; H
  25. #include <linux/module.h>
    / ^! I2 C3 g) [; H! G3 {5 k
  26. #include <linux/init.h>: J; ^9 M' y6 w9 x# j! }, p9 z& M
  27. #include <linux/errno.h>
    , M* \- N8 ~% ^
  28. #include <linux/types.h>
    4 R; m# ~; R* l" e" V: X
  29. #include <linux/interrupt.h>
    * g6 R* _8 L% `
  30. #include <asm/io.h>5 _5 @$ a5 I5 E  n, }9 I& \# `: O: g
  31. #include <linux/moduleparam.h>" J- N+ F  M0 N( ?  k
  32. #include <linux/sysctl.h>9 h- c8 ?2 k/ t2 c0 |4 `
  33. #include <linux/mm.h>- v7 A$ R, H6 w$ B3 H
  34. #include <linux/dma-mapping.h>
    $ a' g! t4 u7 W0 f
  35. 7 R2 m" b2 w2 F1 @; e% A8 O: a
  36. #include <mach/memory.h>
    6 K% ~2 c- r  p8 V; @% W
  37. #include <mach/hardware.h>
    * L& [  y" A  Y* f
  38. #include <mach/irqs.h>
    6 u6 I* y, U8 X. ^; [
  39. #include <asm/hardware/edma.h>
    9 T" N2 Z& T! H; j
  40. $ ~2 F- X7 h* b% g4 B! _
  41. #undef EDMA3_DEBUG6 j' z. ^" E& z) D# q& `) `( c
  42. /*#define EDMA3_DEBUG*/
    & K/ @6 x" d* K+ q0 V2 Y+ ]& A8 B5 P' {

  43. : ?6 h6 k. Z9 T1 f4 `
  44. #ifdef EDMA3_DEBUG6 M- G' {+ _3 Y4 |2 _2 L& I
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    7 M* q$ x: r. c- s5 S
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    0 h, d6 m( N; U4 m
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    5 s8 v3 `2 r) }  u# N* X
  48. #else
    . G  M2 a) W% N. {  Y, [
  49. #define DMA_PRINTK( x... )
    1 O1 D& ~; F  [4 q4 x6 ~
  50. #define DMA_FN_IN6 c' v, y: H+ J: ]# N# Y
  51. #define DMA_FN_OUT& }( S- M3 [5 s2 c2 E# Z( h( A
  52. #endif( I0 A6 i. N) V* L3 ~8 g4 h- @# z

  53. ) ?: t+ C: F7 O8 j( _
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768). [; X( F! u# m+ G' N
  55. #define STATIC_SHIFT                3% |6 s7 e+ d8 A0 S5 I' s5 C
  56. #define TCINTEN_SHIFT               20
    8 o* J) |( q" C" h! h, Z; I9 ]
  57. #define ITCINTEN_SHIFT              217 h9 J, `8 M* Q  n/ O- N* s# Q
  58. #define TCCHEN_SHIFT                220 V7 r9 s7 c) o, m
  59. #define ITCCHEN_SHIFT               23
    ( q. o- L$ ]+ A  z# s' L
  60. # W' N- m$ m7 B" u- p
  61. static volatile int irqraised1 = 0;* `- {6 Q& u7 p, m' I
  62. static volatile int irqraised2 = 0;
    " X/ C# x7 q2 q7 v7 ~

  63. 1 ?  d% Z& ~8 c' c
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & J3 _$ O# f% u9 x: F
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( f9 }8 W7 |5 O$ w1 S
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) Y9 S8 y/ ^" d  [; L# Z4 [0 b
  67.   f! E, Q! g. T. C
  68. dma_addr_t dmaphyssrc1 = 0;
    1 u  h* m! b8 A$ m, l' A; C
  69. dma_addr_t dmaphyssrc2 = 0;, T: H0 Z+ P* v$ s8 h0 ~; _6 B
  70. dma_addr_t dmaphysdest1 = 0;+ f9 l: M8 n# h  i. f
  71. dma_addr_t dmaphysdest2 = 0;" H; }1 m6 S. D2 J8 b! d

  72. & F  m7 Z4 s1 C
  73. char *dmabufsrc1 = NULL;$ J, s# x) x& g, s( b
  74. char *dmabufsrc2 = NULL;3 O: V6 w+ T: P) h
  75. char *dmabufdest1 = NULL;
    % G8 v  j& [/ O# f1 B2 p
  76. char *dmabufdest2 = NULL;
    - {6 t: j4 i" g/ O* r8 C

  77. : {, v2 X3 h4 x$ d0 ^2 ~
  78. static int acnt = 512;8 S6 a' J5 Y8 {
  79. static int bcnt = 8;" w; e9 H  X% b5 D* H5 z* Q
  80. static int ccnt = 8;9 R: E( V: [( P: X) l

  81. % l5 Z& }2 H* ]9 i# c  O. }; }3 v
  82. module_param(acnt, int, S_IRUGO);( M9 e- j8 `4 |# R2 @
  83. module_param(bcnt, int, S_IRUGO);0 P5 p- O6 w) i" Q4 ]+ i4 d$ Z3 m8 h: A7 a
  84. module_param(ccnt, int, S_IRUGO);
复制代码
# o9 H( w$ V& i

3 \" ^5 h0 n0 h/ h# }& ]      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 b7 E( \3 O' e% N! z1 {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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
5 V) _8 s5 C+ D) L     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: E. T, U9 b8 k! T9 o  i! l2 R' L/ |7 Y" \# l

  M5 B9 u1 U* D6 w
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-19 17:57 , Processed in 0.041536 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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