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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 v0 U# k; x+ @) K1 X" \" U
  1. [code]EDMA sample test application
    # C3 y# R. X! \# T* u: J
  2. /*: c: G( M5 ]4 C5 U$ |3 {, e, r0 t
  3. * edma_test.c
    " V; U9 Q1 S* t& F
  4. *
    * T  S) Y$ }- w
  5. * brief  EDMA3 Test Application2 h* B- r' |; t4 g* G% q
  6. *
    9 g5 v# Z+ [) `0 E2 \( I* v4 _
  7. *   This file contains EDMA3 Test code.
    $ f! X' f" p% I- V! ^
  8. *5 S( ^- ]9 U: t; u
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 q; c' Y1 w3 |4 z0 ?) e" x
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; Z3 l' B5 q6 G
  11. *         TO CHANGE.4 I4 r4 I* s+ U( ~# e3 W
  12. *
    / \/ C+ y" T/ M
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    0 g& X: B3 {9 H( Y! N
  14. *0 E3 N4 c& _6 _) B/ i3 B% O
  15. * This program is free software; you can redistribute it and/or9 M8 }' B; F& K6 R7 x8 C% b
  16. * modify it under the terms of the GNU General Public License as9 M  y: H$ K3 i& ^( m& v
  17. * published by the Free Software Foundation version 2.
    3 q" v( B% s8 _- y3 ~% z- q( l& u
  18. *. B5 C/ G) g8 w3 L
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 z" c; {9 `2 A" v2 |' U, t
  20. * kind, whether express or implied; without even the implied warranty
    % u* |; H& J3 c; z, U  m) `
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    6 M6 F. N6 I) j9 j6 `3 l
  22. * GNU General Public License for more details.
    , L! d2 o: E# P8 I' `
  23. */3 ?( X4 ~  f% R# W0 H
  24. - I* z0 A% o' |) D; b
  25. #include <linux/module.h>
    8 T5 `$ G  Y/ k2 s# ~3 @
  26. #include <linux/init.h>
    + ?. ]2 a: ]: k1 y; J' E
  27. #include <linux/errno.h># C  p% Y& D. t. l! X, V$ E
  28. #include <linux/types.h>. z" [9 a9 `+ N; [6 z, v% A! f
  29. #include <linux/interrupt.h>
    8 S! W( k7 b8 i! r5 K
  30. #include <asm/io.h>
    % D: _, O0 E# K$ v4 l' Z
  31. #include <linux/moduleparam.h>
      H& R0 r) h) ]: a& R' r8 u" x
  32. #include <linux/sysctl.h>& G" c0 b' j0 c5 S$ A3 C
  33. #include <linux/mm.h>
    ) s( {) M3 r; s1 O7 ]  V
  34. #include <linux/dma-mapping.h>
    * s, B( l3 E. P, M- ~. I
  35. 7 L' {+ v% r% \) v1 m! C/ a) ?) ]
  36. #include <mach/memory.h>
    + w9 h. @* @3 u! M, D+ u' X+ g2 K  }; D
  37. #include <mach/hardware.h>! o5 Z" }) ?9 M; @& S
  38. #include <mach/irqs.h>
    : a1 O8 I+ f: D5 j  Q
  39. #include <asm/hardware/edma.h>
    2 Z; `; N6 R: ?" w$ C! F$ `

  40. 1 I2 C) m. h6 R/ l, I
  41. #undef EDMA3_DEBUG* p. ]+ ]( j3 s3 M
  42. /*#define EDMA3_DEBUG*// t9 K& Y0 m9 [

  43. 2 {* x! {0 o) c5 f; P- g
  44. #ifdef EDMA3_DEBUG: U* S' g" Y: |
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    % ^% Z9 u- y4 t% ^; X; |) Z! S, Z+ G
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    7 R: h( P/ B6 W5 q# O, G
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 l! ]& A! U5 |1 d. I, i
  48. #else+ r1 P; e5 D2 H) g. {
  49. #define DMA_PRINTK( x... )" O' N- S% @& h& L: a
  50. #define DMA_FN_IN
    # N. \+ V! x$ t
  51. #define DMA_FN_OUT
    ( r# s: ]; U, i/ U: F
  52. #endif
    $ a' @9 z& F' j. [2 F

  53.   E% Z. O0 q5 [4 g. C, n
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)7 T0 A, @( H/ u1 d# w, c- W
  55. #define STATIC_SHIFT                3- X; _8 n' y2 F, _1 o; e
  56. #define TCINTEN_SHIFT               20
    - D; L% k5 M. e* \6 t
  57. #define ITCINTEN_SHIFT              21" L) h$ J; t5 @
  58. #define TCCHEN_SHIFT                22
    - W/ M  ?  `! v" c" I" q
  59. #define ITCCHEN_SHIFT               23
      S1 f4 N1 J, X

  60. 2 A1 m" v, U8 s2 Q) i" d
  61. static volatile int irqraised1 = 0;8 E* u: R2 l* s# k  U' `6 S* `
  62. static volatile int irqraised2 = 0;
    8 B% U) ]  L# T8 R1 Y+ I

  63. ' M% i5 p! |' Q% _2 K* E
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 o( H' n/ ^4 p1 W. ]6 D9 E
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 f1 c. t8 K1 r6 V) s" {
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + `2 a1 A7 O) S2 h6 j+ c" N9 u1 Q
  67. ( n2 ^$ z2 z# R( J
  68. dma_addr_t dmaphyssrc1 = 0;
    ' v) v* D8 H- W" a! C0 D: t# a' u
  69. dma_addr_t dmaphyssrc2 = 0;
    2 _. x, [; G& D, }5 u
  70. dma_addr_t dmaphysdest1 = 0;
    & r# A8 s0 u7 L7 u6 m! J
  71. dma_addr_t dmaphysdest2 = 0;( |3 p5 z5 e7 N' I
  72. - c, N6 U, H5 j7 H7 V
  73. char *dmabufsrc1 = NULL;
    1 U6 A5 N  K7 B8 d$ u
  74. char *dmabufsrc2 = NULL;; K0 `' |  @: Z
  75. char *dmabufdest1 = NULL;
    / y1 Y! Z+ a  N2 ?
  76. char *dmabufdest2 = NULL;" S) {! N, Q$ c+ R8 F
  77. 3 H' \& P+ b. y+ Y* I) V7 m- _
  78. static int acnt = 512;; _* B# e6 f4 ]+ F3 f
  79. static int bcnt = 8;
    3 X: b1 Z5 J( }: e
  80. static int ccnt = 8;
    % U& t5 a" b. V+ Z
  81. 4 K2 u! D. Y6 ^
  82. module_param(acnt, int, S_IRUGO);
    4 c. S  x( O; J$ Z
  83. module_param(bcnt, int, S_IRUGO);
    2 |7 G" R4 _6 ]- G- T1 `
  84. module_param(ccnt, int, S_IRUGO);
复制代码

5 _- d3 u# B- a
( `" B$ t6 a: v- i/ w9 H8 ^      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用2 N4 d& G1 \+ t9 J' i! i
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' }" x. x& M8 G. e( b     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 t4 }2 }$ J- e% e# j' s/ x# U* H# ^! h
2 I- [9 g  @5 @( o) y$ f
" \6 ^. d! @9 ?1 j7 b; o
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-17 05:02 , Processed in 0.043329 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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