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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " o% {' e& K$ B
  1. [code]EDMA sample test application
    3 P/ {: D' H/ f4 n
  2. /*" R$ n  |  E+ P. `# C# j: h
  3. * edma_test.c
    # m& ?5 Q, N4 x/ R
  4. *9 u  _4 O* U8 \4 y' l! ?# Q7 F
  5. * brief  EDMA3 Test Application
      h  M; c; f' I; H  e) g9 \3 a$ O
  6. *. N: b$ a2 E# d- I1 i6 a
  7. *   This file contains EDMA3 Test code.% k. T4 B7 A8 O! t* Q6 E  g
  8. *# F$ M: t+ n; A- u- r3 c
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE2 f9 \0 l8 T4 r7 c) ?. \
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT: U) Z2 {" }2 d0 C* }
  11. *         TO CHANGE.
    ( p( O  n8 n2 X/ Z
  12. */ J. t0 U+ V5 C' R5 p
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ P- Z& S3 j' V8 b  y5 S$ ^9 J
  14. *
    / p% a1 V( \" U
  15. * This program is free software; you can redistribute it and/or
    $ R5 A) v- M9 B
  16. * modify it under the terms of the GNU General Public License as( r8 \$ y1 C) a* ^
  17. * published by the Free Software Foundation version 2.- a0 E0 R/ H4 c
  18. *
    & R" H4 x; O0 C' }1 P; P
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    8 d9 l4 Q$ ^6 }/ Q3 N0 l: m! k$ R
  20. * kind, whether express or implied; without even the implied warranty3 ?. o8 ^; J) |, {$ z% E& U: M
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    6 r' e- ^( h2 B0 K) ^# D8 i
  22. * GNU General Public License for more details.
    7 D9 P# g7 L$ Q- y0 {5 ]7 t
  23. */
    6 K; X# N+ Y9 ]0 p" {+ }

  24. ! J0 I! k$ U! K2 c9 w
  25. #include <linux/module.h>
    . N: F8 e# l9 K2 d( V/ |/ T) u
  26. #include <linux/init.h>  o7 B; u0 c2 `; s7 z. E* S
  27. #include <linux/errno.h>  C' ?' x6 }, B, L. L# x
  28. #include <linux/types.h>4 Y) S! n, d. t* W& x- P
  29. #include <linux/interrupt.h>: ]5 L7 |- p) ]$ V9 R) g  P( Z
  30. #include <asm/io.h>
    - [  e/ T6 L) ?0 W- N. I
  31. #include <linux/moduleparam.h>
    % J1 U  f$ \8 `  U7 ]
  32. #include <linux/sysctl.h>5 C' M* C' X1 ~" Y1 v" _& j
  33. #include <linux/mm.h>
    & c3 i1 V. e. q1 S
  34. #include <linux/dma-mapping.h>. H( F% R9 a/ S3 A
  35. 8 I1 p! o+ t8 Q" F( D! K: H7 F6 l
  36. #include <mach/memory.h>
    7 G& |) V8 V) X* w& b7 [8 j
  37. #include <mach/hardware.h>
    : e7 ^3 J! Q" J; o
  38. #include <mach/irqs.h>$ D9 X8 J" I) i, `6 d
  39. #include <asm/hardware/edma.h>' H: o! g4 e& `4 V! q5 ~( H

  40. 4 Q+ x5 d+ c5 \) ?& [6 t
  41. #undef EDMA3_DEBUG! `- V4 r+ s) u' N# F
  42. /*#define EDMA3_DEBUG*/' n" K: e; y6 H* \. D7 K! O
  43. - U' R% r! H3 S7 J( \% o
  44. #ifdef EDMA3_DEBUG% U" J9 F. ~0 X6 ?/ ^: V
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# j: Q* _/ Q: ?* w7 r( g
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 r9 f% L9 ^: w) F
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    1 R9 j  u6 R& }9 A* g, r
  48. #else
    ) ]* G: @& j: ^$ ]+ A
  49. #define DMA_PRINTK( x... ). _5 }1 H/ H  k( d9 x# e
  50. #define DMA_FN_IN6 ^6 e9 B* g( U4 t7 x% W! W
  51. #define DMA_FN_OUT
    ! ?, f; m$ V& a- w; u# V8 N3 z& i
  52. #endif
    ! W9 d- t8 T& _; K6 m8 j% d7 M8 y

  53. ) |+ U* c( x1 C/ }9 o7 h
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    . q5 h! Q7 L) P$ w1 x, r* E' P
  55. #define STATIC_SHIFT                3- q3 O+ ], f& W6 e1 y5 }
  56. #define TCINTEN_SHIFT               20
    6 M- g: ~# w, }" a0 a
  57. #define ITCINTEN_SHIFT              21- p% Y1 _4 g) B8 X/ J5 M
  58. #define TCCHEN_SHIFT                22* g4 g; I0 a; v3 W1 P
  59. #define ITCCHEN_SHIFT               23' H/ {3 H& z& I: w, l

  60. 6 A2 H0 N, H! J
  61. static volatile int irqraised1 = 0;
    / E4 D: w; Y; v; R8 P$ e( l
  62. static volatile int irqraised2 = 0;
    9 _! z- @6 m* h7 G+ U# b. A( B

  63. ! }& C$ Y, A4 _/ C
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) J0 E. U9 ~2 v3 C
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ `/ H$ O% X/ s# k# {
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# ^5 g9 q) z# `. s. S& ~
  67. $ h" f6 ?% A+ B, w3 m" W, q
  68. dma_addr_t dmaphyssrc1 = 0;) n: R9 q/ y' w$ x/ ~
  69. dma_addr_t dmaphyssrc2 = 0;
    * m: J0 d7 \# A* a! p! }7 g
  70. dma_addr_t dmaphysdest1 = 0;
    5 v2 L8 r- M; e% ~2 V! n
  71. dma_addr_t dmaphysdest2 = 0;
    , {( @* M* s: M/ B+ C5 L
  72.   F0 {  w- d, q6 |
  73. char *dmabufsrc1 = NULL;$ b4 b2 F6 J- W, X
  74. char *dmabufsrc2 = NULL;9 x: t% o6 o" R2 [$ t
  75. char *dmabufdest1 = NULL;
    9 ?6 K  `/ v% J( e( F
  76. char *dmabufdest2 = NULL;% ^- M  f3 G) I0 H8 g/ F, S

  77. ) z8 [$ L- h/ t5 n' k% ]+ z
  78. static int acnt = 512;
    + k. m4 R& V# ?: t& b
  79. static int bcnt = 8;0 }7 b2 u# Q" Y% D
  80. static int ccnt = 8;3 X2 P: `2 p. w* ?) z

  81. ' A# x) ?1 U, a0 w7 `! w1 H
  82. module_param(acnt, int, S_IRUGO);
    * {* \, P1 Y" I  A) y: K- Q
  83. module_param(bcnt, int, S_IRUGO);
    4 `% M( E5 ~7 P; U* l; r' m
  84. module_param(ccnt, int, S_IRUGO);
复制代码

/ n/ s6 m8 k% T, o, {% t. `- `* O" y. l! [4 t, e
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 S5 j. v9 R3 Z) W- _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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。7 C/ j. g/ e! u
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" x! f" b, F& Y4 U  J' g6 ~- C# P2 j
* K! h3 O* x3 R2 l
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-5 22:03 , Processed in 0.039137 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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