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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 y' v- _) d& S: }3 a8 H3 K  S
  1. [code]EDMA sample test application8 h) Q  r, d; P
  2. /*' p0 E9 T3 L% S+ U4 U1 \
  3. * edma_test.c2 _) w: ]  @$ g4 e- \2 Z
  4. ** N4 U% f8 C1 }7 B$ v$ N
  5. * brief  EDMA3 Test Application9 g- C+ O6 `" A4 P
  6. *+ m3 R+ _) N  o7 B& a; s) q1 N
  7. *   This file contains EDMA3 Test code.
    % ?. ^8 o/ o% n/ m5 _, W
  8. *
    ' [; H4 t3 j- w1 F8 N' V$ a4 p
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' N- f9 n2 H% v
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- d/ p9 x2 |0 _* V5 D/ [
  11. *         TO CHANGE.
    . S  `; w, N" L* c
  12. *7 h* X: S( g- R" B: R% a; L
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    4 i9 W7 g* k! ?" c
  14. *& W+ S3 v' }' H1 a+ N; n  t
  15. * This program is free software; you can redistribute it and/or
    4 K, E* R' s8 C7 P4 B2 l% J" q; y
  16. * modify it under the terms of the GNU General Public License as
    8 x8 m( q3 f$ `. H
  17. * published by the Free Software Foundation version 2.! k- H  K. r! n( c* X. O
  18. *
    ; Y$ a# ?) H6 z, r$ g3 z  y& J
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any, O! O& a- u8 C9 C, B5 I
  20. * kind, whether express or implied; without even the implied warranty
    ! I  t* g8 n" @" |+ B* Q: P
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the% |' l$ ]$ P4 I# X7 \, U+ v! w! C! d
  22. * GNU General Public License for more details.
    8 P* f* u0 L* i8 L3 F: q" c
  23. */
    % A- U$ @; Y5 r$ C9 T, w2 h0 u

  24. 8 ~0 \3 }7 [2 d& _
  25. #include <linux/module.h>
    4 m7 c$ g8 |- P+ A
  26. #include <linux/init.h>9 u5 h3 Y6 L8 r: D1 u
  27. #include <linux/errno.h>5 \5 T6 d& U) b* ^( p9 ?+ |
  28. #include <linux/types.h>2 }* x9 u  a  G, Y0 ?2 ~0 @
  29. #include <linux/interrupt.h>
    3 Q2 M; W4 t& ^1 D
  30. #include <asm/io.h>+ f' b& |" S9 k! I# q  a5 @
  31. #include <linux/moduleparam.h>0 J- ]' n' P: b, _- P3 G" p
  32. #include <linux/sysctl.h>
    * Q# @4 }: x3 ^: N
  33. #include <linux/mm.h>
    ' `) @8 G; }' \% W. U' T
  34. #include <linux/dma-mapping.h>
    6 L& n9 x; n4 c% {

  35. - ]+ z2 N" D$ W$ ^5 E
  36. #include <mach/memory.h>
    / }7 ^+ ]3 y% s# L
  37. #include <mach/hardware.h>
    5 A+ I7 M9 Q' j6 K) W
  38. #include <mach/irqs.h>
    8 n2 j' v  O/ Z1 l9 j4 t
  39. #include <asm/hardware/edma.h>
    3 _9 J$ ~  Y4 }( U
  40. : U" l% Q* `7 B2 Y+ U0 U0 ~) F
  41. #undef EDMA3_DEBUG5 P4 B# m$ N+ _: ], E) |! q# ?# k( U5 r
  42. /*#define EDMA3_DEBUG*/
    8 G7 Y) D: r9 N2 t2 o+ q! Y- |
  43. 3 l  {6 M) ]% ~* Z3 c. v
  44. #ifdef EDMA3_DEBUG
    3 ~, r' e+ U( g$ C1 f
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    . b2 C& a. O- W' N, `
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 @. X0 a! b! L" E* D
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    / G" C8 b$ [% ?& z
  48. #else8 h2 G2 T9 `: y! z( z
  49. #define DMA_PRINTK( x... )6 C8 o! ~  l8 P+ a
  50. #define DMA_FN_IN- K3 Z+ H. \3 w7 M& k
  51. #define DMA_FN_OUT; I" p/ g% I5 k5 ^
  52. #endif9 j" b* n4 V) U- t, ]1 e% x7 ^4 h+ @% J
  53. # Y3 p3 _6 I% z/ W- r( [0 }, d
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    9 p! v( S/ w' e) ^7 H; X  M
  55. #define STATIC_SHIFT                3
    5 |  G( x# O( Z% q" K" W! J1 z
  56. #define TCINTEN_SHIFT               209 ^1 H( b% R0 [; O1 N
  57. #define ITCINTEN_SHIFT              21
    " Y( v& ~% r; [2 W  ~. \0 W
  58. #define TCCHEN_SHIFT                22: ^, b& W2 ~1 N) E; h$ B+ r; ]
  59. #define ITCCHEN_SHIFT               23
    1 |5 G& K5 D+ S* x

  60. ! w  d4 V9 k7 W
  61. static volatile int irqraised1 = 0;
    0 ?% D5 H( g( a6 ]5 H' I
  62. static volatile int irqraised2 = 0;
    . F& T0 O/ i4 p$ @
  63. 9 _5 r. O. g8 \4 J, }/ z
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - {7 c/ q( I( v
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; y* A( Q2 g, y( C4 x# l8 w
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- u0 b" h% z5 Z
  67. $ a. w- I* u( K* d3 ~" Z4 e
  68. dma_addr_t dmaphyssrc1 = 0;6 o8 G. ?# Y4 M  `) {, R
  69. dma_addr_t dmaphyssrc2 = 0;
    - @, c; V9 V# b) {1 |7 D
  70. dma_addr_t dmaphysdest1 = 0;# Z, \$ H" J' \
  71. dma_addr_t dmaphysdest2 = 0;
    6 h# R4 j6 c  A) d5 B% P: G. B, ^" K7 [
  72. / j7 A( H5 ?% v( I5 L5 K0 i* K3 P
  73. char *dmabufsrc1 = NULL;
    ( Y  p4 b4 R" @, i- D1 Z' s# u3 q
  74. char *dmabufsrc2 = NULL;
    9 x" A# E/ U! w- W% I6 v
  75. char *dmabufdest1 = NULL;! y" P- U0 X0 {$ s% W. l
  76. char *dmabufdest2 = NULL;
    # }' O3 E+ }6 H5 R

  77. 7 A+ B' r  `" b
  78. static int acnt = 512;- Q3 [8 j3 e+ c, J# O4 f
  79. static int bcnt = 8;
    : l' O( K# u. C+ B6 u4 p
  80. static int ccnt = 8;' f5 k  \0 [3 g6 v6 ]

  81. 1 _! K3 g* |6 g( f7 n5 V  e
  82. module_param(acnt, int, S_IRUGO);
    7 D  ^/ o! N2 H
  83. module_param(bcnt, int, S_IRUGO);2 E8 a. l' W' M+ S/ m- @
  84. module_param(ccnt, int, S_IRUGO);
复制代码
1 z) ]( C4 D* T2 H; D
1 [/ S1 r; b% c8 N
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) E8 s9 n9 R7 Y" f- s7 darm-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 T: O2 u2 g8 |# G% d7 U' Z, w
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
/ A8 |' ?8 a; M2 }  D. x4 l! \7 R. y* A9 U: E9 v
' S5 X/ V* Q# n
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-24 02:55 , Processed in 0.040139 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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