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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
) q3 L' j" K$ Z9 L( l. N
  1. [code]EDMA sample test application
    * O2 q! m& L# `. T# ~+ J
  2. /*+ V; ?" r3 Q( k( S4 _, o
  3. * edma_test.c2 h% W" X# f7 M
  4. *
    & z& q9 D$ S7 r5 ^6 s7 `9 S
  5. * brief  EDMA3 Test Application2 M+ |0 b/ ?" \$ R1 I5 w
  6. *  S: T3 t( g6 E
  7. *   This file contains EDMA3 Test code.- {7 Y0 k: C; m+ n4 A
  8. *
    ' c8 V, Q# M( K' ]' ]- |; p
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    5 O4 l. W: d" G$ p4 W7 q
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ' z9 r& b2 t6 k  M0 d- l) o% ]
  11. *         TO CHANGE.
    ) O$ m4 V0 k* }; L4 D* `- f, f
  12. *
    # A& m; j0 u$ j$ M9 I; X& W4 A7 U
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" Z( W+ m" d/ u
  14. *4 P/ E2 ]4 O0 m. s; Z3 R4 r3 J0 P
  15. * This program is free software; you can redistribute it and/or/ _) P8 N2 b& h* Z' N
  16. * modify it under the terms of the GNU General Public License as: N8 A4 M5 b/ r9 S) a$ H' ]
  17. * published by the Free Software Foundation version 2.
    6 H! l0 E3 O6 x/ }9 g4 c! f
  18. *" l- n, D8 z9 ?, f4 ?  L5 s
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any. S  {& B8 ?% s+ b7 A7 \
  20. * kind, whether express or implied; without even the implied warranty! e# Z+ o3 X) C- [5 n' _( k
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the* E) m2 l/ J( n' O& n7 Z, i
  22. * GNU General Public License for more details.) v+ W; q: n8 m& }
  23. */
    0 L* T. V7 [3 g0 T& f- i, d* t. p- ]
  24. - b- C; e  n5 k! w
  25. #include <linux/module.h>6 N/ {( N2 a9 \+ E3 M$ p# S
  26. #include <linux/init.h>. e; t: K3 }5 q4 [4 ?5 ]$ ~5 W/ P3 d) d
  27. #include <linux/errno.h>
    , B: I( e( f' C* |: I# l  b1 K
  28. #include <linux/types.h>9 g* \) ?! z; Z) ~0 N
  29. #include <linux/interrupt.h>. A$ b& c0 {9 q% b" ~
  30. #include <asm/io.h>* |( ?$ K8 o7 x, E
  31. #include <linux/moduleparam.h>& y; E; P' N+ b9 [
  32. #include <linux/sysctl.h>
    " Z  c( N3 N0 x; W8 n% M/ F
  33. #include <linux/mm.h>4 ~' D0 j! [8 ]* T/ |2 U
  34. #include <linux/dma-mapping.h>
    7 `7 w' N( f) ?
  35. * [8 l. t3 A: C: P
  36. #include <mach/memory.h>
    % R8 T* ?$ B8 T* V
  37. #include <mach/hardware.h>1 y$ R' S" |3 n4 X$ J
  38. #include <mach/irqs.h>8 Y* _4 G$ C2 {6 U# u$ d
  39. #include <asm/hardware/edma.h>5 e0 H3 z& ]# E

  40. 2 v: a8 R) L1 Y  Y
  41. #undef EDMA3_DEBUG, v7 c# `: s2 ~, b+ y# p+ }
  42. /*#define EDMA3_DEBUG*/
    7 }, J1 i9 a6 q

  43. ) j  Q; i- s$ j2 v% C
  44. #ifdef EDMA3_DEBUG" P! H1 Q# S4 B1 [, V/ D* V& R2 m
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ! K) u$ W  i7 l% d
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)  E9 I" Z4 O2 c: R& V5 g
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    6 w% W9 r" r# P: e
  48. #else
    % s5 Z1 R/ J' D
  49. #define DMA_PRINTK( x... )* W, v+ T1 r# U3 c
  50. #define DMA_FN_IN
    3 |! v0 A2 O' S( H, C7 ]: r
  51. #define DMA_FN_OUT5 p4 r! B  W# i: f: _! e0 Q
  52. #endif
    ! ?/ U. y2 z/ s( u2 q& ~
  53. 4 z* _' G7 _. e. @9 I' c
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)& k7 V$ o% j# B6 B
  55. #define STATIC_SHIFT                31 J; r4 D% j; b0 h0 H
  56. #define TCINTEN_SHIFT               20
    : L$ }$ p3 a8 ^' Y- q4 E6 L
  57. #define ITCINTEN_SHIFT              21" B4 ?' B9 X7 K% f0 c. g
  58. #define TCCHEN_SHIFT                22
    & p% Q1 ]7 H, r
  59. #define ITCCHEN_SHIFT               23' L- h( Z7 I! e0 e8 m; o5 ?

  60. + |; F7 u9 `. o2 {9 ~: n
  61. static volatile int irqraised1 = 0;
    ' a6 @1 n5 E0 i' M( i% X
  62. static volatile int irqraised2 = 0;0 |# E- K* r" [- e

  63. ( r& f5 j5 j* t3 ~5 y5 I- J8 o
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' Z/ s/ w- i- I/ M7 o. `- e
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 t7 L4 m' h! y6 I* A: x- {& i
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. ^2 e8 E) N7 X) K) `! I  I

  67. # b0 ~8 l: i$ Z1 H6 \
  68. dma_addr_t dmaphyssrc1 = 0;; }& y  j' B# Y3 c
  69. dma_addr_t dmaphyssrc2 = 0;& Y( V5 L$ h) K
  70. dma_addr_t dmaphysdest1 = 0;
    % O. _7 J: k4 V( t5 q
  71. dma_addr_t dmaphysdest2 = 0;
    6 m. F. c% s+ L5 m

  72. # l$ f4 o+ H  u
  73. char *dmabufsrc1 = NULL;
    3 c% l8 W. v& ]6 a. ^$ j( o( R. T
  74. char *dmabufsrc2 = NULL;
    ; n) e% g, p/ G5 H5 C; W
  75. char *dmabufdest1 = NULL;
    3 a8 M. n- |" Y7 r
  76. char *dmabufdest2 = NULL;
    0 Z# U9 A/ i5 @% W) V4 v

  77. . I" C9 u6 g& w5 r
  78. static int acnt = 512;
    ) @# m/ y% Z& l% \, b% p
  79. static int bcnt = 8;
    9 b  ?3 h4 `" I+ k$ F
  80. static int ccnt = 8;: v$ s1 U5 T. @; c1 N% l  @' i5 Q
  81. 3 y9 i6 |$ M% N+ Y
  82. module_param(acnt, int, S_IRUGO);! R/ w/ o; e& X7 @1 p
  83. module_param(bcnt, int, S_IRUGO);
    ; v' E! a6 [/ a! E  |. S
  84. module_param(ccnt, int, S_IRUGO);
复制代码
- b" o3 j( w: w- S$ S* O# G
/ r% |. `: t8 V9 S6 W- ^
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
  H3 H; u; P( iarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! C2 H6 s" P- o) b  d2 i4 W
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。  l% \% g; H) V6 I' [

; |  J/ f* Z# U) H6 `4 C7 U- T5 N6 A
# h. {$ B: s  ~
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-5 03:04 , Processed in 0.042289 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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