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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
& ~0 ^, u( Q" Z  s+ j$ \% S  R2 ]
  1. [code]EDMA sample test application
    ( y; }( a. g7 Y2 H
  2. /*
    * W8 `0 r9 b1 D0 m: J! v3 E
  3. * edma_test.c
    * o3 `5 ~5 |" K* o" a. C! j
  4. *1 P, e2 i6 _/ M
  5. * brief  EDMA3 Test Application
    ( h0 J+ n: c8 S; z  }4 x" G
  6. *, d6 H9 i# z2 K% x
  7. *   This file contains EDMA3 Test code.; A7 Z" P6 I4 J1 i( J7 W1 e
  8. *
    . g- z- `0 t& d7 C
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ( p, M/ G, u5 Z% I
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- ^9 H2 Y) e$ I$ q3 s
  11. *         TO CHANGE.) ]2 J$ w5 i5 o  D9 p3 `5 j9 O9 i8 Q
  12. *
    , u1 E" E! I9 Y) ]1 W9 U5 m
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! g0 `3 X( l8 A8 w- U' `" X% ~
  14. *+ B* z) k) z7 i- s
  15. * This program is free software; you can redistribute it and/or( @  |8 c( e& B& l0 j
  16. * modify it under the terms of the GNU General Public License as
    % E+ `/ ]+ B0 P* w. m
  17. * published by the Free Software Foundation version 2.
    * M/ L9 p0 Y8 b# ~) m. E
  18. *
    # M7 m$ f. s3 n* ~
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any  w) T/ p1 O( `( b
  20. * kind, whether express or implied; without even the implied warranty, a/ B- H+ a- D' K
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    + |/ z/ J& |2 T; g7 {+ F- O8 O
  22. * GNU General Public License for more details.
    & T( z- t0 w! i) i1 h/ b8 x+ d! k
  23. */
    " f* y- K# A0 \! S2 x# \
  24. + d, z: k6 k8 X! B$ K- A
  25. #include <linux/module.h>
    5 F1 J  s+ [/ ]% ]: T  D$ a
  26. #include <linux/init.h>
    ' a+ p, P1 L6 I2 y) U
  27. #include <linux/errno.h>; m+ W" n% W. L7 [( Y
  28. #include <linux/types.h>, P  l3 X) h( i: K+ o1 k
  29. #include <linux/interrupt.h>) |% L. m7 k: n( o, U5 ~" i8 B' Y" N
  30. #include <asm/io.h>$ q- Y, M8 A' g3 x8 l/ b" ?
  31. #include <linux/moduleparam.h>
    . {; r! C2 h# \3 P; P
  32. #include <linux/sysctl.h>. W) a  O! E0 c. T
  33. #include <linux/mm.h>2 Z5 d8 _8 ~# G( X# A. O
  34. #include <linux/dma-mapping.h>, U; n0 r" x% r% L8 T/ _( b
  35. + N6 k" J4 Q1 \/ I$ h
  36. #include <mach/memory.h>
    0 G7 `( G3 `. R( c- S
  37. #include <mach/hardware.h>7 t7 `) P+ {: i9 S( t
  38. #include <mach/irqs.h>
    " U$ j, n: \* b2 g  f
  39. #include <asm/hardware/edma.h>
    $ @4 V0 n3 J* L) U# z- S
  40. 5 w! q' s* t7 F' d! U9 K
  41. #undef EDMA3_DEBUG
    $ i- u" b4 F( z" X. \3 Q$ }
  42. /*#define EDMA3_DEBUG*/
    0 I( \7 A" t: d1 A6 x

  43. . M: V4 T9 s) f) F
  44. #ifdef EDMA3_DEBUG) Y. `+ P0 V; j
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    9 ?; L* h% L. G' F# k  S# Q% D
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ) [$ b' ~" q$ ^6 W
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ U1 Q1 r7 i) ^0 l+ g# Q
  48. #else1 b1 k" {4 K) ]4 e
  49. #define DMA_PRINTK( x... )
      i; p5 Q8 Q! _  b$ m
  50. #define DMA_FN_IN6 ~% O* |7 v5 Q. v+ M( q
  51. #define DMA_FN_OUT
    % x4 w, N" U  `( w0 ~
  52. #endif
    6 S' r+ ?. _) a! a5 c1 B' G

  53. # X5 L# H% f4 l7 l/ T; _3 o2 i
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)# u- w" b2 c7 o6 I7 s/ P4 [2 ]
  55. #define STATIC_SHIFT                3
    ; p4 D5 c9 f6 I* |& n9 B% F) D% z) C8 ^
  56. #define TCINTEN_SHIFT               20" b" q4 E* P6 N: P; _! \
  57. #define ITCINTEN_SHIFT              21$ [; l' ]: Z) g
  58. #define TCCHEN_SHIFT                225 W% N7 f8 j! P
  59. #define ITCCHEN_SHIFT               23- y8 Y+ Q! T% L8 Y

  60. / c! A9 P6 ]% i4 R5 s# X2 c
  61. static volatile int irqraised1 = 0;  U6 V* j6 {0 \8 y" k! H( F3 L
  62. static volatile int irqraised2 = 0;
    6 S' {2 c* H4 Y" q0 e! b1 P

  63. / L' ]# P) A4 v$ t2 `: `7 T7 ~; V3 q! l
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / R  ]: D% O. ~# [
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / k2 m' u: ^' S
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 n2 I4 ~2 L& A% G3 S6 i

  67. 6 f) o& |5 a. N- k. K# Z
  68. dma_addr_t dmaphyssrc1 = 0;5 S( l6 t2 v, l% b- d7 [( ~
  69. dma_addr_t dmaphyssrc2 = 0;
    ! Q- b- b. J( G% Q9 s, E+ D+ C
  70. dma_addr_t dmaphysdest1 = 0;* O( R( M) C! @. W* i! z' {3 B
  71. dma_addr_t dmaphysdest2 = 0;0 {& @1 n3 p: ^) p! H& d
  72. 9 j1 D3 Q7 G# D, _' N, S5 W
  73. char *dmabufsrc1 = NULL;" n# T0 F' y9 u2 o  I# h. i" h% x- A
  74. char *dmabufsrc2 = NULL;4 t0 ]2 J1 l, q# V6 j  y3 c7 y
  75. char *dmabufdest1 = NULL;
    1 h2 U0 e( ]+ e+ w! d9 k7 e2 F
  76. char *dmabufdest2 = NULL;
    / M# j/ ^" [4 C
  77. - S, `7 }/ k& Q% x
  78. static int acnt = 512;( W6 u( n0 }2 _. M, c7 E
  79. static int bcnt = 8;  a; {& F: X! \# J& U; _* y
  80. static int ccnt = 8;
    8 Y5 J* Y8 a* T+ [9 u* v3 H- l

  81. 5 [- _; G3 e5 g) A! A; o( i
  82. module_param(acnt, int, S_IRUGO);: x/ L: F6 `0 W% X# c
  83. module_param(bcnt, int, S_IRUGO);3 _6 V: v! q) P- V/ v# V  |1 v
  84. module_param(ccnt, int, S_IRUGO);
复制代码

* c; D& \1 \+ e3 r* O/ d7 {2 u2 ^& D. @2 C) b" b
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 @5 R# u( c3 S9 V; H
arm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ `8 d  c9 X3 r0 i
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 M9 J. P+ G2 K& ?, y3 M$ `7 [5 C* U- |5 e

% `& U1 }8 z# `0 @" Y2 W
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-28 02:54 , Processed in 0.045802 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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