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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; g$ b& C2 d1 J- r
  1. [code]EDMA sample test application
    % U4 y) G+ J4 T8 t
  2. /*
    % ^0 V2 I# u1 ^; t1 Y2 Q2 U! t
  3. * edma_test.c4 q6 @5 y( e/ {6 m$ ]. v4 ~& a; N. k
  4. *- O0 S- k7 e2 l7 m+ P' {
  5. * brief  EDMA3 Test Application, L5 H) }/ C% C) |5 `9 K
  6. *
      w$ Q4 @) i, Y  h1 x( S- s
  7. *   This file contains EDMA3 Test code.& |6 o( p5 q) j2 S
  8. *
    ; C* ?8 a" a& T, f, C0 |
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    & S/ a+ D/ K2 d* ]9 b1 C1 `
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. M; Q# G0 L. i/ B$ n' `9 s1 M
  11. *         TO CHANGE.
    8 ?, N0 f$ y7 O1 W! J2 h+ y
  12. *
    : K( s* x( u+ ^+ e. ]9 Q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 y0 l( a: F) Q/ H0 r
  14. *) e. A, @; }( G- ], [
  15. * This program is free software; you can redistribute it and/or
    , c- }/ b. Y- U( J6 \
  16. * modify it under the terms of the GNU General Public License as  Y) r7 a6 j3 l! o# S5 x: g
  17. * published by the Free Software Foundation version 2.8 A3 ~3 d0 O  t% R
  18. *
    ! }9 Z2 N5 T5 I  f" M' o
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any2 H8 A" n7 |. m0 l7 t$ V1 ~1 P
  20. * kind, whether express or implied; without even the implied warranty2 C' O- h  N! J, l; m3 r" U
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the. K% ]4 c& m, ?# d- R" h* ^
  22. * GNU General Public License for more details.
    0 x9 ~+ V2 ~0 _1 y
  23. */
    ; n8 G, c+ H2 r; h/ H$ `( b7 G
  24. $ u5 B% H1 h" I. K! m, J* c
  25. #include <linux/module.h>
    % ]8 y! i, S7 I7 M3 Q
  26. #include <linux/init.h>
    * y9 Y! @7 @0 X: w
  27. #include <linux/errno.h>; w8 E7 @  V1 t/ v/ C. R
  28. #include <linux/types.h>: x9 A; ]1 e( a* n  O# `7 `
  29. #include <linux/interrupt.h>; {% v1 t% t, `4 W
  30. #include <asm/io.h>  E+ v8 |9 A+ x  r7 g$ i/ z
  31. #include <linux/moduleparam.h>
    3 y( h1 D& ?- Z. x, ~1 y* Z
  32. #include <linux/sysctl.h>
    7 X& [4 s$ r2 t) _5 i- \% @6 S& D
  33. #include <linux/mm.h>0 T& _- |1 M" ]3 a  c& m9 m; n1 C
  34. #include <linux/dma-mapping.h>
    . j2 [# d" a4 j3 \/ C

  35. 7 H- I8 U5 Q2 K0 _
  36. #include <mach/memory.h>
    / V- \( G4 ]" V. p
  37. #include <mach/hardware.h>
    7 w$ q: z# l0 v4 S2 w9 h" X. w
  38. #include <mach/irqs.h>
    ; O9 v) r. H+ w: L5 C
  39. #include <asm/hardware/edma.h>
    3 s  x1 A' @# H: ]
  40. 6 L' [& [) Y8 o+ |% V
  41. #undef EDMA3_DEBUG0 d1 ?! d$ ]: s8 ^
  42. /*#define EDMA3_DEBUG*/* T9 P1 X$ k+ |6 L2 ~) p. b, s

  43. 4 u1 ^3 a9 G3 c8 J+ W/ W' s, K
  44. #ifdef EDMA3_DEBUG
    . w. v! ~9 N1 i* l' r% O
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
      A  X- `/ @2 u! M3 N) {1 r+ Q; q8 ~
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    9 p: Q+ y0 W) j
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" J% t6 h) b" P
  48. #else% V' K4 A* o5 V! A; ~3 ^7 W' w
  49. #define DMA_PRINTK( x... )
    0 D, @) i/ b& H" P/ C
  50. #define DMA_FN_IN
    9 B2 P) f4 k+ ~. G! g: Q
  51. #define DMA_FN_OUT: e8 h8 P4 z. p/ H9 {8 J
  52. #endif+ S. X) e) D/ p6 [& m" @
  53. . f% m  D/ x3 K1 }, V" n, `# d6 b/ w
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    6 o$ N3 b1 Y7 t. z
  55. #define STATIC_SHIFT                3
    % |/ W6 Y6 P4 t7 Z/ b- a
  56. #define TCINTEN_SHIFT               20: ~3 E: d0 O! d& ?7 Y# a& G5 ~3 m
  57. #define ITCINTEN_SHIFT              21
    6 g8 J. i  p/ D0 O
  58. #define TCCHEN_SHIFT                22
    ; x/ t. n8 x. R. k/ J# Q  M4 O
  59. #define ITCCHEN_SHIFT               23
    - t( R4 n9 u* f$ i6 z  o
  60. . M% e2 U+ p& j& n
  61. static volatile int irqraised1 = 0;( C4 N. m4 P& l" m
  62. static volatile int irqraised2 = 0;" W' E7 d% l3 P' a' q' c

  63. - ]! B! e. j+ Z1 T' u
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 U  T8 R0 W9 t
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # U* Z5 k: [9 t
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ R1 q* S. V# A9 r, ~
  67. , D8 o6 W! J  M, _9 _
  68. dma_addr_t dmaphyssrc1 = 0;! W! u# O- Z' M- W7 O3 X% d9 d
  69. dma_addr_t dmaphyssrc2 = 0;! G8 k+ |% F$ \/ W
  70. dma_addr_t dmaphysdest1 = 0;
    " T! M+ Z" l, h. w9 x
  71. dma_addr_t dmaphysdest2 = 0;" U% H- \: L7 a3 w6 ^! V7 ?% T& ]

  72. ( f: U  \! w# C9 [/ R* @! N
  73. char *dmabufsrc1 = NULL;. e. v0 ~2 v& k
  74. char *dmabufsrc2 = NULL;1 d# @- I% c  l6 u. \: T. x3 }3 V
  75. char *dmabufdest1 = NULL;
    / h! ?# R3 i: x+ g5 G
  76. char *dmabufdest2 = NULL;
    4 E6 K; T, V- ^6 K% r' Y

  77. " J) X! |2 p8 l- n( U5 ^( Z
  78. static int acnt = 512;5 @& X; T4 _2 u* x
  79. static int bcnt = 8;4 D4 ]: s. A" [
  80. static int ccnt = 8;
    * O$ {; u: Q4 i4 r

  81. 3 H& ?* B& T4 B/ }' k- S
  82. module_param(acnt, int, S_IRUGO);7 f2 P! s! B/ Z' T
  83. module_param(bcnt, int, S_IRUGO);( S7 n1 q! t- q+ @7 t* G2 D* L0 g
  84. module_param(ccnt, int, S_IRUGO);
复制代码
& y3 `* g" q4 e) J
# R- U! W6 L6 p+ J4 R; w. M
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ S; i% Z9 D/ E
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: S6 R9 g# x( M; T% z
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。* {# m9 v& h2 j

4 O0 G# m! u' |2 ]( K# c3 j0 D
# }7 o+ ^3 y# B+ ?& y2 \7 [  y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-27 01:53 , Processed in 0.049054 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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