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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 \# ?% \  l0 l% X, {4 f$ o  d
  1. [code]EDMA sample test application/ y# ~& D! f! ~: t8 P3 |
  2. /*
    # v/ C. w5 y/ S# ?6 E. Z# B* ?5 x
  3. * edma_test.c" `, a% Y; `4 {. f% K, ?4 J- {) ~1 a
  4. *
    8 S) R6 H  `; e% `; i, v* `/ s
  5. * brief  EDMA3 Test Application
    8 O4 N, f! Y" g6 w. ~  C; F
  6. *8 U! N" W% r) D3 P$ P
  7. *   This file contains EDMA3 Test code.
    : l2 i$ U6 U. b" N) O
  8. *
    ) ~6 [7 F: i! D
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ ]! V6 Q. h% m1 B( V
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    4 K3 K- d- L  z) b4 A4 H
  11. *         TO CHANGE.2 n8 A- M/ B$ y
  12. *
    ' E* ~( v% y" c4 V) T
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    / E, d6 B3 L+ M0 n9 T
  14. *
    $ e: U7 t% _  ?; S5 }/ H; _
  15. * This program is free software; you can redistribute it and/or
    1 O7 ^& S# ]: e( s
  16. * modify it under the terms of the GNU General Public License as7 O$ S) [. M# |
  17. * published by the Free Software Foundation version 2.  ?3 A- [8 P. R1 B
  18. *
    6 Y; B( Y- X- ~6 L" M/ j+ V: r
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    / P) N  w- h1 o, I8 z# ^
  20. * kind, whether express or implied; without even the implied warranty
    2 Z1 y& j  ^+ U/ M- m) Q6 l
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    . J# n' c5 h9 `
  22. * GNU General Public License for more details." ^* v* `0 G4 P  z6 E
  23. */
    # f, _) i0 i7 T- d/ S4 b9 L

  24. 3 ^. Q! i5 a" C. J* S
  25. #include <linux/module.h>1 D4 ~: T- L. x) H& k
  26. #include <linux/init.h>. J" q: R1 [- r+ z6 s
  27. #include <linux/errno.h>
    , }$ {' }3 @1 K' _$ ?! w! Q7 ^8 a
  28. #include <linux/types.h>- A9 h( r: F. c5 L6 x/ R0 s+ x
  29. #include <linux/interrupt.h>) q& C" {- @2 v, \5 x: w
  30. #include <asm/io.h>
    8 \7 C4 G* ?' t5 Q! _& X
  31. #include <linux/moduleparam.h>
    * }5 X+ b0 y( d
  32. #include <linux/sysctl.h>
    4 [/ k6 ]- ?4 [% ?( ?  ]
  33. #include <linux/mm.h>% F7 ^# L# x6 t& f4 u) ]
  34. #include <linux/dma-mapping.h>
    3 C" r1 o' s! ~9 N" \! F! R' }3 y
  35.   [# C8 `4 F/ C
  36. #include <mach/memory.h>
    ; z/ a/ J0 K8 e/ j  d1 s# Q
  37. #include <mach/hardware.h>7 Q* n. |8 k) k
  38. #include <mach/irqs.h>( H2 i- x3 b) s. A/ S9 J
  39. #include <asm/hardware/edma.h>$ Z# E1 y& W* @8 l. v  M) r
  40. $ S! X+ K1 A: H+ Q
  41. #undef EDMA3_DEBUG, r: _' D# }. m: w: c
  42. /*#define EDMA3_DEBUG*/( j. h( \# U& R# v" }
  43. 2 \) ]" {: p& E% q8 L8 @2 d
  44. #ifdef EDMA3_DEBUG
    : P2 L! y$ `- a! K' C- V
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ; Z1 D3 n- T% ^! F7 F6 k4 C
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    " Z' o' S% |3 R3 Z2 p' ]
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). {8 `* d6 ~+ w, \' z. {3 t
  48. #else- v8 Z: H( g0 d( M& s( {  F% a
  49. #define DMA_PRINTK( x... )
    5 s) t8 r" ^& a0 e- d2 T, M
  50. #define DMA_FN_IN
    - J- ^; M; g% L, ~- }0 O
  51. #define DMA_FN_OUT! @7 ]. T$ \  Y9 {8 K. ~
  52. #endif( q2 ~( a0 Q" J, E6 \  k/ |
  53. & @: S# y. }: S
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    + L% E- R/ Z* ?  h4 a& z* h
  55. #define STATIC_SHIFT                3& ^( S& X# i/ {! {; s9 r+ X
  56. #define TCINTEN_SHIFT               205 s: S; G5 h. K9 d3 c( L7 Q
  57. #define ITCINTEN_SHIFT              218 i0 F/ k, r8 {9 {' l) A# h- z
  58. #define TCCHEN_SHIFT                22
    8 {5 [) d# X7 V+ v' x
  59. #define ITCCHEN_SHIFT               23' o' G: ]+ q$ e

  60. & M8 Y% i! }' l7 f" Y
  61. static volatile int irqraised1 = 0;
    . W4 n8 n: J6 M) B: ^* h
  62. static volatile int irqraised2 = 0;9 Q7 {* b# _; Y' v% h+ I
  63. & ~+ ]! e) ^8 [' D
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # H5 K  E6 v  C( h  B5 e; G
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 S# T# |4 P& M4 h5 A0 j" k
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 P& N7 h* l! ^: C* W

  67. 7 S& c) L; q( ?( }
  68. dma_addr_t dmaphyssrc1 = 0;8 D( L) O( U- o, N7 K! z% F8 r% c
  69. dma_addr_t dmaphyssrc2 = 0;
    ( \2 L9 o6 X. v  v/ Z: O
  70. dma_addr_t dmaphysdest1 = 0;
    ( G5 N6 D3 g3 g2 N( S3 z  N+ Z/ }: W) s2 B
  71. dma_addr_t dmaphysdest2 = 0;
    * u/ j, Y) f  P: a, I( c  H( D; J/ l
  72. ) \9 Q) q( n+ \7 w! I
  73. char *dmabufsrc1 = NULL;  M6 R( F" `/ c4 [! P6 U
  74. char *dmabufsrc2 = NULL;. ~0 N" z, x: R/ U1 v
  75. char *dmabufdest1 = NULL;
    7 I# l2 ?  k! @/ h( V+ G# V2 [0 B
  76. char *dmabufdest2 = NULL;
    + g" [" ]0 G7 k7 x0 l7 g5 N
  77. 8 [) I, Z5 F7 B9 u- G0 Y  r
  78. static int acnt = 512;
    ; I4 b! ]! h, y3 L( k
  79. static int bcnt = 8;( ~% H4 k! A& j& S1 k
  80. static int ccnt = 8;) e. }( l' f' Q; b1 K' P/ f
  81. 5 z3 n7 @; q, Q$ y
  82. module_param(acnt, int, S_IRUGO);
    $ J6 Y% @  _% e. B1 g7 d, F! Y
  83. module_param(bcnt, int, S_IRUGO);
    ' h! L1 P' q2 J$ ~7 r1 x
  84. module_param(ccnt, int, S_IRUGO);
复制代码
# r$ j' L! D. \9 ^
: J4 Q9 j: G, w: Q+ i4 K0 s& F
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ f7 n# x; Y5 Q! d# _
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 H7 J- l" D" V     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* a' Q+ d! U: _1 |6 P7 \; F8 h
" V+ P! b/ T, i) B
& C& S5 d& Y+ P
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-18 17:29 , Processed in 0.040469 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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