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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : P  m  n9 Y7 ]. x, e$ R- @: w. Q6 g
  1. [code]EDMA sample test application$ a5 w4 g0 L$ E; E  @
  2. /*
    ; \* s& [3 h  J( ^1 V5 w! b, O
  3. * edma_test.c
    + J0 N2 t- I8 R7 H) s
  4. *
    7 p6 m9 [: x* s( Q$ Q
  5. * brief  EDMA3 Test Application! n; b( |5 z  M, L+ B' K! v
  6. *0 w" _4 ^& W9 y" M7 D
  7. *   This file contains EDMA3 Test code.$ C; o3 \% f# |
  8. *
    ) _3 T8 `1 o$ F3 g7 v/ K
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ( x: q( ^! u0 ?: \  t. X
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 h0 C' }0 V" O+ Z% l5 S
  11. *         TO CHANGE.
      D, W8 c7 i: F& E
  12. *
    : L  g) J. |6 R$ i+ _. U& ~
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    / k' i8 I8 R0 W6 v/ b) r3 o
  14. *8 \4 v" W. W6 T/ M0 K" C/ K
  15. * This program is free software; you can redistribute it and/or
    , A; |1 l& a: g: Q- l' X
  16. * modify it under the terms of the GNU General Public License as9 ^/ d3 \1 V. H3 _/ d
  17. * published by the Free Software Foundation version 2.
    " x' l7 w( F: N, g8 C: q: k
  18. *+ B: I' W  g! [4 q6 h% R
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any. w. q$ F% r( c8 B1 u2 ?$ Q7 ~% m8 k
  20. * kind, whether express or implied; without even the implied warranty
    ) ]* o: J2 m. j- U5 s
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the/ d4 U0 X2 C+ K: d: P9 C
  22. * GNU General Public License for more details.4 [% ^$ C( ]: u7 x: p6 @* o
  23. */
    5 Z0 q' n2 l$ H. V3 x, A' G( M. p
  24. - j* S$ Y+ ^6 s5 b/ J
  25. #include <linux/module.h>
    * E1 W8 v# n% ]6 g
  26. #include <linux/init.h>; \, K7 S6 H" w4 h% h! ?, m2 i
  27. #include <linux/errno.h>
      T" Z9 R0 Y- A$ b9 y
  28. #include <linux/types.h>  w2 Z- Y/ t. I) ~: q1 a0 ?5 P* I
  29. #include <linux/interrupt.h>( X0 N$ l+ j: |( t! _* b: C7 p
  30. #include <asm/io.h>% ]4 l; C' }8 N
  31. #include <linux/moduleparam.h>
    ! |3 P2 e0 p0 ~+ f+ ?  t
  32. #include <linux/sysctl.h>
    " r/ {# X2 }; i" r# M* ~
  33. #include <linux/mm.h>
    6 A" a8 j; j! D6 u5 Q' V& A9 U
  34. #include <linux/dma-mapping.h>* V) d+ d* W! U& i/ r% J

  35. 6 ?3 O! O! z4 m: y" Q+ @! }
  36. #include <mach/memory.h>2 k4 s, ?: u% q( }' |7 p1 C8 ~
  37. #include <mach/hardware.h>
    ' I! i$ a' A3 U4 D
  38. #include <mach/irqs.h>* K* q2 D9 {& ^- k
  39. #include <asm/hardware/edma.h>
    6 w7 _# V7 L( @$ F5 w/ r8 `

  40. 2 n- l4 v; v& G
  41. #undef EDMA3_DEBUG; m$ U  ]9 a& f( Y  ?6 Y7 V# `
  42. /*#define EDMA3_DEBUG*/, k$ O  ^5 ]% P' ^! V; a  Y% I6 i
  43. 9 D& e+ y1 V' B7 a# r- L1 ?% j
  44. #ifdef EDMA3_DEBUG$ ]- }& d% c( m7 L
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)9 ~# M& h" U; x- G- Z; D
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 }; {. v$ h9 r+ w. |' t
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)8 u& F- Q# }: d; \. J% ]4 n( q
  48. #else
    6 F) Z: U4 @8 b, _$ [* b8 m2 r9 w
  49. #define DMA_PRINTK( x... )
    7 Y3 U: h- I4 `" u3 `0 S
  50. #define DMA_FN_IN5 t5 A' K% B2 }' N+ U+ S
  51. #define DMA_FN_OUT
    , F  m% _2 Q) r% ]( P
  52. #endif$ X. r3 R* u* g/ T1 m8 [/ B

  53. ! u/ D8 T: A: l- f
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ( I  H) a/ o7 O6 h+ o
  55. #define STATIC_SHIFT                3
    # O9 w- @1 Z" L
  56. #define TCINTEN_SHIFT               20) M1 a# a9 E* B# A- [
  57. #define ITCINTEN_SHIFT              21, M  P! ^1 N. ~3 A
  58. #define TCCHEN_SHIFT                22$ v, g$ j* ~6 n! N8 x8 W
  59. #define ITCCHEN_SHIFT               23
    0 Y5 }7 V& u+ K( R3 X
  60. ' b$ i( G" P0 T+ ~8 c3 o
  61. static volatile int irqraised1 = 0;
    ! F# m7 r* m1 S: T$ U1 H
  62. static volatile int irqraised2 = 0;
    - _4 G4 E/ x( q! {/ y) Y. Q

  63.   x4 ~$ ~2 x4 d4 ]. k! S) X1 r
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & z" D# ]' f7 W* G. t5 C
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- q. r2 Q. X. m" J9 b) }
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  k4 ~: L9 R( H

  67. 9 \/ A0 D  S( T( G$ x
  68. dma_addr_t dmaphyssrc1 = 0;
    1 h3 C# x+ V- H" [* w5 x
  69. dma_addr_t dmaphyssrc2 = 0;
    2 l4 ^( \% v6 H$ ^3 i4 \
  70. dma_addr_t dmaphysdest1 = 0;$ A) a$ O6 Y% p  e1 D+ b% L1 a. V
  71. dma_addr_t dmaphysdest2 = 0;7 V% w& }; u; k/ n' b" p0 K6 e

  72. # f2 p5 O" C( R& g
  73. char *dmabufsrc1 = NULL;
    # w1 o  S( K/ u2 ]
  74. char *dmabufsrc2 = NULL;
    9 r' [5 \) z4 D6 @$ F
  75. char *dmabufdest1 = NULL;
      _9 y, A% u. @. |4 R1 b
  76. char *dmabufdest2 = NULL;5 N9 c8 }) b/ {2 W9 n+ j; S

  77. * V! b# F! D. X" o! L# {. q
  78. static int acnt = 512;
    8 m! a0 p4 Y. L& D, h4 G
  79. static int bcnt = 8;+ w5 c2 ^5 h4 N+ t+ ~- C  W
  80. static int ccnt = 8;
    + V3 `) T) H& o9 g; V( s

  81. , Q; x1 Y- W  I! V/ F
  82. module_param(acnt, int, S_IRUGO);
    / f) {. T0 h) G  D
  83. module_param(bcnt, int, S_IRUGO);8 W5 p) k1 A8 c+ n
  84. module_param(ccnt, int, S_IRUGO);
复制代码
2 Q( A% d" Y/ A2 N/ E  A9 D

. [' b0 g6 W7 W      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) S- c& }3 z" qarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。2 l% ?6 X8 R" @+ c' Q
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。; [/ b1 a* U, t8 e
5 U8 z( H7 b) N, P! N; d$ V

: q4 Q& ?; X3 q) P
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-11 11:20 , Processed in 0.038885 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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