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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 }0 G" A+ Z  ?
  1. [code]EDMA sample test application) c2 j3 t/ ~! w- c& {: j
  2. /*
    , b# G* [5 @6 V* C
  3. * edma_test.c
    - g& r1 s9 y3 [* [' B( |- v
  4. *
    # t/ N5 V7 _/ T& c- R3 b/ ]
  5. * brief  EDMA3 Test Application
    $ z( m8 u/ S& x1 p. t% j. H
  6. *4 Y7 G1 l% K- r$ u0 u) Y
  7. *   This file contains EDMA3 Test code.) ~" a$ ^$ Y3 ~/ z' u; u/ J
  8. *! u, `7 B. h" H! c. H
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE; j+ x2 Q$ d- C5 i& A
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    5 a2 o' X$ s( F4 Y; T0 M
  11. *         TO CHANGE.
      z7 b. f/ O: L
  12. *5 z. w, z' X. W: n; ?9 V7 q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    + P9 W6 U" T0 \6 f- `$ P" r' n8 C
  14. *
    4 D$ ]" E7 @; `& o
  15. * This program is free software; you can redistribute it and/or  e: N% S2 @' v. I. U, e* ~4 J
  16. * modify it under the terms of the GNU General Public License as* [! l. o3 j5 k, O
  17. * published by the Free Software Foundation version 2.8 f! D1 d3 \% G
  18. *
    * N5 P8 |7 ]9 B1 P. Z- ]
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any) K! p$ _" @* {9 t4 ~
  20. * kind, whether express or implied; without even the implied warranty
    5 O$ T/ E( N) D
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ( h9 N/ k7 |1 }3 e. b) f
  22. * GNU General Public License for more details.  O" S- r. D& \  ~2 B* r
  23. */
    5 e- J4 P* m5 n4 p3 e  Y8 J

  24. 5 A5 z1 X/ v  Y8 i& O1 q7 S7 s! f
  25. #include <linux/module.h>
    6 a2 t! v2 A" x/ L, i# f3 q
  26. #include <linux/init.h>
    ' n  Z: i8 }- E0 m* N1 H- p
  27. #include <linux/errno.h>
    . M+ J6 f! `9 V5 S" _5 Q$ R7 g
  28. #include <linux/types.h>
    , q* T+ q) |$ K2 W
  29. #include <linux/interrupt.h>
    % }2 M8 ?1 k- N" D8 S) x
  30. #include <asm/io.h>
    ! u6 V, H* O* N) y
  31. #include <linux/moduleparam.h>
    0 N, m2 n9 [+ f2 q
  32. #include <linux/sysctl.h>
    8 S3 w9 c/ P7 B0 @( u8 u9 \4 \
  33. #include <linux/mm.h>' u5 Z" G) m, a7 L' k% D; m
  34. #include <linux/dma-mapping.h>
    2 v9 G2 m% i5 s; \

  35. - c& N4 P( c) L3 s
  36. #include <mach/memory.h>
    4 o7 O  ?6 O7 _: A9 E
  37. #include <mach/hardware.h>
    $ T' O# w" b3 h! u$ u$ {! K  m! V
  38. #include <mach/irqs.h>4 k. u5 C! P2 d' V6 c' U. G' F, E
  39. #include <asm/hardware/edma.h>* j; c3 Y3 \! X# y' f
  40. 5 X& h9 f, u9 p, N! J0 [
  41. #undef EDMA3_DEBUG
    % O6 G3 S) J2 S
  42. /*#define EDMA3_DEBUG*/
    / u) N0 K; p) {7 M$ L
  43.   h6 _0 D! K: r- Z
  44. #ifdef EDMA3_DEBUG
    * z) t' W0 H) \- ?; ^1 ~2 M& I
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), q  R8 a% `2 k$ P
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* e  Q( u5 w) F! z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)8 ]$ b+ ]/ y3 j
  48. #else  O% ?* E- a- Q* J
  49. #define DMA_PRINTK( x... ), u! A( K6 K3 D
  50. #define DMA_FN_IN
    : ?" Y4 i; Y7 O' D' ]
  51. #define DMA_FN_OUT5 b$ ?$ K: [" }
  52. #endif5 o' H5 H4 G/ h2 v, V1 v/ @

  53.   N$ W  ^% B1 {3 V$ n0 E
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)) X8 o; P/ ^- j* t9 a
  55. #define STATIC_SHIFT                3
    ; W) r9 X8 A' Q. d
  56. #define TCINTEN_SHIFT               20, K! K" m3 t6 Q% ]- V) p& j
  57. #define ITCINTEN_SHIFT              21
    # ]" f( Q1 U3 G: i2 N' u! z6 [
  58. #define TCCHEN_SHIFT                22
    8 U, \- n, I: B3 m
  59. #define ITCCHEN_SHIFT               23
    * i6 f; D- X8 g5 `" S2 Y. s
  60. 0 @* t' \- @8 H/ U4 v6 m
  61. static volatile int irqraised1 = 0;8 u* T; I. o8 |5 Z/ w
  62. static volatile int irqraised2 = 0;% M; Z+ |+ I' l$ ^7 z7 Y

  63. + _, b* S; r) K
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' g' W' M2 P" R4 `9 B) c8 U) u
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . [1 R$ R. k- D' I% @
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ ~0 R6 m( W9 Z" _( ?

  67. , q! x0 U6 ]; q! S: v
  68. dma_addr_t dmaphyssrc1 = 0;. N; Q) r  \% _
  69. dma_addr_t dmaphyssrc2 = 0;" }; y- g6 \' _0 s' H3 f1 q
  70. dma_addr_t dmaphysdest1 = 0;
    ! U$ D4 c+ e9 @9 i1 \- |
  71. dma_addr_t dmaphysdest2 = 0;
    , p2 z. l" G$ x  x8 R7 Z
  72. + A# D: O1 D9 f4 n3 q/ o
  73. char *dmabufsrc1 = NULL;: [% l2 L5 e; ~; [9 p* R
  74. char *dmabufsrc2 = NULL;0 u$ N! w. i3 x$ R/ ~* t
  75. char *dmabufdest1 = NULL;
    9 y% S1 R$ h: I& z; x9 H( P2 J
  76. char *dmabufdest2 = NULL;% }- P, H6 f' ?2 |6 y% c
  77. 3 M0 D  {8 t* ], ]# a: H6 z, T
  78. static int acnt = 512;' A. D. v4 q2 k7 Z, l
  79. static int bcnt = 8;
    + K/ W, F+ j. S. k$ q7 I
  80. static int ccnt = 8;
    0 U/ u6 O! S( l: `: D
  81. ; J" _+ |. s; K! A: A3 ^2 v" q* \$ s( S
  82. module_param(acnt, int, S_IRUGO);1 o4 d; ?( K2 P% S5 {( m. s
  83. module_param(bcnt, int, S_IRUGO);
    7 X7 }9 T/ T+ M1 M5 \6 w+ x
  84. module_param(ccnt, int, S_IRUGO);
复制代码

! G" V7 h2 u7 k+ X; M, K. w
/ X2 F/ m+ L+ c0 U      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用9 a; N& i8 z; a( x6 Z; s# |5 }
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。5 f. q# L$ i4 f+ U6 S# Y
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 ~( c/ O% ~, G: L+ ?" h/ Y
' u( ?! R# N9 y% |$ e# ~& M4 ~9 ^0 ~8 L
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-10-10 06:42 , Processed in 0.045936 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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