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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 N& f2 }" U4 r# L# q0 j5 o, s" N
  1. [code]EDMA sample test application
    ( d% l" ^2 H3 v; W2 N$ V2 f
  2. /*- v+ j" w2 P, l2 r$ t- I- w2 W& w
  3. * edma_test.c, Z: g# a0 H+ F! m
  4. *
    8 s- R$ m1 t3 B3 y2 m% l
  5. * brief  EDMA3 Test Application4 G& ]4 \7 `0 o6 }
  6. *& {4 X* s( T; T& j0 O
  7. *   This file contains EDMA3 Test code.
    , s  A' S: g" ~2 {( ]/ [
  8. *
    2 B" t+ o! [9 R2 J- W  L# l+ R: _
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 p! I& w! X( A, }/ _) q
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 a$ @1 m! F  B
  11. *         TO CHANGE.8 K) a8 G$ f' i! x
  12. *
    & p4 M# A" [" E6 {) ]* U
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 W$ T5 _' [4 W* V) K2 q
  14. *
    - M  R3 d5 F9 |* h
  15. * This program is free software; you can redistribute it and/or; @8 ~. n* Q( |
  16. * modify it under the terms of the GNU General Public License as
    ( c+ [% r* s9 G( ~7 N/ z4 H9 d
  17. * published by the Free Software Foundation version 2.
    / L! S% v$ b- l( ^) K/ |) w
  18. *
    7 I$ [* T$ q1 n( r
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ! H6 ?9 N( e* X9 L9 P
  20. * kind, whether express or implied; without even the implied warranty
    5 g! q5 s/ p+ s, e' T7 U
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    $ p+ M( ^$ E9 k# n: A
  22. * GNU General Public License for more details.- a9 `2 [( y, t/ Y7 K
  23. *// i. s$ I5 W" y; V; W: W4 D& p9 ]

  24. + _; ~; a4 k* Q+ S# P
  25. #include <linux/module.h>- T/ K& T' [- y
  26. #include <linux/init.h>' Y8 s0 h; H7 Z- b
  27. #include <linux/errno.h>
    3 r7 B0 M" _4 j7 a) Y
  28. #include <linux/types.h>
    1 K5 H) F9 z" C+ h
  29. #include <linux/interrupt.h>. H, X% F9 Q& p
  30. #include <asm/io.h># v7 j. I: `% W, `3 G0 d
  31. #include <linux/moduleparam.h>
    1 H7 V6 e5 n; {6 m0 m+ z
  32. #include <linux/sysctl.h>
    ( y: n# ]. P+ w- v' t8 _& E
  33. #include <linux/mm.h>
    . T3 }4 }/ P3 N0 Y! c7 \# v6 h
  34. #include <linux/dma-mapping.h>
    4 U8 e9 ^" K5 g+ c4 E( q* X
  35. ' T# U8 e9 Z( S' T" Z" `) ^' U
  36. #include <mach/memory.h>
    8 J- o( }& Z0 r6 Q
  37. #include <mach/hardware.h>/ C, C$ b/ C1 W: V, C
  38. #include <mach/irqs.h>
      s2 ^* t, D, v6 D/ L7 S
  39. #include <asm/hardware/edma.h>" ]1 h! Z$ ^8 X" C$ A

  40. 1 ?1 ~/ l* z6 j4 W2 g7 X& N+ {
  41. #undef EDMA3_DEBUG' f6 X' i: g: d
  42. /*#define EDMA3_DEBUG*/$ o; m. x, s  o: E1 j
  43. ; P" \+ K2 W  s) I! E& p2 f
  44. #ifdef EDMA3_DEBUG
    + O- L% e) p2 e$ o2 _8 N9 x7 G5 A* a
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    - V6 [, ?4 U9 d( \' ]
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ W) ]8 b! m- C2 K1 q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)5 n- k: ?& e" U4 @* }' G6 Q! h
  48. #else
    8 _' S, u# `$ e. I: S; Y3 ~7 i
  49. #define DMA_PRINTK( x... )6 [$ M( M( O; B$ s& |- U+ N
  50. #define DMA_FN_IN! c# }$ R7 R/ V$ [
  51. #define DMA_FN_OUT# R% d6 z# U; o: C3 O( J
  52. #endif0 |4 l% g) G0 A0 w
  53. 8 `8 v/ v- z9 a: O' w1 e( h
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    # n5 A! X, P6 S& N* M, y
  55. #define STATIC_SHIFT                3
    6 T5 v- B! e% O
  56. #define TCINTEN_SHIFT               20" F: N% U) a# _- Y) G9 Q. I" y  i
  57. #define ITCINTEN_SHIFT              21# S5 H+ L- t" y6 y8 O# p
  58. #define TCCHEN_SHIFT                22
    ; \* S4 }# a2 {" k' s
  59. #define ITCCHEN_SHIFT               237 a; E8 m! n" r$ E$ S" S

  60. 8 R  R7 _- c: K6 C# J3 l5 Y
  61. static volatile int irqraised1 = 0;- ^+ U1 W, P) _: `2 [( B: h
  62. static volatile int irqraised2 = 0;5 |7 L: w; j, K, O
  63. / w* a( C' [: s: V0 q0 d: d0 o
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  g* D  [6 k; U" Z8 C6 t
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 t$ W+ ?: @! H$ }' @
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 E9 Y$ l/ _% }' s# @1 d$ O8 Y' ~7 s  m
  67. $ f: K! T5 c5 u3 T: k% s9 U
  68. dma_addr_t dmaphyssrc1 = 0;1 g1 [9 n, U4 R9 G
  69. dma_addr_t dmaphyssrc2 = 0;
    / o' W. M6 |0 Y
  70. dma_addr_t dmaphysdest1 = 0;
    ' s8 F6 D& C. ?( N8 K% _# E6 @
  71. dma_addr_t dmaphysdest2 = 0;
    8 m" k* K. l3 v6 N$ j9 l* t

  72. 6 Y2 n0 S# N7 K2 d
  73. char *dmabufsrc1 = NULL;9 E7 b; M1 b* g
  74. char *dmabufsrc2 = NULL;
    / J- {! r! D" l. s# o0 s
  75. char *dmabufdest1 = NULL;( c" w0 c! R, G7 `6 t0 Z
  76. char *dmabufdest2 = NULL;# P% }8 g4 ~5 T; b$ i6 b

  77. : x( n+ d# \/ q( r' j
  78. static int acnt = 512;
      [5 u; U  g& E6 _
  79. static int bcnt = 8;
    4 G' A: ]- u6 A  o( G1 W6 a
  80. static int ccnt = 8;
    % `4 r( d8 P4 M8 q& m0 s

  81. , }. H  Q9 _  k4 O
  82. module_param(acnt, int, S_IRUGO);# \8 Y  J# r7 o9 a/ z2 c
  83. module_param(bcnt, int, S_IRUGO);7 L2 k3 L, m) V; Q( O7 z
  84. module_param(ccnt, int, S_IRUGO);
复制代码

) M6 k' M% C& q  J+ m( K" Q! s. B
' @" C$ ?& p! V( K% B" J      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- c( f  U+ b: i, D9 z! r/ Aarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 A$ X3 }4 v; _6 e7 D' @* @
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# u* m$ z/ _. _
5 N) d6 W* A8 K  }% i  Q# L# P0 ?$ B% z+ n) i& T1 m) w
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-9 09:05 , Processed in 0.041755 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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