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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
0 P* R( O0 \- }1 s5 @* \, q/ X( V4 b! q
  1. [code]EDMA sample test application
    + [$ U" `  W2 }9 I; f
  2. /*
    1 X/ `4 b# i; K: c$ f& _
  3. * edma_test.c
    8 l+ p! ~2 l- P- E9 W" A! h
  4. *
      K' Y% I& W2 _7 ?
  5. * brief  EDMA3 Test Application
    5 b5 ~, Y& }% }3 G' V, U
  6. *# @, e0 o4 m8 J/ E/ u$ Z# I" o
  7. *   This file contains EDMA3 Test code.
    6 H) Q+ g- a- \* ]7 A
  8. */ n  |$ r3 U0 L+ O) V# b
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    * D$ U7 [; ~) U4 s1 z7 |
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( c+ u5 F1 H7 R3 d$ V% B0 W
  11. *         TO CHANGE.% K/ t8 X9 }, ^0 v6 u1 f" ^
  12. *
    ! B' V1 z" ^+ C0 }3 T$ ?4 u' d) E5 h
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    : T1 A' f  L7 h, \! N
  14. *
    # \, u1 I5 v  D# M  h2 j
  15. * This program is free software; you can redistribute it and/or
    + S2 ?# d- H4 I' d
  16. * modify it under the terms of the GNU General Public License as
    ; D, S1 @$ P% T0 A- q
  17. * published by the Free Software Foundation version 2.
    + J7 q0 i# c% o. n8 v1 F- ^' j6 C
  18. *
    ! U. l' b4 n6 H, y
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 \% i7 Q' @) G6 j6 P
  20. * kind, whether express or implied; without even the implied warranty7 @, \! R% y! b% s% ~' j& {* R' L' L
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ; y5 e& W: R5 F1 f  ~6 K4 i
  22. * GNU General Public License for more details.7 |6 G% I5 n7 }! [' k
  23. */) |1 Y# P: b" f8 O( g/ m
  24. & F3 Y& |/ @- i% M) {
  25. #include <linux/module.h>
    # [! \3 S: N8 z
  26. #include <linux/init.h>
    : T' m! N$ H/ E4 P$ @
  27. #include <linux/errno.h>
    ) U0 f6 S& I' q1 b7 ]7 o( A
  28. #include <linux/types.h>( z" O, Z. y/ z& M$ T8 h
  29. #include <linux/interrupt.h>% B/ P) ~) x/ g1 W
  30. #include <asm/io.h>! R- A% n* t) [# A# M5 s
  31. #include <linux/moduleparam.h>
    & e' V* ]$ B( h$ D7 O% A8 i
  32. #include <linux/sysctl.h>% H7 H; M" K# O
  33. #include <linux/mm.h>
    % O- W% s4 r# o' E
  34. #include <linux/dma-mapping.h>, D9 J6 @5 o$ g8 ]6 p! t0 p

  35. $ k# C; @% V3 ]& C
  36. #include <mach/memory.h>
    2 K! A1 |& k) d5 x0 o
  37. #include <mach/hardware.h>5 M2 x3 f2 \* T# @5 {. H
  38. #include <mach/irqs.h>
    $ z3 f! a; K0 c' W" h$ {2 k1 ?
  39. #include <asm/hardware/edma.h>) S4 {2 F* e* u/ P6 s1 e
  40. * C; N( {$ n5 ]9 K" `) |5 Q& L
  41. #undef EDMA3_DEBUG$ Y# Z1 _! r0 T6 u) r, Z5 a2 {
  42. /*#define EDMA3_DEBUG*/' ^4 T4 L2 W0 ~1 C& Y0 \7 `4 e
  43. ( y- X. |5 R% ~' [+ L' k
  44. #ifdef EDMA3_DEBUG7 W; C. Y! L+ K$ N4 Q) G
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 p5 q3 H4 {0 u# \; F9 @
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    9 N& b4 D5 m7 E: E9 r, {
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    0 }3 a1 [8 h- C  I1 |2 G
  48. #else& Z& ?' I" ^0 i( ~9 I' |7 q/ m& I
  49. #define DMA_PRINTK( x... )
      ^6 r0 ^6 Y( v) G* R
  50. #define DMA_FN_IN- G% c& r' U( G  h. \4 _1 a
  51. #define DMA_FN_OUT% m  ^9 X, \0 {# s: W4 e
  52. #endif. h1 Q% ^9 S$ [  b6 @  _

  53. 4 F0 f6 r  u& c! y4 V& V
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)' W* t% S- f( F. T
  55. #define STATIC_SHIFT                36 L& ^9 ^$ R) W7 \/ A# m
  56. #define TCINTEN_SHIFT               20! s3 G. c# f& d1 X2 K
  57. #define ITCINTEN_SHIFT              21- Z$ V/ ^" A5 R( ~. X/ s8 n/ o3 P
  58. #define TCCHEN_SHIFT                22$ y) V" a7 l2 k0 V+ o  c
  59. #define ITCCHEN_SHIFT               23
    7 Y2 s" s' u, V/ J. w+ X0 l' ?
  60. - P% a# m/ n9 k# v: z, F- ]6 n, c
  61. static volatile int irqraised1 = 0;8 E2 `- J9 l' M
  62. static volatile int irqraised2 = 0;
    / Q; A6 w0 d9 h5 J5 E* W

  63. - w# L! q; p2 C1 s4 M7 ]
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! M3 P! g5 n+ H3 U7 @) R
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 W' B7 }! \; ^! u
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % T' b2 s" u" z' @+ c
  67. # V4 N5 N) ^; Y# a
  68. dma_addr_t dmaphyssrc1 = 0;" W# ~* c( |1 _( |
  69. dma_addr_t dmaphyssrc2 = 0;
    & ~! Z, `2 X8 ~6 r4 x, _$ j
  70. dma_addr_t dmaphysdest1 = 0;
      j5 @( I. k3 V+ U
  71. dma_addr_t dmaphysdest2 = 0;1 T, u* {+ l8 V0 G' _
  72. % P  s. K- ]* [5 \/ y- |
  73. char *dmabufsrc1 = NULL;
    $ b$ Y. L! c1 L7 n- A
  74. char *dmabufsrc2 = NULL;+ O6 m: K# e( u, i/ B  r7 Y
  75. char *dmabufdest1 = NULL;
    ! b2 W/ `9 R1 m) u+ A7 d7 j
  76. char *dmabufdest2 = NULL;( d5 h+ u/ }$ L5 e

  77. ; Y$ Q4 g* e# w- b: B
  78. static int acnt = 512;
      [( h& p0 L. S+ c( x: y
  79. static int bcnt = 8;
    2 C5 ^( ]6 c+ y, x+ y+ I6 f
  80. static int ccnt = 8;' l+ k/ M, N1 X4 K* T; E

  81. : l- c7 L- B* @* }' O. x
  82. module_param(acnt, int, S_IRUGO);
    ' i! h2 E6 w2 l7 b
  83. module_param(bcnt, int, S_IRUGO);3 `8 ~- Z2 ^& V& O
  84. module_param(ccnt, int, S_IRUGO);
复制代码

, E+ y  ~/ l7 W+ r! U, z, G7 S% E: O! ~2 p; w" f, B
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: M8 K  M2 h  @+ H$ V1 Larm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。" e6 J4 U; [+ E7 C, V6 h; |& \& ?" q4 i
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。; D4 f0 q# B3 J6 H  f5 W5 }2 Z

6 m9 p4 |3 Y$ V" O9 m5 @6 Y7 J' a7 X: I
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-29 13:24 , Processed in 0.039099 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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