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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 y( O/ _" ^" e9 q6 \) ]% J7 ]
  1. [code]EDMA sample test application7 \1 i# U( M8 P" s/ |, C
  2. /*% G8 j4 D" d8 x! C+ Z
  3. * edma_test.c
    % X% C& f9 w- K9 n
  4. *& b& \# V5 I; H& ^- j
  5. * brief  EDMA3 Test Application4 \; B, G/ [, r( ~. B
  6. *3 k( }  `( W/ k! q
  7. *   This file contains EDMA3 Test code.
    , y( d- @7 Q! s8 X: ^
  8. *5 x2 P' ]* v( m! d2 T% V
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 f: x  k% `$ w; n! k1 ]6 S
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    3 \( Q! p, {# @& a! }! _8 l
  11. *         TO CHANGE.
    5 N1 I) U- p. H
  12. *
    % |7 h: O% H- {8 U2 U5 t) ~2 M8 p- r0 }
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/  x( E6 q- a+ o6 R
  14. *; n6 i1 E2 O* j1 p
  15. * This program is free software; you can redistribute it and/or
    & b+ ^: M. b4 V0 \# o
  16. * modify it under the terms of the GNU General Public License as8 p/ O5 U7 H/ R, n) h9 c
  17. * published by the Free Software Foundation version 2.
    2 y3 m5 K. R- g4 Y9 [
  18. *0 \- t4 A' Q- v
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ! P& [9 I0 E3 ?, _& r
  20. * kind, whether express or implied; without even the implied warranty/ s0 L. g0 \; S2 w* m  s
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    8 r* U! Y+ G( v( m  M& m
  22. * GNU General Public License for more details.' x+ h, l2 e2 p1 j' K+ t, N/ L; Q. v# ?
  23. */
    : F2 m% X! c7 t
  24. 6 ]  o" k! X; M# ?
  25. #include <linux/module.h>1 L+ ^4 N$ f% U4 k% E3 j
  26. #include <linux/init.h>
    7 _/ H3 R- g: r
  27. #include <linux/errno.h>5 M1 y5 q' [2 S' n" a* Y* T
  28. #include <linux/types.h>& R% B7 v8 c2 d6 d; S6 Q
  29. #include <linux/interrupt.h>
    - F- Z7 `* T! A3 \6 u  _0 Q
  30. #include <asm/io.h>
    1 j- [; e0 v( [! w; h; L) Q% r
  31. #include <linux/moduleparam.h>* b6 K2 m5 i5 d+ p8 f1 `. \* m0 L" Z
  32. #include <linux/sysctl.h>( \8 a/ X* m5 J" \$ k# Q
  33. #include <linux/mm.h># `7 H- t2 o! y/ z3 s* I% r  [
  34. #include <linux/dma-mapping.h>
    : `3 T' O$ `5 _3 S0 h& t4 c

  35. # u  N4 p7 o6 o% l/ s
  36. #include <mach/memory.h># T6 J7 _7 s5 U: x
  37. #include <mach/hardware.h>+ V' G% n/ ~3 l+ y$ z9 F
  38. #include <mach/irqs.h>
    - m+ N' K0 `: r0 Y' L
  39. #include <asm/hardware/edma.h>9 V( y5 ?3 d( A. V5 Z3 g* O

  40. 7 A0 k4 ^9 _+ t) ?/ f
  41. #undef EDMA3_DEBUG. G, U; I+ O- Y5 E
  42. /*#define EDMA3_DEBUG*/4 _" ^0 g: [0 S0 t- J- B8 Y: w
  43. % v: B8 R- Y# Q3 s4 j- W5 [
  44. #ifdef EDMA3_DEBUG8 |& s! ?  L& e" j  c& x
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). S% d4 M  U3 A4 U8 [- l3 H
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" ~) g+ T) N. k. }+ M
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    8 h4 Z' `8 J+ N6 B
  48. #else
    5 m% O, g$ p( }' I' ~& F- ], q4 _' E
  49. #define DMA_PRINTK( x... )
    7 R- g/ _; A$ b
  50. #define DMA_FN_IN4 I5 `1 Y% `8 S
  51. #define DMA_FN_OUT. t4 d3 c" L% U* B2 O
  52. #endif, i; a2 x; X/ x. }8 y( D, k% P
  53. * |+ j4 m" F9 ~9 x7 m# H
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)/ v( t: W5 X2 e8 k- D! h* @  ]
  55. #define STATIC_SHIFT                3) R2 [% R+ v/ z2 a8 J4 U' C( [; U
  56. #define TCINTEN_SHIFT               20
    ! Z, y4 k  g+ j2 D9 j2 r4 ~
  57. #define ITCINTEN_SHIFT              21) S0 E/ @! E- v0 |
  58. #define TCCHEN_SHIFT                222 U; h6 \! U3 ?
  59. #define ITCCHEN_SHIFT               231 K. s& q( W1 i0 a, h9 e' u& Q

  60. : s) N: u% B& g6 Y
  61. static volatile int irqraised1 = 0;# x1 a) o$ @* u2 O" G! @* T; j% V6 A
  62. static volatile int irqraised2 = 0;+ f1 _5 Z/ ^. D. x
  63. ! i7 M" h7 u3 n2 X' \
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: G' I- _4 P( Z+ M( M
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: n' F: N0 A) p% n+ z4 Q
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# J. B" d9 ^/ C& ?3 H9 Y7 H( s- J

  67. 2 u3 Y' K3 E9 ]& @. a* N
  68. dma_addr_t dmaphyssrc1 = 0;: H& S) X4 v# N1 ^8 g
  69. dma_addr_t dmaphyssrc2 = 0;
    ! t3 B1 @5 Y( j6 }
  70. dma_addr_t dmaphysdest1 = 0;
    7 L/ v3 g7 |0 v; K/ T$ w) c) W
  71. dma_addr_t dmaphysdest2 = 0;1 H1 x% F. g5 n

  72. * \6 V. K  d0 P. e7 z
  73. char *dmabufsrc1 = NULL;, ^7 M( e( P5 L- c2 a  L$ S
  74. char *dmabufsrc2 = NULL;9 W* u! u( j* m' E) i0 w% K
  75. char *dmabufdest1 = NULL;/ |9 h8 v/ h, ]. t9 H9 ]2 b
  76. char *dmabufdest2 = NULL;
    2 V' W$ \6 P$ H( @1 `

  77. % ~# \+ ^* F+ R
  78. static int acnt = 512;+ r) k' l5 A0 ?% U1 \2 K$ g4 p
  79. static int bcnt = 8;
    6 R3 ]+ Z& u9 L, Q2 Y
  80. static int ccnt = 8;
    2 z  p+ r  P+ i

  81. . o( ?! V* r* u; }3 N+ G6 f
  82. module_param(acnt, int, S_IRUGO);
    , \7 {* h6 n( W# i# {4 y2 d4 G
  83. module_param(bcnt, int, S_IRUGO);
      c  K( E! a. M% ^" I
  84. module_param(ccnt, int, S_IRUGO);
复制代码

+ r$ V- |. a, B  j+ S3 i+ b; X( b) f- E# D1 z
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 P0 T' U) a8 i9 \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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 w! B& n5 T* r6 l$ S- L; x     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 P9 N8 a* }, {7 c0 q2 _" ~- l

* B+ }+ B; C0 Z$ a6 ^- O+ I) I! F6 Q1 R
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-12 15:03 , Processed in 0.038792 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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