OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! @' _0 ?. v5 E
  1. [code]EDMA sample test application
    ! H4 W; s8 [; F& `
  2. /*
    # {5 V5 \1 w1 a8 n% g& V0 _
  3. * edma_test.c" a6 w  A. ?6 Y2 I4 O
  4. *9 B3 M$ e$ y% ~! v) _, P
  5. * brief  EDMA3 Test Application8 [6 Z* G9 z8 H8 O  ^1 m
  6. *. N# x0 _1 a) N1 Q, ]- J% w
  7. *   This file contains EDMA3 Test code.1 x- O, L( {- X; W" K; e0 g
  8. *
    ! F7 U6 ?; C2 z6 ^1 T
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, L  a4 R/ H2 {- S: \. K8 ~  ^
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT4 {( h0 _  S4 x/ c
  11. *         TO CHANGE.7 Q( Q. z5 R7 G) I, W* u
  12. *& p$ a- {' |+ G' L8 U: P# [/ P9 O  y
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ' G1 {5 d: t& F  K, f
  14. *
    9 E7 f9 c2 \2 L2 q
  15. * This program is free software; you can redistribute it and/or2 E# T0 j' j3 y- m* G# C/ m; d
  16. * modify it under the terms of the GNU General Public License as. G& g/ m% @6 v. f1 |' @
  17. * published by the Free Software Foundation version 2.
    ! d1 r. h- ^/ W/ n0 M/ @- h
  18. *. S, a8 a. r; W' ~+ n/ k4 z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    6 R7 I  R0 Z3 l* ?3 D
  20. * kind, whether express or implied; without even the implied warranty
    & N6 ~' r" I  n! q2 G1 J
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the: |6 x+ p% J/ W4 ]) G* g5 d# _
  22. * GNU General Public License for more details., \! c; O$ \% A( v
  23. */% y/ L+ u, l9 a( B, u4 g5 x
  24. ( G9 z- k# ^4 z' ]! ~2 E5 W( i
  25. #include <linux/module.h>
    & M) Z0 l" M$ n0 z- G, p
  26. #include <linux/init.h># `/ ^* O3 z0 x9 x3 y7 c% @
  27. #include <linux/errno.h># U1 o$ X; N, [# g+ j
  28. #include <linux/types.h>
    ! |. K& m9 H/ a' J3 @
  29. #include <linux/interrupt.h>( l3 {7 T% T/ E% H) ]
  30. #include <asm/io.h>
    ( m  i/ ~8 n: k7 H
  31. #include <linux/moduleparam.h>0 _# w( W5 B) `1 i0 g4 g9 m6 q
  32. #include <linux/sysctl.h>
    & a" A$ }, p2 \1 x
  33. #include <linux/mm.h>! w/ J& D3 b! |; O2 V: E
  34. #include <linux/dma-mapping.h>
    & M9 u2 M% `( d5 ]
  35. % \2 }  k6 b- C2 w9 p
  36. #include <mach/memory.h>
    ( D8 n1 m3 L* n: J: ?. M) R: B
  37. #include <mach/hardware.h>
    ; ^1 q( V. K# V" S# y* p8 o3 ^
  38. #include <mach/irqs.h>
    : o4 r  e4 A0 s* t, O+ P
  39. #include <asm/hardware/edma.h>7 W- J0 Q0 @. S

  40. : ~# W: r4 c# }! g- S
  41. #undef EDMA3_DEBUG$ t2 @9 y: I9 ~& _2 Q7 O
  42. /*#define EDMA3_DEBUG*/
    , d3 C9 H/ `2 n" P: v, s6 s

  43. 0 U# O+ s: }! b" o, A: v( s: }3 Y
  44. #ifdef EDMA3_DEBUG
    2 W. [3 u! F" r8 `' a! G
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    $ r& ~) K  i4 q, Q5 U7 o
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)) `5 `: ~4 z$ Y5 D, a
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( x  @. G9 n2 K7 d6 a) N, x
  48. #else
    4 J& Y: O6 h6 m. d
  49. #define DMA_PRINTK( x... )
    2 B' U1 V9 s# b" N3 Q; P% J
  50. #define DMA_FN_IN
    # U. `/ N, q1 L% o: j0 j7 V
  51. #define DMA_FN_OUT4 ]3 ~7 q# V7 {# d
  52. #endif) a8 G7 \" a, ~
  53. ' k* h6 |* t* Q( g
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    : {; S. p1 R; O9 X# L
  55. #define STATIC_SHIFT                3! h- }* O' @+ [& O* V4 P' J+ v* m
  56. #define TCINTEN_SHIFT               20+ O. i6 Q6 y9 ]; y% E% }
  57. #define ITCINTEN_SHIFT              21
    / F  k7 Q5 e: D8 O7 P
  58. #define TCCHEN_SHIFT                22, v+ _$ ~9 F0 w/ V
  59. #define ITCCHEN_SHIFT               233 |2 L. P% X( U, B

  60. 8 H) T) M% Y: Q0 r1 Z) H0 Z
  61. static volatile int irqraised1 = 0;- _' F3 w4 U  e( v9 K4 V) f2 l. [
  62. static volatile int irqraised2 = 0;
    * N0 a. Q2 Z, B6 _/ o3 S7 @6 ]

  63.   h: e) _5 Y" R( l5 m6 |; L
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # w) s6 o% X4 }2 ]4 T% ]
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 L" `3 C( u' K: W9 j" v& ^
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( t$ V! y& ~  e

  67. + ~/ R7 w* V- B2 F( x
  68. dma_addr_t dmaphyssrc1 = 0;
    6 w( L; d, n+ w& g0 M$ b
  69. dma_addr_t dmaphyssrc2 = 0;% K' j+ f7 @/ k. L  y
  70. dma_addr_t dmaphysdest1 = 0;5 o" G1 b( W$ f! m3 u2 h5 W
  71. dma_addr_t dmaphysdest2 = 0;
    ; Q0 Z4 n+ O+ ^4 n. Z  Y! D' r

  72. ' U! G0 m- J; Q2 S5 a0 ~. k& F. U$ L
  73. char *dmabufsrc1 = NULL;# M$ w/ _! o& M# M; L* c
  74. char *dmabufsrc2 = NULL;8 a' C1 V; f9 d/ @' C, w
  75. char *dmabufdest1 = NULL;1 _8 i1 Y. p; H! ^3 ]8 d: H
  76. char *dmabufdest2 = NULL;8 Q- C8 w1 [- F3 k9 d
  77. 7 ^* a% H7 u0 ~, M
  78. static int acnt = 512;2 p: c: U: d$ s0 `; d# R
  79. static int bcnt = 8;
    8 p* ~+ N  z. }* b% Q% v( E
  80. static int ccnt = 8;
    # j' j% T- p9 x
  81. : w& @: [2 T. z8 C; t' Z! l# [
  82. module_param(acnt, int, S_IRUGO);2 J$ y9 @6 L, u3 Y" J
  83. module_param(bcnt, int, S_IRUGO);
    : w4 d! x& q; L6 k" A
  84. module_param(ccnt, int, S_IRUGO);
复制代码
0 _7 x) a. E% B  n; P

' H8 B$ t7 z/ U" u4 S* l9 |: A      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ ^; |; X# ^: ]$ ^( 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。6 O2 F7 v5 K: I0 ]: V; I4 a
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ n0 F; G5 s' u
: [! b7 G4 F2 p; I7 V$ k
& C. |9 p  ^9 U  t8 k" {5 b) L
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-1 16:49 , Processed in 0.037698 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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