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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! U; p% R) z, k4 e; d
  1. [code]EDMA sample test application- D; X% \7 Q) s2 \% u* c
  2. /*( ]) z6 u- ~' ?. o0 D! o2 h
  3. * edma_test.c7 t' U) O9 Y- U9 ~3 H2 L0 T
  4. *. r2 @' I' F7 R
  5. * brief  EDMA3 Test Application0 Q5 X1 g' s% D( R' R+ D
  6. *7 V. H6 h5 }3 j
  7. *   This file contains EDMA3 Test code.
    0 @+ A5 X/ y6 }4 @& R
  8. *3 v8 i, f& M* x2 C7 ?" M% M8 \
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    * {6 T+ y+ h0 w5 \- i
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' e& J! ]7 F- a9 Q
  11. *         TO CHANGE.
    * f5 z; s/ m4 t8 Z( W. {5 W( t
  12. *1 ^3 x5 ]: J1 m
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 ~3 ~3 `7 J1 Y' O, a
  14. *, n+ @+ L" k) |- z; b" D
  15. * This program is free software; you can redistribute it and/or8 Q4 }0 P2 x- B( v* ?5 T
  16. * modify it under the terms of the GNU General Public License as
    ; s- e# S- g! f5 n* D/ Y
  17. * published by the Free Software Foundation version 2.
    5 K$ G' K3 Z2 F% h
  18. *
    ' X7 F3 G% f2 B, s9 k
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any' b; j% x4 [; ]8 o6 r( |
  20. * kind, whether express or implied; without even the implied warranty
      T4 q( p: J0 O
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the' W7 v8 s, i  o4 o
  22. * GNU General Public License for more details.$ q3 @( h; f2 I9 E
  23. */
    6 \, j" f0 `; u. l1 }7 Z0 z* T( j( ]
  24. 0 a: X7 ~. m$ S
  25. #include <linux/module.h>
    ( ^/ ]8 p3 o7 M. l9 f/ w! b
  26. #include <linux/init.h>
    2 U& z& f2 D+ d' E( @2 R. O
  27. #include <linux/errno.h>
    ; ^/ i2 A' S4 u4 `7 e4 z
  28. #include <linux/types.h>
    % G! D1 _. |- l: F. V
  29. #include <linux/interrupt.h>9 K: x+ X2 D( |: y5 z: x8 F
  30. #include <asm/io.h>
    2 h6 D, a# |" a' @8 K# u
  31. #include <linux/moduleparam.h>) m6 \; t, Z2 w# I2 L
  32. #include <linux/sysctl.h>: i4 G1 a: P& S- g4 [
  33. #include <linux/mm.h>9 T! B' h7 P* C
  34. #include <linux/dma-mapping.h>4 n0 T8 {% P: l! c# E" n& j

  35. # b: |8 m+ c$ h9 _7 e  w
  36. #include <mach/memory.h>
    * G0 ~+ ]7 |& _, f5 m, N
  37. #include <mach/hardware.h>
    4 O: `; R, l5 K) g/ r
  38. #include <mach/irqs.h>
    " d; H, ~: u# h8 H2 i
  39. #include <asm/hardware/edma.h>: r9 q  m; Q! N0 U* b
  40. ! a) N* y6 F6 u; }4 f4 i
  41. #undef EDMA3_DEBUG# K7 c6 y3 z: h/ T5 t
  42. /*#define EDMA3_DEBUG*/( O) V2 ?) A' b/ m# D

  43. 8 [3 T5 g6 r. Q0 m
  44. #ifdef EDMA3_DEBUG
    ! X8 p5 _! k% T1 A) e+ t- Z5 B
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    + S! w( W# C, H$ |
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ( a: K$ G; T3 f' D4 u1 z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)% m+ E8 J# L/ `! x( u
  48. #else' x0 c' ]/ I. V" V+ h& |
  49. #define DMA_PRINTK( x... ). \9 s4 e/ t( i% E5 d
  50. #define DMA_FN_IN' o: @% K9 G( R1 c4 |/ p
  51. #define DMA_FN_OUT
    1 u  X* \) ?  r; @7 J* A
  52. #endif" g! f0 C( W' k2 r: g& ^" f

  53. 9 {  H) g6 y1 ~- `. w. K$ V( B. `. r( ?
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    4 @, z+ E* n0 n
  55. #define STATIC_SHIFT                33 c, j, O7 C2 M# w7 @+ w
  56. #define TCINTEN_SHIFT               20" E! n0 i! M, e, A7 d$ h3 F
  57. #define ITCINTEN_SHIFT              21- @0 L! G* _/ v( H
  58. #define TCCHEN_SHIFT                22  _6 v' n& \/ w& u
  59. #define ITCCHEN_SHIFT               239 ?0 O- t. u2 @' |: ?6 u, G
  60. $ u/ ^' S5 z. n2 S. A
  61. static volatile int irqraised1 = 0;- [) x$ X! o: f- ^& N% |
  62. static volatile int irqraised2 = 0;
    8 O7 q' Y2 V4 R8 r( O8 c

  63. 9 G# n* E# a! F: u+ I: v$ _! j
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 h# h% D% N/ S' S# ~& M0 E( g
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ |* k, m! o8 [
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 m2 R& l2 u/ Z2 x5 @  f

  67. ) n* q1 w# Y' L0 ]- y8 ^
  68. dma_addr_t dmaphyssrc1 = 0;, [8 \& [4 i, o3 `1 D  T& B) r2 _
  69. dma_addr_t dmaphyssrc2 = 0;
    / P  |/ f7 J, a! e
  70. dma_addr_t dmaphysdest1 = 0;& w8 S* W& O! Q; o
  71. dma_addr_t dmaphysdest2 = 0;& t0 d; C3 I) f

  72. , N# q9 H" O/ f
  73. char *dmabufsrc1 = NULL;
    ' t3 g9 j. H: D* ?# r" c
  74. char *dmabufsrc2 = NULL;" s- f& A; S" ?- T/ i/ _3 p
  75. char *dmabufdest1 = NULL;7 @  Y# q- E) A9 L
  76. char *dmabufdest2 = NULL;
    0 V( m+ ^& m2 U

  77. * @( v8 }6 O, E
  78. static int acnt = 512;
    7 s) ~$ k/ ~. S3 e0 l) C
  79. static int bcnt = 8;" u" E9 U7 L( [: A. X8 K
  80. static int ccnt = 8;
    0 |; |; K( }" b4 ^, W$ o- k- D

  81. 0 X4 y$ |. m5 J( r
  82. module_param(acnt, int, S_IRUGO);
    7 H0 p. U% ^8 ]1 r9 w8 P% a. F$ h$ y
  83. module_param(bcnt, int, S_IRUGO);
    6 Q# K; m) Q5 J- y
  84. module_param(ccnt, int, S_IRUGO);
复制代码

9 G- z! u# Y4 ]
" Z0 v. M; l+ B* V& U7 D( G3 N6 E      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) n! [0 e6 H& h5 \3 C7 _" M
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。  t+ T. y& r& ?3 c; r
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。. _; V6 L- Z8 A1 w4 S/ |$ y' \
- `  @& z' {; Q

$ U" P+ J' H( ~! x% y- O
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-26 18:24 , Processed in 0.039250 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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