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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 G" ~  {! [3 G& K5 H
  1. [code]EDMA sample test application
      N; B: c* g, P$ y
  2. /*
    , X2 Q3 {; v7 z, w, B0 W
  3. * edma_test.c2 F2 P! P0 o3 R* \! S( h3 K3 A
  4. *
      s$ w# V% G) j. L+ j1 ^
  5. * brief  EDMA3 Test Application
    % ]4 v/ ^( C. Z. \) |# D
  6. *( h/ k" {% M  T; O' p( e
  7. *   This file contains EDMA3 Test code.: K& L2 X6 o+ G
  8. *7 B( s$ v, V6 Y, J7 ^
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" \+ {# z( q: s! p6 Q$ l% }
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, G/ _5 \8 N2 ?; Z0 X9 a
  11. *         TO CHANGE.# i7 F/ v9 N4 J( ?9 F; m
  12. *6 s* ~* k" H# A* K# N& r
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 ^9 p7 n1 `6 H: d( ?7 Y
  14. *
    1 X7 r& L% r" c3 e: ?
  15. * This program is free software; you can redistribute it and/or
    8 U  Y& T% n6 [7 Y( j# _
  16. * modify it under the terms of the GNU General Public License as/ h5 s# {- d  D- e4 L
  17. * published by the Free Software Foundation version 2.
    7 y% v/ t1 I- k  [' P
  18. *$ }) e3 k7 B7 V
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ B9 T1 Y# }0 z1 H- y& ^1 W
  20. * kind, whether express or implied; without even the implied warranty! c  f# A" C" E9 a" p$ L4 s+ w6 N
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the( R* k" l, `: Q
  22. * GNU General Public License for more details.
    * B. r4 g, a+ Z( s# S2 r  |6 K
  23. */1 r( h$ m2 }* O1 T4 ]

  24. ) s# |0 W6 I$ O/ c- j( P9 F
  25. #include <linux/module.h>& e) r) A6 p( H8 l6 U2 V# g
  26. #include <linux/init.h>
    1 [/ n) E: Z* e
  27. #include <linux/errno.h>* W( `( n/ Q' ~7 i( U3 n* c( d: M
  28. #include <linux/types.h>
    4 A0 K9 g3 p5 M7 A. u. ~" j- i
  29. #include <linux/interrupt.h>8 O# g3 o& {" d6 z. [
  30. #include <asm/io.h>
    7 Y- ^2 Q; U9 Q
  31. #include <linux/moduleparam.h>
    2 ^/ ]& E8 _8 Q+ V' i; @
  32. #include <linux/sysctl.h>  Y: q4 ]0 ~9 j7 [+ e9 ]
  33. #include <linux/mm.h>
    ! u/ X0 J8 h& i8 U% o4 s) g% S$ M: v
  34. #include <linux/dma-mapping.h>. e6 O! {$ I! r, i8 _; o3 Y( M

  35. 8 B' [; _7 _- q9 m1 i( F) A% i' R
  36. #include <mach/memory.h>
    & q7 y; A0 _' o2 U  b. A
  37. #include <mach/hardware.h>
    & J7 E; b' a( y+ R" j! V( Y
  38. #include <mach/irqs.h>  t; Z$ X; J3 \( Z  e$ X( T
  39. #include <asm/hardware/edma.h>
    % p0 T; A" o& B0 V
  40. ( h2 q/ M7 e6 s
  41. #undef EDMA3_DEBUG1 v7 A2 y) L3 ~3 \8 P; q" f
  42. /*#define EDMA3_DEBUG*/4 C- c1 s9 e9 o, Y
  43. # D0 W9 {" a  ~% y
  44. #ifdef EDMA3_DEBUG. S5 u- K3 ~9 P" v4 `0 c  t
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    2 F. o( z; Q' b
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 h; l  B' U% h3 f
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ! [& r8 V. v$ r% X! ~/ e9 V
  48. #else
    6 S/ U" J( J+ C- a: S
  49. #define DMA_PRINTK( x... )( x: Q6 p: W2 y; x' a
  50. #define DMA_FN_IN
    * r# T3 c8 b% D( w+ U
  51. #define DMA_FN_OUT7 {0 w- N7 i) ~9 }
  52. #endif
    3 z/ `8 k( i+ B
  53. 5 y  Z' Y9 @4 `: d
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)* e/ s/ u" v/ O& L4 n- `2 U6 G
  55. #define STATIC_SHIFT                3
    . ?8 o3 ?: q8 |$ X" a( m
  56. #define TCINTEN_SHIFT               20
    % m- T# J1 n8 t; q. e3 U5 H( N
  57. #define ITCINTEN_SHIFT              210 O0 H3 k6 L* X% @( ^
  58. #define TCCHEN_SHIFT                22( I* W4 L: M! F9 Y: u
  59. #define ITCCHEN_SHIFT               230 _  C- a3 @2 }; `1 H- V

  60.   N( d5 ]2 \6 b& o9 h, b+ o
  61. static volatile int irqraised1 = 0;3 }  K2 K; H$ C* C: A# i
  62. static volatile int irqraised2 = 0;
    1 A" d% P  K5 e* q1 F4 B: y
  63. 1 A: Y) _- o+ i& H# K- `
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 c1 k9 n  ?/ Y9 I1 k
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! H& T! k! ]$ ]$ ?1 t6 f
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 c3 J; a: K4 r
  67. * P$ Z* _3 e1 n
  68. dma_addr_t dmaphyssrc1 = 0;
    9 O; \% Q% J, G( D- r  M  b
  69. dma_addr_t dmaphyssrc2 = 0;; V' {, n; _8 y! e" e" U: n. D) H
  70. dma_addr_t dmaphysdest1 = 0;
    * v1 D5 q2 {" J; ?) \
  71. dma_addr_t dmaphysdest2 = 0;
    . N$ ], D9 V% O. J
  72. ! m" S/ E8 q5 d1 d
  73. char *dmabufsrc1 = NULL;" O( P( j: b. |0 S9 K3 n' e
  74. char *dmabufsrc2 = NULL;
    2 p1 d- \5 g  Q0 t% _: X7 v) @
  75. char *dmabufdest1 = NULL;
    $ D9 q  ?! c# h( z4 N
  76. char *dmabufdest2 = NULL;
    0 t2 @) g5 b! I# [! r. R; U% a6 Z* ?

  77. " `" S* |) }6 V
  78. static int acnt = 512;
    % M$ Z1 q! \% ?# v# {! u" A. e3 c
  79. static int bcnt = 8;) h0 M8 x) a( H; d9 t; A' a$ c
  80. static int ccnt = 8;
    $ \& ?3 r2 I; m* }

  81. * r" g! k" @- X. k
  82. module_param(acnt, int, S_IRUGO);% j( c: J& J% I9 J
  83. module_param(bcnt, int, S_IRUGO);3 j0 B/ M7 i6 R5 p- {0 H8 {& w
  84. module_param(ccnt, int, S_IRUGO);
复制代码
2 G5 g0 Y- O: Y& a/ ~; U! n

5 C/ f+ G8 {  |( E9 K- T; A      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 ?  m/ v! l* Z9 N, d$ ^( V/ {
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
2 @  f3 q2 e$ w' b9 @     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 ^5 @6 Y" n2 v# O6 F

, M. X9 h& E3 R7 F% D6 Q0 f5 `; S/ L
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-30 20:15 , Processed in 0.040669 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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