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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 C  o% B, Y6 F2 v/ u$ b' @0 m, H
  1. [code]EDMA sample test application
    ; G* v4 m% R6 E4 C8 M4 c2 c; ]
  2. /*
    * q; U" d3 `; r; q8 d
  3. * edma_test.c( }6 e) E9 C% e; P
  4. *" f7 D; W: z% U  {0 {+ X. y
  5. * brief  EDMA3 Test Application: F. e$ N, w- X3 u" t% M: o2 }
  6. *5 _1 E6 N# {' ~3 p
  7. *   This file contains EDMA3 Test code.
    ( E! x( p4 ]  j% p, C4 _8 u
  8. *8 @+ A' a7 i& N+ x8 O% c( K
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ _* U) ~) n( J2 [) ~! w5 V
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    $ X  S" [/ q: s6 s1 M7 c7 `/ K
  11. *         TO CHANGE.( V1 c' l# b& X
  12. *4 j; K8 d2 ?8 s
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ( v' q# b  Q+ P
  14. *
    9 G8 j( }  w1 \
  15. * This program is free software; you can redistribute it and/or- F, k1 X* P  T1 z* k
  16. * modify it under the terms of the GNU General Public License as
    ( }" c/ s' \: ?: g7 T1 J
  17. * published by the Free Software Foundation version 2.
    1 u! u0 U5 }! r; F7 U  ^
  18. *
    , Y3 E' R% N6 G) {; q  y8 ~$ Y
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    . H) X, ]( Q: d* P+ s/ S( _( h
  20. * kind, whether express or implied; without even the implied warranty
    - c; q. Y3 T" g* G
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the( z. S: Y4 {/ e: ^
  22. * GNU General Public License for more details.
    7 N" p4 R! D% Y2 y: k( o' n
  23. */
    & x$ d$ s7 f9 a7 T

  24. * m8 N9 n4 v& o  }$ }# b
  25. #include <linux/module.h>
    0 z# k" L0 E/ ~5 J$ l6 A9 V; o
  26. #include <linux/init.h>! u/ O. P- z9 B4 X4 U
  27. #include <linux/errno.h>
      k7 T& H0 |0 e, l: d
  28. #include <linux/types.h>
    % V7 |" B- s. U
  29. #include <linux/interrupt.h>8 V% C; `4 \/ D$ L$ P8 _
  30. #include <asm/io.h>+ [1 l4 D6 W! C; u, k2 O
  31. #include <linux/moduleparam.h>
      G% Y! s1 I# P) H
  32. #include <linux/sysctl.h>
    / u! w( r7 U0 G' H5 t3 }! L
  33. #include <linux/mm.h>. |. ^+ m5 v( S3 U
  34. #include <linux/dma-mapping.h>
    $ }8 z# H+ V/ ]9 E5 y

  35. - W2 K# j- h' q+ Y1 L4 z; ]
  36. #include <mach/memory.h>5 E) j% Z- K  z/ G8 j; Q
  37. #include <mach/hardware.h>$ q1 }( k8 K( k( B
  38. #include <mach/irqs.h>
    $ B) C; C+ N" @9 T
  39. #include <asm/hardware/edma.h>
    5 C4 @( B7 ^5 }: ]( g& j. [6 a
  40. ( o4 ^* D9 d/ `. k, l! z
  41. #undef EDMA3_DEBUG
    ! y% \5 G; i& k; x0 P
  42. /*#define EDMA3_DEBUG*/0 G' M$ R* ^8 N

  43. 9 z- a$ b6 H$ Q! u
  44. #ifdef EDMA3_DEBUG
    % ?6 Z4 Q) P  k6 `  B
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). y( f- m+ |: y5 k* S1 w: v1 |
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)6 r" s( n. \8 G7 h8 F" d' |
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    3 `+ |2 ]0 ^; f6 L
  48. #else
      w: ^3 A( @& O: I8 ?
  49. #define DMA_PRINTK( x... )5 a% o& ^  _% z, J7 K( a% w
  50. #define DMA_FN_IN
    9 u6 @5 l0 w0 e
  51. #define DMA_FN_OUT
    - @% P5 Z: i7 z1 x! `1 J
  52. #endif
    ( t+ S+ q; [5 Y* T
  53. / G0 |6 v6 N4 R7 Y2 t* j9 o
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    8 \& |) Z. O+ A5 m0 }  m
  55. #define STATIC_SHIFT                36 J" p$ O- u/ n1 s$ b+ G- ]
  56. #define TCINTEN_SHIFT               206 b# t% @4 s8 t7 @; C- P
  57. #define ITCINTEN_SHIFT              21( p5 g, ?$ H) h/ q$ Z# L) z
  58. #define TCCHEN_SHIFT                22
    * I: L' s0 O0 K! u
  59. #define ITCCHEN_SHIFT               23
    9 p5 V  O7 p7 j! B& E4 _! ?
  60. 7 E. `+ l1 @, h$ v5 j! t! J
  61. static volatile int irqraised1 = 0;% |9 l/ k" d! n; I7 G* R$ W
  62. static volatile int irqraised2 = 0;$ C( }7 i  P) e- l) W! d6 T" U

  63. , w( L) V) E- M  p  _6 I
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 V! r" @$ A: q7 t8 v$ q! Y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 ]& ]- e5 f# B9 w1 m9 F2 X& M. r# H; s
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * s# e+ o' y& ]6 O0 H, o' }& X
  67. % \7 s+ {& F) I4 x8 n* a" L+ H
  68. dma_addr_t dmaphyssrc1 = 0;
    6 v) j+ e  \/ X6 V4 {  Z- ^1 l' f+ w. `7 Q
  69. dma_addr_t dmaphyssrc2 = 0;
    , a; w. h" ^6 I
  70. dma_addr_t dmaphysdest1 = 0;
    9 G! K8 N* c  J! p$ M9 M6 j2 ^' ^* d: J
  71. dma_addr_t dmaphysdest2 = 0;5 y: P. B8 W& L, t

  72. 0 Z& c- Y! g% ]( M( }- h% f) g* I9 U
  73. char *dmabufsrc1 = NULL;6 B# o+ S4 M! e
  74. char *dmabufsrc2 = NULL;
    / Y+ w) X4 g( K: Y( H9 u
  75. char *dmabufdest1 = NULL;0 r6 Q" n* a$ s4 u4 \0 Y+ _
  76. char *dmabufdest2 = NULL;. {. n$ F  H! K; h. N

  77. , W1 b+ U1 g0 g
  78. static int acnt = 512;5 y7 v1 [8 l- t5 X
  79. static int bcnt = 8;4 v4 [# R' `; ^$ E: Q* \' l9 W, Q
  80. static int ccnt = 8;
    , y0 _3 v" ]$ \0 i6 O
  81. ( l; |7 o: A0 j
  82. module_param(acnt, int, S_IRUGO);+ ]. B* ]/ s# s7 K& |
  83. module_param(bcnt, int, S_IRUGO);
    5 J1 ?* g+ Q8 _) q" s7 y1 i
  84. module_param(ccnt, int, S_IRUGO);
复制代码

7 `" H' X3 @; S: Q% K+ D+ R0 U$ d
# C* \7 m  u  @4 |3 V      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% z% C( Q6 \3 q6 f
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$ @2 g; D# Q     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 x/ c4 z: t3 @8 t. d4 z7 M6 j+ p! z' m6 b3 a
( ~; P1 Q- B  r- e! C
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-30 01:55 , Processed in 0.039759 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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