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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( i, ?8 I) W4 ]* o3 _
  1. [code]EDMA sample test application
    , ]& H" O: o/ P2 a
  2. /*
    - z/ f( }6 L4 _8 v
  3. * edma_test.c
    " ]2 P! K& h3 R6 q
  4. *
    8 F4 ^1 N9 h/ S( g% X2 |- Q: U/ A
  5. * brief  EDMA3 Test Application* c7 V+ N0 }# y2 j* |$ J
  6. *
      }3 V, N: m, M
  7. *   This file contains EDMA3 Test code.
    , U3 H9 K' B& J& n: O
  8. *
    $ o9 s, ^9 _5 s$ [3 B0 v
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
      K- e$ F( q! }# E5 s
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT  X' N* S( `- Y/ N! r0 h
  11. *         TO CHANGE.
    ) R' `% G; K6 W5 {% d* j
  12. *; R& }2 r+ q2 A9 ]7 |
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* [% r8 T8 o; Z# ^8 s6 J( B! @
  14. *9 b- F# y; `# ]1 `
  15. * This program is free software; you can redistribute it and/or, Y' f: E4 }) e( J+ H2 W" d
  16. * modify it under the terms of the GNU General Public License as5 w% O: s  ^) |9 X( l( u2 l% T' X: }
  17. * published by the Free Software Foundation version 2.
    ' e- p" @: a0 i8 M+ g: k& t+ n
  18. *& q9 K. r# l) I- a
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ( @1 F& k! O& ]  F' P( T
  20. * kind, whether express or implied; without even the implied warranty% O8 I: }" i8 |7 F1 I' d
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    9 o% s$ p' F: Y9 t* ~0 C! ?
  22. * GNU General Public License for more details.
    ; T; A0 ^8 u4 c2 {; Y7 Y; r
  23. */) j+ d1 E% t. i9 D. {7 @# o+ T1 b

  24. 8 H9 k, l/ v/ N* a% B7 p
  25. #include <linux/module.h>
      P4 n9 U# L. k6 }0 Q
  26. #include <linux/init.h>0 X$ j0 \/ b3 K6 v
  27. #include <linux/errno.h>) Y# I$ S7 _9 }/ \
  28. #include <linux/types.h>
    0 r2 ?0 L3 Z7 s
  29. #include <linux/interrupt.h>4 P9 k8 w: D9 b' n
  30. #include <asm/io.h>; D6 z; M, u- p  K0 o
  31. #include <linux/moduleparam.h>+ _% B9 N! s+ J1 E$ q/ d
  32. #include <linux/sysctl.h>6 l9 Z, j- ?& {5 T9 ^
  33. #include <linux/mm.h>
    5 _" M; L' o3 z) g7 E9 N
  34. #include <linux/dma-mapping.h>8 d3 A7 T4 Y# i. U: ?- @8 j

  35. & d7 }! k- w5 ~4 n9 E& J% S/ t5 m
  36. #include <mach/memory.h>; O+ {/ V. t  f. ^$ ~/ c8 T1 Y
  37. #include <mach/hardware.h>
    / T, R( o6 a5 {' n- f. v
  38. #include <mach/irqs.h>
      r  T# R0 S1 H. c5 i7 S8 _& u
  39. #include <asm/hardware/edma.h>
    # y2 |) z# k, w; C, U8 C( A  c+ V

  40. 5 v) U- `+ p# r
  41. #undef EDMA3_DEBUG
    + r' g- s% F2 K' _- |
  42. /*#define EDMA3_DEBUG*/
    . U' e! {* }, s1 @! ^! w9 t4 Q
  43. 8 |9 K8 J" G* D. D( K
  44. #ifdef EDMA3_DEBUG
    7 e( H1 {. N7 Y, P6 I
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ {; N2 }: F) `2 K7 c* {
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    # P8 X3 m/ X; M" a8 n. M
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    / p! J0 V9 L& w
  48. #else2 \9 q! I0 r9 d7 S
  49. #define DMA_PRINTK( x... )
      B' N+ H3 E6 I" W* k: R( E, S
  50. #define DMA_FN_IN
    5 Y" a2 T  @' e/ W
  51. #define DMA_FN_OUT
    * o/ D+ b% ^) K# A3 G  T$ T
  52. #endif8 o$ ]- M0 k0 t8 j1 T# S

  53. + P5 ^/ g; l! E( e" L& k$ |' I% y' H
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)" k; l7 h& Z5 T) K/ h7 {: Z4 `
  55. #define STATIC_SHIFT                3
    ( P! ~" x1 ?  p  o2 P. z9 I8 F
  56. #define TCINTEN_SHIFT               200 z4 r6 J" x! q
  57. #define ITCINTEN_SHIFT              21
    3 d5 y# e5 f6 J
  58. #define TCCHEN_SHIFT                22
    ( Q2 F& ^' D+ P5 G( e
  59. #define ITCCHEN_SHIFT               231 x4 t3 O- R9 x* y
  60. 8 O( l! Y# b9 b# [2 h
  61. static volatile int irqraised1 = 0;: l( p* ~  f7 O7 T
  62. static volatile int irqraised2 = 0;# g( `; r& X, `6 Q* H2 `
  63. * F. V. F4 Z% t% U* h, T
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( c; P2 N! {! }2 p  b
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- ^0 M3 y' P* p; E- s# O! k) w; o
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: b% {& J1 S& [
  67. ! g! o; Z: K  T
  68. dma_addr_t dmaphyssrc1 = 0;
    9 L# t6 u/ O' _5 M% [
  69. dma_addr_t dmaphyssrc2 = 0;
    " ~/ W9 j' v' K  w
  70. dma_addr_t dmaphysdest1 = 0;& a5 O9 X! g; Y, N
  71. dma_addr_t dmaphysdest2 = 0;& H7 L3 j0 c) r; E2 v3 O
  72. 0 [: }7 v5 D" U0 ^$ S( ]3 U& I0 H
  73. char *dmabufsrc1 = NULL;
    " h) u6 i+ {) x0 n# e; Y7 Y  b% Y
  74. char *dmabufsrc2 = NULL;' u# j4 O. f$ }
  75. char *dmabufdest1 = NULL;
    * [/ W5 T0 q6 h! p, x5 Q
  76. char *dmabufdest2 = NULL;
    & `8 ^/ m2 [# ~

  77. - h5 s8 v- h1 G/ V& z/ w4 n! ^
  78. static int acnt = 512;
    ) Q+ j, N: ]8 E9 a; C" ~
  79. static int bcnt = 8;$ V! }% j0 @0 z" i# c& Z
  80. static int ccnt = 8;
    $ b3 D  o& d$ V* a9 F; I
  81.   d3 B! c1 n9 m1 o) K
  82. module_param(acnt, int, S_IRUGO);2 D8 \7 D3 C. @  l
  83. module_param(bcnt, int, S_IRUGO);. a: ~3 G" g1 ~) {
  84. module_param(ccnt, int, S_IRUGO);
复制代码
+ y& f; K3 m  q- l  _2 r

4 M3 l6 Y& G$ c0 @5 }      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 B$ a! o6 L: O  Z( Q8 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。  k7 G# ~. h% ~. t# R8 r, X
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ e2 W. i; B! K# }# s  Q5 Q& R

+ M  Q' z5 E" S6 F. b" k7 c4 U9 z' F2 m1 U: E* j+ {
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-23 13:24 , Processed in 0.040112 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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