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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 O  _) ?" q- _% v* u0 [
  1. [code]EDMA sample test application
    6 o4 q+ e. H5 T1 i
  2. /*
      h4 O( C. T# r6 n
  3. * edma_test.c, s" [, X! c% \( W
  4. *
    ; i0 [1 E. c& H; c7 `
  5. * brief  EDMA3 Test Application
    4 u6 x+ W' }; P4 e3 k! E
  6. *" b% O( ~6 [" V
  7. *   This file contains EDMA3 Test code.
    # p# j- |. D& s2 A* h
  8. *2 I- A3 X/ ?: w- a! d+ ^
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ S% o( _& F' k9 G: L
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ( u! C( t  v, z" v
  11. *         TO CHANGE.8 Q: Q; t0 B- x9 r" R  z
  12. *. [: j" F$ |" Q8 u- L
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// u% t, |: u6 s, S. D8 A3 M
  14. *. {1 q/ Z5 f1 N* u7 b/ Z& j. o. m
  15. * This program is free software; you can redistribute it and/or9 f3 T3 K! g  Y! N3 L. {
  16. * modify it under the terms of the GNU General Public License as: O- x7 o1 r# Z9 l/ `
  17. * published by the Free Software Foundation version 2.. S8 y9 ]1 P3 i
  18. *
    1 s4 b1 l. Z2 q" ^  A
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ( V- t) m* s0 e4 r
  20. * kind, whether express or implied; without even the implied warranty. h5 G2 V5 J/ j5 k; e- P2 q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    - K# ~3 ~4 Q6 B
  22. * GNU General Public License for more details.
    4 e% `8 z! g9 L* X* W: D/ x3 C
  23. */, ]" W8 N4 ], W* Q1 _( u+ z$ v( L

  24. $ G7 d4 I4 T' @5 Z) W, X
  25. #include <linux/module.h>
    7 A0 T& y; ^% w2 B% A' h7 e
  26. #include <linux/init.h>( I( A# l) l% v" _" h% m) |8 j9 x
  27. #include <linux/errno.h>
    " p5 d1 f8 n; S1 p/ U' }
  28. #include <linux/types.h>' g. ]' ]" }) F
  29. #include <linux/interrupt.h>
    2 O+ q0 A: e5 K# T* |
  30. #include <asm/io.h>; d* z6 h# v( s- P
  31. #include <linux/moduleparam.h>% ^6 _2 `0 A, L
  32. #include <linux/sysctl.h>
    * n" B0 z8 A* c  [- w- t% m
  33. #include <linux/mm.h>1 A2 y. l- \  }, a) r, ~
  34. #include <linux/dma-mapping.h>
    & ]3 {7 r# I: `* r6 a. P

  35.   V: l/ _1 k6 e/ _# `' z  P4 I
  36. #include <mach/memory.h>0 T+ e, Q* j% D) \4 |
  37. #include <mach/hardware.h>
    ' ~0 r% D6 {+ N) o9 Z. Z/ |% Q
  38. #include <mach/irqs.h>
    1 f' v: o" P" G4 L- q
  39. #include <asm/hardware/edma.h>
    # k: g  f7 P9 S* n& S
  40. 6 ?5 Q5 M3 d6 z( E2 N
  41. #undef EDMA3_DEBUG, L$ z: ^9 p# l6 E
  42. /*#define EDMA3_DEBUG*/. K' ?. e* N8 d9 c1 Q3 E0 [2 w# _! Y

  43. * U- u0 I+ U5 o, u+ |
  44. #ifdef EDMA3_DEBUG
    # Y5 I: [7 E" ^, A+ t2 ^
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& k0 O: R% U6 [  J% n5 k
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' U2 c$ m6 z7 Z" E& B
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 W5 i% j. L" |  J
  48. #else
    & d" l% e$ f+ v% i7 x# a( E
  49. #define DMA_PRINTK( x... )
    ( n: ]* S) g8 f* I
  50. #define DMA_FN_IN6 m5 H: @' q. }) E8 M) T9 x
  51. #define DMA_FN_OUT
    : u/ r( O& _8 Z7 {& V6 A$ d
  52. #endif
    2 H) p8 q6 ^+ j

  53. + x7 `, F$ g3 ]" z5 t
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)2 w8 R. Q' \+ {2 p) r( z( E: }
  55. #define STATIC_SHIFT                3
    3 L" E9 d6 O  t. ^8 r! E* o
  56. #define TCINTEN_SHIFT               20
    6 t& R) R3 E! [. I* a# G- Y, ]; \' a
  57. #define ITCINTEN_SHIFT              21
      Y5 j. c8 E) q  D6 g% H: p
  58. #define TCCHEN_SHIFT                22
    5 e  C' x9 l+ W' `2 |2 L
  59. #define ITCCHEN_SHIFT               23' L  q8 F; `# f7 R

  60. 7 c0 R; h9 W, E# H4 I7 j* V7 K
  61. static volatile int irqraised1 = 0;
    9 ?3 l9 y' P* S( @; t
  62. static volatile int irqraised2 = 0;
    2 b# Z& W2 s+ ^) [6 Q

  63. / _2 i' l: `7 ]( Y2 r9 }
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' w" o7 ~, b& e3 n: x% p9 s; F" _& M# ^% Z
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 [' G( w5 P- P: h3 |
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# p6 a) i# x2 K1 P: \/ I# }+ g7 n# g
  67. ' b; U% w: O0 e: Q- o
  68. dma_addr_t dmaphyssrc1 = 0;
    0 b8 S" a/ z5 N  h: J0 \( W
  69. dma_addr_t dmaphyssrc2 = 0;: M5 ^5 o) w6 [: }( J+ q
  70. dma_addr_t dmaphysdest1 = 0;
    * i$ ^) U$ ~% n" P; M3 p* {
  71. dma_addr_t dmaphysdest2 = 0;
    2 `* U& `) |) \. G1 K2 G

  72. . h! ?0 ~/ J$ S& ~, }8 ^) Q% M; [2 `
  73. char *dmabufsrc1 = NULL;6 B9 B5 b! `$ C* C) a9 ?; M  _
  74. char *dmabufsrc2 = NULL;
    ) h3 J! o- {& `/ N
  75. char *dmabufdest1 = NULL;
    ; i& _5 _! |9 G6 x
  76. char *dmabufdest2 = NULL;
    8 y3 U/ C6 w$ E5 J2 F
  77. & n* |/ Z9 a+ Z, d: X% K) N
  78. static int acnt = 512;8 Z8 ?) A& W/ Z7 f: p. o5 I5 H1 [
  79. static int bcnt = 8;! j  O5 V9 T# e; T5 s5 j
  80. static int ccnt = 8;1 A; \+ O5 \7 [
  81. & `5 v9 O; l$ k  A  @( R( t
  82. module_param(acnt, int, S_IRUGO);
    " R+ x& F/ @* g
  83. module_param(bcnt, int, S_IRUGO);
    * f! ?' O- [( m9 a: ], p. v8 r
  84. module_param(ccnt, int, S_IRUGO);
复制代码
1 P" w1 y3 {0 X* r5 o" W. _3 g! w
2 X% P1 _# i" F5 d" `3 T
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ a/ Q& ?9 ?/ i7 C
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 r  `0 K: u- }8 o2 q- J; k
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# t0 s2 _4 x* E* e% H
6 H& _: o# m6 u! |$ w( n+ s# x4 ^! I) y8 n- D5 B; v# g$ C
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-13 04:05 , Processed in 0.042866 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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