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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 X7 a; k; _" }2 o% f' w
  1. [code]EDMA sample test application
    0 A  E( a" I( E
  2. /*1 w3 }% @9 L! a" d
  3. * edma_test.c
    & }* h, @; _! p2 V( n: F& c
  4. *! h$ T6 L  R5 f: U- B& ^7 D/ v
  5. * brief  EDMA3 Test Application* ]/ p. E; V6 l1 R- U
  6. ** }( ^; o3 T6 W3 R9 s
  7. *   This file contains EDMA3 Test code.
    ! H' k9 z9 ~+ l- Y! j2 j* }
  8. *
    7 R( g- `  D9 d% A
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" y2 J2 u+ I: f! c8 e& W; U6 e- R
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 c- r- @" _* O$ ?8 s" J
  11. *         TO CHANGE.
    , o/ O) B* C9 Y
  12. *8 g/ R& b0 Q+ R! Q8 Z9 s0 }
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* f" Q$ x6 B( B6 X! G$ H: o# \5 v
  14. *
    # g0 ~! k# x9 m; a1 G
  15. * This program is free software; you can redistribute it and/or$ d+ X& C7 r2 y: x- I% n
  16. * modify it under the terms of the GNU General Public License as& @" p& z" B) `. z+ K/ w5 i9 b& n
  17. * published by the Free Software Foundation version 2.
    6 f$ y# m& c4 e( u
  18. *# e7 {/ A# c7 _8 e* Z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any: r0 s! A( T' m
  20. * kind, whether express or implied; without even the implied warranty
    * L- I- ^) a9 p* o; y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    8 z2 x* F3 t8 p0 u
  22. * GNU General Public License for more details.
    ; A. J! k6 s! Y( [- z% w
  23. */: ^; k& r* O7 q* K  D$ g
  24. , d3 w" X: S5 W% l* P
  25. #include <linux/module.h>7 \: \" ?& r7 O9 `$ t  M$ W
  26. #include <linux/init.h>. _% m! [! u+ O
  27. #include <linux/errno.h>, q2 N8 w% j8 l
  28. #include <linux/types.h>0 V$ S2 q' x, f  f: v
  29. #include <linux/interrupt.h>- M( Z2 w& Q  L- |  X* n. h
  30. #include <asm/io.h>
    3 U' j$ S& z" ?7 t/ T/ ^
  31. #include <linux/moduleparam.h>
    0 c  c1 ^/ O1 U; A. {) U
  32. #include <linux/sysctl.h>
    / i& e- B/ D1 F( N
  33. #include <linux/mm.h>
    ( j) [6 o5 z5 A' h1 {# ?6 `. I
  34. #include <linux/dma-mapping.h>
    5 V- B9 j6 |" x9 L' i7 r& ]
  35. . V9 C4 m5 N$ q. z6 t: ]; r# |
  36. #include <mach/memory.h>5 o& e6 z( s% j* o" I3 n
  37. #include <mach/hardware.h>
    # U  Y7 I5 g0 j( L1 Z' r0 u% @1 C: V
  38. #include <mach/irqs.h>
    ' S! H( I  b3 \! n. d2 _1 y3 V
  39. #include <asm/hardware/edma.h>
      Y$ ?8 N/ @! ^- ^) G; s

  40. ' j2 S8 W3 _+ |% x( K3 L. @
  41. #undef EDMA3_DEBUG+ @/ R) I6 ?$ H
  42. /*#define EDMA3_DEBUG*/
    2 b2 X# ?5 B5 m7 j( m

  43. ) x' r& o$ s( t' R6 T$ l" w# _
  44. #ifdef EDMA3_DEBUG5 ~5 L) ]  r4 a# J8 m3 U4 K( C  J
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    # @/ f" m; Q* Y. ~
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    " k1 v: N  G. K
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    / @1 s$ |( \* s, h
  48. #else
    % e4 M+ L: l' ]; m' o4 Y
  49. #define DMA_PRINTK( x... )
    8 m' a" I" d/ I) v2 d8 l3 k8 z
  50. #define DMA_FN_IN
    1 N/ F1 f$ H/ T
  51. #define DMA_FN_OUT
    , j( }0 H5 x2 U5 ^0 D0 n# s" Q- {
  52. #endif
    - ]  O5 h' B2 _* }, r
  53. # t' p) T/ }, W9 M) ^
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768): f7 m( |  t2 o- D7 f; g3 L
  55. #define STATIC_SHIFT                3
    - o  [- I3 U  n9 |
  56. #define TCINTEN_SHIFT               203 [9 n3 F) I) t- v
  57. #define ITCINTEN_SHIFT              216 a* ]* A2 o0 [9 U# [, _+ h
  58. #define TCCHEN_SHIFT                22
    ; F4 I: O! z* l5 S& B; s
  59. #define ITCCHEN_SHIFT               23( Z- O4 s4 ^: W4 {& d+ {
  60. ; x; W4 D% f; E8 Q0 L
  61. static volatile int irqraised1 = 0;" W% b* d* ?' g4 B6 F7 Y2 Z
  62. static volatile int irqraised2 = 0;2 Z; P1 I" h6 }% E

  63. $ `5 n' k  O- ^0 n' ]* ~
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( G+ W' G  ?3 \( S
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' E+ t. \2 n0 W+ T" D' L6 G) f
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 g( Q" u: C% `- K0 Z! j* Q
  67. 9 g# s0 Y" d9 d5 l. `5 G
  68. dma_addr_t dmaphyssrc1 = 0;. d# V3 E" E  i/ R) {% D
  69. dma_addr_t dmaphyssrc2 = 0;/ A/ Q6 j0 w% V$ [! ]
  70. dma_addr_t dmaphysdest1 = 0;/ }- G7 f4 s) z/ |$ n
  71. dma_addr_t dmaphysdest2 = 0;
    ' p' w# k% U1 j3 u" [" `, W
  72. % ?; V- D1 Z# N3 N
  73. char *dmabufsrc1 = NULL;
    , S+ @+ o8 |  L( N( ~7 k6 m9 z
  74. char *dmabufsrc2 = NULL;
    & [+ G; q$ t0 m: t, r
  75. char *dmabufdest1 = NULL;  R$ ^' D# \8 F% S$ F
  76. char *dmabufdest2 = NULL;8 ^% e- L& ]- f: E# J  f
  77. 3 m, f* _! g( Q1 P: y3 |' r8 q
  78. static int acnt = 512;- i6 }3 R2 s/ G6 h
  79. static int bcnt = 8;
    8 w6 q! m: G5 B6 N6 k" F
  80. static int ccnt = 8;
    - I0 L% Z1 ]2 }
  81. 4 b! V( I2 {6 {3 |
  82. module_param(acnt, int, S_IRUGO);/ b: i3 A2 ^1 o9 Y2 n
  83. module_param(bcnt, int, S_IRUGO);6 P/ k+ s7 V; I2 m8 b3 [0 r: {
  84. module_param(ccnt, int, S_IRUGO);
复制代码

! H6 N7 w! a# F0 t& U1 T/ `1 b; M6 G7 K0 C$ z" K8 B4 Q$ K9 n3 C
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
  g3 l; c: V8 B. jarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; q6 R9 n+ m" |$ J1 l5 R  R
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
$ @. T8 b% p3 Z3 X* W6 }7 N2 V) j2 ^! u

/ P9 _4 I' @3 c' \
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-10 09:49 , Processed in 0.038185 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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