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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; ^' m! b! [  r* N( v: {* X
  1. [code]EDMA sample test application1 n- Q5 M& F6 X$ Z# p; q
  2. /*% n3 |: E5 H- L0 O! ]
  3. * edma_test.c2 o0 z* J' y+ \4 H6 H% T% X% a
  4. *3 \0 z& V  B; |2 N
  5. * brief  EDMA3 Test Application1 c- y: i* k9 |5 [
  6. *
    % D7 s8 p# U, j  g
  7. *   This file contains EDMA3 Test code.' Y0 ^6 [% @& q7 O. p
  8. *1 P% S4 Z% i$ q& R$ p
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" B& |3 o6 y- O) `
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ) i1 i& Q# o0 \/ v+ T
  11. *         TO CHANGE.
    $ n) o5 x  _, x6 X, u- x8 P
  12. *2 l" F) Z6 N' K; C2 ]9 v" x
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' D4 z8 t5 j8 N0 o2 }9 S* u  U
  14. *
    ( P) S2 ^" R4 Q/ X" I
  15. * This program is free software; you can redistribute it and/or$ J; @( {7 h' p) A% b
  16. * modify it under the terms of the GNU General Public License as
    : ~( P3 G* p% A9 N( E
  17. * published by the Free Software Foundation version 2.
    0 c" |8 n. s) Y5 Z" k
  18. *! ]6 O  Q0 t) C) F, ~8 V/ ^
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any. q. u6 A0 Q0 b, _- ^3 \
  20. * kind, whether express or implied; without even the implied warranty+ {( L% k4 O4 L$ L" E& a+ F# x2 t
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      `$ x4 z" c) a; l
  22. * GNU General Public License for more details.5 T2 H/ `* X- Z; y( I
  23. */
    8 E( }; t; t7 u$ N9 a5 Q% j  E
  24. 8 C3 _' J, S* t4 b' I
  25. #include <linux/module.h>
    0 r8 [% n$ F0 b1 Q3 e. {  s( r3 q
  26. #include <linux/init.h>
    5 V9 `: |5 F1 \
  27. #include <linux/errno.h>* |' M. |  k% G; q1 Q
  28. #include <linux/types.h>
    $ _) d) ]; t) o0 V5 _
  29. #include <linux/interrupt.h>
    " R$ l# Z9 N  F5 c0 L! @6 x
  30. #include <asm/io.h>! H4 W# W- G8 r0 ?+ u% N7 b
  31. #include <linux/moduleparam.h>
    , b0 P' o2 z8 Q5 M6 ~: t, m
  32. #include <linux/sysctl.h>  v+ ^7 f% `- n- }
  33. #include <linux/mm.h>
    * V, j! U  ]2 ?+ ?
  34. #include <linux/dma-mapping.h>
    % d$ J1 d  S$ Y& G+ r' w

  35. $ Q' S2 \' E( F0 L5 j9 {
  36. #include <mach/memory.h>
    + _7 {# i! l, b. N0 t
  37. #include <mach/hardware.h>2 h# {) Z) ?, P- ]* X
  38. #include <mach/irqs.h>- R9 ]* `$ n+ W. k0 a# Z
  39. #include <asm/hardware/edma.h>
    " R/ i8 }5 j( f9 O5 ]

  40.   S7 [% M! ]/ A/ X0 Y0 X
  41. #undef EDMA3_DEBUG
    $ s/ B/ c1 N! W
  42. /*#define EDMA3_DEBUG*/
    ( U5 g2 {6 W0 Q, c4 w" [6 {1 V
  43. ' f/ n$ S" {1 P3 o8 G
  44. #ifdef EDMA3_DEBUG5 m& I" c8 e3 `7 s; L; [# \7 r
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); a1 D: J$ b  H  u8 k) o
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    0 M) E" q. _3 E5 M& m
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 M8 i7 \! ^) w
  48. #else0 v/ k7 {$ W6 T* t- J  |
  49. #define DMA_PRINTK( x... )
    0 u, y6 }' O; G. D
  50. #define DMA_FN_IN# S6 M: e% ^' ^$ u7 l5 \
  51. #define DMA_FN_OUT* g. s1 s8 n/ q2 v+ ]
  52. #endif
    9 A, F7 {4 x- T

  53. - h3 {; N' [1 i% U( R* c0 Q1 M- h7 I" ~
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    , ?1 @+ q/ r" k) V, W# [+ d/ i& ?6 n
  55. #define STATIC_SHIFT                3
    1 F5 D$ i' H5 G. m) b
  56. #define TCINTEN_SHIFT               20# I) G% Y0 g2 h8 V1 M
  57. #define ITCINTEN_SHIFT              21
      d" R6 H6 v# ?1 o
  58. #define TCCHEN_SHIFT                22% m( m- @7 S. _1 B: E2 X
  59. #define ITCCHEN_SHIFT               23+ G  N3 B  G. c* k, _! V7 V
  60. # N3 Z9 c( z: v; J, V
  61. static volatile int irqraised1 = 0;& h8 D# d0 M0 |* |* q/ x
  62. static volatile int irqraised2 = 0;
    ' |; b0 Z; U, O$ A0 ?  m: F
  63. $ i7 N2 m" V+ l8 x! s( x7 P) V
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' L8 H1 k' N1 t/ d8 _. X
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( C' u7 `& g" P
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ z: D  l( f5 r6 K

  67. & M8 S  V2 s7 q6 |" B
  68. dma_addr_t dmaphyssrc1 = 0;. A$ a, _/ O% K: v8 L/ Q
  69. dma_addr_t dmaphyssrc2 = 0;
    & a$ c6 ?" e& M$ @5 R! K' ~
  70. dma_addr_t dmaphysdest1 = 0;
    ( e* K, ]  V# u& U; P
  71. dma_addr_t dmaphysdest2 = 0;
    & ]# p6 {* [+ E  s8 L
  72.   G  N/ f2 p3 [, _& A
  73. char *dmabufsrc1 = NULL;
      K  j8 G0 o  h* O
  74. char *dmabufsrc2 = NULL;9 J# K' e  R* u8 |
  75. char *dmabufdest1 = NULL;
    & v, D/ E$ i( P# Z: p9 n0 F# X
  76. char *dmabufdest2 = NULL;6 T4 w/ [5 z' g# ]* m# ^- Q0 z3 [% j1 K$ C

  77. 9 @0 w1 `; c# i) J
  78. static int acnt = 512;4 C, R- D; P4 p; u. e4 T
  79. static int bcnt = 8;
    - Y- z. C/ Z/ B8 a8 N! ]5 _, |, t; h
  80. static int ccnt = 8;! W# e: e1 c+ Z, Y! E
  81. $ R) h# ?2 K, i0 p5 f6 w
  82. module_param(acnt, int, S_IRUGO);
    3 ]8 g/ R( y, w
  83. module_param(bcnt, int, S_IRUGO);& K- u6 e, b& H' g- d
  84. module_param(ccnt, int, S_IRUGO);
复制代码

0 R+ a- d: w- V; D2 d
& Q: C1 G; q0 m* q4 ^0 l      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- y# @0 F8 o- B- l3 ]6 W. z1 `1 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' m6 o# i# L8 y" q- n     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& i' ?" G* t; p3 A5 c! S& R. ~) q! X" N% n; r& `
. J; I% J& F* G: }; `; T1 }% v: v
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-26 02:58 , Processed in 0.038838 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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