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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' m  [' h' Y! {; I  V. i
  1. [code]EDMA sample test application/ V, n4 {( U6 w$ f' B) v" O& A
  2. /*" u0 ]4 b( s- T, `) Y
  3. * edma_test.c  E. T- U# s# a8 _0 J4 e
  4. *' K5 ]+ R  z% x* y1 y: l
  5. * brief  EDMA3 Test Application
    9 v4 T- W& J: K/ H5 z
  6. ** d7 [0 |  M, }# t$ \" m
  7. *   This file contains EDMA3 Test code.
    9 q3 I! K" M  M4 q0 G3 ?  L$ x
  8. *+ {- c) D; Z) N" U5 T" E/ X
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ D% j# A5 {8 a# U; {" Q5 {
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
      P  r  i" A! w
  11. *         TO CHANGE.! D9 Z1 }1 w% v# U) L5 J1 F5 Y8 C
  12. *
    + `9 k  w8 c$ U3 f0 S7 d
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 p, x6 u" N! x2 A4 ~1 X
  14. *
    ; ?1 L; ?- P$ z2 n
  15. * This program is free software; you can redistribute it and/or
    % a* p9 G* t! h1 u
  16. * modify it under the terms of the GNU General Public License as$ c5 E* l0 Q6 g1 z
  17. * published by the Free Software Foundation version 2.2 W& z' G- N! ?' D/ x9 U
  18. *
    ( {- }% x! H: X5 e; n9 {
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 ~: {, O* q! |  z
  20. * kind, whether express or implied; without even the implied warranty( ^2 [5 B/ e, j( @2 ?# |
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the3 J7 b; G; H+ _% A. R. `
  22. * GNU General Public License for more details.
      e+ R; s' |2 j+ A$ q/ r
  23. */
    5 ?3 b$ X: p4 q7 I) N8 @! d
  24. ' Y1 ^7 ?* G" d
  25. #include <linux/module.h>
    6 C, R7 F7 l7 R8 |- X$ m2 q, E
  26. #include <linux/init.h>
    ) O. e! h9 q9 K* [+ x
  27. #include <linux/errno.h>0 }. Q0 [! H7 I4 u: l- w# E
  28. #include <linux/types.h>+ J1 m8 B) d3 a" i4 U
  29. #include <linux/interrupt.h>
    - L4 @/ m/ M& k+ D( f
  30. #include <asm/io.h>
    % ?! `& \, N5 A6 h7 V8 }: B* k1 ?* D
  31. #include <linux/moduleparam.h>9 ]4 r3 V8 b& o: ^% [
  32. #include <linux/sysctl.h>, G2 n0 Y* s+ X
  33. #include <linux/mm.h>2 {- m+ }- }0 c) c+ x: x& a, C  p" H
  34. #include <linux/dma-mapping.h>8 |! \5 X4 g6 X. i/ {/ Y% H' k
  35. . a3 |% [1 C7 _" Z! q
  36. #include <mach/memory.h>, \( M- O% ]* Z: \! s# t: P
  37. #include <mach/hardware.h>
    # @$ n2 A" s1 ?0 m# N
  38. #include <mach/irqs.h>- R7 I1 `0 `9 L: W- Q$ m& s
  39. #include <asm/hardware/edma.h>
    # f  k5 x5 E3 y6 W( |

  40. ; Q, a1 W, u$ ]2 L9 g
  41. #undef EDMA3_DEBUG
    , V! i3 j0 _! b7 \" z3 A2 P
  42. /*#define EDMA3_DEBUG*/
    3 \: M* ?4 G2 v. [3 A5 G9 m; P. i

  43. : S4 p' }7 e4 w8 q; B) I
  44. #ifdef EDMA3_DEBUG" e2 a  k8 M  N
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" L8 T7 d2 S- ?0 x2 Y5 g" G' y6 \6 L
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# s( N$ A# U6 Z& v' }
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ) x: \4 V, j9 }
  48. #else' d  Q' A2 g, G! H: [9 A
  49. #define DMA_PRINTK( x... ). a, m# g- r7 @, w
  50. #define DMA_FN_IN
    0 o2 r8 Y* e7 I" ^: {
  51. #define DMA_FN_OUT( B& \+ j$ H+ E" T) [; ?
  52. #endif5 s3 A8 q5 l; c+ Z

  53. 0 J2 e; C1 }. _2 v: M, D
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)0 J% f/ f$ r, K& `9 c( z6 S+ [  O
  55. #define STATIC_SHIFT                3
    . \" v. }. u1 D' k
  56. #define TCINTEN_SHIFT               20
    9 f4 v8 o6 u1 U+ C: I
  57. #define ITCINTEN_SHIFT              21
    , [' l  h4 P: l' N' o  z
  58. #define TCCHEN_SHIFT                22
    8 u4 z1 j% {! i8 G
  59. #define ITCCHEN_SHIFT               23
    1 E3 i/ N, T: V; S

  60. . E0 }, I* B5 Y
  61. static volatile int irqraised1 = 0;& x* B% m& m; f
  62. static volatile int irqraised2 = 0;
    6 I; U7 w3 G$ h% ~( }. x% M
  63. ; r; a/ l. _+ j8 O
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; }* |# s7 s. ?! U, k: u
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 o2 k4 C, R7 t- g$ m' O# j
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ W! g6 z( J! G1 h1 V5 p

  67. ( I9 y# ]4 u/ I- S" M  a
  68. dma_addr_t dmaphyssrc1 = 0;2 X/ c7 @2 e$ y
  69. dma_addr_t dmaphyssrc2 = 0;  ?$ |" ^+ x, D" A7 |) `
  70. dma_addr_t dmaphysdest1 = 0;
    - ?( P8 J1 e! G" L% f( M
  71. dma_addr_t dmaphysdest2 = 0;0 T( h% X/ ]3 g& ~( ~

  72. 1 B! {6 ?9 n( p. j! i* _& Q: ?
  73. char *dmabufsrc1 = NULL;! J. q0 n  k+ ?1 ~) |9 ?7 D) B
  74. char *dmabufsrc2 = NULL;2 ^- Q, M5 `" k" W% N9 m% G
  75. char *dmabufdest1 = NULL;
    5 q1 k5 x0 V- ]# S4 {: m
  76. char *dmabufdest2 = NULL;
    - Y, W1 l4 G# F1 h
  77. ; M$ n9 ^0 f* I8 f. o7 x
  78. static int acnt = 512;( u$ f& s" `; Z0 |) C
  79. static int bcnt = 8;
    3 ]+ Z. Z' h: v1 N3 F; G% h" ~
  80. static int ccnt = 8;2 g2 t# [% @& ]5 M6 Y; I

  81. 0 z0 h& |( W8 `- o$ F
  82. module_param(acnt, int, S_IRUGO);- `4 W8 x/ J* Q- [+ S& F
  83. module_param(bcnt, int, S_IRUGO);( P) G- M' s  u& L( p, {
  84. module_param(ccnt, int, S_IRUGO);
复制代码

$ u4 q) U/ D9 B5 m: r, D+ L/ T) T, X6 l  v
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 t3 {3 h& ]+ |4 _/ l; F- o" Oarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
! v4 d# p( ~3 u0 W, g0 v$ y     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ C( C- `: h8 e% A/ ^

1 a. a8 m0 W: y9 H7 _) ]
6 E4 u+ d* P  E. K8 d+ \" _2 L
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-15 23:51 , Processed in 0.038942 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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