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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; H6 h3 _. H" v' A4 ]1 X5 J
  1. [code]EDMA sample test application5 M; j& ]3 q' k" ?, u, c6 [  }' X9 Z
  2. /*9 N6 R/ l4 _9 Y) }! r
  3. * edma_test.c: w7 @+ A6 t# J! ]1 ^
  4. *$ [, x4 X+ }2 Z: Z9 r5 m1 R
  5. * brief  EDMA3 Test Application$ h2 ~- w% \0 s7 T4 t4 _
  6. *0 j& j" ~' [, A
  7. *   This file contains EDMA3 Test code.
    * A% u6 G: S+ [" m0 E
  8. *$ s' `3 _6 p( v# A$ T5 ^
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    / a1 K* u! Z& _
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    6 }6 r. b9 A. y+ x. k4 P& m* w
  11. *         TO CHANGE.
    4 a! A6 Q% v* P; O- J
  12. *: T  ~9 K2 a# `9 p# }# m: r# x
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 _5 y7 U! g3 z; e, C  s4 y
  14. *
    2 A( }9 u# }# F" D
  15. * This program is free software; you can redistribute it and/or# z0 V! ~0 t7 L0 e+ E. ^1 Y
  16. * modify it under the terms of the GNU General Public License as( L. I) g* A* C; `: j# {1 T& f
  17. * published by the Free Software Foundation version 2.
    $ `- f* z$ \" C& _4 [! c0 a
  18. *
    ; ~& Z' R7 S2 W6 i. u# v
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any" `8 a& O* `5 P& U. V
  20. * kind, whether express or implied; without even the implied warranty
    9 i5 Y5 k( ?+ d+ F
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the4 j7 q! S! l9 [( A. N" i: a3 X$ y1 [
  22. * GNU General Public License for more details.- Z( c: {, d: k0 L; [6 _. S+ z
  23. */6 a, r3 l, d4 L5 S+ T

  24. 0 Y' K! a) Z  ~' e
  25. #include <linux/module.h>" L6 K) y5 q+ o/ Y7 c7 c, F
  26. #include <linux/init.h>
    & f) }4 a/ X: t" q* `  i
  27. #include <linux/errno.h>
    4 U4 v* }# p6 n' C
  28. #include <linux/types.h>1 n$ ]. i  `8 a5 C% f! ~  r/ P
  29. #include <linux/interrupt.h>
    + M4 @3 ^$ }3 ]+ a+ Z( n
  30. #include <asm/io.h>( T0 H8 Z& n" n3 K  v
  31. #include <linux/moduleparam.h>+ O, q' I; u2 ?) e
  32. #include <linux/sysctl.h>
      ?' t# O1 T# f' x6 D2 i
  33. #include <linux/mm.h>- A0 F9 G1 `, J7 s% z5 m1 o1 {, Z
  34. #include <linux/dma-mapping.h>2 K; ^( v  S( b+ e( g  H

  35. ! |% ]6 P  e; t8 f5 K
  36. #include <mach/memory.h>
    * |; A' k# m* H7 `4 F9 u5 F
  37. #include <mach/hardware.h>+ M7 ~  f' R% S9 Y$ [
  38. #include <mach/irqs.h>5 n5 k0 r' {# N, P$ ]( C
  39. #include <asm/hardware/edma.h>
    : k8 r7 R' v& I3 f; q0 u% I
  40. ( w9 L* X7 C% p
  41. #undef EDMA3_DEBUG6 c0 z# Q4 ]) I' f( \0 G$ {. g
  42. /*#define EDMA3_DEBUG*/( S4 r/ s  t% S' r9 y) M  ]* Z
  43. 1 Q6 d+ x/ V; u. ?/ `* O) e' o/ g  e
  44. #ifdef EDMA3_DEBUG
    6 y  ]( K( R/ K& k- r' a
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), m7 U. B7 v. @0 h; V9 b) F4 c
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    + J& P, p3 \0 x" |- g" b5 A' E
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)  ?$ l+ H1 |/ V0 d- F* N
  48. #else% u6 q1 q9 W/ M$ \
  49. #define DMA_PRINTK( x... )
    $ h0 g; ^1 C# s) [, ?/ v$ ]: ?
  50. #define DMA_FN_IN& O0 P! a, o8 e6 f. `
  51. #define DMA_FN_OUT
    / a& \" w0 ~7 h" {: l  w
  52. #endif7 u8 g! _: g. n- ?4 ^4 G# b

  53. 2 [# ^' p$ Q( r# b& A
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    7 s9 C( {7 m( n! j. [$ e
  55. #define STATIC_SHIFT                3! N/ x9 q2 R$ ^+ K' ^2 a
  56. #define TCINTEN_SHIFT               20, X4 e+ I: |$ r2 Q
  57. #define ITCINTEN_SHIFT              21
    6 y' R1 Y. W, X1 I- `
  58. #define TCCHEN_SHIFT                22% g  S6 o" ~, M' B) o, `2 g
  59. #define ITCCHEN_SHIFT               23
    - K& k! q7 M  T; Q2 U& l) G3 \

  60. 2 ~0 {. E1 T! M! l" @0 N. l
  61. static volatile int irqraised1 = 0;
    , ~& T9 d! P- m& e0 u+ ~: K
  62. static volatile int irqraised2 = 0;& Y% M/ ~- y8 F. v, \0 n

  63. 6 M  J3 k9 Y) ^8 s( N
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. _9 ]' w! D' [
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 ?0 d1 X& ~8 k9 m; ]
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, E* T$ s- x7 b4 J. z% P  U
  67. * s0 B- Z2 ]% V' D4 A8 }3 p
  68. dma_addr_t dmaphyssrc1 = 0;' E+ B7 w: b; t/ K! q
  69. dma_addr_t dmaphyssrc2 = 0;# u" k6 a+ f2 v6 w+ P6 D5 F
  70. dma_addr_t dmaphysdest1 = 0;
    0 i! D% C& U9 |" X
  71. dma_addr_t dmaphysdest2 = 0;
    . @- }- [8 U, S# o# [5 ~# V
  72. : W9 n7 f$ o: d0 Z" Z
  73. char *dmabufsrc1 = NULL;% m9 m9 x+ b" ^. q+ Y
  74. char *dmabufsrc2 = NULL;+ N6 |# n& M0 w
  75. char *dmabufdest1 = NULL;
    ! \' V0 u4 i+ W( {% h( W  s
  76. char *dmabufdest2 = NULL;9 ~4 @! R1 a7 m' G7 A4 m
  77. - W0 e& m1 X# {/ {' u) o
  78. static int acnt = 512;% |4 i& V& |3 Z( {- M! d
  79. static int bcnt = 8;
    1 q7 e# K/ C, c* i
  80. static int ccnt = 8;, R$ f) {& w% u5 K. H2 h

  81. " q+ b: B+ _' m
  82. module_param(acnt, int, S_IRUGO);
    & n( ?2 e1 H5 V+ V) B
  83. module_param(bcnt, int, S_IRUGO);+ N7 X/ V; K5 d8 c$ i) D
  84. module_param(ccnt, int, S_IRUGO);
复制代码
  c3 u# V+ w+ w: \* j
+ n& v* T4 e/ ?9 K, d% p
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 n6 N% v4 C0 L, S; X" C- Rarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 A# h: M% n" H     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- R4 v) X# v$ B: s1 Q7 R
4 z7 n7 ?# j% H# K" e1 U

/ z* W! F2 N5 M: h5 {
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-27 19:13 , Processed in 0.039949 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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