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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " Z0 R- p9 n! z, {
  1. [code]EDMA sample test application1 x. o3 s# K  k- ]9 v% m
  2. /*
    8 y: X3 F2 n6 C4 N- F5 e' w
  3. * edma_test.c9 M& K5 B+ m4 k5 {7 ?
  4. *
    / R2 ?* e: o- b4 {2 N
  5. * brief  EDMA3 Test Application+ n+ V! T! w- T& J& q' b: u! f) c
  6. *
    ( v( L% _8 M: a1 E) P# m, w2 a& x
  7. *   This file contains EDMA3 Test code.
    5 g% `5 G! N/ k) P4 t' [
  8. *5 U* c0 i$ D; W7 l* A8 e& ~
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    8 E6 k3 B# U( `' C5 O
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ n9 `( g0 p8 c! @/ H7 y9 G
  11. *         TO CHANGE.
    ' y& H* J. a6 A3 f* E; o9 |
  12. *
    ; O: a6 |+ X% X6 z2 i9 q( y! H8 n- K
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    1 q1 r$ I& ^: M5 J  c; H
  14. *3 U( J2 s2 F* K' `7 `: w  _* g0 @2 R. j
  15. * This program is free software; you can redistribute it and/or+ W3 S5 m0 _+ d$ W3 }
  16. * modify it under the terms of the GNU General Public License as
    & p+ f# H+ v! [; q' L/ C+ ]
  17. * published by the Free Software Foundation version 2.7 ^& e" j5 M4 p, Y
  18. *) u+ l) Z- h* T" U+ \' `- e" T& V
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any- P0 m1 D! t! P. g
  20. * kind, whether express or implied; without even the implied warranty! Q" d8 Z( {5 M& p! T. }# ^, I
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    4 I. O& x3 \* T! x
  22. * GNU General Public License for more details.: y# q# h: V6 ~5 o) S+ T2 P
  23. */
    3 @- m; X; V; X6 A% p" ?4 ]

  24. . F+ m' Q- R8 v% A4 |( |( f
  25. #include <linux/module.h>
    4 k6 e  @& r% m. V
  26. #include <linux/init.h>! @7 [3 v/ I0 D3 n
  27. #include <linux/errno.h>
    1 i1 I6 b8 T& U% T* z5 V3 j
  28. #include <linux/types.h>: w1 y3 l0 p! O: f- h; s
  29. #include <linux/interrupt.h>; i, Q8 H* X, k
  30. #include <asm/io.h>; K6 ?$ W* ]: s* T
  31. #include <linux/moduleparam.h>) b. M8 y. W3 _) J8 y/ l
  32. #include <linux/sysctl.h>
      ?9 v% d' {! w3 L7 H/ y
  33. #include <linux/mm.h>
    ) i# c4 e! g7 v) m* _, n2 t
  34. #include <linux/dma-mapping.h>& o* u7 k4 N- U4 g) T/ C& {

  35. 3 V1 {4 H- [2 y/ |; ]; d/ N% \
  36. #include <mach/memory.h>
    / f# x% g' ?: B. e/ S; L: Y6 ^
  37. #include <mach/hardware.h>
    9 N9 n6 |1 [+ G6 o& I6 g
  38. #include <mach/irqs.h>) }2 j+ C6 n2 i& b! z3 H: j5 K2 q
  39. #include <asm/hardware/edma.h>
    : P, ]' `* p% K6 ]

  40. . [& m% S4 @7 w( c* z- r
  41. #undef EDMA3_DEBUG# }" A( P: E: K4 F  o( @1 I
  42. /*#define EDMA3_DEBUG*/
    , z- X( L+ t5 Y8 k& h. X- W

  43. 2 w' ^4 W. c' R9 ^3 |
  44. #ifdef EDMA3_DEBUG& R& z3 j4 E# ^4 _5 V- v5 p
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ D9 W" d+ j! Q) u+ X& e$ O4 F5 U
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    : ?" Y% _9 B% ~
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)5 D$ k. y# V1 {2 ?
  48. #else
    ! i2 J' r0 c& s# X; i- n0 ?' A
  49. #define DMA_PRINTK( x... ); a  q: R: h: f8 o. O9 x# D# X) E
  50. #define DMA_FN_IN3 q( T) I/ Q/ N5 ?# c& d' K
  51. #define DMA_FN_OUT
    5 O0 Z" K# u- G, d9 V% n
  52. #endif7 R: T% m) |0 j8 J- r8 i/ E. `7 R6 C
  53.   b: F- O$ Q6 [( V7 K
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    % F/ Q. g. Z9 N* n6 D2 \
  55. #define STATIC_SHIFT                36 Y2 A/ B; }" [9 T- a' f
  56. #define TCINTEN_SHIFT               20+ C4 [- f; U$ d7 O4 o7 h' w
  57. #define ITCINTEN_SHIFT              21
    1 x3 q" L- c2 T6 [; G3 A
  58. #define TCCHEN_SHIFT                224 _& v. f' }: n8 ]4 N7 m
  59. #define ITCCHEN_SHIFT               23
    9 Z9 i/ K8 o- @9 y

  60. * {: Q+ e* w  L& E! j/ b8 B  @
  61. static volatile int irqraised1 = 0;
    ; F; q5 U0 X& f' i& @1 r' D
  62. static volatile int irqraised2 = 0;2 o' m- f$ X) }- O

  63. 8 t% x9 [. }6 i
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 e! `, T, l6 L, Z% u* h
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - N6 {! ^3 x( Z
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 {9 g# V6 Q% ?8 g% g' s

  67. 8 x) X% r% m7 R, F( N
  68. dma_addr_t dmaphyssrc1 = 0;
    4 h6 F6 _, ~# {" w3 }7 g2 I0 j, @
  69. dma_addr_t dmaphyssrc2 = 0;' j+ R: m2 |" E5 N8 H4 m* \; `
  70. dma_addr_t dmaphysdest1 = 0;
      J0 A+ z- L7 Y# \: J8 G
  71. dma_addr_t dmaphysdest2 = 0;9 o" ~  k: X8 r

  72. : R" i  A  a5 }7 v; q& V5 R
  73. char *dmabufsrc1 = NULL;* E. [" X3 `# F3 L7 A
  74. char *dmabufsrc2 = NULL;) Y! ~9 C4 c( @7 _" E! K: w% v5 a
  75. char *dmabufdest1 = NULL;
    6 k2 {! |( d8 [- |! F) ?/ ?2 p1 y  m
  76. char *dmabufdest2 = NULL;* }. @* c2 N- p( S/ J; d
  77. 4 L' G/ u! N8 c
  78. static int acnt = 512;) |7 Y% y' Z2 m2 f/ b5 y4 S& d" ]
  79. static int bcnt = 8;7 G! P; t! Y8 W, b2 U' K
  80. static int ccnt = 8;* n' G8 e2 {  X& V

  81.   y) O& f% Q- o+ _
  82. module_param(acnt, int, S_IRUGO);5 P: q' k" J& S% F0 V0 W  o
  83. module_param(bcnt, int, S_IRUGO);0 b$ s/ x: U3 F* |: z: P7 \
  84. module_param(ccnt, int, S_IRUGO);
复制代码
- Q4 ^) w- H; R4 u5 q& i
2 z2 J- _) U2 {# ]' Q
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
7 Y; h" H& t2 }% i: narm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' B" d0 a5 p( y/ b' M+ z# W     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。  }' d  l# |# y' W' {! c6 c

0 h' W3 a# Q) ?" r3 C' C
* ]% v- c2 k6 c) U0 Y5 T) O1 `
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-24 14:55 , Processed in 0.042804 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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