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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . q) W$ U9 X# _' U# M
  1. [code]EDMA sample test application" z, C# u( b, [, R# n
  2. /*. T2 x/ A+ g* F, g( M0 o$ f
  3. * edma_test.c6 E2 U) K, `- e0 ]
  4. *5 I$ E1 j4 D2 t# ]+ Q
  5. * brief  EDMA3 Test Application8 {3 g$ K% c' b
  6. *
    " I3 m0 c$ U) \  v2 @# b: G' f
  7. *   This file contains EDMA3 Test code." B: r1 M9 ?7 i7 J
  8. *3 x5 j$ i: q' ^" [
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# R) a4 N" ~, |4 P0 r
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    & M& s; }9 V' C* o) P! N* r
  11. *         TO CHANGE.' x+ d7 a* _/ W) ]. N& \
  12. *6 ]1 g, E8 H3 d
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- s6 m3 Z# k0 R' d5 t
  14. *% o( O$ K" m4 c* z
  15. * This program is free software; you can redistribute it and/or
    " A, J. |  P( S( b' H7 a
  16. * modify it under the terms of the GNU General Public License as9 i1 F4 w3 t- ?+ e
  17. * published by the Free Software Foundation version 2.
    * {, q  w5 U, S$ a; J
  18. *
    3 C1 m  ~5 z, s$ K! N* Q
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 y5 c* s  Z9 h" C4 }
  20. * kind, whether express or implied; without even the implied warranty5 i. U6 a( Y4 c# E
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the/ _2 H* D0 \8 m( h( q2 M, C3 H
  22. * GNU General Public License for more details.6 g- c* e' T1 ~2 d  i3 f: U
  23. */
    ( }7 l8 o; B+ j+ S2 `4 x

  24. . N$ h* ]/ Z" O
  25. #include <linux/module.h>
    0 F. W3 K) A9 W5 a; o
  26. #include <linux/init.h>
    # E, f5 U1 ]3 R8 Q
  27. #include <linux/errno.h>
    % U2 N9 G2 [* C; \7 c3 {. t3 c
  28. #include <linux/types.h># O; a' k3 t4 j3 h/ J
  29. #include <linux/interrupt.h>* j2 T! K9 l6 N& g' m" l
  30. #include <asm/io.h>/ P0 e2 u, i. t) m5 O; R
  31. #include <linux/moduleparam.h>2 ?: b- z9 ?: S7 m3 V: i
  32. #include <linux/sysctl.h>
    6 I8 j4 R9 Y% `" E
  33. #include <linux/mm.h>% I# j+ l0 C; c6 a- x) w! e9 E
  34. #include <linux/dma-mapping.h>! g$ K$ D; f) J

  35. 8 v7 D. |$ J' R+ G7 w% ^0 |
  36. #include <mach/memory.h># y4 d# s( T/ l
  37. #include <mach/hardware.h>) ~, _+ y  S; T% N4 M
  38. #include <mach/irqs.h>1 t) l5 T! l  U
  39. #include <asm/hardware/edma.h>
    ! k  r! u) `) Z# y3 J# \$ Y) `
  40. , ?1 t8 I8 X7 y( l5 `7 d8 l( [
  41. #undef EDMA3_DEBUG& [8 @, j8 B" ]
  42. /*#define EDMA3_DEBUG*/
    0 S0 \$ D$ @' k; N+ T
  43. 0 m0 K8 h7 n4 K
  44. #ifdef EDMA3_DEBUG/ H9 {+ E1 M7 H2 _
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    8 h' O3 w+ j7 U* h; D) B
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    & r4 s) @+ l3 W3 [$ T
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    3 x2 Q* U+ X1 d
  48. #else
    $ p- c1 J" B( H! z2 J
  49. #define DMA_PRINTK( x... )
    / r9 s! L5 n, A; ~. b# `
  50. #define DMA_FN_IN
    1 g: d$ f* a9 c6 V
  51. #define DMA_FN_OUT
    6 N- u/ [- Z. `! U7 `
  52. #endif
    - @; P' n1 \2 Q) @9 Q; d" P
  53. & k1 c+ O  Y( G5 K9 c. e; b6 S1 ?
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    + t' M: W$ }) I7 x! C9 f9 f9 F  {
  55. #define STATIC_SHIFT                3
    2 i1 p# _4 d7 [' N& s& @
  56. #define TCINTEN_SHIFT               20* ~3 q* j- j$ X+ z8 t8 Q
  57. #define ITCINTEN_SHIFT              21
    0 W* r& R% Q; N8 P9 O& R
  58. #define TCCHEN_SHIFT                22- ]1 O  U- h- j
  59. #define ITCCHEN_SHIFT               23+ z7 w0 P* `: ~1 W# N) d& R0 G+ H9 O

  60. 5 x' [8 F- L/ Y, b
  61. static volatile int irqraised1 = 0;2 O. A- F& y9 r' K- j+ F/ a
  62. static volatile int irqraised2 = 0;
    * G3 B8 z/ N+ {3 {: e. y
  63. + S8 u4 t0 i3 y7 U" c$ Q% i; m
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 E. n) I: z+ O3 u
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , U% |7 K! n1 C4 g% s
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 W* a* M1 q: q$ w: B
  67. ( f9 H5 D5 |. o- X$ W- v7 b( Q
  68. dma_addr_t dmaphyssrc1 = 0;
    ' c" N' D% R& l) G& b5 Y
  69. dma_addr_t dmaphyssrc2 = 0;
    : o( R# T; L) Y9 A" ?6 K, G
  70. dma_addr_t dmaphysdest1 = 0;
    - X3 }$ \8 }: C+ j
  71. dma_addr_t dmaphysdest2 = 0;/ {5 p1 v) _% Y( ]# j
  72.   r2 p  k9 J3 q6 m8 Y4 Z
  73. char *dmabufsrc1 = NULL;, D0 S# N! `* I4 h* @  `
  74. char *dmabufsrc2 = NULL;
    . G: V1 o8 i: q4 ?3 z
  75. char *dmabufdest1 = NULL;
    5 C* k3 D0 `+ s, Y* T$ N1 D
  76. char *dmabufdest2 = NULL;
    / E5 n" t+ h3 @& a, S( }

  77.   X5 V1 n# g/ U  `  a- [, L; n
  78. static int acnt = 512;" |6 f9 F* A: X( e8 ?, p# Q2 }
  79. static int bcnt = 8;
    ( f/ P2 r' `: d( _5 [
  80. static int ccnt = 8;
    7 i, g7 j3 m1 L# |7 ?

  81. 1 n7 N" X6 ^+ r2 N: f: w
  82. module_param(acnt, int, S_IRUGO);
    # A: B4 b9 g4 X
  83. module_param(bcnt, int, S_IRUGO);' }4 H/ H( A# P$ X, L' o9 C
  84. module_param(ccnt, int, S_IRUGO);
复制代码

5 L# ]# \( w% ?0 c0 W7 g8 ^6 m
" e9 S9 G, R0 K$ Y' M; J0 [& E! h( t0 T      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, N  K* V- i/ t; s- H7 }6 ^  ~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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 X; j/ h: u6 o4 j+ A" ~* x  q     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 C7 X5 a% {6 ~# W: ^  L8 |9 |1 h7 u) |4 M  _$ H

2 o  n, \8 E+ `$ W; W
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-23 22:03 , Processed in 0.044881 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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