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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑   @! B: B$ ^- h  v) {2 V8 D
  1. [code]EDMA sample test application
    5 Y3 \, W3 }1 ?7 T; p5 d
  2. /*7 Q4 ^  @: o  m3 |; k1 R8 [$ h
  3. * edma_test.c. h3 A; _1 I9 l- j+ q
  4. */ C0 w& ?8 K; U3 K; r
  5. * brief  EDMA3 Test Application: H! G% [- o' D9 H' @
  6. *
    7 F# q# o# }! s, W
  7. *   This file contains EDMA3 Test code.
    ( ]2 Q' M0 I" w$ `, ?3 U5 M6 Z
  8. *3 @9 d3 o% z' Y0 N+ U7 x* V
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! y7 _9 n8 I5 C. `
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    6 t" N# X6 `8 q9 h8 @' ]
  11. *         TO CHANGE.
    9 ~% I; C3 {0 D( z# l
  12. *
    5 V% t* T9 b9 n! P4 ]
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    - m. R0 |9 X: Z) g2 ~' x
  14. *
    4 [9 u8 P5 g" G* A
  15. * This program is free software; you can redistribute it and/or
    & m$ q% D: K) |7 ~
  16. * modify it under the terms of the GNU General Public License as8 f" q' {. Y8 b5 ]6 @: m( ^4 M. T( Z% X
  17. * published by the Free Software Foundation version 2.3 u+ u0 b; u5 p
  18. *
    / `" K4 \" i' X! c0 }
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    & c( T! D# ]: X( z. {$ ^& U2 f
  20. * kind, whether express or implied; without even the implied warranty
    6 y" M/ d5 v: d5 Y3 v. k
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the6 P% N1 i, j7 H: j2 y7 o
  22. * GNU General Public License for more details.$ p' M  j6 F; A$ F5 @- ~- \
  23. */
    * E3 U# p' ]0 z" l  J
  24. , G5 a3 B; J$ J$ \
  25. #include <linux/module.h>( O; z5 d) [' B" Q1 [8 P' l
  26. #include <linux/init.h>2 t" A- n0 F' I, d" y  r/ ~
  27. #include <linux/errno.h>. v& J& _9 G6 F+ o: ]
  28. #include <linux/types.h>' F7 o7 f6 x/ a8 A$ w2 ?2 Y3 z  j5 |+ c
  29. #include <linux/interrupt.h>% |- g, L1 @! _" Q1 _4 L% }* P! K: R
  30. #include <asm/io.h>1 L+ @) ^8 h7 b7 [5 q" r- W* Z
  31. #include <linux/moduleparam.h>
    ; W6 x( t# j9 l" L: x& e: i
  32. #include <linux/sysctl.h>7 l" y) i) }; K. \0 i
  33. #include <linux/mm.h>. Y0 [6 c( s5 ]) A
  34. #include <linux/dma-mapping.h>* z7 F' r' o1 x$ Y5 ~

  35. * Z; S) m  n; z
  36. #include <mach/memory.h>
    , j. I  A' R) S, c
  37. #include <mach/hardware.h>+ g6 K+ _0 ?. A% S( U' J5 M
  38. #include <mach/irqs.h>
    & g8 z$ P4 C2 \! A- w3 j, I# w
  39. #include <asm/hardware/edma.h>
    5 }/ C  c; S* G) O% w2 |

  40. 7 H* ?+ f$ \+ @' Q3 ^" r
  41. #undef EDMA3_DEBUG
    ) t# q3 `% ]) j* h$ K4 M" F
  42. /*#define EDMA3_DEBUG*/
    1 u+ c" @7 `0 Y
  43. " |6 |7 Q: V8 H  D
  44. #ifdef EDMA3_DEBUG) L! G! [2 |. M& \
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    8 c% y& O7 u- |* E) C, W  R
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ) ^$ [  h$ i' p2 a  N' q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)8 e9 A( d0 u6 X% {
  48. #else
    / d: |1 A8 o# c) v3 d' k) Y
  49. #define DMA_PRINTK( x... )  w. A( c; z3 c( c: o6 }  N
  50. #define DMA_FN_IN
    ! c; T3 C* X, r$ k" l0 I4 G
  51. #define DMA_FN_OUT# }1 G/ l  p  g" D7 Y0 P
  52. #endif" @) M  k$ U0 @/ ]

  53. " R" h; x9 {! {' ^6 d) a4 o3 O
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768); _+ f7 D7 D6 T) Z6 e
  55. #define STATIC_SHIFT                35 X8 ?% D$ I" @' m! e% c# T
  56. #define TCINTEN_SHIFT               20
    * r3 o2 I, b/ K
  57. #define ITCINTEN_SHIFT              21
    + O' R8 l, M0 L7 w) }3 \
  58. #define TCCHEN_SHIFT                22
    # ^0 L; P+ r: W0 J  N& W
  59. #define ITCCHEN_SHIFT               23
    . ~& R4 N3 R5 m. N: j% ?! p
  60. $ m7 w7 |/ J- y3 g  {! Q2 X
  61. static volatile int irqraised1 = 0;3 |7 f) |4 W& r3 q( X
  62. static volatile int irqraised2 = 0;1 |, D7 x: k* y% k" X" V6 ]- s
  63. ( N1 C3 e( D6 d1 T) b
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ b( q- o4 @, ~% K1 j& c5 o" u
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 U' F/ E* w! x
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " i0 l9 L& o" l& G
  67. & W7 j9 a1 c, ?, `6 c: Z/ A
  68. dma_addr_t dmaphyssrc1 = 0;
    / b8 q+ Z% M  K; f
  69. dma_addr_t dmaphyssrc2 = 0;
    % u: ?5 ~7 @0 {/ y+ _% ]6 S
  70. dma_addr_t dmaphysdest1 = 0;
    & a& Q! O0 k3 w' H2 y
  71. dma_addr_t dmaphysdest2 = 0;9 \6 ]0 D' ]# O

  72.   o' I$ e. E* u- n: G8 T% v
  73. char *dmabufsrc1 = NULL;
    * a- M) m0 O1 c% x/ J" W- o
  74. char *dmabufsrc2 = NULL;
    : y0 j; R0 A9 b7 g! _
  75. char *dmabufdest1 = NULL;: |' W9 M/ P& t0 v
  76. char *dmabufdest2 = NULL;$ ?# b1 s- [' d. N, \& t
  77. 1 E$ `% V( I5 R5 R& l  n. H% h
  78. static int acnt = 512;7 D- d# `, R/ r: n8 I+ l$ M
  79. static int bcnt = 8;
    6 D6 ^, _% x: H
  80. static int ccnt = 8;: R1 R4 r7 N# u

  81. 8 p# Y. c9 A2 D
  82. module_param(acnt, int, S_IRUGO);
    6 {5 e# U+ T, Y' ]- f
  83. module_param(bcnt, int, S_IRUGO);# v7 F9 C, Y0 v
  84. module_param(ccnt, int, S_IRUGO);
复制代码

8 T, t, j: `0 z. [% {) e
* X' T0 @% k, \3 A( \! [5 M( ?      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' G& {# K* P5 u
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。7 B2 a+ k( H6 d5 P3 J
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。; a7 O# Q/ p# I) \7 B8 H
* H! m# D6 S4 G2 G

9 V2 T- ~. i7 J4 C
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-25 04:25 , Processed in 0.045928 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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