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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
) k: S+ Z' L8 u' o" i) L2 e
  1. [code]EDMA sample test application
    , s7 o5 o! C$ p7 v* K
  2. /*" a# M+ s/ g, g% f! D- R0 ~$ D
  3. * edma_test.c
    & P& N! |) f7 H9 B* z1 P, I
  4. *
    ) r" q. x3 g7 y4 {
  5. * brief  EDMA3 Test Application
    ) b' V! I2 J3 _2 ^0 {; Q9 G8 Z
  6. *
    6 u: [% S! D6 B
  7. *   This file contains EDMA3 Test code., O1 y' s5 ]9 l7 m
  8. *5 R% h: C: ?8 D4 h, I
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& _2 I- k$ I9 O% |' D/ t6 x! {+ a# U
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# c) `. P0 {9 }# H7 Y
  11. *         TO CHANGE.
    $ g! a4 S( p2 h
  12. *# {: k6 x- R" x6 m; ^
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    1 f  c0 X; R, {( R) u; A3 L9 b
  14. *
    % `9 \' A) P3 N; Z2 T# s) x
  15. * This program is free software; you can redistribute it and/or
    4 G1 M) I% v. z$ P  F
  16. * modify it under the terms of the GNU General Public License as
    # F0 @* n) m" M, O; G% h
  17. * published by the Free Software Foundation version 2.! E8 b! l; e) C! ~9 \" D
  18. *
    4 e8 o7 n  |) r- D, e, ~0 U
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ! |9 I) X- [, L$ I
  20. * kind, whether express or implied; without even the implied warranty% i0 i! c( X% V' @6 c% r. \
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the. ?. R/ h" N2 V$ |
  22. * GNU General Public License for more details.
    / N: W4 Q8 Q( k; Y1 q
  23. */! K' c1 @, K/ ~3 U* v2 k( K
  24. 8 }/ ~6 G" v. t: j2 d+ ]8 V' k
  25. #include <linux/module.h>8 ], A+ n" D  o
  26. #include <linux/init.h>
    ; U# f! {) ^" c8 q5 g& ?+ n
  27. #include <linux/errno.h>
    2 I# a& `7 J. t+ Q/ T+ q* v
  28. #include <linux/types.h>% ^% T& h% ?+ a* c; h2 q# E
  29. #include <linux/interrupt.h>1 [4 n3 E( i) X/ T% o* {
  30. #include <asm/io.h>2 R, }% a# ^8 l0 t
  31. #include <linux/moduleparam.h>
    2 i" A  @0 {2 L6 Q2 g4 H0 c& c
  32. #include <linux/sysctl.h>
    - B) }* F' w0 a2 n# k( @6 O
  33. #include <linux/mm.h>& \+ V0 l" C! V" W, C' ^: v, j8 o
  34. #include <linux/dma-mapping.h>
      ~' K9 D* G5 Z

  35.   T! C. L/ x  C
  36. #include <mach/memory.h>
    . S6 [/ h( E+ ?4 E4 [# N6 }
  37. #include <mach/hardware.h>6 m4 _& I( z# \2 y/ A2 q' z9 A6 v# R  p
  38. #include <mach/irqs.h>
    0 ^) q' N- D5 {' R
  39. #include <asm/hardware/edma.h>% L, J$ c0 O$ y9 C$ |
  40. & J' n! t. P& w
  41. #undef EDMA3_DEBUG
    9 y' \+ q4 c3 B
  42. /*#define EDMA3_DEBUG*/
    ( Z% ?( L/ Z) }  ]8 A. F! K% V

  43. 5 [& v5 F8 C! o5 {+ h
  44. #ifdef EDMA3_DEBUG% w1 u9 G. ]4 j" G. Q0 B
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    . K; p( x# i5 l
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" z5 ]# m" E- V. Q# {8 r$ g
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    : U$ \% s/ E- ?: L5 Y" m5 e
  48. #else
    - ]  T( R2 j5 E) y3 e
  49. #define DMA_PRINTK( x... )& j' j- y" w5 U1 }& a- {
  50. #define DMA_FN_IN( U. V) ?, {" G
  51. #define DMA_FN_OUT  b. [3 b3 n8 V) B7 c
  52. #endif
    ) e% G: ]# W8 ~, x

  53. : Q7 x; n8 Q% S# T4 G1 C5 S
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)7 i4 S$ z+ Z6 I1 x7 C& Z
  55. #define STATIC_SHIFT                3
    . n2 s: B/ o+ Z* w; z
  56. #define TCINTEN_SHIFT               20/ y, R' i! r; ?3 H% G
  57. #define ITCINTEN_SHIFT              21  _4 F1 T9 |7 [- H9 f, a7 j
  58. #define TCCHEN_SHIFT                22
    * ^# Q1 t/ v2 x( j2 y( A2 h0 r
  59. #define ITCCHEN_SHIFT               23% `+ Z3 v0 F' U) ^5 {
  60. ) }% c4 @5 M" l9 B! C* b: w, ^
  61. static volatile int irqraised1 = 0;0 B- m# H+ J/ r& B- f3 T" _
  62. static volatile int irqraised2 = 0;0 x* V6 J4 z5 Y' j# W* i- t! i

  63. $ f; s: s0 J4 c/ V- `3 ?. E1 O) W+ f
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 j$ p) e2 W4 P' {
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 d9 R* L/ r$ |
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 g+ y+ c. H' S8 g7 f  @1 n
  67. $ @2 u2 X7 k% B, z2 V# B0 I6 L  A
  68. dma_addr_t dmaphyssrc1 = 0;8 {  Q# L/ O/ ?% q# ?
  69. dma_addr_t dmaphyssrc2 = 0;
    8 W) n& T/ G+ U7 C0 L$ k
  70. dma_addr_t dmaphysdest1 = 0;& K. g. W0 @; {* b0 a+ k: ~7 O7 p7 V! A
  71. dma_addr_t dmaphysdest2 = 0;7 c# d8 f5 D- w, [
  72. 2 Y- E) W* k8 ]) O
  73. char *dmabufsrc1 = NULL;* V7 z3 J7 A1 g1 ~5 r7 @
  74. char *dmabufsrc2 = NULL;
    , T+ z+ L" q7 e, T$ M
  75. char *dmabufdest1 = NULL;2 K2 P# N- _+ ]6 k
  76. char *dmabufdest2 = NULL;2 c* B% Y: e% Y4 _

  77. # T* A4 o; Y& w0 K0 [$ J
  78. static int acnt = 512;. e' [& L4 X: Z/ w- |
  79. static int bcnt = 8;
    " e* i/ x3 R3 J' e1 {
  80. static int ccnt = 8;
    5 U6 P2 I9 ]" K- B7 m* {8 I9 G
  81. 8 y$ j. U' ]. I; o+ N
  82. module_param(acnt, int, S_IRUGO);0 _8 B6 L5 {1 _5 k' n9 w5 W9 a
  83. module_param(bcnt, int, S_IRUGO);6 C/ `4 S; N  |' v( z
  84. module_param(ccnt, int, S_IRUGO);
复制代码
, S( y' ]% v; c, V8 [; E2 ]

$ f' J% D' x( `' y. Q' w      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用. p4 `$ s' [3 J  H4 i$ I. \3 z
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 `; d) v5 o; s- U0 M
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 z/ Y3 q# r; p2 W* b4 j2 v, `

7 L5 U) G) h; M7 d& |" w  t1 V# _( ^, f1 V
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-24 05:25 , Processed in 0.037364 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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