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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 U6 @$ Z1 a( U, q; j/ z! t
  1. [code]EDMA sample test application
    * u- V3 S6 y) }/ p! a4 t0 o
  2. /*, a/ P9 B6 r8 @) u5 U( ~
  3. * edma_test.c
    7 O! w0 {" u5 h& F! F/ w
  4. *7 r/ Y  O' E( ?/ y9 {6 H
  5. * brief  EDMA3 Test Application9 y/ H  l' ]4 y" k7 q( v
  6. *  R; S% ?9 L. x3 e. ?
  7. *   This file contains EDMA3 Test code.7 J, O5 q7 D' m& C
  8. *6 E  I/ q0 N# q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    9 K% L% D) w' q/ w
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    / T9 m% @' E( n" t
  11. *         TO CHANGE.4 @  Q, s5 f3 k# |3 D
  12. *
    ) ?- V: W. P9 e' c
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ' [3 S1 [) ^0 y+ b. ~4 y
  14. *! b3 G' c! D4 _& Y9 l
  15. * This program is free software; you can redistribute it and/or
    $ v" |- @5 P5 T3 O. m0 V( B0 z4 O: W
  16. * modify it under the terms of the GNU General Public License as6 }- m- \8 f! ]9 S  G: E9 S7 \3 H
  17. * published by the Free Software Foundation version 2.
    ' g' h# q; q) S" P" ]5 h) f: }
  18. *  ?  [0 M* H5 G& h5 P; \0 n; i7 p
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any. `9 \5 ~: I6 \- l6 d  @. V3 v; L! B
  20. * kind, whether express or implied; without even the implied warranty. X( \$ Z, U# y( e# X/ U; n7 D
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    9 ~# n6 b! B+ ?3 m0 r" ?
  22. * GNU General Public License for more details.
    , C" G( i9 j/ w. P9 y0 f. g$ R
  23. */
    9 R- v6 ^5 c" y# k1 }+ J
  24. # _- g3 W* i: {" E
  25. #include <linux/module.h>* v0 `. ]9 g4 o5 X
  26. #include <linux/init.h>
    - n4 K9 z0 E& ^" a5 n' T
  27. #include <linux/errno.h>
    & P% B6 W' h( E# o  Z
  28. #include <linux/types.h>- s: x( ]( t- v# H
  29. #include <linux/interrupt.h>! l% Q4 ~9 r* A& H- ^& C
  30. #include <asm/io.h>% V3 n9 E! ]3 V  |
  31. #include <linux/moduleparam.h>
    4 {( f3 W- P) E5 Q
  32. #include <linux/sysctl.h>
    / p; ~. A6 j9 N! M
  33. #include <linux/mm.h>
    % j9 s4 b. j* o
  34. #include <linux/dma-mapping.h>
    1 g' A; }1 L+ a1 r& h9 x! j! t
  35. % X3 G, Q# D$ V& R' F
  36. #include <mach/memory.h>" ~+ e1 o; v- x* O9 C6 m
  37. #include <mach/hardware.h>
    0 k; a8 K) @( G' I
  38. #include <mach/irqs.h>
    8 F: Y6 `2 T5 O3 g6 _* F- I/ ]
  39. #include <asm/hardware/edma.h>
    * i' ?8 a% ]+ k  P! s. x

  40. 3 n$ }/ U% A+ Y+ C) v- B. n
  41. #undef EDMA3_DEBUG
    # o$ A1 z+ Z2 l3 [4 \: R
  42. /*#define EDMA3_DEBUG*/% d5 Y* a0 f4 z4 i# G! B; G. P5 e
  43. : p9 m* a/ D$ l! o
  44. #ifdef EDMA3_DEBUG
    8 s9 P2 ^9 ]# B
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" [  x; i5 y( J! D; Z
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): x* c, F0 b: R
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    2 g( P( y. E: u0 {: @/ M% \
  48. #else
    / k* r' N# I: Z
  49. #define DMA_PRINTK( x... )
    ! d/ E0 w1 X0 t4 ]5 j7 c
  50. #define DMA_FN_IN
    + V/ S9 v* D) b
  51. #define DMA_FN_OUT
    " D( w. Q  g8 R/ P: R
  52. #endif
    ! V9 d& D3 D' ~- j$ ^0 v; O" u  M9 q% z
  53. 2 ]1 R) U% [, j
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    7 z" V8 q9 |# {& N# w
  55. #define STATIC_SHIFT                3
    0 e3 }' v9 v" y8 a
  56. #define TCINTEN_SHIFT               20
    5 H4 a6 k/ \  \6 `/ g) B- j+ r
  57. #define ITCINTEN_SHIFT              21
    4 d" m. N/ @% |/ p0 I( l
  58. #define TCCHEN_SHIFT                22, B8 v+ @6 U. x( }; s1 I
  59. #define ITCCHEN_SHIFT               23: U0 B( \. e, r* a* P* @7 j! I) h( f5 m

  60. + r6 ~/ H7 `6 f7 j( V( o
  61. static volatile int irqraised1 = 0;+ w1 r8 N7 s. e4 x
  62. static volatile int irqraised2 = 0;
    1 V  K9 q. m3 k7 Z3 C

  63. 1 c5 V% ~) `/ W2 Q$ a' a
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! c8 d1 F) Z  z
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 H3 r8 v+ c9 ^; C3 H7 |
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" H6 W" M! s' E, z5 ~

  67. . L  u3 s5 p+ _' j- ~% Q. F
  68. dma_addr_t dmaphyssrc1 = 0;$ {% z- n: G$ H0 K( i1 A, U" W
  69. dma_addr_t dmaphyssrc2 = 0;
    7 O) E! A/ j2 }+ V
  70. dma_addr_t dmaphysdest1 = 0;
    4 h- y/ e2 N6 n8 d& ]8 P2 t
  71. dma_addr_t dmaphysdest2 = 0;
    " }/ E, I& \# G& a# a3 l
  72. ( L# w7 L9 B0 V
  73. char *dmabufsrc1 = NULL;0 `7 k( z! {; I& x0 v
  74. char *dmabufsrc2 = NULL;- C5 `; q4 W3 }2 ^( u0 j
  75. char *dmabufdest1 = NULL;5 U+ u$ k2 V. o% L' B1 P$ P. `- ^
  76. char *dmabufdest2 = NULL;
    5 e' m/ }+ Z( ?/ c1 S' G9 K

  77. 2 Z- E$ u  I  o5 O/ R" i- g
  78. static int acnt = 512;
    6 v! B4 A6 J& _
  79. static int bcnt = 8;
    % ]9 j( c$ |" a5 E$ {
  80. static int ccnt = 8;
    ! P2 v/ z7 }: J  }3 V! d& W  N

  81. 5 B& p9 |  f! Y' D
  82. module_param(acnt, int, S_IRUGO);' ^8 m2 `$ J( u, f
  83. module_param(bcnt, int, S_IRUGO);8 B! \: U; U' {( Y
  84. module_param(ccnt, int, S_IRUGO);
复制代码

& [9 B! U' b& O1 H( v" V
/ h0 i9 u# Y6 t1 z! j      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ x9 ?* c+ O; r9 W' L; o# |4 V
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 v0 }7 S) t% C6 F1 U& ~- e
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 e/ L5 F! T, g' e7 M
+ X  x- J9 X6 `7 Y8 [: C$ S8 Y. e% T! q/ Z. ]; g
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-7 06:44 , Processed in 0.038887 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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