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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 ^: Z$ F- A# f0 A3 `
  1. [code]EDMA sample test application
    6 p" A' |3 a% _  _1 [
  2. /*! t$ ?/ f& C" N7 ~1 U7 g$ }1 @) |% W
  3. * edma_test.c
    7 C6 U, l, R- r0 W& i( j6 {
  4. *5 S3 _: W9 @! {8 ~* ?; l
  5. * brief  EDMA3 Test Application1 }( X# ]/ _( a9 k7 ~5 a( w
  6. *) }2 D' r7 K9 S! k5 b( }8 U, Y
  7. *   This file contains EDMA3 Test code.
    ( j# T8 y' ]- w5 X7 `
  8. *6 Z% G; t! f9 t/ f
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ( P$ @, G  Q( W  w+ }2 C
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    5 f/ ?. P, v9 n/ s2 \) m. z
  11. *         TO CHANGE.' x1 X, ]9 y8 r  w
  12. *( B5 ?5 ]. e# Y1 [6 ?( {
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    3 `/ ?+ U  i( D: f3 }: `7 _
  14. *- {" n3 n* B+ H6 |2 S, j
  15. * This program is free software; you can redistribute it and/or( r! N7 S4 C; ?2 w
  16. * modify it under the terms of the GNU General Public License as# z0 Y. z2 ~9 }1 Z9 a- G- ?& k" T
  17. * published by the Free Software Foundation version 2.+ [- A, ~" o- k$ u& ^0 K
  18. *
    7 C( f" y" e5 g, k3 U# S( I
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    : F0 {$ V& R6 V' d4 ^$ R
  20. * kind, whether express or implied; without even the implied warranty, o. P% k/ ], ?- j$ w8 Y7 r& Z5 P# R
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    & K. U9 m! f- r9 o! ~
  22. * GNU General Public License for more details.
    # H" F2 Q4 g0 F6 _( Z
  23. */5 i* V5 j. }& o# x
  24. 9 h' D& {& N9 K, p; J
  25. #include <linux/module.h>
    0 h) Q5 s) M  X) E  t2 T
  26. #include <linux/init.h>
    ) _- U& `( N5 r/ b3 [6 S$ y5 x+ ^
  27. #include <linux/errno.h>
      g9 l0 s: q* q9 t9 R
  28. #include <linux/types.h>  P( z' u- t1 A9 u( ~4 i
  29. #include <linux/interrupt.h>
    ' a0 M4 R6 w" ^) E' w
  30. #include <asm/io.h>
    2 N$ l: H9 {+ I3 f
  31. #include <linux/moduleparam.h>% m9 V' S3 s* u1 ~2 \! s
  32. #include <linux/sysctl.h>5 N0 y# e  z; X) {
  33. #include <linux/mm.h>4 |: ~) {4 N' G
  34. #include <linux/dma-mapping.h>$ Z( _. L3 R# {2 N1 h

  35. , I4 {; k/ ~, T: \  x
  36. #include <mach/memory.h>
    / |5 f6 N6 J3 S
  37. #include <mach/hardware.h>
    6 `; ~& Q9 C6 n% s& f
  38. #include <mach/irqs.h>
    6 `+ E8 V6 W! D0 d. c5 K7 S/ a6 @' c' t
  39. #include <asm/hardware/edma.h>
    " ]! d1 f% R6 r7 s" M3 L
  40. 8 ~1 a% t  Y, p2 m2 Z; h
  41. #undef EDMA3_DEBUG
    ! g4 s  L4 Z" S' T8 i
  42. /*#define EDMA3_DEBUG*/8 O; c; ]& ~. i

  43. , }$ e' S# x( n* `1 a' Q" Z
  44. #ifdef EDMA3_DEBUG  I9 W) d' p; D) i6 V9 _
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    0 N% E3 T6 O1 z5 L; s0 j
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    4 O4 q+ h5 ^& n1 u0 }* S' y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): V3 {4 o  M4 L3 f7 e- H
  48. #else
    % T1 |; k6 a4 {" d: ~$ n  Q1 K0 `
  49. #define DMA_PRINTK( x... )+ Q1 U( V9 Z( ^5 E: w
  50. #define DMA_FN_IN, Z1 \9 \, m* X' X$ }  ?" m
  51. #define DMA_FN_OUT
    8 j& q7 A1 e- L9 P" B: G
  52. #endif& f2 S0 a) a6 ]" S, [
  53. . ?( g" ~& p8 d% f  U' J/ m
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    " a# @2 B3 w# b- N7 J9 z3 z
  55. #define STATIC_SHIFT                3
    : I* E5 C! x$ U9 e0 U4 E
  56. #define TCINTEN_SHIFT               20: ~3 p  _8 U+ V% a+ V# I- C
  57. #define ITCINTEN_SHIFT              21) F% d( E0 J( z$ n
  58. #define TCCHEN_SHIFT                22
    : L6 v% i* Y, t' ?4 ^
  59. #define ITCCHEN_SHIFT               23
    $ p/ ~$ I/ C  Y( ]$ Z# ?

  60. ' y. b! Y0 B( S* x' [
  61. static volatile int irqraised1 = 0;
    ! Y! w* s/ k: w. e
  62. static volatile int irqraised2 = 0;
    # b: U2 j. ~* W) y1 p& Q8 C
  63. 0 Q6 f* F+ N% C& }
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# @' x6 J* K! i
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " N; B" G3 q7 M0 t# ^6 q7 y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 \2 `0 A9 X7 f$ f5 z: ^
  67. 0 \" Q* ~6 F5 M& a" o
  68. dma_addr_t dmaphyssrc1 = 0;' m- H2 n5 g1 `( _9 u
  69. dma_addr_t dmaphyssrc2 = 0;9 b. @# m9 n6 Q% X+ U) V
  70. dma_addr_t dmaphysdest1 = 0;/ D1 D( _9 t+ x! j6 M
  71. dma_addr_t dmaphysdest2 = 0;" R9 \* H4 J8 ]5 ]
  72. 9 s% I2 M* J5 n6 u1 p
  73. char *dmabufsrc1 = NULL;, P" X  @# O/ [
  74. char *dmabufsrc2 = NULL;  `* b& H4 \* g- K& p4 e2 K5 K# O
  75. char *dmabufdest1 = NULL;% m& n8 Q: W" d" P) I  Q7 R$ t
  76. char *dmabufdest2 = NULL;! ^1 Z) ]2 i* p' W' l  [

  77. . `4 Z1 p" X0 }, x6 n
  78. static int acnt = 512;
    ' t' C' U- t* D# {$ j
  79. static int bcnt = 8;) I1 b: v" i8 j- S2 `
  80. static int ccnt = 8;$ v% K$ i) ?  L; i% p

  81. 5 h7 b1 E1 g9 e% @
  82. module_param(acnt, int, S_IRUGO);
    ' N$ A2 b1 Q; R
  83. module_param(bcnt, int, S_IRUGO);
    ) O- a2 h; z3 H8 K
  84. module_param(ccnt, int, S_IRUGO);
复制代码
/ f1 p' d: Z! ^7 R$ P' g

9 v6 K" ^" p# V+ U      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ g9 w. c4 [, X, m2 d  \0 `$ darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 w; N) r$ K, R     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& o7 V" l0 k% p: G
0 R9 Z; M0 A+ X$ K, K1 A$ ^  h( D
0 @7 l8 C; {( X. O" E
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-10-1 20:40 , Processed in 0.041735 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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