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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, u) ]; |  w$ x+ [: }* z
  1. [code]EDMA sample test application
    7 ?+ @, ]# u# g( y( \
  2. /*
    ) V- j% h9 h- }( ?+ z
  3. * edma_test.c) ]% j7 R0 J6 {2 N5 O6 @
  4. *. p) U" X' v4 T
  5. * brief  EDMA3 Test Application3 T4 C- G6 C" j; U8 u
  6. *
    5 o3 k% j' [: f- ]
  7. *   This file contains EDMA3 Test code.
    9 g' V% b+ O4 z7 Q- D5 C
  8. *
    # F+ b4 Y- s" N2 w- }2 @
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: l, L9 g( }8 V8 u: j7 K& f
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 R9 t: s  `% w  a( ?% w% ?
  11. *         TO CHANGE.& O5 ]3 N% |$ M6 A; y
  12. *
    ! N3 I( ]. ~, F
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/  _$ D) Z3 v2 _
  14. *9 m! B% L1 m+ j& k9 N+ ^$ O. y
  15. * This program is free software; you can redistribute it and/or
    + x7 N8 g- B. H  Q8 ]
  16. * modify it under the terms of the GNU General Public License as" n8 c, ~8 u6 X1 T  m7 t4 d$ Q* A' i
  17. * published by the Free Software Foundation version 2.3 [/ L5 X; t" M7 _$ A" c
  18. *& {3 S3 x  R+ U7 M" R
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ; v  F5 E; T3 L; y) a9 o
  20. * kind, whether express or implied; without even the implied warranty
    4 M3 a$ b: x" U! B. B1 Z' a
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    3 H; t0 G% s% i$ y- c
  22. * GNU General Public License for more details.
    - S: H+ b, K; Z3 I
  23. */
    : l3 I0 I+ Y" J3 t8 ~  U' G
  24. , w9 n7 h0 g! g: O2 [
  25. #include <linux/module.h>. o5 x5 R  M9 R; _- B
  26. #include <linux/init.h>
    : M0 M% ^; n( i) R7 y: @& X; P* Q
  27. #include <linux/errno.h>
    3 r; v& g7 Z5 T1 F& R
  28. #include <linux/types.h>9 D4 h! F8 y  D. @8 T$ [, M
  29. #include <linux/interrupt.h>
    - k( b8 R# o' V6 I* F5 f
  30. #include <asm/io.h>$ \( A9 s3 V2 ^$ }  L& R
  31. #include <linux/moduleparam.h>
    " l& k! {/ {8 Y7 I& k
  32. #include <linux/sysctl.h>  [; z7 j0 L, d
  33. #include <linux/mm.h>
    6 ]! `+ x0 r% t1 o8 W" K( x+ U
  34. #include <linux/dma-mapping.h># G3 C( l% I1 F

  35. 0 P* I+ Z7 J9 m# C0 H6 f8 w
  36. #include <mach/memory.h>
    0 f6 Z$ W  O' t  F8 g2 j
  37. #include <mach/hardware.h>- w9 F6 _" V  s: ?8 Y# w
  38. #include <mach/irqs.h>% K; j  U$ W( X% {" [
  39. #include <asm/hardware/edma.h>7 @1 x7 X( S" D5 L
  40. ; Z. \: P1 z* m* C6 @' j6 w6 ?
  41. #undef EDMA3_DEBUG
    ( n8 L! W1 D) T6 C1 v1 x9 }8 W
  42. /*#define EDMA3_DEBUG*/0 q: c) s" [$ I  [

  43. ! U8 g8 @0 o3 G) ^& I, r& c* P; @
  44. #ifdef EDMA3_DEBUG$ G; ?6 K6 U% R) }
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ @( }9 f/ x" a2 _/ ]
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    - U8 w# }/ f" ~& f
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    * C  G3 D) C( i! o3 _6 T
  48. #else
    2 b. h8 j8 h5 `/ A" I& ~
  49. #define DMA_PRINTK( x... )# B# W: ?: p2 x
  50. #define DMA_FN_IN# w% X2 r. r  o9 F9 a
  51. #define DMA_FN_OUT
    ; A- k! W! b8 _; T' Y+ h) n
  52. #endif+ Y* R4 X1 _/ @8 J& J5 Q" O

  53.   T, p  X, t! D, |
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)7 w  k5 ]' p6 Y+ M
  55. #define STATIC_SHIFT                3
    1 s8 V6 K+ |4 j+ c( E9 O
  56. #define TCINTEN_SHIFT               20
    : o0 R8 V" R. u; E& W* C
  57. #define ITCINTEN_SHIFT              21/ M1 u- n! I5 \9 G) q; g
  58. #define TCCHEN_SHIFT                22
    7 P) E8 l$ \  E. o
  59. #define ITCCHEN_SHIFT               23
    : q  n; V9 e. b' S+ i
  60. 1 w- d3 {: Z* `7 [3 S4 @
  61. static volatile int irqraised1 = 0;
    . s: M4 i; N/ a4 r8 I
  62. static volatile int irqraised2 = 0;! C! \9 \/ B2 e- H
  63. % {% k& n/ z3 S& j- Z- k$ `
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- F: |2 r/ T  G, Z$ \, i
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 u1 n; `; N7 I2 M6 l' ~, h0 p' M
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ h6 [6 y8 g" E9 C& ^
  67. ) R/ Q0 P( ~9 v" i
  68. dma_addr_t dmaphyssrc1 = 0;0 I2 j1 Q3 F' t  L. F8 q# Y
  69. dma_addr_t dmaphyssrc2 = 0;
    * k: _* D' m6 ?5 p0 z% r
  70. dma_addr_t dmaphysdest1 = 0;7 @! B( x" s. S
  71. dma_addr_t dmaphysdest2 = 0;
    ) i6 o- d3 A0 I; X
  72. 1 }$ l: u: O5 Y, Q
  73. char *dmabufsrc1 = NULL;
    ) g' e! h( A2 j/ m
  74. char *dmabufsrc2 = NULL;5 {/ R# @+ D. l, T" n
  75. char *dmabufdest1 = NULL;& S9 ]! ~! m+ l, u% d' u: X
  76. char *dmabufdest2 = NULL;
    1 K6 h2 s6 U) E* D' n

  77. # d. f! N+ a6 y0 t5 R
  78. static int acnt = 512;+ }9 P* F7 T6 A+ F
  79. static int bcnt = 8;4 ]! X3 Q& T' Z9 T3 _! W
  80. static int ccnt = 8;& i7 N6 S/ }  I3 Z3 H6 R6 T
  81. % B. x/ ^/ a1 j" j
  82. module_param(acnt, int, S_IRUGO);( F, ~% b& G; B$ v' ^& W" P# h
  83. module_param(bcnt, int, S_IRUGO);
    3 N4 Z9 K/ k; r+ c% B* l
  84. module_param(ccnt, int, S_IRUGO);
复制代码

9 L/ F- h: t- }7 e3 i2 z: }3 L8 E2 m# u/ I9 m8 ^
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 i" ^' V( }) b5 \
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- m* U2 t7 G" p% A+ T1 v
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 ]! ]* E! w$ `  H; `  l% z

, \. Q) C+ ^, S& w- S& B% o
: K  F$ M1 G# \2 K& R) w5 R
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-9 19:16 , Processed in 0.040052 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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