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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! R2 Y* C2 [: k" x8 I8 m* n9 e9 w' ]
  1. [code]EDMA sample test application* p; m4 x5 Y5 s$ w9 ]
  2. /*2 O# m5 b7 A. G4 c$ y  T  L
  3. * edma_test.c0 k" H, y# b0 B+ t  C5 w
  4. *
    2 Z2 w, h4 z$ L* B- n) g# N
  5. * brief  EDMA3 Test Application
    + n( m1 w$ \8 F! ^: N: M
  6. *, n* T, `/ T3 M/ V
  7. *   This file contains EDMA3 Test code.  O" |( L* ?: r. t
  8. *8 ^! ^! n( T2 q1 `( W/ q6 j0 k
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    + I7 J" A4 L  k  @% U
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    5 }: [4 H4 f: e. A! Q  `
  11. *         TO CHANGE.- |* n7 A* J& m# M; y0 M) Z
  12. *
    # m; h' U  @1 R. U+ a
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ! h8 N$ l, t% h' n' X
  14. *
    2 ^3 @! a: J, \
  15. * This program is free software; you can redistribute it and/or
    7 o1 {$ m% P4 P! G/ l
  16. * modify it under the terms of the GNU General Public License as  ~- {8 N9 a9 A* y% b9 B3 o$ t
  17. * published by the Free Software Foundation version 2.
    . j9 t' k, g$ s3 t" M0 E
  18. *3 c0 p3 I0 L" H' q
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ; f8 {* A7 T+ C# c
  20. * kind, whether express or implied; without even the implied warranty0 {/ X- x0 N& Q4 U3 N% p! e
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ( r: c+ x' E1 M3 C2 _1 I
  22. * GNU General Public License for more details.
    / s' Y) v5 b' v) v
  23. */3 n$ u$ \& l; j8 k  d& a
  24. 3 }* L/ h& Q. j$ |
  25. #include <linux/module.h>
    . r' f4 D/ V# B# E& q# a
  26. #include <linux/init.h>9 Q. H- n& s8 U6 a
  27. #include <linux/errno.h>9 @2 K- H4 h0 h. T3 Y/ u
  28. #include <linux/types.h>6 N2 S# s, l+ Y% q
  29. #include <linux/interrupt.h>
    7 u* M" q5 p* U  g6 O9 P4 B, ~
  30. #include <asm/io.h>
    $ ]/ T+ L2 k& M
  31. #include <linux/moduleparam.h>
    2 X* ]7 x4 _7 j6 F, U
  32. #include <linux/sysctl.h>2 o: [0 H- i+ }
  33. #include <linux/mm.h>
    9 o( ~" N  j/ b; s7 k( e0 m' {' o
  34. #include <linux/dma-mapping.h>
    ) U5 Z/ G$ {- n- k. O

  35. - A# c4 j& D* Q
  36. #include <mach/memory.h>1 g" ]! j5 `/ z- c
  37. #include <mach/hardware.h>2 G3 X- i3 |% n8 Z9 |) T) Q
  38. #include <mach/irqs.h>3 r( Z& F' r; a; U# e8 V
  39. #include <asm/hardware/edma.h>
    ' X# ^8 E; A7 u! p0 U7 U1 \" I1 n

  40. 6 P. l0 ~" i, ^( o1 @
  41. #undef EDMA3_DEBUG
    7 ]( t, B" p) i+ A6 v
  42. /*#define EDMA3_DEBUG*/5 i0 F6 r8 a4 S" {+ w

  43. 1 h) ~$ c- E2 d9 B- c( T7 Q4 `
  44. #ifdef EDMA3_DEBUG
    + f) `4 d4 p% T7 Y# Q' k
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    % |# T( h4 a& n2 s* e
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    % C3 \/ x( h; l1 C8 t
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    : ]; o$ d! i- H" P- O8 G3 h! e% A
  48. #else7 d1 V, [! ~" B8 E  i
  49. #define DMA_PRINTK( x... )5 z4 c- ?) m' Q4 H
  50. #define DMA_FN_IN" F% I8 V8 h9 N$ I
  51. #define DMA_FN_OUT
    - L7 w" F+ W) N$ G8 E7 G
  52. #endif
    3 |) G3 x2 ]9 T- g+ G7 }* \, K. Y) D

  53. 0 t) b, ]( x% y" c
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)/ T6 v1 A8 h* e( V* F4 j
  55. #define STATIC_SHIFT                3# O) K- }/ E+ c+ r
  56. #define TCINTEN_SHIFT               20
    - H( N) P2 z7 _7 F) F- n$ X- b
  57. #define ITCINTEN_SHIFT              21
    # f+ W+ t! R: C  R6 M
  58. #define TCCHEN_SHIFT                22
    ) f/ V8 `, f# f8 f7 D
  59. #define ITCCHEN_SHIFT               23
    5 p) x/ m9 Y; r0 t/ \$ ^

  60. 0 k8 n0 C" `9 K& ]; x5 E
  61. static volatile int irqraised1 = 0;
    ) U6 X1 h0 e& [
  62. static volatile int irqraised2 = 0;
    , X: f/ W- m/ v* C& v: U
  63. 1 l* V5 F0 d8 d. d% ~
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " W( b6 u& p5 p  b# z. ]
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ H- P( ^7 S. {. z. j% q
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) b* O$ c- v' {1 v! d+ o+ ^# j( e! A

  67. * ]1 c& K# k: N" M8 L  R
  68. dma_addr_t dmaphyssrc1 = 0;6 G2 B. l' D0 @: S# [+ Y
  69. dma_addr_t dmaphyssrc2 = 0;' R* z! Q; v$ J9 r6 i, ]
  70. dma_addr_t dmaphysdest1 = 0;% D& R; |( T4 Z& V  \6 k
  71. dma_addr_t dmaphysdest2 = 0;: R" K* ]9 W' v

  72. ! k' r8 D. H7 k5 I" T
  73. char *dmabufsrc1 = NULL;1 @; U: \, ^5 p$ b: }
  74. char *dmabufsrc2 = NULL;
    $ b$ w, w, a# o/ M9 L+ @- G6 g
  75. char *dmabufdest1 = NULL;
    ) n8 }, {6 {- d# u* N% d
  76. char *dmabufdest2 = NULL;
    1 E0 u6 N9 X  c" D( h
  77. 5 L$ @/ {* w1 ]# N7 r. {4 _2 X
  78. static int acnt = 512;$ r" k# A& H6 E, i7 \
  79. static int bcnt = 8;
    ! J0 ?3 B' U4 m, B; i1 T8 w
  80. static int ccnt = 8;
    ) i; `/ d6 K& @  ^. i
  81. 7 A$ Q) M  x, L; f# X
  82. module_param(acnt, int, S_IRUGO);! w4 Z* Z9 v! r( R* B
  83. module_param(bcnt, int, S_IRUGO);
    & i, D1 d6 I/ l
  84. module_param(ccnt, int, S_IRUGO);
复制代码

) w& d, h* w! B0 \
3 z- S/ u8 x- e6 a      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! [* J( `& I6 K8 }- X  Y( p
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
) T& z$ G1 i' P1 L4 @- ^+ b2 S     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 ?8 p5 o0 N; D& b) C( w- y: X! B) m% e' C  ~  U7 r
8 ]! k9 x: K7 K$ ?% [
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-24 22:32 , Processed in 0.038606 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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