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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
& e  W0 `. L$ j: M! ~
  1. [code]EDMA sample test application1 n$ ?- a3 w- g. {
  2. /*1 S* H/ T  J/ p: x+ ]* W# J6 L9 ]
  3. * edma_test.c- p8 S/ [9 J3 Y
  4. *
    " ]7 p# u. `8 V
  5. * brief  EDMA3 Test Application
    , [4 d- e8 S0 E! o
  6. *
    ) b6 G% B7 L2 J
  7. *   This file contains EDMA3 Test code.6 ]5 F- l7 ^/ K, B$ `% p
  8. *
    3 v0 K2 a. u6 D! b, ~* E
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& @$ L4 z7 A& ]- [( s6 P
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    8 @, g/ l" D, Y% x) O
  11. *         TO CHANGE.' P0 p4 u: t0 J# Q8 A4 z
  12. *
    1 g! y, x6 V7 e: t
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    . f& K! c+ {- E- T% p5 H
  14. *
    8 q$ `+ g5 z$ u9 u' {
  15. * This program is free software; you can redistribute it and/or! U$ Y) L) j% X" m1 y8 u3 X
  16. * modify it under the terms of the GNU General Public License as
    & }: h$ V% R# F+ V  [2 c2 W
  17. * published by the Free Software Foundation version 2.+ B$ X* T0 Y# @8 G
  18. *1 z0 \+ T* q; y; C+ _+ B
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ V- d2 y" B2 ^  [  P& a- Q+ z
  20. * kind, whether express or implied; without even the implied warranty" N* c7 m  ?4 O8 p* l: F) B
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    . V, U2 C. ]' B6 C& C' X* i1 D4 s
  22. * GNU General Public License for more details.& @. r" w, Y. |3 s5 V
  23. */
    " @/ `! W; T1 D9 e8 g$ f+ w

  24.   i& X3 \+ K' q) d) Y
  25. #include <linux/module.h>; h% z6 L; O) b; X0 Z4 u* [; T: _
  26. #include <linux/init.h>
    : V) D) b# y3 X( E. D
  27. #include <linux/errno.h>
    & ?* F% V9 d8 K! E- D5 t1 X$ H
  28. #include <linux/types.h>
    6 \' [  A; l/ f/ ~' b* a' A
  29. #include <linux/interrupt.h>
    ! v* R5 S; w$ _& ?$ p0 D
  30. #include <asm/io.h># \4 _" z* n, k9 g8 J/ g
  31. #include <linux/moduleparam.h>! A: O% ?2 y: {# L. k. o
  32. #include <linux/sysctl.h>4 n9 {9 c, J8 A  a
  33. #include <linux/mm.h>
    7 s# l# ]* X4 |: \& P0 |9 |
  34. #include <linux/dma-mapping.h>
    * n* |7 m# H2 K3 l7 U5 f
  35. . W! i/ S) X6 t; S- n  j
  36. #include <mach/memory.h>0 s9 Q& M) F* I2 P
  37. #include <mach/hardware.h>6 d( e- h( U3 P' d
  38. #include <mach/irqs.h>, ^2 X. d/ ?$ \( {5 e6 b5 n: @
  39. #include <asm/hardware/edma.h>1 [. N* a# `0 c9 r) l7 A
  40. 4 {8 Q) X& h, v0 j: B
  41. #undef EDMA3_DEBUG" c: J3 |8 d( X) C9 J1 c6 J' M
  42. /*#define EDMA3_DEBUG*/( a  X1 M. ^" |: f" `8 s/ m
  43. 8 y4 F+ ^9 o5 V  L
  44. #ifdef EDMA3_DEBUG! ~' M/ x9 u' ?% t" N7 T) }3 M  C
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    $ T. y: Z6 X4 \9 M8 x! D: i
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# t6 w& |9 X) R- Q4 l
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    * F/ d, P- ^. A7 N* k+ s4 l/ ~
  48. #else
    + z# [: q5 K1 [- U+ J! H1 `
  49. #define DMA_PRINTK( x... )1 J) K2 F" Z& Y6 {4 r8 H
  50. #define DMA_FN_IN+ A; U3 J% |' C* @( p( Z
  51. #define DMA_FN_OUT# S6 v' X% l9 j1 G
  52. #endif! S, ^( _7 j/ f  ^0 Y0 g, P' L

  53. / _6 F3 t* t  m6 f' j
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    * ]) [6 {4 F" `" e0 f7 h* X
  55. #define STATIC_SHIFT                3* J3 E# T" V. u2 F$ q" r
  56. #define TCINTEN_SHIFT               205 }8 U5 N; a; u( G# p7 o1 t
  57. #define ITCINTEN_SHIFT              21
    7 p1 v) L1 P! n! T
  58. #define TCCHEN_SHIFT                22! A; w9 Q! B4 c& o) [4 @# v7 l
  59. #define ITCCHEN_SHIFT               23
    % S2 ^5 p: {; ~. Y; M1 R; ]" T

  60. : _  j5 U, j# B
  61. static volatile int irqraised1 = 0;7 Q; e+ ?  b9 F
  62. static volatile int irqraised2 = 0;
    . i' t+ H) |! Z7 Q. h5 e1 O( P
  63. . s/ w( ?# L+ b: P) ]$ d
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      j& E, M$ M. P  ~1 c& X  e
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 r  d' j; h; E) q+ b
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) H# g( H) N( {* k$ J( K6 f
  67. . M& _4 Y* e5 `+ U- y* s
  68. dma_addr_t dmaphyssrc1 = 0;2 ~; ]% z1 Q4 ~/ D
  69. dma_addr_t dmaphyssrc2 = 0;
    8 D1 t# p$ u; E7 Q! I
  70. dma_addr_t dmaphysdest1 = 0;& d- r6 \+ F% e; O* Q3 v
  71. dma_addr_t dmaphysdest2 = 0;8 N% Q( k) Q6 \9 i* @

  72. ( h: r. T4 R/ i( r
  73. char *dmabufsrc1 = NULL;( |0 H6 e2 c* P5 y- G' a& A9 c. t. C
  74. char *dmabufsrc2 = NULL;# n6 ~) }$ W  \' k+ {9 e
  75. char *dmabufdest1 = NULL;
    8 o- z* q% F! `7 Z+ ]5 }: a: H
  76. char *dmabufdest2 = NULL;+ `1 s% [8 Y; ]0 N: @% r

  77. 3 U) I! T; ^: A$ q- m7 r' f& @7 Q8 g
  78. static int acnt = 512;" s4 q! [# \# L* T
  79. static int bcnt = 8;
    ) J& d  u5 g% E! I, ]
  80. static int ccnt = 8;2 Y1 R% z( a, [6 I
  81. # o! H  l1 [; j9 u1 i* l% c$ b
  82. module_param(acnt, int, S_IRUGO);7 ^  K7 m  K$ h/ D9 [
  83. module_param(bcnt, int, S_IRUGO);
    ! ?0 |# v" ?9 V" o# Y
  84. module_param(ccnt, int, S_IRUGO);
复制代码
1 B6 W* x4 h0 p# n
9 N/ D7 Z9 C- W7 g
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, b  x# w' d" d+ m, }. b6 q% P  I3 f' i
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 C; Q" C. C7 P6 H     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 {! h9 c2 v3 b: S' m8 u4 M0 s& q
  [* {  F+ I% K* Z

$ m4 f8 n, v1 j! ~
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-21 07:00 , Processed in 0.043837 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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