OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" V3 f& w3 l- @
  1. [code]EDMA sample test application
      \  m  o8 K  L
  2. /*
    7 e# m( C2 ~' ^! Q0 b7 G7 e
  3. * edma_test.c
    ; K  M+ m+ j: H( f$ q/ J
  4. *
    : j" }8 y8 A) K
  5. * brief  EDMA3 Test Application
    . l: j( W1 E3 t7 K3 \7 I9 s( b) ^
  6. *
    , Y/ R- q& w/ h. b5 ~" U
  7. *   This file contains EDMA3 Test code.
    : y3 c3 c% u! [7 ~( v; K: T' F9 F
  8. *3 m! F" `; v! ?$ r" g
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' \3 k2 G$ ~) j2 l2 J6 z
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- m: B" b. o1 R. t
  11. *         TO CHANGE.9 G1 k+ f; `/ Q% B) x
  12. *
    3 k% o6 R+ Z4 y1 c
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    + u" I$ X, q+ o: Q; b3 |
  14. *
    % D6 I1 F. [! @3 @8 u4 @+ i
  15. * This program is free software; you can redistribute it and/or
    + {% W* O. A3 G+ J% {0 H% e1 l
  16. * modify it under the terms of the GNU General Public License as5 S9 P5 }4 Q/ U- U9 h; D0 v
  17. * published by the Free Software Foundation version 2.
    4 x. J. }2 N9 p9 l
  18. *
    7 v3 v2 y8 [% u1 b
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any8 a3 P" R; e4 g% {; O
  20. * kind, whether express or implied; without even the implied warranty# f4 i# g, w- Z) |- o
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the; F8 ^+ v- _* ]& N, v
  22. * GNU General Public License for more details.
    ( B' v7 E, U  m, i$ ^
  23. */5 V- p( |- A4 h" T- E! c

  24. % O7 c' h2 h! L( [
  25. #include <linux/module.h>
    * ?* p( i- W& U* u
  26. #include <linux/init.h>/ ?% t1 a1 ]' K9 Z8 K: @
  27. #include <linux/errno.h>
    ( R- @- k% U1 c
  28. #include <linux/types.h>- j( M& v0 S. V
  29. #include <linux/interrupt.h>. b& b$ c5 e- X9 ^; L6 P
  30. #include <asm/io.h>
    5 Q) t9 E8 ?  M8 f  V& F
  31. #include <linux/moduleparam.h>
    ' C+ F. I6 `- L9 Y# d5 t& E% z, V
  32. #include <linux/sysctl.h>
    5 V+ @3 W, g% o/ F
  33. #include <linux/mm.h>7 [8 B& d* e9 C7 [
  34. #include <linux/dma-mapping.h>  s9 e/ |0 Y' @, x6 E6 m" [$ K
  35. % C9 ~3 ^& q2 i$ `1 S
  36. #include <mach/memory.h>
    " W1 y, I  O- c  l8 R
  37. #include <mach/hardware.h>* Y3 |6 k. X/ W2 ?. F  t
  38. #include <mach/irqs.h>
      g- _$ i  r  A
  39. #include <asm/hardware/edma.h>
    3 O: [0 y+ |- a# k- e- O& r$ ~
  40. 3 P. }, g) w' c# ^
  41. #undef EDMA3_DEBUG
    4 A3 Z4 ?% X" a
  42. /*#define EDMA3_DEBUG*/
    1 a$ O1 N/ l9 n# A2 R

  43. & ?4 E( ?5 E6 ^: I1 ^$ t" n) R
  44. #ifdef EDMA3_DEBUG
    9 |: P: F3 G7 N) i0 |
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). E* W9 n5 }: r$ \8 W
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    + }+ [. E$ n! P, D2 |) x$ o
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ G$ W' @$ H: X8 g) ?
  48. #else6 Z) e! s8 l8 m6 B
  49. #define DMA_PRINTK( x... )
    $ E( T6 i8 \0 `. {
  50. #define DMA_FN_IN
    ( O  C- ]( t! d
  51. #define DMA_FN_OUT
    # e, _3 B) E; K
  52. #endif0 k+ v0 ^( [' H; x/ M& v  z

  53. 4 ~; a' ]4 f; U- d5 r! g) ~
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    7 o0 f$ `' c+ g' ^0 B
  55. #define STATIC_SHIFT                3% @: V1 H3 n3 H0 h# b& W8 m
  56. #define TCINTEN_SHIFT               204 N: `6 l1 G9 H
  57. #define ITCINTEN_SHIFT              21+ I& L! l6 w6 a% x6 f$ U
  58. #define TCCHEN_SHIFT                22" I5 [+ L, j4 z' g* _1 @* s
  59. #define ITCCHEN_SHIFT               23; g2 h3 @# i) @0 y( g3 a& ^# c% w
  60. # m3 z8 o" L! ]6 f* ]
  61. static volatile int irqraised1 = 0;' i2 a: w- w% d4 H5 x, h0 {! F
  62. static volatile int irqraised2 = 0;2 X1 j9 u% c# @

  63. # T; m% q3 A9 W6 i
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 H, ~+ k- l, u9 K. {; v7 f. H
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . I% R/ _# x) _3 Y# h/ M5 j9 X
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ u# G7 `1 O4 z4 V

  67. * h9 P$ k* f. t# U% p
  68. dma_addr_t dmaphyssrc1 = 0;" d$ b; h$ d  R- v' S- }. j! Q
  69. dma_addr_t dmaphyssrc2 = 0;! ?9 _  p- ]& S9 e/ _8 s5 U
  70. dma_addr_t dmaphysdest1 = 0;
    2 e# \) R# z" v* D* u5 q/ L
  71. dma_addr_t dmaphysdest2 = 0;* V4 S/ [3 d: a' A' a$ b

  72. 5 R5 g, ^" j( N0 n7 J
  73. char *dmabufsrc1 = NULL;# H) ]$ h, F, Z. S
  74. char *dmabufsrc2 = NULL;
    ! Q: _. n8 Z" w1 @0 \
  75. char *dmabufdest1 = NULL;
    8 D: {9 h  M' r5 D/ R+ R; i5 M( e# b
  76. char *dmabufdest2 = NULL;# D2 F/ J" Y+ c/ u
  77. ) J. L  b/ g' F" V" i% J
  78. static int acnt = 512;
    7 l, B3 t- g* o
  79. static int bcnt = 8;
    6 A$ c- ?+ U) A; V3 e4 q2 [
  80. static int ccnt = 8;
    : \  F" W# r" D7 r, F0 c, L
  81. 7 B* ?4 y' ?; o: A
  82. module_param(acnt, int, S_IRUGO);
    - e+ c; `$ u- a% v* E% F$ Q0 d
  83. module_param(bcnt, int, S_IRUGO);6 A! e3 E3 r$ V
  84. module_param(ccnt, int, S_IRUGO);
复制代码
# ?; }9 \+ y* o" A1 ?: Q
4 s8 n# U( V. p7 v: R
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用: P! D- ~1 T- Z/ q
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) }& G! F+ @8 ?% Q5 Q3 k+ B; p  a% k
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。# H5 A1 G6 H6 b9 ~+ _+ U0 m, `
. Y, `8 x, ~2 D8 b: F8 T7 W

1 N, Z) l- p3 M% g4 n$ B* @7 |
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-1 05:19 , Processed in 0.038088 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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