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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! g* f3 d  M6 w/ W( W8 b1 r
  1. [code]EDMA sample test application
    % c% [; s& M9 j5 C* M8 I
  2. /*/ k. r# f, [" H" T* w+ ]
  3. * edma_test.c6 j* J: D: l4 o
  4. *! j- Z/ {5 w) ~: h  O8 ^, q
  5. * brief  EDMA3 Test Application
    ; d5 @. o9 v4 N' g7 D
  6. *
    ( ]3 X- T8 l4 J% [
  7. *   This file contains EDMA3 Test code.
    9 A5 q# v3 N* {# s5 O
  8. *
    , W0 ^, D5 L' P# P% T# |
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& r# o" v2 U- S2 _, H3 _6 T
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ' i# z6 p$ V9 s' \5 t
  11. *         TO CHANGE.
    ' B8 K0 ^. m3 U4 q# z/ t
  12. *
    ' T2 Z& Y* p/ ^* C4 O6 y4 ~" r# s, c
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 M& H2 \( Z( p
  14. *
    1 j8 F8 `  o: T% Y$ y7 y  h: f
  15. * This program is free software; you can redistribute it and/or
    * F7 W, Y3 f3 M1 }5 j2 f# S9 W
  16. * modify it under the terms of the GNU General Public License as
    : a0 Q/ x* ~6 U- _( J
  17. * published by the Free Software Foundation version 2.
    5 R; h2 ^8 u( f
  18. *
    " t5 i9 N  _+ X: P5 c/ G0 B7 F
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any* K2 f4 K$ J: ~- c3 B% ?
  20. * kind, whether express or implied; without even the implied warranty7 {" p, c3 m% u- c6 Z& R/ ]
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the1 E8 `) B: O: l& k4 S
  22. * GNU General Public License for more details.
    ! h! F+ Z) r- |7 t6 G2 |
  23. */& v' d' D5 r. @; v1 B

  24. 0 h, `" m0 }& [8 X
  25. #include <linux/module.h>
    - K" m/ D# Z: i% i- ~3 y
  26. #include <linux/init.h>
    # W8 C. h* g- _! N) |/ y
  27. #include <linux/errno.h>
    7 K( Y- S  b6 o6 y6 D# q5 g  |4 g
  28. #include <linux/types.h>
    , ~2 a4 ^; |* Q. P  W5 A
  29. #include <linux/interrupt.h>- j/ B! W  n* B/ W* v
  30. #include <asm/io.h>* \, X4 U; u, }# i: R
  31. #include <linux/moduleparam.h>
    , {0 H# o3 f  b  P
  32. #include <linux/sysctl.h>7 W4 v# E1 ?5 u; C; b/ k/ b
  33. #include <linux/mm.h>
    ; j, w# ]8 @; p  N' E
  34. #include <linux/dma-mapping.h>' b* Y  E4 M) X* u0 [4 e" V

  35. 1 \+ Q3 [1 Q$ y" R) P0 Y  X
  36. #include <mach/memory.h>, k0 `9 h3 }/ F) D: J
  37. #include <mach/hardware.h>
    $ w' z) Z0 Q( m( s7 U3 {
  38. #include <mach/irqs.h>
    ; v" G$ }3 [% X8 j
  39. #include <asm/hardware/edma.h>
    + q$ @5 J! u% [

  40. ! M) ?" s* t' \5 X" j) X# _# k
  41. #undef EDMA3_DEBUG9 @( p. \; `, J
  42. /*#define EDMA3_DEBUG*/
    , W: x( _: Q% r6 u# F, o9 {
  43. , D2 A2 E+ C+ |$ \2 ^
  44. #ifdef EDMA3_DEBUG- ]. {# P0 \! k
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)  X& [, m2 T: Z# Z4 L
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): D; v5 m( Z) V
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    8 [8 E$ b  E: U- x
  48. #else
    ( N0 d) Z( F1 |' Z/ C3 u
  49. #define DMA_PRINTK( x... )
    + g, k" b0 g2 ?+ G2 |
  50. #define DMA_FN_IN
    ; j5 z* o% [( t( _4 {1 G
  51. #define DMA_FN_OUT
    ) W1 _# U. ?. J+ d+ {4 {7 u  p7 I2 ~
  52. #endif
    & {# L( g  i% R( T8 k
  53. ( H1 w# q$ x, a
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    + ?+ a+ a  |6 Q+ s7 y
  55. #define STATIC_SHIFT                3
    4 k1 F' f- O0 c9 ], L
  56. #define TCINTEN_SHIFT               20# b- w) Y; H' b4 u; |, \
  57. #define ITCINTEN_SHIFT              21
    8 Y/ {; w& D/ X% V2 y
  58. #define TCCHEN_SHIFT                22
    : S% N2 f' l5 Y& g
  59. #define ITCCHEN_SHIFT               23
    ) T$ p+ p, A; c3 W' a' \

  60. + q# x: ^' l$ i" A' J+ x5 A
  61. static volatile int irqraised1 = 0;
    2 ?7 h+ A7 |  H5 C
  62. static volatile int irqraised2 = 0;
    2 {1 a% O# @& c* m8 B- f

  63. + Q7 }2 O4 I5 v9 M
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 y; E. I8 I- C: w
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. _6 z2 U2 G5 \' w! e
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 C4 d' O2 ]3 [- y) U7 n- M: x$ V, g
  67. 3 A0 _6 ]" F8 G# O* c# b
  68. dma_addr_t dmaphyssrc1 = 0;3 e) g% u; `$ l
  69. dma_addr_t dmaphyssrc2 = 0;) n! }" _0 C1 a$ C0 h$ I$ D
  70. dma_addr_t dmaphysdest1 = 0;
    2 @4 n+ H6 P0 W/ B" b* t
  71. dma_addr_t dmaphysdest2 = 0;4 v+ N; b  p5 J5 @7 g$ }/ M7 L: C

  72. + q) t" G2 J  W5 g2 h$ h
  73. char *dmabufsrc1 = NULL;
    # W0 z9 ^& L3 G% x) U/ D
  74. char *dmabufsrc2 = NULL;! P& g# q* U+ I) k+ X
  75. char *dmabufdest1 = NULL;
    7 e  j) S! S: ~5 m8 y. c) @
  76. char *dmabufdest2 = NULL;2 ^- ]% M- c) e& {9 U: k

  77. % T1 @* D% [4 S- k$ F. `4 t- C2 L. L
  78. static int acnt = 512;. u. X" J0 T  n! R& \
  79. static int bcnt = 8;
    & I, ]& F6 Z9 C. u  q) O
  80. static int ccnt = 8;
    - I2 w% ~( ~0 w

  81. - t3 x; ?) n: C+ a
  82. module_param(acnt, int, S_IRUGO);
    9 ]9 I: _7 Q9 N6 E% b. N9 S
  83. module_param(bcnt, int, S_IRUGO);
    5 Q( t% q0 C. l: e1 g5 n
  84. module_param(ccnt, int, S_IRUGO);
复制代码

3 f) S: b1 W) P& r* M+ G. I# |
, _. i/ @! S, ?. K: K      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& U9 u+ G: v2 a, s3 Yarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ R9 x* K) r/ ~7 a0 c
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 T, A" P. W. |5 a5 z
* f, }) S4 Q! v0 C' S* t' m; H4 R/ P+ a3 ?1 m
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-26 12:52 , Processed in 0.040329 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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