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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 ^$ Z8 j" z& c; Z$ C, C/ n9 l
  1. [code]EDMA sample test application
    * L" @9 j$ t5 j! f( H% C* \3 k/ u
  2. /*
    - B, L4 D. l5 h) O
  3. * edma_test.c2 C5 C6 r) n: N+ ]- {
  4. *  p* ^% t( L- D) L+ [: x" D: t
  5. * brief  EDMA3 Test Application
    ; k* ?4 }8 ^. V# \# l
  6. *
    3 Z7 o2 W4 W8 V9 A! c. H: K
  7. *   This file contains EDMA3 Test code.3 L4 y$ n0 b7 H0 q: T
  8. *6 W5 z1 ?; _1 H! T; @* H) m
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    / h! F& z0 m( A1 n( k
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    * T6 h$ x& x0 ^4 t
  11. *         TO CHANGE." ~: b+ g; v( {
  12. *" i. f6 x+ U) F8 d- o/ V
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& Q% t7 `, Y$ W9 `; q
  14. *
    1 J0 q; y+ t$ z, z) O/ N6 i
  15. * This program is free software; you can redistribute it and/or' J( u1 w) F* j0 I
  16. * modify it under the terms of the GNU General Public License as
    9 q; Z$ s' D, z
  17. * published by the Free Software Foundation version 2.2 o1 D# W/ l$ ]1 p! I) p
  18. *9 q1 k! L0 E& E  S3 R" K" ?
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 S& x& k8 S6 [5 I
  20. * kind, whether express or implied; without even the implied warranty
    / H4 q5 z1 N3 g& X* p
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the& q' k2 t- ?% S
  22. * GNU General Public License for more details.& s* U: L3 X7 h" m# J; g/ g  d7 h
  23. */
    * q* v9 @$ Z$ W/ D

  24. 6 v9 M' V4 y! A' r2 z8 O! d! C
  25. #include <linux/module.h>, t6 B# q/ T) f
  26. #include <linux/init.h>. \( X/ G: l+ N  O% u
  27. #include <linux/errno.h>! V' E* c2 T5 k
  28. #include <linux/types.h>3 P) W' q4 |3 F
  29. #include <linux/interrupt.h>
    1 a( ^( \0 N( K6 m' \2 {3 f9 {
  30. #include <asm/io.h>
    + p4 u' b3 J0 t, q  H% }& E
  31. #include <linux/moduleparam.h>6 d3 w' I4 @* U' Y; V* w! H& C1 V
  32. #include <linux/sysctl.h>% Q3 i: ]" H. B% y1 V/ L3 r& A$ b4 _
  33. #include <linux/mm.h>5 y9 S$ t+ p0 f$ s
  34. #include <linux/dma-mapping.h>
    : d$ m" T- Q  X5 s
  35. / c# C1 c+ Z4 B  K
  36. #include <mach/memory.h>
    ' I; N, r6 g7 q9 E( P
  37. #include <mach/hardware.h>
    & o, T% J0 q! `
  38. #include <mach/irqs.h>4 `! N3 g+ V5 |: b3 j
  39. #include <asm/hardware/edma.h>
    # [" a7 f8 r/ p# ^1 X

  40. 5 s6 O: Z% r3 n$ @$ s+ k# P9 J6 T
  41. #undef EDMA3_DEBUG
    ) U' L' j3 H+ v' v* P
  42. /*#define EDMA3_DEBUG*/# L" i$ a2 J. Q5 d) e* @) k1 k5 l
  43. ! ~6 g+ s. P) P: {
  44. #ifdef EDMA3_DEBUG" T+ R1 @' w' E8 t: Z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" F* e* U: @2 e2 u' e
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 W0 ^1 X7 c% `, F* i9 ?6 J
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    - C+ V; x. \/ V, R9 f
  48. #else
    ) x2 ^/ y2 ]9 j  X, g- R  z* x  ~
  49. #define DMA_PRINTK( x... )
    9 X/ ]" b% i1 ]; H6 ~/ `, `: M
  50. #define DMA_FN_IN  z7 l" [! ^  [4 [' P$ M
  51. #define DMA_FN_OUT1 R! ~  ?6 B1 I9 N: S2 J! y: s3 O
  52. #endif; R% h  g* X# k( M

  53. 8 h+ \3 \# v2 _% m, K1 |+ R
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)# F5 T! d: o6 b7 m4 y4 b3 c9 C
  55. #define STATIC_SHIFT                3
    2 ~- J! n% m) `+ t5 R& x5 O9 w! }
  56. #define TCINTEN_SHIFT               208 g1 z- q% r6 o$ i1 ?
  57. #define ITCINTEN_SHIFT              21
    - d3 Q+ m5 @  @. [4 \2 M* @' \
  58. #define TCCHEN_SHIFT                22; i! H0 g# U, v6 Y
  59. #define ITCCHEN_SHIFT               23: E2 C7 o6 c& ^% y8 {' W
  60. . `$ [) @! l( Y( M, ^+ |! b; r, {
  61. static volatile int irqraised1 = 0;
    , U: A9 ?' S  t# \; e% k
  62. static volatile int irqraised2 = 0;
    % K% {/ s1 y. q9 b" j
  63. ( W" C; P' A% b. V6 u/ W, y( X& l
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 _0 V+ O- u2 S, H
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 M: g7 y0 f7 t, u# ^: E
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, k4 y! b7 q0 t  X8 V* K
  67. 5 K" v. B9 P& }1 G+ ]  p& o
  68. dma_addr_t dmaphyssrc1 = 0;
    9 F8 x  B! C- e8 l# a
  69. dma_addr_t dmaphyssrc2 = 0;
    & z, Y1 U8 t/ Z4 t& o& H& F' u
  70. dma_addr_t dmaphysdest1 = 0;
    3 D& x# P) n; u6 A
  71. dma_addr_t dmaphysdest2 = 0;" Y$ e8 L5 l" G4 z
  72. 9 ^0 B  Q, r; k- t
  73. char *dmabufsrc1 = NULL;
    ! g) K& l5 f' p
  74. char *dmabufsrc2 = NULL;
    ; o: p2 ]# G( d
  75. char *dmabufdest1 = NULL;
      _% l$ d8 T0 x* L
  76. char *dmabufdest2 = NULL;
    % j3 M8 L9 P& J
  77. , b6 U, d7 F& ~8 k
  78. static int acnt = 512;
    6 h. ?, M* i  n" [' X
  79. static int bcnt = 8;
    2 C, s2 h8 O9 x
  80. static int ccnt = 8;
      H$ S2 P9 g3 }! ^; ^% k( i7 E
  81. & H8 b. p0 [8 G* [7 J2 b' T
  82. module_param(acnt, int, S_IRUGO);; [2 z2 O. S) w8 T% E5 o. S1 c/ ?
  83. module_param(bcnt, int, S_IRUGO);
    4 S0 F' J  y& k- f0 x" b' G+ z
  84. module_param(ccnt, int, S_IRUGO);
复制代码
& O6 Y( A+ @' ]& k! ~% g! ]
0 F: p% A; ^! {) c
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, p6 G/ w# O2 `! n
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 N) g1 }, ^/ b" ~- Z" T     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 p# Z8 @8 u2 M( M
4 P0 |" n' o" K" Y" U0 p  ]. H. C

, J  L2 W; O, z' O4 ~9 \$ U
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-5 15:52 , Processed in 0.043731 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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