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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 P* \/ H0 l! z
  1. [code]EDMA sample test application
    ) U* d% q8 e+ F$ a$ U5 f, {
  2. /*
    ) l' A& M7 S  ?4 L  H. ^* T
  3. * edma_test.c
    ; W* N% P+ b  b5 a
  4. *' @8 S1 Y8 V2 @  @# c% d
  5. * brief  EDMA3 Test Application
    9 X1 g. m* [  B+ K+ }6 p0 P
  6. *
    ) `8 n- l% j8 @- o/ J
  7. *   This file contains EDMA3 Test code.4 [( K* P0 j* }% Q1 |% h; f
  8. *
    - x0 i, c& t; Q1 {
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    : g$ A7 z; v! {# m6 r8 ~; N
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 m/ n! ~7 z4 H( P- b. r
  11. *         TO CHANGE.& @  E# {  A. `. \7 Z
  12. *
    0 N% _  `* M3 T. j
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 t; @! s' e; |9 q1 o& a1 t. ]& I
  14. *) H+ [& R- g( i3 o% M/ h
  15. * This program is free software; you can redistribute it and/or; ?% _) z1 C! O+ U! J. G
  16. * modify it under the terms of the GNU General Public License as1 r: a7 I2 h, e: Y
  17. * published by the Free Software Foundation version 2." @0 \7 r: U* v/ P
  18. *
    " U! y: i7 U( p3 Q- c; V& A
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any& P4 i! x( ^/ ~% P! K- E
  20. * kind, whether express or implied; without even the implied warranty
    - B; I- y6 Y9 G$ I
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the% t9 i; ~6 y5 d* w9 \) D1 f( O
  22. * GNU General Public License for more details.5 t2 C7 `  ]' q! S
  23. */
    $ b5 l4 W7 K3 }- f
  24. ) a  V+ p- P3 @% K
  25. #include <linux/module.h>
    / r: i7 P5 C4 G! h0 O6 M
  26. #include <linux/init.h>  p! F6 b$ T' c
  27. #include <linux/errno.h>
    7 }: J* E" o/ R' w, i7 g
  28. #include <linux/types.h>
    * C6 L5 ~5 {; d% X, L, Z9 C+ |0 ^
  29. #include <linux/interrupt.h>! x# Q7 O. z8 c, o8 l! Z$ V4 n
  30. #include <asm/io.h>
    3 H; i( N  }5 U: S: k
  31. #include <linux/moduleparam.h>
    ! b# R; i( K* x" Z% d* G
  32. #include <linux/sysctl.h>
    3 H. K% J8 V( G! |
  33. #include <linux/mm.h>
    ; X% y" t' ^) d4 D' l9 P
  34. #include <linux/dma-mapping.h>$ b) x8 x' o: ]& Y9 E* v

  35. 0 V6 [$ R3 @& }# H! _2 }' @
  36. #include <mach/memory.h>; B! i4 e+ v* Y
  37. #include <mach/hardware.h>
    : [, ]3 |6 \, `* [/ C6 O
  38. #include <mach/irqs.h>
    8 y8 G! A' d3 N! a; Y4 k6 B+ \5 }
  39. #include <asm/hardware/edma.h>8 _. ~: F2 `  w( J& Z
  40. ; A, Q/ S3 V7 Q
  41. #undef EDMA3_DEBUG2 s& k; A! a& M# ~# a- d* P! u% O8 B
  42. /*#define EDMA3_DEBUG*/
    + b' U, b5 R4 I; z5 _# `, Z2 X
  43. , g! c1 y: G2 b6 P1 i
  44. #ifdef EDMA3_DEBUG" N" u0 W9 K8 F$ e4 G/ g0 E
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    * ]! c5 T2 o  e4 F7 N* U8 F5 Q: V
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ' y5 L! y) a3 }- A
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
      h! ^8 ^% l, d# O! L, s* p
  48. #else
    : S5 U$ J; M1 x1 {/ o' T( r
  49. #define DMA_PRINTK( x... )
    8 |) a7 Z- d% I
  50. #define DMA_FN_IN, d7 a# x& P2 V8 E
  51. #define DMA_FN_OUT5 L: U3 J( N- ~$ f9 d; K" Q0 u$ P
  52. #endif
    3 S% A& T' H; u" m  X

  53. 9 n6 Q/ m0 T5 D0 U. _! K8 I7 W
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)* J6 F2 x2 d6 ~# e1 Y& Y
  55. #define STATIC_SHIFT                3. A: `- H( L4 k1 M: b
  56. #define TCINTEN_SHIFT               20( n7 p% W8 }! P: `
  57. #define ITCINTEN_SHIFT              21
    ' p+ Y7 U; f3 N: A+ ~) h
  58. #define TCCHEN_SHIFT                229 ]. n6 Q8 N6 O/ }/ V7 g
  59. #define ITCCHEN_SHIFT               23
    1 J5 t, C0 q9 j& O

  60. / @! F, D3 t6 f/ o6 c( w% R
  61. static volatile int irqraised1 = 0;
    ! m5 }1 T. G, Z3 c5 i( G
  62. static volatile int irqraised2 = 0;6 R' G1 D, n4 O& ?/ Z6 k3 e9 r
  63. . b+ v% S$ c; p3 Z4 k
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + D7 k7 A0 ~+ a% ^  L- G- u
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # Z/ B3 k* ]+ @& M, Q
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! e" }2 t7 @$ A  T2 k; t1 N

  67. 3 D# v% K- x/ _* P% _! G
  68. dma_addr_t dmaphyssrc1 = 0;
    $ f- A5 g8 Y: u5 _* s# ]
  69. dma_addr_t dmaphyssrc2 = 0;3 p! m. |$ ]) ]$ R
  70. dma_addr_t dmaphysdest1 = 0;, A# w5 P! J* [0 ?
  71. dma_addr_t dmaphysdest2 = 0;* C* @4 P# V# `: J3 _
  72. $ V8 r# S% @" Z' k* R, Q- I: u7 v
  73. char *dmabufsrc1 = NULL;2 L$ c- [* F0 U2 A
  74. char *dmabufsrc2 = NULL;5 N# G" j3 C1 @7 C( `2 U: F
  75. char *dmabufdest1 = NULL;
    ) J0 k( v1 b8 \
  76. char *dmabufdest2 = NULL;
    % q/ i, S7 @2 k. h, u& k2 X1 i
  77. 4 |5 A+ J& H1 _7 i
  78. static int acnt = 512;
    . g# k0 X7 m/ o" F! i  _4 }8 V
  79. static int bcnt = 8;. n2 o3 B' M% G5 @5 g4 z6 c
  80. static int ccnt = 8;2 \3 w8 E) n! r  {
  81. : z! C  K  U* i4 n! M8 u
  82. module_param(acnt, int, S_IRUGO);% {# k- C$ k( ^; h) W& [9 x; M
  83. module_param(bcnt, int, S_IRUGO);
    ) _7 S6 \+ e% U: Q5 G
  84. module_param(ccnt, int, S_IRUGO);
复制代码
  \3 d# y9 O7 U% E1 W

% I2 v0 `+ r# N9 D9 \      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用  V; }! F9 C0 M: b! [" N+ l0 W; ]
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( D  M8 ~) I9 t& D; N     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) Q2 c3 H) L) j+ f  B! z2 n
# }3 Z$ i! g3 r+ z+ m  t0 z; y4 g3 E* g3 x
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-23 08:15 , Processed in 0.038631 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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