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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
& z4 v3 q/ H: Z
  1. [code]EDMA sample test application/ h/ }9 |9 \1 R* {
  2. /*
    4 ^1 I8 ]2 }* D4 X
  3. * edma_test.c
    ) Y9 h$ _4 k$ o. d
  4. *
    . k  j) y; ~2 H
  5. * brief  EDMA3 Test Application' p1 `+ Z, q4 E% x" A% |' |
  6. */ t* r' s; n# x! x; R7 x
  7. *   This file contains EDMA3 Test code.% W; Z: ]' h& v  W& ~6 T
  8. */ A$ n# ~2 P$ v! F- f, T
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, a, Y" ]! S6 t( y
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 N2 G# R5 n& D- J$ `
  11. *         TO CHANGE.
    ; k1 W  ?2 z) _" ?
  12. *
    3 y' Q) W% D+ D; }; Y8 ~7 Q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    & c" V4 q9 Y/ o) P' G* V! X
  14. *% i! F8 ?9 |  o2 N7 A3 O, k" A# S3 N
  15. * This program is free software; you can redistribute it and/or
    4 ^% N# @/ j& o
  16. * modify it under the terms of the GNU General Public License as$ [, T3 ?# T  t0 @
  17. * published by the Free Software Foundation version 2.
    8 g! m% t7 ?7 p, ]' g
  18. *
    : X& ]( ^6 l3 O$ a$ `) [
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    / E5 C+ D/ {2 L1 @& p9 d
  20. * kind, whether express or implied; without even the implied warranty$ t, l2 e: @; a5 q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1 g, K# T3 g- s# V! w
  22. * GNU General Public License for more details.
    8 o6 l" O- ?$ u6 u5 s' L  N
  23. */
    # {$ t, C- z* Z1 v& B5 {
  24. 3 c7 c5 u; A! E4 ?+ s' _: v
  25. #include <linux/module.h>
    3 Z( {7 {. P) }" f2 [
  26. #include <linux/init.h>- t5 z1 `. {& P2 \% e; o& ]
  27. #include <linux/errno.h>
    1 ?0 `4 E& k# N! v& |
  28. #include <linux/types.h>
    * `6 B9 m6 g+ B0 Q& L1 w0 \- B
  29. #include <linux/interrupt.h>
    3 q# g2 J5 U( x+ o
  30. #include <asm/io.h>) O! q0 Z. ]5 l8 a5 x! O- W
  31. #include <linux/moduleparam.h>
    5 A) v! e/ G5 M" C/ s* _
  32. #include <linux/sysctl.h>
    ; t8 ]) z6 V2 s5 ]4 i3 q6 m
  33. #include <linux/mm.h>
    6 d- Z& A  H  J4 R: x* H2 p
  34. #include <linux/dma-mapping.h>
    8 K2 B% q# ?& J# k7 ^

  35. , l# k8 S' D( L4 Q$ g
  36. #include <mach/memory.h>4 m' n% A7 X& E# s
  37. #include <mach/hardware.h>: Z( }( E; B9 A0 M4 X
  38. #include <mach/irqs.h>
    8 N8 g. _0 b3 y3 E1 [
  39. #include <asm/hardware/edma.h>. @* C* N6 V2 R! Y' S8 J
  40. 0 K  B; }4 P. [1 f* V) x
  41. #undef EDMA3_DEBUG& |* `/ x6 k: N+ x. T( C/ }" Y! u
  42. /*#define EDMA3_DEBUG*/9 h- J/ W8 A% B9 h; U

  43. . v2 v6 G2 w# D  L! A
  44. #ifdef EDMA3_DEBUG- \- n8 e' a( k/ E/ ~) {- f  ]
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    9 j! N. C, b  n" ?
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! \9 ?3 o2 L) g
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ S' D2 `9 s4 Q; y
  48. #else9 u0 l( ^2 U' J8 y8 V4 \- V3 o# S
  49. #define DMA_PRINTK( x... ): a) q4 V5 D0 ~7 t; ]
  50. #define DMA_FN_IN- E$ b/ C4 e* C+ Z
  51. #define DMA_FN_OUT
    6 L8 s2 v8 I# t! Z
  52. #endif
    ( J" C7 n- L, O  D% T, d. P0 U9 S

  53. / j5 C6 t* @  M, ^; P; P
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)6 e- r7 b& B$ z" k4 s/ S* ?7 e/ i
  55. #define STATIC_SHIFT                32 p2 ~- @$ e- J$ H. N! S
  56. #define TCINTEN_SHIFT               20$ R9 `3 ]1 e+ v
  57. #define ITCINTEN_SHIFT              21# f/ c, G; U! F5 x( p& V
  58. #define TCCHEN_SHIFT                22
    % I  Q/ N9 ?& p* }3 s1 @
  59. #define ITCCHEN_SHIFT               23! m8 F. b. I& Z! f. X% x0 d
  60. , }+ O3 A' v! I9 X+ S6 P; B' L8 h
  61. static volatile int irqraised1 = 0;
    ; [( g+ W. L3 B4 M& a
  62. static volatile int irqraised2 = 0;
    - F( _. g. j) F. Q$ V
  63. : N$ S, y% @# g6 ~: Q( j
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 u, c- M! W  j& `* _. M
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 T) x  ~1 y7 _5 ~. o) j4 P3 [
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ }4 v4 X% H/ ~5 A' O/ |
  67. " W  r: G7 z! ~$ X8 H  W6 c
  68. dma_addr_t dmaphyssrc1 = 0;
    . e( `- B4 A2 i/ C9 N& C) }: d
  69. dma_addr_t dmaphyssrc2 = 0;0 s, h& ~- }, R* [
  70. dma_addr_t dmaphysdest1 = 0;
    . t0 T  x3 m/ a6 w2 H! @
  71. dma_addr_t dmaphysdest2 = 0;
    0 S- T1 e/ n9 B2 C5 V$ z6 {* p- \

  72. ( X! {( P2 Z7 a" g  M4 Y% I3 T7 i
  73. char *dmabufsrc1 = NULL;( O* {- J5 k1 E4 X
  74. char *dmabufsrc2 = NULL;
    # w5 z2 Q4 l# c9 ~7 C& Q7 B
  75. char *dmabufdest1 = NULL;& H0 c5 G1 m6 {# k; A5 `
  76. char *dmabufdest2 = NULL;" _% [' A9 N* u' y. A0 C
  77. / @( F4 O' {' D
  78. static int acnt = 512;( D9 ]5 l! o; _
  79. static int bcnt = 8;
    7 o9 _9 u6 J/ g& s5 _, p
  80. static int ccnt = 8;" F3 `# ~* i; _: ?& J2 j- r/ r, Y0 w
  81. / u' j8 U; u1 W9 T6 C
  82. module_param(acnt, int, S_IRUGO);# a  R' P9 w2 C  d, o1 L  X. _; `
  83. module_param(bcnt, int, S_IRUGO);" o. V, c, T0 d- g6 j. R" G
  84. module_param(ccnt, int, S_IRUGO);
复制代码
* G+ {. R, Y6 l1 @$ e* w" l+ j4 S  |

; D6 n3 N  g5 I! |7 {) O. A1 m      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 L+ \/ k8 q& T% }4 t5 Tarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! q8 o% Z' G. l( S9 [- y
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 l/ A& ^  R3 Z8 {; [+ N8 o; X

  B* a: C4 Q. S) ]" M" A! W# a# [" W% h6 f
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-9 15:20 , Processed in 0.045034 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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