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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 Y2 H4 b8 R2 n
  1. [code]EDMA sample test application
    ; i/ S9 y# H* U* j( F% I' K
  2. /*
    + R( a$ F! b% E  E
  3. * edma_test.c3 V; k0 A; P) T, o5 w
  4. *
    0 z, {: p: S  T" o9 O& V0 m
  5. * brief  EDMA3 Test Application7 r; e: j$ D% c! F" Q
  6. *
    6 L% G  R9 n$ s; U4 G* [* h
  7. *   This file contains EDMA3 Test code.5 W# h" G. b4 Q0 _9 N3 u' X8 J
  8. *. B" I1 `# g+ l" r" F2 j. S; B
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    7 E) A7 L0 f$ x. \  d
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    # l3 ~) ?5 n( X! l% x
  11. *         TO CHANGE.$ C; j3 Q. {  v# X6 p
  12. *
    3 b) p3 Y1 Q1 D: N$ ?1 N, _
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) }* S$ j& P9 w; O: Q
  14. *
    2 V- f# M8 Y3 i4 |& p
  15. * This program is free software; you can redistribute it and/or
    & c: q  z1 M- x, @
  16. * modify it under the terms of the GNU General Public License as
    , J( D. ^& J# n1 G) ^
  17. * published by the Free Software Foundation version 2." `; `( K3 l2 \+ }+ s
  18. *4 z8 X$ h9 z8 t0 S  I/ ~; j
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    4 k# |2 y; z7 E
  20. * kind, whether express or implied; without even the implied warranty% Y- O3 N1 U( \' q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the+ X' m3 C0 G* b, M$ s; _$ r% v
  22. * GNU General Public License for more details.
    5 A6 q  F3 b! C# y& N$ \6 v
  23. */% S2 r/ C5 e  w6 W0 Y

  24. 2 E6 x* v6 g: S7 a* |& ]" B5 j) C
  25. #include <linux/module.h>! A. {* j2 ]5 Z: C3 c
  26. #include <linux/init.h>
    4 H, L$ n) l7 n5 U. ^* q0 {  c$ e6 T
  27. #include <linux/errno.h>
    ! e- e- n9 H) Z
  28. #include <linux/types.h>  M" G0 I  D. y$ L1 g
  29. #include <linux/interrupt.h>
    3 ^9 o0 J1 P- j: Y
  30. #include <asm/io.h>
    ; S0 K, ]! t: w- o7 {# ]7 i
  31. #include <linux/moduleparam.h>
    ! ?" H' {; L7 G4 W+ `
  32. #include <linux/sysctl.h>
    7 J+ Z6 Y) T) S
  33. #include <linux/mm.h>+ A9 c# t8 {) F$ T
  34. #include <linux/dma-mapping.h>
    " w% w4 f# Y+ }% J& L

  35. + i. P  L' h: N) {) i; m5 u9 [
  36. #include <mach/memory.h>
    ; ?# X9 W8 W% j8 t& h: }) N% K" Q
  37. #include <mach/hardware.h>5 L& O9 t* e7 a
  38. #include <mach/irqs.h>
    0 H5 h0 l  S7 {
  39. #include <asm/hardware/edma.h># r, E, t# A* \& W8 W' {
  40. 0 b) v+ m  B+ E9 l, n
  41. #undef EDMA3_DEBUG
    1 n: W5 Q' m" r: e% u( E7 t, f3 F
  42. /*#define EDMA3_DEBUG*/
    * |% h% q6 F( k' W( F: I! u

  43. # u8 A3 e2 ]  w$ r
  44. #ifdef EDMA3_DEBUG
    ' g9 U" i: Z' J  v, k
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    % L" W4 C8 [8 C, j0 @
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ; L' e" ?3 F7 `9 A# g
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- u) a; e7 g6 D8 a7 e( Q
  48. #else
    : v8 Y- A6 \! ^' K8 G# q9 U
  49. #define DMA_PRINTK( x... )* u) X# c$ F& t) ?) }
  50. #define DMA_FN_IN
    8 U4 w3 h; y" ?: z$ ]
  51. #define DMA_FN_OUT
    ) \- |. {$ b$ m' j
  52. #endif$ Z- U; c# x# q6 ~% E3 V
  53. $ @# Y- B  O: t
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ; L3 I% D6 T# a% r2 a* g: ]: ^
  55. #define STATIC_SHIFT                3
    0 w8 L4 q* G9 ^: \" O
  56. #define TCINTEN_SHIFT               20# O+ g! _- L3 i$ k
  57. #define ITCINTEN_SHIFT              21
    " G7 l0 h: j$ D. k, e4 r3 [' J* L, s
  58. #define TCCHEN_SHIFT                222 v4 ~7 l" J  ]5 j$ d  ~+ t
  59. #define ITCCHEN_SHIFT               23: m# i* m$ e* N5 V& s

  60. . N3 {, Z# o2 I  Y: y, l& v
  61. static volatile int irqraised1 = 0;+ R$ s; f8 Z, O1 b
  62. static volatile int irqraised2 = 0;
    8 [6 H# j' Q# ~) x" _7 f/ T

  63. 7 h3 \$ C! s) m
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 b& B4 \& N, b, l8 A
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 g8 j) ]" g4 R6 N) |7 D
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 [" I: S3 Y: m1 ]$ i8 J
  67. 0 Z! j0 e% {9 y& H" q% X' F4 K
  68. dma_addr_t dmaphyssrc1 = 0;& z% x" o$ |* L2 x( B
  69. dma_addr_t dmaphyssrc2 = 0;1 }5 x: X+ F4 A( M! r. ?- h
  70. dma_addr_t dmaphysdest1 = 0;
    % R; H) s& X4 O$ o
  71. dma_addr_t dmaphysdest2 = 0;
    % j% B4 |6 F4 B& @% M* G/ a0 Q3 _3 W

  72. ; k3 B- D; P4 H# C. r
  73. char *dmabufsrc1 = NULL;+ B' U3 j7 E& V
  74. char *dmabufsrc2 = NULL;/ U- |# i' ]8 N! G  U
  75. char *dmabufdest1 = NULL;
    7 w$ I, _9 H- v  Y
  76. char *dmabufdest2 = NULL;; e/ S! J; ~1 G' q# T7 R
  77. ) v! j; z$ o+ ^7 X
  78. static int acnt = 512;) j+ L. {7 J, Y! O4 [# z
  79. static int bcnt = 8;
    - E9 o4 a9 y# d- M
  80. static int ccnt = 8;& t) ^7 k; I5 E9 e; F" \, ]

  81. - z6 _1 v3 L% n+ C- M
  82. module_param(acnt, int, S_IRUGO);7 [$ R1 j8 ^. i5 k' k/ t1 e
  83. module_param(bcnt, int, S_IRUGO);
    1 R  i0 Z/ B: Q- j
  84. module_param(ccnt, int, S_IRUGO);
复制代码

" l/ g+ P6 ]. L7 a* J% _, q, y" G+ {6 ?/ c5 ~" d
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 t2 |( k! ]8 S& I7 X7 m
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
2 }- K& w3 I1 k     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: F! t0 N  ^4 Z1 C8 c

* Y5 \3 s  W  M0 E& g) l$ ~( w  ~4 @5 e# `9 Z# c* j
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-2 01:03 , Processed in 0.040442 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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