OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: u1 b2 x9 A/ I( o, H
  1. [code]EDMA sample test application
    : @* E$ F6 C$ q: Z
  2. /*3 p5 i- |1 {- {8 }$ I4 g
  3. * edma_test.c
    ( }1 Q, }- D4 \/ m* R
  4. *( J* p7 j$ c: Q9 n  A: L
  5. * brief  EDMA3 Test Application
    ; x3 \" V  s5 m2 X! I
  6. *
      N5 v& M' A; m' {$ T" `# L9 l; A" P
  7. *   This file contains EDMA3 Test code., W, i4 w4 W2 e" D
  8. *' R5 C6 K& d9 d# }: r3 L8 q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 w4 K+ z: D5 B
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ X/ y* y* r8 s) Y
  11. *         TO CHANGE.& x# v: L  ?2 B; S
  12. ** {" d9 H* F- K
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    8 J2 v/ R% ?1 f5 q$ q4 d) B" Z
  14. *
    9 p( x' {- h/ i* d8 U" M& L2 ^
  15. * This program is free software; you can redistribute it and/or
    4 k$ W: |# m! K# q, K# O. B
  16. * modify it under the terms of the GNU General Public License as
    % Z, u4 t6 z/ s; }" A; H
  17. * published by the Free Software Foundation version 2.* r: Y3 N, L( {& c& Z! _" h
  18. *
    + L" ~  H* z4 r$ C7 {4 ^
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    8 R( ^9 @3 v$ C, g# L
  20. * kind, whether express or implied; without even the implied warranty
    * R0 J% K& C  d/ z7 z# m
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the4 u* ?2 s0 n- O& @; y8 P
  22. * GNU General Public License for more details." z" y9 J" U6 Z: J5 s4 p$ i
  23. */$ ~% G0 I+ e' z; n  i
  24. 7 V5 V- _: ]  R( d3 S& k
  25. #include <linux/module.h>- P, @2 h7 d8 G5 i6 D
  26. #include <linux/init.h># s& j6 v" k# H% M7 b4 ?1 Q
  27. #include <linux/errno.h>
    * I4 M) g8 ]9 N7 V2 i6 e
  28. #include <linux/types.h>
    9 ?" F6 P, r) G2 M" l0 ]3 K& n
  29. #include <linux/interrupt.h>
    ' I# l2 B! G) n, E9 b- @7 _, U) V- Q
  30. #include <asm/io.h>
    6 N8 m5 d, s" D3 l# E4 c
  31. #include <linux/moduleparam.h>
    ; Z2 ~/ m; L* e) H
  32. #include <linux/sysctl.h>
    ; U$ t, z5 q8 f* v, a' m3 ?9 f* w
  33. #include <linux/mm.h>
    ' U' h  e3 M; F" r" G3 C
  34. #include <linux/dma-mapping.h>
    ! A2 o4 M% U+ w% C) v
  35. 1 e3 n) J# a4 `4 ~% O) c
  36. #include <mach/memory.h>
    ! b0 L/ x* u4 \1 W6 P
  37. #include <mach/hardware.h>
    % i2 y- I* I0 {+ m3 c
  38. #include <mach/irqs.h>4 @' z! n3 ?" I4 [; K
  39. #include <asm/hardware/edma.h># E. |. H6 a; D# y0 y
  40. - T* ^) n7 ^% _' ~* S' \
  41. #undef EDMA3_DEBUG
    * L2 b1 N- {/ q8 y' Y
  42. /*#define EDMA3_DEBUG*/
    + A+ `$ T- {9 E2 T- W! B

  43. ; q8 [0 [- U# d! d
  44. #ifdef EDMA3_DEBUG
    % D: k5 K) X# I- p9 Z5 Z9 N
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)9 ?% g6 N5 p" f
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    4 [0 ~7 o& p3 W/ }+ `1 m: D1 \
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
      c6 E; z2 j0 w. L& }" G& t% [2 d
  48. #else- c% u2 g0 N: T3 b1 |/ y
  49. #define DMA_PRINTK( x... )0 [+ f+ ^! I2 M
  50. #define DMA_FN_IN, H% X3 d! n  [3 X0 @
  51. #define DMA_FN_OUT
    / i9 j* }4 K8 B2 H
  52. #endif
    - w3 [& ^7 A: e
  53. 0 E, L2 C+ m& b5 T6 I
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)! i5 F+ A; ]  `! a6 \
  55. #define STATIC_SHIFT                3; t) a* D) X5 q
  56. #define TCINTEN_SHIFT               20
    ! p  e, v# a  G4 k9 W2 w/ m
  57. #define ITCINTEN_SHIFT              216 Q3 L* H0 g4 o
  58. #define TCCHEN_SHIFT                22* x3 o$ @3 B4 a
  59. #define ITCCHEN_SHIFT               23+ z& j4 M5 o% K) j- I3 q
  60. / Y" Y' s; `! j+ O+ R
  61. static volatile int irqraised1 = 0;
      o% Y3 ]2 A* {4 `
  62. static volatile int irqraised2 = 0;
    : k- e* n3 g7 e5 m9 l7 K3 U
  63. , h/ w' e! G, \9 l% f6 Z
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 ^( A7 a. L6 L! V, O
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 i3 X" K! I2 ]1 v- X9 y" e+ b
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ ]" x+ T( \# e0 b* U8 A* o
  67. . Y* p5 d' S$ _. C! s! l
  68. dma_addr_t dmaphyssrc1 = 0;4 E/ @: m+ y/ \, E, o& J, G* r7 B
  69. dma_addr_t dmaphyssrc2 = 0;4 S9 \3 V  f0 |) f; O
  70. dma_addr_t dmaphysdest1 = 0;
      m  u& E! ?4 G% x: ~
  71. dma_addr_t dmaphysdest2 = 0;2 e- g  C, q! D' R  u  w$ [8 m. c
  72. 8 U' C( h. m2 r0 i/ d* S# m1 Q; u
  73. char *dmabufsrc1 = NULL;
    . _3 h& ~% G! e2 S- y2 E2 m
  74. char *dmabufsrc2 = NULL;# S* e% H8 ?6 Q# K  J. Q  W
  75. char *dmabufdest1 = NULL;# `# X; P! ]. q9 w9 ~/ Q5 D
  76. char *dmabufdest2 = NULL;4 ~% v9 `2 D5 e7 @
  77. # R9 f* r- {# d7 U( j
  78. static int acnt = 512;
    : h" O& N7 M+ q; z" W
  79. static int bcnt = 8;3 [( N$ p. e/ K7 T( V
  80. static int ccnt = 8;+ S, ^, T6 L; j4 ~0 R
  81. " h0 S! {: C% p$ N" S3 e& v6 C
  82. module_param(acnt, int, S_IRUGO);: @6 {. ~" i+ J# @3 I
  83. module_param(bcnt, int, S_IRUGO);
    # y, F) N# ?1 N
  84. module_param(ccnt, int, S_IRUGO);
复制代码

6 l; O# n4 r6 n- M& _! B& k( q; h4 F6 ~# t
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- f3 S! a2 q5 k0 \- e; v0 g& Q: Narm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ z4 X3 p) H/ t! w
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。" A) Q/ p2 ^& S1 V  M8 q

8 M( s4 q1 I  R- J% |/ z( @2 B# _. Q1 u2 G. X# |* R
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-26 07:19 , Processed in 0.037672 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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