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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & {; o2 j+ T# l. y
  1. [code]EDMA sample test application
    ; E! O# D, m. H3 B- ?7 J4 v
  2. /*% B: o# \8 \2 Q/ L& C
  3. * edma_test.c* P! D6 s' {( t" e2 X
  4. *
    & z  S  e, p1 O0 u
  5. * brief  EDMA3 Test Application
    $ C& g$ V* T6 Z7 H" Q4 z6 {
  6. *
    9 Z; k- _0 r% s% g4 D
  7. *   This file contains EDMA3 Test code.
    # e! }- H" i/ m( L& J0 _( s
  8. *$ t7 D+ F8 [0 F/ s2 ]( M; W
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 `2 Y* L. D# {6 @
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    % H/ Q6 ?) U% d  |! e5 A
  11. *         TO CHANGE.
    ! p( e) E. d8 X: w' M5 {7 |4 [/ E8 y
  12. *# n+ a0 V3 q5 X: b
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 s; ~% U3 ?. C5 t! d
  14. *  V1 ~1 h, r2 z5 R' l9 X# T2 h) H( q
  15. * This program is free software; you can redistribute it and/or
    * M3 l! H$ c+ j7 G& k
  16. * modify it under the terms of the GNU General Public License as) q  P5 E9 G4 ?4 t2 Y
  17. * published by the Free Software Foundation version 2.
    ) f  I" r  W) a& x* B1 [- j: c- P" k
  18. *+ x3 @+ ~# i+ |& Q2 r4 K3 D
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any7 r+ k- e  W3 P! r. w
  20. * kind, whether express or implied; without even the implied warranty
    4 |' ~6 E9 G1 V- E' y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    0 c4 ]+ U( q  o. v; F$ C: J1 C
  22. * GNU General Public License for more details.1 E) _; O6 }. H  h$ W2 g
  23. */
    % J0 B' g) R+ C/ @- H5 s6 |

  24. 0 C! a1 ]( R- m" }0 n# `
  25. #include <linux/module.h>
    , u' Z% ^" ?# K; k3 K* N" r
  26. #include <linux/init.h>
    5 c" ~5 Q" y3 l" c5 k
  27. #include <linux/errno.h>
    1 j$ Z8 X6 p+ O  I) Z) o
  28. #include <linux/types.h>
    & k8 [/ E3 J4 E3 E" d
  29. #include <linux/interrupt.h>) U( o* l5 \2 d$ {; n% n; m5 u
  30. #include <asm/io.h>
    % c1 Y. w5 X  c" I1 M' o
  31. #include <linux/moduleparam.h>, k8 t% Y$ N" V% }. R
  32. #include <linux/sysctl.h>
    ! ~* K$ e9 n. U
  33. #include <linux/mm.h>) m, M8 {+ ]% s, B" k% h
  34. #include <linux/dma-mapping.h>: i5 ]- ~9 M5 @- M+ S: b
  35. , w9 m4 a. ~$ _8 B9 F% f1 ?
  36. #include <mach/memory.h>- Z: n. S0 W4 C
  37. #include <mach/hardware.h>
    4 O3 ~9 y' z1 O1 ]8 s
  38. #include <mach/irqs.h>
    / n. ^- ~& F1 {9 a
  39. #include <asm/hardware/edma.h>
    - N& G, G) F0 w7 g. E4 c
  40. / G+ s+ V0 Q4 ?8 q
  41. #undef EDMA3_DEBUG
    6 \& V  W9 y* H, m$ y1 _
  42. /*#define EDMA3_DEBUG*/
    ; E" h5 |; G9 s4 Y
  43. . \) K1 r' q$ s( W7 T
  44. #ifdef EDMA3_DEBUG
    $ N2 O8 i) i! q
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    0 K8 Y* m; T$ N5 }8 r! W2 f
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ; E! E$ J$ ~5 y# M: ^
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    9 _! D+ o( A4 O3 @2 n
  48. #else! I, Z6 n6 r5 {
  49. #define DMA_PRINTK( x... )
    ) ]# [4 A3 X" O8 q) j
  50. #define DMA_FN_IN
    " Z/ N% W$ d2 m2 U
  51. #define DMA_FN_OUT
    , B5 D2 ^3 f: o; g+ m
  52. #endif, Q8 P0 ?% y. z6 J, U" x) Y
  53. / W+ y/ Q  a5 |! {2 G
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    8 H; W& f! A( X8 L  X, ^+ J# l) S2 G
  55. #define STATIC_SHIFT                3
    : X2 Z- _  k1 h6 L: y4 n& J
  56. #define TCINTEN_SHIFT               20
    . k6 i7 _) b% v9 ~0 A
  57. #define ITCINTEN_SHIFT              21! x# y. ~: v! q9 ]) {3 Z7 K  K) s! o
  58. #define TCCHEN_SHIFT                22
    8 |& ?- {# ^8 ]# u: I
  59. #define ITCCHEN_SHIFT               23
    2 e) E1 M) z' c, B  L
  60. 9 O: u% Z; A8 u. c7 A# w; U/ I+ H4 p
  61. static volatile int irqraised1 = 0;$ g' E) Z" F! q4 W+ V
  62. static volatile int irqraised2 = 0;8 d& d" U2 s+ i. J

  63. 1 z$ ~2 K& R2 _& A8 t) j
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 I. T5 [" ?) b8 [" @5 ^
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( S+ _9 _' v9 |
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) T/ T6 H4 l& A2 ~

  67. ! B: p& ?; W/ U2 C
  68. dma_addr_t dmaphyssrc1 = 0;3 y8 a9 V$ ~, T- t/ g
  69. dma_addr_t dmaphyssrc2 = 0;/ _' e  }# G8 E% a3 \, B
  70. dma_addr_t dmaphysdest1 = 0;
    + a- _+ V. a& z2 T
  71. dma_addr_t dmaphysdest2 = 0;
    ! [. h4 P3 n6 t  Q3 ?2 }
  72. 7 Y! ^# |* s8 F* O; J* Z  k) w
  73. char *dmabufsrc1 = NULL;) t, u' `  Y2 D0 a$ f2 Y9 P
  74. char *dmabufsrc2 = NULL;
    2 x( D* R) u/ y) l& E
  75. char *dmabufdest1 = NULL;
    9 Z8 e$ ^4 z. ]# M" h
  76. char *dmabufdest2 = NULL;
    2 {* a# Z$ `8 Z- g

  77.   {7 S' m2 ]4 u  x
  78. static int acnt = 512;. L3 @. M% f+ ^8 Z7 M  @; N
  79. static int bcnt = 8;$ t( u/ E, |7 A" r$ ?: N# i* S1 d
  80. static int ccnt = 8;* G( p% u4 O& W, C5 \$ Q

  81. ! X/ b! M$ h7 S( A: s
  82. module_param(acnt, int, S_IRUGO);0 {$ u% o" |( J" \' N
  83. module_param(bcnt, int, S_IRUGO);
    * b; _. |& j0 E
  84. module_param(ccnt, int, S_IRUGO);
复制代码
0 U' m2 D8 H( z/ G+ [5 X+ {
; }' s- K$ f+ O0 `4 k2 h) E
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& T; g, q/ v; [- {7 u* D, T4 Q4 {/ _  Farm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& I4 W& Q5 k$ b$ x" j& E+ }     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 q6 F2 p' W% e
8 H. |! ~$ C. e4 Q- O$ f& F

; i0 h* M+ O! [9 Q# a
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-3 04:21 , Processed in 0.037430 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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