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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " B* `" p4 N/ l& P6 y
  1. [code]EDMA sample test application  }( G6 ]2 ?: F
  2. /*! R; i$ T+ f& ?. F
  3. * edma_test.c* A; r# ?  m( Z
  4. *
    + k' W0 A2 s6 A5 n) q# S6 V
  5. * brief  EDMA3 Test Application6 \. j9 d- Q) [/ f; K+ y9 G; O
  6. *6 b" p& g! U' Q
  7. *   This file contains EDMA3 Test code.
    4 D' Q. F% s0 [) z) d! r! D
  8. *0 |+ h, y8 r! Z! A+ P
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    # k$ `& S3 w0 e9 Y
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ( t8 e4 X  Z! ^4 U/ ?
  11. *         TO CHANGE.
    1 W; Q+ l/ Y* i* v
  12. *
    # ?1 W9 e4 {# \- p# [3 n2 h
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    5 f$ _' a& j+ U' |. a* r
  14. *
    # A+ _: t9 W+ `# X7 _* W
  15. * This program is free software; you can redistribute it and/or6 k4 E, w& I+ H
  16. * modify it under the terms of the GNU General Public License as: m7 B7 l% p7 c) O( `% [
  17. * published by the Free Software Foundation version 2.
    7 Q5 w8 t# P3 q. Y7 _" N
  18. *3 n$ e* U8 S( J5 n' C$ W
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    & p" J9 v" M/ [$ ^' c* Y0 [4 _! F- R9 |
  20. * kind, whether express or implied; without even the implied warranty) I& ^  b9 [  i- O; E7 j
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the; K( m) v; n' U$ y& s# o
  22. * GNU General Public License for more details.- f) c3 W5 `( V7 y
  23. */
    0 E( ]/ T0 Z7 }  X" B
  24. 1 g. U: x' H- \
  25. #include <linux/module.h>+ X6 v+ [( ]/ l3 `8 z8 w
  26. #include <linux/init.h>* n  C7 Z5 y! ?; t, |3 ?( i. ~
  27. #include <linux/errno.h>% H3 Y# r+ }, o1 U$ _) ?% M( f
  28. #include <linux/types.h>
    4 B# R$ V8 S: b' _& X$ P
  29. #include <linux/interrupt.h>. M: e6 G  o  m: r+ I4 F
  30. #include <asm/io.h>
    " l  [) a6 P  z/ K0 l3 m3 D3 U  O
  31. #include <linux/moduleparam.h>* S' }$ K% F! h, @) T7 X* j
  32. #include <linux/sysctl.h>
    7 S/ @2 Z( C+ v/ ~2 B
  33. #include <linux/mm.h>
    + d' E1 E, F% M" a9 `
  34. #include <linux/dma-mapping.h>
    # h: T3 v+ R  B  q4 G
  35. 4 |; G  Z# j6 {
  36. #include <mach/memory.h>
    " P# I* t! M+ h* |) L0 s* {
  37. #include <mach/hardware.h>
    ) y' K, n8 {8 ~  ]( Q
  38. #include <mach/irqs.h>; _' h. M! g& H7 M1 \% Q! F2 m
  39. #include <asm/hardware/edma.h>6 [6 q& z1 m* y3 `( I$ I" W
  40. ( \/ N! B+ n5 ?7 m; F% H
  41. #undef EDMA3_DEBUG! T9 y) L) E/ f* J2 ?( x
  42. /*#define EDMA3_DEBUG*/5 @" `+ ~3 Q; A
  43. & N' W) W/ C/ g$ T
  44. #ifdef EDMA3_DEBUG+ c& O! r5 \) T, u9 p
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    - M4 o: F' Z" C0 t0 l
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' Q; K( o7 q; \. x5 W
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    " I9 [* m% w3 d, d  Y/ E& b
  48. #else$ {1 D$ N! e* F  [6 t1 h2 g5 W$ V
  49. #define DMA_PRINTK( x... )
    1 J6 H8 A+ n4 c4 d
  50. #define DMA_FN_IN8 e* }" ?- R" [# \6 ^3 d, v
  51. #define DMA_FN_OUT6 ~9 p2 ^2 w* c% G
  52. #endif: A* E* x7 }$ N

  53. : O; s' `8 n0 e, _2 k9 P5 N- T- Z; s
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    % W% i& ]2 a! Z+ I' R
  55. #define STATIC_SHIFT                3$ l, w; O' ]% m' R2 e2 u
  56. #define TCINTEN_SHIFT               20
    ; _. s6 n) p- u+ C, O3 j* x
  57. #define ITCINTEN_SHIFT              21- d' m4 h( F/ \& H3 r2 _$ M
  58. #define TCCHEN_SHIFT                22
    ; l9 a: {8 q. |0 k. \+ f; ]2 L
  59. #define ITCCHEN_SHIFT               23
    ) E" S" ?; g# |

  60. % O) u7 e$ C, [$ ?3 f9 @$ Q
  61. static volatile int irqraised1 = 0;, r- @9 P" X! Q" q
  62. static volatile int irqraised2 = 0;
    ' c  c  a: l( r7 A! P# t: {

  63. ' C8 R3 w/ _& G6 r2 i
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- s' v! o' \' F8 F0 i) l
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 h, d  A5 u% r( h( k  o& J
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 u+ h0 W8 K2 T5 n' c2 H1 d. j. `

  67. ) M  N: {+ }! k. q' @4 F
  68. dma_addr_t dmaphyssrc1 = 0;
    2 O* A( s' ?+ p2 y2 p! F
  69. dma_addr_t dmaphyssrc2 = 0;* i: W& H, v! T
  70. dma_addr_t dmaphysdest1 = 0;; n) }4 t3 l9 j4 S9 t
  71. dma_addr_t dmaphysdest2 = 0;6 p( \7 x+ @- k8 g! G
  72. % R1 @% n6 \0 Q/ E' f
  73. char *dmabufsrc1 = NULL;
    $ P6 L# T  v5 F' d
  74. char *dmabufsrc2 = NULL;
    ) n9 d! h; t' c3 T
  75. char *dmabufdest1 = NULL;
    . L4 P0 O! \- W! x0 f
  76. char *dmabufdest2 = NULL;, n/ L* c4 N/ V

  77. ! i9 u3 D* [, `7 ^
  78. static int acnt = 512;; ^- D3 g) x2 ~' Y5 y
  79. static int bcnt = 8;+ J! ~3 q3 B3 Y, y$ s. [
  80. static int ccnt = 8;
    ! D/ F7 i) u0 _
  81. ( s5 q# w/ X+ b3 S: U
  82. module_param(acnt, int, S_IRUGO);- c3 M7 V" I9 F0 @! j; T+ m
  83. module_param(bcnt, int, S_IRUGO);  n/ e9 Z9 t% l& E5 i
  84. module_param(ccnt, int, S_IRUGO);
复制代码
! I& D6 q/ Z% \

9 Y# F0 E( X% U  j0 V' N      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' T& X- h! e# e/ j8 Farm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 W% S# O& L  f7 }3 j0 o% M0 l     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ ~$ Q1 d" M0 I* ~
" q7 A. @- @+ Z' t( x

4 B/ n  L- K, w+ S/ w
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-8-7 08:37 , Processed in 0.040434 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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