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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * D6 V- m" p- f0 x1 I" K$ J' n5 A
  1. [code]EDMA sample test application! m2 n6 Z( p! `, a; S' f; J+ X  @. h
  2. /*
    % o/ l# d" z# B1 x" J7 B
  3. * edma_test.c* y* ?0 B4 ?1 z4 S8 \  B7 o* V
  4. *
    , _# C7 O+ |+ g% G# Q' M
  5. * brief  EDMA3 Test Application0 t7 A8 T! k* L% D5 H7 r$ u
  6. *
    ; v! E6 s7 a( {2 u
  7. *   This file contains EDMA3 Test code.  B& _' n) ^* L& J) K# C
  8. *7 g: Y$ s0 M+ c5 @
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    $ J& m% p. }5 g6 L! c. p1 Y, k
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* L& q' Q3 {* M/ x0 q# n. f3 S
  11. *         TO CHANGE.3 d5 I4 u7 o/ Q- P! n4 w0 P- j
  12. *
    $ I; H4 ^% G$ ?  F, p* B
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    7 K1 Y0 T9 Q4 T% E' O  O' }" t
  14. *. A: F* Q3 d, X9 Z& h1 }
  15. * This program is free software; you can redistribute it and/or: J( Y. R( m  K- U& a' e
  16. * modify it under the terms of the GNU General Public License as
    . \/ J4 U: M; C8 g. P6 p
  17. * published by the Free Software Foundation version 2.( U$ p( l9 `9 R" d8 n' M
  18. *, f, r' R6 @8 L& `( D  @
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    6 N. {" n& d) P0 m# v: B
  20. * kind, whether express or implied; without even the implied warranty7 g, x0 A2 f, K, C* I: X
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      i% u5 s9 Y" r$ x) ^' Y+ h( A
  22. * GNU General Public License for more details.2 Q3 D$ R) O- u* E6 O9 z3 U
  23. */3 B1 t# W6 U9 |' E0 [+ X$ q

  24. 1 j  j8 D. F5 ^' t, g1 @
  25. #include <linux/module.h>$ ?# U# U8 p& v$ V
  26. #include <linux/init.h>4 x8 P  B% W" E- A
  27. #include <linux/errno.h>
    9 b' Y2 v( m5 Y* q% u- ~
  28. #include <linux/types.h>
    8 M. t4 r+ H* V
  29. #include <linux/interrupt.h>
    5 y- B$ Y4 ]7 I: P& I" z% ?
  30. #include <asm/io.h>8 v3 L. k) ?5 f8 _- Z
  31. #include <linux/moduleparam.h>
    / N1 ?  u7 t7 L+ g5 v
  32. #include <linux/sysctl.h>
    4 o5 ^% B1 V) I9 A
  33. #include <linux/mm.h>- S( u  h( Z; E" R
  34. #include <linux/dma-mapping.h>/ i% q1 h4 y7 M$ Q, R' l! q/ y

  35. 4 L( S2 u; h" M. }% u1 w) s
  36. #include <mach/memory.h>
    . D5 C# }% O% c7 n+ t
  37. #include <mach/hardware.h>
    ; V; z5 e* a' b6 I' v6 |$ ~
  38. #include <mach/irqs.h>3 r  b% g1 |& D1 D8 f
  39. #include <asm/hardware/edma.h>, S5 k+ B" p; D: S

  40. ( [- \) z: f" y% |2 ~
  41. #undef EDMA3_DEBUG
    # i5 W# C& `3 a" b5 X+ U
  42. /*#define EDMA3_DEBUG*/& Q/ e8 [2 o) V% Y! f" t/ E( Y# \
  43. - L5 d* P5 {3 l- Z% f1 z2 T) w" l
  44. #ifdef EDMA3_DEBUG
    . X( F/ h. d+ R
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    9 V4 e* L; n* D8 \
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 g1 ?5 A6 R8 N! y1 j
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): J* A$ C+ f% s7 d1 _! K
  48. #else' A) `* ~1 c% E( c
  49. #define DMA_PRINTK( x... )
    1 o* a* c4 [$ P+ D$ W# p+ u* F  o, h
  50. #define DMA_FN_IN' `$ {3 [1 Q, y# a' A
  51. #define DMA_FN_OUT
    : F( e; H* C5 [& ^: `6 y
  52. #endif
    1 r2 b5 l/ l& w) ~# m$ R! F
  53. 9 H3 h  Y4 s5 }: a2 C8 M
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)- f0 f. D5 }0 l( G  c
  55. #define STATIC_SHIFT                3
    $ j1 c# ^) P" ~- P9 H% D
  56. #define TCINTEN_SHIFT               20" z5 O5 U* R: m' g
  57. #define ITCINTEN_SHIFT              21; B5 \9 ~; d2 h( O/ y
  58. #define TCCHEN_SHIFT                22
    8 O+ a' U0 z+ M- U' U
  59. #define ITCCHEN_SHIFT               23
    8 x, j  g7 c' E- U9 W

  60. : g8 q  S: {3 v; {0 l
  61. static volatile int irqraised1 = 0;: x# @% `* b8 l1 N
  62. static volatile int irqraised2 = 0;
    - Y2 J0 r# D1 F% F

  63. 6 D( {  C' m% @7 C4 X4 ]
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ T1 B- q$ ^' K, r/ T8 Z( v
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 K' c0 e  L6 `7 f4 b8 D7 |* i$ `
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # ]- o! X9 v8 F) |9 ]% _+ c

  67. ' c# b+ J) r5 `" ]9 c9 E# ^; @
  68. dma_addr_t dmaphyssrc1 = 0;9 L6 U# j0 G0 X' D: ?- N
  69. dma_addr_t dmaphyssrc2 = 0;
    ( s; `2 \2 l9 T, y- l" [; v
  70. dma_addr_t dmaphysdest1 = 0;
      l3 c8 o7 L  I) ~' l
  71. dma_addr_t dmaphysdest2 = 0;
    / S5 l' P( w3 r4 {7 P
  72. + X) @2 Y8 [8 {5 {* u* r( V4 T, O" u
  73. char *dmabufsrc1 = NULL;) B7 Z  S. U" e5 E/ Z, Z  k
  74. char *dmabufsrc2 = NULL;7 d! d3 u! l! V1 ^+ I" v# M7 [
  75. char *dmabufdest1 = NULL;# Z0 Y/ F" ]9 r. U
  76. char *dmabufdest2 = NULL;- m1 _5 l+ S/ Z& p$ e" S; t3 O/ w

  77. $ e, Y9 u! O1 V! i! |; M
  78. static int acnt = 512;
    8 |; H. M/ p: M8 m8 D
  79. static int bcnt = 8;/ h, V+ O0 I5 D1 T% d
  80. static int ccnt = 8;* Z7 e+ y1 G8 C# K

  81. 8 L: A, H8 v& v+ g! o- }2 w
  82. module_param(acnt, int, S_IRUGO);  ?7 }5 f7 T, Q! W9 f
  83. module_param(bcnt, int, S_IRUGO);2 {$ ^& h) S( {) A1 y) N! U
  84. module_param(ccnt, int, S_IRUGO);
复制代码
5 l$ B4 q" R( _6 ^

! \- d* p( `; Z- [( t8 l      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 K6 M% H* S& 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! s9 a( M/ u7 p3 Q" S7 {
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 L' W: C3 f; c6 `1 V% m! O: j- V
$ r% R: B# t: Q7 o- O7 A  G1 B2 f' g
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-31 07:26 , Processed in 0.043383 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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