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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
  e/ R# n% ?8 `. x4 _
  1. [code]EDMA sample test application
    9 O& ~: J4 v) v( F
  2. /*1 L; N8 N9 x0 C
  3. * edma_test.c
    . |; L% X# D$ Z4 p! a" v/ x
  4. *6 w  x7 }2 z! |) J3 g
  5. * brief  EDMA3 Test Application6 F) v7 B! d2 E
  6. *
    4 k8 M  i& R/ S/ W' T
  7. *   This file contains EDMA3 Test code.
    , D- e$ ?. @- \3 [+ X1 ]
  8. *
    , S  V+ h0 A) L6 K. X# r
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 ^2 r! s( B8 Z
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 ~; Z1 J" |( V" u0 C6 B
  11. *         TO CHANGE.
    . x: |( h; j* X# E' C- R) l
  12. *+ I* q" \" `$ Z  l  Y. w% Y
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    . {* x+ q/ d6 O( h$ J
  14. *2 @$ q1 d7 R) N' S
  15. * This program is free software; you can redistribute it and/or
    . c& c" G7 m3 _; m- R  Z, B% [: O
  16. * modify it under the terms of the GNU General Public License as# J8 q* M; u. b; |/ Q3 ~) {
  17. * published by the Free Software Foundation version 2.
    % |) B, ?1 S* W  I+ o
  18. *# g4 F' m' p/ r7 G- ~
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any" ], P7 E) s) D" R/ j" c' A
  20. * kind, whether express or implied; without even the implied warranty
    % a% [# S; }8 n% |% \. K- F. ?
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the4 t& n5 n3 u+ R5 Y9 r
  22. * GNU General Public License for more details.
    / `% X2 v% h! \$ Q' R) ?: g
  23. */& `7 ?# Y6 j+ }" g, z$ G( m, O
  24. 2 t5 V9 A( K" c% C& v
  25. #include <linux/module.h>
    8 Z' ^& ]  t; T: E
  26. #include <linux/init.h>
    5 ?  B# E5 t3 C- D" ?* U
  27. #include <linux/errno.h>
    & b+ l( C1 e! R8 |
  28. #include <linux/types.h>
    5 }$ D. D) ^0 k) v
  29. #include <linux/interrupt.h>
    2 H$ i4 I4 C3 h: `9 M' }
  30. #include <asm/io.h>
    ; G3 i) e; D# g" g- [7 K& f! g4 ?8 e, K& s
  31. #include <linux/moduleparam.h>! B7 q& F5 Q# O0 X7 T4 F; k
  32. #include <linux/sysctl.h>; ^2 c3 L! h) Z* p& E& P( q
  33. #include <linux/mm.h>4 ]5 J1 [9 P& K
  34. #include <linux/dma-mapping.h>
    7 H4 k. l) L8 K* M+ e
  35. / c1 ~  q; g! p7 Y
  36. #include <mach/memory.h>, h. y$ L5 f# O% _  x) G1 b: r' n
  37. #include <mach/hardware.h>0 J% `  z% q1 X) j  Z
  38. #include <mach/irqs.h>4 ^" H0 @( l- T( R$ P$ @
  39. #include <asm/hardware/edma.h>% s% y6 T- b$ N9 j$ u- C
  40. . f1 `- T5 q( S8 ]0 g4 u0 Z
  41. #undef EDMA3_DEBUG
    ! x' V3 P  }, `' f" Q
  42. /*#define EDMA3_DEBUG*/2 H+ i! w* t9 J+ g  [1 u

  43. 2 h+ Z$ b; N2 f" Q
  44. #ifdef EDMA3_DEBUG
    - e9 V1 S% [0 I1 x' V
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ! x3 T5 @3 x: {+ V' I( @
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ( U! D( p" e/ n8 F2 ~# k
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    0 T. P5 t: I9 @+ k
  48. #else
    7 Y2 ?% Y1 H9 ?! X
  49. #define DMA_PRINTK( x... )
    5 j# f8 i/ F: C/ Q6 ?
  50. #define DMA_FN_IN) o+ N9 @  W" b; o# ~; E
  51. #define DMA_FN_OUT
    0 b9 {; O; t8 l/ ]
  52. #endif
    7 g4 b+ a* T/ m+ X

  53. % P; u& d& o4 K/ x
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
      {7 h% a8 R8 o4 ?& h
  55. #define STATIC_SHIFT                3' B. B0 O* D6 _# _9 k; e
  56. #define TCINTEN_SHIFT               20+ y) |, s$ C! C! r& g
  57. #define ITCINTEN_SHIFT              21% d( F# y( i0 `9 p  y1 r% Q+ s: h
  58. #define TCCHEN_SHIFT                22# r0 g* O1 h0 d) j- \
  59. #define ITCCHEN_SHIFT               23
      e; M# j0 s% S0 n

  60. 5 [) y, @1 H9 a6 B( G% K, n" J
  61. static volatile int irqraised1 = 0;" K4 ?3 y6 g" ^( a0 e
  62. static volatile int irqraised2 = 0;% S6 n; r) D" z- M+ R( M9 G
  63. ! j+ P5 Y  ^5 ]& W5 c( @
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & y( |" s( }* I& I; c. X4 E- x
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 V% _( @4 L0 `1 z
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 }- X" ?7 h& c) s! D0 u/ o& |% W

  67. ; J3 p. U2 d4 K' p; H
  68. dma_addr_t dmaphyssrc1 = 0;' d' X$ r/ e, G. h' W! f$ q" m
  69. dma_addr_t dmaphyssrc2 = 0;! p2 V0 K: j0 E; S# |- o
  70. dma_addr_t dmaphysdest1 = 0;
    $ d. B2 W6 S5 @) Z/ K8 J& [) e
  71. dma_addr_t dmaphysdest2 = 0;
    % b/ o1 D, O! S+ m$ R! z5 |* z
  72. 7 v/ x- P3 {' A
  73. char *dmabufsrc1 = NULL;
    8 C% q8 w6 A* g
  74. char *dmabufsrc2 = NULL;5 U# M7 v+ }" w* M, K8 e
  75. char *dmabufdest1 = NULL;
    7 B  L2 `1 u, k4 t) _3 m1 a5 e) n
  76. char *dmabufdest2 = NULL;
    - \/ E; l4 k9 n' j" {# K& `1 h

  77. 5 R9 m1 V! i5 ]9 D! f& J5 `8 I
  78. static int acnt = 512;
    * f+ @, ?* U5 X: m8 m
  79. static int bcnt = 8;
    / B: _$ }6 w" r8 T2 p' M- }
  80. static int ccnt = 8;  X; C0 ?, V, c' a- Q. D, X, b
  81. + x9 r6 I, M% h/ K) W" t0 ^
  82. module_param(acnt, int, S_IRUGO);8 w+ h. {; Z+ C9 l( ?1 f# I
  83. module_param(bcnt, int, S_IRUGO);7 h$ y+ N- `9 |. t9 k
  84. module_param(ccnt, int, S_IRUGO);
复制代码

6 c. Q, M+ Y* l( G7 J: {. h: J: B' @9 U& b! _
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% Y" @% R+ g9 K- z- f2 @0 m
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。  m# v0 O/ h  r2 a5 y
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
  g$ Q+ h; R. i; \6 m/ l* l5 k; }- |$ M5 ]( O: g; N% T
5 {& P9 z) j; [7 g5 X# A$ r; N
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-8 08:53 , Processed in 0.039574 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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