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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
2 L; [/ Z+ E- \( p0 V
  1. [code]EDMA sample test application
    5 H; X. I* D) ~( `1 K  K
  2. /*
    8 Z& I$ \4 J3 T# n, A0 M
  3. * edma_test.c
    . X6 j  c! ]: q/ y) L
  4. *! L4 X6 ~( K: D
  5. * brief  EDMA3 Test Application+ g( d9 [/ ~8 q$ u0 q6 e1 a* y8 `
  6. *2 o8 u. D  ]# n6 |
  7. *   This file contains EDMA3 Test code.
    6 p3 H" q9 J0 T% M8 ^
  8. *
    ! ?+ k3 ?# M1 j1 P. M" }" _( y9 R
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) j( I. [% e! c; Y% ~+ [; E
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    : ]9 Q9 @! g7 j$ y1 \( }) M! M
  11. *         TO CHANGE.; D7 p- s* t' h6 K- a6 D- [
  12. *
    + f6 k% Z! o* @
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ L& H, A: d# s" Q1 i  C
  14. *9 f! {6 _; Y( w3 _
  15. * This program is free software; you can redistribute it and/or6 M' s! ^) u) i  r! @
  16. * modify it under the terms of the GNU General Public License as7 {5 X% A( J5 {8 z* ]9 Q, Z
  17. * published by the Free Software Foundation version 2.( W- X' L( I% y, {1 G$ n) h
  18. *4 l! e9 e1 {" F# |
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 ^7 }$ ]3 N" i" @
  20. * kind, whether express or implied; without even the implied warranty! u/ U- U5 z0 W, ]0 E
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    . y0 k5 Y) ?: |. D5 n
  22. * GNU General Public License for more details.$ @* |9 q) F7 ]2 x$ u" x+ k9 l3 u
  23. */0 U+ K0 E3 V" Z9 K- H: L

  24. # E, R$ H' f+ K# P
  25. #include <linux/module.h>
    5 j( E  L  o  I
  26. #include <linux/init.h>
    ) ]/ r6 M  Y; o* A' N6 x6 r# G3 F
  27. #include <linux/errno.h>% X4 q- {  {- |* x; K# L5 t) c; k
  28. #include <linux/types.h>5 `. B, Y! }' ?: U( u  Q" x
  29. #include <linux/interrupt.h>
    - E' U3 [& R4 A5 u, d
  30. #include <asm/io.h>
    7 x3 P# e6 U2 @+ @7 q% M2 O# c* c
  31. #include <linux/moduleparam.h>% ?; p- J4 I1 ?8 S
  32. #include <linux/sysctl.h>8 O4 L# N9 n3 K9 l
  33. #include <linux/mm.h>
    : M: ^& T2 i% A: ^+ w9 `" ?; @
  34. #include <linux/dma-mapping.h>9 H" H+ t1 Q3 o- E" Y& P
  35. 3 z4 Y# P# e7 `7 f: j% b! W+ q
  36. #include <mach/memory.h>: a2 `0 M- w- J3 t+ o
  37. #include <mach/hardware.h>+ ^& d, Q2 \$ |+ e2 A( i
  38. #include <mach/irqs.h>  K; N1 k2 n- D! l
  39. #include <asm/hardware/edma.h>8 T9 x6 ~6 c( a7 d

  40. ( {6 S0 R! a/ T* h$ P# U: U7 o
  41. #undef EDMA3_DEBUG
    . q, o  E* k! C/ f4 j* n$ e
  42. /*#define EDMA3_DEBUG*/$ A( D9 w: a# \" z( j1 ?

  43. 4 e! t3 u, L2 J" q; F% l
  44. #ifdef EDMA3_DEBUG
    3 E) w9 C8 z1 N3 l: k
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    + i( c- I: w' O) O  Z( g
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    + R2 A& l4 |* r2 `6 A
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
      k* K  |! z* r' K
  48. #else
    . D! G% K( H' q% d
  49. #define DMA_PRINTK( x... )" M' A7 a6 U) p  j- ~6 r
  50. #define DMA_FN_IN: w, X$ o% J6 \+ E7 }
  51. #define DMA_FN_OUT. q7 i3 k2 |- ]3 a* h# _6 W
  52. #endif
    & Q" ]1 t1 Z1 I# L, H0 F/ ]. s
  53. ! x/ a' l: D1 G* v& J0 B, }  ~+ r
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ' Q8 y8 W- l$ d
  55. #define STATIC_SHIFT                30 J! [! Z( p, I7 O1 }
  56. #define TCINTEN_SHIFT               20
    % ]% u6 {  u" j$ P1 Y* H8 L: m
  57. #define ITCINTEN_SHIFT              215 L# X: ^* P2 e7 j
  58. #define TCCHEN_SHIFT                22
    ' S# h' f4 B5 `( G
  59. #define ITCCHEN_SHIFT               23+ y2 s* ?- X  C( q4 N' K) `
  60. 4 f6 M% F& c# [, `# Q
  61. static volatile int irqraised1 = 0;+ X( `8 ?, z! i) m) |4 L
  62. static volatile int irqraised2 = 0;) g  h! P/ ^  v6 R

  63. / w: Y' M( A! q( A* i
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 S' s6 d7 o) U5 V/ ]# z
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 U' @( z4 p8 Y' H( U! u
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . P( P5 \$ j8 [. J+ p

  67. / t# [- ]$ m: k: m' [% D0 c, f. ]- p
  68. dma_addr_t dmaphyssrc1 = 0;
    2 ^7 o; ?  V3 Z1 R' y2 L( o
  69. dma_addr_t dmaphyssrc2 = 0;
    6 V6 t; J$ T) Q( X
  70. dma_addr_t dmaphysdest1 = 0;
    : `; E9 J' f. L
  71. dma_addr_t dmaphysdest2 = 0;3 p, j/ G3 `: L) |/ `: l

  72. . M4 I1 ~) o$ U0 q
  73. char *dmabufsrc1 = NULL;# E/ V2 z6 q5 f  S5 U2 G0 R2 a
  74. char *dmabufsrc2 = NULL;
    3 P" s, S  n3 a7 l& g  u0 m
  75. char *dmabufdest1 = NULL;3 y, @9 u0 r% T4 f% ~( {
  76. char *dmabufdest2 = NULL;, [9 k% p, q" Q- z# r$ i

  77. 1 ?7 H3 Z# h1 [0 A5 Q; p
  78. static int acnt = 512;  L) A' m. C3 ?/ }! v" Q8 N2 Q( k
  79. static int bcnt = 8;% E5 j, X, o* g
  80. static int ccnt = 8;
    . l5 z0 W* m, B" A5 w" K. f" i0 T
  81. / r% z8 N  r6 K( c' G$ P* T( `7 s
  82. module_param(acnt, int, S_IRUGO);/ M+ @# M$ j- W3 `2 w" I
  83. module_param(bcnt, int, S_IRUGO);
    9 w0 V" o: y3 V4 C7 [' T/ D1 x, v. {# ]7 S- p
  84. module_param(ccnt, int, S_IRUGO);
复制代码

7 U! g9 o' {7 r
: y4 {& |) P, u2 q, c1 @3 f' B      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用9 C5 c1 J8 d9 C+ p2 m+ o
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) s% V5 }4 v, {# |: v
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' H! h! L* Y" n3 }/ F3 o
7 _. ~' E4 x* c. m: j
, l' L# L" K7 y, R# O2 |% W
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-31 14:57 , Processed in 0.040386 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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