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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - I/ s. U& i# \- n7 X2 Q# L! G0 k" i
  1. [code]EDMA sample test application9 N- p/ K5 N* |5 S' [8 h
  2. /*7 c  I3 u: E* [$ `
  3. * edma_test.c
      }/ O. |3 _8 [2 x
  4. *# B- G7 W* h% l$ F: c: |& G# @! o
  5. * brief  EDMA3 Test Application
    4 c  L3 J% |, }& {/ }
  6. *
    1 m$ N, p  w1 I3 C( q7 N
  7. *   This file contains EDMA3 Test code.
    ' r: `# x2 i7 m) b, `
  8. *
      ~; e& r5 T" }% V' y! h- k- P
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE2 W, A6 u2 k9 ~1 D, t* t
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 K5 q' r4 w- y' }$ w
  11. *         TO CHANGE.( K8 i; Y) f, {* G8 I6 G
  12. *
    0 m; x4 ?1 X8 f
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- @2 U6 H1 g4 `5 D- p8 c
  14. *
    & o% Q0 a2 L  a& G% V$ d) X
  15. * This program is free software; you can redistribute it and/or' f# [0 _- B% h: f- x& A! M3 z
  16. * modify it under the terms of the GNU General Public License as
    4 v; E- `2 r5 t! }6 @4 x/ w
  17. * published by the Free Software Foundation version 2." e& W. O1 A5 S; V$ }# M
  18. *
    2 n( K5 S& h3 v3 R
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    8 [! J! F% \/ W/ |$ Y' M  Y
  20. * kind, whether express or implied; without even the implied warranty
    2 p* D' n. P3 R4 C0 r6 H
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ) X2 L+ a' d3 L6 i) W5 I, o+ w. }
  22. * GNU General Public License for more details.$ O5 }* n: E9 P2 A/ C# ?2 N* }, ?
  23. */
    + A2 n; w7 {4 N

  24. 1 m) Y3 E' I" T) P1 b/ v- k0 h; @
  25. #include <linux/module.h>
    0 |1 `% k4 v9 N0 a" F
  26. #include <linux/init.h>
    6 d$ @' C9 {! U) @. ]) a
  27. #include <linux/errno.h>4 q5 |) u8 J! _% Y( q& D
  28. #include <linux/types.h>
      k5 d- N# d1 `) q$ J3 I/ @% m
  29. #include <linux/interrupt.h>0 N  j0 J4 l. N* y5 n$ C
  30. #include <asm/io.h>0 A$ \3 T3 ^7 {. ]- T# R- F
  31. #include <linux/moduleparam.h>
    / O4 i! A0 l( h
  32. #include <linux/sysctl.h>! R9 E/ O( Y$ f0 `) V; b4 t
  33. #include <linux/mm.h>
    6 g6 `) e' A0 R
  34. #include <linux/dma-mapping.h>
    6 p- G  L5 c: u8 ]

  35. 9 c! i' ^% u) N- g3 e* k
  36. #include <mach/memory.h>; @# t2 Y& R& f. s
  37. #include <mach/hardware.h>4 f9 u, f" d- q
  38. #include <mach/irqs.h>
    3 @( J) I8 F  f4 P2 E* y
  39. #include <asm/hardware/edma.h>7 j+ d2 }8 t7 f3 o  G3 v$ q
  40. 4 Q# B8 U! j- r' k
  41. #undef EDMA3_DEBUG* v, D; H5 V. n
  42. /*#define EDMA3_DEBUG*/0 ]- q, m. o0 H  W  h; h* k
  43.   p3 h7 }- m9 J
  44. #ifdef EDMA3_DEBUG
    8 z1 r8 G( P9 b, \4 W3 w# U' u* I
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    5 }: R  a! r9 H
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    - d. V( S+ B8 a9 v. Z8 u6 n$ P0 V
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    - M7 W. F3 D, K( B- Q
  48. #else8 U7 ]6 m* a6 `1 B4 M, n' y: q
  49. #define DMA_PRINTK( x... )
    ; T# v9 {% c; F$ U3 h
  50. #define DMA_FN_IN
      J* E/ N$ f: ~  Y/ Z* K
  51. #define DMA_FN_OUT+ T  T: \8 A$ X! v8 ?
  52. #endif% ?3 o$ @: z/ ^9 B9 W9 ^

  53. ' G4 L: i* C! l; k- ]
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)4 |( [5 |# W; ^4 L% G
  55. #define STATIC_SHIFT                3' h7 R4 @& G6 ?" I
  56. #define TCINTEN_SHIFT               20
    # C5 J1 K! _4 C5 F2 V9 }
  57. #define ITCINTEN_SHIFT              21
      s& ~8 n/ p3 F: s! K
  58. #define TCCHEN_SHIFT                22
    6 L7 j- O0 S" D
  59. #define ITCCHEN_SHIFT               23
    + m+ q2 s4 @9 n6 A

  60. 6 F1 Z# R( h4 L" d3 i( ?
  61. static volatile int irqraised1 = 0;
    : s& D1 X+ S2 z& i# V
  62. static volatile int irqraised2 = 0;( T3 g0 G! G2 O6 w
  63. ; ^6 R9 w& E0 J- F: ~$ I
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( q) x& o: C6 D) k
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + ?: C3 h& B/ C) E+ y0 n* \
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 R. Y- r* y3 a, f# J) f9 j
  67. 6 f# o, O, j  Q9 `- g
  68. dma_addr_t dmaphyssrc1 = 0;0 W# ~7 a$ n; f6 V
  69. dma_addr_t dmaphyssrc2 = 0;5 I0 S- Z+ S) x$ a
  70. dma_addr_t dmaphysdest1 = 0;& }3 O2 J0 h0 h
  71. dma_addr_t dmaphysdest2 = 0;
    $ G; _/ C$ w7 y) i! `6 S0 r' ~$ c

  72. 7 v( j4 q; ^; B2 M
  73. char *dmabufsrc1 = NULL;
    " \5 P# r4 [6 M4 |
  74. char *dmabufsrc2 = NULL;
    $ F. k' J/ O7 [3 e! Y+ ?
  75. char *dmabufdest1 = NULL;
    : o& g' ?$ ?8 n) F/ e8 r! V4 a
  76. char *dmabufdest2 = NULL;- ~. c7 z" O& N. w7 c: w5 ~1 o: I
  77. & N, [) r) M3 [, z
  78. static int acnt = 512;" Q2 D; R$ n* G+ y
  79. static int bcnt = 8;
    + o) \1 f0 u7 E% E9 P: h
  80. static int ccnt = 8;
    9 R+ D# p  v$ h( M" ]
  81. 8 N, R+ K6 g, \4 w4 A' v
  82. module_param(acnt, int, S_IRUGO);0 J$ W! E# |7 d4 z0 q
  83. module_param(bcnt, int, S_IRUGO);7 M+ k) P/ U* E5 T+ d
  84. module_param(ccnt, int, S_IRUGO);
复制代码

+ v5 y  O- k3 `1 z
8 _2 w  T- N. \. P3 Z      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 ~; S. S1 j/ C$ w
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& `3 h. V* l) k* h& m# Q3 y# D. E
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- ~' d  t( \- h4 g; H1 {: X

+ g# o1 T$ U% c  |! V+ j9 u) C- o. N* ^" a! \
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-19 07:03 , Processed in 0.038914 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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