OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . p: R  q3 }* n1 `
  1. [code]EDMA sample test application
    - f) o7 M: K1 ]* ], T
  2. /*
    ; ^# l" a! M2 t" ^$ X
  3. * edma_test.c
    8 W3 v. v% j* ]% I3 K) u  K, [$ R) J+ E
  4. *
    ! M8 X3 `" a3 ~. M+ ~
  5. * brief  EDMA3 Test Application
    & n; s6 A( T  _. j7 J% S" E
  6. *
    6 x( ^3 K* i( K' Q+ B, E/ N; |
  7. *   This file contains EDMA3 Test code.
    , n% t; J7 s, J0 L
  8. *
    ; R; [# \9 K: |1 N0 O# U/ M: P
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
      H% F( a7 \6 K
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    $ u/ }, E: }8 [: i# L, N
  11. *         TO CHANGE.3 D. i+ c% v7 O# g5 ^# a
  12. *
    - X" x# t/ m0 ]4 @* R0 `
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ j0 X* M' {1 c0 `! k* I
  14. *
    ( ]- i1 K& r; e
  15. * This program is free software; you can redistribute it and/or5 i% E; b! P7 Y- s. V5 p
  16. * modify it under the terms of the GNU General Public License as
    ) I3 I% I- e( J- }* D2 S; H
  17. * published by the Free Software Foundation version 2.
    ! j& z9 u5 o  I$ Y4 e8 g( \  i
  18. *
    " w% F6 y  @4 M' |
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    4 e. g+ O2 f6 R; u; @( a3 `
  20. * kind, whether express or implied; without even the implied warranty
      X; ^4 Y8 p% t% h3 J& f
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    + s2 c" e5 X$ L+ l5 P* I
  22. * GNU General Public License for more details.1 S& e8 x. l; E
  23. */( P' K8 A) R& L1 i, I4 f
  24. $ u: {$ j  ^; U; Z  K# r7 g
  25. #include <linux/module.h>
    ; K& I, ^6 E8 [# b* z7 C
  26. #include <linux/init.h>
    ; C) H- ~* a+ ~" N' z
  27. #include <linux/errno.h>
    + b) q, F$ V2 A- A
  28. #include <linux/types.h>
    . O' G; {& `) ~7 \+ b2 c
  29. #include <linux/interrupt.h>. q; N  |' p; o- U6 ?, e/ b3 o
  30. #include <asm/io.h>
    ( B: i% Y) D' t' Y& J$ z
  31. #include <linux/moduleparam.h>4 j4 N: A2 c; W. F8 K8 G, \
  32. #include <linux/sysctl.h>* w) x: U3 X, o3 i
  33. #include <linux/mm.h>
    . j. s* g7 j1 ]$ z# m* g* c" f
  34. #include <linux/dma-mapping.h>
    ! t: i4 H( V- K( a$ x
  35. 9 m/ e. ?/ H3 N. O9 D
  36. #include <mach/memory.h>- X0 @6 k+ a6 E5 |
  37. #include <mach/hardware.h>+ v! z2 g/ B) k* e& d" T$ c
  38. #include <mach/irqs.h>
    # ~  G) F) b2 b: Z, h
  39. #include <asm/hardware/edma.h>, L5 z& P- W3 }! o* I7 g% ^
  40. . @: `: Q- u. @) S$ |2 a+ \
  41. #undef EDMA3_DEBUG
    + W7 x, }% W" O8 R: W
  42. /*#define EDMA3_DEBUG*/
    4 ~3 u5 C/ M  T% V- f- D
  43. 8 o, {: ^+ O7 ~/ \
  44. #ifdef EDMA3_DEBUG
    # C+ p0 V" i5 Z, V3 q
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 M' _3 ?& H- n% Q$ {1 w
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ P; ~& J1 A& o( ?4 M* O
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( T) v+ }, n% \/ X4 `! z1 H+ X- x
  48. #else
    5 l1 F( B  x& A* S9 C# L
  49. #define DMA_PRINTK( x... )
    1 L4 m7 f" k+ z2 H
  50. #define DMA_FN_IN8 t4 m, q2 }0 u
  51. #define DMA_FN_OUT" y# g! V. W: ?
  52. #endif
    . K5 P$ r( [$ w, j, T" C3 G! _

  53. ; a8 K7 E0 z4 x3 |  ], j1 h
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    , I2 E2 F" \( E) _
  55. #define STATIC_SHIFT                39 \: r" W. W9 O4 ?8 [
  56. #define TCINTEN_SHIFT               20
    7 g& Z9 Y1 o5 k7 x9 k- G7 m9 }% j
  57. #define ITCINTEN_SHIFT              214 n+ T: O" w) W  X- g' h7 L4 N$ }
  58. #define TCCHEN_SHIFT                22& y' ?/ E' x5 e2 t
  59. #define ITCCHEN_SHIFT               23# r  z. ]. |0 [4 F

  60. / r. L, S. S6 T, F
  61. static volatile int irqraised1 = 0;
    5 F1 Y# }: m% [
  62. static volatile int irqraised2 = 0;
    & `7 Y$ {; f7 J6 P" b" l
  63. 8 C8 v6 t( {! x4 n
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; A: n* K- J/ X) Q) e4 O: l
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " U; C6 ?3 o& B- Y) u
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! t0 z  W9 X4 F0 M

  67. ) u" F+ d9 {- O4 d  c. t
  68. dma_addr_t dmaphyssrc1 = 0;5 Y6 J$ n2 ]- Q0 {( T. J: Q
  69. dma_addr_t dmaphyssrc2 = 0;
    - D  ^" K/ {2 F" \; D. {$ H1 i
  70. dma_addr_t dmaphysdest1 = 0;
    : V* C7 ]" M! ^- L7 a
  71. dma_addr_t dmaphysdest2 = 0;
    ; n6 g3 M, |( ?# K" R% y4 o
  72. 9 |" w" G* B+ w% ]
  73. char *dmabufsrc1 = NULL;6 G; M8 g! J9 Q5 u: C% V
  74. char *dmabufsrc2 = NULL;$ l( _( @0 ]! y" B2 Y* f1 M# R0 ^
  75. char *dmabufdest1 = NULL;
    ! J# {& Q; l: X: i4 b+ U
  76. char *dmabufdest2 = NULL;
    ( ~- l$ p4 s+ F" z& X3 j$ X! v# X0 X

  77. - J/ l5 \. v# M! e! E8 y
  78. static int acnt = 512;
    4 w) n- [7 |/ h4 E! x
  79. static int bcnt = 8;
    1 Y- a6 \6 C( k2 f' d, Y5 q- D5 [4 M
  80. static int ccnt = 8;: Z$ b$ w6 q: w) Q

  81. + E2 U, G0 B3 I# J0 J  w. g5 |# h: ^5 C
  82. module_param(acnt, int, S_IRUGO);+ F; k4 `8 G+ i$ ], f; w" `
  83. module_param(bcnt, int, S_IRUGO);- ?; \" Y9 X% t3 [
  84. module_param(ccnt, int, S_IRUGO);
复制代码

, \. s1 A$ }/ x' y) H
: ~0 y2 @- ]" s) s6 a: Z+ B      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# ^, K( R( A; H6 A
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* x/ T4 p9 @# P5 P0 K5 ]5 i/ s; d
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( {  z& K: M7 Z+ Z: r2 d$ j# h4 ]% Q7 F* ?
0 ?& T5 P, o+ `' K- T
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-3 15:08 , Processed in 0.037932 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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