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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! f4 t! A) Q% C) R; z! E
  1. [code]EDMA sample test application! _# p1 e' p; o& j# w
  2. /*1 t3 a' t2 f  C; C4 t: I; M7 k
  3. * edma_test.c
    : r4 F6 W& m) u
  4. *) [/ B1 h" t8 r' ?2 z+ v
  5. * brief  EDMA3 Test Application
    / r! r+ ~1 G3 i
  6. *& b5 L7 s: J( {1 P- \
  7. *   This file contains EDMA3 Test code.# O- |: B& R; R- J" V5 r/ c
  8. *
    ) ]7 f8 Z" H8 K. U
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    7 q& X" V; ?% X4 C: m0 P& C
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; `3 z' y# C( A* m: |! g$ e6 u% ~
  11. *         TO CHANGE.- k4 ?: S, p% D$ o: v% L
  12. *' B' A% m! q" \% }
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    4 F- }4 u, K1 q1 t: Q$ n1 }
  14. *
    / u3 a% b  C% t2 L7 E, y
  15. * This program is free software; you can redistribute it and/or
    9 k8 Z3 N& `& w1 M* n
  16. * modify it under the terms of the GNU General Public License as
    7 [  ]. y9 E" K8 G
  17. * published by the Free Software Foundation version 2.
    6 a" J2 }$ W) _* z- f
  18. *3 m0 q! T. {3 n! c7 W
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 y# _7 s7 T6 h5 q& a
  20. * kind, whether express or implied; without even the implied warranty
    7 a3 U1 l2 N& Q% ?+ q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the. L, W- B+ M/ B$ P
  22. * GNU General Public License for more details.
    1 y7 L$ }3 t! m8 ]- X
  23. */9 m( r- c1 r! @5 a9 i2 C8 N
  24. ; l- R9 y5 U( u2 W0 p# t" X
  25. #include <linux/module.h>
    8 s* c0 f/ T0 }- z0 j
  26. #include <linux/init.h>
    2 G5 R! q5 r+ N8 R1 @! t3 x  N
  27. #include <linux/errno.h>
    4 L2 @1 a# a  x3 o& }, J
  28. #include <linux/types.h>
    2 h" ?" a* i4 p9 @; I9 J, _9 Q9 ?
  29. #include <linux/interrupt.h>
    ' H( z3 D" {  G' h  Z9 x3 }7 c
  30. #include <asm/io.h>
    * g3 k! a' t5 D# Y- ?
  31. #include <linux/moduleparam.h>
    ) o' u. V+ E2 \) B9 {
  32. #include <linux/sysctl.h>& X( P8 N4 C$ `
  33. #include <linux/mm.h>0 _0 G; v1 d/ @# P
  34. #include <linux/dma-mapping.h>
    & G' d, {& e- H8 C- S; B

  35. 6 y; u) s& o/ d' S
  36. #include <mach/memory.h>
    3 [4 N( Z  \6 a  V5 J5 v/ p- X" f. }
  37. #include <mach/hardware.h>
      ?9 A4 H# r5 q% E
  38. #include <mach/irqs.h>) r2 G; ^: E$ E2 x% R2 z' |: J
  39. #include <asm/hardware/edma.h>
    8 ~+ J, {4 w  p; h. V5 p% A$ u

  40. 3 s1 r, |& L+ |& x1 O: Q4 r* F
  41. #undef EDMA3_DEBUG$ d0 ~# i8 k7 M) u
  42. /*#define EDMA3_DEBUG*/- x& \# }8 O7 Y, T

  43. % s3 T( R  w' o( R
  44. #ifdef EDMA3_DEBUG- `4 N0 w8 w" K' j, X
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ l) \" O/ l5 d0 {
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ) H; R! Q& E. b( ]5 ?& E: @9 L
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)% X4 W2 K3 H- A" V' T
  48. #else: [7 Z" f! T" w3 n4 f* P/ r
  49. #define DMA_PRINTK( x... )
    # G8 T2 U/ A* z2 y
  50. #define DMA_FN_IN! e) w, e( N6 Y% X  |) U3 ~
  51. #define DMA_FN_OUT
    * K3 f5 N6 }# s% a2 J- y& k
  52. #endif5 v8 v: w0 Q3 H6 A$ m" P! g" ~
  53. ' ^. `; ~4 c- [' S% h& b
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    # J+ G6 L9 z. _: I2 \5 C3 d7 v
  55. #define STATIC_SHIFT                34 `& E  A! D" ?8 b  P- m5 a! ?% V
  56. #define TCINTEN_SHIFT               202 d+ D& H& C9 F+ ]+ i& L) q
  57. #define ITCINTEN_SHIFT              21
    % q8 ]2 @  @2 O0 z; z9 H
  58. #define TCCHEN_SHIFT                224 g) `8 m9 |8 g, Q( ?
  59. #define ITCCHEN_SHIFT               23, o0 \8 K; \2 d- C6 ~

  60. + t- W/ H: J! j9 J4 _$ }, Z" a
  61. static volatile int irqraised1 = 0;6 r1 g; m) t6 O  Q; e% P' A8 z2 V
  62. static volatile int irqraised2 = 0;# K" v1 L0 Z0 y" G% ~
  63. 9 g) n( U5 U7 m5 c
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      n* W. F- Z" A. q) c7 f! y, d
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; @+ i$ ?/ k# c2 Y" j  B- O" T, Y, F. a
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- ?6 Y! Q4 N) h& R- k( Q
  67. ) }" U. e  i1 _. u- c' c% {& V
  68. dma_addr_t dmaphyssrc1 = 0;
    ) x5 c. D0 n# i! ?1 S2 |6 N9 V
  69. dma_addr_t dmaphyssrc2 = 0;
    : D7 u7 v4 {8 B  C3 ?
  70. dma_addr_t dmaphysdest1 = 0;
    % K' n0 j8 e8 l1 {+ U
  71. dma_addr_t dmaphysdest2 = 0;
    $ q( f5 t# [0 ~, G, b
  72. # H" {5 }9 J+ k9 o
  73. char *dmabufsrc1 = NULL;
    0 [/ \: l0 Z' E- h3 u
  74. char *dmabufsrc2 = NULL;5 X8 m, L7 \1 ^) O
  75. char *dmabufdest1 = NULL;$ R- A- n5 U4 Y4 D
  76. char *dmabufdest2 = NULL;
    8 r0 N; U" ?( E. f; h0 a7 Y
  77. 3 @' l  s3 g# \$ e3 b
  78. static int acnt = 512;$ [' x' l! @$ `
  79. static int bcnt = 8;6 @+ X0 s4 r$ G- ~, y% Z* a
  80. static int ccnt = 8;
    0 G. c. t8 k  d" |
  81. + E( M1 F: o  j) k* _+ k
  82. module_param(acnt, int, S_IRUGO);5 c; a% d4 k  [, J' L- z/ c
  83. module_param(bcnt, int, S_IRUGO);. s. N! a* x6 Y* w. p( Y, Q5 d( k# ~
  84. module_param(ccnt, int, S_IRUGO);
复制代码
; r! G4 M# v* H5 h2 B

. r5 M' W  _% l) r8 U$ b      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 \2 e. a& A  }; w  t9 x
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% W" @# R' @( o3 H     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 ~2 \. s1 B. u+ A% m- K* k
, ~' ]2 ?  s( t, A- X

9 L$ s6 k" x6 j
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-25 03:17 , Processed in 0.039259 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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