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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ x0 q8 R% j2 d+ A: }% ?. `
  1. [code]EDMA sample test application
    / A+ P/ \! E+ _
  2. /*5 s3 Q6 q- ?( s$ S! }
  3. * edma_test.c7 N7 ]5 s& I* g# d& j3 \0 g
  4. *' d1 M& a& _' b/ R# h
  5. * brief  EDMA3 Test Application
    ' y/ }- o* ~" N9 `1 M0 ~
  6. *
    ' C& X! s4 n, |6 I+ ]
  7. *   This file contains EDMA3 Test code.% D$ h/ E& u1 i* s$ b6 l9 U. _
  8. *# M4 L" F9 w  p. u
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! y2 D. J, x- T; b5 J( C
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT8 J2 I( X5 I# a+ E9 y0 g1 c3 D
  11. *         TO CHANGE.
    0 }$ K. l3 P+ G8 E+ }9 D
  12. *
    " _+ w$ N, Z) w( r* r. u
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 x0 h* o% R- r  D, b
  14. *
    0 R% V% J3 g  e4 f& \) c% H
  15. * This program is free software; you can redistribute it and/or
    # B0 K5 z$ Y+ y7 V' H
  16. * modify it under the terms of the GNU General Public License as
    8 S/ ?1 N% j- B. W5 G. B2 R
  17. * published by the Free Software Foundation version 2.* ^0 I6 [, [# y! B
  18. *4 y* s4 C# v* t! e# C% E* |# c4 W
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    . K- J. y8 k/ ~5 Y- N7 r4 U. ~  }" o
  20. * kind, whether express or implied; without even the implied warranty
    0 B7 m4 f* h2 e  A- j
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    & _1 Y% f& y# b' }
  22. * GNU General Public License for more details.
    . H1 m; q. D- B5 p: ~  c
  23. */
    3 p, s6 j& k4 {# b" G+ V

  24. ( c- e6 N  v" e: l
  25. #include <linux/module.h>5 g% s7 K- \3 {
  26. #include <linux/init.h>
    # u8 K9 O# H' |5 [  o& j
  27. #include <linux/errno.h>6 R0 X/ N% _  t9 t, {: v
  28. #include <linux/types.h>
    0 p/ G; y8 P7 ?# @$ I& ^+ B
  29. #include <linux/interrupt.h>2 F2 u+ ~4 Q* Y; u- L1 i  X. l5 E* R
  30. #include <asm/io.h>
    1 ]) V2 W% K; v$ A& a: d+ h
  31. #include <linux/moduleparam.h>
    & I# F# ]9 M. E) z3 @( ^" d
  32. #include <linux/sysctl.h>
    - O8 h( g" d9 `1 k4 U) R: o
  33. #include <linux/mm.h>: `  T3 l* c' i$ U5 b8 i1 l: \
  34. #include <linux/dma-mapping.h>
    9 d% h( s! u6 }  `

  35. 2 B" ^6 r7 O) U- ^
  36. #include <mach/memory.h>
    9 ]" r# p% a6 z8 d. u, W
  37. #include <mach/hardware.h>
    - U1 S) U+ Y; F
  38. #include <mach/irqs.h>
    ! K! K" L1 w8 i: ?8 @% m
  39. #include <asm/hardware/edma.h>
    + ~2 N# \- G& w9 e! R6 }
  40. 3 b% `6 [1 E2 j) @; [
  41. #undef EDMA3_DEBUG
    $ ?# j; d, D. d( s' M
  42. /*#define EDMA3_DEBUG*/
    5 `4 ~6 P  q$ i

  43. 2 ]" D5 I% v7 f8 m
  44. #ifdef EDMA3_DEBUG5 x* k9 c; e' }2 G2 |- o
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)9 `4 Q/ C  l, t8 q& k
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 ?5 _; t: T' p5 L5 H
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)% L2 V1 e+ z; W/ o/ A. z+ a, H
  48. #else  ]( ~0 Q+ F* g/ A9 w7 T; j+ Q
  49. #define DMA_PRINTK( x... ): s4 `% T; X, D4 l) j  B
  50. #define DMA_FN_IN4 w5 @4 d5 ^- z" a5 }: u
  51. #define DMA_FN_OUT
    4 L* g* P1 @( [
  52. #endif
    + i) O, Q$ w" r% C

  53. 5 V! n; I" M2 ^" s% d0 e
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)4 ^5 `! H0 ]( R9 k( [, M# E+ J
  55. #define STATIC_SHIFT                3% E9 A0 d% M$ L" G& r8 x* s5 G) r
  56. #define TCINTEN_SHIFT               20
    * _8 `7 l, u' Z! @
  57. #define ITCINTEN_SHIFT              21
    9 T, B+ \* M0 @0 q# O  Q
  58. #define TCCHEN_SHIFT                22
    % Y, z( {0 a+ X0 W! M8 \2 A
  59. #define ITCCHEN_SHIFT               233 }! Y' Y8 h4 [( F

  60. # E  d. J: |5 S( I% |
  61. static volatile int irqraised1 = 0;
    1 j4 e) v7 o1 K; k3 h- Y# c
  62. static volatile int irqraised2 = 0;
    8 Z: L0 F( N3 k3 c% P. j
  63. $ J5 ?0 _9 {$ g% o" V$ L. d
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 ~/ ?7 {4 j" }1 N* T* h, i4 L: d
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + K( n# |6 S# c& w/ y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 ]  \. R; }& c0 B8 ]4 \

  67. 7 P1 _; k2 ?# U& o" _# Q6 n
  68. dma_addr_t dmaphyssrc1 = 0;4 h% l5 v5 n) }! ^9 ^) O8 x  F+ c
  69. dma_addr_t dmaphyssrc2 = 0;7 N7 H$ q# {5 p
  70. dma_addr_t dmaphysdest1 = 0;( v  A+ I: }- ?8 {
  71. dma_addr_t dmaphysdest2 = 0;
    - M% y" c9 Z& \4 O& g

  72. / u% x$ e) Q' E7 e* T% B
  73. char *dmabufsrc1 = NULL;7 J0 t' q3 ]8 L/ ]' U; c% ^
  74. char *dmabufsrc2 = NULL;
    7 x* l; @& }4 W" L( k( k& d
  75. char *dmabufdest1 = NULL;' I5 G$ P$ f3 {/ h# c6 o3 Y
  76. char *dmabufdest2 = NULL;; H- i4 N- F7 {4 t" u6 e

  77. 8 f8 V% I# a1 O
  78. static int acnt = 512;
    4 h5 g/ [8 @% d/ a& V, Z3 {; ]
  79. static int bcnt = 8;9 r' y; ^* l6 c  N; y- V  J( x
  80. static int ccnt = 8;. _& o' u  D. X: e0 P. h

  81. : f7 b, y* w" T) z* F
  82. module_param(acnt, int, S_IRUGO);2 D& h$ \4 h8 M
  83. module_param(bcnt, int, S_IRUGO);+ s# s2 a1 g# u& G1 P
  84. module_param(ccnt, int, S_IRUGO);
复制代码
# {$ z5 ]9 ~4 M

7 _; c' A' s0 W" K* Z      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# t5 {$ W2 f/ c4 ~+ s( f: y
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 ?; X1 a4 m, X+ m1 M. ]: [5 ?
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。; v5 d, y( W1 c8 B

. _. O: c/ n- m7 I6 C% ~' J9 c7 z2 `+ z; R( t* ~7 l" A- B
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-10 12:25 , Processed in 0.037945 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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