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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . `) @( ?0 f( u* W
  1. [code]EDMA sample test application0 {6 t6 g4 r/ o
  2. /*
    0 }* ]; P( F/ X& z7 y, Z
  3. * edma_test.c( n% d4 `8 c2 ?" n" m3 @
  4. *
    9 C7 w* I! L! q. H; i
  5. * brief  EDMA3 Test Application, e- p  X* P. j: g  L3 u( C
  6. *) M4 H  U+ o0 W$ S0 W
  7. *   This file contains EDMA3 Test code.
    9 _  B) N) N! o/ v
  8. *4 K; _, J# v0 H- M( h6 }3 g% J
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    - t7 _( }0 s) A
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ) ^: \) K: I  S2 l4 V
  11. *         TO CHANGE.* w6 ]1 i3 k$ x$ R, \  b! x' J
  12. *" l! m1 o# v# P" p
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    3 N2 L5 q2 N7 q1 I' ?: [
  14. *
    ( m/ P9 M/ B9 u& h6 h  `) {
  15. * This program is free software; you can redistribute it and/or
    5 g+ {) Q' R2 `* h/ ]
  16. * modify it under the terms of the GNU General Public License as9 R) W) @7 D7 Q+ e, w3 @+ k2 X
  17. * published by the Free Software Foundation version 2.
    9 Q: _8 q0 g8 U" x4 B- J* X
  18. *
    7 j6 D: w4 V; B/ L8 w2 r- d& O/ }
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    4 F8 p: Z: g8 L, e( r" Q
  20. * kind, whether express or implied; without even the implied warranty" [! M9 H. R( `+ `. J7 |+ Q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    3 ~) w# ?; l! N! H5 e6 v
  22. * GNU General Public License for more details.3 z" w8 Q. y- I/ W6 u4 m2 z
  23. */: O4 M0 x$ Q* [! H0 T* G
  24. & e& q- n9 m6 p3 L! `3 M
  25. #include <linux/module.h>
      `: x, s, A3 f
  26. #include <linux/init.h>2 b& q) |7 ?; ]0 f$ Y
  27. #include <linux/errno.h>
    ; ?. M3 O. f6 ]4 `
  28. #include <linux/types.h>
    $ g  Z5 o, L' a
  29. #include <linux/interrupt.h>
    % T& L% g8 f4 Z3 x# ?
  30. #include <asm/io.h>- D8 Y6 p4 M* ~8 z$ x' m( a5 S  N6 [
  31. #include <linux/moduleparam.h>0 P) k. X, _% U/ n( x
  32. #include <linux/sysctl.h>
    & l6 w6 e4 d+ W/ G$ z+ r
  33. #include <linux/mm.h>  T1 r% X6 V! ]2 t" L8 S0 g5 E
  34. #include <linux/dma-mapping.h>% H4 ]5 f( x) |0 Z/ }  D* O# b3 @) P

  35. - c' \) S; W7 V+ N# y/ S8 A0 y
  36. #include <mach/memory.h>9 ^5 t+ G  x2 |5 J
  37. #include <mach/hardware.h>/ o2 A  F# W3 \7 o2 q
  38. #include <mach/irqs.h>
    * d8 t! b, M+ s, r. k/ e
  39. #include <asm/hardware/edma.h>
    - ^8 ]- P7 R! |# L- h/ e

  40. : _8 a' P5 z6 s' y6 H2 V) [: C. R" _
  41. #undef EDMA3_DEBUG% }5 ~1 k, l8 S) K% ~4 b$ @6 H9 j2 A
  42. /*#define EDMA3_DEBUG*/  `7 l2 T' `% `& m

  43.   k! q& U% {% z$ R  n5 b1 I
  44. #ifdef EDMA3_DEBUG
    6 X; h( A# N3 }3 c+ A4 W
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- F; p3 C4 l% I2 A& v" s$ j
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    9 H9 y  r& ~6 ]) F: U
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ; i* Y( \: x" t: \/ x+ l
  48. #else4 z" N5 B. S8 y! p8 U
  49. #define DMA_PRINTK( x... )
    # E; p+ `5 P/ G: t3 N( `( v
  50. #define DMA_FN_IN6 `; A4 x; Z/ w8 c) p" B
  51. #define DMA_FN_OUT$ X# w2 U8 H7 n0 N$ _
  52. #endif
    ( K/ }) y% }; I2 M

  53. % c$ }% G- k" ]0 G9 ?' D. B: E0 B
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)1 E/ q& c6 D7 t
  55. #define STATIC_SHIFT                33 |9 u  A" R! v; Y7 e' A
  56. #define TCINTEN_SHIFT               20
    ! v6 D$ x1 }9 A. \, ~* }; ~
  57. #define ITCINTEN_SHIFT              21
    0 B% W3 t2 q+ c
  58. #define TCCHEN_SHIFT                22$ n# I& T  |( B' s/ I9 O! K
  59. #define ITCCHEN_SHIFT               234 ?4 n0 w9 a' q. E1 J

  60.   m0 @1 I8 ?3 i& T7 c. {0 ^% k
  61. static volatile int irqraised1 = 0;
    5 r  l' ~, r* Z+ C
  62. static volatile int irqraised2 = 0;
      Q, H4 S6 n7 }$ ~1 \5 ]: R

  63. ' \4 }- u- ~: p, f& J2 S* R0 f2 v
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 \6 b- w, E2 C9 `( V. k
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 D& a( M: r; @: |  a
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! z5 b; c5 b$ ?) W9 h7 v  J0 D

  67. 4 n- Q3 g6 }0 V
  68. dma_addr_t dmaphyssrc1 = 0;! e7 A9 z, }: D) Y, r0 S
  69. dma_addr_t dmaphyssrc2 = 0;
    - [' j; A% g7 W% o9 ?
  70. dma_addr_t dmaphysdest1 = 0;  f' X( v2 _# ?: Z8 a
  71. dma_addr_t dmaphysdest2 = 0;
    + P9 q" }8 g* m
  72. % `% H5 u0 v9 R! h* w( r' V
  73. char *dmabufsrc1 = NULL;3 @$ h$ \, x. u# c3 f3 \3 P
  74. char *dmabufsrc2 = NULL;
    + l. h% [( f% I6 I
  75. char *dmabufdest1 = NULL;
    4 m$ a8 O4 d+ K' E( ^
  76. char *dmabufdest2 = NULL;. v9 I: w( G% ?; B2 v

  77. 3 U+ E3 e1 ~2 u3 ?! P9 S/ U: q- {
  78. static int acnt = 512;3 B( `, i; @+ q
  79. static int bcnt = 8;9 ^7 k  q- i) c! }" j
  80. static int ccnt = 8;. K1 h( S. m( U. v/ V
  81. % N/ H& |1 ]# Q0 S4 w* r) l1 C
  82. module_param(acnt, int, S_IRUGO);  g' h$ V# K/ t/ \: N' _
  83. module_param(bcnt, int, S_IRUGO);9 ]: R0 ~5 x7 e
  84. module_param(ccnt, int, S_IRUGO);
复制代码

$ N4 |2 x9 K4 t4 @
/ c8 V' E! [# X- H( ]1 l% J6 D      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' J  l7 c7 g5 P: O+ Z: J
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- h, ?6 G* M/ y$ T0 s0 h
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- I( B. p. r" j7 p2 P
" q% y- {: }; w! d' e  `, f# p7 P

4 J9 @1 P- L$ Y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-2 07:44 , Processed in 0.039676 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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