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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! j( K9 c3 w" l, ^: M1 K" o
  1. [code]EDMA sample test application
    + X. _6 E& o% z  D
  2. /*5 S( M7 V$ {# l4 ^" z
  3. * edma_test.c
    . g& ^* \7 a" ~! h( G  T/ d' m
  4. */ ~: `$ L1 ?+ x
  5. * brief  EDMA3 Test Application) @- Y- B3 ?) z1 Q* x
  6. *
    ( i/ C' n/ U! T$ X; Y; D0 }* ^6 j
  7. *   This file contains EDMA3 Test code.9 [. ]$ y. l, l. C# J& P
  8. *1 ^& j& |; C8 [7 P# J: s' n
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& B( n8 X& ^1 f$ {5 X  y8 f# P4 p
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    2 A' `/ R- ?8 f; m) o
  11. *         TO CHANGE.$ a! a6 s! e3 Q% G" v8 z
  12. *$ y  p! q- S* G" l! }" m
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ! u( T5 g# @. J$ ~8 m% ~
  14. *
    3 f0 H" y% h# N: e6 u$ y, ]
  15. * This program is free software; you can redistribute it and/or/ e5 a; B6 P- j8 _% Q0 q, z4 {
  16. * modify it under the terms of the GNU General Public License as6 }) w6 P* z% m3 r3 n" O
  17. * published by the Free Software Foundation version 2.
    8 @7 @0 g+ I+ H! ?+ w
  18. *
    + c1 }2 ^. P- s
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ) o- D( W3 V6 }4 I
  20. * kind, whether express or implied; without even the implied warranty
    6 G5 }. k- n, U
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the& q# ?0 \. _' N, X4 T& q, W
  22. * GNU General Public License for more details., v* `6 \  W9 Y, p; Z& A, m! n+ m
  23. */$ m+ @  ^3 I; w5 ]* i: f! c

  24. 2 g4 p1 a" u. B" X/ p7 ?
  25. #include <linux/module.h>
    # P2 x3 H9 V! u( d4 O
  26. #include <linux/init.h>% b" ]$ h& h/ v  o2 T; B
  27. #include <linux/errno.h>
    3 ]8 C9 o1 F$ g
  28. #include <linux/types.h>/ l/ {5 }" c2 |) K
  29. #include <linux/interrupt.h>
    . s- S1 @) u: B
  30. #include <asm/io.h>
    / E6 a' l8 L% C- n
  31. #include <linux/moduleparam.h>
    ; ^5 q8 c/ ~" W% ^
  32. #include <linux/sysctl.h>6 }7 j; y: T& q- M: P" H; z1 [. G
  33. #include <linux/mm.h>1 v( S& x+ M0 z* z' n+ J0 w
  34. #include <linux/dma-mapping.h>
    : E0 K1 e' B) E2 U' _+ u6 R! C( \7 g

  35. - ^  a# Z9 V, f
  36. #include <mach/memory.h>% {# R5 T* J- u( L& ~8 u8 A
  37. #include <mach/hardware.h>
    0 i/ m7 v6 J1 l5 V# Q" i1 c, G
  38. #include <mach/irqs.h>
    & j3 V) g( B5 P
  39. #include <asm/hardware/edma.h>
    0 y) i8 r8 ~; ~0 b9 y. w/ B7 _' T8 N; B

  40. 0 @. \, u% G& i6 Y7 q, V; U3 c4 @
  41. #undef EDMA3_DEBUG
    / L+ y/ b( P/ j9 z
  42. /*#define EDMA3_DEBUG*/! g3 \0 P7 q" n" b: b9 t

  43. 2 G" O' \( X# R  C( q- m4 I2 N6 F0 _
  44. #ifdef EDMA3_DEBUG8 Z, O% f) z% I5 \
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    9 q- Y4 g5 I# S7 Y6 t8 y
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
      ^5 f+ ^' R( Y! D/ Z$ B" T
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 w+ b$ x8 M8 E2 e# k# ~6 ~
  48. #else
    ) Z6 w6 }+ T9 \* p% F7 K
  49. #define DMA_PRINTK( x... )) h; d" O2 W5 T- @6 N5 ?
  50. #define DMA_FN_IN4 Z9 E3 U$ h$ f3 V, X- n) p0 H8 c" e
  51. #define DMA_FN_OUT' @) D. m! d9 T' R+ Z
  52. #endif
    0 @* K' w8 N. `9 b' l+ e) G$ r

  53. 5 |- d$ z# U9 y/ L" ?
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    / w$ C1 M. j( @& v5 r/ W
  55. #define STATIC_SHIFT                38 B3 w- f8 @% e* ^
  56. #define TCINTEN_SHIFT               20
    " V5 a* V/ M9 H6 j9 H! V
  57. #define ITCINTEN_SHIFT              21
    1 C/ X2 ~8 i! x, K; Y9 c+ K
  58. #define TCCHEN_SHIFT                22
    5 G. v$ x* L! @0 c7 V5 y5 f
  59. #define ITCCHEN_SHIFT               230 m5 F- q% a% j9 N- N) x

  60. ! @: z/ ?& V- F! V
  61. static volatile int irqraised1 = 0;
    / q2 c6 Z8 X$ S' R/ Q7 [( \2 e
  62. static volatile int irqraised2 = 0;
    9 }+ r1 k3 j& ^9 V! m7 l1 [* `

  63. * t$ {: u  M) f9 u. l8 t- e4 N
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 n, Q6 G1 x1 C' Q: L
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' {0 Q7 u7 U$ Z1 `, B( ^( i( Y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 k5 o7 ^: X. |, U2 y- Z
  67. . {6 O3 o6 p1 F5 L
  68. dma_addr_t dmaphyssrc1 = 0;
    7 `! P) W0 \# W$ p7 B
  69. dma_addr_t dmaphyssrc2 = 0;+ N; A% q4 ?' V4 ]# ]4 W% N
  70. dma_addr_t dmaphysdest1 = 0;
    1 }* e3 w; s" E& `9 l3 |
  71. dma_addr_t dmaphysdest2 = 0;
    - v+ N; v0 P1 A+ Q& n9 Y$ v( n, u

  72. / A# `; V8 @9 x; M2 T
  73. char *dmabufsrc1 = NULL;! Q  d9 T7 [* X0 z. T5 D
  74. char *dmabufsrc2 = NULL;$ P+ F1 U# y: n7 ?( p
  75. char *dmabufdest1 = NULL;0 o, s9 T, m0 f- ]% T
  76. char *dmabufdest2 = NULL;
      P7 w5 a. p# E" R/ Q$ e  T

  77. : ~% \$ H2 z( _, n7 i4 k5 v% d0 b
  78. static int acnt = 512;% s/ x0 n' e" T. G  V) L" }
  79. static int bcnt = 8;
    + J. Q  g3 ~1 F6 L0 e1 R0 J: b
  80. static int ccnt = 8;
    / ?$ v6 R  m5 O) B

  81. ( x' D- U. ]5 s3 T: k4 j6 M
  82. module_param(acnt, int, S_IRUGO);/ ~' E0 o' Z- P) r
  83. module_param(bcnt, int, S_IRUGO);
    ( ?) I7 @. y$ V* h9 q! v  j
  84. module_param(ccnt, int, S_IRUGO);
复制代码
! s' v9 a" b1 S  L$ y
* k; M- a/ c& @/ E/ j5 K
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 J3 ?7 ?2 c* G3 a8 Harm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" u+ a* x8 o7 Z3 ^! T     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 P# T) J  F! b7 R. [

0 A2 p. E' v/ H
) @5 s- X2 n6 M) e4 @
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-15 05:31 , Processed in 0.041322 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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