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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# V( ^  B% o5 v- \( i/ L
  1. [code]EDMA sample test application
    # `4 |( q% W& |; N* R
  2. /*
    ! Z" ~) H9 Z) j% J' V) }' T/ n
  3. * edma_test.c
    - C7 Z8 v! E6 y1 q& {
  4. *% P. Q0 H, D4 e" i5 v1 s$ k- [
  5. * brief  EDMA3 Test Application/ ]5 x  Y  V* q: I
  6. *
    8 J- \4 x, A4 }' K: d
  7. *   This file contains EDMA3 Test code.8 B+ I, E% h7 U. A
  8. *
    % H- j& O1 z: V
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ M7 ^0 K" k7 m- y$ K7 u! w+ M4 N
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- [& \. X5 [- p
  11. *         TO CHANGE.: Z' J, _$ L0 k& ^3 V5 h& r: O
  12. ** u$ `, U- a  M
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ; g. K0 }4 `. {8 V/ X& M
  14. *: r. m& k5 [* R
  15. * This program is free software; you can redistribute it and/or( ]+ N8 d: h3 N* b$ o) ?7 L- z
  16. * modify it under the terms of the GNU General Public License as/ _, x7 Z$ ~" j" m/ c' W% t( t
  17. * published by the Free Software Foundation version 2.  u5 O8 R$ e; z: E2 i
  18. *  V3 {2 _- v" n2 V  K
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
      G+ `- k3 s6 T# X  e5 g  k
  20. * kind, whether express or implied; without even the implied warranty
    7 F1 B% t1 N. r- s( x& Z* H: ]7 Y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the+ D. f% m; l3 ?0 c8 H  W. n+ R/ v2 l
  22. * GNU General Public License for more details.+ [0 D: H: W8 O. X2 Y
  23. */
    ; p( a( }; L- P! g3 F! r) c

  24. " x9 D, m2 q1 g5 l* K
  25. #include <linux/module.h>) K7 M, f* [# T; C" @9 H' N9 d
  26. #include <linux/init.h>4 F2 X1 p1 ^$ {" ?8 l( J4 Z* C1 q
  27. #include <linux/errno.h>
    1 W  ?. W) u6 A( h
  28. #include <linux/types.h>- L2 {( j* _; S4 D/ {
  29. #include <linux/interrupt.h>
      h6 W( d  ]/ a
  30. #include <asm/io.h>- ]# S) j* \0 v4 \% i
  31. #include <linux/moduleparam.h>2 h. H( o, X2 r2 d- g( ]- E$ b0 X
  32. #include <linux/sysctl.h>' A, v& ?( b) o8 ?0 J4 X$ |2 o
  33. #include <linux/mm.h>
    3 o3 Q! k. J$ s0 X; H. `# e
  34. #include <linux/dma-mapping.h>
    9 h, }' O0 ^# f5 {# u3 L2 c

  35. / F2 x; z% m0 i( m! M
  36. #include <mach/memory.h>
    * P6 B2 U1 Q3 U/ K! o
  37. #include <mach/hardware.h>
    ' i& o; V4 D4 |% M: I$ Z
  38. #include <mach/irqs.h>3 b  F: A6 b! {
  39. #include <asm/hardware/edma.h>9 Z2 _2 h- F/ v
  40.   I( w6 g7 Z0 k0 D# t$ s
  41. #undef EDMA3_DEBUG+ H  E/ ^3 g! B5 r0 d' m
  42. /*#define EDMA3_DEBUG*/
    & ?; {1 |  f/ ]: Q/ E
  43. 8 _) I0 F% k+ P) f
  44. #ifdef EDMA3_DEBUG4 e  i' y9 ?" y5 s! l% Y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    / Q& d6 E/ N! {
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    , H6 I9 j6 ?5 |/ M3 K$ B2 w
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 p4 _! ^8 R' w; W6 k
  48. #else( b. C; R# m% \9 _: {: u7 @
  49. #define DMA_PRINTK( x... )
    ! u$ G- u( b& J
  50. #define DMA_FN_IN8 S; e* O0 p: ~
  51. #define DMA_FN_OUT4 h; a0 D$ k) a  G& ^
  52. #endif
    ( _& l' C5 L) t1 |
  53. 1 q1 ^- d) R2 `( s2 d
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ' R! f9 o1 l, W3 F/ |0 ]
  55. #define STATIC_SHIFT                3" c9 K7 B7 n) @$ q  Z) @/ H6 X
  56. #define TCINTEN_SHIFT               200 I( H( M3 q+ D  [/ k2 @
  57. #define ITCINTEN_SHIFT              21+ V( F, A% ]% v7 L2 [
  58. #define TCCHEN_SHIFT                224 K/ O1 s0 m9 J& S* ?
  59. #define ITCCHEN_SHIFT               23
    5 X5 v' y# C# a" q2 \' [5 w! p

  60. , C. J1 _3 s+ L
  61. static volatile int irqraised1 = 0;
    8 p; Y3 Z6 J: }
  62. static volatile int irqraised2 = 0;
    ' m8 Q& C! K0 w9 R/ V; w) G
  63. ! i, M2 V8 ^& Y
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 `3 ^. ~8 ]1 j! [1 V; z2 _# |
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 @7 l* O  O+ |% w; O! K
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 c2 z; o. [, R" ]+ z, m

  67.   f2 @1 P  _! b" q, [. B1 r0 n& a
  68. dma_addr_t dmaphyssrc1 = 0;1 C4 @1 ~3 S/ F2 v1 t7 L1 x2 R+ y
  69. dma_addr_t dmaphyssrc2 = 0;* @( U( C2 Q3 E0 o+ [0 a$ a1 m+ @
  70. dma_addr_t dmaphysdest1 = 0;3 G1 U& ^7 d" @* X$ h2 S4 Q8 P
  71. dma_addr_t dmaphysdest2 = 0;
    ' o* C( G' a$ l( h1 X' Q; j
  72. 3 N* d- Y+ I3 n) j0 v; v3 r4 ]3 v
  73. char *dmabufsrc1 = NULL;
    ( j4 C2 b8 J+ G' Y+ y
  74. char *dmabufsrc2 = NULL;
    . D' T: C0 l5 h
  75. char *dmabufdest1 = NULL;
    " i. Z# \  P6 W; K7 s( C
  76. char *dmabufdest2 = NULL;& z6 t* A2 ~9 u  {
  77. 7 [4 G) m2 d- Z! K7 s4 z, o
  78. static int acnt = 512;
    5 x$ G6 A3 K- ~! H! A1 J
  79. static int bcnt = 8;
    * K" N$ ]4 k1 S$ r
  80. static int ccnt = 8;
    1 @. N, b& s+ _% Q; L
  81. & d. R* H# T$ ^$ |1 i
  82. module_param(acnt, int, S_IRUGO);
    0 |/ b& I8 x# \0 c( g9 M
  83. module_param(bcnt, int, S_IRUGO);
    # w9 J8 F( U' j7 S* B* E5 W
  84. module_param(ccnt, int, S_IRUGO);
复制代码

6 o2 e" k8 i, S# w! I) C4 N+ Q% o- _. `, |# a+ ]9 U+ S- M
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ f1 ~* \% t( J- e1 ~9 l% Sarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。6 o, ~8 v! A; D, o0 A+ y$ Y/ C
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
/ P  k' U. O! X! f, G& e4 `7 [1 _" d- @& P- s8 t0 x2 o3 D' q: k) a

! P, ^# j; K6 w) N7 V$ i5 z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-25 10:57 , Processed in 0.040465 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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